View Single Post
Old 05-16-2012, 01:16 PM   #4
Hassat Hunter
Forumite
 
Join Date: Jan 2010
Posts: 536
Works, but not really dependant on HP. And the NPC can be killed before that time. I was more thinking (not using 2 scripts);

Code:
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 ));
   }
}
Hassat Hunter is offline   you may: quote & reply,