Download

Usable Actor Systems - Thoughts

So I’m trying to concept this out and I’m mostly just seeing what kind of advice other peeps might provide.
I need a usable actor system, but my specific needs go beyond just a “Use Actor” function.

Take for instance a Door. Users should have the following options:
Open/Close, Search, Pick Lock, Lock/Unlock, Disarm Trap, Bash/Disable, etc
And an NPC might give the following options:
Talk To, Trade With, Attack, Pick Pocket, etc

I am currently thinking of two separate designs. One is to have each item define the actions that can be done to it in a list, and provide functions via interface that implement the specifics. There will be one “GetActions” method in the interface that returns the list of available actions for that actor. Then I’d just pop the list up in a context menu when clicking on the actor.

The other design is a bit more like the existing usable systems on the market place. I would just have one “Use Actor” function that would map to whatever the default action is. Open/Close for a door, Talk for an NPC, Trade for Vendor, etc. And then I would implement the additional functions (Search, Disarm, Bash, etc) via some type of Skill system that would require targeting the specific actor.

Of course I can see benefits and drawbacks to either system. If anyone has any thoughts on this or if you’ve done something similar I’d love to hear about it.

Thanks
Jake

I created a usable actor system for my own game. I use it for puzzle elements.

I have a base “usable actor” - it doesn’t do much, but holds a few variables, like if its currently active or not. All other child classes stem from this, so the player can easily do a raytrace and see that any of those objects are indeed usable actors.

As for the different options, it might be good to have an enum that lists all of them, then have an array of the enum and you can select which actions would be available to the player. Get the array and spit it on the screen in a menu once the usable actor is active. Then just have a function library or something that can be called when you want those functions executed. It’d be a bit more complicated, but a lot more versatile in terms of a system.