For an ability I need to get the current weapon damage of a unit. The ability should scale with the unit's weapon damage, so if the unit has a lot of additional weapon damage (through items, buffs etc.) then the ability should also do more damage.
I made serveral abilities that scale with an attribute already, so I know how to setup the ability. But I can't seem to get the weapon damage PLUS the additional weapon damage as a number. I managed to get the BASE weapon damage via an catalog field value get function, but not any added weapon damage.
It's pretty simple. You don't need to do the catalog lookup. Just use the function "Weapon Damage". It should read something like "Maximize damage of Unit weapon 1 vs None". It returns a real value.
I'm sure. Just make sure that you're using it in the context of a Real value. Try setting a Real variable equal to it before making use of that variable.
I have a unit that uses a missile as ability, the missile has a behavior that does what it does. (It's a tornado ability, thus a missile makes sense). But I somehow need to change the damage this missile's behavior does based on an attribute on the caster.
The only way to do this efficiently is by trigger. Have your missile deal 0 damage with a dummy damage indicator, and have a trigger that responds to a unit taking damage from this damage indicator effect. Then calculate the damage, factoring in the caster's attribute, and deal that damage amount to the triggering unit via effect (trigger action categorized in environment).
Mind you, the caster in this case is NOT the damaging unit - the missile is the damaging unit. You will have to determine what the casting unit was in some other way. Say it was a hero - keep all the heroes in an array, indexed by player. Then access the hero from this array using damaging player.
Yes exactly, I know how to do this by trigger, as I did this with a lot of abilities already, but usually the caster is the damaging unit. The tricky part is that most things I tried didn't work.
The caster is ALWAYS the Titan, since this unit cannot be any other unit than THE titan. The Titan as a unit is stored in a global variable. But getting the attribute stacks through this global variable didn't work for some reason.
I'm sorry, but there is no function "Weapon Damage", it must be a custom made one. Try finding that function in a new map, if you do you can make a trigger and post it here.
For an ability I need to get the current weapon damage of a unit. The ability should scale with the unit's weapon damage, so if the unit has a lot of additional weapon damage (through items, buffs etc.) then the ability should also do more damage.
I made serveral abilities that scale with an attribute already, so I know how to setup the ability. But I can't seem to get the weapon damage PLUS the additional weapon damage as a number. I managed to get the BASE weapon damage via an catalog field value get function, but not any added weapon damage.
@Scythe1250: Go
It's pretty simple. You don't need to do the catalog lookup. Just use the function "Weapon Damage". It should read something like "Maximize damage of Unit weapon 1 vs None". It returns a real value.
You sure that function isn't a custom made one? Because I couldn't find anything related to "weapon" in the actions.
@Scythe1250: Go
I'm sure. Just make sure that you're using it in the context of a Real value. Try setting a Real variable equal to it before making use of that variable.
Also, it's categorized as a Unit function.
Great. I do have another problem though.
I have a unit that uses a missile as ability, the missile has a behavior that does what it does. (It's a tornado ability, thus a missile makes sense). But I somehow need to change the damage this missile's behavior does based on an attribute on the caster.
@Scythe1250: Go
The only way to do this efficiently is by trigger. Have your missile deal 0 damage with a dummy damage indicator, and have a trigger that responds to a unit taking damage from this damage indicator effect. Then calculate the damage, factoring in the caster's attribute, and deal that damage amount to the triggering unit via effect (trigger action categorized in environment).
Mind you, the caster in this case is NOT the damaging unit - the missile is the damaging unit. You will have to determine what the casting unit was in some other way. Say it was a hero - keep all the heroes in an array, indexed by player. Then access the hero from this array using damaging player.
Yes exactly, I know how to do this by trigger, as I did this with a lot of abilities already, but usually the caster is the damaging unit. The tricky part is that most things I tried didn't work.
The caster is ALWAYS the Titan, since this unit cannot be any other unit than THE titan. The Titan as a unit is stored in a global variable. But getting the attribute stacks through this global variable didn't work for some reason.
@Scythe1250: Go
Should work fine. That or the code is wrong in some way.
I'm sorry, but there is no function "Weapon Damage", it must be a custom made one. Try finding that function in a new map, if you do you can make a trigger and post it here.
@Scythe1250: Go
Don't know where the heck you're looking.
Oh well, I was trying to use Set Variable function in the actions, I didn't know you can use functions inside the variables themselves.
@Scythe1250: Go
How have you been managing without that? Hahaha.
You do know you can do it within the Set Variable function as well, right...?