Hi!
I'm having problems in syncing some effects in MP.
Starting off with:
I have this Arena that I've been working on, and I wish to, with a button press, change the load between 3 options: Full, Empty, or random. Problem lies in the random. How do I sync the number of objects. Please make sure that even the clients may press the buttons.
Please forgive any eccessive code, but it is good for effect.
Next is 2 codes, interacting with each other. One, is a light cog in which to light the arena. Next is the flicker cog for making the light show no matter in what sector you are looking at. I modified the cog a bit so it would show the light, given to the ghost positions from the previous cog. Now, server went and turned off these lights, but the client still saw the place in full light. Could anyone help here?
So, please help?
/Edward
I'm having problems in syncing some effects in MP.
Starting off with:
I have this Arena that I've been working on, and I wish to, with a button press, change the load between 3 options: Full, Empty, or random. Problem lies in the random. How do I sync the number of objects. Please make sure that even the clients may press the buttons.
Code:
# What is the load in the arena. # How many objects. # Can't set number. Only Full, Empty, or Random # # By Edward symbols message startup message activated sector arena0 sector arena1 sector arena2 sector arena3 sector arena4 sector arena5 sector arena6 sector arena7 sector arena8 sector arena9 sector arena10 sector arena11 sector arena12 sector arena13 sector arena14 sector arena15 thing i local int j local material a material b surface full surface random surface empty sound on sound off sound alert int l=0 local int r local end # code startup: SetWallCel(full,15); SetSurfaceMat(random,a); SetWallCel(random,0); SetWallCel(empty,0); l=0; return; activated: if(l!=0) return; l=1; if(GetSenderRef()==full) { if(GetWallCel(full)==0) PlaySoundPos(alert, GetSectorCenter(arena0[rand()*15]), 1, -1, 200, 0x0); if(GetSurfaceMat(random)==b) { PlaySoundPos(off, GetSurfaceCenter(random), 1, -1, -1, 0x0); SurfaceAnim(random, 16, 0x0); sleep(1); SetSurfaceMat(random, a); SetWallCel(random, 15); for(r=15; r>=0; r=r-1) { SetWallCel(random, r); sleep(0.05); } } if(GetWallCel(full)==0) { PlaySoundPos(on, GetSurfaceCenter(full), 1, -1, -1, 0x0); SurfaceAnim(full,16,0x0); } if(GetWallCel(empty)==15) { PlaySoundPos(off, GetSurfaceCenter(empty), 1, -1, -1, 0x0); for(r=15; r>=0; r=r-1) { SetWallCel(empty, r); sleep(0.05); } } for(j=0; j<16; j=j+1) { i=FirstThingInSector(arena0[j]); while(i!=-1) { if(GetThingType(i)==7) { ClearThingFlags(i, 0x10); SetCollideType(i, 3); } i=NextThingInSector(i); } } } else if(GetSenderRef()==random) { PlaySoundPos(alert, GetSectorCenter(arena0[rand()*15]), 1, -1, 200, 0x0); if(GetSurfaceMat(random)==b) { PlaySoundPos(off, GetSurfaceCenter(random), 1, -1, -1, 0x0); SurfaceAnim(random, 16, 0x0); sleep(1); } else { if(GetWallCel(full)==15) { PlaySoundPos(off, GetSurfaceCenter(full), 1, -1, -1, 0x0); for(r=15; r>=0; r=r-1) { SetWallCel(full, r); sleep(0.05); } } if(GetWallCel(empty)==15) { PlaySoundPos(off, GetSurfaceCenter(empty), 1, -1, -1, 0x0); for(r=15; r>=0; r=r-1) { SetWallCel(empty, r); sleep(0.05); } } SurfaceAnim(random, 16, 0x0); sleep(1); SetSurfaceMat(random, b); SetWallCel(random, 15); } PlaySoundPos(on, GetSurfaceCenter(random), 1, -1, -1, 0x0); for(r=15; r>=0; r=r-1) { SetWallCel(random, r); sleep(0.05); } for(j=0; j<16; j=j+1) { i=FirstThingInSector(arena0[j]); while(i!=-1) { if(rand()>.5) { if(GetThingType(i)==7) { SetThingFlags(i, 0x10); SetCollideType(i, 0); } } else { if(GetThingType(i)==7) { ClearThingFlags(i, 0x10); SetCollideType(i, 3); } } i=NextThingInSector(i); } } } else if(GetSenderRef()==empty) { if(GetWallCel(empty)==0) PlaySoundPos(alert, GetSectorCenter(arena0[rand()*15]), 1, -1, 200, 0x0); if(GetSurfaceMat(random)==b) { PlaySoundPos(off, GetSurfaceCenter(random), 1, -1, -1, 0x0); SurfaceAnim(random, 16, 0x0); sleep(1); SetSurfaceMat(random, a); SetWallCel(random, 15); for(r=15; r>=0; r=r-1) { SetWallCel(random, r); sleep(0.05); } } if(GetWallCel(full)==15) { PlaySoundPos(off, GetSurfaceCenter(full), 1, -1, -1, 0x0); for(r=15; r>=0; r=r-1) { SetWallCel(full, r); sleep(0.05); } } if(GetWallCel(empty)==0) { PlaySoundPos(on, GetSurfaceCenter(empty), 1, -1, -1, 0x0); SurfaceAnim(empty, 16, 0x0); } for(j=0; j<16; j=j+1) { i=FirstThingInSector(arena0[j]); while(i!=-1) { if(GetThingType(i)==7) { SetThingFlags(i, 0x10); SetCollideType(i, 0); } i=NextThingInSector(i); } } } l=0; return; end
Please forgive any eccessive code, but it is good for effect.
Next is 2 codes, interacting with each other. One, is a light cog in which to light the arena. Next is the flicker cog for making the light show no matter in what sector you are looking at. I modified the cog a bit so it would show the light, given to the ghost positions from the previous cog. Now, server went and turned off these lights, but the client still saw the place in full light. Could anyone help here?
Code:
# Environment # # By Edward symbols message startup message activated message arrived thing skylight0 thing skylight1 thing skylight2 thing skylight3 thing skylight4 thing skylight5 thing skylight6 thing skylight7 thing skylight8 thing skylight9 surface lights surface lightmove flex lightamount surface rusty surface metal surface wood surface rock int l=1 local int lm=0 local int i local end # code startup: sleep(0.2); for(i=0; i<10; i=i+1) ThingLight(skylight0, lightamount, 0); return; activated: if(GetSenderRef()==lights) { if(l==1) { l=2; SetWallCel(lights, 1); for(i=0; i<10; i=i+1) ThingLight(skylight0, 0, 0); l=0; } else if(l==0) { l=3; SetWallCel(lights, 0); for(i=0; i<10; i=i+1) ThingLight(skylight0, lightamount, 0); l=1; } } else if(GetSenderRef()==lightmove) { if(lm==0) { SetWallCel(lightmove, 1); for(i=0; i<10; i=i+1) MoveToFrame(skylight0, 4, 1); lm=1; } else if(lm==1) { SetWallCel(lightmove, 0); for(i=0; i<10; i=i+1) StopThing(skylight0); lm=0; } } return; arrived: If(GetSenderRef()==skylight0) { for(i=0; i<10; i=i+1) SkipToFrame(skylight0, 0, 100); WaitForStop(skylight0); for(i=0; i<10; i=i+1) MoveToFrame(skylight0, 4, 1); } return; end
Code:
# "Ode to Suzanne" # # Dynamic lighting controller # # 12/2002 - 07/2004 gbk flags=0x240 Symbols Message Startup Message Newplayer Message Pulse Thing Ghost0 #Position for each light. Thing Ghost1 Thing Ghost2 Thing Ghost3 Thing Ghost4 Thing Ghost5 Thing Ghost6 Thing Ghost7 Thing Ghost8 Thing Ghost9 Int Used #number of used lights. (ID of last used) Template L #Actual light template, eg. "Light1.0" Thing LL0=-1 Local Thing LL1=-1 Local Thing LL2=-1 Local Thing LL3=-1 Local Thing LL4=-1 Local Thing LL5=-1 Local Thing LL6=-1 Local Thing LL7=-1 Local Thing LL8=-1 Local Thing LL9=-1 Local Thing Player Local Sector Player_sec Local Flex Rate=0.1 #Rate of replacement. Int I=0 Local End Code Startup: Player = jkGetLocalPlayer(); SetPulse(Rate); Stop; Newplayer: Player = Getsenderref(); Setpulse(Rate); Stop; Pulse: Player_sec = Getthingsector(Player); For(I=0;I<=Used;I=I+1) { If(LL0 != -1) Destroything(LL0); LL0 = Createthingatpos(L, Player_sec, Getthingpos(Ghost0), '0 0 0'); If(LL0 == -1) Print("Light creation failure!"); else SetThingLight(LL0, GetThingLight(Ghost0), 0); } Stop; End
So, please help?
/Edward