My aplologies. I was tired and forgot to assign the last two lines to the area. This should work:
void JailPCIfInArea(object oArea, object oWaypoint)
{
object oPC = GetFirstPC();
while (GetIsObjectValid(oPC))
{
if (GetArea(oPC) == oArea)
AssignCommand(oPC, ActionJumpToObject(oWaypoint));
oPC = GetNextPC();
}
}
void main()
{
//Get Killer.
object oKiller = GetLastKiller();
//Get the master of the killer.
object oMaster = GetMaster(oKiller);
//Get the area.
object oArea = GetArea(OBJECT_SELF);
//If the killer has a master then the killer is a familiar, henchman, etc..
//If so then change the master to the killer.
if (GetIsObjectValid(oMaster)) oKiller = oMaster;
//If the killer is not a player then end.
if (!GetIsPC(oKiller)) return;
//Build a string to announce who killed self.
string sKiller = GetName(oKiller) + " has just slain the big bad monster.";
//Get the object that will SHOUT message to server. Change tag to match yours.
object oShouter = GetObjectByTag("Tag of module shouter");
//Assign command to the shouter to shout out the above message.
AssignCommand(oShouter, ActionSpeakString(sKiller, TALKVOLUME_SHOUT));
//If your server does not allow shouting you will have to do a loop to send the
//message to all the players.
//Loop through all the party members of the killer and give XP.
object oMember = GetFirstFactionMember(oKiller);
while (GetIsObjectValid(oMember))
{
GiveXPToCreature(oMember, 500);//Change amount of XP to give.
oMember = GetNextFactionMember(oKiller);
}
//Get location of the waypoint where we will spawn portal in at. Enter correct tag.
location lLoc = GetLocation(GetWaypointByTag("Tag of WP here"));
//Create the portal at the location of a WP. Enter your portals res ref.
object oPortal = CreateObject(OBJECT_TYPE_PLACEABLE, "res ref of portal", lLoc);
//Get the WP in the jail that the players will jump to if sent. Enter correct tag.
object oJailWP = GetWaypointByTag("Tag of jail WP here");
//If players are still in the area at delay then call function above and jump
//them to a jail WP. Delay is currently 120 seconds
AssignCommand(oArea, DelayCommand(120.0, JailPCIfInArea(oArea, oJailWP))
);
//Destroy the portal after the same amount of time as jail jump.
//Delay is currently 120 seconds
AssignCommand(oArea, DelayCommand(120.0, DestroyObject(oPortal))
);
}
Modifié par GhostOfGod, 02 novembre 2010 - 01:07 .