AyaDrevis Posted June 8, 2015 Share Posted June 8, 2015 I have a little problem with my Mod. Everytime somone else than the Host trys to Play my Mod, it displays this Message I allready tried anything to get rid of this, but no matter what i do, still comes back. im using the RoG addon. Can somebody help me please? Codes: Modmain: local require = GLOBAL.requirelocal Ingredient = GLOBAL.Ingredientlocal RECIPETABS = GLOBAL.RECIPETABSlocal STRINGS = GLOBAL.STRINGSlocal ACTIONS = GLOBAL.ACTIONSlocal Action = GLOBAL.Actionlocal resolvefilepath = GLOBAL.resolvefilepathlocal containers = require("containers")--local player_classified = require("player_classified")local oldwidgetsetup = containers.widgetsetupcontainers.widgetsetup = function(weapon, prefab) if not prefab and weapon.inst.prefab == "armor_spirit" then prefab = "armorwood" end oldwidgetsetup(weapon, prefab)endSTRINGS.CHARACTERS.GENERIC.DESCRIBE.KURUMI = ("She looks really creepy.")GLOBAL.STRINGS.NAMES.ARMOR_SPIRIT = "Elohim Heist"GLOBAL.STRINGS.RECIPE_DESC.ARMOR_SPIRIT = "Kurumi´s Spirit Armor"GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.ARMOR_SPIRIT = "For some reason i can't wear it."GLOBAL.STRINGS.NAMES.MUSKET = "Kurumi's musket"GLOBAL.STRINGS.RECIPE_DESC.MUSKET = "Kurumi's favorit weapon"GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSKET = "What a pretty looking Gun!"AddPrefabPostInit("forest", function(inst) if STRINGS.CHARACTERS.KURUMI thenSTRINGS.CHARACTERS.KURUMI.DESCRIBE.ARMOR_SPIRIT = "My Spirit Armor!"STRINGS.CHARACTERS.KURUMI.DESCRIBE.MUSKET = "My Favorite weapon!"endend)PrefabFiles = { "kurumi", "armor_spirit", "musket",}Assets = { Asset( "IMAGE", "images/saveslot_portraits/kurumi.tex" ), Asset( "ATLAS", "images/saveslot_portraits/kurumi.xml" ), Asset( "IMAGE", "images/selectscreen_portraits/kurumi.tex" ), Asset( "ATLAS", "images/selectscreen_portraits/kurumi.xml" ), Asset( "IMAGE", "images/selectscreen_portraits/kurumi_silho.tex" ), Asset( "ATLAS", "images/selectscreen_portraits/kurumi_silho.xml" ), Asset( "IMAGE", "bigportraits/kurumi.tex" ), Asset( "ATLAS", "bigportraits/kurumi.xml" ), Asset( "ATLAS", "images/kurumi.xml" ), Asset( "IMAGE", "images/kurumi.tex" ), Asset("SOUNDPACKAGE", "sound/kurumi.fev"), Asset("SOUND", "sound/kurumi.fsb"), Asset( "IMAGE", "images/avatars/avatar_kurumi.tex" ), Asset( "ATLAS", "images/avatars/avatar_kurumi.xml" ), Asset( "IMAGE", "images/avatars/avatar_ghost_kurumi.tex" ), Asset( "ATLAS", "images/avatars/avatar_ghost_kurumi.xml" ), Asset( "IMAGE", "images/inventoryimages/armor_spirit.tex" ), Asset( "ATLAS", "images/inventoryimages/armor_spirit.xml" ), Asset( "IMAGE", "minimap/kurumi.tex" ), Asset( "ATLAS", "minimap/kurumi.xml" ),}local require = GLOBAL.requireGLOBAL.STRINGS.CHARACTERS.KURUMI = require "speech_kurumi"--This is the character's title on the select screenSTRINGS.CHARACTER_TITLES.kurumi = "The Nightmare"--This is the character's nameSTRINGS.CHARACTER_NAMES.kurumi = "Kurumi"--This is the description on the selectscreen \n = start a new lineSTRINGS.CHARACTER_DESCRIPTIONS.kurumi = "*starts with her Spirit armor \n*Looses slowly Health, killing gives health back \n*professional at murdering"--this is the quote wilson's is "I will conquer it all with the power of my MIND!"STRINGS.CHARACTER_QUOTES.kurumi = "\"My, have you seen Shido?\""-- Let the game know kurumi is a male, for proper pronouns during the end-game sequence.-- Possible genders here are MALE, FEMALE, or ROBOTtable.insert(GLOBAL.CHARACTER_GENDERS.FEMALE, "kurumi")RemapSoundEvent( "dontstarve/characters/kurumi/death_voice", "kurumi/characters/kurumi/death_voice" )RemapSoundEvent( "dontstarve/characters/kurumi/hurt", "kurumi/characters/kurumi/hurt" )RemapSoundEvent( "dontstarve/characters/kurumi/talk_LP", "kurumi/characters/kurumi/talk_LP" )RemapSoundEvent( "dontstarve/characters/kurumi/emote", "kurumi/characters/kurumi/emote" )RemapSoundEvent( "dontstarve/characters/kurumi/ghost_LP", "kurumi/characters/kurumi/ghost_LP" )AddMinimapAtlas("minimap/kurumi.xml")AddMinimapAtlas("minimap/armor_spirit.xml")AddMinimapAtlas("minimap/musket.xml")GLOBAL.STRINGS.NAMES.kurumi = "Kurumi"AddModCharacter("kurumi")for k, v in pairs(CHARACTERLIST) do if v.prefab ~= "wilson" then AddPrefabPostInit(v, ModCharacterInit) endendfor k,v in pairs(GLOBAL.MODCHARACTERLIST) do AddPrefabPostInit(v, ModCharacterInit)endfunction InventoryItemReplicaPostInit(self) local getatlas = self.GetAtlas function GetAtlas(self) return self.atlasname or getatlas(self) end self.GetAtlas = GetAtlasendAddClassPostConstruct("components/inventoryitem_replica", InventoryItemReplicaPostInit)AddSimPostInit(armor_spirit)AddPrefabPostInit("armor_spirit")AddSimPostInit(musket)AddPrefabPostInit("musket") Kurumi ( Charakter): local MakePlayerCharacter = require "prefabs/player_common"local assets = { Asset( "ANIM", "anim/player_basic.zip" ), Asset( "ANIM", "anim/player_idles_shiver.zip" ), Asset( "ANIM", "anim/player_actions.zip" ), Asset( "ANIM", "anim/player_actions_axe.zip" ), Asset( "ANIM", "anim/player_actions_pickaxe.zip" ), Asset( "ANIM", "anim/player_actions_shovel.zip" ), Asset( "ANIM", "anim/player_actions_blowdart.zip" ), Asset( "ANIM", "anim/player_actions_eat.zip" ), Asset( "ANIM", "anim/player_actions_item.zip" ), Asset( "ANIM", "anim/player_actions_uniqueitem.zip" ), Asset( "ANIM", "anim/player_actions_bugnet.zip" ), Asset( "ANIM", "anim/player_actions_fishing.zip" ), Asset( "ANIM", "anim/player_actions_boomerang.zip" ), Asset( "ANIM", "anim/player_bush_hat.zip" ), Asset( "ANIM", "anim/player_attacks.zip" ), Asset( "ANIM", "anim/player_idles.zip" ), Asset( "ANIM", "anim/player_rebirth.zip" ), Asset( "ANIM", "anim/player_jump.zip" ), Asset( "ANIM", "anim/player_amulet_resurrect.zip" ), Asset( "ANIM", "anim/player_teleport.zip" ), Asset( "ANIM", "anim/wilson_fx.zip" ), Asset( "ANIM", "anim/player_one_man_band.zip" ), Asset( "ANIM", "anim/shadow_hands.zip" ), Asset( "SOUND", "sound/sfx.fsb" ), Asset( "SOUND", "sound/wilson.fsb" ), Asset( "ANIM", "anim/beard.zip" ), -- Don't forget to include your character's custom assets! Asset( "ANIM", "anim/kurumi.zip" ), Asset( "ANIM", "anim/kurumi_spirit.zip" ), Asset( "ANIM", "anim/ghost_kurumi_build.zip" ),}local prefabs = {"armor_spirit","musket","nightmarefuel",}--this is what your character starts withlocal start_inv = {"armor_spirit","musket","nightmarefuel","nightmarefuel","nightmarefuel","nightmarefuel","nightmarefuel",}local function common_postinit(inst) inst.avatar_tex = "avatar_kurumi.tex" inst.avatar_atlas = "images/avatars/avatar_kurumi.xml" inst.avatar_ghost_tex = "avatar_ghost_kurumi.tex" inst.avatar_ghost_atlas = "images/avatars/avatar_ghost_kurumi.xml"endlocal smallScale = 0.5local medScale = 0.7local largeScale = 1.1local function onkill(inst, data) if data.afflicter == inst and not data.inst:HasTag("veggie") and not data.inst:HasTag("structure") then inst.components.health:DoDelta(5) math.randomseed(os.time()) local temp = math.random(0, 20) if temp < 1 then inst.components.lootdropper:SpawnLootPrefab("nightmarefuel")----------LOOT DROPPER end endendlocal function fn() inst:AddComponent("sanityaura") inst.components.sanityaura.aura = 1.33/60 endlocal function master_postinit(inst) -- choose which sounds this character will play inst.soundsname = "kurumi" -- a minimap icon must be specified inst.MiniMapEntity:SetIcon( "kurumi.tex" ) -- todo: Add an example special power here. inst.components.health.maxhealth = 150 inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 1.2) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(200) inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1) inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1) inst.components.sanity.night_drain_mult = 0 inst.components.sanity.neg_aura_mult = 0 inst.components.health:StartRegen(-1 * 150 / 200, 15, false) inst:AddTag("KURUMI") inst.components.sanity.dapperness = 1.33/60 inst:AddComponent("sanityaura") inst.components.sanityaura.aura = 1.33/60 inst:AddComponent("lootdropper") inst:ListenForEvent("entity_death", function(wrld, data) onkill(inst, data) end, TheWorld) inst.strength = "normal"endreturn MakePlayerCharacter("kurumi", prefabs, assets, common_postinit, master_postinit, start_inv)[/spoiler] armor_spirit (Item): local assets ={ Asset("ANIM", "anim/armor_spirit.zip"), Asset( "IMAGE", "minimap/armor_spirit.tex" ), Asset( "ATLAS", "minimap/armor_spirit.xml" ), Asset("IMAGE", "images/inventoryimages/armor_spirit.tex"), Asset("ATLAS", "images/inventoryimages/armor_spirit.xml"), Asset( "ANIM", "anim/kurumi_spirit.zip" ),}local function onequip(inst, owner) if owner:HasTag("KURUMI") then if (owner.strength=="normal") then local damage_mult = 4 local health = 150 local hunger_rate = 1.5 local scale = 1 local speed = 1.2 owner.components.health.absorb = 0.50 owner.AnimState:SetBuild("kurumi_spirit") owner.strength="spirit" owner.Transform:SetScale(scale,scale,scale) owner.components.hunger:SetRate(hunger_rate*TUNING.WILSON_HUNGER_RATE) owner.components.combat.damagemultiplier = damage_mult owner.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * speed) owner.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * speed) owner.components.sanity.dapperness = -6.66/60 owner.components.sanityaura.aura = -6.66/60 --local health_percent = owner.components.health:GetPercent() --owner.components.health:SetMaxHealth(health_max) --owner.components.health:SetPercent(health_percent, true) end endendlocal function onunequip(inst, owner) if owner:HasTag("KURUMI") then if (owner.strength=="spirit") then local damage_mult = 0.5 local health = 150 local hunger_rate = 1 local scale = 1 local speed = 1.0 owner.components.health.absorb = 0 owner.AnimState:SetBuild("kurumi") owner.strength="normal" owner.Transform:SetScale(scale,scale,scale) owner.components.hunger:SetRate(hunger_rate*TUNING.WILSON_HUNGER_RATE) owner.components.combat.damagemultiplier = damage_mult owner.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * speed) owner.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * speed) owner.components.sanity.dapperness = 1.33/60 owner.components.sanityaura.aura = 1.33/60 end endendlocal function onload(inst, owner)--print(ThePlayer)--print(ThePlayer.replica.inventory:GetEquippedItem(EQUIPSLOTS.BODY))print(inst.components.equippable:IsEquipped())if inst.components.equippable:IsEquipped() then if owner:HasTag("KURUMI") then if (owner.strength=="normal") then local damage_mult = 4 inst:AddComponent("sanityaura") --local health_max = 150 local hunger_rate = 1.5 local health = 150 local scale = 1 local speed = 1.2 owner.components.health.absorb = 0.50 owner.AnimState:SetBuild("kurumi_spirit") owner.strength="spirit" owner.Transform:SetScale(scale,scale,scale) owner.components.hunger:SetRate(hunger_rate*TUNING.WILSON_HUNGER_RATE) owner.components.combat.damagemultiplier = damage_mult owner.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * speed) owner.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * speed) owner.components.sanity.dapperness = -6.66/60 owner.components.sanityaura.aura = -6.66/60 --local health_percent = owner.components.health:GetPercent() --owner.components.health:SetMaxHealth(health_max) --owner.components.health:SetPercent(health_percent, true) end endendendlocal function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddMiniMapEntity() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.foleysound = "dontstarve/movement/foley/logarmour" inst.AnimState:SetBank("backpack1") inst.AnimState:SetBuild("armor_spirit") inst.AnimState:PlayAnimation("anim") local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon("armor_spirit.tex") if not TheWorld.ismastersim then return inst end inst.entity:SetPristine() inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.BODY inst.replica.equippable.equipslot = EQUIPSLOTS.BODY inst.components.inventoryitem.keepondeath = true inst:AddComponent("inspectable") --inst.OnLoad = onload --inst.OnNewSpawn = onload inst.components.equippable:SetOnEquip(onequip) inst.components.equippable:SetOnUnequip(onunequip) MakeHauntableLaunch(inst) inst.components.inventoryitem.atlasname = "images/inventoryimages/armor_spirit.xml" inst.replica.inventoryitem.atlasname = "images/inventoryimages/armor_spirit.xml" return instendreturn Prefab("common/inventory/armor_spirit", fn, assets) musket (item): local assets={ Asset("ANIM", "anim/musket.zip"), Asset("ANIM", "anim/swap_musket.zip"), Asset("ATLAS", "images/inventoryimages/musket.xml"), Asset("IMAGE", "images/inventoryimages/musket.tex"),}local prefabs = {"nightmarefuel",}local function onattack(inst, attacker, target) inst.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") if inst.components.container:Has("nightmarefuel", 1) then inst.components.container:ConsumeByName("nightmarefuel", 1) end if inst.components.container:IsEmpty() then if attacker.sg and not attacker.sg:HasStateTag("busy") then attacker.AnimState:PlayAnimation("give") end inst:DoTaskInTime(0.5, function() if attacker.components.inventory:Has("nightmarefuel", 1) then inst.SoundEmitter:PlaySound("dontstarve/common/minerhatAddFuel") attacker.components.inventory:ConsumeByName("nightmarefuel", 1) inst.components.container:GiveItem(SpawnPrefab("nightmarefuel")) end end)endendlocal function onopen(inst) inst.SoundEmitter:PlaySound("dontstarve/wilson/backpack_open", "open")endlocal function onclose(inst) inst.SoundEmitter:PlaySound("dontstarve/wilson/backpack_close", "open")endlocal function itemtest(inst, item, slot) return item.prefab == "nightmarefuel" endlocal slotpos = {}for y = 0, .5 do --table.insert(slotpos, Vector3(-162, -y*75 + 114 ,0)) table.insert(slotpos, Vector3(-162 -448, -y*75 + 85 ,0))endlocal function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() MakeInventoryPhysics(inst) inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddNetwork() inst.AnimState:SetBank("gandr") inst.AnimState:SetBuild("musket") inst.AnimState:PlayAnimation("idle") inst:AddComponent("container") inst.components.container.itemtestfn = itemtest inst.components.container:SetNumSlots(#slotpos) inst.components.container.widgetslotpos = slotpos inst.components.container.widgetpos = Vector3(0,-376,100) inst.components.container.side_widget = true inst.components.container.type = "equippable" inst.components.container.onopenfn = onopen inst.components.container.onclosefn = onclose inst.components.container:WidgetSetup("backpack") if not TheWorld.ismastersim then return inst end local function OnEquip(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_musket", "swap_gandr") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") end local function OnUnequip(inst, owner) owner.AnimState:Hide("ARM_carry") owner.AnimState:Show("ARM_normal") end inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "musket" inst.components.inventoryitem.atlasname = "images/inventoryimages/musket.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip( OnEquip ) inst.components.equippable:SetOnUnequip( OnUnequip ) inst.components.inventoryitem.keepondeath = true inst:AddComponent("inspectable") inst:AddTag("shadow") inst:AddComponent("weapon") inst.components.weapon:SetDamage(40) inst.components.weapon:SetOnAttack(onattack) inst.components.weapon:SetRange(10, 12) inst.components.weapon:SetProjectile("fire_projectile") inst:DoPeriodicTask(.5, function() if inst.components.equippable.isequipped then local owner = inst.components.inventoryitem.owner if not inst.components.container:Has("nightmarefuel", 1) then if inst.components.weapon then inst:RemoveComponent("weapon") owner.components.talker:Say("My, i need to reload my weapon!") end else if not inst.components.weapon then inst:AddComponent("weapon") inst.components.weapon:SetDamage(40) inst.components.weapon:SetRange(10, 12) inst.components.weapon:SetOnAttack(onattack) inst.components.weapon:SetProjectile("fire_projectile") end end end end) return inst end return Prefab("common/inventory/musket", fn, assets) Link to comment Share on other sites More sharing options...
Developer PeterA Posted June 8, 2015 Developer Share Posted June 8, 2015 @AyaDrevis, is your mod on the Steam Workshop already? Are you able to use your mod as a client on the same machine that is okay with using it as a host? Link to comment Share on other sites More sharing options...
DarkXero Posted June 9, 2015 Share Posted June 9, 2015 This is a complete mess of bloated code. I'm surprised it works as a host. If I had to guess, the crash is due to the container component added in the client side. Also yeah, you should post a zip. Link to comment Share on other sites More sharing options...
AyaDrevis Posted June 9, 2015 Author Share Posted June 9, 2015 @PeterA Well, i tried my other mod, and it worked fine. The same with mods i downloaded on Steam Workshop. I even deactivaded all the other mods to make sure it wasnt the fault of an other mod. Also my friend created a server to make sure that only the host can choose this character. It simply crashes to everyone, who tries to choose this character with that error message except for the host. But anything else works like it should and no problem occour by the other players when the host plays this character. The strange thing is that the non-RoG Version of this Mod has an almost identical script, but no problem ocours here. Yes, i already uploaded this mod to Steam Workshop. I wasnt aware of this Glitch until recently. RoG-Version: http://steamcommunity.com/sharedfiles/filedetails/?id=432373302 Normal version: http://steamcommunity.com/sharedfiles/filedetails/?id=403023416 I would like to Post a .zip here, but i dont know how to do that. Link to comment Share on other sites More sharing options...
Developer PeterA Posted June 9, 2015 Developer Share Posted June 9, 2015 @AyaDrevis, you don't need to have two versions of the mod. Reign of Giants has been included in everyone's version of Don't Starve Together now, so that should simplify things a bit.It looks like the actual error you're hitting is [00:01:30]: [string "scripts/components/container.lua"]:4: attempt to index field 'container' (a nil value)LUA ERROR stack traceback:scripts/components/container.lua:4 in (field) ? (Lua) <3-5> self = inst = 100584 - (valid:true) numslots = 0 slots = table: 1EE8F258 _ = table: 1EE8F1B8 canbeopened = truescripts/class.lua:30 in () ? (Lua) <23-32> t = table: 1EE8F190 k = canbeopened v = true p = table: 1EE8F1E0 old = nilscripts/components/container.lua:15 in (field) _ctor (Lua) <11-25> self = inst = 100584 - (valid:true) numslots = 0 slots = table: 1EE8F258 _ = table: 1EE8F1B8 inst = 100584 - (valid:true)scripts/class.lua:181 in (local) cmp (Lua) <171-184> class_tbl = table: 1EE8E678 arg = nil obj = table: 1EE8F190scripts/entityscript.lua:512 in (method) AddComponent (Lua) <501-523> self (valid:true) = GUID = 100584 Transform = Transform (2D77C120) inlimbo = false actionreplica = table: 1EE8D250 event_listening = table: 1EE8D4F8 actioncomponents = table: 1EE8D098 lower_components_shadow = table: 1EE8D048 entity = Entity (1F4F09A0) AnimState = AnimState (2D77C140) Network = Network (2D77C1A0) Physics = Physics (2D77C100) SoundEmitter = SoundEmitter (2D77C160) spawntime = 34.333335123956 replica = table: 1EE8D0C0 persists = true components = table: 1EE8D070 event_listeners = table: 1EE8D430 name = container lower_name = container cmp = table: 1EE8E678../mods/workshop-403023416/scripts/prefabs/musket.lua:70 in (field) fn (Lua) <54-140> inst = 100584 - (valid:true)scripts/mainfunctions.lua:148 in () ? (Lua) <137-168> name = musket prefab = Prefab musket - I believe the issue is that you're trying to add the container component before the "if not TheWorld.ismastersim then", if you look at the cases where the container component is used int he game, it's only ever used on the host, and not the clients. Try moving it after the if check. Good luck! Link to comment Share on other sites More sharing options...
AyaDrevis Posted June 10, 2015 Author Share Posted June 10, 2015 @PeterA Ah i see...that would be kinda difficult to be fixed But anyway...Thanks for your help! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now