SE39ObjectScript
Editor ID:SE39ObjectScript
Form ID:00042BF5
Type:Object
Script:ScriptName SE39ObjectScript
;used to track when the player messes up Cindanwe's house in SE39
;It is attached to ALL the items in her house
;The general logic of this script is this:
;If its not in a container, and hasn't already been moved or added to player inventory yet, if its current position is greater than moveDistanceNeeded, mark it moved and increment a quest variable to count the number of things moved
;When it's added to the player's inventory, if it hasn't been moved or added yet, mark it added and increment a quest variable to count the number of things moved
;If enough things have moved (SE39.MessCount) update the quest
;external variable
;SE39.MessCount ;used to track how many items have moved, once enough objects have been moved, update the quest
;local variables
short init ;doOnce to init all the variables
short moveDistanceNeeded ;how far does the player need to havoc things before they are considered moved
short moved ;the object has been havoc'd far enough to be considered moved
short added ;the player added the item to his inventory (ie "moved it")
float origPosX ;holds the original position of this object
float origPosY ;holds the original position of this object
float origPosZ ;holds the original position of this object
float posX ;holds the "current" position of this object
float posY ;holds the "current" position of this object
float posZ ;holds the "current" position of this object
float timer ;If you mess up the house before talking to Ranarr-Jo during stage 50 results I reset the interior... it seems the GameMode block runs before the objects are finished being reset, so they think they've been moved... this timer is a work around that makes them wait before processing
BEGIN GameMode
;don't bother with this script if its not the appropriate time to worry about if things are moved or not
if getStage SE39 >= 200
RETURN
elseif getStageDone SE39 60 == 1
RETURN
elseif getStageDone SE39 65 == 1
RETURN
elseif getStage SE39 < 50
RETURN
elseif getStageDone SE39 50 == 1
if timer < 2
set timer to timer + getSecondsPassed
else
if GetContainer == 0
if added == 0
set posX to getPos X
set posY to getPos Y
set posZ to getPos Z
endif
if moved == 0 && added == 0
if posX > origPosX
if posX - origPosX > moveDistanceNeeded
set moved to 1
endif
elseif posX < origPosX
if origPosX - posX > moveDistanceNeeded
set moved to 1
endif
endif
if posY > origPosY
if posY - origPosY > moveDistanceNeeded
set moved to 1
endif
elseif posY < origPosY
if origPosY - posY > moveDistanceNeeded
set moved to 1
endif
endif
if posZ > origPosZ
if posZ - origPosZ > moveDistanceNeeded
set moved to 1
endif
elseif posZ < origPosZ
if origPosZ - posZ > moveDistanceNeeded
set moved to 1
endif
endif
endif
if moved == 1
Set SE39.MessCount to ( SE39.MessCount + 1 )
if SE39.MessCount > 15
setStage SE39 60
endif
set moved to 2
endif
endif
endif
endif
END
BEGIN OnAdd Player
if getStageDone SE39 50 == 1
if moved == 0 && added == 0
Set SE39.MessCount to SE39.MessCount + 1
if SE39.MessCount > 15
setStage SE39 60
endif
Set added to 1
endif
endif
END
Begin OnLoad
if init == 0
set moveDistanceNeeded to 20
set origPosX to getPos X
set origPosY to getPos Y
set origPosZ to getPos Z
set init to 1
endif
if getStageDone SE39 50 == 1
if moved > 0
SetPos X posX
SetPos Y posY
SetPos Z posZ
endif
endif
End