- Home /
Is it possible to make a "NPC Creation Tool"?
Hello, I'm making a RPG game, which would require a large amount of NPC's - which could make a very time-consuming and painful ordeal to make them each separately. Is there a way I could make any type of system or gizmo(don't know about this, though) which could allow me to "patch" various body pieces and armor/clothing, set up some base stats, and prepare them for the world?
I've seen this while I was modding Oblivion in Gamebryo - I was just curious if something was possible as well here. Please try to explain as best as you can - I'm still new to the whole program. Thanks in advance!
Answer by Kiloblargh · Nov 13, 2012 at 06:35 PM
Of course it's possible. You can have a master List of GameObjects that make up the different character parts, then a List of ints that correspond to the index of the part you want on your character in the GameObject List- then a script that saves and reads the int list and uses it to instantiate the parts you want and parent them to the empty objects in your "npc armature" character. The first int of the saved array could be a large number, which encodes all the npc's stats.
With this type of system you could easily generate a large number of unique random characters.
I wouldn't bother trying to make it work in-editor. Just make it work in-game, have a separate editor "level", so you can hit the run button, make some characters, and save them. Then have a script that runs in the real game at level load, goes through every character with NPC in front of its name, finds the character file for that name; and sets up the character.
Answer by gooongalooo · Nov 13, 2012 at 08:10 PM
Well, just some ideas... quickndirty... You can use Unitys Character Costumizer and change it to your needs. If you use Unitys free version, it´s also possible to change the code to work without assetsbundles. Create a list of all available items (by name or id...) and a methode which randomly picks members of from this list(or lists -> i guess you have helmets and chests and... so you could use different lists if you want to). After you´ve finished your NPC setup, create a string from the setup and save it to your database or what ever. A lot of this stuff is already provided by the Character Costumizer...and last but not least, you can use the generator of the character costumizer to parse the string and build your npcs in game.
To change the npc setup, just load the meshes by using the setup string and modify it again... If you want to generate names, there are tons of RPG name generator out there in the www... you could use them to create your own list of names .. or build your own name generator. a basic one shouldn´t be hard to write. Combine the mesh generator and the name generator.
...but don´t forget: none will give you a game ready solution for free, i guess. Anyway..i would recommend to start from the Character Costumizer...
You can also save positions and a lot of different stuff to this string. After launching you game put all NPCs into a dictionary (name/id - setup) and parse the npcs setup strings by something like InitNpc(NPC_ID); or InitNPC("NPC_Name");