Jump to content

[Script] OnTriggerEnter for Objects


Zorkaz

Recommended Posts

Event OnTriggerEnter is appearantly for Actors only.

Has someone found a neat way to incorporate miscobjects or MovableStatics too?

 

For example I'm trying to use a ball that enters a triggerzone but it won't work in any way or form

ObjectReference Property TBRBallCloud Auto
ObjectReference Property TeleportMarker Auto
Keyword Property TBRBallKeyword Auto

Event OnTriggerEnter (ObjectReference AkActionRef)
If AkActionRef.haskeyword (TBRBallKeyword)
AkActionRef.moveto (TeleportMarker)
Endif
EndEvent

 

Link to comment
Share on other sites

Will this involve the player throwing something at the trigger? Maybe you could try having a script activate when the player is near the object first (to register and whatnot), grab the object reference of whatever is in the player's hands at this point and then set off an OnDistanceLessThan() event between the trigger zone and this object when it arrives in proximity. Better not have this script or this event-potential lingering persistently though, or it will likely screw with performance. I suppose it's easy enough to unregister the event.

https://www.creationkit.com/fallout4/index.php?title=RegisterForDistanceLessThanEvent_-_ScriptObject

Link to comment
Share on other sites

Scriptname TBRTriggerBallScr extends ObjectReference

ObjectReference Property TBRBallCloud Auto
ObjectReference Property TeleportMarker Auto
Keyword Property TBRBallKeyword Auto

Event OnTriggerEnter (ObjectReference AkActionRef)
If AkActionRef == (TBRBallCloud)

;If AkActionRef.haskeyword (TBRBallKeyword)
AkActionRef.moveto (TeleportMarker)
;Endif
Endif
EndEvent

Won't work either

Link to comment
Share on other sites

OK. Not sure what counts as 0 distance for the object. 0 units from bounding box or from center? If bounding box it could still work if you put a very small number like 1 which would be something like 1 cm from the ground assuming the bounds are a very thin but wide cube or a 2d plane. Have you tried it?

Link to comment
Share on other sites

OK. Not sure what counts as 0 distance for the object. 0 units from bounding box or from center?

 

The center.

 

Event OnTriggerEnter is appearantly for Actors only.

Has someone found a neat way to incorporate miscobjects or MovableStatics too?

 

For example I'm trying to use a ball that enters a triggerzone but it won't work in any way or form

 

Have you looked at the Atomic Rollers? I haven't but they detect when the ball falls in the hole somehow.

Link to comment
Share on other sites

OK. So how about having the floor be a conventional trigger that enables a process, once player enters, wherein something will fire once a held object is found within confines determined by the trigger object, modified by what you think is necessary in +/- distance. There's no OnDistanceLessThanFromCoordinates type event so I guess it'll have to be a while loop (bad, locking things up) or a short, repeating timer (better), conditioned upon the player having anything in a grabbed state at all, travel-time of throw being accounted for in timer length and GetTriggerObjectCount() being more than 0.

 

Ignore this at will, I'm simply brainstorming.

Link to comment
Share on other sites

Somehow from info around had an impression that anything is able to trigger a volume, though cannot test. Maybe OnTrigger() or exact collision layer must be specified for the primitive?

 

There was a mention of player thrown objects, well, by the way, is there a direct method to determine if object has been thrown? Or some event when player throws (but not drops) a grabbed thing. IsPlayerGrabbedRef is an interesting and useful Condition, but won't cover every need.

Link to comment
Share on other sites

So far I've only found OnRelease, the opposite of OnGrab. Which will say nothing about velocity... One could use a switch of states to follow up, then OnTranslationComplete()* check where this object has landed. If it's within the 2D bounds of the floor, and on level with it, Activate().

If the item was dropped directly from the inventory it would be OnItemRemoved with no receiving container (dropped into the world) and again translation event (if applicable). For a genuine throwable, simply an OnHit.

 

*don't know if this applies to translations that aren't the result of scripted requests, i.e. things that are simply doing some gameplay-havok

v°v

Link to comment
Share on other sites

  • Recently Browsing   0 members

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