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

Help to Destroy Point Leak

Status
Not open for further replies.
Level 4
Joined
Jul 14, 2012
Messages
100
So I know how to destroy a point using a quick custom script if it is not an array, and even if it is an array with integers. but this is my spell. I don't know how to destroy the point given to the player, and I don't want to destroy all points in the array, since I want it to be MUI. I don't know how to make it refer to Player Number of Owner of Casting Unit for the index #.

  • Krep Ki Suj Time Warp
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Time Warp
    • Actions
      • Game - Display to (All players) the text: cast
      • Set uniqueloc[(Player number of (Owner of (Casting unit)))] = (Position of (Casting unit))
      • Set uniquehp[(Player number of (Owner of (Casting unit)))] = (Integer((Life of (Casting unit))))
      • Wait 5.00 seconds
      • Unit - Reset ability cooldowns for (Casting unit)
      • Unit - Move (Casting unit) instantly to uniqueloc[(Player number of (Owner of (Casting unit)))]
      • Special Effect - Create a special effect at temploc using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Casting unit) is alive) Equal to True
        • Then - Actions
        • Else - Actions
          • Skip remaining actions
      • Set regainedhp = (uniquehp[(Player number of (Owner of (Casting unit)))] - (Integer((Life of (Casting unit)))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • regainedhp Greater than 0
        • Then - Actions
        • Else - Actions
          • Skip remaining actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Time Warp for (Casting unit)) Equal to 1
        • Then - Actions
          • Set regainedhp = (regainedhp x ((1 / 4) + ((Intelligence of (Casting unit) (Include bonuses)) x (1 / 1000))))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Time Warp for (Casting unit)) Equal to 2
        • Then - Actions
          • Set regainedhp = (regainedhp x ((35 / 100) + ((Intelligence of (Casting unit) (Include bonuses)) x (1 / 1000))))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Time Warp for (Casting unit)) Equal to 3
        • Then - Actions
          • Set regainedhp = (regainedhp x ((1 / 2) + ((Intelligence of (Casting unit) (Include bonuses)) x (1 / 1000))))
        • Else - Actions
      • Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + (Real(regainedhp)))
 
If you ever feel lost in translating an index from GUI to JASS, just use an integer variable. :)
  • Set TempIndex = (Player number of (Owner of (Casting unit))
  • Custom script: call RemoveLocation(udg_uniqueloc[udg_TempIndex])
In case you were curious, you could write your index above as:
call RemoveLocation(udg_uniqueloc[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))])
But that is pretty ugly to write, and it is easy to make mistakes. Assigning it to a variable is much easier. You can also take advantage of (Triggering player), since that is equivalent to (Owner of (Casting unit)) or (Owner of (Triggering unit)) for most generic unit events.
call RemoveLocation(udg_uniqueloc[GetPlayerId(GetTriggerPlayer()) + 1])
That works too.
 
Level 4
Joined
Jul 14, 2012
Messages
100
Derp! Of course I could've just made an integer variable for player number bah I feel noob >_< haha thanks man. And yeah that is really ugly to write aha
 
Status
Not open for further replies.
Top