Cunning fox Posted June 29, 2017 Share Posted June 29, 2017 Hello! I'm trying to make a mod that'll start sand storm all over the world when some event is working. I cant find where's sandstorm code is and how can I start it, so I made my own. It works nicely, when it's not on dedicated server. But on dedicated server players slows down, changes their walk animations, but on the screen there's no any sand storm overlay. For overlay I used this: ThePlayer:PushEvent("sandstormlevel", {level = 7/7}) What should I do now? Thanks everybody for your help! 1 Link to comment Share on other sites More sharing options...
CarlZalph Posted June 29, 2017 Share Posted June 29, 2017 Client doesn't know about it, use a netvar on the server to let the client know that it should be displaying a sandstorm and then make it render on the client. Link to comment Share on other sites More sharing options...
Cunning fox Posted June 29, 2017 Author Share Posted June 29, 2017 21 minutes ago, CarlZalph said: Client doesn't know about it, use a netvar on the server to let the client know that it should be displaying a sandstorm and then make it render on the client. I never worked with netvars... Can you help me, or tell me how to use them, please? 1 Link to comment Share on other sites More sharing options...
Cunning fox Posted June 30, 2017 Author Share Posted June 30, 2017 17 hours ago, CarlZalph said: Client doesn't know about it, use a netvar on the server to let the client know that it should be displaying a sandstorm and then make it render on the client. Ok, I can give you some cool skins, if you'll help me! 1 Link to comment Share on other sites More sharing options...
CarlZalph Posted June 30, 2017 Share Posted June 30, 2017 (edited) 56 minutes ago, makar5000 said: Ok, I can give you some cool skins, if you'll help me! There's a thread on the forum here about netvars from a bit back: You'll want to use a "net_bool" since the state is a simple on/off. Check the files for net_bool to see how they use it, as well as Peter's post. It's an old post so formatting of the code has been lost, so add some newlines to make his code more legible. And keep your stuff matey. Edited June 30, 2017 by CarlZalph Link to comment Share on other sites More sharing options...
Serpens Posted July 1, 2017 Share Posted July 1, 2017 Example from my questmod. It is to change the text colour from talking pigking also for clients: local function OnDirtyEventQuestRGB(inst) -- function called for client, when rgb value is changed for a questgiver inst.components.talker.colour = GLOBAL.Vector3(inst["mynetvarQuestsR"]:value()/255, inst["mynetvarQuestsG"]:value()/255, inst["mynetvarQuestsB"]:value()/255) end AddPrefabPostInit("pigking",function(inst) inst["mynetvarQuestsR"] = GLOBAL.net_byte(inst.GUID, "QuestsRNetStuff", "DirtyEventQuestsR") inst["mynetvarQuestsR"]:set(255) inst["mynetvarQuestsG"] = GLOBAL.net_byte(inst.GUID, "QuestsGNetStuff", "DirtyEventQuestsG") inst["mynetvarQuestsG"]:set(255) inst["mynetvarQuestsB"] = GLOBAL.net_byte(inst.GUID, "QuestsBNetStuff", "DirtyEventQuestsB") inst["mynetvarQuestsB"]:set(255) inst:ListenForEvent("DirtyEventQuestsR", OnDirtyEventQuestRGB) inst:ListenForEvent("DirtyEventQuestsG", OnDirtyEventQuestRGB) inst:ListenForEvent("DirtyEventQuestsB", OnDirtyEventQuestRGB) end So when the server is somewhere now doing: inst["mynetvarQuestsB"]:set(100) to change this value, the value is also changed at client AND the OnDirtyEventQuestRGB function is called. With inst["mynetvarQuestsR"]:value() you can get the actual value. And of course you do not need 3 of them, only one. You can use any names you want, but see which ones are identical in my example. Instead of net_byte you use net_bool, as CarlZalph wrote. The value for this is only true and false, no numbers. This way you can start the sandstorm in the "OnDirty.." function if it is true, or stop it, if it is false. I think you should add the netvars to the players, so AddPlayerPostInit. Then "inst" is in your OnDirty function the player. I'm not 100% sure if you need to check if player is the server or not... depends on if sandstorm can be started twice, if you start it on server and addtionally on the player. 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