PDA

View Full Version : Battle animation during dialog


Xavier2
12-30-2004, 07:30 PM
I was looking to make a fight animation between 2 npcs during dialog, just like jedi Elina's fight in the Endar Spire or the Dark Jedi vs Jedi in the star forge deck 1.

I noticed the above scenes use dialog branches to fire scripts that i believe are responsable for the fight animations.

Does any one knows how are such scripts sintax?

Darth333
01-01-2005, 05:25 AM
It depends what you want to do exactly. Here are some examples:

This was a script made by tk102 where Trask shoots you during a convo:
(for the animations numbers (217), refer to animations.2da)

void main()
{
object oTrask=GetObjectByTag("end_trask");
object oPC=GetFirstPC();
ActionPauseConversation();
AssignCommand(oTrask,CutsceneAttack(oPC,217,1,10)) ;
DelayCommand(5.0,ActionResumeConversation());
}


This is the script I used in another mod where the pc uses lightning on a Sith trooper:


void main() {
ActionPauseConversation();
object oPC=GetPCSpeaker();
effect eDamage= EffectDamage(20, DAMAGE_TYPE_DARK_SIDE, DAMAGE_POWER_PLUS_FIVE);
AssignCommand(oPC, ActionCastFakeSpellAtObject(FORCE_POWER_LIGHTNING, OBJECT_SELF));
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_PRO_LIGHTNING_L), OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, OBJECT_SELF);
ActionPlayAnimation(ANIMATION_LOOPING_DEAD, 1.0, 5.0); ActionResumeConversation();
}

And finally, you can change faction ID to prey (12) and predator (11) so that each npc attacks each other. If you want a perpetual fight animation, you can change the faction ID in the .utc file. (Don't forget to put min 1hp :D )

object oNPC1=GetObjectByTag("npc_tag");
object oNPC2=GetObjectByTag("npc_tag");
ChangeToStandardFaction(oNPC1, 12);
ChangeToStandardFaction(oNPC2, 11);

Doom_Dealer
01-01-2005, 05:48 AM
:eek: wow i was actually closer than i thought when i was trying to work this out, anyway cheers Darth333, this is going to be a great help.

Are you actually human or just some computer full of scripting knowledge? :p


so if i wanted to have to npcs fighting this would work, right?::


void main() {
object oNPCa=GetObjectByTag("darkjedi");
object oNPCb=GetObjectByTag("jedi");
ActionPauseConversation();
AssignCommand(oNPCa,CutsceneAttack(oNPCb,217,1,10) )
;
DelayCommand(5.0,ActionResumeConversation());
}

Darth333
01-01-2005, 05:59 AM
Originally posted by Doom_Dealer

Are you actually human or just some computer full of scripting knowledge? :p
I'm just human. The computer with full of scripting knowledge would be tk102 :D (j/k tk ;) )


so if i wanted to have to npcs fighting this would work, right?::


void main() {
object oNPCa=GetObjectByTag("darkjedi");
object oNPCb=GetObjectByTag("jedi");
ActionPauseConversation();
AssignCommand(oNPCa,CutsceneAttack(oNPCb,217,1,10) )
;
DelayCommand(5.0,ActionResumeConversation());
}

I never tried but looks good to me. Just make sure there are no obstables between the two npcs (such as a placeable table) or they won't fight.

Note: you can also use the DelayCommand function with the other scripts, to change the faction after a certain time. There are multiple possibilities. You can also use the On Damaged flag and have a fight where your NPCs will fight until their health drops at a certain point.

StormTrooper789
01-04-2005, 09:45 AM
I think this thread should go into the list of Do you Want to mod SW-KotOR? Then Start here.Mod Tutorials! thread. I think this has been very helpful.

Xavier2
01-04-2005, 12:32 PM
Originally posted by Darth333
[B]Note: you can also use the DelayCommand function with the other scripts, to change the faction after a certain time. There are multiple possibilities. You can also use the On Damaged flag and have a fight where your NPCs will fight until their health drops at a certain point.
That one sounds pretty interesting...How the sintax should look like if i wanted one of them to run cowardly after take too much damage (health droped to a certain level)?

tk102
01-04-2005, 12:41 PM
You've done the Talk-Fight-Talk sequence right Xavier2? Well instead of resuming the conversation you'd use ActionForceMoveToLocation or a similar function with the bRun parameter set to true. Then use the DestroyObject function to make the NPC disappear off in the distance.