Scripts

TR_m4_TJ_VethaLlatha_g_sc

TR_Mainland.esm
Variables 9
Local Variables
dead
follow
control
state
ftemp
xPos
yPos
zPos
delay
Source
1begin TR_m4_TJ_VethaLlatha_g_sc 2 3short dead 4short follow ;set in dialogue 5short control 6short state 7 8float ftemp 9float xPos 10float yPos 11float zPos 12float delay 13 14if ( state == 2 ) 15 return 16endif 17 18if ( OnDeath ) 19 set dead to 1 20endif 21 22if ( dead ) 23 set delay to ( delay + GetSecondsPassed ) 24 if ( delay > 7.5 ) 25 resurrect 26 PlaceAtMe "T_Glb_Var_GhostDeathFX1" 1 0 0 27 PlaySound3D "conjuration hit" 28 if ( follow ) 29 AiFollow player 0 0 0 0 30 endif 31 set dead to 0 32 set delay to 0 33 endif 34 return 35endif 36 37if ( state == 1 ) 38 if ( getdistance TR_m4_bal_galanchest < 300 ) 39 disable 40 PlaceAtMe "T_Glb_Var_GhostDeathFX1" 1 0 0 41 PlaceAtMe "TR_m4_Vetha Llathsa" 1 0 0 42 PlaySound3D "conjuration hit" 43 set state to 2 44 endif 45 return 46endif 47 48if ( GetPCCell "Tur Julan, Hall of Invocation" ) 49 if ( GetDistance TR_m4_TJ_VethaLlathsa_c < 700 ) 50 set control to 1 51 else 52 set control to 0 53 endif 54elseif ( GetPCCell "Arvud, Ald Erfoud Ruins" ) 55 if ( GetDeadCount TR_m4_AldErf_Ghost >= 1 ) 56 if ( GetDistance "TR_m4_AldErf_Ghost" < 500 ) 57 AITravel -5330 776 8855 1 ; TR_m4_MARK_Vetha_Llathsa 58 set follow to 0 59 set state to 1 60 endif 61 endif 62else 63 set control to 0 64endif 65 66if ( follow == 0 ) 67 return 68endif 69 70; water walking aka effect 2 71if ( Player->GetEffect sEffectWaterWalking ) 72 if ( GetEffect sEffectWaterWalking == 0 ) 73 AddSpell TR_Follow_WW_Real 74 endif 75elseif ( GetEffect sEffectWaterWalking ) 76 RemoveSpell TR_Follow_WW_Real 77 RemoveEffects 2 78endif 79 80; levitation aka effect 10 81if ( Player->GetEffect sEffectLevitate ) 82 if ( GetEffect sEffectLevitate == 0 ) 83 AddSpell TR_Follow_LV_Real 84 else ; align height to pc 85 set zPos to ( Player->GetPos z ) 86 SetPos z zPos 87 endif 88elseif ( GetEffect sEffectLevitate ) 89 RemoveSpell TR_Follow_LV_Real 90 RemoveEffects 10 91endif 92 93; distance warp 94set ftemp to ( GetDistance Player ) 95 96if ( ftemp > 900 ); warp behind pc 97 set zPos to ( Player->GetAngle z ) 98 if ( zPos <= -135 ) 99 set xPos to -1 100 set yPos to -2 101 elseif ( zPos <= -90 ) 102 set xPos to -2 103 set yPos to -1 104 elseif ( zPos <= -45 ) 105 set xPos to -2 106 set yPos to 1 107 elseif ( zPos <= 0 ) 108 set xPos to -1 109 set yPos to 2 110 elseif ( zPos <= 45 ) 111 set xPos to 1 112 set yPos to 2 113 elseif ( zPos <= 90 ) 114 set xPos to 2 115 set yPos to 1 116 elseif ( zPos <= 135 ) 117 set xPos to 2 118 set yPos to -1 119 else 120 set xPos to 1 121 set yPos to -2 122 endif 123 124 set xPos to ( Player->GetPos x ) - ( xPos * 20 ) 125 set yPos to ( Player->GetPos y ) - ( yPos * 20 ) 126 set zPos to ( Player->GetPos z ) 127 128 SetPos x xPos 129 SetPos y yPos 130 SetPos z zPos 131 132 AiFollow Player 0 0 0 0 133endif 134 135end