Aller au contenu

Photo

Locking out spells/talents


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

#1
jsd313

jsd313
  • Members
  • 184 messages
I have a couple spells using this setup but they don't work. Am I scripting it wrong or do these effect flags affect the PC only?

[dascript]
case ABILITY_SPELL_SILENCE:
        {
            // remove stacking effects
            RemoveStackingEffects(stEvent.oTarget, stEvent.oCaster, stEvent.nAbility);
           
            if (ResistanceCheck(stEvent.oCaster, stEvent.oTarget, PROPERTY_ATTRIBUTE_SPELLPOWER, RESISTANCE_PHYSICAL) == FALSE)
            {
            //Silence effect
            eEffect = SetEffectFlags(eEffect, EFFECT_FLAG_DISABLE_SPELLS);
            eEffect = SetEffectFlags(eEffect, EFFECT_FLAG_DISABLE_TALENTS);
            ApplyEffectOnObject(EFFECT_DURATION_TYPE_TEMPORARY, eEffect, stEvent.oTarget, 6.0f, stEvent.oCaster, stEvent.nAbility); 
            }
            break;
        }
[/dascript]

#2
Craig Graff

Craig Graff
  • Members
  • 608 messages
I've never used effect flags myself, so I don't really know about their effects, but even if they do work as you expect them to you will need to change your code a bit if you want both spells and talents disabled. Notice the bitwise or (|=) below.


[dascript]
case ABILITY_SPELL_SILENCE:
        {
            // remove stacking effects
            RemoveStackingEffects(stEvent.oTarget, stEvent.oCaster, stEvent.nAbility);
           
            if (ResistanceCheck(stEvent.oCaster, stEvent.oTarget, PROPERTY_ATTRIBUTE_SPELLPOWER, RESISTANCE_PHYSICAL) == FALSE)
            {
            //Silence effect
            eEffect = SetEffectFlags(eEffect, EFFECT_FLAG_DISABLE_SPELLS | EFFECT_FLAG_DISABLE_TALENTS);
            ApplyEffectOnObject(EFFECT_DURATION_TYPE_TEMPORARY, eEffect, stEvent.oTarget, 6.0f, stEvent.oCaster, stEvent.nAbility); 
            }
            break;
        }
[/dascript]

Modifié par Craig Graff, 02 avril 2010 - 06:48 .


#3
jsd313

jsd313
  • Members
  • 184 messages
What do the pipes do? I added them and the script barked at me Logical operation has invalid operands (while compiling var_constants_h.nss)


#4
Craig Graff

Craig Graff
  • Members
  • 608 messages
Sorry, that will teach me not to post after rolling out of bed (well, probably it won't, but it should). I've fixed the above code.

| is a bitwise OR, basically the same as a +, but it obviously needs to be applied to the flags, not effects.

Modifié par Craig Graff, 02 avril 2010 - 06:50 .


#5
jsd313

jsd313
  • Members
  • 184 messages
I gotcha, I had originally tried something similiar there, used a comma instead but that didn't work ><



Script exports will test and let ya know, thank you Craig.

#6
jsd313

jsd313
  • Members
  • 184 messages
Nah it doesn't work. I'm thinking the effect flags only affect the controlled player.

#7
TimelordDC

TimelordDC
  • Members
  • 923 messages
Do you have eEffect defined elsewhere?

If you look in the core scripts, you will see eEffect either defined as an EFFECT_TYPE_ constant or will be constructed using a EffectModifyProperty constructor. I suppose the FLAG can be assigned only on a defined Effect.

#8
jsd313

jsd313
  • Members
  • 184 messages
I'm going to mess around with it a bit more but if I can't figure it out I'll just replace the 2 abilities. Thanks

Modifié par jsd313, 02 avril 2010 - 08:06 .


#9
LightPhoenix

LightPhoenix
  • Members
  • 26 messages
Does it only require one pipe, or two? Usually in coding a logical OR is ||.