Revanchist Posted March 13, 2021 Share Posted March 13, 2021 (edited) Hi, i not really good know english but i try. I wanna do lightning strike for my character and i wrote this code. local function ThunderSpell(inst) if not (GLOBAL.TheWorld and GLOBAL.TheWorld.ismastersim) then return end local player=GLOBAL.ThePlayer local cheksan = player.components.sanity:GetPercent() if cheksan >= .25 then player.components.health.invincible = true local pt = GLOBAL.ConsoleWorldPosition() GLOBAL.TheWorld:PushEvent("ms_sendlightningstrike", pt) player.components.sanity:DoDelta(-50) inst.AnimState:PlayAnimation("punch") player.components.health.invincible = false else player.components.talker:Say("The Force is leaving me...") end end local hk_light = GLOBAL.KEY_C AddModRPCHandler(modname, "ThunderSpell", function(inst) ThunderSpell(inst) end) if hk_light then GLOBAL.TheInput:AddKeyDownHandler(hk_light, function() local player=GLOBAL.ThePlayer if player and player.prefab=="revan" and not GLOBAL.IsPaused() and not GLOBAL.TheInput:IsKeyDown(GLOBAL.KEY_CTRL) and not GLOBAL.TheInput:IsKeyDown(GLOBAL.KEY_SHIFT) and not (player.HUD:IsChatInputScreenOpen() or player.HUD:IsConsoleScreenOpen()) then SendModRPCToServer(MOD_RPC[modname]["ThunderSpell"]) end end) end So, its work perfect when i host but when i add cave my server stops after i press button I will be glad if you can help. Edited March 18, 2021 by Revanchist Link to comment Share on other sites More sharing options...
pickleplayer Posted March 15, 2021 Share Posted March 15, 2021 you'll probably need to take a look at the crash log, which is in a different place than the usual crash log if you're hosting a caves server. You can check under Documents/Klei/DoNotStarveTogether/(bunch of numbers)/Cluster_#/Master/server_log.txt Link to comment Share on other sites More sharing options...
Revanchist Posted March 15, 2021 Author Share Posted March 15, 2021 It seems he. [00:03:44]: [string "../mods/build 0.97/modmain.lua"]:172: attempt to index local 'player' (a nil value) LUA ERROR stack traceback: ../mods/build 0.97/modmain.lua:172 in (upvalue) ThunderSpell (Lua) <169-183> inst = 116491 - revan (valid:true) player = nil ../mods/build 0.97/modmain.lua:273 in () ? (Lua) <272-274> inst = 116491 - revan (valid:true) target = nil =[C]:-1 in (method) CallRPC (C) <-1--1> scripts/networkclientrpc.lua:1070 in (global) HandleRPCQueue (Lua) <1061-1106> i = 1 fn = function - ../mods/build 0.97/modmain.lua:272 sender = 116491 - revan (valid:true) data = table: 2CA56130 tick = true scripts/update.lua:46 in () ? (Lua) <33-134> dt = 0.016640100628138 [00:03:44]: [string "../mods/build 0.97/modmain.lua"]:172: attempt to index local 'player' (a nil value) LUA ERROR stack traceback: ../mods/build 0.97/modmain.lua:172 in (upvalue) ThunderSpell (Lua) <169-183> ../mods/build 0.97/modmain.lua:273 in () ? (Lua) <272-274> =[C]:-1 in (method) CallRPC (C) <-1--1> scripts/networkclientrpc.lua:1070 in (global) HandleRPCQueue (Lua) <1061-1106> scripts/update.lua:46 in () ? (Lua) <33-134> [00:03:44]: Warning: Widget:SetFocusFromChild is happening on a widget outside of the screen/widget hierachy. This will cause focus moves to fail. Is ScriptErrorWidget not a screen? [00:03:44]: stack traceback: scripts/widgets/widget.lua:604 in (method) SetFocusFromChild (Lua) <601-626> scripts/widgets/widget.lua:623 in (method) SetFocusFromChild (Lua) <601-626> scripts/widgets/widget.lua:623 in (method) SetFocusFromChild (Lua) <601-626> scripts/widgets/widget.lua:648 in (method) SetFocus (Lua) <628-657> scripts/widgets/menu.lua:83 in (method) SetFocus (Lua) <74-85> scripts/widgets/scripterrorwidget.lua:109 in (method) OnUpdate (Lua) <102-119> scripts/update.lua:95 in () ? (Lua) <33-134> server_log.txt 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