Jump to content

How to add a starting item


Recommended Posts

Hello!

 

I would need a little fast help :) I'm almost done with my mod, but I want to add a boomerang to him as a a starting weapon/item. Can someone please help me? I'm looking for tutorials, but I wasn't succesful in it yet.

 

Please :)

Link to comment
Share on other sites

http://forums.kleientertainment.com/topic/27341-tutorial-the-artists-guide-to-characteritem-modding/ has the answer of your problem.

 

We should now be able to debug spawn it. But we want our character to start with it! So let's add a little bit of code to our character's prefab .lua file. Just above the line "local fn = function(inst)" we need to add a new section, like so: ? 1 2 3 4 5 6 local start_inv = { "YOUR_ITEM", } local fn = function(inst) So it's now added to our start inventory. (We found out how to do this with some detective work, looking at how other characters add start inventories.) We must also change the last line, so the game knows to check the start inventory: ? 1 return MakePlayerCharacter("YOU", prefabs, assets, fn) Becomes: ? 1 return MakePlayerCharacter("YOU", prefabs, assets, fn, start_inv) And finally, we are done!
Link to comment
Share on other sites

If you want to just use the default boomerang, you can add to your character's prefab. (I hope this comes out right, I'm not sure how to post code, but it's not too much.):

local start_inv = {"boomerang"-- Custom starting items}

It would go under local prefabs = {}. You can just copy and paste it over your current local start_inv.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...