How to use a variable with spawn eggs.

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Status
Not open for further replies.

Bethins

Member
May 27, 2017
4
1
3
Skript Version: 2.5.1
Minecraft: Paper 1.15.2

I want this...
Code:
on damage:
    set {_victim} to "%victim%"
    if attacker is holding Heart of the Sea named "Capture Container":
        cancel event
        if attacker has enough space for 1 %{_victim}% spawn egg named "Captured %{_victim}%":
            send "You have Captured the %{_victim}%!" to attacker
            teleport victim 100 meters below attacker
            give attacker %{_victim}% spawn egg named "Captured %{_victim}%"
            add 1 to {player.captured.%{_victim}%}
            send "You have captured %{player.captured.%{_victim}%}%!" to attacker
        else:
            send "You are out of space in your inventory!" to attacker


But it gives me errors and I can only get this to work but I'm not wanting to write code for every mob...

Code:
on damage:       
    if attacker is holding Heart of the Sea named "Capture Container":
        cancel event   
        if victim is bat:
            if attacker has enough space for 1 bat spawn egg named "Captured Bat":
                send "You have Captured the Bat!" to attacker
                teleport victim  100 meters below attacker
                give attacker bat spawn egg named "Captured Bat"
                add 1 to {player.captured.bat}
                send "You have captured %{player.captured.bat}% bats!" to attacker
            else:
                send "You are out of space in your inventory!" to attacker

The problem is with "bat spawn egg". It won't let me use a variable or even "victim" in place of "bat".

I'm sure I'm just having trouble with the syntax, its been a few years and skript has changed so much since then... I've been googling for a couple days but haven't found anything useful.

Thanks!
 
Status
Not open for further replies.