Citizens and NPC behaviors

377 views
Skip to first unread message

Captain Starbuck

unread,
Oct 30, 2016, 6:05:30 PM10/30/16
to ScriptCraft - Scripting Minecraft
I'm looking into the Citizens API to create characters for quests. Rather than focusing on a single quest, I'm sort of thinking of creating a generic ScriptCraft library of functionality which can be used for any similar purpose. Someone might want to have a villager run after pigs, randomly saying "here piggy piggy piggy", "oink", "you're tonight's dinner guest"... Someone might want to create a squad of soldiers who occasionally walk through town in marching formation, or marauders (maybe on horseback) that set fire to unprotected buildings. Or we could create a collection of NPCs which can be added into any world to create a huge variety of quests, similar to World Of Warcraft, Runescape, etc. There could be a mage villager that offers to do magic tricks for a fee. Or a new NPC in an information booth in every town, offering information on what to do in the local area.

This would all be a lot easier with a consistent library rather than every developer having to do this on their own. And for educational purposes it could be used as an exercise for people to add sets of behaviours to a collection for others to use - an introduction to FOSS principles.

So has anyone done anything like this yet? I've seen hard-coded quest/bot scripts but nothing that interfaces with Citizens yet (and Sentries, based off of Citizens..).

Thanks.

Captain Starbuck

unread,
Nov 21, 2016, 3:42:36 PM11/21/16
to ScriptCraft - Scripting Minecraft
I'm still looking at this... wrapping the Citizens NPC plugin in ScriptCraft.
Personally I'd like to be able to manipulate NPCs as easily as the Drone class faciliates block placement.
When the basics are implemented, that would extend to the specialty Citizens traits like Sentries, Denizens, and Builders.

For a Builder example, wouldn't it be cool if we could use a Drone to define a build schematic and then hand it to one or more Builder NPCs to actually do the build? We could add delays and watch them build a construction block by block, making it a more realistic process than the magic that currently happens with a Drone. You could walk into a town and see them doing things and come back a few days later to check their progress - kinda like real life. That could be combined with some education about paying people for labor, or resource allocation.
And I'd much prefer to use Trader NPCs than buy and sell through signs.

In short, I think more refined access to NPCs via ScriptCraft can help to enrich the experience of new developers, and wrapping more complex functionality into helper routines will help new developers to get faster rewards for their efforts, thus helping to develop and maintain their enthusiasm.

So... Has anyone else done something like this?
Any guidelines? Preferences? Suggestions? Requests?
Any education projects that can help to fund this with some beer and pizza? :)


Related links:
https://wiki.citizensnpcs.co/API
https://wiki.citizensnpcs.co/Characters
https://dullahansoftware.wordpress.com/2013/02/11/scriptcrafting-a-quest-in-minecraft/
https://gist.github.com/growlf/a5547e20e435c886168f (Someone else thinking about this)
https://gitter.im/walterhiggins/ScriptCraft (discussion on the topic some months ago)

Captain Starbuck

unread,
Nov 22, 2016, 9:47:10 PM11/22/16
to ScriptCraft - Scripting Minecraft
Just another update: I was able to use the Citizens library to create player NPCs, not just a villager or built-in MC mob. It occurred to me I don't need to write too much code that actually builds an NPC and behaviours from scratch. The Citizens plugin and related Trait plugins do all of this quite well. So the challenge will be to write Java and/or JavaScript for ScriptCraft that integrates closely with these other tools, making their functionality accessible to new developers.

My personal challenge is to educate myself on the mismatches between Java and JavaScript (Nashorn / ECMA-6). There are a lot of details that I need to master like implementing Java interfaces with a JavaScript class - is that even possible? Or creating a class that derives from a Java base type where specific annotations are used, like @Persistent. I'll do the research and try to work out patterns for doing all of these things. This is actually something that I will try to translate into ScriptCraft - it's not enough to just add the functionality so that someone can make a sheep walk around. For that next level student the challenge is in understanding how that was done with the tools available.

So I have a lot of homework to do, but the goal is fairly clear. I feel like I should be blogging about this stuff but for now I'll keep note here. For example, I've been reading the details of the Citizens API, going through Denizens (and their scripting model), dlTraders, Sentry, and the other Characters that are available in this area. It's fascinating stuff and I'll be happy to exchange notes with anyone who cares to do so.

Regards,
-CS

Gene Liang

unread,
Nov 23, 2016, 9:31:07 PM11/23/16
to ScriptCraft - Scripting Minecraft
Hi, Captain :

Glad to know someone who  want to bring Scriptcraft to next level !

From my knowledge of programming, the things you want to achieve is mind-boggling for me.

But considering those plugins is still actively developed, whouldn't it be easier to just install these plugins together and do scripting seperately (or call these classes from Scriptcraft if possible) ?

Regards,
Gene


Captain Starbuck

unread,
Nov 24, 2016, 12:30:29 AM11/24/16
to ScriptCraft - Scripting Minecraft
Gene said:
But considering those plugins is still actively developed, whouldn't it be easier to just install these
plugins together and do scripting seperately (or call these classes from Scriptcraft if possible) ?

Um, I feel a little silly right now but yeah, I agree that probably would be the best approach. :)
I'm still considering options. For example, rather than rely on the Citizens API (or for any of the Character classes), I'm looking to see what features are available by issuing /commands to NPCs through ScriptCraft.

All suggestions are welcome!!

-CS
Reply all
Reply to author
Forward
0 new messages