Jump to content

Electric shock script. Any takers please?


Recommended Posts

Hi all.

What I want to achieve is a OnTriggerEnter script that will cause a quick electrical effect. I already have the sound fx and I'm guessing PlaceAtMe will be involved, I'm way out of touch with scripting so help appreciated. Scene is: Player walks down a passage, there is a closed door. When player nears the door an electircal shock effect can be heard in the room behind the door, also the 'shocking' effect can be seen through the crack under the door. Meaning the effect will take place in the room behind the door and the player will know this as the door will be iiluminated (I know fx can be seen behind doors as I've dropped a torch in a room, closed the door and the illumination is visible through the door). Player sees and hears the very short 'shock', opens the door and... nothing - just a smoking chair - this part I've alreay done. Event will occur once - for now - maybe go back to this room (in history, kind of my mod's theme) to witness what happened but that will be much later in the mod.

Hope I have explained myself clearly, thanks for any help.

Link to comment
Share on other sites

I think you can place a disabled xMarker where you want the FX and such to play. Use the OnInit event on the xMarker's script to trigger all the stuff to run. Then when the player enters the trigger volume box use the OnTriggerEnter event on that script to enable the xMarker.

 

There may be other possible methods. Feel free to see if anyone else has some ideas.

Link to comment
Share on other sites

I'm getting there. Just need a reminder on how to place sound at the xmarker, not emit from player.

 

 

import sound

Actor Property PlayerREF Auto
explosion property MyFX auto
ObjectReference property xMarkerFX auto
Sound Property MySoundFX Auto
int instanceID ;used to store sound ref


auto state waiting
Event OnTriggerEnter(ObjectReference akActionRef)
if akActionRef == PlayerRef

xMarkerFX.placeAtMe(MyFX)
instanceID = MySoundFX. Play(PlayerRef)
Utility.wait(0.5)
GoToState("Done")
else
; Do nothing

endif
ENDEVENT
ENDSTATE

EVENT onTriggerLeave(ObjectReference akActionRef)
if akActionRef == PlayerRef
; Do nothing
endif
ENDEVENT

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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