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

Functions questions

Status
Not open for further replies.
Level 9
Joined
Feb 20, 2014
Messages
409
Hi,
I am editing my map in 1.30.4 but by testers play it in the latest patch.
Some abilities are working for me but not for them.

Do these fuctions still exist in the latest patch?
Here are the triggers

An ability increasing base damage doesn't work for them :

  • Event
    • Unit - A unit Start to cast an ability
  • Conditions
    • (Ability being cast) Equal to Dragon's Rage
  • Actions
    • Set strenghtE = ((Strenght of (Triggering unit) (Include bonuses)) / 100)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of Dragon's Rage for (Triggering unit)) Equal to 1
      • Then - Actions
        • Set strenght = (Real(strenghtE))
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unité - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) - (strenghtE x 20)) for weapon index: 1
      • Sinon - Actions
An ability increasing armor doesn't work for them.

  • Event
    • Units - A unit Starts to cast an ability
  • Conditions
    • (Ability being cast) Equal to Archangel's Protection
  • Actions
    • Set TargetigUnit = (Target unit of ability being cast)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of Archangel's Protection for (Triggering unit)) Equal to 1
      • Then - Actions
        • Unit - Set Armor of (Target unit of ability being cast) to ((Armor of (Target unit of ability being cast)) + 1000000.00)
        • Wait 5.00 seconds
        • Unit - Set Armor of TargetigUnit to ((Armor of TargetigUnit) - 1000000.00)
        • Wait 0.10 seconds
      • Sinon - Actions
 
Level 8
Joined
May 21, 2019
Messages
435
Hi,
I am editing my map in 1.30.4 but by testers play it in the latest patch.
Some abilities are working for me but not for them.

Do these fuctions still exist in the latest patch?
Here are the triggers

An ability increasing base damage doesn't work for them :

  • Event
    • Unit - A unit Start to cast an ability
  • Conditions
    • (Ability being cast) Equal to Dragon's Rage
  • Actions
    • Set strenghtE = ((Strenght of (Triggering unit) (Include bonuses)) / 100)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of Dragon's Rage for (Triggering unit)) Equal to 1
      • Then - Actions
        • Set strenght = (Real(strenghtE))
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unité - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) + strenghtE) for weapon index: 1
        • Wait 3.00 seconds
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 1) - (strenghtE x 20)) for weapon index: 1
      • Sinon - Actions
An ability increasing armor doesn't work for them.

  • Event
    • Units - A unit Starts to cast an ability
  • Conditions
    • (Ability being cast) Equal to Archangel's Protection
  • Actions
    • Set TargetigUnit = (Target unit of ability being cast)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of Archangel's Protection for (Triggering unit)) Equal to 1
      • Then - Actions
        • Unit - Set Armor of (Target unit of ability being cast) to ((Armor of (Target unit of ability being cast)) + 1000000.00)
        • Wait 5.00 seconds
        • Unit - Set Armor of TargetigUnit to ((Armor of TargetigUnit) - 1000000.00)
        • Wait 0.10 seconds
      • Sinon - Actions

For the first trigger, the problem is that weapon indexes are zero indexed in the new update. So Weapon 1 is 0 and Weapon 2 is 1. This should be fixed if you change the index to 0 instead of 1.

For your second trigger, it's worth noting that it is NOT MUI. This means that if multiple people cast it, the global variable TargetigUnit is going to be overwritten while the effect of previous casts is still on-going.

Edit: Your first trigger isn't MUI either. You need to be using local variables or hashtables to avoid variable conflicts.
 
Level 9
Joined
Feb 20, 2014
Messages
409
For the first trigger, the problem is that weapon indexes are zero indexed in the new update. So Weapon 1 is 0 and Weapon 2 is 1. This should be fixed if you change the index to 0 instead of 1.

For your second trigger, it's worth noting that it is NOT MUI. This means that if multiple people cast it, the global variable TargetigUnit is going to be overwritten while the effect of previous casts is still on-going.

Edit: Your first trigger isn't MUI either. You need to be using local variables or hashtables to avoid variable conflicts.

I know nothing about hashtable.... Is it hard to do?
Or at least should I create like 1 TargetingUnit for every Spell?
 
Level 8
Joined
May 21, 2019
Messages
435
I know nothing about hashtable.... Is it hard to do?
Or at least should I create like 1 TargetingUnit for every Spell?
Hashtables aren't hard to do, but the way that Blizzard designed it in the GUI, it's kinda confusing to pick up.
A local variable solution is probably an easier approach.

I don't have my world editor on me at the moment, so had to wing these, but give them a try:

  • Event
    • Unit - A unit Start to cast an ability <--- CHANGE THIS TO STARTS THE EFFECT OF AN ABILITY!
  • Conditions
    • (Ability being cast) Equal to Dragon's Rage
  • Actions
    • Custom script: local integer strength
    • Set strenghtE = ((Strength of (Triggering unit) (Include bonuses)) / 100)
    • Custom script: set strength = udg_strenghtE
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of Dragon's Rage for (Triggering unit)) Equal to 1
      • Then - Actions
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set udg_strengthE = strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) + strenghtE) for weapon index: 0
        • Wait 3.00 seconds
        • Custom script: set strength = udg_strength
        • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of (Triggering unit) for weapon index 0) - (strenghtE x 20)) for weapon index: 0
        • Custom script: call RemoveUnit( Exploding_Unit )
      • Sinon - Actions

  • Event
    • Units - A unit Starts to cast an ability
  • Conditions
    • (Ability being cast) Equal to Archangel's Protection
  • Actions
    • Custom script: local unit targetUnit
    • Set TargetigUnit = (Target unit of ability being cast)
    • Custom script: set targetUnit = udg_TargetigUnit
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of Archangel's Protection for (Triggering unit)) Equal to 1
      • Then - Actions
        • Unit - Set Armor of (Target unit of ability being cast) to ((Armor of (Target unit of ability being cast)) + 1000000.00)
        • Wait 5.00 seconds
        • Custom script: set udg_TargetigUnit = targetUnit
        • Unit - Set Armor of TargetigUnit to ((Armor of TargetigUnit) - 1000000.00)
        • Custom script: set targetUnit = null
      • Sinon - Actions
 
Status
Not open for further replies.
Top