Aller au contenu

Photo

Trigger that spawns monsters based on PC level and has a cooldown timer


  • Veuillez vous connecter pour répondre
5 réponses à ce sujet

#1
scalyjake

scalyjake
  • Members
  • 3 messages
 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);        }    }}

#2
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages
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

#3
scalyjake

scalyjake
  • Members
  • 3 messages
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?

#4
Shadooow

Shadooow
  • Members
  • 4 474 messages

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

#5
scalyjake

scalyjake
  • Members
  • 3 messages
Ok thanks a lot I'll definitely look into this.

#6
Shadooow

Shadooow
  • Members
  • 4 474 messages

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 .