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;