Author Topic: Prevent entry into a trigger  (Read 402 times)

Legacy_Quevy

  • Jr. Member
  • **
  • Posts: 92
  • Karma: +0/-0
Prevent entry into a trigger
« on: July 24, 2016, 03:42:55 pm »


               

As the title suggests, you can prevent the entry into a trigger if the pg does not have an object?



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Prevent entry into a trigger
« Reply #1 on: July 24, 2016, 06:44:13 pm »


               Well, you can eject the PC the moment they enter the trigger. Action them to jump to a waypoint just outside. Make them uncommandable until the action is complete.
               
               

               
            

Legacy_Quevy

  • Jr. Member
  • **
  • Posts: 92
  • Karma: +0/-0
Prevent entry into a trigger
« Reply #2 on: July 24, 2016, 06:59:11 pm »


               
Yes, I had done something similar on an old module years ago, wondering if there was a different system.

Maybe my idea you could achieve if you can create different waypoints, and move the pg to the nearest one.

But I do not think I'm capable of doing this.


               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Prevent entry into a trigger
« Reply #3 on: July 24, 2016, 10:20:19 pm »


               If the waypoints had the same tag, GetNearestObjectByTag would do it.
               
               

               
            

Legacy_Quevy

  • Jr. Member
  • **
  • Posts: 92
  • Karma: +0/-0
Prevent entry into a trigger
« Reply #4 on: July 24, 2016, 10:52:25 pm »


               

Thanks '<img'>



               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Prevent entry into a trigger
« Reply #5 on: July 26, 2016, 04:16:52 pm »


               

Technically speaking


It is impossible to prevent entry into a trigger, since the code that you would be using to eject them, has run because they are already inside the trigger.


But yeah - what they said about jumping to a waypoint etc


 


 I would actually suggest you put lots of invisible objects about 1 meter away from the outer edges of the trigger perimeter.


Then in the onEnter script, tell it to find the closest object by tag (your invisible jump target)


Then tell the entering object to jump to that one


 


 


Eg


Imagine you have a trigger here, with X being your jump target.


If the player enters from the other side, it looks like a teleport if they end up jumping across the trigger to the other side


 


                                             ==============


                                X          =                           =


                                            =                           =


                                             = = ============


                                 


 


                                        X       X     X     X      X    X


                                  X           ==============     X


                                X          =                           =      X


                                 X           =                           =     X  


                                   X          = = ============   X 


                                            X     X    X   X    X   X   X


 


 


The above example however, gives the script lots of other targets to jump you to - meaning that you will have a more realistic 'bounce' effect when you enter from any side.


Eg: The script will find the closest X from the player, and then tell the player to JumpToObject on the X object.


I recommend you apply a knockdown effect etc to discourage constant running into the trigger.


Also - Ensure that the X's are far enough away from the trigger.


If the player tries hard enough, and they are able to keep walking while 'sliding' to the X, they can sometimes overcome the triggers script and remain inside the trigger.


Since the trigger only runs the onEnter event once per entry, if they manage to fight against the script and end up avoiding the full teleport, they will have managed to stay in without being ported out.


So avoid this by making sure the X locations are at least 1-2 meters away from the perimeter.



               
               

               
            

Legacy_Quevy

  • Jr. Member
  • **
  • Posts: 92
  • Karma: +0/-0
Prevent entry into a trigger
« Reply #6 on: July 26, 2016, 04:44:57 pm »


               
Thanks for the suggestion.

 

These days I meditated and I think that maybe I will solve the problem in another way, I do not really like that you see the jump, and then I thought of something like that, some waypoints, nis not necessarily too close, if a character that enters the trigger does not reflect certain conditions, the control console is deactivated and the pg walking up to the nearest trigger.


               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Prevent entry into a trigger
« Reply #7 on: July 27, 2016, 05:29:47 pm »


               

Glad you got a solution.


That being said - if the jump location is close enough to the player, they will actually slide to the destination.


That way you can simulate a forcefield pushing them back.