I am an intermediate cogger, but I can pretty much solve most problems. But I need a way to have a key door which is synched in MP, cause SP key cogs are screwy in MP
Here's what Ive conjured:
SERVER COG:
CLIENT COG:
But it isnt working & Im stuck on it now. Ideas? Help?!
[This message has been edited by F-Body (edited June 14, 2004).]
Here's what Ive conjured:
SERVER COG:
Code:
# Jedi Knight Cog Script # # DoorKEY_Srv.cog # # This cog is not made or endorsed by LucasArts Entertainment Co. symbols thing door mask=0x405 int player local int doorID flex sleepTime=2.0 int doorSector local message activated message arrived message timer message blocked message startup end # ======================================================================================== code startup: doorSector = GetThingSector(door); SetSectorAdjoins(doorSector, 0); Return; # ........................................................................................ activated: door = GetSenderRef(); player = GetSourceRef(); SendTrigger(-1, 500000 + doorID, door, 4, doorSector, player); Return; # ........................................................................................ arrived: if(IsThingMoving(door)) Return; if(GetCurFrame(door) == 0) { SendTrigger(-1, 500000 + doorID, door, 3, doorSector, 0); } else { SetTimerEx(sleepTime, 2, 0, 0); } Return; # ........................................................................................ blocked: SendTrigger(-1, 500000 + doorID, door, 11, doorSector, 0); Return; # ........................................................................................ timer: if(GetSenderId() == 1) SetInvActivated(player, 46 + key, 0); else if(GetSenderId() == 2) SendTrigger(-1, 500000 + doorID, door, 2, doorSector, 0); Return; end
CLIENT COG:
Code:
# Jedi Knight Cog Script # # DoorKEY_Cli.cog # # Key Door Script, Client side # Use 0 in "key" for the Red Key (default), # 1 for Blue, and 2 for Yellow # # This cog is not made or endorsed by LucasArts Entertainment Co. flags=0x240 symbols int doorID sound locked_snd=i00ky73t.wav sound wav0=lvrclik2.wav int key=0 int playerguy local flex moveSpeed=1.0 flex lasttime=-1 local flex curtime=-1 local message trigger end # ======================================================================================== code trigger: playerguy = jkGetLocalPlayer(); if(GetSourceRef() != 500000 + doorID) Return; if(GetParam(1) == 1) { SetSectorAdjoins(GetParam(2), 1); MoveToFrame(GetParam(0), 1, moveSpeed); } else if(GetParam(1) == 11) { MoveToFrame(GetParam(0), 1, moveSpeed); } else if(GetParam(1) == 2) { MoveToFrame(GetParam(0), 0, moveSpeed); } else if(GetParam(1) == 3) { SetSectorAdjoins(GetThingSector(GetParam(0)), 0); } else if(GetParam(1) == 4) { if ((GetInv(GetParam(3), 46 + key) == 1.0) || (GetParam(3) != playerguy)) { if(IsThingMoving(GetParam(0))) Return; if(GetCurFrame(GetParam(0)) != 0) Return; if(GetCurFrame(GetParam(0)) == 0) { SetSectorAdjoins(GetParam(2), 1); SetInvActivated(GetParam(3), 46 + key, 1); SetTimerEx(2, 1, 0, 0); MoveToFrame(GetParam(0), 1, moveSpeed) } } else { PlaySoundThing(wav0, GetParam(0), 1.0, -1, -1, 0); curtime = GetLevelTime(); if( (lasttime == -1) || (curtime - lasttime > 3) ) { PlaySoundThing(locked_snd, GetParam(3), 1.0, -1, -1, 0); Print("You don't have the right key!"); lasttime = curtime; } } } Return; end
But it isnt working & Im stuck on it now. Ideas? Help?!
[This message has been edited by F-Body (edited June 14, 2004).]
This is retarded, and I mean drooling at the mouth