Published in


NPCs are landing in Crayta!

No more Scarecrow shopkeepers & no more automaton guards (unless you want them, of course!)

The next season of Crayta, Cursed Galleons, will introduce the first phase of a long-awaited and much-requested feature for creators and players to enjoy. NPCs (Non-Player Characters) are characters, just like players, that can be placed in the world and controlled via Lua scripting.

Maybe your game needs a shopkeeper and those static meshes just aren’t cutting it any more; or perhaps your players are tired of shooting at practice dummies. With a couple clicks and a script your world can feel much more alive with the addition of some NPCs.

Now, we must impress — this is very early stages, and the use of these is limited compared to what we’re planning for the future. But we imagine creators will be able to do lots with what we have provided so far. So…

How Do They Work?

NPCs are a new type of primitive entity; like Light or Locator; adding one is as easy as selecting the primitive type in the editor and clicking anywhere in your world.

You can customise how they look in the properties window by selecting from a range of customisation presets; this will set up their body, face, hair, etc. Then you can go one step further and choose an outfit for your NPC to wear from a wide selection of our most popular looks. Based on the feedback, we want to expand the ways in which you can customise your NPCs, specifying exactly which head/hair/etc to use but for now, we’ve made it simple and gone for presets at this stage.

Now you have a lovely looking NPC standing around in your world…

But what can my NPC do?!

We have an extensive Lua API available for controlling NPCs; there are two sections you’ll want to check out, CharacterBase and NPC. Let’s have a look at some of the most exciting features available.

Play Emotes
Let your NPCs express themselves! Cheer, Cry or have a dance party, using the PlayEmote API your NPCs can perform all the same emotes available to use as a player.

All of the grip APIs have been moved from Character to CharacterBase, a new base class shared by NPCs and Characters. This means you can use all of your existing grip related scrips on NPCs too! NPCs can fire a rifle, swing a sword or carry a box just as well as players can. All made possible with the Grip APIs.

So you can dance and you can swing a sword, but it’s not much use if all you can do is stand in one spot, is it?

Not to worry! We’ve provided some methods to help your NPCs move around the world too. That’s where MoveToPosition comes into play. With this, you can set a destination for your NPCs to move to and even tell them how fast to go. Combined with the Jump, Roll & Crouch methods your NPCs will be moving around your world in no time!
There is one limitation to this system though; your NPCs will currently only move towards their destination in a straight line; automatic pathfinding and obstacle avoidance isn’t there just yet.

What’s next?

We think NPCs are one of the most exciting features we’ve added to Crayta and we can’t wait to see what you all do with them!

But this isn’t the end of the road for NPCs! There’s still plenty of potential for NPCs in Crayta and we’re going to continue working hard to improve and expand on the feature. So, go play with them, and let us know what you’d like to see from NPCs in the future, & let us know what you think on Discord and Twitter!

Crayta is FREE to play and create on Stadia and Epic Games Store!



Posts by Unit 2 Games staff, mostly about Crayta

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store