Mertaan Posted February 15, 2015 Share Posted February 15, 2015 Hey guys, I made a character today, and it works perfectly when i run it in Host-mode. It has a multifunctional weapon that should be added to the inventory on spawn. But when i try the mod as a client, the character loads randomly in the world (even in de sea) and is not able to pick anything up and loses connection slightly after. I think its just a simple misplacement of my ismastersim and network stuff, however after looking at similar mods, i just can't get it to work. Any ideas? Any help would be super awesome Here is the script: -- In a prefab file, you need to list all the assets it requires.-- These can be either standard assets, or custom ones in your mod-- folder.local assets={ Asset("ANIM", "anim/rangersword.zip"), Asset("ANIM", "anim/swap_rangersword.zip"), Asset("ATLAS", "images/inventoryimages/rangersword.xml"), Asset("IMAGE", "images/inventoryimages/rangersword.tex"),}-- Write a local function that creats, customizes, and returns an instance of the prefab. local function OnEquip(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_rangersword", "swap_rangersword") 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 local function fn(Sim) local inst = CreateEntity() local trans = inst.entity:AddTransform() local anim = inst.entity:AddAnimState() -- inst.entity:AddSoundEmitter() MakeInventoryPhysics(inst) inst.entity:AddNetwork() inst.AnimState:SetBank("rangersword") inst.AnimState:SetBuild("rangersword") inst.AnimState:PlayAnimation("idle") inst:AddTag("sharp") -- inst.entity:AddLight() -- inst.Light:SetColour(220/255, 200/255, 155/255) if not TheWorld.ismastersim then return inst end --inst.entity:SetPristine() inst:AddComponent("inventoryitem") --inst.components.inventoryitem.imagename = "rangersword" inst.components.inventoryitem.atlasname = "images/inventoryimages/rangersword.xml" inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.HANDS inst.components.equippable:SetOnEquip( OnEquip ) inst.components.equippable:SetOnUnequip( OnUnequip ) inst:AddComponent("weapon") inst:AddComponent("tool") inst.components.tool:SetAction(ACTIONS.CHOP, 0.2) inst.components.tool:SetAction(ACTIONS.MINE, 0.1) inst.components.weapon:SetDamage(34) return instend-- Add some strings for this itemSTRINGS.NAMES.RANGERSWORD = "My sword"STRINGS.CHARACTERS.GENERIC.DESCRIBE.RANGERSWORD = "I have the Power!"return Prefab("common/inventory/rangersword", fn, assets, prefabs)and this currently gives me the error: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager.A previous error was about inst:22 Link to comment https://forums.kleientertainment.com/forums/topic/50976-little-help-needed-working-sp-mod-but-crashes-on-clientside/ Share on other sites More sharing options...
mikey99222 Posted February 15, 2015 Share Posted February 15, 2015 (edited) how can I delete a post? Edited February 15, 2015 by mikey99222 Link to comment https://forums.kleientertainment.com/forums/topic/50976-little-help-needed-working-sp-mod-but-crashes-on-clientside/#findComment-613347 Share on other sites More sharing options...
rezecib Posted February 16, 2015 Share Posted February 16, 2015 @Mertaan, Are you sure it's the weapon causing the problems? Nothing looks obviously wrong to me just glancing at it. Although the STRINGS stuff should be in your modmain, not in the prefab. You'll have to use GLOBAL.STRINGS there, though. Link to comment https://forums.kleientertainment.com/forums/topic/50976-little-help-needed-working-sp-mod-but-crashes-on-clientside/#findComment-613480 Share on other sites More sharing options...
Mertaan Posted February 16, 2015 Author Share Posted February 16, 2015 @Mertaan, Are you sure it's the weapon causing the problems? Nothing looks obviously wrong to me just glancing at it. Although the STRINGS stuff should be in your modmain, not in the prefab. You'll have to use GLOBAL.STRINGS there, though. I managed to fix it by removing those STRINGS earlier today and have been running it on a dedicated host without problems ever since. I'll try to add it with GLOBAL to the modmain later, thanks Link to comment https://forums.kleientertainment.com/forums/topic/50976-little-help-needed-working-sp-mod-but-crashes-on-clientside/#findComment-613491 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