edited May 2014 in ORK Support
While it is possible to trigger a Game Event with an Enemy or NPC, it doesn't seem possible to set them as actors.

In the Event Settings there are four tabs for Event Actor:

Object, Player, Member, Camera

None of these handle the use case where an enemy or NPC triggers the event.

As an example, I made a trigger zone with a fire icon. Anyone who enters says: "#actor.name0#: I'm on fire!!!" If the Event Actor is set for Player, the dialogue is "Brown Pants: I'm on fire!!!". However if I set it on Object, enemies can trigger the dialog, but the name will be blank ": I'm on fire!!!"



  • I see the problem, will add it in one of the next updates :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I figured out a temporary fix for this issue. Place an Event Interaction Component on each NPC/Enemy who can trigger effects. Then add an empty placeholder event. Mine is called "_blank".

    Create a trigger object with a Box Collider. Instead of using an Event Interaction Component, apply this script instead:


    using UnityEngine;
    using ORKFramework;
    using System.Collections;

    public class TriggerEventInteraction : MonoBehaviour {

    public ORKGameEvent EventToTrigger;
    public string TagRequired;
    public bool DeleteTrigger;


    // Use this for initialization
    void Start () {
    }

    // Update is called once per frame
    void Update () {

    }

    void OnTriggerEnter (Collider other) {
    if (other.tag == TagRequired){

    other.gameObject.GetComponent<ORKFramework.Behaviours.EventInteraction>().eventAsset = EventToTrigger;
    other.gameObject.GetComponent<ORKFramework.Behaviours.EventInteraction>().LoadEvent();
    other.gameObject.GetComponent<ORKFramework.Behaviours.EventInteraction>().CallStart();
    if (DeleteTrigger)
    {
    Destroy(this.gameObject);
    }
    }

    }


    void OnTriggerStay (Collider other) {

    }

    void OnTriggerExit (Collider other) {

    }

    }


    TagRequired - This is the tag you will use on the NPC/Enemy to prevent other moving objects (weapons, skeleton pieces, etc.) from triggering it. I use something like "NPC".

    DeleteTrigger - Check this if you want the trigger to delete itself after being fired.

    EventToTrigger - This is the event that you would normally place in the trigger's Event Interaction Component.

    Not a perfect solution, but it should work well enough until the bug fix is in.
  • Thanks for fixing this issue. I recently tried it out with 2.1.4 and it works fine now.

    For those having trouble:

    * Set the Event Interaction component's Event Settings : Start By Other to TRUE (unless you only want the PC to trigger them)
    * Use Check Tag to prevent items and other models from accidentally triggering the event
    * In the Event, set Event Settings : Event Actors : Actor 0 : Type to Starting Object

    BTW: Seems like CallStart() has been replaced with StartEvent(), which allows for the triggering GameObject to be specified. In the previous code you could replace CallStart() with StartEvent(other.gameObject).
Sign In or Register to comment.