SCTX |
Scriptname MS40Script
;This script covers all handling for MS40 - Vampire Cure
short RonaSleep
short HalliurzTravel
short talkedtoHassildor
short talkedtoMelisande
short Blood
short garlicvar
short nightshadevar
short bloodgrassvar
short argonianvar
short ashvar
short cureready
short halltarget
short currentday
short currenthour
short doorlocked ;set to make sure the player doesn't follow Melisande into the basement
short endstate ;increment to update character positions and packages for final scene
short convo ;incremented for conversation between Janus and Rona at end of quest
short melisandemove ;incremented when Melisande is moved back to her home at end of quest
short potiondrank
float convtimer
float timer
float fQuestDelayTime
begin gamemode
;Update cureready var when Melisande reaches her mark in the basement ( see below )
if ( GetStage MS40 < 10 )
return
endif
if ( GetStage MS40 == 10 )
if ( fQuestDelayTime == 0 )
set fQuestDelayTime to 0.5
endif
endif
;Once player has left the cell after getting the cure, lock the door and move Melisande to Chamber of the Lost
if ( GetStage MS40 == 70 )
if ( Player.GetInCell DrakeloweFarm == 0 )
if ( endstate == 0 )
DrakeloweExDoorRef.lock 100
MelisandeRef.moveto MS40MelisandeChamberMark
MelisandeRef.EvaluatePackage
JanusHassildorRef.moveto MS40HassildorChamberMark
JanusHassildorRef.EvaluatePackage
set endstate to 1
endif
endif
endif
;Once the player has left the Chamber of the Lost, move Melisande back to her home
if melisandemove == 0
if ( GetStage MS40 >= 70 )
if ( Player.GetInCell SkingradCastleChamberoftheLost == 0 )
if ( endstate >= 17 )
DrakeloweExDoorRef.unlock
MelisandeRef.moveto MS40MelisandeDrakeloweMark
set melisandemove to 1
endif
endif
endif
endif
;run the series of events after player hands over the cure
; NOTE: Nothing after this runs unless endstate is between 6 and 19
if endstate < 6 || endstate == 100
return
endif
if ( endstate == 6 )
set convtimer to MelisandeRef.SayTo JanusHassildorRef MS40Conversation
set endstate to 7
elseif ( endstate == 7 )
if ( convtimer > 0 )
set convtimer to ( convtimer - GetSecondsPassed )
else
set endstate to 8
endif
elseif ( endstate == 8 )
MelisandeRef.cast MS40RestoreFatigue RonaHassildorRef
set endstate to 9
elseif ( endstate == 10 )
if ( RonaHassildorRef.GetSleeping == 0 )
set convtimer to JanusHassildorRef.Sayto RonaHassildorRef MS40Conversation
set endstate to 11
endif
elseif ( endstate == 11 )
set convtimer to 5
set endstate to 12
elseif ( endstate == 12 )
if ( convtimer > 0 )
set convtimer to ( convtimer - GetSecondsPassed )
else
set endstate to 13
endif
elseif ( endstate == 13 )
RonaHassildorRef.EvaluatePackage
set endstate to 14
RonaHassildorRef.StartConversation JanusHassildorRef MS40Conversation
elseif ( endstate == 14 )
if ( RonaHassildorRef.GetCurrentAIPackage != 6 )
set endstate to 15
endif
elseif ( endstate == 15 )
RonaHassildorRef.EvaluatePackage
set endstate to 16
elseif ( endstate == 16 )
if ( potiondrank == 1 )
set timer to 0
set potiondrank to 2
elseif ( potiondrank == 2 )
set timer to ( timer + GetSecondsPassed )
if ( timer >= 5 )
set potiondrank to 3
endif
elseif ( potiondrank == 3 )
RonahassildorRef.kill
set endstate to 17
endif
elseif ( endstate == 17 )
set currentday to GameDay
set currenthour to GameHour
set endstate to 18
elseif ( endstate == 18 )
if ( currentday != GameDay )
if ( currenthour < GameHour )
set endstate to 19
endif
endif
elseif ( endstate == 19 )
if ( HalLiurzTravel == 3 )
if ( HalliurzRef.GetDistance JanusHassildorRef < 300 )
set Halliurztravel to 4
JanusHassildorRef.EvaluatePackage
HalliurzRef.EvaluatePackage
set endstate to 20
endif
endif
endif
;Have Hassildor cast reward spell on the player
if ( endstate == 30 )
JanusHassildorRef.cast MS40RewardSpell player
set endstate to 99
endif
;Close out the quest when the reward is given
if ( endstate == 99 )
set endstate to 100
SetStage MS40 100
endif
End
|