Jump to content

Need help with a event like sequence


FalloutBeast

Recommended Posts

Actually, what *may* have went wrong is the execution of the code. Code may sometimes not work because conditions are wrong, or events are not caught.

 

As far as the trigger, you can use a triggerbox (3D) or a trigger plane (2D). A default trigger would do fine if you plan on only making 1 box (and you would add the script to the reference window through your render window...), otherwise create a new trigger.

 

This may help you debug your code. What this will do is let you see how far you have gotten with your code. If you walk into your trigger and nothing happens you know it is not being caught (possibly disabled or bad declarations or events...).

 

Here is something to try (modified scrivener07):

Scriptname ShakeSceneTriggerScript extends ObjectReference
;/
Attach this script to a new triggerbox. Its the red one I think. 
Do what steve said about the sound
;/

;Be sure to point this to your effect by opening the properties window.
Sound Property mySoundEffect Auto


;Fires when player enters tigger box
Event OnTriggerEnter(ObjectReference akActionRef)
DEBUG.NOTIFICATION("The player has entered the trigger box...")
       If(akActionRef == Game.GetPlayer()) ; This condition ensures that only the player will trigger this code
               PlaySceneEffect()
               RecoverFromScene()
       Endif
EndEvent


Function PlaySceneEffect()      
       Game.DisablePlayerControls(true, true, false, false, false, false, true, false)
DEBUG.NOTIFICATION("You should hear a sound...")
       mySoundEffect.Play(self)
Utility.Wait(2)
       Game.ShakeCamera()
       Game.ShakeController(0.5, 0.5, 2.0)
EndFunction

Function RecoverFromScene()
       Game.EnablePlayerControls(True)
EndFunction

EDIT: As for nothing happening... make sure you assigned it to a trigger. Make sure the trigger is enabled when it should be firing. If the object has a parent ref... make sure the object either matches the parent ref or is opposite depending on the way you may have configured the objects behavior with it's assigned parent reference. ;)

Link to comment
Share on other sites

There's a tutorial here, and a bit more info about trigger scripts here.

 

The trigger primitive type must be a Trigger Volume:

 

"Select an existing object in your cell. Click on the Trigger Volume button, the box with a T inside of it. A orange box should appear around the object you selected. If you know you need a large trigger volume, select a large object before pressing the T-box button! "

 

"OnTriggerEnter - ObjectReference

Member of: ObjectReference Script (Papyrus)

Event called when the object reference is a trigger volume and has been entered."

Edited by steve40
Link to comment
Share on other sites

ok got all of that now a quick question for the sound part( i suck a scripting sorry),I went into properties and created a new property named it mySoundEffect(like the one in the script) and then put it the sound category, clicked auto-fill, and then picked the sound marker I made.
Link to comment
Share on other sites

FalloutBeast: You don't need to create the Property because it is defined within the script.

 

1) In the script, edit the line "Sound Property mySoundEffect Auto" and change "mySoundEffect" to be exactly the same name as your SoundMarker.

2) You also need to edit the line "mySoundEffect.Play(self)" and change "mySoundEffect" to the same name that you used in step 1 (your sound marker's name).

3) Next, save the script, then right-click it. Select Properties, then auto-fill. It should fill the property with your SoundMarker if it was named correctly.

4) That should be it. Test it in-game.

 

If you are using a custom sound effect, this walkthrough might help.

Edited by steve40
Link to comment
Share on other sites

FalloutBeast: You don't need to create the Property because it is defined within the script.

 

1) In the script, edit the line "Sound Property mySoundEffect Auto" and change "mySoundEffect" to be exactly the same name as your SoundMarker.

2) You also need to edit the line "mySoundEffect.Play(self)" and change "mySoundEffect" to the same name that you used in step 1 (your sound marker's name).

3) Next, save the script, then right-click it. Select Properties, then auto-fill. It should fill the property with your SoundMarker if it was named correctly.

4) That should be it. Test it in-game.

 

If you are using a custom sound effect, this walkthrough might help.

hmm, ok thanks I see what i did wrong. I fixed it and it worked, thanks for the help of all you.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...