• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

This to MUI... Or what?

Status
Not open for further replies.
Level 11
Joined
Jun 20, 2009
Messages
880
Im making solo player survival map, and i have a question.
So i have item "Bronze Ring". If you carry it for 5 minutes, it will trasform into "Silver Ring".
This is easy to make, i know. But how to make that for many rings?


  • Bronze Ring A
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |c00FFFF00Bronze Ring|r
    • Actions
      • Countdown Timer - Pause BronzeRingTimer
      • Countdown Timer - Start BronzeRingTimer as a One-shot timer that will expire in 300.00 seconds
      • Set BronzeRingTimer = (Last started timer)
  • Bronze Ring B
    • Events
      • Time - BronzeRingTimer expires
    • Conditions
    • Actions
      • Hero - Drop (Item carried by You of type |c00FFFF00Bronze Ring|r) from You
      • Item - Remove (Last dropped item)
      • Hero - Create |c00FFFF00Silver Ring|r and give it to You
      • Set TempLoc = (Position of You)
      • Special Effect - Create a special effect at TempLoc using Abilities\Spells\Undead\ReplenishMana\SpiritTouchTarget.mdl
      • Custom script: call RemoveLocation(udg_TempLoc)

If you have ring, and buy another one, the timer will reset :confused:
So how can i make own timer for each ring?
 
First off, you don't need to set that timer into a variable, since you simply fire it up. In case you do so, you need "call DestroyTimer (udg_timer)" to destroy it, but generally, when it's a simple action of firing it up and get it expired in another trigger, you don't need variables.

Secondly, like baassee suggested, hashtables or indexes can make this be MUI. Timers in GUI are global and I used to think that they were normally ok to use, when you go for MUI effect, but I was wrong. You can work with them in GUI, but they you will end up clogging a trigger up, e.g.
  • Actions
    • Custom script: local timer t = CreateTimer()
    • Custom script: call TimerStart (t, 3, false, null)
    • Custom script: call TriggerRegisterTimerExpireEvent (gg_trg_Two, t)
    • Custom script: set t = null
  • Two
    • Events
    • Conditions
    • Actions
      • Game - Display to (All players) the text: hello!
      • Custom script: call DestroyTimer (GetExpiredTimer())
Try it; it is totally MUI (well, it doesn't have any units invloved, but it is having multiple uses at a time, just like any MUI system or spell does.

Now, you can go for the way mentioned above or the other way:

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hash = (Last created hashtable)
  • One
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Bronze Ring
    • Actions
      • Set Point = (Position of (Triggering unit))
      • Unit - Create 1 Footman for (Owner of (Triggering unit)) at Point facing Default building facing degrees
      • Unit - Hide (Last created unit)
      • Unit - Add a 300.00 second Generic expiration timer to (Last created unit)
      • Hashtable - Save Handle Of(Triggering unit) as 0 of (Key (Last created unit)) in Hash
      • Hashtable - Save Handle Of(Item being manipulated) as 1 of (Key (Last created unit)) in Hash
      • Item - Make (Item being manipulated) Undroppable
      • Custom script: call RemoveLocation (udg_Point)
  • Two
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set LoadUnit = (Load 0 of (Key (Triggering unit)) in Hash)
      • Set LoadItem = (Load 1 of (Key (Triggering unit)) in Hash)
      • Hero - Drop LoadItem from LoadUnit
      • Item - Remove (Last dropped item)
      • Hero - Create Silver Ring and give it to LoadUnit
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in Hash
 
Status
Not open for further replies.
Top