Scripts

TR_m7_EEC_SelasNPCMob

TR_Mainland.esm
Variables 7
Local Variables
TR_Map
control
controlQ
T_local_NPC
OnPCHitMe
NoLore
currentHealth
Source
1Begin TR_m7_EEC_SelasNPCMob 2 3short TR_Map 4short control 5short controlQ 6Short T_local_NPC 7short OnPCHitMe 8float currentHealth 9short NoLore 10 11if ( GetJournalIndex "TR_m7_EEC_Narsis8" < 10 ) 12 ; Disable before the quest 13 if ( GetDisabled == 0 ) 14 disable 15 endif 16elseif ( GetJournalIndex "TR_m7_EEC_Narsis8" >= 80 ) 17 ; Disable after the quest 18 if ( GetDisabled == 0 ) 19 disable 20 endif 21else 22 ; Enable during the quest 23 if ( GetDisabled == 1 ) 24 enable 25 endif 26 27 ; disable the dead ones 28 if ( GetDeadCount "TR_m7_Dalse_Seles" > 0 ) 29 if ( GetDisabled == 0 ) 30 set TR_m7_EEC_farmerdeadcount to ( TR_m7_EEC_farmerdeadcount + 1 ) 31 "TR_m7_Dalse_Seles_v2"->disable 32 endif 33 endif 34 if ( GetDeadCount "TR_m7_Favel_Seles" > 0 ) 35 if ( GetDisabled == 0 ) 36 set TR_m7_EEC_farmerdeadcount to ( TR_m7_EEC_farmerdeadcount + 1 ) 37 "TR_m7_Favel_Seles_v2"->disable 38 endif 39 endif 40 if ( GetDeadCount "TR_m7_Ildos_Seles" > 0 ) 41 if ( GetDisabled == 0 ) 42 set TR_m7_EEC_farmerdeadcount to ( TR_m7_EEC_farmerdeadcount + 1 ) 43 "TR_m7_Ildos_Seles_v2"->disable 44 endif 45 endif 46endif 47 48if ( OnDeath ) 49 set TR_m7_EEC_farmerdeadcount to ( TR_m7_EEC_farmerdeadcount + 1 ) 50endif 51 52if ( TR_m7_EEC_killfarmers_glob < 1 ) ; if you've killed one, peace is never an option 53; Check if the player has attacked the NPC 54if ( OnPCHitMe == 1 ) 55 56 ; Set all three NPCs to attack the player 57 "TR_m7_Favel_Seles_v2"->SetFight 100 58 "TR_m7_Dalse_Seles_v2"->SetFight 100 59 "TR_m7_Ildos_Seles_v2"->SetFight 100 60 61 ; Ensure each NPC knows the player is the target 62 "TR_m7_Favel_Seles_v2"->StartCombat player 63 "TR_m7_Dalse_Seles_v2"->StartCombat player 64 "TR_m7_Ildos_Seles_v2"->StartCombat player 65 66 ; Reset playerAttacked to prevent repeated triggering 67 Set OnPCHitMe to 0 68endif 69 70if ( GetHealth < 50 ) 71 ; Ensure this script only runs once per health drop below the threshold 72 if ( currentHealth != GetHealth ) 73 set currentHealth to GetHealth 74 75 ; Stop combat and set fight for specific NPCs 76 "TR_m7_Favel_Seles_v2"->StopCombat 77 "TR_m7_Dalse_Seles_v2"->StopCombat 78 "TR_m7_Ildos_Seles_v2"->StopCombat 79 80 "TR_m7_Favel_Seles_v2"->SetFight 0 81 "TR_m7_Dalse_Seles_v2"->SetFight 0 82 "TR_m7_Ildos_Seles_v2"->SetFight 0 83 84 ; Trigger journal entry 85 Journal "TR_m7_EEC_Narsis8" 30 86 87 ; Force greeting from Dalse Seles 88 "TR_m7_Dalse_Seles_v2"->ForceGreeting 89 endif 90endif 91else ; player has killed a farmer beforehand, set phasers to kill 92 if ( controlQ == 0 ) 93 set controlQ to 1 94 ; Set all three NPCs to attack the player 95 "TR_m7_Favel_Seles_v2"->SetFight 100 96 "TR_m7_Dalse_Seles_v2"->SetFight 100 97 "TR_m7_Ildos_Seles_v2"->SetFight 100 98 99 "TR_m7_Favel_Seles_v2"->StartCombat player 100 "TR_m7_Dalse_Seles_v2"->StartCombat player 101 "TR_m7_Ildos_Seles_v2"->StartCombat player 102 endif 103endif 104 105set TR_Map to 7 106 107End TR_m7_EEC_SelasNPCMob