Jump to content

Home

Fighting in dialog


Weavel

Recommended Posts

Hey guys wanted to come in and share my sparse knowledge of TSL scripting with you.

 

This tut will show you an example script and give instructions on how to have two characters fight each other in a dialog.

 

 

You will want to change the factions for your NPCs and turn the combat AI off.

The k_inc_fakecombat include file contains some useful functions for this.

FAI_EnableFakeMode(object oTarget,int iFaction); will prepare the character oTarget for fake combat and set its faction.

If there are only two combatants I would set Attacker1 and Attacker2 to STANDARD_FACTION_ONE_ON_ONE.

 

Remember to use FAI_DisableFakeMode(object oTarget,int iFaction); to reset the characters again.

You can initiate a fake attack with FAI_PerformFakeAttack(object oAttacker,object oTarget,int bLethal = FALSE);.

 

 

 
#include "k_inc_fakecombat"

void main() {

object oNPC1 = GetObjectByTag("CREATURE_TAG", 0);
object oNPC2 = GetObjectByTag("CREATURE_TAG", 0);


               // Enable fake combat.
               FAI_EnableFakeMode(oNPC1, STANDARD_FACTION_ONE_ON_ONE);
               FAI_EnableFakeMode(oNPC2, STANDARD_FACTION_ONE_ON_ONE);

               //Ignite Sabers
	SetLightsaberPowered(oNPC1, 1, 1, 1); 	
               //Delay the second power command slightly
	DelayCommand(1.2, SetLightsaberPowered(oNPC2, 1, 1, 1));	

               // Do some fake attacks.
	DelayCommand(2.0, FAI_PerformFakeAttack(oNPC1, oNPC2, FALSE));
	DelayCommand(4.0, FAI_PerformFakeAttack(oNPC1, oNPC2, FALSE));
	DelayCommand(6.0, FAI_PerformFakeAttack(oNPC1, oNPC2, FALSE));
	DelayCommand(8.0, FAI_PerformFakeAttack(oNPC1, oNPC2, FALSE));


               //Reset factions
               DelayCommand(10.0, FAI_DisableFakeMode(object oNPC1,int iFaction));
               DelayCommand(10.0, FAI_DisableFakeMode(object oNPC2,int iFaction));         
}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...