How to Make Controllable Security Cameras

From EDukeWiki
Revision as of 06:19, 14 August 2008 by The Commander (talk | contribs) (New page: This code was originaly posted by James AKA JBlade on AMC, It can be placed into any GAME.CON //Stick this anywhere gamevar EXTRASAVED 0 2 gamevar TEMP 0 2 gamevar TEMP2 0 2 gamevar TEMP3...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This code was originaly posted by James AKA JBlade on AMC, It can be placed into any GAME.CON

//Stick this anywhere gamevar EXTRASAVED 0 2 gamevar TEMP 0 2 gamevar TEMP2 0 2 gamevar TEMP3 0 2 gamevar TEMP4 0 2

//The following gets the camera's extra value into a variable, than sets it to 0 to avoid any possible glitches eventloadactor CAMERA1 getactor[THISACTOR].extra EXTRASAVED setactor[THISACTOR].extra 0 enda

onevent EVENT_GAME ifactor CAMERA1 { getplayer[THISACTOR].newowner TEMP ifvarvare TEMP THISACTOR { ifvare EXTRASAVED 1 // Delete this line if you want all cameras to be able to do this { getinput[THISACTOR].extbits TEMP2 ifvarand TEMP2 16 // If the player presses 'turn left' { getactor[THISACTOR].ang TEMP3 // Get the Camera's angle subvar TEMP3 16 // Turn it left (subtracting from an angle turns it left) setactor[THISACTOR].ang TEMP3 // Change it to the new value } ifvarand TEMP2 32 // If the player presses 'turn right' { getactor[THISACTOR].ang TEMP3 // Get the Camera's angle addvar TEMP3 16 // Turn it right (adding to an angle turns it right) setactor[THISACTOR].ang TEMP3 // Change it to the new value } getinput[THISACTOR].bits TEMP3 ifvarand TEMP3 8192 { getactor[THISACTOR].shade TEMP4 ifvarl TEMP4 124 { addvar TEMP4 4 setactor[THISACTOR].shade TEMP4 } } ifvarand TEMP3 16384 { getactor[THISACTOR].shade TEMP4 ifvarg TEMP4 -128 { subvar TEMP4 4 setactor[THISACTOR].shade TEMP4 } } } } } endevent

Thanks to James for the code.