Jump to content

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
https://forums.kleientertainment.com/forums/topic/57847-client-side-only/
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.

 

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

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.

 

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.

 

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

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
×
  • Create New...