Jump to content

Client Side Only


_Q_
 Share

Recommended Posts

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

If you put

if not TheWorld.ismastersim thendoyourjobend

it 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

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 = OnGetItemModend

If 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

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 by ZupaleX
Link to comment
Share on other sites

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

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? :razz:

 

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

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 by Maris
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...