Cunning fox Posted August 15, 2017 Share Posted August 15, 2017 (edited) Hey everyone! I'm trying to add my own sg state to Wilson. It works nicely on non-dedicated servers but on dedicated servers something wrong becames with client side :/. So what am I trying to ask... How properly should I add state on client side? I've tried to add to client same state as on server, but it fixed nothing, only added problems. Any help? Edited August 15, 2017 by makar5000 1 Link to comment Share on other sites More sharing options...
Cunning fox Posted August 15, 2017 Author Share Posted August 15, 2017 (edited) My code: shadow_hands = State { name = "shadow_hands_teleport", tags = {"busy"}, onenter = function(inst) inst.AnimState:PlayAnimation("teleport") -- player won't cancel it if inst.components.locomotor ~= nil then inst.components.locomotor:StopMoving() end if inst.components.playercontroller ~= nil then inst.components.playercontroller:RemotePausePrediction() end if inst.components.health then inst.components.health:SetInvincible(true) end inst:ShowHUD(false) inst:SetCameraDistance(12) end, timeline = { TimeEvent(0, function(inst) inst.SoundEmitter:PlaySound("dontstarve/common/teleportato/teleportato_pulled") end), TimeEvent(82 * FRAMES, function(inst) inst.SoundEmitter:PlaySound("dontstarve/common/teleportato/teleportato_under") end), }, events = { EventHandler("animqueueover", function(inst) if inst.components.health then inst.components.health:SetInvincible(false) end inst:SnapCamera() inst:ScreenFade(true, 4) inst:Hide() inst.DynamicShadow:Enable(false) inst:DoTaskInTime(2.15,function() a,a1,a2 = inst.Transform:GetWorldPosition() local fx = SpawnPrefab("spawn_fx_small_high") fx.Transform:SetScale(2,2,2) fx.Transform:SetPosition(a,-4,a2) inst.sg:GoToState("wakeup") inst:Show() inst:ShowHUD(true) inst.DynamicShadow:Enable(true) inst:DoTaskInTime(.5,function() inst:SetCameraDistance() end) end) end), }, } AddStategraphState("wilson", shadow_hands) AddStategraphState("wilson_client", shadow_hands) Edited August 15, 2017 by makar5000 1 Link to comment Share on other sites More sharing options...
ZupaleX Posted August 16, 2017 Share Posted August 16, 2017 You cannot just add the same state to both server and client SG as some stuffs that you are trying to access on the server DG are not accessible on the client side (components.health for instance). So you have to rethink your state so it display the animation but doesn't perform the task which are the server's job. Link to comment Share on other sites More sharing options...
Cunning fox Posted August 16, 2017 Author Share Posted August 16, 2017 6 hours ago, ZupaleX said: You cannot just add the same state to both server and client SG as some stuffs that you are trying to access on the server DG are not accessible on the client side (components.health for instance). So you have to rethink your state so it display the animation but doesn't perform the task which are the server's job. Yeah, I came up with idea: I'l just coppy the same SG, and'll change some animations. 1 Link to comment Share on other sites More sharing options...
Cunning fox Posted August 16, 2017 Author Share Posted August 16, 2017 (edited) 7 hours ago, ZupaleX said: You cannot just add the same state to both server and client SG as some stuffs that you are trying to access on the server DG are not accessible on the client side (components.health for instance). So you have to rethink your state so it display the animation but doesn't perform the task which are the server's job. Oh, and I wanted to ask something. In SGwilson_client I found two new options: Ontimeout and onupdate. When do they trigger, and what they are suppose to do? Edited August 16, 2017 by makar5000 1 Link to comment Share on other sites More sharing options...
ZupaleX Posted August 17, 2017 Share Posted August 17, 2017 The game update the status of the entities periodically. The onupdate suggest that it is called when this update occurs. Some state can time out. Like if you are waiting for something to happen before executing a piece of code, but that something never happens. To prevent the code to hang there, you put a timeout. 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