Author Topic: Creature Spawn toggle  (Read 368 times)

Legacy_Snottling

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
Creature Spawn toggle
« on: September 12, 2012, 05:38:01 pm »


               Hey guys!
I was wondering if it's possiple for a DM to toggle creature spawns on/off in an entire area with, say, a DM wand?
What scripts would I need?

Thanks,
-Snottling
               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Creature Spawn toggle
« Reply #1 on: September 13, 2012, 02:00:06 am »


               Do you use standard encounters or a custom spawner? In the first case you could loop over the area triggers and set them to active/inactive with a few lines of code. In the second case, spawners often check a variable set on the area, so you could set the variable accordingly to start/stop the spawner. Only suggestions, I can't really say more without having more details...


Kato
               
               

               


                     Modifié par Kato_Yang, 13 septembre 2012 - 01:19 .
                     
                  


            

Legacy_Snottling

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
Creature Spawn toggle
« Reply #2 on: September 13, 2012, 03:48:04 am »


               Ah yes, I use standard BioWare encounter triggers. I envision using the DM wand on the ground in an area, and via dialogue (DMFI-style) I would be able to toggle the encounters off and on.
Does that sound possible?

-Snottling
               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Creature Spawn toggle
« Reply #3 on: September 13, 2012, 04:10:34 am »


               void SetAreaSpawning(object oArea, int bSpawning) // pass true or false to bSpawning
{
   object oEnc = GetFirstObjectInArea(oArea);
   while(oEnc != OBJECT_INVALID)
   {
      if(GetObjectType(oEnc) == OBJECT_TYPE_ENCOUNTER) SetEncounterActive(bSpawning, oEnc);
      oEnc = GetNextObjectInArea(oArea);
   }
}

The function is generic, thus it could be called from anywhere provided that the correct parameters are passed, and it also assumes that the check to see if user is a DM is performed in the client code.

Note: If your triggers follow a tagging convention you could alternatively retrieve them with GetObjectByTag() for better efficiency(i.e. ENC_ + <Area tag> for instance). 


Kato
               
               

               


                     Modifié par Kato_Yang, 13 septembre 2012 - 03:29 .
                     
                  


            

Legacy_Snottling

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
Creature Spawn toggle
« Reply #4 on: September 13, 2012, 09:53:05 am »


               Thanks a lot! I'll try it out as soon as possible.
               
               

               
            

Legacy_Snottling

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
Creature Spawn toggle
« Reply #5 on: September 14, 2012, 12:56:45 pm »


               Works perfectly. Thanks Kato.