edited December 2016 in ORK Scripting
I'm trying to write a script so that when a player starts an event by interacting with an object (with an attached Event Interaction component), the script I've attached to that same object will do something (play an animation for example)

Is there anything that gets set to true on an objects event interaction component when its event is started?

I'm just trying to vaguely describe what I mean, so forgive me if this makes little sense but something like:

Event event = gameObject.GetComponent( typeof(EventInteraction) ) as EventInteraction;

if( event.started == true )
//do something

Thanks in advance to anyone who can help me!

EDIT: I've decided to use ORK's move AI instead of my own script since it's a lot easier to implement than I thought, but It might still be nice to know if there's a variable that gets set to true or not.
Post edited by braytendo on
  • I am not an expert and i use that few times, but can't you simply rely on "Call Function" step, to call a custom function from a script you attached there? I tried that and it worked fine in my 2D game. Or i suppose you could use "Enable component" to enable the script itself and put there the autostart funciton you need.
    I hope it can help you. :-)
  • edited December 2016
    Oh yeah, there are plenty of things I could do from the event itself, but I'm trying to save myself the trouble of having to include that stuff every single time.

    I wrote up a nice movement AI script that I can plop on any object that I want roaming around an area, but I want to write in a section of the script that pauses the objects movement during an event.

    There are many objects that I need this script on, and most of them are NPCS that can be talked to, so it would save a lot of time if I could just add something that detects the event inside the script, ya know?

    EDIT: I also realize that I can handle movement AI through ORK but it doesn't meet my specific needs and this way I don't have to make a combatant for every NPC that I want moving around town.
    Post edited by braytendo on
  • I got your point.

    About NPC wandering i just made one combatant, and i attached that to every non-battling characters: NPCs simpy move around and stops if the player interact with them.
  • you only made one combatant for all NPCs? Could you explain your process a bit more, that could be very useful for me in the future.
  • Sorry i am outside at the moment, can't tell you exact details, however i just made an empty combatant (consider the basic evil pants) with a simple move AI, then i just ise ORK wizard to attach the combatant component to each NPC, setting it to player faction. I tested it with 4 npcs in scene and worked fine. :-)
  • edited December 2016
    Oh wonderful! I guess I'll just use ORK's Move AI then since it's a lot easier to implement than I thought.
    Post edited by braytendo on
  • The Event Interaction component (and other interaction components) have a bool property named EventStarted, which is true while an event is running.
    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!
Sign In or Register to comment.