Scripts

TR_m7_Selar_Adryn_sc

TR_Mainland.esm
Variables 8
Local Variables
TR_Map
NoLore
control
controlQ
controlA
controlD
T_Local_NPC
T_Local_NoLore
Source
1begin TR_m7_Selar_Adryn_sc 2 3short TR_Map 4short NoLore 5short control 6short controlQ 7short controlA 8short controlD 9short T_Local_NPC 10short T_Local_NoLore 11 12if ( TR_Map != 7 ) 13 set TR_Map to 7 14endif 15 16if ( onDeath ) 17 if ( getjournalindex TR_m7_Ns_Arena_13 == 20 ) 18 ; Death during formal duel phase (stage 20) 19 if ( controlD == 1 ) 20 ; FIXED: Legitimate one-hit kill during active duel 21 ; Route to stage 95 for "decisive victory" narrative 22 set controlA to 1 23 set TR_m7_Ns_ArenaCurrentDuel to 0 24 set TR_m7_Ns_ArenaDuelBegun to 0 25 set TR_m7_Ns_ArenaDuelActive to 0 26 set TR_m7_Ns_ArenaCorrectDoor to 0 27 Journal TR_m7_Ns_Arena_13 95 28 set TR_m7_Eralgor.duelwon to 1 29 TR_m7_Eralgor->ForceGreeting 30 return 31 else 32 ; Duel wasn't active - player killed Selar outside the rules 33 set TR_m7_Ns_ArenaCurrentDuel to 0 34 set TR_m7_Ns_ArenaDuelBegun to 0 35 set TR_m7_Ns_ArenaCorrectDoor to 0 36 Journal TR_m7_Ns_Arena_13 200 37 PCExpell "TR_Fact_NarsisArena" 38 set TR_m7_Eralgor.duelwon to -1 39 TR_m7_Eralgor->ForceGreeting 40 return 41 endif 42 elseif ( getjournalindex TR_m7_Ns_Arena_13 >= 30 ) 43 if ( getjournalindex TR_m7_Ns_Arena_13 <= 80 ) 44 ; Death during death match phase - normal flow 45 set controlA to 1 46 set TR_m7_Eralgor.duelwon to 1 47 TR_m7_Eralgor->ForceGreeting 48 return 49 endif 50 endif 51endif 52 53if ( controlD == 0 ) 54 return 55endif 56 57; FIXED: Guard against health check firing when NPC is already dead 58; This prevents the race condition where health check fires before onDeath 59if ( GetHealth <= 0 ) 60 return 61endif 62 63if ( getjournalindex TR_m7_Ns_Arena_13 == 20 ) 64 if ( GetHealthGetRatio <= 0.20 ) 65 ; Player won the formal duel (Selar at 20% health) 66 set control to 1 67 set TR_m7_Ns_ArenaDuelActive to 0 68 set TR_m7_Ns_ArenaDuelManager.duelwon to 1 69 set TR_m7_Eralgor.duelwon to 1 70 SetFight 20 71 StopCombat 72 TR_m7_Eralgor->ForceGreeting 73 return 74 elseif ( player->GetHealthGetRatio <= 0.20 ) 75 ; Player lost the formal duel 76 set control to 1 77 set TR_m7_Ns_ArenaDuelActive to 0 78 set TR_m7_Ns_ArenaDuelManager.duelwon to -1 79 set TR_m7_Eralgor.duelwon to 2 80 SetFight 20 81 StopCombat 82 TR_m7_Eralgor->ForceGreeting 83 return 84 endif 85endif 86 87if ( getjournalindex TR_m7_Ns_Arena_13 >= 30 ) 88 if ( getjournalindex TR_m7_Ns_Arena_13 <= 80 ) 89 if ( controlq == 0 ) 90 if ( getdistance player >= 700 ) 91 forcegreeting 92 endif 93 endif 94 if ( ondeath ) 95 set controlA to 1 96 set TR_m7_Eralgor.duelwon to 1 97 TR_m7_Eralgor->ForceGreeting 98 return 99 endif 100 endif 101endif 102 103if ( controlA == 1 ) 104 if ( onactivate ) 105 MessageBox "You cannot loot the corpse of your fallen opponent!" 106 endif 107endif 108 109if ( controlA == 1 ) 110 if ( cellchanged ) 111 disable 112 endif 113endif 114 115end