Parameters:
oCreature
- owner of the ability
nAbilityId
- ability to set the cooldown
fCooldownTime
- time that the ability should be inactive (in seconds)
sSourceItemTag
- if an item ability, specify the specific item providing the ability. If an
empty string, the engine will grab the first item with this ability, this may
not be the desired intention if the player has several items with the same
ability.
Now, for the below script, I leave the sSourceItemTag empty because it's a dynamic script and there is no way for me to get the itemtag when I only know the ability which is fired, at least not to my knowledge. Seeing as how the abilities are called "ABILITY_ITEM_LESSER_HEALTH_POULTICE", etc, I was under the assumption that these abilities would only be tied to one item and so the first item is always the correct one.
However, when using the script, nothing happens (if I use floaty messages, they fire correctly, so the script is working correctly). After some testing I found that if I swap last line of code:
SetCooldown(stEvent.oCaster, 200010 + i, 5.0f);
to
SetCooldown(stEvent.oCaster, 200010 + i, 5.0f, "gen_im_qck_health_201");
Now the last part of the script works, although only on the health poultice, not the lesser/greater/potent, which is as expected.
Now my question is, why won't it work without the ItemTags? Is the description wrong in saying that I can leave it empty or are these abilities actually called by some other items and are the cooldowns wrongly applied on those items instead of the healing poultices?
case ABILITY_ITEM_LESSER_HEALTH_POULTICE:
case ABILITY_ITEM_HEALTH_POULTICE:
case ABILITY_ITEM_GREATER_HEALTH_POULTICE:
case ABILITY_ITEM_POTENT_HEALTH_POULTICE:
{
object [] arTeam = GetPartyList(stEvent.oCaster)
int nSize = GetArraySize(arTeam);
int i;
object oCurrent;
float fItemCooldown = Ability_GetCooldown(stEvent.oCaster, stEvent.nAbility);
for(i = 0; i < nSize; i++)
{
oCurrent = arTeam[i];
if(oCurrent != stEvent.oCaster &&
FloatToInt(GetRemainingCooldown(oCurrent, stEvent.nAbility)) == 0)
{
SetCooldown(oCurrent, stEvent.nAbility, fItemCooldown * 0.25);
}
}
for(i = 0; i < 4; i++)
{
if(200010 + i != stEvent.nAbility &&
FloatToInt(GetRemainingCooldown(stEvent.oCaster, 200010 + i)) == 0)
{
SetCooldown(stEvent.oCaster, 200010 + i, 5.0f);
}
}
}
Modifié par Joshua Raven, 27 novembre 2009 - 06:47 .





Retour en haut






