Jump to content

Home

Talk, fight, talk, fight, talk problem


Trex

Recommended Posts

Hi all.

 

I'm trying to put together a big duel which is in 4 parts. You fight, talk, then fight, then talk etc.

 

I have this this script in the utc's ScriptDamaged :

 

void main() {
  int nFlag = IntToFloat( GetCurrentHitPoints( OBJECT_SELF ) ) < ( 0.1 * GetMaxHitPoints( OBJECT_SELF ) );
  if( nFlag && !GetLocalBoolean( OBJECT_SELF , 10 ) ) {
     SetLocalBoolean( OBJECT_SELF, 10, TRUE );
     SetMinOneHP( OBJECT_SELF, FALSE );

CancelCombat(OBJECT_SELF);
       SurrenderToEnemies();
       ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_NEUTRAL);

       object oNPC=GetObjectByTag("syyth");
 location lMe=GetLocation(GetFirstPC());
   ActionDoCommand(SetCommandable(TRUE,oNPC));
 AssignCommand (oNPC, ActionStartConversation(GetFirstPC()));
  }

}  

 

Which works fine, but only for the first round. After the first mid-fight conversation has happened, my baddie just keeps fighting and never turns to neutral and talks to you a second time.

 

How can I make this work?

Link to comment
Share on other sites

I see.

 

So, in theory, if I add a script into the actual conversation to reset the local boolean to false each time, it should work?

 

EDIT : SOLUTION FOUND

 

Add a little to the end of the script to reset it (using a seperate script doesn't really work)

 

void main() {
  int nFlag = IntToFloat( GetCurrentHitPoints( OBJECT_SELF ) ) < ( 0.1 * GetMaxHitPoints( OBJECT_SELF ) );
  if( nFlag && !GetLocalBoolean( OBJECT_SELF , 10 ) ) {
     SetLocalBoolean( OBJECT_SELF, 10, TRUE );
     SetMinOneHP( OBJECT_SELF, FALSE );

CancelCombat(OBJECT_SELF);
       SurrenderToEnemies();
       ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_NEUTRAL);

       object oNPC=GetObjectByTag("syyth");
 location lMe=GetLocation(GetFirstPC());
   ActionDoCommand(SetCommandable(TRUE,oNPC));
 AssignCommand (oNPC, ActionStartConversation(GetFirstPC()));
 DelayCommand(0.5, SetLocalBoolean( OBJECT_SELF, 10, FALSE ));
  }

}  

Link to comment
Share on other sites

Works, but not really dependant on HP. And the NPC can be killed before that time. I was more thinking (not using 2 scripts);

 

void main() {
  int nFlag = IntToFloat( GetCurrentHitPoints( OBJECT_SELF ) ) < ( 0.5 * GetMaxHitPoints( OBJECT_SELF ) );
  int nFlag2 = IntToFloat( GetCurrentHitPoints( OBJECT_SELF ) ) < ( 0.1 * GetMaxHitPoints( OBJECT_SELF ) );
  if( nFlag && !GetLocalBoolean( OBJECT_SELF , 10 ) ) {
     SetLocalBoolean( OBJECT_SELF, 10, TRUE );

     CancelCombat(OBJECT_SELF);
       SurrenderToEnemies();
       ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_NEUTRAL);

       object oNPC=GetObjectByTag("syyth");
 location lMe=GetLocation(GetFirstPC());
   ActionDoCommand(SetCommandable(TRUE,oNPC));
 AssignCommand (oNPC, ActionStartConversation(GetFirstPC()));
  }

   if( nFlag2 && !GetLocalBoolean( OBJECT_SELF , 15 ) ) {
     SetLocalBoolean( OBJECT_SELF, 15, TRUE );
     SetMinOneHP( OBJECT_SELF, FALSE );

CancelCombat(OBJECT_SELF);
       SurrenderToEnemies();
       ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_NEUTRAL);

       object oNPC=GetObjectByTag("syyth");
 location lMe=GetLocation(GetFirstPC());
   ActionDoCommand(SetCommandable(TRUE,oNPC));
 AssignCommand (oNPC, ActionStartConversation(GetFirstPC()));
 DelayCommand(0.5, SetLocalBoolean( OBJECT_SELF, 10, FALSE ));
  }
}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...