I'm sorry if there is another thread covering this problem, but I couldn't find one.
To my problem: Imagine a unit that has multiple weapons. I'd like to create a galaxy function that lets the unit attack with only one of its weapons which is given by a parameter. Like this:
voidAttack(unitu,stringweapon){}
As I want to use this function in a mod, it has to be as general as possible. There is no direct way to implement it so now I'm looking for a work around. Unfortunately it is not possible to just remove all other weapons from the unit, save them in an array and give it back to the unit after the attack, because there is no way to retrieve the turret assigned to a weapon.
The only solution I found is to create a behavior for each weapon disabling it, and then use these behaviors to disable all weapons except the given one. But I don't like this solution as it requires a lot of work and is not very comfortable to users of the mod ...
The trouble is that the weapons of the unit may change in the game (e. g. through items) and so differ from the default weapons saved in the catalog.
If Blizzard could just add a "UnitGetWeaponTurret" or "UnitWeaponDisable" function ...
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm sorry if there is another thread covering this problem, but I couldn't find one. To my problem: Imagine a unit that has multiple weapons. I'd like to create a galaxy function that lets the unit attack with only one of its weapons which is given by a parameter. Like this:
As I want to use this function in a mod, it has to be as general as possible. There is no direct way to implement it so now I'm looking for a work around. Unfortunately it is not possible to just remove all other weapons from the unit, save them in an array and give it back to the unit after the attack, because there is no way to retrieve the turret assigned to a weapon. The only solution I found is to create a behavior for each weapon disabling it, and then use these behaviors to disable all weapons except the given one. But I don't like this solution as it requires a lot of work and is not very comfortable to users of the mod ...
Has anybody an idea?
I could think of using catalog functions to get the Turret of a weapon like:
(not exactly sure if the field value things are correct)
and by this removing and adding the weapons to the unit.
The trouble is that the weapons of the unit may change in the game (e. g. through items) and so differ from the default weapons saved in the catalog.
If Blizzard could just add a "UnitGetWeaponTurret" or "UnitWeaponDisable" function ...