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

So i thought I'd make an indexing system...

Status
Not open for further replies.
Level 8
Joined
Mar 3, 2009
Messages
327
Ok new bug entirely. The system works ok, except for the first attack. When a unit with happy powder is attacked, the first one will still deal damage, but all of the rest are blocked. How can I fix that?

  • Happy Powder
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Happy Powder
    • Actions
      • Custom script: local integer udg_tempint
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UnitInt Equal to 30
        • Then - Actions
          • Set UnitInt = 0
        • Else - Actions
      • Set UnitInt = (UnitInt + 1)
      • Set tempint = UnitInt
      • Trigger - Add to Hp2 <gen> the event (Unit - (Target unit of ability being cast) Takes damage)
      • Unit - Set the custom value of (Target unit of ability being cast) to UnitInt
      • Unit Group - Add (Target unit of ability being cast) to Hpgroup
      • Set Hpunit[UnitInt] = (Target unit of ability being cast)
      • Set CurrentHp[UnitInt] = (Life of (Triggering unit))
      • Set CurrentMp[UnitInt] = (Mana of (Triggering unit))
      • Wait 10.00 seconds
      • Unit Group - Remove Hpunit[tempint] from Hpgroup
      • Unit - Cause Boss to damage Hpunit[tempint], dealing Damstored[tempint] damage of attack type Chaos and damage type Universal

  • Hp2
    • Events
    • Conditions
      • ((Triggering unit) is in Hpgroup) Equal to True
    • Actions
      • Set Damstored[(Custom value of (Triggering unit))] = (Damstored[(Custom value of (Triggering unit))] + (Damage taken))
      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Damage taken))
  • Hp3
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in Hpgroup) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from Hpgroup
      • Unit - Replace (Triggering unit) with a (Unit-type of (Triggering unit)) using The new unit's max life and mana
      • Unit Group - Add (Last replaced unit) to Hpgroup
      • Unit - Set the custom value of (Last replaced unit) to (Custom value of (Triggering unit))
      • Unit - Set life of (Last replaced unit) to CurrentHp[(Custom value of (Triggering unit))]
      • Unit - Set mana of (Last replaced unit) to CurrentMp[(Custom value of (Triggering unit))]
      • Set Hpunit[(Custom value of (Triggering unit))] = (Last Haunted Gold Mine)
      • Set char[(Player number of (Owner of (Triggering unit)))] = (Last replaced unit)
  • Hploop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 30, do (Actions)
        • Loop - Actions
          • Set CurrentHp[(Integer A)] = (Life of Hpunit[(Integer A)])
          • Set CurrentMp[(Integer A)] = (Mana of Hpunit[(Integer A)])
 
Last edited:
Your indexing must be recycled.
  • Custom script: local integer udg_tempint
This doesn't do anything; you just create an integer variable, which is called "udg_tempint"; it doesn't become "tempint".
It should be
  • Custom script: local integer i = 0
  • Custom script: set udg_tempint = i
But still, if you want to localize everything, you should try the same version in Jass, where TriggerSleepAction or PolledWait don't require Indexing systems (inefficient, compared to timers of course).
 
Status
Not open for further replies.
Top