Jump to content

Home

Fighting during a dialog using script functions?


Pikmin

Recommended Posts

First of all I have a plate of cookies for whoever pushed the easy button and fixed LF. Anyone, anyone at all? No one wants fresh wookie blood cookies? Ahh, well more for me.

 

Anyway, I have this script and case 4 is supposed to have Atris and Kreia fight. But instead they just stand there with their lightsabers ignited. Also case 6 has Kreia fall down dead, but she gets up immediatly on the next node...

Anyway here is the script.

 

// Prototypes
void sub2();
void sub1();

void sub3() {
CreateObject(1, "n_darthtraya001", GetLocation(GetWaypointByTag("sp_traya")), 0);
}
void main() {

int nParam1 = GetScriptParameter(1);
object oAtris = GetObjectByTag("Atris", 0);
object oKreiaEvil = GetObjectByTag("KreiaEvil", 0);
object oSister1 = GetObjectByTag("Sister1", 0);
object oSister2 = GetObjectByTag("Sister2", 0);
switch (nParam1) {
case 0: {

		SetGlobalFadeOut();

		SetLockOrientationInDialog(oAtris, TRUE);
		SetLockOrientationInDialog(oKreiaEvil, TRUE);
		AssignCommand(oKreiaEvil, SetFacing(270.0));

break;
case 1: {
	SetGlobalFadeIn();
	AssignCommand(oKreiaEvil, ActionMoveToObject(GetWaypointByTag("wp_kreia_end2"), 0, 1.0));
}
break;
case 2: {
	SetLockOrientationInDialog(oAtris, FALSE);
	AssignCommand(oAtris, SetFacing(90.0));
	SetLockOrientationInDialog(oAtris, TRUE);
}
break;
case 3: {
	SetLockOrientationInDialog(oAtris, FALSE);
	AssignCommand(oAtris, SetFacing(270.0));
	SetLockOrientationInDialog(oAtris, TRUE);
	AssignCommand(oKreiaEvil, ActionMoveToLocation(GetLocation(GetWaypointByTag("wp_kreia_ending")), 0));
}
break;
case 4: {
	SetLightsaberPowered(oAtris, 1, 1, 1); 	
	AssignCommand(oAtris, SetFacingPoint(GetPosition(oKreiaEvil)));
	DelayCommand(1.2, SetLightsaberPowered(oKreiaEvil, 1, 1, 1));	
	DelayCommand(2.0, AssignCommand(oAtris, ActionAttack(oKreiaEvil)));
	DelayCommand(4.0, AssignCommand(oAtris, ActionAttack(oKreiaEvil)));
	DelayCommand(6.0, AssignCommand(oAtris, ActionAttack(oKreiaEvil)));
	DelayCommand(8.0, AssignCommand(oAtris, ActionAttack(oKreiaEvil)));	
}
break;
case 5: {
	AssignCommand(oAtris, SetFacingPoint(GetPosition(oKreiaEvil)));
	SetLockOrientationInDialog(oKreiaEvil, FALSE);
	AssignCommand(oKreiaEvil, SetFacing(270.0));
	SetLockOrientationInDialog(oKreiaEvil, TRUE);	
}
break;
case 6: {
	AssignCommand(oKreiaEvil, ActionPlayAnimation(ANIMATION_LOOPING_DEAD, 1.0, -1.0));	
}
break;	
      case 7: {
	AssignCommand(oAtris, ActionMoveToObject(GetObjectByTag("wp_pc_end", 0), 1));

      } 
break;
      case 8: {
	SetGlobalFadeOut(1.0, 2.0, 0.0, 0.0, 0.0);

      }
break;
      }
  }
}

 

Also what animation could I have Hanharr use to throw the player out of the way of a rancor?

Link to comment
Share on other sites

About case 4; I think NPC need have other faction to attack. Try add to case 4 function ChangeStandardFaction().

Kreia stand up because animation is start, and in next node animation is stopped 'acutomaticly'. In all node where Kreia should be 'dead' you need add dead animation (you can do it in DLGEditor).

And if no one want cookie, I can take them all! :xp:

Link to comment
Share on other sites

Change the factions 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. Since there are only two combatants I would set Kreia and Atris 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). Case 4 could look like this:

 

#include "k_inc_fakecombat"

void main() {	
switch (nParam1) {
case 4: {
               // Enable fake combat.
               FAI_EnableFakeMode(oAtris, STANDARD_FACTION_ONE_ON_ONE);
               FAI_EnableFakeMode(oKreiaEvil, STANDARD_FACTION_ONE_ON_ONE);

	SetLightsaberPowered(oAtris, 1, 1, 1); 	
	AssignCommand(oAtris, SetFacingPoint(GetPosition(oKreiaEvil)));
	DelayCommand(1.2, SetLightsaberPowered(oKreiaEvil, 1, 1, 1));	

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

}
       break;

 

Also case 6 has Kreia fall down dead, but she gets up immediatly on the next node...
Replay the animation by calling case 6 again in every node. If you don't need her anymore you can also make her dead for good by making the final fake attack in case 4 lethal. Just set the third parameter to TRUE in the FAI_PerformFakeAttack function.
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...