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

[Spell] What's wrong with this?

Status
Not open for further replies.
Level 14
Joined
Jul 19, 2007
Messages
770
I have an ability in my map that's called "Split Cold Arrows" but it doesn't seems to do the damage I want. I want it to do 100/200/300 + the caster's raw agility in damage but it doesn't seems to work for level 2 and 3. It works fine in level 1 with 100 + caster's raw agility but it seems like the trigger is ignoring the "x level of Split Cold Arrows for caster". How can I solve it?

  • Split Cold Arrows
    • Events
    • Conditions
    • Actions
      • Set VariableSet Caster = (Triggering unit)
      • Set VariableSet Target = (Target unit of ability being cast)
      • Set VariableSet TempLoc = (Position of Caster)
      • Set VariableSet TempLoc2 = (Position of Target)
      • Set VariableSet TempGroup = (Units within 250.00 of TempLoc2 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Triggering playe
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Greater than 1
        • Then - Actions
          • Set VariableSet TempReal = ((Real((Agility of Caster (Include bonuses)))) + (100.00 x (Real((Level of Split Cold Arrows for Faramir 0232 <gen>)))))
        • Else - Actions
          • Set VariableSet TempReal = ((Real((Agility of Caster (Include bonuses)))) + (100.00 x (Real((Level of Split Cold Arrows for Faramir 0232 <gen>)))))
      • Set VariableSet TempInt2 = (Level of Split Cold Arrows for Caster)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy Attack for (Triggering player) at TempLoc facing Default building facing degrees
          • Set VariableSet TempUnit = (Last created unit)
          • Unit - Add Dummy Damage to TempUnit
          • Unit - Set level of Dummy Damage for TempUnit to (Integer(TempReal))
          • Unit - Add Split Cold Arrows Dummy to TempUnit
          • Unit - Set level of Split Cold Arrows Dummy for TempUnit to TempInt2
          • Unit - Add a 1.00 second Generic expiration timer to TempUnit
          • Unit - Order TempUnit to Neutral Sea Witch - Activate Frost Arrows.
          • Unit - Order TempUnit to Attack Once (Picked unit)
      • Custom script: call RemoveLocation (udg_TempLoc)
      • Custom script: call RemoveLocation (udg_TempLoc2)
      • Custom script: call DestroyGroup (udg_TempGroup)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,510
I don't like this approach. You're setting the level of the Dummy Damage ability to TempReal, which is going to be equal to (Agility + (100 * Ability Level)), and you're converting it to an Integer which will have rounding. Why not just set the Dummy unit's attack damage through triggers:
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Set VariableSet Caster = (Triggering unit)
      • Set VariableSet Target = (Target unit of ability being cast)
      • Set VariableSet TempPoint[0] = (Position of Caster)
      • Set VariableSet TempPoint[1] = (Position of Target)
      • Set VariableSet AbilityLevel = (Level of (Ability being cast) for Caster)
      • Set VariableSet DummyDamage = ((Agility of Caster (Include bonuses)) + (100 x AbilityLevel))
      • Set VariableSet TempGroup = (Units within 250.00 of TempPoint[1].)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy Attack for (Owner of Caster) at TempPoint[0] facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Set Base Damage of (Last created unit) to DummyDamage for weapon index: 0
          • Unit - Order (Last created unit) to Attack Once Target
      • Custom script: call RemoveLocation (udg_TempPoint[0])
      • Custom script: call RemoveLocation (udg_TempPoint[1])
      • Custom script: call DestroyGroup (udg_TempGroup)
Note that I left some of your original stuff out for simplicities sake.

Also, careful not to overwrite any of these Event Responses/Variables. Creating a Dummy and Ordering it to attack can set off other Events which may cause other triggers to run and cause problems.

A safer approach would be to use unique variables for this trigger.
 
Level 14
Joined
Jul 19, 2007
Messages
770
I don't like this approach. You're setting the level of the Dummy Damage ability to TempReal, which is going to be equal to (Agility + (100 * Ability Level)), and you're converting it to an Integer which will have rounding. Why not just set the Dummy unit's attack damage through triggers:
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Set VariableSet Caster = (Triggering unit)
      • Set VariableSet Target = (Target unit of ability being cast)
      • Set VariableSet TempPoint[0] = (Position of Caster)
      • Set VariableSet TempPoint[1] = (Position of Target)
      • Set VariableSet AbilityLevel = (Level of (Ability being cast) for Caster)
      • Set VariableSet DummyDamage = ((Agility of Caster (Include bonuses)) + (100 x AbilityLevel))
      • Set VariableSet TempGroup = (Units within 250.00 of TempPoint[1].)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy Attack for (Owner of Caster) at TempPoint[0] facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Set Base Damage of (Last created unit) to DummyDamage for weapon index: 0
          • Unit - Order (Last created unit) to Attack Once Target
      • Custom script: call RemoveLocation (udg_TempPoint[0])
      • Custom script: call RemoveLocation (udg_TempPoint[1])
      • Custom script: call DestroyGroup (udg_TempGroup)
Note that I left some of your original stuff out for simplicities sake.

Also, careful not to overwrite any of these Event Responses/Variables. Creating a Dummy and Ordering it to attack can set off other Events which may cause other triggers to run and cause problems.

A safer approach would be to use unique variables for this trigger.
Well I didn't make this ability I imported it from a spellpack. I still think it's strange why it seems to ignore the "x level of ability" I can't see the reason why it doesn't included that :-/ Anyway I'm not sure I can fix the ability by myself because I'm kinda noobish at triggerings as I've said earlier and I'm afraid to do something wrong. Maybe you can fix it in my map pls?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,510
I showed you how to do it. There's like 1 Action you have to add, use search for text if you can't find it but as you can see it's under the Unit category:
  • Unit - Set Base Damage of (Last created unit) to DummyDamage for weapon index: 0

So rather than modifying an ability that adds damage based on it's level you instead modify the unit's damage directly. This action came with patch 1.31 so it wasn't an option back in the day.

DummyDamage is an Integer variable.
 
Level 19
Joined
Feb 27, 2019
Messages
580
What is the max level of Dummy Damage? It needs to be 300 levels + max agility possible in a game for that unit levels. Its not a very good option to have that many levels of an ability since it will add seconds to load the map. In my simple test it added about 5 extra seconds to the loading time to have a single ability with 999 levels.
 
Level 14
Joined
Jul 19, 2007
Messages
770
I showed you how to do it. There's like 1 Action you have to add, use search for text if you can't find it but as you can see it's under the Unit category:
  • Unit - Set Base Damage of (Last created unit) to DummyDamage for weapon index: 0

So rather than modifying an ability that adds damage based on it's level you instead modify the unit's damage directly. This action came with patch 1.31 so it wasn't an option back in the day.

DummyDamage is an Integer variable.
I tried to do like you showed me and I think it's working like it should now. I will be telling if it doesn't!
  • Split Cold Arrows
    • Events
    • Conditions
    • Actions
      • Set VariableSet Caster = (Triggering unit)
      • Set VariableSet Target = (Target unit of ability being cast)
      • Set VariableSet TempLoc = (Position of Caster)
      • Set VariableSet TempLoc2 = (Position of Target)
      • Set VariableSet AbilityLevel = (Level of (Ability being cast) for Caster)
      • Set VariableSet DummyDamage = ((Agility of Caster (Include bonuses)) + (100 x AbilityLevel))
      • Set VariableSet TempGroup = (Units within 250.00 of TempLoc2 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Triggering playe
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
        • Else - Actions
      • Set VariableSet TempInt2 = (Level of Split Cold Arrows for Caster)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy Attack for (Triggering player) at TempLoc facing Default building facing degrees
          • Set VariableSet TempUnit = (Last created unit)
          • Unit - Add Split Cold Arrows Dummy to TempUnit
          • Unit - Set level of Split Cold Arrows Dummy for TempUnit to TempInt2
          • Unit - Add a 1.00 second Generic expiration timer to TempUnit
          • Unit - Set Base Damage of TempUnit to DummyDamage for weapon index: 0
          • Unit - Order TempUnit to Neutral Sea Witch - Activate Frost Arrows.
          • Unit - Order TempUnit to Attack Once (Picked unit)
      • Custom script: call RemoveLocation (udg_TempLoc)
      • Custom script: call RemoveLocation (udg_TempLoc2)
      • Custom script: call DestroyGroup (udg_TempGroup)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,510
Looks good to me, the only thing I would change is (Triggering player) when you create the Dummy. Instead, use (Owner of (Triggering unit)). Triggering unit acts like a local variable which means that it will retain it's value throughout the entire trigger.

Also, that If Then Else can be deleted if you're not using it.
 
Status
Not open for further replies.
Top