_Q_ Posted September 14, 2015 Share Posted September 14, 2015 So anyone know how to do something like, but for clients only?function birdcagePrefabPostInit(inst) if inst and inst.components.trader then inst.components.trader.onaccept = OnGetItemMod end if inst and inst.components.occupiable then inst.components.occupiable.onoccupied = OnOccupied inst.components.occupiable.onperishfn = OnBirdStarve end if inst and inst.components.occupiable then inst.components.occupiable.onemptied = OnEmptied end endAddPrefabPostInit("birdcage", birdcagePrefabPostInit) Link to comment Share on other sites More sharing options...
ZupaleX Posted September 14, 2015 Share Posted September 14, 2015 If you putif not TheWorld.ismastersim thendoyourjobendit will be executed only for clients. Don't know if that's what you were asking though... Link to comment Share on other sites More sharing options...
_Q_ Posted September 14, 2015 Author Share Posted September 14, 2015 If you putif not TheWorld.ismastersim thendoyourjobendit will be executed only for clients. Don't know if that's what you were asking though...Well the componets calls will be all nil and crash the game. Link to comment Share on other sites More sharing options...
ZupaleX Posted September 14, 2015 Share Posted September 14, 2015 Ok but it was not really clear what you want to do. Could you develop a bit? I don't understand why you need to call the birdcage stuff for the client only. With some enlightment I may be able to help Link to comment Share on other sites More sharing options...
_Q_ Posted September 14, 2015 Author Share Posted September 14, 2015 Ok but it was not really clear what you want to do. Could you develop a bit? I don't understand why you need to call the birdcage stuff for the client only. With some enlightment I may be able to help Its not about birdcage, its general thing.I want to edit some of the functions that object uses but only on client side. Like here:if inst and inst.components.trader then inst.components.trader.onaccept = OnGetItemModendIf that happens then modded function is used instead of normal one.But there is no way to access components on client side so I can't do something like that to edit functions for clients only. Link to comment Share on other sites More sharing options...
ZupaleX Posted September 14, 2015 Share Posted September 14, 2015 (edited) You could try to use net variables if the function return something. How would you like to modify this onaccept function? You have the function you want to use for the host and the one (different) for the client? Edited September 14, 2015 by ZupaleX Link to comment Share on other sites More sharing options...
_Q_ Posted September 15, 2015 Author Share Posted September 15, 2015 You could try to use net variables if the function return something. How would you like to modify this onaccept function? You have the function you want to use for the host and the one (different) for the client?Its just for people that join servers without the mods they like, so they still could join and have that functionality even if the server don't have any mods installed. Link to comment Share on other sites More sharing options...
ZupaleX Posted September 15, 2015 Share Posted September 15, 2015 Hmmm that's quite tricky and questionnable. But could be done with net variables and RCP in some extent.I will ask again : any function that you would like to be executed client only so I could try to see what could be done? Link to comment Share on other sites More sharing options...
_Q_ Posted September 15, 2015 Author Share Posted September 15, 2015 Hmmm that's quite tricky and questionnable. But could be done with net variables and RCP in some extent.I will ask again : any function that you would like to be executed client only so I could try to see what could be done? I just wanted some general idea on how to do it, I will check RPC and net variables now.Thanks. Link to comment Share on other sites More sharing options...
Maris Posted September 15, 2015 Share Posted September 15, 2015 (edited) This is part of my mod.if TheNet:GetIsServer() then q.SERVER_SIDE = true if TheNet:GetServerIsDedicated() then q.DEDICATED_SIDE = true else q.CLIENT_SIDE = true --Solved problem with "ismastersim". endelseif TheNet:GetIsClient() then q.SERVER_SIDE = false q.CLIENT_SIDE = true q.ONLY_CLIENT_SIDE = trueend Edited September 15, 2015 by Maris Link to comment Share on other sites More sharing options...
ZupaleX Posted September 15, 2015 Share Posted September 15, 2015 So what? That's not really the issue here as stated in post #3 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