Could do something kinda like so:
void main()
{
float fDistance = 5.0;//distance to check
int iXP = 500;//xp to give if within distance
//To keep this script universal you could also set an integer variable on
//the creature and just use that as the amount of XP to give. Example:
//int iXP = GetLocalInt(OBJECT_SELF, "MY_DEATH_XP");
//You could also do the same thing with the float fDistance above by setting
//a float variable on the creature. Example:
//float fDistance = GetLocalFloat(OBJECT_SELF, "MY_XP_DIST");
location lDeath = GetLocation(OBJECT_SELF);
location lMember;
object oDeathArea = GetArea(OBJECT_SELF);
object oKiller = GetLastKiller();
if (GetMaster(oKiller) != OBJECT_INVALID)
oKiller = GetMaster(oKiller);
object oMember = GetFirstFactionMember(oKiller, TRUE);
while (GetIsObjectValid(oMember))
{
//Decided to go with distance between locations because I wasn't sure
//if the dead monster could still be considered a valid object to check.
lMember = GetLocation(oMember);
if (GetDistanceBetweenLocations(lDeath, lMember) <= fDistance &&
GetArea(oMember) == oDeathArea)
GiveXPToCreature(oMember, iXP);
oMember = GetNextFactionMember(oKiller, TRUE);
}
}
Modifié par GhostOfGod, 27 avril 2012 - 02:01 .