home *** CD-ROM | disk | FTP | other *** search
- #standard type magnetic tram cog.
- #don't forget to set blocking walls to "no move"
- symbols
- message startup
- message arrived
- message crossed
- message entered
- message user0
-
- thing magnettramghost
-
- template magnettramT
-
- sector thrustsector linkid=5
-
- surface triggeradjoin mask=0xfff
- surface tram1block1 nolink
- surface tram1block2 nolink
- surface tram1block3 nolink
- surface tram1block4 nolink
-
- vector cratepos local
- vector trampos local
- vector thrustvector
-
- cog gencog
- cog catapultcog
-
- sound t1dropcrate=t1dropcrate.wav
- sound t1trammove=t1trammove.wav
- thing nCrateGhost
- template nCrateTemplate
- end
-
- ## Code Section
- code
- startup:
- tramlegal=1;
- ItIsAttached=0;
- player=getlocalplayerthing();
- call createtram;
- return;
-
- crossed:
- print("crossed the funky tram triggeradjoin");
- hangoffset=('0,0,0');
- setsectorthrust(thrustsector, thrustvector, 0);
- sendmessage(catapultcog, user4);
- call movetram;
-
- return;
-
- movetram:
- print("the sucker is attached");
- ItIsAttached=1;
- MadeOfStone=creatething(nCrateTemplate, nCrateGhost);
- attachthingtothing(MadeOfStone, newtram);
- return;
-
- arrived:
- //when the tram has arrived, drop the achthing and reset to stop 0
- if (getcurframe(newtram)==5) {
-
- sleep(2);
- if (ItIsAttached==1) {
- ItIsAttached=0;
- destroything(MadeOfStone);
- sendmessage(catapultcog, user5);
- sendmessage(gencog, user4);
- }
- movetoframe(newtram, 6, 5);
- }
- else if (getcurframe(newtram)==6) {
- destroything(newtram);
- stopsound(movechannel, 0.3);
- tramlegal=1;
- call createtram;
- }
- else if (getcurframe(newtram)==1) {
- setsectorthrust(thrustsector, thrustvector, 8);
- call setajnflgs;
- sleep(4);
- movetoframe(newtram, 2, 5);
- }
- else if (getcurframe(newtram)==2) {
- setsectorthrust(thrustsector, thrustvector, 0);
- movetoframe(newtram, 3, 5);
- call clrajnflgs;
- }
- else if (getcurframe(newtram)==3) {
- movetoframe(newtram, 5, 5);
- }
- return;
-
- user0:
- createtram:
- if (tramlegal==1) {
- tramlegal=0;
- newtram=creatething(magnettramT, magnettramghost);
- capturething(newtram);
- movetoframe(newtram, 1, 5);
- }
- return;
-
- clrajnflgs:
- setadjoinflags(tram1block1, 2);
- setadjoinflags(tram1block2, 2);
- setadjoinflags(tram1block3, 2);
- setadjoinflags(tram1block4, 2);
- return;
-
- setajnflgs:
- clearadjoinflags(tram1block1, 2);
- clearadjoinflags(tram1block2, 2);
- clearadjoinflags(tram1block3, 2);
- clearadjoinflags(tram1block4, 2);
- return;
-
-
-
- end
-
-
-