Jump to content

Mod spawning items for everyone.


Recommended Posts

I made a character mod where the character starts with chester. The problem is whenever I load a server with the mod it makes everyone spawn with chester. Does anyone know how to code to fix this?

 

maybe if you put him the bone in the spawn items .

 

Modmain.lua

 

prefabfiles:

 

PrefabFiles = {

    "eyebone",

}

 

 

character.lua:

 

-- Custom starting items

local start_inv = {

"eyebone",

}

Link to comment
Share on other sites

If you're referencing Personal Chester by the Creator Dragon Wolf Leo then you have to change the tags in modmain.

 

Inside the modmain:

local function PersonalChester(inst)	if not GLOBAL.TheWorld.ismastersim or inst:HasTag("specialchesterowner") then		return	end

Change it to:

local function PersonalChester(inst)    if not inst:HasTag("characterowner") then        return    end

change characterowner to whatever your charatcers name and then add the tag to your characters prefab:

local common_postinit = function(inst) 	-- Minimap icon	inst.MiniMapEntity:SetIcon( "character.tex" )	inst:AddTag("characterowner")end
Edited by rons0n
Link to comment
Share on other sites

@rons0n

 

If you're referencing Personal Chester by the Creator Dragon Wolf Leo then you have to change the tags in modmain.

 

Inside the modmain:

local function PersonalChester(inst)	if not GLOBAL.TheWorld.ismastersim or inst:HasTag("specialchesterowner") then		return	end

Change it to:

local function PersonalChester(inst)    if not inst:HasTag("characterowner") then        return    end

change characterowner to whatever your charatcers name and then add the tag to your characters prefab:

local common_postinit = function(inst) 	-- Minimap icon	inst.MiniMapEntity:SetIcon( "character.tex" )	inst:AddTag("characterowner")end

 

Thanks for the advice, it actually worked. However now I keep crashing with the following

[00:00:38]: [string "scripts/prefabs/player_common.lua"]:1336: bad argument #1 to 'ipairs' (table expected, got function)LUA ERROR stack traceback:    =[C]:-1 in (global) ipairs (C) <-1--1>    scripts/prefabs/player_common.lua:1336 in () ? (Lua) <1252-1653>    =(tail call):-1 in ()  (tail) <-1--1>    scripts/mainfunctions.lua:95 in (global) LoadPrefabFile (Lua) <87-107>    scripts/gamelogic.lua:196 in (upvalue) LoadAssets (Lua) <122-217>    scripts/gamelogic.lua:786 in () ? (Lua) <783-789>    =[C]:-1 in (method) SetPersistentString (C) <-1--1>    scripts/saveindex.lua:64 in (method) Save (Lua) <62-65>    scripts/saveindex.lua:196 in () ? (Lua) <191-197>    =[C]:-1 in (method) SerializeWorldSession (C) <-1--1>    scripts/networking.lua:148 in (global) SerializeWorldSession (Lua) <147-149>    scripts/saveindex.lua:199 in (method) OnGenerateNewWorld (Lua) <188-200>    scripts/gamelogic.lua:797 in (field) cb (Lua) <779-799>    scripts/screens/worldgenscreen.lua:173 in (local) cb (Lua) <172-174>    scripts/frontend.lua:523 in (method) DoFadingUpdate (Lua) <487-527>    scripts/frontend.lua:575 in (method) Update (Lua) <535-684>    scripts/update.lua:93 in () ? (Lua) <39-123>	[00:00:38]: SCRIPT ERROR! Showing error screen	

I've tried adding the following in various orders and using only one "nil" seemed to work somewhat, except that in using wolfgangs character base when he grows the character goes invisible and crashes (which worked prior to this event):

return MakePlayerCharacter("wolfgang", nil, assets, nil, master_init, common_postinit)

I appreciate the help. I've attached the file in case you'd be willing to further help :)

wolfgang.lua

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...