Difference between revisions of "Talk:Enable - ObjectReference"
m
→Parentheses Must Be Left Blank
imported>HawkFest |
imported>HawkFest |
||
Line 44: | Line 44: | ||
:<LI>Note : enabling an already enabled light bulb will disable it (a bug?). | :<LI>Note : enabling an already enabled light bulb will disable it (a bug?). | ||
'''Example''' - The following script toggles on or off a light bulb object, and is triggered when the player hits an object to which the script is attached (either a trigger object, or any static having a collision mesh - some target) : | '''Example''' - The following script toggles on or off a light bulb object, and is triggered when the player hits an object to which the script is attached (either a trigger object, or any static having a collision mesh - some target) : | ||
:1- Put a bubl object in the render window and force its persistence by giving it a Reference Editor ID. | :Step 1- Put a bubl object in the render window and force its persistence by giving it a Reference Editor ID. | ||
:2- Choose a static object with collision that can get hit by the player with any weapons (or hand-to-hand) : a dummy target, a box, a wall, whatever. Then attach the following script to it (an alternative would be to use an activator such as a button or a lever, and code the OnActivate event, instead of the OnHit event as is the case below - which would also allow you to add controls to their gamebryo animations within the same code structure if need be): | :Step 2- Choose a static object with collision that can get hit by the player with any weapons (or hand-to-hand) : a dummy target, a box, a wall, whatever. Then attach the following script to it (an alternative would be to use an activator such as a button or a lever, and code the OnActivate event, instead of the OnHit event as is the case below - which would also allow you to add controls to their gamebryo animations within the same code structure if need be): | ||
<source lang="papyrus"> | <source lang="papyrus"> | ||
Scriptname SimpleLightBulbSwitchScript extends ObjectReference | Scriptname SimpleLightBulbSwitchScript extends ObjectReference | ||
Line 60: | Line 60: | ||
EndEvent | EndEvent | ||
</source> | </source> | ||
Last step : assign the light bulb reference | :Last step : assign the light bulb reference from above step 1 to the LightBulbRef property (via CK's form script tab where you've attached the script). '''TEST :''' In the above code, if you provide a parameter to the Enable function, e.g. ''LightBulbRef.Enable(True|False)'', then the light will not render at all, even with ''False'' as a parameter although it's the default value.<br> | ||
--[[User:HawkFest|HawkFest]] ([[User talk:HawkFest|talk]]) 01:12, 3 December 2012 (EST) | --[[User:HawkFest|HawkFest]] ([[User talk:HawkFest|talk]]) 01:12, 3 December 2012 (EST) |