NexBeth Posted August 12, 2019 Author Share Posted August 12, 2019 Not sure what the iCount is for, can't you keep it simple: EVENT onTriggerEnter(objectReference akActionRef) if akActionRef == Game.GetPlayer() ;Do something endifendEvent EVENT OnTriggerLeave(objectReference akActionRef) if akActionRef == Game.GetPlayer() ;Do something else endifendEvent Also kTemporary is a property and needs to be defined.agerweb, XXX; do something? That would be turn on the sound marker when entering trigger, and turn off the sound marker upon exit? Also, this is to work with NPC not player. Sorry, I'm not knowledgeable in scripting. Link to comment Share on other sites More sharing options...
agerweb Posted August 12, 2019 Share Posted August 12, 2019 Not sure what the iCount is for, can't you keep it simple: EVENT onTriggerEnter(objectReference akActionRef) if akActionRef == Game.GetPlayer() ;Do something endifendEvent EVENT OnTriggerLeave(objectReference akActionRef) if akActionRef == Game.GetPlayer() ;Do something else endifendEvent Also kTemporary is a property and needs to be defined.agerweb, XXX; do something? That would be turn on the sound marker when entering trigger, and turn off the sound marker upon exit? Also, this is to work with NPC not player. Sorry, I'm not knowledgeable in scripting. Sorry when I cut and pasted I forgot to change == to != so whatever you put in place of the ;dosomething will be triggered by an NPC. This just seemed simpler. However you code it, the 'kTemporary' has to be defined as a property and filled with something; which it isn't in your example. Link to comment Share on other sites More sharing options...
NexBeth Posted August 12, 2019 Author Share Posted August 12, 2019 I don't know what to put in there because I don't know how to script. Also, I was assuming your script did not need anything from the original script I posted so the KTemporary isn't relevant to this script? I was given the first script I posted and it does work well. It was originally made to work with setting up an NPC shower that turns on (a rain moveable static) when NPC enters the trigger, and off when it leaves. I attached a sound marker to that set up (in addition to the moveable static rain) and used the activator as enable parent. It works perfectly. However, when I tried to employ that here, minus the rain, only using the sound marker, doesn't work. Link to comment Share on other sites More sharing options...
maxarturo Posted August 12, 2019 Share Posted August 12, 2019 (edited) @maxarturo: Thanks for writing that up for me. You said I don't need an activator but you included a property for an activator? Not sure what to do. I've created the script and it compiled. Linked the myRef property to the sound marker. Just need to understand the activator part?I added the " Activator " to the script because i don't know what you are using it for, and if you actually need it for something.If you don't need it, just remove it from the script ( Property and MyActivator.Activate(self) ). If you just need the " Sound Marker " to be enable/disable, then there is no need for the " Activator ". Edited August 12, 2019 by maxarturo Link to comment Share on other sites More sharing options...
NexBeth Posted August 12, 2019 Author Share Posted August 12, 2019 @maxarturo: I compiled the script successfully (copy below with the activator edits removed), but the sound markers are on without being triggered by NPCs. The markers are initially disabled so I'm not sure how they can be heard. Now I linked the sound markers in the script's property field, not "link reference" in the markers Reference tap to the trigger. Sound markers just play all the time. Scriptname EP_EnableDisableOnTriggerSCRIPT extends ObjectReference {NPC entering trigger enables linked object, upon exit object is disabled}ObjectReference Property MyREF Auto{Enable and Disable Link Ref on Trigger Enter - Leave} EVENT onTriggerEnter(objectReference triggerRef) if triggerRef as Actor == TRUE MyREF.Enable() EndIfENDEVENT EVENT onTriggerLeave(objectReference triggerRef) if triggerRef as Actor == TRUE MyREF.Disable() EndIf ENDEVENT Link to comment Share on other sites More sharing options...
maxarturo Posted August 12, 2019 Share Posted August 12, 2019 Try this :ObjectReference Property MyREF Auto {Enable and Disable Link Ref on Trigger Enter - Leave} EVENT onTriggerEnter(objectReference triggerRef) Actor triggerActor = triggerRef as Actor if triggerActor MyREF.Enable() EndIf ENDEVENT EVENT onTriggerLeave(objectReference triggerRef) Actor triggerActor = triggerRef as Actor if triggerActor MyREF.Disable() EndIf ENDEVENT Link to comment Share on other sites More sharing options...
NexBeth Posted August 12, 2019 Author Share Posted August 12, 2019 No, same problem. Sound is continuous. Link to comment Share on other sites More sharing options...
maxarturo Posted August 12, 2019 Share Posted August 12, 2019 (edited) Wait... what ? " Sound is continious ".I don't know what you have actually done in your mod, but let's take out from the equation the " Sound Marker ". Delete the " Sound Marker " and now choose it from the script's drop down menu list.It's supposed to play the sound FX On Trigger Enter - Stop On Trigger Leave, the sound will play - be heard at the center of the trigger box. Sound property MySoundFX auto {Insert from the drop down List the sound FX to play} int instanceID ;used to store sound ref EVENT onTriggerEnter(objectReference triggerRef) Actor triggerActor = triggerRef as Actor if triggerActor instanceID = MySoundFX. Play(self) EndIf ENDEVENT EVENT onTriggerLeave(objectReference triggerRef) Actor triggerActor = triggerRef as Actor if triggerActor StopInstance(instanceID) EndIf ENDEVENT * Also try it with another sound just to check that it might be the actual " Sound Marker " that has the problem. * If neither this is working, then i don't know what's going on... Edited August 12, 2019 by maxarturo Link to comment Share on other sites More sharing options...
NexBeth Posted August 13, 2019 Author Share Posted August 13, 2019 In this new script, question, do I need to insert the name of my sound marker wherever it says: MySoundFX?? I will do that if it works, but I did have more than one sound marker I wanted to use the script with. I could just write modified scripts; there are just 3 of them. Thanks for sticking with me with this! Link to comment Share on other sites More sharing options...
maxarturo Posted August 13, 2019 Share Posted August 13, 2019 In the script's properties > in MySoundFX > find in the drop down list the name of your " Sound Marker ".And this is the Sound FX that will play or whatever else you might choose. " but I did have more than one sound marker I wanted to use the script with ".Wait now... so..., from the beginning you had more than 1 Sound Marker ?.The Script was made taking in consideration that you wanted to enable/disable just one object and not three. * Linking just one Sound Marker to be enable/disable won't affect the other 2 Sound Markers, and they will play continuously no matter of the state that the first Linked Sound Marker is. Link to comment Share on other sites More sharing options...
Recommended Posts