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

[Trigger] Orb effect magic damage - MUI Effect

Status
Not open for further replies.
Level 4
Joined
Sep 25, 2018
Messages
81
I am trying to get an Orb Item to change the Hero's attack type to magic by saving it's orginal attack type using Hashtables.

Below is what I have so far...

  • Acquires
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Orb of Frost
    • Actions
      • -------- Store units original Attack Type in Hashtable --------
      • Hashtable - Save (Unit: (Triggering unit)'s Weapon Integer Field: Attack Attack Type ('ua1t') at Index:0) as (Key OT_AttackType.) of (Key OT_Handle.) in OT_HastTable.
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit: (Triggering unit)'s Weapon Integer Field: Attack Attack Type ('ua1t') at Index:0) Not equal to 4
        • Then - Actions
          • -------- Set units Attack Type to Magic --------
          • Unit - Set Unit: (Triggering unit)'s Weapon Integer Field: Attack Attack Type ('ua1t')at Index:0 to Value: 4
        • Else - Actions
  • Drops
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Orb of Frost
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Load (Key OT_AttackType.) of (Key OT_Handle.) from OT_HastTable.) Not equal to 4
        • Then - Actions
          • Unit - Set Unit: (Triggering unit)'s Weapon Integer Field: Attack Attack Type ('ua1t')at Index:0 to Value: (Load (Key OT_AttackType.) of (Key OT_Handle.) from OT_HastTable.)
        • Else - Actions
When the Hero picks up the Orb Item, it saves his current attack type then changes it to attack type magic.

The problem I have is that it does not seem to save the attack type correctly. For my Heroes with Pierce damage, it works correctly. However, Heroes with Normal damage, once the Orb Item is dropped (after being picked up) it completely removes the Hero's ability to attack until it picks the Orb Item back up. It should obviously return that Hero's attack type back to Normal.

Please help!
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
Are you using both attack indices on the heroes? If not you could just do what the orbs do and enable attack 2 (ranged but same damage type and numbers by default) when the orb is picked up. Set attack 2 to be identical but use magic as its attack type.
 
Level 4
Joined
Sep 25, 2018
Messages
81
Are you using both attack indices on the heroes? If not you could just do what the orbs do and enable attack 2 (ranged but same damage type and numbers by default) when the orb is picked up. Set attack 2 to be identical but use magic as its attack type.
I tried that originally, but unfortunately, that method does not work. It does not consistently change the attack type to magic. (Which is needed for other mechanics in my map).

Also, I like the visual change to the attack type icon when I trigger the attack type change (which you would not get if you did it by enabling attack 2).
 
Last edited:
Level 4
Joined
Sep 25, 2018
Messages
81
Should your condition "Not equal to 4" not be "equal to 4" in the unit loses an item trigger?

Because that is what you set it to in the other trigger.
Yes, I think it is correct. Because then it only changes back if the original attack type was not Magic.

I was getting a strange error where if my Hero’s attack type was already magic damage, when he dropped the item (after having it in his inventory), it would make it so he could only attack air units (if he was not holding the Orb Item). That is why I had to set it to ignore the Heroes which already had attack type Magic.
 
Last edited:
Level 4
Joined
Sep 25, 2018
Messages
81
You need to debug your script then.

What does "Weapon Integer Field: Attack Attack Type ('ua1t') at Index:0)" return at the first script? What does it return at the second?
Ok, so I did a load of tests to see what my script was doing and the problem seems to be coming from setting the attack type value to 1 (Normal);

  • Unit - Set Unit: (Hero manipulating item)'s Weapon Integer Field: Attack Attack Type ('ua1t')at Index:0 to Value: 1
All the other attack type values work except for value 1 (Normal). However, if I set the attack type value to 0, I get back attack type Normal, but it completely removes the Weapon Sound.

So it is not a problem with my Hashtable, but a problem with the Warcraft 3 engine...

Sigh....

Edit: Ugh, this engine! So the "Set Unit: Weapon Integer Field:" does not work for any of the attack types except Pierce, Magic and Hero. So you can swap between those three attack types without issue. But if you try it with the others, you are going to have all sorts of unexplained problems.

Hopefully they'll fix it at some point...
 
Last edited:
Status
Not open for further replies.
Top