Forum rules - please read before posting.

[Whishlist] WaitForACEvent(List) Action + ActionStarter new dropdown "Run when" ACEvent[List]

edited November 2019 in Engine development

Hi there!

Some extra brainstorming

From what I can see, there are tons of delegates that can be used to inject some customization in AC.

I was thinking about: instead requiring to register/unregister code, and require a class only to hook to a specific event, to execute maybe just a few lines of code, would it be possible to have a versatile "WaitForEvent", where a single script can selectively choose which event to register to, and maybe also have some ScriptableObject "ScriptableAction" that just executes some custom code (as part of the same WaitForEvent node, or a separate one)?

That would make extending some behaviours a bit easier on the user side, and wouldn't require to write a new class only to hook into a single event, and execute a few lines of code.

I'm thinking about this because I'm seeing that most of the snippets around are in the form of:

-register to event
-execute custom code
-unregister event (on disable or when not needed anymore)

That would translate to (for instance):

  • Action: WaitForEvent (SubtitleMenuAppears) (note: the event will deregister automatically on first occurrence unless specified and move to next action)
  • Action: ExecuteScriptedAction (myStaticScriptableObjectCode)
  • no step 3. Optionally create a delay and a loop back to the beginning of the queue.

I understand writing such class would be enormously boring and a pain to maintain (unless some procedural automated way to do that is written to gather a full list of events),

yet!

a VERY common pattern I've seen in the forums could be handled (used and reused) just by using the WaitForEvent and ExecuteCustomScript actions.

The ActionList Starter could benefit from the same "triggering" conditions, building the ultimate bridge between scripting, parameters and custom code snippets.

Comments

  • You could feasibly do this from a single custom script that hooks into any and all events you want to listen to, and run an ActionList when triggered. I don't feel that having an Action itself listen/wait for events would be appropriate, and many of the custom scripts that use them rely on the parameters that get passed.

  • Got it :)

    What about the "Custom Script" Action, which executes some code contained in a inheritable ScriptableObject's Execute method, to plug some extra code in the actionlist without having to send a message/statically use Unity Events that rely on writing a class just for that? (well, you'd actually still need to write the same code for the CustomScriptAction ScriptableObject, but you could use more, and it would be easier to plug/unplug/be reusable, and it wouldn't require to write a whole new action to add some code in the ActionList).

    It's basically an Action with a single ScriptableObject field, containing the actual code.
    Nothing extra-complex, I'm using it myself, I'm just suggesting to maybe add it to the native actions, if it's compatible with the overall design.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.