home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Classic Fond 52
/
ClassicFond52.iso
/
GAMES
/
DROIDW.RAR
/
DWCD.GOB
/
mission_cog_03_counterweight.cog
< prev
next >
Wrap
Text File
|
1998-11-04
|
10KB
|
377 lines
# Droids COG Script
#
# 03_Counterweight.cog
#
# Desc:
# This behemoth is the counterweight puzzle. Do not taunt it.
#
# 10/14/97 [DGS] Created
# 12/01/97 [DGS] Updated to take droid's actual weight.
# 2/11/98 [JP] Modified for the Moisture Farm C/W
# ========================================================================================
symbols
message crossed
message activate
message arrived
message timer
message pulse
message startup
message entered
message user5 #message from rdroid that he's on the startsector
surface add_sand linkid=8
surface rem_sand linkid=9
surface led_ones nolink
surface led_tens nolink
surface led_hund nolink
surface release_brake linkid=10
cog sander
cog Rdroid
thing wdud2
thing elevator linkid=1
thing wdud
thing Repairdroid linkid=2
thing counterweight linkid=3
thing brake linkid=6
thing line0start
thing line0end
thing line1start
thing line1end
thing line2start
thing line2end
thing line3start
thing line3end
sector reset_puzzle linkid=11
flex start_wait=0.25 local
flex sleeptime=2.0 local
flex c_weight=10.0 local
flex c_dest=10.0 local
flex sand_inc=5.0 local
flex gravity=12.0 local
flex speed=4.0 local
int c_crate=0 local
int step=10 local
int l_color=111 local
flex L_size=0.01 local
flex droidweight=10.0 local
sound wav0=Activate02.wav local
sound switch
sound switchmax
sound release
sound elevmove
sound elevstart
sound elevstop
surface a1
surface a2
surface a3
surface a4
surface a5
surface a6
surface a7
surface a8
surface a9
surface a10
surface a11
surface a12
surface a13
cog rdroid2
sound est=elvt7bigelevst.wav local
sound esp=elvt7bigelevstp.wav local
end
# ========================================================================================
code
startup:
addbeam(line0start,line0end,l_color,l_size);
addbeam(line1start,line1end,l_color,l_size);
addbeam(line2start,line2end,l_color,l_size);
addbeam(line3start,line3end,l_color,l_size);
Rdroid_on=0;
attachthingtothing(line0start,elevator);
attachthingtothing(line1start,elevator);
attachthingtothing(brake,elevator);
attachthingtothing(line2start,counterweight);
attachthingtothing(line3start,counterweight);
droidweight = GetThingMass(GetLocalPlayerThing()) / 2.2; // Get the player's weight
//c_weight = (droidweight) + ((rand()*20)-10); // Set th e counterweight to something near the players weight
//c_weight = (droidweight); // Set the counterweight to something near the players weight
// ++++++++++++++++++++++++++++++ These lines set the counterweight to a specific number
if (Rdroid_on == 0) //++++++++++++++++++ Rdroid is not on...
{
c_weight = (290);
c_crate = 0;
//destroything(cube);
}
//else if (getdifficulty() == 1) //++++++++++++++++++ EASY
//{
// c_weight = (230);
// c_crate = 175;
//destroything(cube);
//}
else if (Rdroid_on == 1) //++++++++++++++++++ EASY
{
c_weight = (290);
c_crate = 175;
//attachthingtothing(cube,elevator);
}
c_weight = c_weight - (c_weight % 10); // Rounds the weight to a 10
call displayweight;
return;
crossed: // If player crosses adjoin(s)
return;
user5:
print("user5");
//if (getthingsector(Repairdroid)==startsector);
Rdroid_on=1;
c_crate = 175;
return;
# ........................................................................................
activate:
print("Cweight: Activated");
printint(getsenderid());
printint(getsenderref());
printint(add_sand);
if (GetSenderId() == 10) // message came from release_brake
{
//--------------------------------------------- RELEASE THE BRAKE
if (GetWallCel(release_brake) == 1) return; //exit if the button is down already
SetWallCel(release_brake, 1);
call adjoinon; //makes it impossible to get off elevator
//dwdisablejump();
PlaySoundPos(release, SurfaceCenter(release_brake), 1.0, -1, -1, 0); //changed wav0 to release A
//move=(elevmove, elevator, 1, -1, -1, 0x1);
if ((droidweight + c_crate) < (c_weight)) //Up take c_crate out?
{
dwplaycammyspeech(16009, "M3CA010.wav", 5, 2); //c uh oh, we're moving up...
speed = gravity - (gravity / (c_weight / (droidweight + c_crate)));
SkipToFrame(elevator, 1, speed);
SkipToFrame(counterweight, 1, speed); //down
sendmessage(Rdroid, user5); //added
xmove=playsoundthing(elevmove, elevator, 1, -1, -1, 129); //LLL
playsoundlocal(est, 1, 0, 0);
dwdisablejump(); //LLL
}
if (droidweight + c_crate > c_weight) //Down
{
speed = gravity - (gravity / ((droidweight + c_crate) / c_weight));
if (c_weight < 26)
{
speed=gravity;
//dwsetmissiontext(16010);
}
else
{
//dwsetmissiontext(17106);
}
SkipToFrame(elevator, 2, speed);
SkipToFrame(counterweight, 2, speed); //up
sendmessage(Rdroid, user5); //added
xmove=playsoundthing(elevmove, elevator, 1, -1, -1, 129); //LLL
playsoundlocal(est, 1, 0, 0);
dwdisablejump();
dwplaycammyspeech(16099, "M3CA011.wav", 5, 2);
}
if (droidweight + c_crate == c_weight) //Same
{
SetWallcel(release_brake, 0);
Playsoundlocal(switchmax, 1, 0, 0);
//dwsetmissiontext(17101);
}
printflex(speed);
}
//-----------------------------------------------END RELEASE
if (GetSenderId() == 8) // message came from add_sand
{
if ( (getwallcel(rem_sand)==1)||(getwallcel(add_sand)==1) ) return;
call sand_add;
}
if (GetSenderId() == 9) // message came from rem_sand
{
if ( (getwallcel(rem_sand)==1)||(getwallcel(add_sand)==1) ) return;
call sand_rem;
}
return;
# ........................................................................................
arrived:
//print("current elev frame:")
//printint(getc
if (GetSenderId() == 1) //the elev
{
if (GetCurFrame(elevator) == 0)
{
SetWallCel(release_brake, 0);
PlaySoundPos(wav0, SurfaceCenter(release_brake), 0.6, -1, -1, 0);
print("STOP! THE! SOUND!");
stopsound(xmove, 0.5);
print("elevatorframeis:");
printint(getcurframe(elevator));
print("move droid");
sendmessage(rdroid, user3); //if bottom
sendmessage(rdroid, user2); //if top
call adjoinoff;
dwenablejump();
playsoundlocal(esp, 1, 0, 0);
}
}
return;
# ........................................................................................
sand_add:
if ( (GetWallCel(add_sand) != 1) && (GetWallCel(rem_sand) != 1) )//Nothing's already happening
{
sendmessage(sander, user1);
SetWallCel(add_sand, 1);
PlaySoundPos(switch, SurfaceCenter(add_sand), 0.6, -1, -1, 0);
sand_inc = 1;
c_dest = c_weight + step;
SetPulse(0.3);
}
return;
sand_rem:
if ( (GetWallCel(rem_sand) != 1) && (GetWallCel(add_sand) != 1) ) //Nothing's already happening
{
sendmessage(sander, user2);
SetWallCel(rem_sand, 1);
PlaySoundPos(switch, SurfaceCenter(rem_sand), 0.6, -1, -1, 0);
sand_inc = -1;
c_dest = c_weight - step;
SetPulse(0.3);
}
return;
pulse:
c_weight = c_weight + sand_inc;
if (c_weight < 200)
{
sendmessage(sander, user0);
SetPulse(0);
Set