Jump to content

Home

Non-Jedi feat/powers question... (Wookie Rage in mind)


Recommended Posts

If you just want to check if the character is fighting barehanded, just use a conditional like...

 

if (!GetIsObjectValid( GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, oNPC) ))

 

...which would return true if the character has nothing equipped in their active weapon slot.

 

 

Mmm. Somehow I managed to *not* make it work, lol.

 

Tried with my own script (which worked for weapons), then gave up and tried copying/pasting/editing yours...

 

This is what I ended up with...

 

Oh, and I removed all that had to do with "ST_HasEquippedWeaponType" since it basically is of no use here...

 

void ST_RemoveOldEffects(object oTarget, int iSpellId);
void ST_EnforceWeaponRequirements(object oTarget, int iSpellId, float fTimer);



void main() {
   object oTarget = GetSpellTargetObject();
   effect eBonus;
   float fDur;



   // DR - This should be the hand-to-hand check...
   if (!GetIsObjectValid( GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, oTarget)))

   {
       return; 
   }


   // ST: Has Combat Omniscience feat
   if (GetFeatAcquired(246, oTarget)) {
       eBonus = EffectAttackIncrease(6);
       fDur = 30.0;
   }
   // ST: Has Combat Intuition feat
   else if (GetFeatAcquired(245, oTarget)) {
       eBonus = EffectAttackIncrease(4);
       fDur = 20.0;        
   }

   if (GetIsEffectValid(eBonus)) {
       // ST: If the ability is already active, remove existing effects
       //     before re-applying new ones.   
       ST_RemoveOldEffects(oTarget, GetSpellId());      

       // ST: Apply the effect
       effect eVis = EffectVisualEffect(9013);
       ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
       ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBonus, oTarget, fDur);   

       // ST: Make sure the character doesn't switch to a disallowed weapon.
       //     If they do, cancel the effects of the ability.
       ST_EnforceWeaponRequirements(oTarget, GetSpellId(), fDur); 
   }
}


void ST_EnforceWeaponRequirements(object oTarget, int iSpellId, float fTimer) {
   if (GetIsObjectValid(oTarget) && GetHasSpellEffect(iSpellId, oTarget)) {
       if (!GetIsObjectValid( GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, oTarget)))


       {
           ST_RemoveOldEffects(oTarget, iSpellId);
           return; 
       }

       if (fTimer > 0.0) {
           DelayCommand(1.0, ST_EnforceWeaponRequirements(oTarget, iSpellId, fTimer - 1.0));   
       }    
   }
}


void ST_RemoveOldEffects(object oTarget, int iSpellId) {
   if (GetHasSpellEffect(iSpellId, oTarget)) {
       effect eEff = GetFirstEffect(oTarget);

       while (GetIsEffectValid(eEff)) {
           if( GetEffectSpellId(eEff) == iSpellId) {
               RemoveEffect(oTarget, eEff);
           }
           eEff = GetNextEffect(oTarget);
       }
   }   
}

 

Compiles just fine, but it's just not working... Won't give a bonus to *anything* :(

 

Made sure PC had the right feat, so it's gotta be a problem with the script.

 

What went wrong?

 

Cheers,

 

DRRLZ

Link to comment
Share on other sites

Mmm. Somehow I managed to *not* make it work, lol.

   // DR - This should be the hand-to-hand check...
   if (!GetIsObjectValid( GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, oTarget))) {
       return; 
   }

 

The effects should only be applied when fighting bare-handed, correct? If so the above quoted check does exactly the opposite. If no weapon is equipped, the script execution is aborted. Similarily in the EnforceWeaponRequirements() function, the check there removes the buffs if no weapon is equipped. Remove the negation of the conditional and it'll probably work better. :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...