HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

trigger bug (realted to creating units)

02-01-2004, 02:20 AM#1
johnfn
In the game im making (see sig 8)) ) i have this trigger/script:

Events:
A unit enters bring to forest<gen>
Actions:

if(owner of(Triggering Unit) Equal To (Player 11(Dark Green)) then do (Do Nothing) else (Create 5 Archer at center of spawnunit archer <gen> facing default building facing degrees))

Unit Group - order (last created unit group) to center of (removeunit archer <gen>)

Unit Group - pick every unit in (removeunit archer <gen>) and remove (picked unit) from the game

Wait 20.00 seconds

Trigger - Run (this trigger)(checking conditions)

-------------------------------------------------------------
(gosh its tiring to type triggers)
Anyway as you can see what this does is if you bring a unit to the forest, it spawns some archers and tells them to go somewhere. Then it kills two birds with one stone by removing the units that it had spawned earlier from where these archers go.

Im having major problems with this trigger. First of all, the units dont move all the time. Sometimes they just sit around. But first and foremost is the fact that even though it says wait 20 seconds, i have seen this run every, say, 2 seconds. I CANT FIGURE THIS THING OUT :reallyang and any help would be greatly appreciated.

thanks
02-01-2004, 02:24 AM#2
LegolasArcher
Make sure your not making the units for player 11 or it will be a loop that will crash the game.
02-01-2004, 02:35 AM#3
johnfn
!!
Well, i am. hmmmmmmm... I just changed it to player 10 - light blue - same problem.
02-01-2004, 06:57 AM#4
th15
This trigger is firing that often because each time a archer enters the region, it triggers the "unit enters a region" event that you have.

If you want it to run only on periodic time you should create a new trigger and place the actions in that one, destroying this original trigger after it has run.

Next, dont create units in a block like that. Use this instead
Code:
For loop integer 1-5 do:
     create 1 archer at spawnarcher
     Order last created unit to move to center
02-01-2004, 11:38 AM#5
ABM
you have two event that launch your trigger:

every 20 sec the trigger is lauched but also everytime a unit enter forest....

so you should o this:

Events:
A unit enters bring to forest<gen>

Condition:

Actions:

turn off this tigger

if(owner of(Triggering Unit) Equal To (Player 11(Dark Green)) then do (Do Nothing) else (Create 5 Archer at center of spawnunit archer <gen> facing default building facing degrees))

Unit Group - order (last created unit group) to center of (removeunit archer <gen> )

Unit Group - pick every unit in (removeunit archer <gen> ) and remove (picked unit) from the game

Wait 20.00 seconds

turn on this trigger

Trigger - Run (this trigger)(checking conditions)


with the turn off and on it will prevent the trigger from spawning unit before the 20sec had passed.
02-01-2004, 11:44 AM#6
johnfn
oh dang... would never of thought of that... thanks a ton :ggani:

No wonder the units would double so fast... thanks again