Oblivion Game Data

Select game:

Search:

Select a record type:

MQ11OblivionGateScript (0x00026eaf)

  • Record Type: SCPT
  • Editor ID: MQ11OblivionGateScript
  • Form ID: 0x00026eaf
  • Source File: Oblivion.noSI.esm.mod
  • Patch Status: FormID has not been modified.
Parameter Value
SCTX
scn MQ11OblivionGateScript

short closed
short inOblivion			; set to 1 when you enter the gate

float timer
short count
ref mySpawnMarker

float resetTimer

begin OnLoad
	; destroy me if open after MQ16 finishes
	if getdestroyed == 0 && getdisabled == 0 && getstage MQ16 >= 100
		ForceCloseOblivionGate 
	endif

	; reset count
	if count > 0
		set timer to 60
	endif
	set count to 0
	
	if mySpawnMarker == 0
		set mySpawnMarker to getParentRef
	endif

end


begin gamemode
	if closed == 0 && getdestroyed == 1
		set closed to 1
		set MQ11.closedGates to MQ11.closedGates + 1
		; increase the player's fame
		modpcfame 1
		if getself == MQ11AnvilGate
			if getstagedone MQ11 20 == 1
				setstage mq11 40
			endif
			setfactionreaction AnvilFaction playerFaction 20
		elseif getself == MQ11SkingradGate
			if getstagedone MQ11 22 == 1
				setstage mq11 41
			endif
			setfactionreaction SkingradFaction playerFaction 20
		elseif getself == MQ11ChorrolGate
			if getstagedone MQ11 24 == 1
				setstage mq11 42
			endif
			setfactionreaction ChorrolFaction playerFaction 20
		elseif getself == MQ11BravilGate
			if getstagedone MQ11 26 == 1
				setstage mq11 43
			endif
			setfactionreaction BravilFaction playerFaction 20
		elseif getself == MQ11LeyawiinGate
			if getstagedone MQ11 28 == 1
				setstage mq11 44
			endif
			setfactionreaction LeyawiinFaction playerFaction 20
		elseif getself == MQ11CheydinhalGate
			if getstagedone MQ11 30 == 1
				setstage mq11 45
			endif
			setfactionreaction CheydinhalFaction playerFaction 20
		endif

	endif

	if inOblivion == 1
		if resetTimer > 0
			set resetTimer to resetTimer - getsecondspassed
		elseif getdistance player < 5000
			set inOblivion to 0
		endif
	endif

	; no need to process further if destroyed
	if getdestroyed == 1
		return
	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

begin OnActivate
	if isactionref player == 1
		set inOblivion to 1
		set resettimer to 1
		; we aren't "near" any gate anymore (we're in Oblivion!)
		set MQ00.nearOblivionGate to 0
		ReleaseWeatherOverride
	endif
	activate
end

Database last updated 11/02/2011
SCPT records last updated 10/31/2011