Author Topic: Camping Script  (Read 791 times)

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Camping Script
« on: October 31, 2010, 11:03:27 am »


               Hi all,

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.
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Camping Script
« Reply #1 on: November 01, 2010, 04:57:17 am »


               I'm about ready to "Hit the Hay" and haven't tested this so it might not work but pretty sure it will.


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.
               
               

               
            

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Camping Script
« Reply #2 on: November 01, 2010, 08:36:23 pm »


               Ok script works but does not send to jail or destroy portal
               
               

               
            

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Camping Script
« Reply #3 on: November 02, 2010, 12:03:52 am »


               Can anyone please help this is driving me nuts.
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Camping Script
« Reply #4 on: November 02, 2010, 01:04:00 am »


               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 .
                     
                  


            

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Camping Script
« Reply #5 on: November 09, 2010, 10:40:31 pm »


               Just the job, works great ty. sry for late reply been so busy. :-)
               
               

               
            

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Camping Script
« Reply #6 on: November 29, 2010, 09:37:33 pm »


               Anyway this script can give xp only to party members in certain areas. maybe restrict it so if in certain areas no xp ?
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Camping Script
« Reply #7 on: November 30, 2010, 04:08:19 am »


               Something like 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))
    {
    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)));
}


               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Camping Script
« Reply #8 on: November 30, 2010, 01:09:28 pm »


               I started having to come up with some -anti-camping scripts last year when I ran Worlds of Rhun.



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.
               
               

               
            

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Camping Script
« Reply #9 on: November 30, 2010, 08:02:03 pm »


               Thanks Ghost '<img'>
               
               

               


                     Modifié par Madasahatter, 30 novembre 2010 - 08:02 .
                     
                  


            

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Camping Script
« Reply #10 on: December 01, 2010, 10:09:53 pm »


               another request, can this script be altered to delay 600 seconds then shout Boss has respawned.
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Camping Script
« Reply #11 on: December 01, 2010, 11:01:33 pm »


               You could but it'd probably be better just to do it when the Boss actually spawns using it's OnSpawn event.
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:

string sMessage = "The Boss Has Respawned!";
AssignCommand(oShouter, DelayCommand(600.0, ActionSpeakString(sMessage, TALKVOLUME_SHOUT));

Or if you add this to the OnSpawn script of the boss then maybe something like so added:

object oShouter = GetObjectByTag("Tag of your shouter here");
string sMessage = "The Boss Has Respawned";
AssignCommand(oShouter, DelayCommand(600.0, ActionSpeakString(sMessage, TALKVOLUME_SHOUT));

Hope that helps.
               
               

               


                     Modifié par GhostOfGod, 01 décembre 2010 - 11:03 .
                     
                  


            

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Camping Script
« Reply #12 on: December 01, 2010, 11:05:48 pm »


               I figured it it out



Thanks  Ghost