Aller au contenu

Photo

Passive feat scripting/triggering


  • Veuillez vous connecter pour répondre
9 réponses à ce sujet

#1
Laugh out loud

Laugh out loud
  • Members
  • 109 messages

Hello I am doing some troubleshooting into passive feat that may be firing in a loop (and possibly stacking.)  For example I have this custom passive feat script; 

 

 

const int FEAT_PRIVATEER_TAUNTING = 2859;
void main()
{
   object oPC = GetLastPCRested();
   object oTarget = OBJECT_SELF;
   if(GetHasFeat(2859, oTarget) && (GetLocalInt(oPC,"FEAT_PRIVATEER_TAUNTING") <1))
      SetLocalInt(oPC,"FEAT_PRIVATEER_TAUNTING",1);
   
   effect eEffect = EffectSkillIncrease(SKILL_TAUNT, 3);
   effect eEffect1 = EffectSavingThrowIncrease(SAVING_THROW_ALL, 1, SAVING_THROW_TYPE_MIND_SPELLS);
   effect eEffect2 = EffectSavingThrowIncrease(SAVING_THROW_ALL, 1, SAVING_THROW_TYPE_FEAR);
   eEffect = SupernaturalEffect(eEffect);
   eEffect1 = SupernaturalEffect(eEffect1);
   eEffect2 = SupernaturalEffect(eEffect2);
   ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, HoursToSeconds(72));
   ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect1, oTarget, HoursToSeconds(72));
   ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect2, oTarget, HoursToSeconds(72));
}
 
 
and I am using a custom On_Rest script to fire the feat;
 
 
void main()
{
   object oPC = GetLastPCRested();
   object oTarget = OBJECT_SELF;
   if(GetHasFeat(2859, oTarget)>0)
   ExecuteScript("feat_privateer_taunting", oTarget);
}
 
 
To fire the script.  If this the best method of firing a passive feat script or, is there another way I do not know about?  I am trying to avoid script firing loops and "Too Many Effect" errors.

 



#2
rjshae

rjshae
  • Members
  • 4 485 messages

You could apply a SetEffectSpellId to the feat effect so that you can track it and abort it using GetEffectSpellId, if necessary.



#3
Dann-J

Dann-J
  • Members
  • 3 161 messages

You could apply a SetEffectSpellId to the feat effect so that you can track it and abort it using GetEffectSpellId, if necessary.

 

That's certainly the approach I would take; lump everything together into a single effect using EffectLinkEffects() and then give it a dummy spell number via SetEffectSpellId(). Then have the OnRest script remove the tagged effect via RemoveEffectsFromSpell() before adding it back again:

#include "nw_i0_spells"

void main()

{
   object oPC = GetLastPCRested();
   object oTarget = OBJECT_SELF;

   if(GetHasFeat(2859, oTarget))
     {
     RemoveEffectsFromSpell(oTarget, 9999);// Where 9999 is the spell ID used to tag the effect
     ExecuteScript("feat_privateer_taunting", oTarget);
     }

}

Is there really any need to define both oPC and oTarget in that OnRest script though? OBJECT_SELF will return different things depending on what the script is running from.



#4
Laugh out loud

Laugh out loud
  • Members
  • 109 messages
I separated OBJECT_SELF and oTarget so companions could have and use the feat

#5
Laugh out loud

Laugh out loud
  • Members
  • 109 messages
Do you have to use a dummy SpellID or can you simply use the spell 's ID# from the Spells.2da file?

#6
rjshae

rjshae
  • Members
  • 4 485 messages

Do you have to use a dummy SpellID or can you simply use the spell 's ID# from the Spells.2da file?

 

You can use any ID you want. I set it to a high value so it is unlikely to collide with somebody else's mod or an existing spell.



#7
kevL

kevL
  • Members
  • 4 056 messages
( just close your eyes and type out a five-digit number )


err, might be wise to keep it under 65000. [edit] err 32,000 ...

#8
Dann-J

Dann-J
  • Members
  • 3 161 messages

I often use the spell ID for the Light spell, since it's easy to remember (100) and I generally don't care if a light spell is actually removed at the same time as my tagged effects. For hostiles it's a moot point, since you can't cast Light on a hostile, and their AI won't have them cast it on themselves.



#9
kevL

kevL
  • Members
  • 4 056 messages
hm i see my ACP -> -Reflex save uses 74925

so I guess it's 4-byte ( ~lots)

#10
Clangeddin86

Clangeddin86
  • Members
  • 220 messages

The best way to fire passive feats is to make them persistent (will fire on rest, level up, area transiction and game load) in the feat .2da and associating to them a spell on spells.2da that will fire the script you want on "impact script".

 

I'd have to understand what you're trying to do with this feat though, as I see there are two different subjects, the oTarget and the oPC, are they supposed to be the same character? And why is the feat not permanent and lasts for 72 hours?