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?
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);
: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());
}
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.
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.
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)?
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.