home *** CD-ROM | disk | FTP | other *** search
-
-
- # DrowWorks Cog Script
- #
- # SY_MagTram C
- #
- # Replacement for Magtram B
- #
- #
- # Desc:
- #
- # When I reworked the Salvage yard I had rewrite all these tram cogs. Bummer.
- #
- # [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)
- # [04/02/98] DGS Getting totally re-written again as so it's waiting for you at said "wait point". (Captiol Ultra-Lounge: Bachelor Pad Royale)
- # and it's a piece of junk that I just hate.
-
-
- symbols
-
- ## ====================== Messages
- message startup
- message arrived
- message entered
- message exited
- message pulse
- message touched
- message activated
- message timer
-
- ## ====================== Things
- thing tram mask=0xffff
- thing door1_o
- thing door2_o
- thing door3_o
- thing door4_o
- thing door5_o
- thing door6_o
- thing ghost1_o
- thing ghost2_o
- template killer_t
- int killer_i=0 local
- ## ====================== Surfaces
- surface tram1block1 nolink
- surface tram1block2 nolink
- surface tram1block3 nolink
- surface tram1block4 nolink
- surface tram1block5 nolink
- surface tram1block6 nolink
- surface tram1block7 nolink
- surface tram1block8 nolink
- surface switch_s
-
- ## ---------------------- 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
-
- ## ===================== Vectors
- vector up_v
-
- ## ====================== Sectors
- sector pickup1_s linkid=21
- sector pickup2_s linkid=22 mask=0xffff
- int tram_sect_i local
-
- sound act_snd=SWT00LtSwch2.WAV local
-
- ## ====================== Misc. Variables
-
- flex t_speed=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 tram_pickup=0 local
- int touchy=0 local
- int killer_loc=1 local
- int sayline=0 local
- int player=0 local
- int okaytoattach=1
-
- end
-
- # ========================================================================================
-
- code
-
- startup:
- //movetoframe(tram,1,t_speed);
- player = getlocalplayerthing();
- moveframe = 1;
- call open_adjoins;
- 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);
-
- setwallcel(switch_s,1); //turn switch to green
- # global8 = 0;
- global8=1;
- pickups_i = pickup1_s;
- //SectorThrust(pickups_i, up_v, 5);
- okaytoattach=1;
- return;
-
- touched:
- print("touched");
- if (touchy == 0)
- {
- if (getsenderref() == tram)
- {
- call open_adjoins;
- print("touched32");
- touchy = 1;
- //print("touched");
- tram_pickup = 0;
- SectorThrust(pickups_i, up_v, 0); //turn it off whereever it is
- sleep(0.01);
- call pickup1;
- settimer(1);
- okaytoattach=0;
- }
- }
- return;
- activated:
- // Hi. This is Doug. I just wanted to leave a personal message to anyone out there reading the cogs. I love america!
- if (getsenderref() == switch_s)
- {
- print("Cammy Line");
- dwPlayCammySpeech(12120, "M1ca040.wav", 10, 3);
-
- setwallcel(switch_s,1 - getwallcel(switch_s));
- garbage = playsoundpos(act_snd,getsurfacecenter(switch_s),0.5,-1,-1,0);
-
- if (getwallcel(switch_s) == 0) // if the switch is set to red (stopped)
- {
- if (killer_loc == 1)
- {
- print("Sanctuary!");
- global8 = 1;
- }
- else if (killer_loc == 2)
- {
- print("Not Yet!");
- # global8 = 0;
- }
- stopthing(tram); //Stop the tram from moving
- }
- else //else it's set to greeeeeeeeeen!
- {
- print("Cammy Line");
- dwPlayCammySpeech(12130, "M1ca041.wav", 10, 0);
-
- # global8 = 0;
- if (touchy != 0) settimer(0.01); //if the tram is not waiting to pickup the player
- }
- }
- return;
-
- entered:
- print("entered");
- if (dwCheckDroidCaps(16))
- {
- if (getwallcel(switch_s) == 1) //if the tram is turned on
- {
- if ((getcurframe(tram) == 0) && (getsenderref()== pickup1_s) && (moving == 0))
- {
- pickups_i = pickup1_s;
- call close_adjoins;
- SectorThrust(pickups_i, up_v, 5);
- setpulse(0);
- achthing=getsourceref();
- }
- if ((getcurframe(tram) == 18) && (getsenderref()== pickup2_s) && (moving == 0))
- {
- if (okaytoattach!=1) return;
- pickups_i = pickup2_s;
- call close_adjoins;
- SectorThrust(pickups_i, up_v, 5);
- setpulse(0);
- if (getthingtemplate(getsourceref())==killer_t) {
- print("that AD is STUCK");
- }
- achthing=getsourceref();
- }
- }
- }
- 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);
- }
- }
- 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
- if (dwCheckDroidCaps(16))
- {
- print("pick me up!");
- printint(achthing);
- t_speed = 7.5;
- hangoffset=('0,0,0');
- moving = 1;
- cargot_i = achthing;
- // setsectorthrust(thrustsector, thrustvector, 0);
- totalradius = GetThingRadius(achthing) + GetThingRadius(tram);
- VectorSet(hangoffset, 0, 0, (-totalradius)- 0.5);
- // hangoffset = VectorAdd(hangoffset, GetThingInsertOffset(magnettram));
- hangoffset = VectorSub(hangoffset, GetThingInsertOffset(achthing));
- //SetThingPos(achthing, VectorAdd(GetThingPos(tram), hangoffset));
- AttachThingToThingEx(achthing, tram, 8);
- if (achthing==player) dwdisablejump();
- }
- else
- {
- // Tell player not magnetic
- }
- return;
-
- dropoff1:
- print("dropOFF:");
- moving = 1;
- if (cargot_i == killer_i)
- {
- if (getcurframe(tram) == 0)
- {
- killer_loc = 1;
- // dwPlayCammySpeech(16122, "M1ca015.wav", 10, 0);
- moving = 0;
- }
- if (getcurframe(tram) == 18)
- {
- killer_loc = 2;
- dwPlayCammySpeech(16143, "M1ca028.wav", 10, 0);
- moving = 0;
- }
- }
- printint(cargot_i);
- cargot_i = 0; //empty out the cargo variable
- t_speed = 15;
- //Sleep(2);
- in_tram = 0;
- detachthing(achthing);
- setthingvel(achthing, '0,0,0.5');
- SectorThrust(pickup1_s, up_v, 3);
- SectorThrust(pickup2_s, up_v, 3);
- setpulse(2);
- dwenablejump();
- touchy = 0;
- okaytoattach=1;
- return;
-
-
- create_killer:
- // In charge of creating the assassin droid and moving the tram;
- print("Kreate Killer!");
- if (killer_i != 0)
- {
- destroything(killer_i);
- killer_i = 0;
- }
- if (getcurframe(tram) == 0)
- {
- killer_i = creatething(killer_t,ghost1_o);
- moveframe = 1;
- }
- if (getcurframe(tram) == 18)
- {
- killer_i = creatething(killer_t,ghost2_o);
- moveframe = 26;
- }
- setactorflags(killer_i, 8);
- Call Cammyline;
- cargot_i = killer_i;
- achthing = killer_i;
- touchy = 1;
- AttachThingToThingEx(killer_i, tram, 8);
- movetoframe(tram,moveframe,t_speed);
- return;
- cammyline:
- if (sayline == 0)
- {
- dwPlayCammySpeech(12140, "M1ca042.wav", 10, 0);
- sayline = 1;
- }
- else if (sayline == 1)
- {
- dwPlayCammySpeech(12141, "M1ca043.wav", 10, 0);
- sayline = 2;
- }
- else if (sayline == 2)
- {
- sayline = 3;
- dwPlayCammySpeech(16945, "M1ca031.wav", 10, 0);
- }
- else if (sayline == 3)
- {
- dwPlayCammySpeech(16944, "M1ca030.wav", 10, 0);
- sayline = 4;
- }
- else
- {
- sayline = 3;
- dwPlayCammySpeech(16945, "M1ca031.wav", 10, 0);
- }
- return;
- arrived:
- if ((getsenderref() == tram) && (getwallcel(switch_s) == 1)) //if it's the tram and the switch is turned on
- {
- if ((getcurframe(tram))==0)
- {
- if (cargot_i == 0) // If the tram is empty
- {
- # call create_killer; //Create the assassin
- }
- else //Else something's in the tram
- {
- if (cargot_i == player) //if the player is in the tram
- {
- call dropoff1; //drop it.
- moveframe = 1;
- settimer(2);
- }
- if (cargot_i == killer_i) //if the player is in the tram
- {
- call dropoff1; //drop it.
- moveframe = 1;
- global8=1;
- //settimer(2);
- }
-
- }
- moveframe = 1;
- }
- else if ((getcurframe(tram))==1)
- {
- SetSectorAdjoins(door1_s, 1); //Turn on door adjoins
- movetoframe(door1_o,1,door_speed);
- moveframe = 2;
- movetoframe(tram,2,t_speed);
- }
- else if ((getcurframe(tram))==2)
- {
- movetoframe(door1_o,0,door_speed);
- moveframe = 3;
- movetoframe(tram,3,t_speed);
- }
- else if ((getcurframe(tram))==3)
- {
- SetSectorAdjoins(door2_s, 1); //Turn on door adjoins
- movetoframe(door2_o,1,door_speed);
- moveframe = 4;
- movetoframe(tram,4,t_speed);
- }
- else if ((getcurframe(tram))==4)
- {
- movetoframe(door2_o,0,door_speed); // Close door
- moveframe = 7;
- movetoframe(tram,7,t_speed);
- }
- else if ((getcurframe(tram))==7)
- {
- SetSectorAdjoins(door3_s, 1); //Turn on door adjoins
- movetoframe(door3_o,1,door_speed);
- moveframe = 8;
- movetoframe(tram,8,t_speed);
- }
- else if ((getcurframe(tram))==8)
- {
- movetoframe(door3_o,0,door_speed); // Close door
- moveframe = 9;
- movetoframe(tram,9,t_speed);
- }
- else if ((getcurframe(tram))==9)
- {
- SetSectorAdjoins(door4_s, 1); //Turn on door adjoins
- movetoframe(door4_o,1,door_speed);
- moveframe = 10;
- movetoframe(tram,10,t_speed);
- }
- else if ((getcurframe(tram))==10)
- {
- movetoframe(door4_o,0,door_speed); // Close door
- moveframe = 12;
- movetoframe(tram,12,t_speed);
- }
- else if ((getcurframe(tram))==12)
- {
- SetSectorAdjoins(door5_s, 1); //Turn on door adjoins
- movetoframe(door5_o,1,door_speed);
- moveframe = 13;
- movetoframe(tram,13,t_speed);
- }
- else if ((getcurframe(tram))==13)
- {
- movetoframe(door5_o,0,door_speed); // Close door
- moveframe = 14;
- movetoframe(tram,14,t_speed);
- }
- else if ((getcurframe(tram))==14)
- {
- SetSectorAdjoins(door6_s, 1); //Turn on door adjoins
- movetoframe(door6_o,1,door_speed);
- moveframe = 15;
- movetoframe(tram,15,t_speed);
- }
- else if ((getcurframe(tram))==15)
- {
- movetoframe(door6_o,0,door_speed); // Close door
- moveframe = 18;
- movetoframe(tram,18,t_speed);
- }
- else if ((getcurframe(tram))==18)
- {
- if (cargot_i == player) // If it's dropping off the player
- {
- call dropoff1;
- moveframe = 26;
- settimer(2);
- }
- else if (cargot_i == killer_i) // else if it's dropping off the assassin droid
- {
- call dropoff1;
- //destroything(killer_i);
- pickups_i = pickup2_s;
- moveframe = 26;
- }
- else if (cargot_i == 0) // else if it's empty
- {
- # call create_killer;
- }
- }
- else if ((getcurframe(tram))==26)
- {
- moveframe = 0;
- skiptoframe(tram,0,t_speed);
- }
- }
- else if (getsenderref() == door1_o) //if it's door 1
- {
- if (getcurframe(door1_o) == 0) SetSectorAdjoins(door1_s, 0); //Turn off door adjoins
- }
- else if (getsenderref() == door2_o)
- {
- if (getcurframe(door2_o) == 0) SetSectorAdjoins(door2_s, 0); //Turn off door adjoins
- }
- else if (getsenderref() == door3_o)
- {
- if (getcurframe(door3_o) == 0) SetSectorAdjoins(door3_s, 0); //Turn off door adjoins
- }
- else if (getsenderref() == door4_o)
- {
- if (getcurframe(door4_o) == 0) SetSectorAdjoins(door4_s, 0); //Turn off door adjoins
- }
- else if (getsenderref() == door5_o)
- {
- if (getcurframe(door5_o) == 0) SetSectorAdjoins(door5_s, 0); //Turn off door adjoins
- }
- else if (getsenderref() == door6_o)
- {
- if (getcurframe(door6_o) == 0) SetSectorAdjoins(door6_s, 0); //Turn off door adjoins
- }
-
- return;
- timer:
- // this routine is used to control the movement of the tram after it's waited at
- // the stop for a settimer() amount of ti
- print("I pity the fool");
- if (moveframe == 0) skiptoframe(tram,moveframe,t_speed);
- else movetoframe(tram,moveframe,t_speed);
-
- return;
-
- pulse:
- SectorThrust(pickup1_s, up_v, 0);
- SectorThrust(pickup2_s, up_v, 0);
- setpulse(0);
- return;
-
- open_adjoins:
- if (getcurframe(tram) == 0)
- {
- print("clearing flags");
- setadjoinflags(tram1block1, 2);
- setadjoinflags(tram1block2, 2);
- setadjoinflags(tram1block3, 2);
- setadjoinflags(tram1block4, 2);
- }
- if (getcurframe(tram) == 18)
- {
- print("clearing flags 2");
- setadjoinflags(tram1block5, 2);
- setadjoinflags(tram1block6, 2);
- setadjoinflags(tram1block7, 2);
- setadjoinflags(tram1block8, 2);
- }
-
- return;
-
- close_adjoins:
- if (getcurframe(tram) == 0)
- {
- print("setting flags");
- clearadjoinflags(tram1block1, 2);
- clearadjoinflags(tram1block2, 2);
- clearadjoinflags(tram1block3, 2);
- clearadjoinflags(tram1block4, 2);
- }
- if (getcurframe(tram) == 18)
- {
- print("setting flags 2");
- clearadjoinflags(tram1block5, 2);
- clearadjoinflags(tram1block6, 2);
- clearadjoinflags(tram1block7, 2);
- clearadjoinflags(tram1block8, 2);
- }
-
- return;
-
-
- end
-