• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[General] How to change attack type with items?

Status
Not open for further replies.
Level 6
Joined
Jul 9, 2014
Messages
113
I've got a hero that uses the villager's model and I would like that when he picks up an item (like an axe) it's attack type changes from Hero to Chaos type.

Can any one please help me?
Thanks
 
Level 8
Joined
Jul 8, 2013
Messages
249
If what you want is for the attack to DO chaos damage then that's easy; set the guy's actual attack damage to 0 (Put base damage at -1, dice at 1, and number of sides per die at 1) and then just make a trigger such that when he attacks a target he inflicts damage (and that action will let you choose whatever damage type you want based on what gear he has).

If you want the hero's attack type to actually change, things get a bit tougher. As far as I'm aware, you'll actually have to use a different unit- either replacing the hero or morphing him into the new unit.
 
Level 6
Joined
Jul 9, 2014
Messages
113
If you want the hero's attack type to actually change, things get a bit tougher. As far as I'm aware, you'll actually have to use a different unit- either replacing the hero or morphing him into the new unit.

I want this. I've tried the trigger that when the unit picks up the item it is replaced by another one (one with chaos attack) but my game crushed when he picked up the item.
 
Level 8
Joined
Jul 8, 2013
Messages
249
I would try fiddling around with that trigger a little bit to try to find the true source of the problem. Does it crash if you pick up the item when the trigger is disabled? Does it crash if there's a .01 second wait before the replacement? Etc.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
I want this. I've tried the trigger that when the unit picks up the item it is replaced by another one (one with chaos attack) but my game crushed when he picked up the item.

That actually IS the best way to do it.
I use it in many of my maps.

The crash is probably caused because it changed the actual unit to a new one (new handle id)
To prevent that, you have to change the units type id by a transform ability.
Make an ability based of bear form or crow form. Then set the alternative unit type to the original type of your unit and set the standard unit type to the unit with the chaos attack.

Set all stuff like duration, interval, stuff (havent got editor open but you have to set all other stuff to 0.)

Then add that ability to the unit and remove it. DONT issue order to cast it.
By adding the ability, the unit's type id changes to the standard type if he is the alternative type.

Make the same ability but switch the units when that unit drops/sells that item.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,207
Wietlol's approach sounds the best way to do it if it works.

Chaos (the ability) should in theory do it but it has a huge number of other issues like infinite state gain which make it non-viable.

In SC2 this would be super easy with you disabling one weapon and adding another.
 
Level 6
Joined
Jul 9, 2014
Messages
113
That actually IS the best way to do it.
I use it in many of my maps.

The crash is probably caused because it changed the actual unit to a new one (new handle id)
To prevent that, you have to change the units type id by a transform ability.
Make an ability based of bear form or crow form. Then set the alternative unit type to the original type of your unit and set the standard unit type to the unit with the chaos attack.

Set all stuff like duration, interval, stuff (havent got editor open but you have to set all other stuff to 0.)

Then add that ability to the unit and remove it. DONT issue order to cast it.
By adding the ability, the unit's type id changes to the standard type if he is the alternative type.

Make the same ability but switch the units when that unit drops/sells that item.

It worked, thanks +rep :ogre_haosis:
 
Status
Not open for further replies.
Top