Scripts

TR_m7_Ns_JNS_4_ScAndera

TR_Mainland.esm
Variables 8
Local Variables
TR_Map
control
controlQ
NoLore
T_Local_NPC
T_Local_NoLore
xpos
ypos
Source
1Begin TR_m7_Ns_JNS_4_ScAndera 2 3;Script for Andera Ethas, who is kidnapped by the player during Q4 of the Narsis Ja-Natta Syndicate questline. 4;This controls the escort sequence and makes guards get mad if they find her being kidnapped. 5 6short TR_Map 7short control 8short controlQ 9short NoLore 10short T_Local_NPC 11short T_Local_NoLore 12float xpos 13float ypos 14;ShouldFollow global is for checking if she should escort the player or not (Has a weapon out, is near enough to threaten) 15;AnderaFollow global is for checking if she is on the sequence at all in other NPCs' dialogue (Saldeni Andralor, Jandie) 16;FollowState global is for checking what part of the escort sequence she's on 17;Caught global stops the player from kidnapping her twice if they're caught by the guards 18 19if ( CellChanged == 1 ) 20 if ( TR_m7_Ns_JNS_4_AnderaFollow == 3 ) 21 PositionCell 4917 5444 -43 90 "Narsis, Sewers: Foreign Quarter Central" ; TR_m7_MARK_Ns_JNS_Andera 22 ;If the player leaves the sewers while Andera is following them, she will stay down there. 23 ;Will also fire when first entering the sewers with her, but should be harmless there. 24 ;No AIWander because she should still follow the player when they get back. 25 elseif ( TR_m7_Ns_JNS_4_AnderaFollow < 3 ) 26 if ( GetPCCell "Narsis, Sewers: Foreign Quarter Central" == 1 ) 27 set TR_m7_Ns_JNS_4_ShouldFollow to 2 28 set TR_m7_Ns_JNS_4_AnderaFollow to 3 29 set TR_m7_Ns_JNS_4_FollowState to 8 30 AIFollow player 0 0 0 0 31 endif 32 endif 33endif 34 35; This script uses AITravel instead of AIWander because Andera is affected by post-arrest resets 36; When she's outside, she attempts to travel back to her original coordinates (which would be somewhere on vfell) 37; AIWander is interrupted by this reset, but AITravel is not, so we put her in a state where she's always "traveling" 38; by setting her destination deep underground where she couldn't possibly reach it 39 40if ( GetJournalIndex "TR_m7_Ns_JNS_4" > 10 ) 41 if ( GetJournalIndex "TR_m7_Ns_JNS_4" < 40 ) 42 if ( GetDeadCount "TR_m7_Andera Ethas" == 0 ) 43 if ( TR_m7_Ns_JNS_4_AnderaFollow < 2 ) 44 ;Check if she is following the player using Command Humanoid for dialogue purposes, 45 ;but only if she isn't already following because the player beat her up. 46 if ( GetEffect sEffectCommandHumanoids == 1 ) 47 Set TR_m7_Ns_JNS_4_AnderaFollow to 1 48 else 49 Set TR_m7_Ns_JNS_4_AnderaFollow to 0 50 endif 51 ;Ends the fight, she agrees to go with the player 52 if ( TR_m7_Ns_JNS_4_Caught == 0 ) ;Set if guards catch player, so she won't come with them unless they use Command 53 if ( GetHealth <= 30 ) 54 Set TR_m7_Ns_JNS_4_FollowState to 1 55 Set T_Local_NoLore to 0 56 ForceGreeting 57 endif 58 endif 59 ;Walks to the door 60 elseif ( TR_m7_Ns_JNS_4_FollowState == 2 ) 61 AITravel 504 426 401 ;marker TR_m7_MARK_Ns_JNS_Andera 62 Set TR_m7_Ns_JNS_4_FollowState to 3 63 ;Goes outside if close enough to the door 64 elseif ( TR_m7_Ns_JNS_4_FollowState == 3 ) 65 if ( GetDistance "TR_m7_Ns_JNS_4_EscortActInt" <= 70 ) 66 Set TR_m7_Ns_JNS_4_FollowState to 4 67 PlaySound "Door Heavy Open" 68 PositionCell 60794 -416440 1152 0 "Narsis" ;marker TR_m7_MARK_Ns_JNS_Andera 69 AITravel 60794 -416440 -2000 1 ;marker TR_m7_MARK_Ns_JNS_Andera 70 endif 71 ;If she should follow the player, check where to, trigger the AITravel, 72 ;and set ShouldFollow to a different value so it isn't called every frame. 73 elseif ( TR_m7_Ns_JNS_4_ShouldFollow == 1 ) 74 if ( TR_m7_Ns_JNS_4_FollowState == 4 ) 75 AITravel 59014 -417776 514 ;marker TR_m7_MARK_Ns_JNS_Andera 76 Set TR_m7_Ns_JNS_4_ShouldFollow to 2 77 elseif ( TR_m7_Ns_JNS_4_FollowState == 5 ) 78 AITravel 58606 -419259 111 ;marker TR_m7_MARK_Ns_JNS_Andera 79 Set TR_m7_Ns_JNS_4_ShouldFollow to 2 80 elseif ( TR_m7_Ns_JNS_4_FollowState == 6 ) 81 AITravel 58110 -420913 107 ;marker TR_m7_MARK_Ns_JNS_Andera 82 Set TR_m7_Ns_JNS_4_ShouldFollow to 2 83 elseif ( TR_m7_Ns_JNS_4_FollowState == 7 ) 84 AITravel 57359 -422571 46 ;marker TR_m7_MARK_Ns_JNS_Andera 85 Set TR_m7_Ns_JNS_4_ShouldFollow to 2 86 endif 87 elseif ( TR_m7_Ns_JNS_4_ShouldFollow == 0 ) 88 set xpos to ( GetPos x ) 89 set ypos to ( GetPos y ) 90 AITravel xpos ypos -2000 -1 91 Set TR_m7_Ns_JNS_4_ShouldFollow to -1 92 endif 93 ;Actually check whether she should follow the player for the next frame 94 if ( TR_m7_Ns_JNS_4_AnderaFollow == 2 ) 95 if ( GetDistance player <= 200 ) 96 if ( player->GetWeaponDrawn == 1 ) 97 if ( TR_m7_Ns_JNS_4_ShouldFollow < 1 ) 98 Set TR_m7_Ns_JNS_4_ShouldFollow to 1 99 endif 100 elseif ( TR_m7_Ns_JNS_4_ShouldFollow > 0 ) 101 Set TR_m7_Ns_JNS_4_ShouldFollow to 0 102 endif 103 elseif ( TR_m7_Ns_JNS_4_ShouldFollow > 0 ) 104 Set TR_m7_Ns_JNS_4_ShouldFollow to 0 105 endif 106 ;If she is close enough to the activator marking the next part of the escort sequence, 107 ;(And is on the correct part of the sequence) start the next part. 108 if ( TR_m7_Ns_JNS_4_FollowState == 4 ) 109 if ( GetDistance "TR_m7_Ns_JNS_4_EscortAct1" <= 70 ) 110 Set TR_m7_Ns_JNS_4_FollowState to 5 111 Set TR_m7_Ns_JNS_4_ShouldFollow to 1 112 endif 113 elseif ( TR_m7_Ns_JNS_4_FollowState == 5 ) 114 if ( GetDistance "TR_m7_Ns_JNS_4_EscortAct2" <= 70 ) 115 Set TR_m7_Ns_JNS_4_FollowState to 6 116 Set TR_m7_Ns_JNS_4_ShouldFollow to 1 117 endif 118 elseif ( TR_m7_Ns_JNS_4_FollowState == 6 ) 119 if ( GetDistance "TR_m7_Ns_JNS_4_EscortAct3" <= 70 ) 120 Set TR_m7_Ns_JNS_4_FollowState to 7 121 Set TR_m7_Ns_JNS_4_ShouldFollow to 1 122 endif 123 elseif ( TR_m7_Ns_JNS_4_FollowState == 7 ) 124 if ( GetDistance "TR_m7_Ns_JNS_4_EscortAct4" <= 70 ) 125 Set TR_m7_Ns_JNS_4_FollowState to 8 126 PlaySound "Door Metal Open" 127 PositionCell 4917 5444 -43 90 "Narsis, Sewers: Foreign Quarter Central" ; TR_m7_MARK_Ns_JNS_Andera 128 endif 129 endif 130 endif 131 endif 132 endif 133endif 134 135if ( OnDeath == 1 ) 136 set TR_m7_Ns_JNS_4_AnderaFollow to 0 137endif 138 139if ( TR_Map == 7 ) 140 return 141endif 142 143Set TR_Map to 7 144Set T_Local_NoLore to 1 145 146End