home *** CD-ROM | disk | FTP | other *** search
- # Droids Cog Script
- #
- # 03_watermove.cog
- #
- # Desc:
- # Companion cog to Tanks. When receiving message from tanks cog, it clears them water sectors.
- #
- #
- # 2/18/98 [JP] Created
- #
- # (C) 1998 LucasLearningLimited. All Rights Reserved
-
-
-
- symbols
- message startup
- message pulse
- message activate
- message touched
- message arrived
-
- thing water_sector0
- thing water_sector1
- thing water_sector2
- thing platform_water_sector
-
- sector
- sector
- sector
- sector
- sector
- sector
- sector
- sector
- sector
- sector
- sector
- sector
- sector
-
-
- sound water_gush
-
- end
-
- # =======================================
-
-
- ## Code Section
- code
-
- startup:
- clearvector=vectorset(0.0, 0.0, 0.0);
- //vec0=vectorset(0.0, 0.0, -8.0);
- if (light0 != 0) setthinglight(light0, 0, 0.0);
- if (light1 != 0) setthinglight(light1, 0, 0.0);
- if (light2 != 0) setthinglight(light2, 0, 0.0);
- if (light3 != 0) setthinglight(light3, 0, 0.0);
-
- waterisdrained=0;
- print("c-r startup");
- // AttachThingToThing(wrench_long, wrench); //wrench attached to fake_gear for noninventory version
- // AttachThingToThing(gear, wrench_short);
- AttachThingToThing(wrench_long, gear);
- AttachThingToThing(wrench_short, gear);
- return;
-
- # =========================================================
-
- activate:
- if (GetSenderId() == 7) // pressing reset button underwater
- print("c-r activate");
- {
- if (waterisdrained==0) // water is not drained yet
- {
- print ("reset_switch_broke!");
- PlaySoundLocal(reset_switch_broke, 1, 0, 0);
- dwsetmissiontext(17430); //Cambot dialog
- }
-
- else if (waterisdrained==1) // power comes on
- {
- print("power on");
- PlaySoundLocal(power_on, 1, 0, 0);
- SetWallCel(reset_switch, 1); // reset button changes color
- setthinglight(light0, brightness, 1.5); // turns these lights on
- setthinglight(light1, brightness, 2.0);
- setthinglight(light2, brightness, 1.0);
- setthinglight(light3, brightness, 3.0);
- }
-
-
- }
- return;
-
- # =============// attach the wrench from inventory to the middle gear
- //used:
- // Section is executed when the user uses an inventory object.
- // print("used:");
- // printint (dwGetActivateBin());
- // printint (getsenderid());
- // if (rotate == 0)
- // {
- // if ( getinv(getlocalplayerthing(), dwGetActivatebin()) > 0) // if the bin has more than 0 in it;
- // {
- // printint (getthingsector(getlocalplayerthing()));
- // printint (drain_room0);
- // // The gear assembly was activated
- // if (getthingsector(getlocalplayerthing()) == drain_room0)
- // {
- // // Player is on the lower left side of the gear assembly
- // print ("activated gear");
- // call handle_attach;
- // }
- // }
- // }
- // return;
-
- //used:
- //{
- //if (wrenchisattached==1) // wrench is attached
- //wrench=creatething(wrenchtemplate, wrenchghost);
- //PlaySoundLocal(wrench_gear_attach, 1, 0, 0); // sound of wrench attaching
- //AttachThingToThing(wrench_short, gear); // wrench attached to gear
- //}
- //return;
-
- #==================// takes off the wrench from the inventory to the middle gear
- //taken:
- // print ("taken");
- // printint (getsenderid());
-
- // Taken gets called when the user attempts to take the wrench from the gear
- // if (rotate == 0)
- // {
- // if (GetSenderId() == 2) // if it's the motor gear- p_med_gear_vert that got activated
- // {
- // the gear assembly was activated
- // if (getthingsector(getlocalplayerthing()) == drain_room0)
- // {
- // if (lower_left_spindle != 0) // UH, THIS ISN'T IT...
- // {
- // increase the bin to add it back to the inv, destroy one in the environment, and set
- // lower_left_spindle to 0
- // ChangeInv(getlocalplayerthing(), lower_left_spindle, 1);
- // destroything(lower_left_spindle_i);
- // lower_left_spindle = 0;
- // call update_bins;
- // }
- // call update_bins;
- // }
- // return;
-
- #===========================
- //handle_attach:
- // handle attach is used to put the wrench on the lower left side of the assembly.
- // print("handle_attach");
- // if (lower_left_spindle == 0) // if the lower left spindle is empty
- // {
- // adds whatever you gots to the spindle
- // if (dwGetActivateBin() = bin) // if it's the "bin", for the wrench, it's bin 31
- // {
- // 3 things happen: 1st variable lower_left_spindle is set to the gear that's going to go on the spindle
- // The bin number from the gear is used to represent what gear is on the spindle.
- // If lower_left_spindle is set to 0, then there should be no gear on the spindle. If a non-zero #,
- // it represents the present gear's bin number.
- // lower_left_spindle = dwGetActivateBin();
- // print ("l_l_gear_on");
- // ChangeInv(getlocalplayerthing(), lower_left_spindle, -1); //FIX THIS PART !!!!
- // call update_bins;
- // }
- // }
- // return;
-
- # =============// rotate the wrench attached to the gear and platform
- touched:
- if (playonce==0){
- if (GetSenderId() == 1) // pressing wrench_short
- {
- print("c-r tou~chey!");
- setpulse(0.1);
- playonce=1;
- }
- }
-
- return;
-
-
- pulse:
-
- player=getlocalplayerthing();
- playerpos=getthingpos(player);
- wrench_shortpos=getthingpos(wrench_short);
-
- printflex(vectorY(getthingpos(wrench_long)));
- if((vectorY(getthingpos(wrench_long)))>-0.9591) call stoptheplatform;
-
- if(vectordist(playerpos,wrench_shortpos)<.13) {
- PlaySoundLocal(wrench_gear_move, 1, 0, 0); // wrench fake gear moving sound
-
- if (getcurframe(wrench_short)==0) currentframe=1; //if wrench at frame 0 -> frame 1
- if (getcurframe(wrench_short)==1) currentframe=2; // 1 -> frame 2
- //if (getcurframe(gear)==0) currentframe=1; //if gear at frame 0 -> frame 1
- //if (getcurframe(gear)==1) currentframe=2; // 1 -> frame 2
- // MoveToframe(wrench_short, currentframe, .4); // wrench_short moves to current frame
- //MovetoFrame(wrench_long, currentframe, .314); //wrench_long moves to current frame
- RotatePivot(gear, 1, 9); //gear rotates to current frame
- //MoveToFrame(gear, currentframe, .4); // gear rotates to current frame
- }
- else {
- stopthing(wrench_short);
- stopthing(gear);
- stopthing(wrench_long);
- //stopthing(platform);
- }
- return;
-
- # =============// wrench has been rotated until final frame
- stoptheplatform:
- print("c-r stop!!!");
- setpulse(0);
- Sleep(.5);
- MoveToFrame(platform, 1, .79); // platform moves down
- // MoveToFrame(wrench_short, 3, .5); // wrench moves down
- // MoveToFrame(wrench_long, 3, .5); // wrench_fake moves down
- // MoveToFrame(gear, 2, .5); // gear moves down
- destroything(wrench_short);
- destroything(wrench_long);
- destroything(gear);
- newwf=creatething(wftemplate, wfghost);
- movetoframe(newwf, 1, .8);
- newgr=creatething(grtemplate, grghost);
- movetoframe(newgr, 1, .8);
- return;
-
-
-
-
- arrived:
- if (getsenderid() == 3); //message that platform has arrived
- {
- if (getcurframe(platform)==1){
-
- waterisdrained=1; // control room is drained
- print("c-r arrived");
- clearsectorflags(control_room0, 2); //control & drain rooms no longer submerged
- clearsectorflags(control_room1, 2);
- clearsectorflags(control_room2, 2);
- clearsectorflags(control_room3, 2);
- clearsectorflags(control_room4, 2);
- clearsectorflags(control_room5, 2);
- clearsectorflags(control_room6, 2);
- clearsectorflags(control_room7, 2);
- clearsectorflags(control_room8, 2);
- clearsectorflags(control_room9, 2);
- clearsectorflags(drain_room0, 2);
- clearsectorflags(drain_room1, 2); //control & drain rooms rgb values returned to normal
- setsectortint(control_room0, clearvector);
- setsectortint(control_room1, clearvector);
- setsectortint(control_room2, clearvector);
- setsectortint(control_room3, clearvector);
- setsectortint(control_room4, clearvector);
- setsectortint(control_room5, clearvector);
- setsectortint(control_room6, clearvector);
- setsectortint(control_room7, clearvector);
- setsectortint(control_room8, clearvector);
- setsectortint(control_room9, clearvector);
- setsectortint(drain_room0, clearvector);
- setsectortint(drain_room1, clearvector);
- MoveToFrame(debris0, 1, 5);
- MoveToFrame(debris1, 1, 5);
- MoveToFrame(debris2, 1, 5);
- MoveToFrame(debris3, 1, 5);
- MoveToFrame(debris4, 1, 5);
- MoveToFrame(debris5, 1, 5);
- }
- }
- return;
- # ==============//turn sector thrust off
-
- //timer:
-
-
- //MoveToFrame(gear, 1, .15); // gear rotates to frame 1
- //MoveToFrame(platform, 1, .1); // platform rotates to frame 1
- //MovetoFrame(wrench_fake, 1, .32);
- //Movetoframe(wrench, 1, .5);
-
-
-
- // return;
-
- end