Jump to content
  • 0

Script event when clone kills another clone


Vector

Question


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   0
  • Joined:  10/13/13
  • Last Seen:  

Hi rA!

I'm using the *clone script to generate clone for X users in map, they have a ::OnCloneDead event attached so my Question is:

There is a way to know what clone kills another clone?

Like: The [Player 1] clone kill [Player 2] clone.

Thanks in advance!

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

the clone command return the monster gid

so you can just save the gid and check for it

like 

.PlayerOneClone = clone("prontera",155,155,"NpcName::OnEvent",1);
.PlayerTwoClone = clone("prontera",145,145,"NpcName::OnEvent",2);
end;
OnEventOne:
	if(!unitexists(.PlayerOneClone)){
		//player one clone is dead
	}
	if(!unitexists(.PlayerTwoClone)){
		//player two clone is dead
	}
end;

 

also the event name, you can just use different event name for each clone

like

clone("prontera",155,155,"NpcName::OnEventOne",1);
clone("prontera",145,145,"NpcName::OnEventTwo",2);
end;
OnEventOne:
	//player one clone is dead
end;
OnEventTwo:
	//player two clone is dead
end;

 

 

here a long example :

let's clone everyone in prontera , than we check every time one of the mobs are dead we output a debugmes for the char id of the player

(i didn't test it , i just wrote it as an example , i don't know even if it will work but technically it should work)

	getmapunits(BL_NPC,"prontera",.@AID);
	for(.@i=0;.@i<getarraysize(.@AID);.@i++){
		.@s = getarraysize(.charList);
		.charList[.@s] = convertpcinfo(.@AID[.@i],CPC_CHAR);
		.mobList[.@s] = clone("prontera",155,155,"NpcName::OnEvent",.charList[.@s]);
	}
end;
OnEvent:
	for(.@i=0;.@i<getarraysize(.mobList);.@i++){
		if(.mobList[.@i] && !unitexists(.mobList[.@i])){
			//the monster has been found.
			
			//we save it.
			.@charID = .charList[.@i];
			.@mobID = .mobList[.@i];
			
			//we delete it from the array.
			deletearray .charList[.@i],1;
			deletearray .mobList[.@i],1;
			
			//we break out.
			break;
		}
	}
	
	//now we have the here .@charID = the player id , .@mobID = the monster gid
	debugmes "" + .@charID;
	debugmes "" + .@mobID;
	

 

Edited by sader1992
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   0
  • Joined:  10/13/13
  • Last Seen:  

Thanks, I'll test it

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...