Talk:Global Scripts
--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. At the very least, adding that particular condition to my own plugin forces the player to be playing a valid race before the game is 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
--Kkuhlmann 06:51, 25 March 2006 (EST) Quest conditions only apply to the quest's dialogue, and since your quest doesn't involve dialogue, having a condition or not shouldn't have any impact. _Shouldn't_... obviously something strange is going on though.
Strange. I'll do some stress testing. Maybe I'll be able to work out a good synopsis for your codemonkeys. ;-) --JT 18:18, 25 March 2006 (EST)
Quest scripts are not always running!
I was trying to use a global script to do something when the players journal/inventory was open. It appears these scripts will stop when a menu is open. Any other suggestions for my delemma?
Thanks
--Reflection 01:08, 19 October 2006 (EDT)
- Sure they are. The problem you're having there -- I'm assuming -- is that you're using the GameMode block type like in the example. If you want your script to execute when the menus are open, you need to use the MenuMode blocktype instead.
- One of the issues with Oblivion modding is that there is no real way to have a single block which executes regardless of whether the menu is open or not, however, so if you want the same code to execute while the menu is open as well as when the game is in progress as well, you'll have to copy-and-paste it into the MenuMode block too.
- Most of the time, there's no need to run the GameMode code in the MenuMode block because when you're in MenuMode, there's no passage of time and thus no real need to affect the game world. --JT 18:10, 19 October 2006 (EDT)