Help with Removing Modify Attacks..
#1
Posté 09 août 2010 - 04:53
eEffect = EffectModifyAttacks(1);
From the PC once it has been applied...
The only solution I could find was to set it like so...
eEffect = SupernaturalEffect(eEffect);
And then to remove it by checking the subtype of the effect, and if it was Supernatural Remove it...
However, I need to know if there is a more effective way to remove the effect (Modify Attacks) from the PC.. properly..
Anyone?
#2
Posté 09 août 2010 - 06:30
Second way using system creature too - effect creator, give it tag like EC_MODIFYATTACK. Tell this creture to apply the modify effect and then check of tag of effect creator == "EC_MODIFYATTACK"
#3
Posté 10 août 2010 - 11:42
#4
Posté 10 août 2010 - 05:42
-420
#5
Posté 11 août 2010 - 04:58
#6
Posté 11 août 2010 - 05:23
example to remove the effect:if(GetHasFeat(FEAT_NINJA_GHOST_SIGHT,oPC))
{
AssignCommand(GetObjectByTag("EC_NINJA"),ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectSeeInvisible()),oPC));
}
effect e = GetFirstEffect(oPC);
string sTag;
while(GetIsEffectValid(e))
{
sTag = GetTag(GetEffectCreator(e)) ;
if(sTag == "EC_NINJA")
{
RemoveEffect(oPC,e);
}
e = GetNextEffect(oPC);
}
Modifié par ShaDoOoW, 11 août 2010 - 05:24 .
#7
Posté 11 août 2010 - 10:24
oWay = GetWaypointByTag("ninja_way");
oNinja = GetNearestObjectByTag("EC_NINJA", oWay);
I'll assume it's best to create and destroy this ninja, and not just leave him laying around?
Does the ninja have to be a creature?
#8
Posté 11 août 2010 - 11:17
You don't need waypoint just creature or placeable (but if it won't work don't blame me) in special system area. For example my EC_NINJA is actually lvl 1 immortal/plot chicken without any scripts.
Modifié par ShaDoOoW, 11 août 2010 - 11:18 .
#9
Posté 11 août 2010 - 11:37
No reason not to. Just put it in a 2x2 microset area with no area transitions.I'll assume it's best to create and destroy this ninja, and not just leave him laying around?
Like I said, I use Invisible Object placeables.Does the ninja have to be a creature?
-420
#10
Posté 12 août 2010 - 01:56
kk now when its clear, using placeable is much better than creature420 wrote...
Like I said, I use Invisible Object placeables.
#11
Posté 12 août 2010 - 02:29
The waypoint is so I don't have to use the GetObjectByTag Function, which cycles through the whole module to find the object, (not good).
thanks a lot for the help guys... I'll test this today.
#12
Posté 12 août 2010 - 03:24
object EC_MODIFYATTACK = GetObjecByTag("EC_MODIFYATTACK");
SetLocalObject(OBJECT_SELF,"EC_MODIFYATTACK",EC_MODIFYATTACK);
#13
Posté 12 août 2010 - 05:09
-420
#14
Posté 13 août 2010 - 03:36
#15
Posté 29 avril 2013 - 10:23
It DOES NOT Remove the effect, also I've quadruple checked my scripts and items....
In the next post is the script I used... (Any Help?)
Modifié par _Guile, 29 avril 2013 - 10:26 .
#16
Posté 29 avril 2013 - 10:26
// (NOTE: This is a template script, save it under a new name FIRST)
////////////////////////////////////////////////////////////////////////////////
// Created by: The Krit
// Created on: 04-03-2010
// Modified by: Genisys / Guile
// Modified on: 04-30-2011
///////////////////////////////////////////////////////////////////////////////
// This is intended to be a starting point for writing an item's tag-based script.
// Copy this to a script whose name is the tag of the item in question.
// Edit the event handlers (scroll down to find them) as desired.
// -----------------------------------------------------------------------------
//Required Include (DO NOT TOUCH!)
#include "x2_inc_switches"
//------------------------------------------------------------------------------
// Delcare ALL Common Integers / Floats / Strings
// NOTE: These can be used anywhere in any of the Prototypes
// By declaring at the top of the script they do not need to be delcared anywhere else!
int nInt, i, nGold, nXP, nclass, nCon; // nCon = nConstant
float fDelay, fTime;
string sName, sTag, sMsg, sResref;
//Add more if needed!
// -----------------------------------------------------------------------------
// Event handlers
// -----------------------------------------------------------------------------
// This second part is where you add your desired functionality. Each event
// has its own function with relavant information passed as parameters.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// oItem was acquired (by a PC or an NPC).
// Run by the module.
void OnAcquire(object oItem, object oAcquiredBy, object oTakenFrom, int nStackSize)
{
// Enter code to execute when this event happens
}
// -----------------------------------------------------------------------------
// oItem was activated ("activate item" or "unique power").
// Run by the module.
void OnActivate(object oItem, object oActTarget, location lActTarget, object oActivator)
{
// Enter code to execute when this event happens
}
// -----------------------------------------------------------------------------
// oItem was equipped by a PC.
// Run by the module.
void OnEquip(object oItem, object oEquippedBy)
{
object oWay = GetWaypointByTag("ec_caster_way");
object oEC = GetNearestObjectByTag("eff_caster", oWay);
effect eMas = EffectModifyAttacks(1);
eMas = SupernaturalEffect(eMas);
effect eVis = EffectVisualEffect(VFX_DUR_IOUNSTONE_YELLOW);
if(oWay == OBJECT_INVALID)
{
FloatingTextStringOnCreature("ERROR, notify DMs that the waypoint for this item is missing!", oEquippedBy, TRUE);
return;
}
if(oEC == OBJECT_INVALID)
{
oEC = CreateObject(OBJECT_TYPE_PLACEABLE, "eff_caster", GetLocation(oWay), FALSE);
}
AssignCommand(oEC, ApplyEffectToObject(
DURATION_TYPE_PERMANENT, eMas, oEquippedBy));
AssignCommand(oEC, ApplyEffectToObject(
DURATION_TYPE_PERMANENT, eVis, oEquippedBy));
}
// -----------------------------------------------------------------------------
// oItem is a weapon that just hit a target, or it is the armor of someone who
// was just hit by someone else's weapon.
// Run by the caster.
void OnHit(object oItem, object oHitTarget, object oCaster)
{
// Enter code to execute when this event happens
}
// -----------------------------------------------------------------------------
// Someone cast a spell at oItem.
// Run by the caster.
int OnSpellCast(object oItem, int nSpell, object oCaster)
{
// Enter code to execute when this event happens
return FALSE; //Necessary return (Do this !)
}
// -----------------------------------------------------------------------------
// oItem was unacquired/lost (by a PC or NPC).
// Run by the module.
void OnUnacquire(object oItem, object oLostBy)
{
// Enter code to execute when this event happens
}
// -----------------------------------------------------------------------------
// oItem was unequipped by a PC.
// Run by the module.
void OnUnequip(object oItem, object oUnequippedBy)
{
//Remove Speed Increase
object oPC = oUnequippedBy;
effect e = GetFirstEffect(oPC);
string sTag;
while(GetIsEffectValid(e))
{
sTag = GetTag(GetEffectCreator(e)) ;
if(sTag == "eff_caster")
{
FloatingTextStringOnCreature("Effect Removed!", oPC, FALSE);
RemoveEffect(oPC, e);
}
e = GetNextEffect(oPC);
}
}
//////////////////////////////////////////////////////////////////////////////
// ##### WARNINING:: DON'T TOUCH ANYTHING BELOW THIS LINE!!! #### ///////////
////////////////////////////////////////////////////////////////////////////
// The main function.
void main()
{
int nEvent = GetUserDefinedItemEventNumber();
// Spells might continue to their spell scripts. All other events are
// completely handled by this script.
if ( nEvent != X2_ITEM_EVENT_SPELLCAST_AT )
SetExecutedScriptReturnValue();
// Determine which event triggered this script's execution.
switch ( nEvent )
{
// Item was acquired.
case X2_ITEM_EVENT_ACQUIRE:
OnAcquire(GetModuleItemAcquired(), GetModuleItemAcquiredBy(),
GetModuleItemAcquiredFrom(), GetModuleItemAcquiredStackSize());
break;
// Item was activated ("activate item" or "unique power").
case X2_ITEM_EVENT_ACTIVATE:
OnActivate(GetItemActivated(), GetItemActivatedTarget(),
GetItemActivatedTargetLocation(), GetItemActivator());
break;
// Item was equipped by a PC.
case X2_ITEM_EVENT_EQUIP:
OnEquip(GetPCItemLastEquipped(), GetPCItemLastEquippedBy());
break;
// Item is a weapon that just hit a target, or it is the armor of someone
// who was just hit.
case X2_ITEM_EVENT_ONHITCAST:
OnHit(GetSpellCastItem(), GetSpellTargetObject(), OBJECT_SELF);
break;
// A PC (or certain NPCs) cast a spell at the item.
case X2_ITEM_EVENT_SPELLCAST_AT:
if ( OnSpellCast(GetSpellTargetObject(), GetSpellId(), OBJECT_SELF) )
SetExecutedScriptReturnValue();
break;
// Item was unacquired.
case X2_ITEM_EVENT_UNACQUIRE:
OnUnacquire(GetModuleItemLost(), GetModuleItemLostBy());
break;
// Item was unequipped by a PC.
case X2_ITEM_EVENT_UNEQUIP:
OnUnequip(GetPCItemLastUnequipped(), GetPCItemLastUnequippedBy());
break;
}
}
#17
Posté 29 avril 2013 - 11:21
effect eSomething = blah;
Funky
#18
Posté 30 avril 2013 - 04:15
Make sure the object eff_creator actually exists, in the toolset.
It appears the effect creator was done correctly.
AssignCommand(oEC, ApplyEffectToObject(
DURATION_TYPE_PERMANENT, eMas, oEquippedBy));
So how do you know it is not removing it? Becasue the visual effect is still active, since the modify attacks would
be diificult to detect? Perhaps better to link those effects and apply them together. As it stands you have two seperate effects applied by the same object, though that should not matter if the script is working properly. The script should loop through all extant effects created by eff_creator and remove them accordingly. Btw I would remove the reference to speed as it is irrelevant, perhaps just change it to effect.
Modifié par ffbj, 30 avril 2013 - 04:23 .
#19
Posté 30 avril 2013 - 05:06
This really helped me a lot, I suppose I will have to make some more use of this. =)
(Going to make a good system with this)
Thanks again Funky!
Modifié par _Guile, 30 avril 2013 - 05:24 .
#20
Posté 30 avril 2013 - 05:53
/////////////////////////////////////////////////////////////////////////
// eff_caster_exc
////////////////////////////////////////////////
// Created By: Genisys / Guile
// Created On: 2/10/2013
////////////////////////////////////////////////////////////////////////////////
/*
This script is executed on a spawned in object used to apply an effect to
the PC, this way we can through scripting remove any effect applied to the
PC without removing other effects by accident!
This is ONLY For Permanent Effects/Feats, as there is no need for temporary!
*/
////////////////////////////////////////////////////////////////////////////////
//Main Script
void main()
{
// The Placeable Object that was spawned in for this effect!
object oMe = OBJECT_SELF;
// The PC we saved on the placeable Object...
object oPC = GetLocalObject(oMe, "PC_2_B_EFFECTED");
int nEffect = GetLocalInt(oMe, "EFFECT_NUM");
int Parm1 = GetLocalInt(oMe, "PARAMETER_1");
int Parm2 = GetLocalInt(oMe, "PARAMETER_2");
int Parm3 = GetLocalInt(oMe, "PARAMETER_3");
int nVFX = GetLocalInt(oMe, "VFX_NUMBER");
float fDur = GetLocalFloat(oMe, "FLOAT_DURATION");
effect eEff, eVis;
switch(nEffect)
{
case 0: // Modify Attacks
{
eEff = EffectModifyAttacks(Parm1);
} break;
case 1: // Improved AC
{
eEff = EffectACIncrease(Parm1, Parm2, AC_VS_DAMAGE_TYPE_ALL);
} break;
case 2: // Improved AB
{
eEff = EffectAttackIncrease(Parm1, ATTACK_BONUS_MISC);
} break;
case 3: // Improved SR
{
eEff = EffectSpellResistanceIncrease(Parm1);
} break;
case 4: // Concealment
{
eEff = EffectConcealment(Parm1, MISS_CHANCE_TYPE_NORMAL);
} break;
case 5: // Regeneration / 3 Second or More
{
if(fDur < 3.0)
{ fDur = 3.0; } // Minimum is ever 3 seconds! (Or 2 X per round)
eEff = EffectRegenerate(Parm1, fDur);
} break;
case 6: // Skill Bonus
{
eEff = EffectSkillIncrease(Parm1, Parm2);
} break;
case 7: // EffectDamageShield
{
eEff = EffectDamageShield(Parm1, Parm2, Parm3);
} break;
case 8: // Saving Throw Increase
{
eEff = EffectSavingThrowIncrease(Parm1, Parm2, Parm3);
} break;
case 9: // Temporary Hitpoints
{
eEff = EffectTemporaryHitpoints(Parm1);
} break;
case 10: // Padding..
{
} break;
case 11: // Padding..
{
} break;
}
//Apply the Effect
eEff = SupernaturalEffect(eEff); // NOT Dispellable!
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEff, oPC, 0.0);
//Apply the VFX if one exist...
if(nVFX >= 1)
{
eVis = EffectVisualEffect(nVFX, FALSE);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, oPC, 0.0);
}
//Main Script End
}
#21
Posté 30 avril 2013 - 05:59
#22
Posté 30 avril 2013 - 07:36
ffbj wrote...
Just for consistency I would define oEquippedBy as oPC, as you did in the unequipped portion.
Make sure the object eff_creator actually exists, in the toolset.
It appears the effect creator was done correctly.
AssignCommand(oEC, ApplyEffectToObject(
DURATION_TYPE_PERMANENT, eMas, oEquippedBy));
The effect creator was not done properly. The creator of an effect is the object running the script when the effect is declared. Since eMas was declared on the main script means that eMas is not created by oEC. If he instead put
AssignCommand(oEC, ApplyEffectToObject(
DURATION_TYPE_PERMANENT, EffectModifyAttacks(1), oEquippedBy));
then the effect would be declared within an assigned command and oEC would be the creator.
#23
Posté 30 avril 2013 - 08:09
WhiZard wrote...
AssignCommand(oEC, ApplyEffectToObject(
DURATION_TYPE_PERMANENT, EffectModifyAttacks(1), oEquippedBy));
then the effect would be declared within an assigned command and oEC would be the creator.
Your example is better than mine. It points out that it's not even really the declaration that matters, so much as it is the creation of the effect struct - you can have an effect creator without an explicit declaration, as in your example.
Funky
#24
Posté 01 mai 2013 - 01:35
AssignCommand(oEC, ApplyEffectToObject(
DURATION_TYPE_PERMANENT, EffectModifyAttacks(1), oEquippedBy));
Modifié par _Guile, 01 mai 2013 - 04:23 .
#25
Posté 01 mai 2013 - 05:36





Retour en haut






