Sign in to follow this  
_Q_

Client Side Only

Recommended Posts

_Q_    644

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)

Share this post


Link to post
Share on other sites
ZupaleX    270

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...

Share this post


Link to post
Share on other sites
_Q_    644

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.

 

 

Share this post


Link to post
Share on other sites
ZupaleX    270

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 :-)

Share this post


Link to post
Share on other sites
_Q_    644

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.

 

Share this post


Link to post
Share on other sites
ZupaleX    270

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

Share this post


Link to post
Share on other sites
_Q_    644

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.

 

Share this post


Link to post
Share on other sites
ZupaleX    270

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

Share this post


Link to post
Share on other sites
_Q_    644

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.

 

Share this post


Link to post
Share on other sites
Maris    234

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

Share this post


Link to post
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
Sign in to follow this