BrotatoTips Posted December 30, 2014 Share Posted December 30, 2014 I wanted to make a mod that is nothing but an item. I have got this to work up to this point. what i need help with is how can i make it spawn in ALL characters inventories when a new game is started? Link to comment Share on other sites More sharing options...
Mobbstar Posted December 30, 2014 Share Posted December 30, 2014 http://forums.kleientertainment.com/topic/47318-how-to-because-this-does-nothing/?hl=starting_inventory#entry591354 XirmiX just gave up due to lacking skillz, can you understand my point there? Link to comment Share on other sites More sharing options...
BrotatoTips Posted December 30, 2014 Author Share Posted December 30, 2014 he gave up on it? you explained it pretty well from what i saw. i dont really understand tables very much, as i have yet to use one, but from what i read you gave him an exact answer with these right?if not GetPlayer().components.inventory.starting_inventory then --make a table if there isn't one GetPlayer().components.inventory.starting_inventory == {}endtable.insert(GetPlayer().components.inventory.starting_inventory,"flint") --add one flint Link to comment Share on other sites More sharing options...
Mobbstar Posted December 30, 2014 Share Posted December 30, 2014 he gave up on it? you explained it pretty well from what i saw. i dont really understand tables very much, as i have yet to use one, but from what i read you gave him an exact answer with these right?if not GetPlayer().components.inventory.starting_inventory then --make a table if there isn't one GetPlayer().components.inventory.starting_inventory == {}endtable.insert(GetPlayer().components.inventory.starting_inventory,"flint") --add one flintThat was my last idea, literally adding things to the existing starting inventory. I don't know whether this code runs before the starting inventory is given though. If you put this into modmain, make sure to use GLOBAL.GetPlayer() or declare local GetPlayer = GLOBAL.GetPlayer above! Link to comment Share on other sites More sharing options...
BrotatoTips Posted December 30, 2014 Author Share Posted December 30, 2014 While i was thinking about this, to me, it doesnt really matter whether it is spawned into a world when it is loaded, or if its in the inventory. you said it was character specific and im not sure where this is really handled. ill look into it and see what i can find. but it would be more aesthetic if it did spawn when the world is. i even took a bit of time to look at how creatures spawned, but i couldnt figure it out other than worldgen stuff. the code you have presented is usually what you write and what would require a bit more look, right? edit: i looked into the consolecommands.lua and was thinking about how the c_give command worked. couldnt i use something simular to this to give the item on spawn. have it like check for spawn character or something? or just modify part of the DebugSpawn command? Link to comment Share on other sites More sharing options...
Mobbstar Posted December 30, 2014 Share Posted December 30, 2014 While i was thinking about this, to me, it doesnt really matter whether it is spawned into a world when it is loaded, or if its in the inventory. you said it was character specific and im not sure where this is really handled. ill look into it and see what i can find. but it would be more aesthetic if it did spawn when the world is. i even took a bit of time to look at how creatures spawned, but i couldnt figure it out other than worldgen stuff. the code you have presented is usually what you write and what would require a bit more look, right? edit: i looked into the consolecommands.lua and was thinking about how the c_give command worked. couldnt i use something simular to this to give the item on spawn. have it like check for spawn character or something? or just modify part of the DebugSpawn command? You can give something to the player using the inventory component (I think it was something like GetPlayer().components.inventory:Give(SpawnPrefab(LOOT))) using SpawnPrefab(). You need to set position too, or else it's in the middle of the world. Other than that, I have no clue what your goal or idea is, so that's really up to you. Sorry. Link to comment Share on other sites More sharing options...
BrotatoTips Posted December 30, 2014 Author Share Posted December 30, 2014 hmm. ive tried each of these and i get the game to load, but i cant seem to get it to work in any form. honestly, all i am doing is wanting an item to only be available to the player at spawn. so if it were to spawn like the adventure mode spawns a winter hat during one of the adventure chapters would be enough for this to satisfy it. if it spawns in the inventory, or on the ground, thats fine. but making a table didnt work for me, nor did trying to use the inventory component or the player spawn handle thing. sadly, ill probably just upload it without this if i dont find a solution thanks for the help though, i at least understand tables a bit more, but still needs work on. your information and help was great Link to comment Share on other sites More sharing options...
Recommended Posts
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.