• 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.

[Trigger] No Camp Trigger +REP.

Status
Not open for further replies.
Level 9
Joined
Jul 11, 2009
Messages
294
Hello,I need a trigger that makes the player unable to camp at the spot.
Meaning if he camps over 20 seconds it will return to its base.
Like a peasent is in region a for over 20 seconds.
It will return to its base.



Thanks in advance +REP to anyone who helps. :xxd:
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Okay, I just had to use hashtables for this, sorry if you don't like them :p

Setup the hashtables as usual, I won't show the trigger for that.


  • Camping
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set CampGroup = (Units in CampSpot <gen>)
      • Unit Group - Pick every unit in CampGroup and do (Actions)
        • Loop - Actions
          • Set Time = ((Load (Key Time) of (Key (Picked unit)) from CampTable) + 0.50)
          • Hashtable - Save Time as (Key Time) of (Key (Picked unit)) in CampTable
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Time Greater than or equal to 40.00
            • Then - Actions
              • Set loc = (Player 1 (Red) start location)
              • Unit - Move (Picked unit) instantly to loc
              • Custom script: call RemoveLocation(udg_loc)
            • Else - Actions
      • Custom script: call DestroyGroup(udg_CampGroup)

  • Leave CampSpot
    • Events
      • Unit - A unit leaves CampSpot <gen>
    • Conditions
    • Actions
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in CampTable
 
Status
Not open for further replies.
Top