• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Unsolved] How to check the result of create units triggers

Status
Not open for further replies.
Level 1
Joined
Mar 5, 2014
Messages
2
When using the triggers to create a unit, if the spawn point is full of other units or the unit can't be placed in that random point, the unit will not be created. Some time if a unit is not created due to some error, the game will not countinue properly. Is there a way that I can know if the last create unit(s) action was executed successfully in triggers? So that I can do something like spawning the unit again after 1s to keep the game countinue as intended.
And if the create units action create mutiple units like 3 zealots, but only 2 were create successfully, can I get that info too, so that I can create the missing one again?
 
Level 9
Joined
Dec 21, 2006
Messages
490
i think the goal should be to make it spawn the units no matter what. instead of the unit spawn action try to use the enviroment - effect at point with a create unit effect. you can set there how far a unit may spawn if the target point is not available. you only need one effect because you can set the unit type with catalogs.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
You do exactly what you said. You quite literally check the creation results.

If it fails, the UnitCreate will probably return a group which has less units than expected, if not is empty. After a UnitCreate call UnitLastCreatedGroup will probably return the same group (this is for you GUI users).

You can create your own custom safe spawn action. Use a local integer to keep track of how many remaining then use a while loop until the integer is 0. Every loop you try to create the integer number units and then subtract the integer by the number of units contained in the return group (or last created unit group?) before waiting some time. This should (not sure, but does seem logical) spawn units with constant retrying like you want.

To prevent blocking of key spawns you could try spawning them in safe locations such as outside the usable play area (some maps have wasted space) and then moving him to the place.
 
Level 1
Joined
Mar 5, 2014
Messages
2
I still don't know how to use only 1 effect to create different types of units, so I just do as Dr Super Good said( check and re-spawn).
Hopefully it won't have any bugs now.
 
Status
Not open for further replies.
Top