Jump to content

Home

[K2] Aim Blow Buff


2Corin517

Recommended Posts

I'm again following this: http://www.lucasforums.com/showthread.php?t=130898 and this:http://www.lucasforums.com/showthread.php?s=&threadid=137498 Tutorials. However my script won't seem to compile, on line 19 and 21 there are 2 errors... Both Identical: "Error: Undeclared identifier "FORCE_POWER_AIM_BLOW"" and "Error: Required Argument mission in call to "GetHasSpellEffect"" (With the exception of the second replace with RemoveEffect.)

 

#include "k_inc_force"

int FORCE_POWER_AiM_BLOW = 282;


void main()
{

    object oTarget = GetSpellTargetObject();    

    effect eTargetVisual;                       

    effect eBuff;                               

    int CasterLevel = GetHitDice(OBJECT_SELF);  

    SWFP_HARMFUL = TRUE;

    if(GetHasSpellEffect(FORCE_POWER_AIM_BLOW))
    {
         RemoveEffect(oTarget, FORCE_POWER_AIM_BLOW);
    }

    SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), SWFP_HARMFUL));

    eBuff = SetEffectIcon(eBuff, 85);  

    eBuff = EffectLinkEffects(eBuff, EffectAttackIncrease(3));
    eBuff = EffectLinkEffects(eBuff, EffectDamageDecrease(3));

    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBuff, oTarget, 12.0);
}

Link to comment
Share on other sites

However my script won't seem to compile, on line 19 and 21 there are 2 errors... Both Identical: "Error: Undeclared identifier "FORCE_POWER_AIM_BLOW""

 

int FORCE_POWER_AiM_BLOW = 282;

...

if(GetHasSpellEffect(FORCE_POWER_AIM_BLOW))

 

NWScript is case sensitive, thus...

FORCE_POWER_AiM_BLOW

...and...

FORCE_POWER_AIM_BLOW

...are considered to be two different variables. If that is meant to be the force power the script is run for you can just use GetSpellId() instead of hardcoding the spells.2da line value though.

 

Also, the RemoveEffect() function needs an effect as second parameter, determining what effect to remove, while you are using an integer constant. If you want to remove all effects applied by a certain force power, you can use a custom function like:

 

int FORCE_POWER_AIM_BLOW = 282;

[color="PaleGreen"]// ST: Support function - remove all effects applied by a certain spell[/color]
[color="PaleTurquoise"]void ST_RemovePowerEffects(object oTarget, int nPower) {
   if (GetHasSpellEffect(nPower, oTarget)) {
       effect eEff = GetFirstEffect(oTarget);
       while (GetIsEffectValid(eEff)) {
           if( GetEffectSpellId(eEff) == nPower) {
               RemoveEffect(oTarget, eEff);
           }
           eEff = GetNextEffect(oTarget);
       }
   }   
}[/color]

void main() { 
    object oTarget = GetSpellTargetObject();    
    effect eTargetVisual;                       
    effect eBuff;                               
    int CasterLevel = GetHitDice(OBJECT_SELF);  

    if(GetHasSpellEffect(FORCE_POWER_AIM_BLOW)) {
         [color="PaleTurquoise"]ST_RemovePowerEffects(oTarget, FORCE_POWER_AIM_BLOW);[/color]
    }

    SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

    eBuff = EffectLinkEffects(EffectDamageDecrease(3), EffectAttackIncrease(3));
    eBuff = SetEffectIcon(eBuff, 85);  

    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBuff, oTarget, 12.0);
}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...