Aller au contenu

Photo

Removing all affects on area enter.


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

#1
Rio420

Rio420
  • Members
  • 63 messages
So I've been digging into our module code the last few days, for some odd reason, when you first enter our module you get hit with a movement affect that causes the players to move a little more slowly than I'd prefer them to.  Upon resting, those affects disappear and all is well.  My question is, what function call is it that removes those affects to begin with, I looked at how our rest system works, and I'm just not sure at this point.  Is there a global function that simply heals and removes all the affects or does this have to be singled out to remove the affect?
 

#2
WhiZard

WhiZard
  • Members
  • 1 204 messages
Magical effects (default for most effects) are removed by resting and dispelling
Extraordinary effects are removed by resting
Supernatural effects are not removed by resting

You can set the effect subtype by the functions
MagicalEffect() ExtraordinaryEffect() and SupernaturalEffect()

#3
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages
I'd be wary of changing things until you understand why they are the way they are to begin with - generally speaking. For all I know it's some esoteric HC rules thing. :P You might want to run a search of the mod scripts for that effect type, to see if it's checked anywhere.

Funky

#4
ffbj

ffbj
  • Members
  • 593 messages
AssignCommand(oCaster, ActionCastSpellAtObject(SPELL_GREATER_RESTORATION, oPC, METAMAGIC_ANY, TRUE, 10, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
Where oCaster is the Module and oPC is the module enterer.
Anyway you may want to think about it as FS indicated...It could be a fail safe mechanism to prevent people from logging in and out to avoid something. If that does not work you can follow the structure of while loop to remove that specific movement speed decrease effect.

effect eBad = GetFirstEffect(oTarget);
//Search for negative effects
while(GetIsEffectValid(eBad))
{
if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS ||
GetEffectType(eBad) == EFFECT_TYPE_DEAF ||
GetEffectType(eBad) == EFFECT_TYPE_PARALYZE ||
GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL)
{
//Remove effect if it is negative.
if(!GetIsSupernaturalCurse(eBad))
RemoveEffect(oTarget, eBad);
}
eBad = GetNextEffect(oTarget);
}
So the above is part standard restoration spell you could write your own to remove any specific effect(s). To further illustrate the point. Some boots of speed:

//boots of speed by ffbj
#include "x2_inc_switches"
void main()
{
object oPC = GetPCItemLastEquippedBy();
int nEvent = GetUserDefinedItemEventNumber();
object oItem = GetItemInSlot(INVENTORY_SLOT_CHEST, oPC);
int nItem = GetBaseItemType(oItem);
if (nEvent == X2_ITEM_EVENT_EQUIP)
{

effect eEffect = EffectMovementSpeedIncrease(112 + d4(2));
effect eEffect1 = EffectMovementSpeedIncrease(105 + d4(1));
//change number to change speed
effect eSpeed = SupernaturalEffect(eEffect);
effect eSpeed1 = SupernaturalEffect(eEffect);
if ((nItem == BASE_ITEM_ARMOR) && (GetWeight(oItem) > 20))
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eSpeed1, oPC);
else
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eSpeed, oPC);
return;
}

else if (nEvent == X2_ITEM_EVENT_UNEQUIP)
{
object oPC = GetPCItemLastUnequippedBy();
effect eSpeed = GetFirstEffect(oPC);
// check fo this effect
while (GetIsEffectValid(eSpeed))
{
if (GetEffectType(eSpeed) == EFFECT_TYPE_MOVEMENT_SPEED_INCREASE)
RemoveEffect(oPC, eSpeed);
eSpeed = GetNextEffect(oPC);
}

}


}

#5
WhiZard

WhiZard
  • Members
  • 1 204 messages

ffbj wrote...

effect eEffect = EffectMovementSpeedIncrease(112 + d4(2));
effect eEffect1 = EffectMovementSpeedIncrease(105 + d4(1));
//change number to change speed
effect eSpeed = SupernaturalEffect(eEffect);
effect eSpeed1 = SupernaturalEffect(eEffect);


The EffectMovementSpeedIncrease() command is not a continuous function. Up to 99 it acts as a percentage for increasing the speed.  100 and above it acts as setting the speed to a percentage of the prior value.  That is 12 is the same improvement as 112 each adding 12% additional speed or multiplying your current speed by 112%.

Modifié par WhiZard, 10 septembre 2013 - 06:45 .


#6
ffbj

ffbj
  • Members
  • 593 messages
Ah, so essentially no effect writing it as I did since the 100% is already there.