Camping Script
#1
Posté 31 octobre 2010 - 11:03
Hear we go again,
Im in need of a script that will stop players camping after a boss kill, so on boss death shout who killed boss, give all party members in the boss area xp, spawn in a portal and after a set amount of time if players still in area send them all to jail.
#2
Posté 01 novembre 2010 - 04:57
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.
DelayCommand(120.0, JailPCIfInArea(oArea, oJailWP));//Delay is currently 120 seconds
//Destroy the portal after the same amount of time as jail jump.
DelayCommand(120.0, DestroyObject(oPortal));//Delay is currently 120 seconds
}
Hopefully that is what you needed. Good luck and I hope it works.
#3
Posté 01 novembre 2010 - 08:36
#4
Posté 02 novembre 2010 - 12:03
#5
Posté 02 novembre 2010 - 01:04
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 .
#6
Posté 09 novembre 2010 - 10:40
#7
Posté 29 novembre 2010 - 09:37
#8
Posté 30 novembre 2010 - 04:08
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))
{
object oMemberArea = GetArea(oMember);
if (oMemberArea == oArea)
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)));
}
#9
Posté 30 novembre 2010 - 01:09
I found that sending to Jail was sometimes not a good solution, because
1. There may be legit reasons for the player to be in that area
2. If they are an innocent player, and they get sent to jail, they may get a little p1$$ed and leave the server and not return.
To this end, I looked into creating scripts that tracked a players location, and the amount of time a player stayed in a specific location.
You could say that for every y minutes of real time that passes, the chances of a HIGH LEVEL anti-camp boss appearing, could increase by x amount.
eg -
Player enters area, they are in the area for 20 minutes, the system kicks in, increases the odds of the ANTI Camper Spawning in by 30%. (3/10 chance that one will spawn near to the players location)
If however one doesnt spawn, and another 20 minutes pass, it increases to 60%, 6/10 chance of ANTI Camper boss spawning.
In any case, it will eventually get to 100% where the boss will spawn with 100% certaintly, and the purpose of the boss, is to scare the b'Jebus out of the player.
It would be the PW Server hosts decision what type of creature to use as the ANTI - Camper creature.
But with tinkering, the system could
1. Spawn hordes of creatures to simulate packs of wild creatures (for outdoor areas)
2. Spawn Undead Creatures in crypts etc
3. Spawn one big nasty Demon
or whatever the host wants.
Note - I have none of the code infront of me, since im at work, but the system worked well in the past, and it usually fooled players into thinking that a DM was watching them, when all of a sudden a boss/demon appeared and tore them a new one.
#10
Posté 30 novembre 2010 - 08:02
Modifié par Madasahatter, 30 novembre 2010 - 08:02 .
#11
Posté 01 décembre 2010 - 10:09
#12
Posté 01 décembre 2010 - 11:01
If you are using a hidden creature or placeable to do the server shouting then just assign the command to that with a delay.
So in the above script you could just add 2 lines to the bottom like so:
Or if you add this to the OnSpawn script of the boss then maybe something like so added:string sMessage = "The Boss Has Respawned!";
AssignCommand(oShouter, DelayCommand(600.0, ActionSpeakString(sMessage, TALKVOLUME_SHOUT));
Hope that helps.object oShouter = GetObjectByTag("Tag of your shouter here");
string sMessage = "The Boss Has Respawned";
AssignCommand(oShouter, DelayCommand(600.0, ActionSpeakString(sMessage, TALKVOLUME_SHOUT));
Modifié par GhostOfGod, 01 décembre 2010 - 11:03 .
#13
Posté 01 décembre 2010 - 11:05
Thanks Ghost





Retour en haut







