Author Topic: Encounters restarting when re-entering the area  (Read 510 times)

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
Encounters restarting when re-entering the area
« on: August 09, 2013, 07:20:02 pm »


               I would like the monsters defeated to respawn not after some fixed period of time but after a player re-enters the area. 

It would be easy to do with normal creatures, but I want the opponents to scale, and thus, the encounter is the best (or only) way to spawn them.

Is it possible to do so? Maybe, for example, there is a way of setting encounter's respawn time left to 0 when player enters the area?

Thanks for help.
               
               

               
            

Legacy_Tolkiens Padawan

  • Jr. Member
  • **
  • Posts: 60
  • Karma: +0/-0
Encounters restarting when re-entering the area
« Reply #1 on: August 09, 2013, 07:59:29 pm »


               It's absolutely possible. Make a script like this and set in in onenter of the (otherwise regular) encounter that covers the relevant area:

void main()
{
object oPC = GetEnteringObject();
if(GetIsPC(oPC)
 {
 if(GetLocalInt(OBJECT_SELF,"MONSTERLEVEL") == 0)
  {
  CreateObject(OBJECT_TYPE_CREATURE,"enter-low-level-creature-resref-here"),GetLocation(GetWaypointByTag("enter-waypoint-tag-here")));
   //repeat this if you want more than one creature
  }
 else if(GetLocalInt(OBJECT_SELF,"MONSTERLEVEL") == 1)
  {
 
CreateObject(OBJECT_TYPE_CREATURE,"enter-next-level-creature-resref-here"),GetLocation(GetWaypointByTag("enter-waypoint-tag-here")));
   //repeat this if you want more than one creature
  }
//go on with more else ifs for every monsterlevel you want to have

//At the end we make sure next time the next level is activated:
 SetLocalInt(OBJECT_SELF,"MONSTERLEVEL",GetLocalInt(OBJECT_SELF,"MONSTERLEVEL")+1);
 }
else return;
}


               
               

               


                     Modifié par Tolkiens Padawan, 09 août 2013 - 07:01 .
                     
                  


            

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
Encounters restarting when re-entering the area
« Reply #2 on: August 09, 2013, 08:18:36 pm »


               Thanks. '<img'>