I have an ability with charges, and a weapon, and I want that weapon to be disabled when that ability has 0 charges, and be reactivated when I have more than 0 charges.
I don't know why you need to do this. Technically, when charges are at 0, you're not supposed to be able to use that weapon anyway.
But okay.
Use a validator of type "CValidatorUnitCompareChargeUsed" which checks :
- When it's equal to 0
- When it's greater than 0 (optional).
Pay attention :
> If you set an ability, the value for the field is the link in "Cost" field of your ability WITHOUT the prefix "Abil/".
> If you don't set an ability neither a behavior, the value is the link WITH the prefix "Abil/".
In addition to this, you need to create a new behavior that controls your weapon.
Set modifications which deactivate the weapon. It should be temporary.
And finally, set validator (deactivate) with "CValidatorUnitCompareChargeUsed" when EQ 0. If the validator is false, the behavior is deactivated. That means we deactivate the weapon when the behavior is active, when the validator is true and thus when charges EQ 0.
Give the behavior to your unit.
And that should wrap your request.
Have a nice day.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
All is in the title !
I have an ability with charges, and a weapon, and I want that weapon to be disabled when that ability has 0 charges, and be reactivated when I have more than 0 charges.
How can I achieve this ?
Thanks :)
Hello.
I don't know why you need to do this. Technically, when charges are at 0, you're not supposed to be able to use that weapon anyway.
But okay.
Use a validator of type "CValidatorUnitCompareChargeUsed" which checks :
- When it's equal to 0
- When it's greater than 0 (optional).
Pay attention :
> If you set an ability, the value for the field is the link in "Cost" field of your ability WITHOUT the prefix "Abil/".
> If you don't set an ability neither a behavior, the value is the link WITH the prefix "Abil/".
In addition to this, you need to create a new behavior that controls your weapon.
Set modifications which deactivate the weapon. It should be temporary.
And finally, set validator (deactivate) with "CValidatorUnitCompareChargeUsed" when EQ 0. If the validator is false, the behavior is deactivated. That means we deactivate the weapon when the behavior is active, when the validator is true and thus when charges EQ 0.
Give the behavior to your unit.
And that should wrap your request.
Have a nice day.