Author Topic: Trigger that spawns monsters based on PC level and has a cooldown timer  (Read 316 times)

Legacy_scalyjake

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0


                Hey there! I've been desperately trying to figure out how to spawn monsters in an area based on the PC's level with a trigger.  Everything works great except I cannot figure out how to set a cooldown timer on the trigger.  I'm a little new at this so I'm not even sure if this is possible and I looked in to either putting a cooldown timer on the OnDeath handle of a monster but that doesn't fit what I want to do because I'm trying to save space by only having monsters spawn when someone is actually there.  I also looked into an encounter but that does not really do what I want either unless I'm missing something.  Thanks for the help and here's the code so far!

//Trigger for spawns in well: spawn_well//by scalyjake last modified 2/8/13void main(){object oPC=GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC);int nPCLevel=GetLevelByPosition(1, oPC);int nSpiIndex;int nCenIndex;object oSpawnTimer=GetObjectByTag("SPWNTMR");if (nPCLevel==1)    {    for (nSpiIndex=1; nSpiIndex<=15; nSpiIndex++)        {        location lSpawnSpi=GetLocation(GetWaypointByTag("SPIDER"+IntToString(nSpiIndex)));        CreateObject(OBJECT_TYPE_CREATURE, "SPIDERLVL1", lSpawnSpi);        }    for (nCenIndex=1; nCenIndex<=6; nCenIndex++)        {        location lSpawnCen=GetLocation(GetWaypointByTag("CENT"+IntToString(nCenIndex)));        CreateObject(OBJECT_TYPE_CREATURE, "CENTLVL1", lSpawnCen);        }    }if (nPCLevel==2)    {    for (nSpiIndex=1; nSpiIndex<=15; nSpiIndex++)        {        location lSpawnSpi=GetLocation(GetWaypointByTag("SPIDER"+IntToString(nSpiIndex)));        CreateObject(OBJECT_TYPE_CREATURE, "SPIDERLVL2", lSpawnSpi);        }    for (nCenIndex=1; nCenIndex<=6; nCenIndex++)        {        location lSpawnCen=GetLocation(GetWaypointByTag("CENT"+IntToString(nCenIndex)));        CreateObject(OBJECT_TYPE_CREATURE, "CENTLVL2", lSpawnCen);        }    }if (nPCLevel==3)    {    for (nSpiIndex=1; nSpiIndex<=15; nSpiIndex++)        {        location lSpawnSpi=GetLocation(GetWaypointByTag("SPIDER"+IntToString(nSpiIndex)));        CreateObject(OBJECT_TYPE_CREATURE, "SPIDERLVL3", lSpawnSpi);        }    for (nCenIndex=1; nCenIndex<=6; nCenIndex++)        {        location lSpawnCen=GetLocation(GetWaypointByTag("CENT"+IntToString(nCenIndex)));        CreateObject(OBJECT_TYPE_CREATURE, "CENTLVL3", lSpawnCen);        }    }if (nPCLevel==4)    {    for (nSpiIndex=1; nSpiIndex<=15; nSpiIndex++)        {        location lSpawnSpi=GetLocation(GetWaypointByTag("SPIDER"+IntToString(nSpiIndex)));        CreateObject(OBJECT_TYPE_CREATURE, "SPIDERLVL4", lSpawnSpi);        }    for (nCenIndex=1; nCenIndex<=6; nCenIndex++)        {        location lSpawnCen=GetLocation(GetWaypointByTag("CENT"+IntToString(nCenIndex)));        CreateObject(OBJECT_TYPE_CREATURE, "CENTLVL4", lSpawnCen);        }    }if (nPCLevel>=5)    {    for (nSpiIndex=1; nSpiIndex<=15; nSpiIndex++)        {        location lSpawnSpi=GetLocation(GetWaypointByTag("SPIDER"+IntToString(nSpiIndex)));        CreateObject(OBJECT_TYPE_CREATURE, "SPIDERLVL5", lSpawnSpi);        }    for (nCenIndex=1; nCenIndex<=6; nCenIndex++)        {        location lSpawnCen=GetLocation(GetWaypointByTag("CENT"+IntToString(nCenIndex)));        CreateObject(OBJECT_TYPE_CREATURE, "CENTLVL5", lSpawnCen);        }    }}
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Trigger that spawns monsters based on PC level and has a cooldown timer
« Reply #1 on: February 10, 2013, 12:03:15 am »


               Bioware standard encounter triggers already work exactly like this, so long as you keep your creatures in the CR 1-40 range roughly aligned with player level. Unless you're making higher cr critters, I would just use those.

Funky
               
               

               
            

Legacy_scalyjake

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Trigger that spawns monsters based on PC level and has a cooldown timer
« Reply #2 on: February 10, 2013, 12:13:07 am »


               I want the creatures to spawn in specific places around the dungeon when this encounter is triggered.  How exactly do I utilize the timer on there because I put the script on the OnEnter handle and it will still spawn all the monsters over and over again if a PC keeps stepping on it.  So basically how do I utilize that timer on the encounter in this way?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Trigger that spawns monsters based on PC level and has a cooldown timer
« Reply #3 on: February 10, 2013, 03:26:40 am »


               

scalyjake wrote...

I want the creatures to spawn in specific places around the dungeon when this encounter is triggered.  How exactly do I utilize the timer on there because I put the script on the OnEnter handle and it will still spawn all the monsters over and over again if a PC keeps stepping on it.  So basically how do I utilize that timer on the encounter in this way?

many folks out there uses NESS (spawn system) that should allow you to do it...

btw if you break your encounter into more same encounters that spawns only 1 creature it will be possible to do it with default encounter too, at least if you dont want spawn count randomization
               
               

               
            

Legacy_scalyjake

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Trigger that spawns monsters based on PC level and has a cooldown timer
« Reply #4 on: February 10, 2013, 04:19:59 am »


               Ok thanks a lot I'll definitely look into this.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Trigger that spawns monsters based on PC level and has a cooldown timer
« Reply #5 on: February 10, 2013, 05:05:23 am »


               

scalyjake wrote...

Ok thanks a lot I'll definitely look into this.

if NESS doesnt satisfy you lmk, I have my own trigger-based spawn system that allows what you want
               
               

               


                     Modifié par ShaDoOoW, 10 février 2013 - 05:05 .