home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Classic Fond 52
/
ClassicFond52.iso
/
GAMES
/
DROIDW.RAR
/
DWCD.GOB
/
mission_cog_sy_magtramb.cog
< prev
next >
Wrap
Text File
|
1998-11-04
|
16KB
|
541 lines
# DrowWorks Cog Script
#
# SY_MagTram B
#
# First attempt at MagTram cog
#
# Desc:
#
#
#
# [01/18/97] DGS Created From Matt's TreadRX script.
# [03/03/98] DGS Modified to work with sector thrusts. It got totally re-written. (Del-Fi Lost Treasures)
symbols
## ====================== Messages
message startup
message activated
message arrived
message entered
message exited
message touched
message timer
message pulse
## ====================== Things
thing tram
thing door1_o
thing door2_o
thing door3_o
thing door4_o
thing door5_o
thing door6_o
thing door7_o
thing door8_o
## ---------------------- Door sectors
int door1_s local
int door2_s local
int door3_s local
int door4_s local
int door5_s local
int door6_s local
int door7_s local
int door8_s local
## ===================== Vectors
vector up_v
## ====================== Sectors
sector pickup1_s linkid=21
sector pickup2_s linkid=22
int tram_sect_i local
## ====================== Assassin Droid Templates/Ghosts
template killer_t
thing ghost1_g
thing ghost2_g
int killer_i=0 local
int killer_loc=0 local
## ====================== Misc. Stuff
surface tramswitch
flex t_speed=25.0 local
flex t_max=25.0 local
flex t_cargo=15.0 local
flex door_speed=12.0 local
int cargo1_i=0 local
int cargo2_i=0 local
int cargot_i=0 local
int pickups_i=0 local
int moveframe=0 local
int in_tram=0 local
int waitfor=0 local
int playerdrop=0 local
int killer_pickup=0 local
end
# ========================================================================================
code
startup:
setwallcel(tramswitch, 1);
killer_loc = pickup1_s;
player = getlocalplayerthing();
movetoframe(tram,1,t_speed);
door1_s = GetThingSector(door1_o);
SetSectorAdjoins(door1_s, 0);
door2_s = GetThingSector(door2_o);
SetSectorAdjoins(door2_s, 0);
door3_s = GetThingSector(door3_o);
SetSectorAdjoins(door3_s, 0);
door4_s = GetThingSector(door4_o);
SetSectorAdjoins(door4_s, 0);
door5_s = GetThingSector(door5_o);
SetSectorAdjoins(door5_s, 0);
door6_s = GetThingSector(door6_o);
SetSectorAdjoins(door6_s, 0);
door7_s = GetThingSector(door7_o);
SetSectorAdjoins(door7_s, 0);
door8_s = GetThingSector(door8_o);
SetSectorAdjoins(door8_s, 0);
//printint(global1);
return;
tramstop:
//print("tramstop");
//This routine is in charge of checking a tram stop and dropping something off it it needs
// to, or picking someone up if it needs to.
if (cargot_i == 0) //if the tram is empty
{
tram_pickup = 1; // This variable tell's the touched message that it's okay to pick stuff up.
if ((getthingsector(tram) == pickup1_s) && (cargo1_i !=0 )) //if the sector the tram is in is pickup 1 and there's cargo to pick up
{
achthing = cargo1_i; // Let the achthing (the thing it picks up) = whatever the cargo is.
cargo1_i = 0; // Empty the cargostop variable
pickups_i = pickup1_s; // tell the touched message what sectorthrust to stop.
SectorThrust(pickup1_s, up_v, 5);
timermode = 1;
settimer(3);
}
if ((getthingsector(tram) == pickup2_s) && (cargo2_i !=0 )) //if the sector the tram is in is pickup 1 and there's cargo to pick up
{
achthing = cargo2_i; // Let the achthing (the thing it picks up) = whatever the cargo is.
cargo2_i = 0; // Empty the cargostop variable
pickups_i = pickup2_s; // tell the touched message what sectorthrust to stop.
SectorThrust(pickup2_s, up_v, 5);
timermode = 1;
settimer(3);
}
}
else // Else the cargo is holding something and it's way out wackity wacked
{
call dropoff1;
}
// The lines below control the killer droid
if ((playerdrop == pickup2_s) && (getthingsector(tram) == pickup1_s)) //if you're inside jawa area and the tram's not
{
print("assassin Droid comming your way into the JAWA area");
call pickup_killer;
playerdrop = 0;
}
if ((playerdrop == pickup1_s) && (getthingsector(tram) == pickup2_s)) //
{
print("assassin Droid comming your way back to Refurb area");
call pickup_killer;
playerdrop = 0;
}
return;
touched:
if (getsenderref() == tram)
{
if (tram_pickup == 1)
{
tram_pickup = 0;
print("touched");
SectorThrust(pickups_i, up_v, 0);
//call pickup1;
sleep(0.01);
call pickup1;
timermode = 1;
settimer(0.01);
}
}
return;
entered:
print("entered");
// This routine handles setting up variables for when the player (or potentially something else)
// enters a pickup zone.
If (getsenderref()== pickup1_s) //if something entered pickup 1
{
//print("Sector 1:");
//printint(getsourceref());
cargo1_i = getsourceref();
}
If (getsenderref()== pickup2_s) //if something entered pickup 2
{
//print("Sector 2:");
//printint(getsourceref());
cargo2_i = getsourceref();
}
if (tram_pickup == 1)
{
print("JAMZ");
timermode = 1;
settimer(3);
call tramstop;
}
return;
exited:
//This routine handles clearing varibles that keep track of what's potential cargo.
If (getsenderref()== pickup1_s)//if something exited pickup 1
{
if (cargo1_i == getsourceref())
{
cargo1_i = 0; //if it was potential cargo, then remove it
SectorThrust(pickup1_s, up_v, 0);
}
}
If (getsenderref()== pickup2_s)//if something exited pickup 2
{
if (cargo2_i == getsourceref())
{
cargo2_i = 0; //if it was potential cargo, then remove it
SectorThrust(pickup2_s, up_v, 0);
}
}
return;
pickup1:
// This routine picks up the player (well, in therory anything)
// It was taken from Matt the Tat's tram cog. I modified it a little. -Doug
t_speed = t_cargo;
in_tram = 1;
hangoffset=('0,0,0');
cargot_i = achthing;
// setsectorthrust(thrustsector, thrustvector, 0);
totalradius = GetThingRadius(achthing) + GetThingRadius(tram);
VectorSet(hangoffset, 0, 0, -totalradius);
// hangoffset = VectorAdd(hangoffset, GetThingInsertOffset(magnettram));
hangoffset = VectorSub(hangoffset, GetThingInsertOffset(achthing));
SetThingPos(achthing, VectorAdd(GetThingPos(tram), hangoffset));
AttachThingToThingEx(achthing, tram, 8);
if (achthing == player) dwdisablejump(); // if it's the player we're picking up, freeze his controls.
return;
dropoff1:
//print("dropOFF:");
if (achthing != 0)
{
printint(cargot_i);
cargot_i = 0; //empty out the cargo variable
t_speed = t_max;
Sleep(2);
in_tram = 0;
detachthing(achthing);
setthingvel(achthing, '0,0,0.5');
if (achthing == player) dwenablejump(); // if it's the player we're dropping, let him move.
if (achthing == player) //This stuff is for making the assassin droid follow you in/out.
{
if (getthingsector(tram) == pickup1_s) playerdrop = pickup1_s;
if (getthingsector(tram) == pickup2_s) playerdrop = pickup2_s;
print("playerdrop:");
printint(playerdrop);
}
acthing = 0;
if (achthing == killer_i) //This stuff is for making the assassin droid follow you in/out.
{
if (getthingsector(tram) == pickup1_s) killer_loc = pickup1_s;
if (getthingsector(tram) == pickup2_s) killer_loc = pickup2_s;
print("killer_loc:");
printint(killer_loc);
}
}
return;
pickup_killer:
// This routine creates an assassin droid and attaches him into the tram for dropoff later on.
t_speed = t_cargo;
in_tram = 1;
killer_pickup = killer_pickup +1;
if (killer_pickup == 1) dwPlayCammySpeech(12140, "M1ca042.wav", 10, 0);
else dwPlayCammySpeech(12141, "M1ca043.wav", 10, 0);
timermode = 2;
settimerex(10,2,0,0);
hangoffset=('0,0,0');
if (killer_i != 0) destroything(killer_i);
if (getthingsector(tram) == pickup1_s)
{
killer_i = creatething(killer_t,ghost1_g);
}
if (g