Jump to content
  • 0

Evil Clone Event Script - Help-me


feehcarvalhoce

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   0
  • Joined:  05/12/16
  • Last Seen:  

Hi Friends, I need support, I'm putting together a custom event, where the NPC summons a clone to fight against the player who summoned it, I wanted to insert a condition that if he kills the clone, he is teleported to another map, and if he dies the clone also dies, could you help me?

I've been trying alone for days, but I can't 😞

 

Here's the script:

prt_fild01,76,171,5    script    Kelly    4_F_KHELLY,{
    OnInit:
        mes "[NPC Challenge]";
        mes "Hello, adventurer. Are you ready for the next test?";
        next;
        mes "[NPC Challenge]";
        mes "To pass this test, you will have to face your greatest weakness: yourself.";
        next;
        mes "[NPC Challenge]";
        mes "Now, get ready...";
        next;
        mes "[NPC Challenge]";
        mes "I have summoned a shadowy clone of you. Only you can see it and defeat it.";
        next;
        mes "[NPC Challenge]";
        mes "Defeat your own clone to pass this challenge.";
        next;
        
        // Get the name of the player interacting with the NPC
        set .@player_name$, strcharinfo(0);
        
        // Check if the player has already defeated the shadow clone
        if (getcharid(0, "ShadowClone_Slain") == 1) {
            mes "[NPC Challenge]";
            mes "Congratulations! You have already defeated your own clone.";
            close;
        }
        
        // Call the @clone command to summon the shadow clone
        clone "anrydrago", 76, 171, "@EvilClone_Event_" + .@player_name$, getcharid(0), 0, 0;
        
        close;
        
    OnEvilClone_Event:
        mes "[Shadow Clone Event]";
        mes "You have defeated your own clone. Congratulations!";
        next;
        
        // Mark that the player has slain the shadow clone
        setcharid(0, "ShadowClone_Slain", 1);
        
        // Teleport the player to Prontera
        warp "prontera", 150, 150;
        
        close;
}

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  212
  • Reputation:   93
  • Joined:  06/02/12
  • Last Seen:  

Hi. Your clone command is setting the event label in a incorret way. getcharid and setcharid are also showing errors. The remaining code is fine.

You can use OnPCDieEvent to trigger the clone death when the player dies.

Check the script below. Feel free to ask anything about it.

prt_fild01,76,171,5	script	Kelly	4_F_KHELLY,{
		// Check if the player has already defeated the shadow clone
		if (ShadowClone_Slain == 1) {
			mes "[NPC Challenge]";
			mes "Congratulations! You have already defeated your own clone.";
			close;
		}
		
		// Check if the player is fighting the shadow clone
		if (unitexists(ShadowClone_Slain)) {
			npctalk "Defeat your own clone to pass this challenge.", strnpcinfo(0), bc_self;
			end;
		}
		
		mes "[NPC Challenge]";
		mes "Hello, adventurer. Are you ready for the next test?";
		next;
		mes "[NPC Challenge]";
		mes "To pass this test, you will have to face your greatest weakness: yourself.";
		next;
		mes "[NPC Challenge]";
		mes "Now, get ready...";
		next;
		mes "[NPC Challenge]";
		mes "I have summoned a shadowy clone of you. Only you can see it and defeat it.";
		next;
		mes "[NPC Challenge]";
		mes "Defeat your own clone to pass this challenge.";
		close2;
		// Get the name of the player interacting with the NPC
		set .@player_name$, strcharinfo(0);
		
		// Call the @clone command to summon the shadow clone
		ShadowClone_Slain = clone("anrydrago", 76, 171, strnpcinfo(0) + "::OnEvilClone_Event", getcharid(0), 0, 0);
		
		end;

OnEvilClone_Event:
	if (playerattached() == 0)
		end;
	if (killedgid != ShadowClone_Slain)
		end;
	mes "[Shadow Clone Event]";
	mes "You have defeated your own clone. Congratulations!";
	next;

	// Mark that the player has slain the shadow clone
	//setcharid(0, "ShadowClone_Slain", 1);
	ShadowClone_Slain = 1;
	
	// Teleport the player to Prontera
	warp "prontera", 150, 150;
	
	close;

OnPCDieEvent:
	if (strcharinfo(3) == strnpcinfo(4) && ShadowClone_Slain > 1 && unitexists(ShadowClone_Slain)) {
		unitkill ShadowClone_Slain;
		ShadowClone_Slain = 0;
		announce strnpcinfo(1) + " : The clone defeated you...", bc_self;
	}
	end;
}

 

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   0
  • Joined:  05/12/16
  • Last Seen:  

First of all, thank you very much for your attention and help. The script works normally, the only problem is that it doesn't teleport to the ready when it kills the clone.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   0
  • Joined:  05/12/16
  • Last Seen:  

@RacaaHow do I teleport the player to Prontera as soon as he kills the clone?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   0
  • Joined:  05/12/16
  • Last Seen:  

20 hours ago, Racaae said:

Hi. Your clone command is setting the event label in a incorret way. getcharid and setcharid are also showing errors. The remaining code is fine.

You can use OnPCDieEvent to trigger the clone death when the player dies.

Check the script below. Feel free to ask anything about it.

prt_fild01,76,171,5	script	Kelly	4_F_KHELLY,{
		// Check if the player has already defeated the shadow clone
		if (ShadowClone_Slain == 1) {
			mes "[NPC Challenge]";
			mes "Congratulations! You have already defeated your own clone.";
			close;
		}
		
		// Check if the player is fighting the shadow clone
		if (unitexists(ShadowClone_Slain)) {
			npctalk "Defeat your own clone to pass this challenge.", strnpcinfo(0), bc_self;
			end;
		}
		
		mes "[NPC Challenge]";
		mes "Hello, adventurer. Are you ready for the next test?";
		next;
		mes "[NPC Challenge]";
		mes "To pass this test, you will have to face your greatest weakness: yourself.";
		next;
		mes "[NPC Challenge]";
		mes "Now, get ready...";
		next;
		mes "[NPC Challenge]";
		mes "I have summoned a shadowy clone of you. Only you can see it and defeat it.";
		next;
		mes "[NPC Challenge]";
		mes "Defeat your own clone to pass this challenge.";
		close2;
		// Get the name of the player interacting with the NPC
		set .@player_name$, strcharinfo(0);
		
		// Call the @clone command to summon the shadow clone
		ShadowClone_Slain = clone("anrydrago", 76, 171, strnpcinfo(0) + "::OnEvilClone_Event", getcharid(0), 0, 0);
		
		end;

OnEvilClone_Event:
	if (playerattached() == 0)
		end;
	if (killedgid != ShadowClone_Slain)
		end;
	mes "[Shadow Clone Event]";
	mes "You have defeated your own clone. Congratulations!";
	next;

	// Mark that the player has slain the shadow clone
	//setcharid(0, "ShadowClone_Slain", 1);
	ShadowClone_Slain = 1;
	
	// Teleport the player to Prontera
	warp "prontera", 150, 150;
	
	close;

OnPCDieEvent:
	if (strcharinfo(3) == strnpcinfo(4) && ShadowClone_Slain > 1 && unitexists(ShadowClone_Slain)) {
		unitkill ShadowClone_Slain;
		ShadowClone_Slain = 0;
		announce strnpcinfo(1) + " : The clone defeated you...", bc_self;
	}
	end;
}

 

@Racaae , I even tried to fix the part that isn't reading the marking or the warp.

Script:

 

OnEvilClone_Event:
    if (killedgid != ShadowClone_Slain) end; // Checks if the killed monster is the correct clone

    // Marks that the player has defeated the shadow clone
    set ShadowClone_Slain, 0;

    // Warps the player to Prontera
    warp "prontera", 150, 150;

    // Announces congratulations to the player
    announce "Congratulations, " + strcharinfo(0) + "! You have defeated your own clone.", bc_self;

    end;

Edited by feehcarvalhoce
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  212
  • Reputation:   93
  • Joined:  06/02/12
  • Last Seen:  

2 hours ago, feehcarvalhoce said:

@Racaae , I even tried to fix the part that isn't reading the marking or the warp.

Script:

 

OnEvilClone_Event:
    if (killedgid != ShadowClone_Slain) end; // Checks if the killed monster is the correct clone

    // Marks that the player has defeated the shadow clone
    set ShadowClone_Slain, 0;

    // Warps the player to Prontera
    warp "prontera", 150, 150;

    // Announces congratulations to the player
    announce "Congratulations, " + strcharinfo(0) + "! You have defeated your own clone.", bc_self;

    end;

I get warped and the announce just fine.
ShadowClone_Slain should be 1.
Remove the whole killedgid line, it is most likely the cause of your error.

 

ShadowClone_Slain = 0 //challenge not completed

ShadowClone_Slain = XXXXXXX //challenge ongoing

ShadowClone_Slain = 1 //challenge completed

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   0
  • Joined:  05/12/16
  • Last Seen:  

46 minutes ago, Racaae said:

I get warped and the announce just fine.
ShadowClone_Slain should be 1.
Remove the whole killedgid line, it is most likely the cause of your error.

 

ShadowClone_Slain = 0 //challenge not completed

ShadowClone_Slain = XXXXXXX //challenge ongoing

ShadowClone_Slain = 1 //challenge completed

 

I arrived to change it but it doesn't give a set and doesn't even recognize that I killed it, I can repeat it as many times as I want and it still doesn't teleport 😞

 

OnEvilClone_Event:
    // Remove the line that checks the killed monster's ID
    // if (killedgid != ShadowClone_Slain) end;

    // Marks that the player has defeated the shadow clone
    set ShadowClone_Slain, 1;

    // Warps the player to Prontera
    warp "prontera", 150, 150;

    // Announces congratulations to the player
    announce "Congratulations, " + strcharinfo(0) + "! You have defeated your own clone.", bc_self;

    end;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...