scn OblivionGateRandomScript
float timer
short count
ref mySpawnMarker
short rand ; this can be removed eventually. Put it in just to be able to see the numbers that were being rolled.
short destroyed ; set to 1 after destroyed script runs
short ignore
begin OnLoad
disableLinkedPathPoints
; reset count
if count > 0
set timer to 60
endif
set count to 0
; if MQ is over, destroy me if I'm open
if getdisabled == 0 && getdestroyed == 0 && getstage MQ16 >= 100
ForceCloseOblivionGate
enablelinkedpathpoints
endif
[B]; solange die Quest nicht abgeschlossen ist, werden die Tore geschlossen
if getdisabled == 0 && getdestroyed == 0 && getstage MWOBL < 100
disable
else
enable
endif[/B]
; if we're not at max gates, we might open a new one here
; dies geht nur, wenn die Morrowind-Oblivion Überleitung abgeschlossen ist
if MWOBL == 100
if MQ00.openGates < MQ00.maxOpenGates && ( getdisabled == 1 || ( MQ00.allowGatesToReopen == 1 && destroyed == 1 ) )
set rand to GetRandomPercent
if rand <= MQ00.randomGateChance
set mySpawnMarker to getParentRef
mySpawnMarker.enable
enablelinkedpathpoints
set MQ00.openGates to MQ00.openGates + 1
if destroyed == 1
setDestroyed 0
set destroyed to 0
endif
endif
endif
endif
end
begin OnActivate
if isActionRef player == 1
; we aren't "near" any gate anymore (we're in Oblivion!)
set MQ00.nearOblivionGate to 0
ReleaseWeatherOverride
endif
Activate
set ignore to 1
return
end
begin gamemode
if ignore == 1
set ignore to 0
return
endif
; no need to process further if destroyed
if destroyed == 1
return
endif
if getdestroyed == 1 && destroyed == 0
set destroyed to 1
set MQ00.destroyedGates to MQ00.destroyedGates + 1
endif
; start churning out creatures when I'm turned on
if GetDisabled == 0 && GetDestroyed == 0
if IsAnimPlaying == 0
playgroup specialidle 1
endif
; make sure weather is eeeevil gate weather
if getiscurrentweather OblivionStormTamriel == 0
if getdistance player < 4000
if MQ00.nearOblivionGate == 0 && getdistance player < 1000
; this should only happen when I come out an Oblivion gate into Tamriel -- I'm suddenly close but the "near" variable hasn't been set
forceweather OblivionStormTamriel 1
else
setweather OblivionStormTamriel 1
endif
set MQ00.nearOblivionGate to GetSelf
endif
else
if getdistance player > 5000 && MQ00.nearOblivionGate == GetSelf
set MQ00.nearOblivionGate to 0
ReleaseWeatherOverride
endif
endif
if timer > 0
set timer to timer - getsecondspassed
elseif count < MQ00.maxCreatureCount
set count to count + 1
playgroup forward 1
mySpawnMarker.placeatme LL1DaedricBeast100
set timer to 10
endif
endif
end