Difference between revisions of "Talk:Global Scripts"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>JT
imported>JT
Line 2: Line 2:
Removed section about having to add a condition to a quest or the game will crash. Not true. There are plenty of quests without any conditions. If the game is crashing, it must be for some other reason (perhaps something in the script itself).
Removed section about having to add a condition to a quest or the game will crash. Not true. There are plenty of quests without any conditions. If the game is crashing, it must be for some other reason (perhaps something in the script itself).


-----


Well, the plugin continually crashed when I tried my global script with the quest having no conditions at allWhen I added a condition, to make it similar to the StartupQuest, the plugin worked flawlessly. There must be some kind of issue involved, though I don't really care enough about the details to worry about it. ;-)
Probably rightThe Player.GetIsRace function might be failing before the game is successfully initiated or loaded. --[[User:JT|JT]] 21:36, 24 March 2006 (EST)


Perhaps this is only an issue if the Quest starts enabled from the very beginning of the game?  I've noticed that the quests that don't have conditions are enabled during dialogue/quests as the game proceeds. --[[User:JT|JT]] 21:36, 24 March 2006 (EST)
The script, for reference:
<pre>scriptname JTKhNightEyeScript
 
float fQuestDelayTime
short nighteye_toggle
 
begin GameMode
 
;If the player is not a Khajiit, we have to return here.  Unfortunately, we can't just stop
; the script because the player will not be a Khajiit until his/her race has been selected.
; I'll have to do some research into the chargen states in Oblivion.
if ( Player.GetIsRace "Khajiit" != 1 )
return
endif
 
;Until the player is a Khajiit, this script will execute only once every 5 seconds or so,
; based on Oblivion's standard quest engine.
;If this point is reached, then the player is a Khajiit and we want to process this script every
; frame to allow perfect resolution of the player's Eye of Night power.
set fQuestDelayTime to ( 0.001 )
 
;The player has cast the Eye of Night power.
if ( Player.IsSpellTarget "LpRaceKhajiitNightEye" )
if ( nighteye_toggle == 0 ) ;If we are not currently in night-vision mode...
Player.Dispel "LpRaceKhajiitNightEye"
Player.AddSpell "JTKhNightEyeAbility"
set nighteye_toggle to 1
else ;If we are currently in night-vision mode...
Player.Dispel "LpRaceKhajiitNightEye"
Player.RemoveSpell "JTKhNightEyeAbility"
set nighteye_toggle to 0
endif
endif
 
end GameMode</pre>

Revision as of 21:41, 24 March 2006

--Kkuhlmann 20:27, 24 March 2006 (EST) Removed section about having to add a condition to a quest or the game will crash. Not true. There are plenty of quests without any conditions. If the game is crashing, it must be for some other reason (perhaps something in the script itself).


Probably right. The Player.GetIsRace function might be failing before the game is successfully initiated or loaded. --JT 21:36, 24 March 2006 (EST)

The script, for reference:

scriptname JTKhNightEyeScript

float fQuestDelayTime
short nighteye_toggle

begin GameMode

;If the player is not a Khajiit, we have to return here.  Unfortunately, we can't just stop
; the script because the player will not be a Khajiit until his/her race has been selected.
; I'll have to do some research into the chargen states in Oblivion.
if ( Player.GetIsRace "Khajiit" != 1 )
	return
endif

;Until the player is a Khajiit, this script will execute only once every 5 seconds or so,
; based on Oblivion's standard quest engine.
;If this point is reached, then the player is a Khajiit and we want to process this script every
; frame to allow perfect resolution of the player's Eye of Night power.
set fQuestDelayTime to ( 0.001 )

;The player has cast the Eye of Night power.
if ( Player.IsSpellTarget "LpRaceKhajiitNightEye" )
	if ( nighteye_toggle == 0 ) ;If we are not currently in night-vision mode...
		Player.Dispel "LpRaceKhajiitNightEye"
		Player.AddSpell "JTKhNightEyeAbility"
		set nighteye_toggle to 1
	else ;If we are currently in night-vision mode...
		Player.Dispel "LpRaceKhajiitNightEye"
		Player.RemoveSpell "JTKhNightEyeAbility"
		set nighteye_toggle to 0
	endif
endif

end GameMode