View Full Version : Local NPC clientside/serverside interaction

08-09-2007, 02:54 PM
I have a bomb script I'm messing around with. Problem is, the deleting of it needs to be done on the serverside so it'll delete for everyone. But, the graphical aspect needs to be done on the clientside. The problem I'm having is at the explosion(done on the serverside), I need to trigger something on the clientside. I can't set two timers at the start on both the clientside and serverside because of lag issues and such, and they wouldn't be synced. So any idea how to fix this?

08-09-2007, 02:58 PM
Are you using a class?

08-09-2007, 03:00 PM

08-09-2007, 03:02 PM
As in 'Graphical Aspect' you mean making it flashy and stuff like that, or just displaying the image?
setimg() works fine on serverside, you could make the bomb all serverside

08-09-2007, 03:23 PM
I mean stuff like setfocus and such.

08-09-2007, 03:42 PM
hmm, I don't see why you need two timers?

I don't think you need any timers :O
just schedule an event on the client, and when it catches the ecent, trigger to the serverside to show exploding and such, then destroy the bomb :o

08-09-2007, 04:24 PM
You can use timevar3 to sync timers.

08-09-2007, 07:18 PM
Aren't GAni attributes synchronized between the server and all clients that have it loaded? Could that not be used?

08-09-2007, 08:29 PM
It's not really about syncing two things(I never said I needed to set two timers, I said I didn't want to), it's about being able to trigger the clientside right before it's destroyed on the serverside. I have a bomb that needs to be destroyed on the serverside, but I need to do some clientside stuff as soon as it's destroyed.
I could use some sort of 'global' timer to compare the clientside and serverside, but that would require checking them in a loop. :(
PS. Timevar3, as far as I know, isn't released on GS2 yet.

08-09-2007, 08:48 PM
You could use a loop in the gani script which checks for another attr[] which is set on serverside short before it is destroyed.
You can also visually destroy the bomb but not remove the bomb immediatelly - just make it non-blocking and set the attr[2] to some value, then the gani script in attr[1] is displaying some nice explosion or so and two seconds later you then remove the npc (on serverside).

08-09-2007, 09:00 PM
Hmmm, the hiding of the bomb would actually probably work. Great idea! :)