Scripts

TR_m3_M_Gartus_sc

TR_Mainland.esm
Variables 15
Local Variables
companion
noLore
noHello
control
controlQ
TR_Map
T_Local_NPC
T_Local_NoLore
TR_Merc
timer
ftemp
xPos
yPos
zPos
minimumProfit
Source
1Begin TR_m3_M_Gartus_sc 2 3;Local script on NPC TR_m3_M_Gartus 4;--- 5;Original template by Greatness7 6;Companion should keep up with the player 7;--- 8;control 0 - initial state, NPC at regrouping point (Old Ebonheart, Gartus Garaxus' House) 9;control 1 - NPC has left regrouping point 10;control 2 - NPC is to regroup back at regrouping point 11;--- 12;TR_Merc -1 = Available for hire after contract ran out 13;TR_Merc 0 = Available for hire first time 14;TR_Merc 1 = Currently hired 15;TR_Merc 2 = Not hirable (player took their profit) 16;--- 17 18short companion 19short noLore 20short noHello 21 22short control ;set via dialogue 23short controlQ ;unused 24short TR_Map 25short T_Local_NPC 26short T_Local_NoLore 27 28float timer 29float ftemp 30float xPos 31float yPos 32float zPos 33 34short TR_Merc 35float minimumProfit 36 37if ( OnDeath ) 38 if ( ScriptRunning TR_m3_M_Gartus_Glb_sc ) 39 StopScript TR_m3_M_Gartus_Glb_sc 40 endif 41 if ( ScriptRunning TR_m3_M_Gartus_Move_sc ) 42 StopScript TR_m3_M_Gartus_Move_sc 43 endif 44endif 45 46if ( MenuMode ) 47 Return 48endif 49 50set timer to ( timer + GetSecondsPassed ) 51if ( timer < 0.1 ) 52 return 53endif 54set timer to 0 55 56if ( TR_Merc == 1 ) 57 if ( minimumProfit < 0 ) 58 AIWander 0 0 0 0 0 0 40 20 0 0 0 20 59 set companion to 0 60 StopScript TR_m3_M_Gartus_Glb_sc 61 StartScript TR_m3_M_Gartus_Move_sc 62 ForceGreeting 63 return 64 endif 65 if ( GetPCCell "Old Ebonheart, Gartus Garaxus' House" ) 66 if ( GetAlarm < 100 ) 67 SetAlarm 100 68 endif 69 if ( ScriptRunning TR_m3_M_Gartus_Move_sc == 0 ) 70 set control to 0 71 endif 72 elseif ( control == 0 ) 73 SetAlarm 0 74 set control to 1 75 endif 76endif 77 78if ( GetCurrentAIPackage != 3 ) 79 return 80endif 81 82; detect combat 83if ( GetSpellReadied != GetWeaponDrawn ) 84 set ftemp to ( ftemp + 1 ) 85 86 ; remove bonus speed 87 if ( GetSpeed > 100 ) 88 SetSpeed 100 89 endif 90 91 ; detect combat action 92 if ( GetSoundPlaying "Weapon Swish" ) 93 elseif ( GetSoundPlaying CrossbowShoot ) 94 elseif ( GetSoundPlaying BowShoot ) 95 elseif ( ftemp < 40 ) 96 return 97 else ; break combat 98 set timer to -1 99 AddItem "iron dagger" 1 100 Equip "iron dagger" 101 RemoveItem "iron dagger" 1 102 endif 103 104 set ftemp to 0 105 return 106endif 107 108; water walking aka effect 2 109if ( Player->GetEffect sEffectWaterWalking ) 110 if ( GetEffect sEffectWaterWalking == 0 ) 111 ExplodeSpell TR_Follow_WW_Fake 112 AddSpell TR_Follow_WW_Real 113 endif 114elseif ( GetEffect sEffectWaterWalking ) 115 RemoveSpell TR_Follow_WW_Real 116 RemoveEffects 2 117endif 118 119; levitation aka effect 10 120if ( Player->GetEffect sEffectLevitate ) 121 if ( GetEffect sEffectLevitate == 0 ) 122 ExplodeSpell TR_Follow_LV_Fake 123 AddSpell TR_Follow_LV_Real 124 else ; align height to pc 125 set zPos to ( Player->GetPos z ) 126 SetPos z zPos 127 endif 128elseif ( GetEffect sEffectLevitate ) 129 RemoveSpell TR_Follow_LV_Real 130 RemoveEffects 10 131endif 132 133; sneaking 134if ( GetPCSneaking ) 135 ForceSneak 136else 137 ClearForceSneak 138endif 139 140; distance warp 141set ftemp to ( GetDistance Player ) 142 143if ( ftemp < 300 ) 144 ClearForceRun 145 SetSpeed 40 146elseif ( ftemp < 900 ) 147 set ftemp to ( Player->GetSpeed ) * 2.25 148 SetSpeed ftemp 149else ; warp behind pc 150 set zPos to ( Player->GetAngle z ) 151 if ( zPos <= -135 ) 152 set xPos to -1 153 set yPos to -2 154 elseif ( zPos <= -90 ) 155 set xPos to -2 156 set yPos to -1 157 elseif ( zPos <= -45 ) 158 set xPos to -2 159 set yPos to 1 160 elseif ( zPos <= 0 ) 161 set xPos to -1 162 set yPos to 2 163 elseif ( zPos <= 45 ) 164 set xPos to 1 165 set yPos to 2 166 elseif ( zPos <= 90 ) 167 set xPos to 2 168 set yPos to 1 169 elseif ( zPos <= 135 ) 170 set xPos to 2 171 set yPos to -1 172 else 173 set xPos to 1 174 set yPos to -2 175 endif 176 177 set xPos to ( Player->GetPos x ) - ( xPos * 20 ) 178 set yPos to ( Player->GetPos y ) - ( yPos * 20 ) 179 set zPos to ( Player->GetPos z ) 180 181 SetPos x xPos 182 SetPos y yPos 183 SetPos z zPos 184 185 AiFollow Player 0 0 0 0 186 ForceRun 187endif 188 189set ftemp to 0 190 191if ( TR_Map == 0 ) 192 set TR_Map to 3 193endif 194 195End