Call of Duty 4: Scripting Brushes: Difference between revisions
Jump to navigation
Jump to search
(New page: == Simple Elevator == ''by nuthowz'' Create the elevator as a script_brushmodel then assign the key/values key = targetname value = elevator Then create the triggers go to triggers u...) |
No edit summary |
||
Line 1: | Line 1: | ||
[[Category:Call of Duty 4]] | |||
== Simple Elevator == | == Simple Elevator == | ||
Revision as of 01:54, 16 October 2008
Simple Elevator
by nuthowz
Create the elevator as a script_brushmodel then assign the key/values
key = targetname value = elevator
Then create the triggers go to triggers use_touch create 2 of these 1 for the beginning and 1 for the end
assign key/values
key = targetname value = switch
Then connect them select your brushmodel then trigger teh hit the w key to weld them. That's it for the map side
Now create your script for the elevator to move.
main() { level.elevatorDown = true; level.elevatorMoving = false; thread elevator_start(); } elevator_start() { elevator = getentarray ("switch","targetname"); if ( isdefined(elevator) ) for (i = 0; i < elevator.size; i++) elevator[i] thread elevator_think(); } elevator_think() { while (1) { self waittill ("trigger"); if (!level.elevatorMoving) thread elevator_move(); } } elevator_move() { elevatormodel = getent ("elevator", "targetname"); level.elevatorMoving = true; speed = 10; height =581; if (level.elevatorDown) { elevatormodel playsound ("elevator"); elevatormodel movez (height, speed); elevatormodel waittill ("movedone"); level.elevatorDown = false; } else { elevatormodel playsound ("elevator"); elevatormodel movez (height - (height * 2), speed); elevatormodel waittill ("movedone"); level.elevatorDown = true; } level.elevatorMoving = false; }
Complex Elevator
By MB
This elevator has doors on top floor and bottom floor to keep people out of elevator shaft. it also has doors that for the elevator to keep those who are inside...inside!!! this is more like a hotel elevator.
top left door = topleftdoor top right door= toprightdoor bottom left door= bottomleftdoor bottom right door = bottomrightdoor left inner door= leftindoor right inner door=rightindoor
use-touch trigger (4) = ups make your elevator...select all the brushes for it and make script - brushmodel. targetname - elevator
main() { level.elevDown=true; level.elevMove=false; switchTOP=getentarray("ups","targetname"); for(i=0; i<switchTOP.size; i++) switchTOP[i] thread elev_think(); } elev_think() { IdoorLEFT=getent("leftindoor", "targetname"); IdoorRIGHT=getent("rightindoor", "targetname"); OdoorTL=getent("topleftdoor", "targetname"); OdoorTR=getent("toprightdoor", "targetname"); OdoorBL=getent("bottomleftdoor", "targetname"); OdoorBR=getent("bottomrightdoor", "targetname"); thread door_open(IdoorLEFT, IdoorRIGHT, OdoorBL, OdoorBR); while(1) { self waittill ("trigger"); if(level.elevMove==false) { level.elevMove=true; thread elev_move(); } } } elev_move() { etime=5; zdirec="z"; zdist1=440; zdist2=-440; IdoorLEFT=getent("leftindoor", "targetname"); IdoorRIGHT=getent("rightindoor", "targetname"); OdoorTL=getent("topleftdoor", "targetname"); OdoorTR=getent("toprightdoor", "targetname"); OdoorBL=getent("bottomleftdoor", "targetname"); OdoorBR=getent("bottomrightdoor", "targetname"); Elevator=getent("elevator", "targetname"); if(level.elevDown==true) { door_close(IdoorLEFT, IdoorRIGHT, OdoorBL, OdoorBR); wait(.1); Elevator thread move_func(zdist1, etime, zdirec); IdoorLEFT thread move_func(zdist1, etime, zdirec); IdoorRIGHT thread move_func(zdist1, etime, zdirec); Elevator waittill ("movedone"); door_open(IdoorLEFT, IdoorRIGHT, OdoorTL, OdoorTR); level.elevDown=false; level.elevMove=false; } else { door_close(IdoorLEFT, IdoorRIGHT, OdoorTL, OdoorTR); wait(.1); Elevator thread move_func(zdist2, etime, zdirec); IdoorLEFT thread move_func(zdist2, etime, zdirec); IdoorRIGHT thread move_func(zdist2, etime, zdirec); Elevator waittill ("movedone"); door_open(IdoorLEFT, IdoorRIGHT, OdoorBL, OdoorBR); level.elevDown=true; level.elevMove=false; } wait(.1); } door_close(leftIN, rightIN, leftOUT, rightOUT) { LDclose=41; RDclose=-41; ydirec="x"; dtime=1.1; leftIN thread move_func(LDclose,dtime, ydirec); rightIN thread move_func(RDclose,dtime, ydirec); wait(1); leftOUT thread move_func(LDclose,dtime, ydirec); rightOUT thread move_func(RDclose,dtime, ydirec); wait(1); } door_open(leftyIN, rightyIN, leftyOUT, rightyOUT) { LDopen=-41; RDopen=41; ydirec="x"; dtime=1.1; leftyOUT thread move_func(LDopen,dtime, ydirec); rightyOUT thread move_func(RDopen,dtime, ydirec); wait(1); leftyIN thread move_func(LDopen,dtime, ydirec); rightyIN thread move_func(RDopen,dtime, ydirec); } move_func(dist,time,direc) { if(direc=="z") self movez (dist, time, (time/2), (time/2)); if(direc=="x") self movex (dist, time, (time/2), (time/2)); self waittill ("movedone"); }