Why scripty no worky? (I get an instant CTD the minute I enter Therana's cell.) Your help would be much appreciated!
Begin ajw_therana_compscript
;local script
;note: make sure Mercenary has Hello 0
Short nolore
short noLore
short doOnce
short companion
short distanceCheck
short isdead
short c_move
short c_speed
short c_athletics
short c_marksman
short p_health
short p_fatigue
short p_magicka
short m_set
short h_check
short p_check
short n_check
short c_once
short r_once
short noGreet
short oneTime
short doOnce1
short doOnce2
short warp
short flyCheck
short wwCheck
short chamcheck
short weapUse
short combatDone
short combatCheck
short combatMode
short soundPlayed
Short DTNPS_MoveOnce_NotMenu
short DONOTUSE
Short DTNPS_HandlePotions
short spoken
short dayCount
short dayUp
short CL1
short CL2
short wearingClothes
short doOnce2
Long DTNPS_Count_HealthExclusive
Long DTNPS_Count_HealthQuality
Long DTNPS_Count_HealthStandard
Long DTNPS_Count_HealthTotal
float timer
float z_fly
float sheatheTimer
float counter
float px
float py
float ax
float ay
float az
float bx
float by
float bz
float t1
float t2
float t3
float t4
float coDist1
float coDist2
float DTNPS_Timer_Health
; Potion-saver by DinkumThinkum
if ( MenuMode == 1 )
if ( GetPCSleep == 0 )
return
endif
endif
if ( gethealth < 1 )
return
endif
if ( isdead == 1 )
return
endif
if ( ondeath == 1 )
set isdead to 1
set ajw_therana_near to 0
Set TelvanniDead to ( TelvanniDead + 1 ) ;for Telvanni Hortator...
if ( GetJournalIndex MT_WritTherana > 0 ) ; ... and if the player has a writ for us...
set CL2 to GetPCCrimeLevel
if ( CL2 > CL1 )
; ... append a journal entry if the execution is seen ...
Player->Journal MT_WritTherana 80
else
; ... append a journal entry if the execution is NOT seen ...
Player->Journal MT_WritTherana 90
endif
endif
return
endif
if ( GetJournalIndex HT_TheranaClothes < 100 )
if ( CellChanged == 1 )
;keep her from going off over and over.
StopCombat
SetFight 30
set CL1 to GetPCCrimeLevel
endif
if ( doOnce2 == 0 )
if ( wearingClothes == 1 )
ForceGreeting
Set doOnce2 to 1
endif
endif
endif
If ( GetHealth < 1 )
Set DTNPS_HandlePotions to 0
ElseIf ( GetFatigue < 1 )
Set DTNPS_HandlePotions to 0
ElseIf ( MenuMode == 1 )
Set DTNPS_HandlePotions to 0
Else
Set DTNPS_HandlePotions to 1
EndIf
If ( DTNPS_HandlePotions == 0 )
Set DTNPS_MoveOnce_NotMenu to 0
Set DTNPS_Timer_Health to 99
Set DTNPS_Count_HealthTotal to ( DTNPS_Count_HealthExclusive + DTNPS_Count_HealthQuality + DTNPS_Count_HealthStandard )
If ( DTNPS_Count_HealthTotal > 0 )
While ( DTNPS_Count_HealthExclusive >= 64 )
AddItem "p_restore_health_e" 64
Set DTNPS_Count_HealthExclusive to ( DTNPS_Count_HealthExclusive - 64 )
EndWhile
While ( DTNPS_Count_HealthExclusive >= 8 )
AddItem "p_restore_health_e" 8
Set DTNPS_Count_HealthExclusive to ( DTNPS_Count_HealthExclusive - 8 )
EndWhile
While ( DTNPS_Count_HealthExclusive >= 1 )
AddItem "p_restore_health_e" 1
Set DTNPS_Count_HealthExclusive to ( DTNPS_Count_HealthExclusive - 1 )
EndWhile
While ( DTNPS_Count_HealthQuality >= 64 )
AddItem "p_restore_health_q" 64
Set DTNPS_Count_HealthQuality to ( DTNPS_Count_HealthQuality - 64 )
EndWhile
While ( DTNPS_Count_HealthQuality >= 8 )
AddItem "p_restore_health_q" 8
Set DTNPS_Count_HealthQuality to ( DTNPS_Count_HealthQuality - 8 )
EndWhile
While ( DTNPS_Count_HealthQuality >= 1 )
AddItem "p_restore_health_q" 1
Set DTNPS_Count_HealthQuality to ( DTNPS_Count_HealthQuality - 1 )
EndWhile
While ( DTNPS_Count_HealthStandard >= 64 )
AddItem "p_restore_health_s" 64
Set DTNPS_Count_HealthStandard to ( DTNPS_Count_HealthStandard - 64 )
EndWhile
While ( DTNPS_Count_HealthStandard >= 8 )
AddItem "p_restore_health_s" 8
Set DTNPS_Count_HealthStandard to ( DTNPS_Count_HealthStandard - 8 )
EndWhile
While ( DTNPS_Count_HealthStandard >= 1 )
AddItem "p_restore_health_s" 1
Set DTNPS_Count_HealthStandard to ( DTNPS_Count_HealthStandard - 1 )
EndWhile
EndIf
ElseIf ( DTNPS_HandlePotions == 1 )
If ( DTNPS_MoveOnce_NotMenu == 0 )
Set DTNPS_MoveOnce_NotMenu to 1
While ( GetItemCount "p_restore_health_e" > 64 )
RemoveItem "p_restore_health_e" 64
Set DTNPS_Count_HealthExclusive to ( DTNPS_Count_HealthExclusive + 64 )
EndWhile
While ( GetItemCount "p_restore_health_e" > 8 )
RemoveItem "p_restore_health_e" 8
Set DTNPS_Count_HealthExclusive to ( DTNPS_Count_HealthExclusive + 8 )
EndWhile
While ( GetItemCount "p_restore_health_e" > 1 )
RemoveItem "p_restore_health_e" 1
Set DTNPS_Count_HealthExclusive to ( DTNPS_Count_HealthExclusive + 1 )
EndWhile
While ( GetItemCount "p_restore_health_q" >= 64 )
RemoveItem "p_restore_health_q" 64
Set DTNPS_Count_HealthQuality to ( DTNPS_Count_HealthQuality + 64 )
EndWhile
While ( GetItemCount "p_restore_health_q" >= 8 )
RemoveItem "p_restore_health_q" 8
Set DTNPS_Count_HealthQuality to ( DTNPS_Count_HealthQuality + 8 )
EndWhile
While ( GetItemCount "p_restore_health_q" >= 1 )
RemoveItem "p_restore_health_q" 1
Set DTNPS_Count_HealthQuality to ( DTNPS_Count_HealthQuality + 1 )
EndWhile
While ( GetItemCount "p_restore_health_s" >= 64 )
RemoveItem "p_restore_health_s" 64
Set DTNPS_Count_HealthStandard to ( DTNPS_Count_HealthStandard + 64 )
EndWhile
While ( GetItemCount "p_restore_health_s" >= 8 )
RemoveItem "p_restore_health_s" 8
Set DTNPS_Count_HealthStandard to ( DTNPS_Count_HealthStandard + 8 )
EndWhile
While ( GetItemCount "p_restore_health_s" >= 1 )
RemoveItem "p_restore_health_s" 1
Set DTNPS_Count_HealthStandard to ( DTNPS_Count_HealthStandard + 1 )
EndWhile
EndIf
Set DTNPS_Count_HealthTotal to ( DTNPS_Count_HealthExclusive + DTNPS_Count_HealthQuality + DTNPS_Count_HealthStandard )
If ( DTNPS_Count_HealthTotal > 0 )
Set DTNPS_Timer_Health to ( DTNPS_Timer_Health + GetSecondsPassed )
If ( GetItemCount "p_restore_health_e" > 0 )
Set DTNPS_Timer_Health to 0
ElseIf ( GetItemCount "p_restore_health_q" > 0 )
Set DTNPS_Timer_Health to 0
ElseIf ( GetItemCount "p_restore_health_s" > 0 )
Set DTNPS_Timer_Health to 0
ElseIf ( DTNPS_Timer_Health >= 1 )
If ( DTNPS_Count_HealthExclusive > 0 )
AddItem "p_restore_health_e" 1
Set DTNPS_Count_HealthExclusive to ( DTNPS_Count_HealthExclusive - 1 )
ElseIf ( DTNPS_Count_HealthQuality > 0 )
AddItem "p_restore_health_q" 1
Set DTNPS_Count_HealthQuality to ( DTNPS_Count_HealthQuality - 1 )
ElseIf ( DTNPS_Count_HealthStandard > 0 )
AddItem "p_restore_health_s" 1
Set DTNPS_Count_HealthStandard to ( DTNPS_Count_HealthStandard - 1 )
EndIf
EndIf
EndIf
EndIf
if ( GetDistance "Player" > 800 )
set ajw_therana_near to 0
else
set ajw_therana_near to 1
endif
if ( GetCurrentAIPackage != 3 )
setSpeed 40
endif
if ( weapUse == 1 )
if ( Player->GetWeaponType <= 8 )
setmarksman 0
elseif ( weapUse == 1 )
if ( Player->GetWeaponType >= 9 )
setmarksman 200
endif
endif
endif
if ( companion == 0 )
return
endif
if ( combatCheck == 1 )
set sheatheTimer to sheatheTimer + GetSecondsPassed
if ( GetSoundPlaying, "Weapon Swish" == 1 )
set sheatheTimer to 0
return
elseif ( GetSoundPlaying, crossbowShoot == 1 )
set sheatheTimer to 0
return
elseif ( GetSoundPlaying, bowShoot == 1 )
set sheatheTimer to 0
return
elseif ( sheatheTimer > 4 )
if ( GetSoundPlaying "Weapon Swish" == 0 )
set sheatheTimer to 0
set soundPlayed to 1
endif
elseif ( sheatheTimer > 4 )
if ( GetSoundPlaying "crossbowShoot" == 0 )
set sheatheTimer to 0
set soundPlayed to 1
endif
elseif ( sheatheTimer > 4 )
if ( GetSoundPlaying "bowShoot" == 0 )
set sheatheTimer to 0
set soundPlayed to 1
endif
endif
endif
if ( soundPlayed == 1 )
"therana"->StartCombat "therana"
; messagebox "Working"
set soundPlayed to 0
set combatCheck to 0
set combatMode to 0
set combatDone to 1
endif
if ( combatDone == 1 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 6 )
set timer to 0
set combatDone to 0
set warp to 0
endif
endif
if ( c_move == 1 )
if ( GetDistance Player > 100 )
set noGreet to 0
AIFollow Player 0 0 0 0
set c_move to 0
endif
endif
if ( GetCurrentAIPackage == 3 )
if ( GetPCSleep == 1 )
set p_health to ( Player->GetHealth )
set p_fatigue to ( Player->GetFatigue )
set p_magicka to ( Player->GetMagicka )
setHealth p_health
setFatigue p_fatigue
setMagicka p_magicka
endif
if ( flyCheck == 1 )
if ( GetWeaponDrawn == 0 )
set z_fly to ( Player->GetPos z )
SetPos z z_fly
elseif ( flyCheck == 1 )
if ( GetCurrentAIPackage != 3 )
if ( GetWeaponDrawn == 0 )
set z_fly to ( GetPos z )
SetPos z z_fly
endif
endif
endif
endif
if ( GetWeaponDrawn == 1 )
if ( flyCheck == 0 )
set combatCheck to 1
set combatMode to 1
set timer to 0
set warp to 1
return
elseif ( GetWeaponDrawn == 1 )
if ( flyCheck == 1 )
set combatDone to 1
set combatMode to 1
set timer to 0
set warp to 1
return
endif
endif
endif
if ( GetCurrentAIPackage == 3 )
set px to ( Player->GetPos x )
set py to ( Player->GetPos y )
if ( doOnce1 == 0 )
set ax to ( Player->GetPos x )
set ay to ( Player->GetPos y )
set az to ( Player->GetPos z )
set doOnce1 to 1
endif
set t1 to ( px - ax )
set t1 to ( t1 * t1 )
set t2 to ( py - ay )
set t2 to ( t2 * t2 )
set t1 to ( t1 + t2 )
set coDist1 to ( GetSquareRoot, t1 )
if ( coDist1 > 360 )
set doOnce1 to 0
endif
if ( coDist1 > 180 )
if ( doOnce2 == 0 )
set bx to ( Player->GetPos x )
set by to ( Player->GetPos y )
set bz to ( Player->GetPos z )
set doOnce2 to 1
endif
endif
set t3 to ( px - bx )
set t3 to ( t3 * t3 )
set t4 to ( py - by )
set t4 to ( t4 * t4 )
set t3 to ( t3 + t4 )
set coDist2 to ( GetSquareRoot, t3 )
if ( coDist2 > 360 )
set doOnce2 to 0
endif
if ( warp == 0 )
if ( coDist1 > 300 )
if ( GetDistance Player > 680 )
SetPos x ax
SetPos y ay
SetPos z az
; set doOnce1 to 0
AiFollow Player 0 0 0 0
elseif ( warp == 0 )
if ( coDist2 > 300 )
if ( GetDistance Player > 680 )
SetPos x bx
SetPos y by
SetPos z bz
; set doOnce2 to 0
AiFollow Player 0 0 0 0
endif
endif
endif
endif
endif
endif
if ( counter < 20 )
set counter to ( counter + 1 )
return
endif
set counter to 0
if ( GetCurrentAiPackage == 3 )
set c_speed to ( ( Player->GetSpeed ) * 2.25 )
set c_athletics to ( ( Player->GetAthletics ) * 2.25 )
setSpeed c_speed
setAthletics c_athletics
if ( GetDistance Player < 80 )
set noGreet to 1
AIWander 300 0 0 0 0
set c_move to 1
endif
if ( Player->GetEffect sEffectLevitate == 1 )
if ( flyCheck == 0 )
cast "ajw_crassspell_dummylev" player
addspell "ajw_crassspell_lev"
set flyCheck to 1
endif
endif
if ( Player->GetEffect sEffectLevitate == 0 )
if ( flyCheck == 1 )
removespell "ajw_crassspell_lev"
set flyCheck to 0
endif
endif
if ( Player->GetEffect sEffectWaterWalking == 1 )
if ( wwCheck == 0 )
cast "ajw_crassspell_dummy ww" Player
addspell "ajw_crassspell_ww"
set wwCheck to 1
endif
endif
if ( Player->GetEffect sEffectWaterWalking == 0 )
if ( wwCheck == 1 )
removespell "ajw_crassspell_ww"
set wwCheck to 0
endif
endif
if ( Player->GetEffect sEffectChameleon == 1 )
if ( chamCheck == 0 )
cast "ajw_crassspell_dummycham" player
addspell "ajw_crassspell_wcham"
set chamCheck to 1
endif
endif
if ( Player->GetEffect sEffectChameleon == 0 )
if ( chamCheck == 1 )
removespell "ajw_crassspell_wcham"
set chamCheck to 0
endif
endif
if ( GetPCSneaking == 1 )
ForceSneak
elseif ( GetPCSneaking == 0 )
ClearForceSneak
endif
if ( n_check == 1 )
if ( GetHealthGetRatio > 0.35 )
set n_check to 0
endif
endif
if ( m_set == 1 )
set c_marksman to ( ( Player->GetLevel ) + 35 )
setMarksman c_marksman
endif
if ( GetItemCount p_restore_health_b >= 1 )
set p_check to 1
elseif ( GetItemCount p_restore_health_c >= 1 )
set p_check to 1
elseif ( GetItemCount p_restore_health_e >= 1 )
set p_check to 1
elseif ( GetItemCount p_restore_health_q >= 1 )
set p_check to 1
elseif ( GetItemCount p_restore_health_s >= 1 )
set p_check to 1
else
set p_check to 0
endif
endif
endif
if ( dayCount != Day )
set dayUp to dayUp + 1
set dayCount to Day
endif
addtopic "-Where is Therana?"
End
File here: http://www.4shared.com/zip/eO6DmzK1ce/Crassius_and_Therana.html