• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Solved] Making a unit teleport under certain conditions

Status
Not open for further replies.
Level 3
Joined
Nov 24, 2009
Messages
29
What i am trying to say is that when a player's unit enters a region, if the player has no wood or gold, then the unit will teleport. BUT if the player HAS either wood and/or gold left then the unit will not teleport and will give a comment.
 
1, create a region, eg, region name is region_001"

2, create trigger :

  • trigger: "unit enter region_001"
  • condition: enter unit is player's unit (put your own rules)
  • action:
  • set temp_player = owner of entering unit
  • if(temp_player's current gold =0)
    • if (temp_player's current lumber == 0)
      • //put teleport code here
    • else
      • game - message to temp player "you have lumber left"
  • else
    • game - message to temp player "you have gold left"
 
Elaporate subject. Teleport - where?

  • init
    • Events
      • Unit - A unit enters SomeRegion <gen>
    • Conditions
    • Actions
      • If (All conditions are true) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (((Owner of (Triggering unit)) Current gold) Equal to 0) or (((Owner of (Triggering unit)) Current lumber) Equal to 0)
        • Then - Actions
          • // teleport?
        • Else - Actions
          • Set force = (Player group((Owner of (Triggering unit))))
          • Game - Display to force the text: //message here
          • Custom script: call DestroyForce(udg_force)
Where 'force' is player group variable.
To make such conidtion you have to enter Condition filter and scroll down to a bit to be able to select 'Or' type. Press enter. Now to set first in way I've done it, head to: Integer Comparisons -> Player - Player Property. You probably know how to fill fields here; do the same with second condition but this time refer to lumber instead of gold.

Script requires region to be set on map already.
 
Status
Not open for further replies.
Back
Top