PDA

View Full Version : Making an NPC cast a Force Power using scripting


Silveredge9
05-22-2007, 07:11 AM
Yeah, so basically I've been trying to get an NPC to cast the Stasis Force Power using scripting on a target. The caster for example would be named "jedi1" and the target would be for example named "trooper2".

I'm looking to get the same effect that happens when Malak casts the spell on Carth and Bastila on the Leviathan, where they are frozen for however long the scene lasts.

What I have so far is...


void main(){
object oJedi2=GetObjectByTag("jedi2");
object oMerc = GetObjectByTag("trooper3", 0);

float fDuration = 60.0;
effect eEffect = EffectVisualEffect(2008);

AssignCommand(oJedi2, ActionCastFakeSpellAtObject(29, GetObjectByTag("trooper3", 0)));

ApplyEffectToObject((DURATION_TYPE_TEMPORARY, eEffect, oMerc, fDuration));

}


So I think this should govern the casting part of the spell. And the visual effect, but I'm not so sure about which animation is associated with the "frozen" effect of the Stasis spell.

Thanks in advance for any help. :)

stoffe
05-22-2007, 07:47 AM
Yeah, so basically I've been trying to get an NPC to cast the Stasis Force Power using scripting on a target. The caster for example would be named "jedi1" and the target would be for example named "trooper2".

I'm looking to get the same effect that happens when Malak casts the spell on Carth and Bastila on the Leviathan, where they are frozen for however long the scene lasts.


Something like this might work:

void main() {
object oJedi2 = GetObjectByTag("jedi2");
object oMerc = GetObjectByTag("trooper3");
effect eStasis = EffectCutSceneParalyze();
eStasis = EffectLinkEffects(eStasis, EffectVisualEffect(VFX_DUR_HOLD));

AssignCommand(oJedi2, ClearAllActions());
AssignCommand(oJedi2, ActionCastFakeSpellAtObject(FORCE_POWER_HOLD, oMerc));
AssignCommand(oJedi2, ActionDoCommand( ApplyEffectToObject(DURATION_TYPE_PERMANENT, eStasis, oMerc) ));
AssignCommand(oJedi2, ActionDoCommand(SetCommandable(TRUE)));
AssignCommand(oJedi2, SetCommandable(FALSE, oJedi2));
}


This uses the paralyze effect to put the victim in stasis, freezing their animation and making them unable to take any actions. At the end of the battle when you want to unfreeze the NPC you run a script like below to remove the stasis:


void main() {
object oMerc = GetObjectByTag("trooper3");
AssignCommand(oMerc, ClearAllEffects());
}

Silveredge9
05-22-2007, 08:42 PM
Yup, your script works nicely. Thanks for the help. :)