PDA

View Full Version : Only one casting of Mind, Beast, Droid Trick


WRFan
07-09-2009, 02:06 AM
It shouldn't be allowed to cast the force powers Mind Trick, Beast Trick, Droid Trick more than once. If you want the game to check if the power is already active, tell the game engine to check if the effect is already active on someone in the area. If affirmative, don't apply the effect to anybody else. Here's an example for Mind Trick:


object oObject = GetFirstObjectInArea(OBJECT_SELF,OBJECT_TYPE_CREAT URE);
while(GetIsObjectValid(oObject))
{
if(GetHasSpellEffect(FORCE_POWER_MIND_TRICK, oObject))
{
CancelCombat(oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectForceResisted(OBJECT_SELF), oTarget);
return;
}
oObject = GetNextObjectInArea(OBJECT_SELF,OBJECT_TYPE_CREATU RE);
}


CancelCombat is needed to correct a weird bug that triggers defensive scripts On Spell Cast At Event, even if the enemy can't see you, since Mind Trick etc. don't cancel stealth mode (enemies start running around, activate shields etc.)