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

Items Reduce Stats

Status
Not open for further replies.
Level 2
Joined
Feb 26, 2010
Messages
15
What is the best way to have an Item reduce the holder's movement speed by half? Is there a good way to do it in Object Editor, or would it have to be Triggers?
 
Triggers are the only way I think:
  • ReduceMS
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Kelen's Dagger of Escape
    • Actions
      • Unit - Set (Triggering unit) movement speed to ((Current movement speed of (Triggering unit)) / 2.00)
If you just want to do default movement speed then you can set it to default. That might be better in case the unit acquires the item while under a slow or something.
 
Last edited:
Level 15
Joined
Nov 26, 2005
Messages
1,151
Or you can just make an item ability that gives movement speed bonus -0.5 in %.
I think that should do better.

In order to enter a negative value -> You have to allow negative values in the WE preferences. THen - Shift+Click the field you want to enter a negative and it works... mostly.
 
Level 2
Joined
Feb 26, 2010
Messages
15
I think I'll do it PurgeandFire111's way...

  • Pick Up EFlag
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Hero manipulating item)) is an ally of Player 6 (Orange)) Equal to True
          • (Item-type of (Item being manipulated)) Equal to Orc Flag
        • Then - Actions
          • Unit - Set (Hero manipulating item) movement speed to ((Default movement speed of (Hero manipulating item)) / 2.00)
          • Trigger - Turn on Drop EFlag <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Hero manipulating item)) is an ally of Player 12 (Brown)) Equal to True
          • (Item-type of (Item being manipulated)) Equal to Human Flag
        • Then - Actions
          • Unit - Set (Hero manipulating item) movement speed to ((Default movement speed of (Hero manipulating item)) / 2.00)
          • Trigger - Turn on Drop EFlag <gen>
        • Else - Actions

(Initially Off)
  • Drop EFlag
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Set _Bool_Local = False
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has an item of type Human Flag) Equal to False
              • ((Picked unit) has an item of type Orc Flag) Equal to False
            • Then - Actions
              • Unit - Set (Picked unit) movement speed to (Default movement speed of (Picked unit))
            • Else - Actions
              • Set _Bool_Local = True
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • _Bool_Local Equal to True
        • Then - Actions
        • Else - Actions
          • Trigger - Turn off (This trigger)
I believe this works just fine. :D
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Rather than doing a periodic loop, you should use the event "Unit drops item" and check to see if the item is the flag. If the unit picks up the flag half its movement speed, if a unit drops the flag then reset it back to normal.
 
Level 15
Joined
Aug 31, 2009
Messages
776
The unit group is also leaking.
Make sure to
  • Custom script: call DestroyGroup(udg_<Your Group Variable>)
Where you set the group to a variable first, then destroy it after use.

However, if you do as Berbanog says and use the Unit Drops Item event, you won't need to do this.


Also, why use a Trigger Turn On/Off with a loop, when you can just Run the trigger?
From what I see, you turn a trigger on, which then runs its first loop, then turns itself off. Why not just tell your first trigger to simply run the other?
 
Status
Not open for further replies.
Top