• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Consumable item that modifies hero stats, then reverts them back after 60 seconds

Status
Not open for further replies.
Level 3
Joined
Jan 8, 2022
Messages
64
Hello!

I'm trying to create a consumable item that modifies heroes stats, then reverts back after 60 seconds.

-If I assign a variable to the unit, the trigger works. BUT, if another unit uses the same item, the first unit that used it gets a permanent increase, as the variable gets reassigned before the timer could have out.

-If I don't assign a variable to the unit, the stats don't get removed for anyone, as the second trigger doesn't seem to run.

Here are the triggers without the assigning the unit to a variable:

Trigger 1:
  • Ironforge Ale
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Ironforge Ale
    • Actions
      • Hero - Modify Strength of (Triggering unit): Add 5.
      • Hero - Modify Intelligence of (Triggering unit): Subtract 5.
      • Countdown Timer - Start IronforgeAleTimer as a One-shot timer that will expire in 60.00 seconds
Trigger 2:
  • Ironforge Ale Timer
    • Events
      • Time - IronforgeAleTimer expires
    • Conditions
    • Actions
      • Hero - Modify Strength of (Triggering unit): Subtract 5.
      • Hero - Modify Intelligence of (Triggering unit): Add 5.

Any help or direction would be much appreciated!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,563
Use a Wait in the first trigger and only reference (Triggering unit). That'll fix the issues.

If that wasn't an option you could use Dynamic Indexing to make an effect like this. Link in my signature.

Timers aren't really an option for MUI effects because Timers in GUI are very limited.

That's why I created a simple system to help with this which I attached below. The map requires the latest patch.

It allows you to create a brand new timer that can carry a set of given data (unit, integer, real, etc).
You can then reference this data whenever the timer expires. This timer is treated as a local variable which
means that it's completely MUI. It would work great for your Ale trigger assuming you want the effects to be
able to stack.

Edit: Updated map to allow Keys for restarting existing timers.
 

Attachments

  • GUI Simple Timers 2.w3m
    24.2 KB · Views: 5
Last edited:
Level 3
Joined
Mar 17, 2013
Messages
31
Triggering unit is a global variable with only one instance.
For this scenerio, the latest drinker will be marked as the triggering unit.
If there are other trigger using triggering unit, they'll get involved too.

You might consider using local variables to track ale drinkers independently.
Here is the tutorial:Check Lesson 2

Then again, reading and internalizing a tutorial takes a good amount of time.
If you are urgent to make this thing work in GUI, here's a shoddy solution:

Add a 60 second effect to your ale item in object editor.
Creat an unitgroup variable, name it "IronforgeAle_Drunkards" perhaps.
When a unit drinks ironforge ale, add the triggering unit to IronforgeAle_Drunkards and alter it's attribute.
For every second, pick every units in IronforgeAle_Drunkards, check whether they have the 60 second effect or not.
If the picked unit have the effect, do nothing. If not, alter it's attribute back, and remove it from the IronforgeAle_Drunkards.

this solution makes the entire effect susceptible to dispel, and it's unable to stack.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,563
No, (Triggering unit) acts like a local variable. It's completely MUI.
You can use it after Waits just fine. Other triggers running will not change it's instance value.

This isn't necessarily true for every other Event Response though.
 
Level 3
Joined
Jan 8, 2022
Messages
64
The 60 second wait after consuming the item worked perfectly. I will definitely check out how to configure your Dynamic Indexing - hadn't considered stacking Ale's, great idea!

Thanks for both of your suggestions and help!
 
Status
Not open for further replies.
Top