Spawn new units by clicking on static units

Status
Not open for further replies.
Level 2
Joined
Jan 20, 2009
Messages
18
Hi,

I want the player to spawn units by clicking onto a static unit (not movable, invurnable unit).

Howto do that? Should the spawn point unit belong to another AI controled player?

How can I detect the player clicking on the spawn point unit?

Thanks for your consideration
 
  • Trigger
  • Events
    • Selection - Player 1 (Red) selects a unit
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to X
  • Actions
    • Set Point1 = (Center of (your region <gen>))
    • Unit - Create 1 Footman at Point1 for (Triggering Player) facing default building degrees
    • Custom script: call RemoveLocation (udg_Point1)
Point1 is "Point" variable. The action is "Set Variable". Reference: https://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/variables-5896/ , https://www.hiveworkshop.com/forums/triggers-and-scripts-269/things-that-leak-35124/
 
Thanks, that did it and I learned something.


Can I add more spawn point units with the same action without recreating the trigger for every one of them? I plan to have like 50 spawn point units and it would realy make things easier for me.

Also if I use the point variable Point1 alot, should I create it in map initialization? Where would I free it then? Would I free it, if it is used all the time?
 
Just add them, and it should work.

Create variables @ Trigger editor -> the yellow X on the toolbar.

My question is, how can I have the same action by clicking on any of them without creating a new tricker for each of them.

Where would I set the initial value of the point variable?
 
You can set "initial value" of the global variables by double clicking the variable name in variable editor in trigger editor.
 
Status
Not open for further replies.
Back
Top