Talk:Script Processing

From the Oblivion ConstructionSet Wiki
Revision as of 16:33, 9 November 2007 by imported>HawkFest
Jump to navigation Jump to search

Good job here. There are at least two other timing effects I'm pretty sure I'm seeing. Firstly when you first AddItem to a remote (persistant) actor/container, this seems to force the GameMode on that item to be processed one time. Secondly there may be something going on with cells linked via a door. My token scripts, on a persistant actor in a shop in IC, trigger when I approach the (outside) door to the shop. I've also seen this while in connected interior cells. GuidoBot 17:34, 11 November 2006 (EST)

Scripts on actors: AI packages required?

Is it necessary that an actor have one or more AI packages in order for a script on that actor to run when the player is in a different cell? Abramul 12:27, 5 April 2007 (EDT)

Problem with specific assertions

# Scripts on references: processed every frame when its cell is loaded, not at all when the cell is not loaded. So these scripts run only when the player is nearby (which means these are often a good place to put relatively expensive scripts, doing things like distance checks).

I have a countainer in an interior cell linked by two doors with the IC Waterfront District, namely cells 02 and 03. Within that interior cell is a container using a non-persistent reference. However, its MenuMode block gets executed from the very begining - the first menu when entering the game, when no game is even loaded! try the following script, it will display the message "Entered MenuMode..." on top of the very first menu... Any clue?

scn fjPCMStoneChestLarge1Script
Short CheckContainer
Short DoIt
Begin OnLoad
	If fjPCMGlobalStoneChestLarge1
		pms fjPCMeffectStatueMarvels
	Endif
End

;---***** THE FOLLOWING BLOCK EXECUTES FROM THE VERY FIRST MENU, WHEN NO GAME IS EVEN LOADED!
Begin MenuMode	;--- Should be MenuMode 1008 for container Menu, but it  does not work
	Set CheckContainer to 1
	message "Entered MenuMode..."
	Return
End
;---*****

Begin OnReset	;--- Notify a Respawn Event
	Set fjPCMGlobalStoneChestLarge1 to 1
	; (... several sets and checks code ...)
	If DoIt
		Messagebox "You've aquired so many experience levels, that a new armament up to your persona is at hand. If you use the correct set of magic stones in the correct order inside the Stand of Marvels in your Magic Room, a new Lord's Armor Set of Marvels will respawn. Watch out for Bubo and Siomo!"
	Endif
End

Begin GameMode
	If CheckContainer
		Set CheckContainer to 0
		Message "Verifying the Star Dust Receptacle's Inventory...",4
		if (GetItemCount fjPCMArmorMarvelousGreavesLvl1 > 0) || (GetItemCount fjPCMArmorMarvelousGreavesLvl5 > 0) || (GetItemCount fjPCMArmorMarvelousGreavesLvl11 > 0) || (GetItemCount fjPCMArmorMarvelousGreavesLvl16 > 0) || (GetItemCount fjPCMArmorMarvelousGreavesLvl21 > 0) || (GetItemCount fjPCMArmorMarvelousGreavesLvl27 > 0)
			Set fjPCMGlobalStoneChestLarge1 to 1
			pms fjPCMeffectStatueMarvels
		Else
			Set fjPCMGlobalStoneChestLarge1 to 0
			sms fjPCMeffectStatueMarvels
		Endif			
	Endif
End

# Scripts on objects in containers: these are processed when the container's script is processed -- so, items on actors are processed when the actor is processed; items in other containers are processed every frame when the cell is loaded.

When the cell is loaded is not correct in regards to the above-mentioned oddity. It needs to be clarified IMHO...