Vector Posted December 27, 2019 Posted December 27, 2019 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! Quote
0 sader1992 Posted December 28, 2019 Posted December 28, 2019 (edited) 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 December 28, 2019 by sader1992 1 Quote
Question
Vector
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!
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.