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

[Trigger] Setting unit armor part 2 [Reforged, latest patch]

Status
Not open for further replies.
Level 12
Joined
Feb 5, 2018
Messages
521
Hello again, I made a work around with items while setting a unit armor using custom stats with triggering. Adding the armor ability to the item after setting the armor works like a charm.

Now the issue is that I didn't take into count that what if the unit is already holding items with armor, while getting stat bonus from item that increases the base armor of the unit.

On my previous thread about setting unit armor, I made a workaround in the level up system to order drop all items and then give them back.

Sadly using only triggers to set the stats turned out to be a bit of a pain.

The current map size is near 30mb, but I can share it from the pastebin, if it is easier to fix the triggers that way.

Cheers! :)

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Item-type of (Item being manipulated)) Equal to |cff00ff00Jade Ring|r
    • Then - Actions
      • Set VariableSet StatsPlayerNumber = (Player number of (Owner of (Triggering unit)))
      • -------- Item bonus --------
      • Set VariableSet Agility[StatsPlayerNumber] = (Agility[StatsPlayerNumber] + 1)
      • -------- Adjust stats --------
      • -------- Armor --------
      • Unit - Set Armor of HeroUnit[StatsPlayerNumber] to ((Real(Agility[StatsPlayerNumber])) + ((Real(Toughness[StatsPlayerNumber])) / 2.00))
      • -------- Attack Speed --------
      • Unit - Set level of Attack Speed (1% for each level) for HeroUnit[StatsPlayerNumber] to Agility[StatsPlayerNumber]
    • Else - Actions

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Item-type of (Item being manipulated)) Equal to Zombie Mask
    • Then - Actions
      • Set VariableSet StatsPlayerNumber = (Player number of (Owner of (Triggering unit)))
      • -------- Item bonus --------
      • Set VariableSet Toughness[StatsPlayerNumber] = (Toughness[StatsPlayerNumber] + 1)
      • Set VariableSet Intelligence[StatsPlayerNumber] = (Intelligence[StatsPlayerNumber] + 1)
      • -------- Adjust stats --------
      • -------- HP --------
      • Unit - Set Max HP of HeroUnit[StatsPlayerNumber] to (HitPoints[StatsPlayerNumber] + (Toughness[StatsPlayerNumber] x 7))
      • -------- Armor --------
      • Unit - Set Armor of HeroUnit[StatsPlayerNumber] to ((Real(Agility[StatsPlayerNumber])) + ((Real(Toughness[StatsPlayerNumber])) / 2.00))
      • Item - For Item: (Item being manipulated), Add Ability: Item Armor Bonus (+7)
      • -------- Mana --------
      • Unit - Set Max Mana of HeroUnit[StatsPlayerNumber] to (Intelligence[StatsPlayerNumber] x (4 + (Focus[StatsPlayerNumber] / 2)))
    • Else - Actions
 
Level 12
Joined
Feb 5, 2018
Messages
521
Push and a note from another trigger.

  • Demonic Fury
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Demonic Fury (completed)
    • Actions
      • Unit - Set Armor of DemonicFury_Caster to ((Armor of DemonicFury_Caster) + (8.00 x (Real(DemonicFury_Level))))
Oddly enough this works, I pulled this trigger from another project. I only copy pasted the armor part, but this trigger uses locals.

It doesn't matter if the unit has bonus armor or not, it always gains 8 armor. A bit confusing.
 
Status
Not open for further replies.
Top