#Ability Time lasts a different amount of time host vs client

16 messages · Page 1 of 1 (latest)

lilac sapphire
#

I have ability scripts that last a different amount of time on host vs client. A speedboost or block lasts 1/2 the time on client, vs the full time on host. Attached script is an ability example.

Script: https://pastie.io/osnmsy.cs

#

Ability Time lasts a different amount of time host vs client

dapper widget
#

your times are only decreased via a command to the server?

lilac sapphire
#

yes. only thing that touches duration is the 1 command. Debugs show that the duration is correctly firing for both client and host, but the actual affect only last half the time on the cleint.

dapper widget
#

question is why is it only on a command, it means if the client does not send anything command to the server, the server does not calculate any cooldown

lilac sapphire
#

the command calcs cooldown, but i just realized.... the command sends every frame, which is terrible logic

dapper widget
#

and if it's in a command, how does the client calculate its own cooldown?

lilac sapphire
#

cooldown time is syncvar

dapper widget
#

I am not sure why the cooldown time is 1/2 the time on the client.

#

But maybe you should not syncar the cooldown/active times

#

make these all server only context

#

and make the ability state a sycvar instead

#

and do the timechecks in update() which should be a servercallback or if (isServer) CheckTimes()

lilac sapphire
#

it's not the cooldown time thats half, but the ability affect that's half.

switching to server only is something i need to add though for sure

lilac sapphire
#

Issue was handling all logic through a command firing from client every frame. switched to server only and runs fine

dapper widget
#

ok, so the ability still has a problem? or...