Jump to content

Difference between onTriggerEnter and onTrigger


clanky4

Recommended Posts

Over the past few months, or I guess technically years, of modding I've been using Activators and onTriggerEnter to advance quests when I wanted them advanced from the player going to a certain location at a certain time. For the most part it has worked well enough I seldom noticed any issues with it.


However, I did note that if you put an activator "over" a Door's teleporter marker, and the player was moving during the loading screen (such as by having auto run enabled), that the script did not seem to register the onTriggerEnter. Enlarging the activator did nothing to alleviate the issue. I tested the same script by swapping onTriggerEnter with onTrigger and it seemed to work the same except it did not have the aforementioned issue with the auto run and door thing causing the script to not work correctly.


Is there any real difference in terms of performance or any other adverse effects that differentiate onTriggerEnter and onTrigger? From what little I've seen of it onTrigger seems to be superior to onTriggerEnter since it would fire while an object is touching it instead of once the the object enters it, as long as the activator is disabled once it is used.


In short what is the difference between onTriggerEnter and onTrigger?


Example scripts:




scn MyModSCRIPTActivatorAdvQuest

begin onTrigger player

if getStage MyModQUESTLater == 10
setStage MyModQUESTLater 20
Disable
endif

end


scn MyModSCRIPTActivatorAdvQuest

begin onTriggerEnter player

if getStage MyModQUESTLater == 10
setStage MyModQUESTLater 20
Disable
endif

end

Edited by clanky4
Link to comment
Share on other sites

My understanding of the difference is that OnTrigger will repeat every frame for as long as the actor is on the trigger or touching it, while OnTriggerEnter executes exactly once per entry and will not active again until the actor leaves and enters again. If all you wanna do is advance a quest stage, then the difference doesn't matter, especially if you disable on the first event.

Edited by WarMachineDD7
Link to comment
Share on other sites

Ah Ha ! That explains why I was having what I thought was quirky mixed results with testing a bunch of teleports that had arrival scripts on cubic activators. It was me being in a hurry to run through it for testing , and this glitchy behavior with OnTriggerEnter ... can't remember why I didn't try using OnTrigger ? Thanks for the post :thumbsup:

 

But a mention that may help you in the future ... I was putting scripts on the doors while trying to sort stuff out. So in your case you could put a script on the door like this ...

 

scn MyModSCRIPTActivatorAdvQuest

Short DoOnce

begin OnActivate player

  If DoOnce == 0 && getStage MyModQUESTLater == 10
     setStage MyModQUESTLater 20
     Set DoOnce to 1
     Activate
Else
     Activate
endif

End

 

Link to comment
Share on other sites

Thank you, the GECK wiki isn't too specific on certain topics so it is helpful to get some reinforcement. I suppose now I COULD go back and replace all of the times I've used onTriggerEnter with OnTrigger. Or at least not use it so heavily in the future.

 

I was never too sure on how scripts and doors worked. I'll have to try it next time and see how it goes. I could make certain encounters require less parts.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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