home *** CD-ROM | disk | FTP | other *** search
- #This script handles the mfagnet tram in the phrik mine
- # It turns on the thrust after the player enters the catapult area.
- # Then it tells Sneaky.cog to have the FITTO move
-
- symbols
- message user1
- message arrived
- message startup
- message crossed
- message entered
- message timer
- message user6
-
- template w50cratetemplate
-
- surface triggeradjoin mask=0xfff
-
- sector thrustsector mask=0xfff linkid=5
- vector thrustvector
-
- thing wcreatecrateghost
- thing newtram
- thing ghostcamera
-
- thing AD
- thing stopdoor
- thing gonk
- thing ADcamera
-
- cog ADaicog
- cog catapultcog
- cog sneakycog
-
- sector roomsector linkid=1
-
- sound t1dropcrate
- sound t1trammove
- sound t1tramstart
-
- sector thrustonsector1 linkid=6
- sector thrustonsector2 linkid=6
- sector thrustonsector3 linkid=6
- template ADmq
- thing ADmqGhost
-
-
- surface tramblock1 nolink
- surface tramblock2 nolink
- surface tramblock3 nolink
-
- template ADtemplate
- thing teledoordest
- thing telehideaway
- int isattached=0 local
- end
-
- code
- startup:
- player=getlocalplayerthing();
- movetoframe(stopdoor, 1, 5);
- crateishere=0;
- yet=0;
- sleep(2);
- call clearadjoinflags;
- sabotage=0;
- isattached=0;
- return;
-
- entered:
- if ( (yet==0)&&(getsenderid()==1) ) {
- stopthing(player);
- dwfreezeplayer();
- setactorflags(player, 8);
- // AIclearmode(AD, 0xffff);
- // AIsetmode(AD, 0x2000);
- movetoframe(stopdoor, 0, 5);
- setcamerafocii(2, gonk ,ghostcamera);
- setcurrentcamera(2);
- dwplaycharacterspeech("SDX001", "m2bd034.wav");
- dwcleardialog();
- call setadjoinflags;
- yet=0.5;
- sendmessage(SneakyCog, user0);
- }
- if ( (yet==2)&&(dwCheckDroidCaps(16)==0) ) {
- if (getsenderid()==5) {
- print("sectorthrustoff");
- setsectorthrust(thrustsector, thrustvector, 0);
- call clearadjoinflags;
- }
- else if (getsenderid()==6) {
- print("sectorthruston");
- setsectorthrust(thrustsector, thrustvector, 8);
- call setadjoinflags;
- }
- }
- if (getsenderid()==5) {
- print("something entered the thrustsector");
- if ( (getthingtemplate(getsourceref())==ADtemplate)&&(yet==2)&&(isattached==0) ) {
- achthing=getsourceref();
- print("and it was the AD");
- hangoffset=('0,0,0');
- destroything(getsourceref());
- tramspeed=1.5;
- xADmq=creatething(ADmq,ADmqghost);
- call movetram;
- }
- }
- return;
-
- timer:
- if (getsenderid()==4) {
- dwenddialog();
- dwclearresponses();
- }
- else if (getsenderid()==3) {
- dwunfreezeplayer();
- setcurrentcamera(7);
- }
- return;
-
- user1:
- yet=1;
- print("bing bang boom");
- crateishere=1;
- smallcrate=creatething (w50cratetemplate, wcreatecrateghost);
- return;
-
- user6:
- yet=2;
- return;
-
- arrived:
- if (getsenderref()==newtram) {
- if (getcurframe(newtram)==0) {
- if (yet>=1) setsectorthrust(thrustsector, thrustvector, 8);
- isattached=0;
- call setadjoinflags;
- }
- else if (getcurframe(newtram)==2) {
- if (crateishere!=1) sendmessage(ADaicog, user0);
- movetoframe(newtram, 4, tramspeed);
- }
- else if (getcurframe(newtram)==4) {
- sleep(2);
- if (crateishere==1) {
- destroything(achthing);
- sendmessage(catapultcog, user1);
- crateishere=0;
- playsoundthing(t1dropcrate, newtram, 1, -1, -1, 0);
- }
- else {
- playsoundthing(t1dropcrate, newtram, 1, -1, -1, 0);
- if (achthing==player) {
- dwenablejump();
- detachthing(achthing);
- setthingvel(achthing, '0,0,1.0');
- }
- if (tramspeed==1.5) {
- destroything(xADmq);
- sendmessage(catapultcog, user4); #create AD and send him down
- # teleportthing(AD, telereturn);
- # setthingvel(AD, '0,0,1.0');
- }
- }
- movetoframe(newtram, 0, 25);
- }
- }
- if ( (getsenderref()==stopdoor)&&(getcurframe(stopdoor)==0) ) {
- print("teleporting AD");
- teleportthing(AD, teledoordest);
- setsectorthrust(thrustsector, thrustvector, 8);
- }
- return;
-
- crossed:
- if ( (yet>=1)&&(isattached==0) ) {
- print("something crossed...");
- isattached=1;
- hangoffset=('0,0,0');
- achthing=getsourceref();
- if (getthingtemplate(achthing)==ADtemplate) {
- print("and it was the assassin droid");
- destroything(achthing);
- tramspeed=1.5;
- xADmq=creatething(ADmq,ADmqghost);
- }
- else if (achthing==player) {
- dwdisablejump();
- tramspeed=15;
- }
- else tramspeed=15;
- call movetram;
- }
- return;
-
- ADcatchcam:
- print("switching to ADcatchcam");
- dwplaycammyspeech(16023, "m2ca023.wav", 20, 2);
- dwfreezeplayer();
- setcamerafocii(2, newtram, ADcamera);
- setcurrentcamera(2);
- settimerEX(7, 3, 0, 0);
- return;
-
- movetram:
- //turn off sectorthrust
- if (tramspeed==1.5) {
- movetoframe(xADmq, 3, 1.5);
- call ADcatchcam;
- print("you've got to hide your love away");
- }
- setsectorthrust(thrustsector, thrustvector, 0);
- call clearadjoinflags;
- totalradius = GetThingRadius(achthing) + GetThingRadius(newtram);
- VectorSet(hangoffset, 0, 0, -totalradius);
- hangoffset = VectorSub(hangoffset, GetThingInsertOffset(achthing));
- # hangoffset = GetThingInsertOffset(achthing);
- # hangoffset = VectorSet(0, 0, VectorZ(hangoffset) - GetThingRadius(achthing));
- # hangoffset = VectorSet(0, 0, -0.6 MAGIC NUMBER);
- SetThingPos(achthing, VectorAdd(GetThingPos(newtram), hangoffset));
- AttachThingToThingEx(achthing, newtram, 8);
- movetoframe(newtram, 2, tramspeed);
- return;
-
- clearadjoinflags:
- print("clearing flags");
- setadjoinflags(tramblock1, 2);
- setadjoinflags(tramblock2, 2);
- setadjoinflags(tramblock3, 2);
- return;
-
- setadjoinflags:
- print("setting flags");
- clearadjoinflags(tramblock1, 2);
- clearadjoinflags(tramblock2, 2);
- clearadjoinflags(tramblock3, 2);
- return;
-
- end
-
-