Spawn trigger works TOO well!!

Elf Alpha

New Member
Reaction score
0
...I think.

Basically, I've made a map where I want a Makrura pooldweller to spawn at some random point in the map every nine minutes - just to give players a little bit something more to worry about. Nothing major - a group of gold-harvesting peasants briefly converted to militia could deal with the problem. Anyhow, in the first half of the games (when I playtest it) all seems well, there's one here, one there, it's fun. But in the latter half of the games, it seems like they're everydamnwhere! Seriously, every thirty seconds "Our town is under attack!" or some such, and it's always one of these little dudes. Could it be that the trigger is generating them exponentially? Here's what I've got:

Events:
Map Initialization

Actions:
For each integer 1 to 10, do Actions:
Loop - Actions
Wait 540 seconds
Unit - create one Makarura pooldweller for neutral hostile at Random point in playable map bla bla bla
Unit - add wander (Neutral) to last created unit
Trigger - Run this trigger (checking conditions)*

*(I put that last line in 'cos at first it seemed like it would only do it once.)
Like I said, it it something wrong with my trigger? Or is it just that by that time, there are less "other" units (defeated players and so on) running around to take care of the others, and less expanses of trees for them to be hiding in? Is there way to set a maximum number of them to be alive, and if they all are the trigger stops working temporarily?

-- From,

Creeped Out!
 

simonake

New Member
Reaction score
72
remove, run this trigger and instead of using loop use this

Trigger:
  • Events
    • Time - Every 540 seconds
    • Actions
      • Unit - Create
      • Unit - add
 

Flow

New Member
Reaction score
4
@ simonake:
Why have Map Initialization as an additional event though? Remove that and keep the periodic event.
 

Elf Alpha

New Member
Reaction score
0
Thanks guys, I'll try it. Once again I've probably devised something more complicated than it needs to be...
 

Flow

New Member
Reaction score
4
You leak a point :p



Seeing as you were unaware of this, I assume you don't know what it means. When you tell the game to spawn a unit at "random point in region", this causes a so-called leak. To fix it, first store the point in a variable, then refer to that variable when spawning the unit, like so:

Set YourPointVariable = Random Point in YourRegion

and then, when spawning the unit,

Create 1 YourUnit at YourPointVariable facing Whatever
 

Emu.Man00

New Member
Reaction score
41
Seeing as you were unaware of this, I assume you don't know what it means. When you tell the game to spawn a unit at "random point in region", this causes a so-called leak. To fix it, first store the point in a variable, then refer to that variable when spawning the unit, like so:

Set YourPointVariable = Random Point in YourRegion

and then, when spawning the unit,

Create 1 YourUnit at YourPointVariable facing Whatever

And then at the end of your trigger have
Code:
Custom script:  call RemoveLocation(udg_YourPointVariable)
 

Flow

New Member
Reaction score
4
No, because the variable is given a new value every time you set it to a random point in the region, which is done before every individual spawn.
 

Tom Jones

N/A
Reaction score
437
The last action you have messes everything up. So after nine minutes, the trigger will fire for the first time and activate itself, creating yet a new spawn instance. After nine minutes more, it'll fire twice, once for the first execution of the trigger and once for the second execution of the trigger. Then it'll start a new spawn instance. After nine minutes more it'll fire thrice and so on.
 

Elf Alpha

New Member
Reaction score
0
Yes! That was exactly what was happening! They were seriously EVERYWHERE after a while. It was ridiculous.
 

Emu.Man00

New Member
Reaction score
41
You assumed correctly! Thanks. But would that make all of them only pop up at one point?

The leak at first has no noticeable effect. But after they pile up, your game will start to lag. You should get into the habbit of removing them
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top