Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Making an NPC cast a Force Power using scripting

Page: 1 of 1
 Silveredge9
05-22-2007, 7:11 AM
#1
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, 7:47 AM
#2
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, 8:42 PM
#3
Yup, your script works nicely. Thanks for the help. :)
Page: 1 of 1