I'm having issues converting this cog to multiplayer. This is the cog that controls the moving catwalks inside the core of level 12 (escape with the map)
Here's the problem: only the host can activate the switches. (which require a key) if a client with a key activates it, and the host doesnt have a key, it will print out on the host computer that he needs a key. I 've made slight modifications, but it still doesn't work.
Here's the problem: only the host can activate the switches. (which require a key) if a client with a key activates it, and the host doesnt have a key, it will print out on the host computer that he needs a key. I 've made slight modifications, but it still doesn't work.
Code:
# Jedi Knight Cog Script
#
# 12_KeyedCatwalk.cog
#
# controls the rotating catwalks
#
# [IS/DB]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
#
symbols
message startup
message activated
message arrived
surface switch0a linkid=0
surface switch0b linkid=0
surface switch1a linkid=1
surface switch1b linkid=1
sound wav0=Activate02.wav local
sound cwalksnd=df_Door2-2.wav local
sound doorstop=df_Door2-3.wav local
int itemNum0=46
int itemNum1=48
int jkStringsNum0=262
int jkStringsNum1=264
thing catwalk linkid=2
thing player local
float moveSpeed=2.0
int direction=1 local
int startingUp=1 local
int channel=-1 local
int dummy=0 local
end
code
startup:
MoveToFrame(catwalk, 2, 20.0);
return;
activated:
player = GetSourceRef();
if ((GetSenderId() != 0) && (GetSenderId() != 1)) return;
if (GetWallCel(GetSenderRef()) == 1) return;
if (IsThingMoving(catwalk)) return;
if (GetInv(player, itemNum0[GetSenderId()]) <= 0.0) {
// print "no key" message
jkPrintUniString(GetPlayerNum(player), jkStringsNum0[GetSenderId()]);
return;
}
if (GetSenderId() == 0) {
if (GetCurFrame(catwalk) == 0) return;
direction = -1;
} else if (GetSenderId() == 1) {
if (GetCurFrame(catwalk) == 4) return;
direction = 1;
}
dummy=SetWallCel(switch0a, 1);
dummy=SetWallCel(switch0b, 1);
dummy=SetWallCel(switch1a, 1);
dummy=SetWallCel(switch1b, 1);
dummy=PlaySoundPos(wav0, SurfaceCenter(GetSenderRef()),0.6, 1, 3, 0);
MoveToFrame(catwalk, GetCurFrame(catwalk)+direction, moveSpeed);
channel=playsoundthing(cwalksnd, catwalk, 1.5, -1, -1, 1);
return;
arrived:
// hack to handle starting at frame 2, JumpToFrame(), working on arrived:'s, etc, etc.
if ((startingUp) && (GetCurFrame(catwalk) == 2)) {
startingUp = 0;
return;
}
if (startingUp) return;
if ((GetCurFrame(catwalk) == 0) || (GetCurFrame(catwalk) == 4)) {
dummy=SetWallCel(switch0a, 0);
dummy=SetWallCel(switch0b, 0);
dummy=SetWallCel(switch1a, 0);
dummy=SetWallCel(switch1b, 0);
if (channel != -1)
{
StopSound(channel,0.1);
channel= -1;
playsoundthing(doorstop, catwalk, 1.0, -1, -1, 0);
}
dummy=PlaySoundPos(wav0, SurfaceCenter(GetSenderRef()), 0.6, 1, 3, 0);
} else {
MoveToFrame(catwalk, GetCurFrame(catwalk)+direction, moveSpeed);
}
return;
end
