- Joined
- Aug 13, 2007
- Messages
- 309
- Field Action - Attack Ground
- Stats: Cast Start Time + (0.1500)
I need to change this though. Right now the only way to do it seems to be to add a cooldown everytime I shoot and have 0.15 as the fastest possible shooting rate.
Here is a script I've made (haven't ever seen anyone else do this yet, anywhere):
JASS:
bool gt_onReload_Func (bool testConds, bool runActions) {
unit u = EventUnit();
int cv = FixedToInt(UnitGetCustomValue(u, c_uIndex));
fixed cooldown = UnitAbilityGetCooldown(u, ("AttackGround"), ("Abil/AttackGround"));
if (cooldown < 0.0) {
UnitAbilityAddChargeUsed(u, ("AttackGround"), ("Abil/AttackGround"), -100.0);
UnitAbilityAddCooldown(u, ("AttackGround"), ("Abil/AttackGround"), 1.25);
}
return true;
}
void gt_onReload_Init () {
TriggerAddEventUnitAbility(gt_onReload, null, AbilityCommand(c_reloadAbility, 0), c_unitAbilStageExecute, false);
}
I can add charges and cooldown to the ability.
So for now I have to change the fire rate of attack ground by adding cooldown each time it is fired but this is an annoying way to do things because:
A. You can't que commands properly when doing it this way.
B. You can't cast the ability at all when the cooldown is applied, not until the cooldown is over.
JASS:
//--------------------------------------------------------------------------------------------------
// Fire projectiles at target point (hotkey = A).
//--------------------------------------------------------------------------------------------------
bool gt_onAbilityCommand_Func (bool testConds, bool runActions) {
unit u = EventUnit();
point pt = UnitGetPosition(u);
point ptB = EventUnitTargetPoint();
fixed angle = AngleBetweenPoints(pt, ptB);
point ptA = PointWithOffsetPolar(pt, 0.75, angle);
int cv = FixedToInt(UnitGetCustomValue(u, c_uIndex));
actor act;
act = libNtve_gf_MainActorofUnit(u);
libNtve_gf_PlayAnimation(act, c_animNameDefault, "Attack", 0, c_animTimeDefault);
libNtve_gf_SetAnimationDuration(act, c_animNameDefault, 0.25);
libNtve_gf_SetAnimationTimeScale(act, c_animNameDefault, 1.0);
//libNtve_gf_MakeModelFaceAngle(libNtve_gf_MainActorofUnit(u), AngleBetweenPoints(UnitGetPosition(EventUnit()), OrderGetTargetPosition(EventUnitOrder())));
ActorLookAtStart(act, "Chest", 100, 0.25, libNtve_gf_LookAtTargetFromPointWithZOffset(ptB, 0.5));
UnitAbilityAddCooldown(u, ("AttackGround"), ("Abil/AttackGround"), 0.35);
gf_WeaponFire(u, gv_uWeapon[cv], pt, ptB);
return true;
}
//--------------------------------------------------------------------------------------------------
// Register the weapon fire ability.
void gt_onAbilityCommand_Init () {
TriggerAddEventUnitAbility(gt_onAbilityCommand, null, AbilityCommand(c_projFireAbility, 0), c_unitAbilStageExecute, false);
}
//--------------------------------------------------------------------------------------------------
The above makes it fire every 0.5 seconds. Btw, that chest facing thing... I haven't been able to get that to work for me either...
Is there a behaviour, function, or anything else I can use to change the casting time for an ability? Surely there must exist some modifiers that speed up or slow down an ability, just like there is stuff to do the same for weapons (stimpack for example)?