Complete Example Scripts

From the CreationKit Wiki
Revision as of 05:59, 14 February 2012 by imported>Evernewjoy (Created page with " == Complete Example Scripts == * '''Script Instantiation''' Please remember that no example scripts are complete by themselves, you must create an object in your cell and a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Complete Example Scripts

  • Script Instantiation

Please remember that no example scripts are complete by themselves, you must create an object in your cell and add this script to the object.

  • Property Setting

And if the script has any properties, those properties must be set to actual values before script will work.




A Fully Functional Dwemer Button

Scriptname DwemerButtonExampleScript extends ObjectReference  

objectReference property objSelf auto hidden
sound property QSTAstrolabeButtonPressX auto

;==================

;this event runs when cell is loaded containing
;this scripted object

event onCellAttach()
	objSelf = self as objectReference
	playAnimation("Open")
endEvent

;==================

EVENT onActivate (objectReference triggerRef)

  if(triggerRef == game.getplayer())
		
  ;--- sound and animation
		  
  playAnimationAndWait("Trigger01","done")
  if QSTAstrolabeButtonPressX
	QSTAstrolabeButtonPressX.play(objSelf)
  endif

  ;actual code for what button should do
  Debug.MessageBox("Joy!")
	
  endif

endEVENT

To Make This Script Work

  • You must create this script on a Activator object, probably a dwemer button :)
  • You must then set the property for the QST sound effect property, the sound file has the same name as the property in the script above.


To make your own dwemer button and avoid messing with the original Skyrim scripts/activators:

  • Extract the dwemer button .nif file from the Meshes.bsa and create a new activator using that .nif file (picking the mesh to use is an option in the activator edit window).
  • You must put your extracted .nif file in the skyrim/Data/meshes directory structure if you want the Creation Kit to be able to find and use it.


To extract files from the Skyirm .BSA files you must download something like the Fallout3 Archive Utility, do a google search for this.


♥ and thanks to our friends at Bethesda!

The Creation Kit is Beautiful!