• 🏆 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!

Custom aoe buff with timer array?

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
i want make a % Hp buff, but i am lost a bit with how to disable the bonus hp, i think wait not the best option if we talk about aoe buff (like make roar then remove it after 45 sec), i tryed timer way but idk how could identify what timer expired coz in 2nd trigger what remove the buff in event i must give the fixed array index for timer :/
  • Untitled Trigger 006
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to HP buff
    • Actions
      • Set TempPoint = (Position of (Triggering unit))
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
      • Unit - Add Dummy HP buff to (Last created unit)
      • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Roar
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Wait 1.00 seconds
      • Set TempPoint = (Position of (Triggering unit))
      • Set TempUnitGroup = (Units within 600.00 of TempPoint matching (((Matching unit) has buff HP buff ) Equal to True))
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • Set Max_HP = (Integer((Life of (Picked unit))))
          • Set Buff_Value[(((Player number of (Owner of (Picked unit))) x 30) + 8)] = (Integer(((Real(Max_HP)) x 0.30)))
          • Set Max_HP = Buff_Value[(((Player number of (Owner of (Picked unit))) x 30) + 8)]
          • Game - Display to (All players) the text: (String(Max_HP))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Max_HP Greater than 0
            • Then - Actions
              • Set Loop_Integer = ((Max_HP - (Max_HP mod 100)) / 100)
              • For each (Integer A) from 1 to Loop_Integer, do (Actions)
                • Loop - Actions
                  • Unit - Add Permanent HP to (Picked unit)
                  • Unit - Set level of Permanent HP for (Picked unit) to 4
                  • Unit - Remove Permanent HP from (Picked unit)
              • Set Max_HP = (Max_HP / 100)
              • Set Loop_Integer = ((Max_HP - (Max_HP mod 10)) / 10)
              • For each (Integer A) from 1 to Loop_Integer, do (Actions)
                • Loop - Actions
                  • Unit - Add Permanent HP to (Picked unit)
                  • Unit - Set level of Permanent HP for (Picked unit) to 3
                  • Unit - Remove Permanent HP from (Picked unit)
              • Set Max_HP = (Max_HP / 10)
              • For each (Integer A) from 1 to Loop_Integer, do (Actions)
                • Loop - Actions
                  • Unit - Add Permanent HP to (Picked unit)
                  • Unit - Set level of Permanent HP for (Picked unit) to 2
                  • Unit - Remove Permanent HP from (Picked unit)
            • Else - Actions
          • Countdown Timer - Start BuffTimer[(((Player number of (Owner of (Picked unit))) x 30) + 8)] as a One-shot timer that will expire in 30.00 seconds
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
You can use a hashtable to get the handle id of expired timer. You propably want to save the unit group handle.

Store the group using the timer's handle.

To make it MUI, you could store the group handle using the dummy's handle id and timers handle id as keys. Remove the dummy when the timer expires.

You also need to remove the locations. Do it before the wait and at then end of the trigger. http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/

Put the trigger in [hidden=Trigger][/hidden] tags.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
You can use a hashtable to get the handle id of expired timer. You propably want to save the unit group handle.

Store the group using the timer's handle.

To make it MUI, you could store the group handle using the dummy's handle id and timers handle id as keys. Remove the dummy when the timer expires.

You also need to remove the locations. Do it before the wait and at then end of the trigger. http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/

Put the trigger in [hidden=Trigger][/hidden] tags.

i know about leak that no problem. without harshtable impossible (coz harshtable atm still a bit chinese to me even i readed this http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/hashtables-mui-133407/)?
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Here is a simple example: http://www.hiveworkshop.com/forums/pastebin.php?id=peffdg

Select the paladins. I save the player number for each timer.

  • Kill
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Paladin
    • Actions
      • Set unit = (Triggering unit)
      • Unit - Kill unit
      • Set int = (Player number of (Owner of unit))
      • Countdown Timer - Start Timers[int] as a One-shot timer that will expire in 5.00 seconds
      • Custom script: set udg_ID = GetHandleId(udg_Timers[udg_int])
      • Hashtable - Save int as 0 of ID in ht
      • Hashtable - Save Handle Ofunit as 1 of ID in ht
till custom script i understand after that not sure what is what.

another thing this do only 1 event for each player but i want more timer for each buff for each player (10*30)

i thought a bit on this and another option is more laggy if i do 1 unit/buff and when i make a buff then i create a dummy to owner of buffer with same unit expiration timer than buff duration and make a another trigger where event unit die, condition example dummy hp unit type who dying then action.
(when unit get purge then kill all dummy unit what target player got and this force the expire trigger for run when unit debuffed)

or 30 event better? i really dont know coz i need 30 buff/player
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
1: This should be in
2:Why set TempPoint twice and its still at the same point? its not being changed or anything, you dont have to reset the trigger to the same thing :p

i use temppoint variable in other place too and i dont wrote but i use custom script for remove the leak before wait.

i dont got good ideea with how too hjandle correctly with harshtable so i think i will do with preiodic trigger, what check every 0.1 second if hero[playernumber] still got x buff and if no but buffvalue[playernumber*30+buffid] variable still not 0 then do action because anyway i must run a periodic trigger for multiboard, i dont know but maybe this dont slowdown the map more than a timer trigger thing
 
Status
Not open for further replies.
Top