//3D Game Studio //Code /////////////////////////////////////////////////////////////////////////////// //Scan Cone Function //Used to Scan an entities position. ////////////////////////////////////////////////////////////////////////////// var indicator = 0; var my_pos[3]; var my_angle[3]; function scan_me() { my_pos.x = camera.x; my_pos.y = camera.y; my_pos.z = camera.z; my_angle.pan = camera.pan; my_angle.tilt = camera.tilt; temp.pan =120; temp.tilt = 180; temp.z = 200; indicator = 1; scan(my_pos, my_angle, temp); } //////////////////////////////////////////////////////////////////////////////// //Opening and Closing Doors //Uses Scanning, a Door Action, a Door Function //////////////////////////////////////////////////////////////////////////////// define _counter, skill25; //defines skill25 with the name _counter. function door_event() //function to open or close the door depending on state. { if(indicator !=1) {return;} //not within scan range. if(my._counter <=0) //to open door { while(my._counter <90) { my.pan -=3*time; my._counter += 3*time; wait(1); } my.pan += my._counter-90; my._counter = 90; } else //to close door { while(my._counter > 0) { my.pan +=3*time; my._counter -= 3*time; wait(1); } my.pan += my._counter; my._counter = 0; } } action doorX //action for the door. { my.event = door_event; //calls the function door_event. my.enable_scan = on; //enables scanning. my._counter = 0; //counter. } on_space = scan_me; //does a scan on the space key. /////////////////////////////////////////////////////////////////////////////////// //Entity that will emit light after a switch is activated. /////////////////////////////////////////////////////////////////////////////////// var switch; //switch. action my_light //action for the light entity { my.invisible = on; //entity will be invisible. while(1) { wait(1); my.lightrange = 100; //orginal light range my.light = on; my.red = 128; //colors before player gets there my.green = 128; my.blue = 0; if(switch == 1) //colors after player enters { my.lightrange = 500; //new light range my.red = 0; //colors before player gets there my.green = 128; my.blue = 128; wait(1); } } } function change_switch() //for the switch { switch=1; wait(1); remove(me); //switch ent is removed after touched } action switch_ent //action for the switch { my.invisible = on; //cant see it my.enable_impact = on; my.event = change_switch; //calls the change_switch function. } //////////////////////////////////////////////////////////////////////////////////// //Using Text //////////////////////////////////////////////////////////////////////////////////// string talk2 = "SURE I CAN GIVE YOU A TOUR, FOLLOW ME"; text talking2 { layer = 14; //priority pos_x = 100; //text position pos_y = 10; font = msgfont; //font to use string = talk2; //string to display } //then to use it in a function... talking2.visible = on; //make text visible waitt(64); //wait a sec talking2.visible = off; //make text invisible ///////////////////////////////////////////////////////////////////////////////////// //Using Entity Flags (1,2....8) - can be set in WED. //////////////////////////////////////////////////////////////////////////////////// //You can set an Entities Flag parameters in WED in the Entity Properties. //To use them in your C-Script, do the following: //flags are boolean, either 0 or 1. if(my.flag1 == 1) { jeffsoffice.visible = on; waitt(32); //wait a sec jeffsoffice.visible = off; } if(my.flag2 == 1) { randysoffice.visible = on; waitt(32); //wait a sec randysoffice.visible = off; } ///////////////////////////////////////////////////////////////////////////////////////