How to Make Controllable Security Cameras: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Hendricks266 (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
This code was originaly posted by James AKA JBlade on AMC, It can be placed into any GAME.CON | This code was originaly posted by James AKA JBlade on AMC, It can be placed into any GAME.CON | ||
//The following gets the camera's extra value into a variable, than sets it to 0 to avoid any possible glitches | // Stick this anywhere | ||
eventloadactor CAMERA1 getactor[THISACTOR].extra EXTRASAVED setactor[THISACTOR].extra 0 enda | gamevar EXTRASAVED 0 2 | ||
gamevar TEMP 0 0 | |||
gamevar TEMP2 0 0 | |||
gamevar TEMP3 0 0 | |||
gamevar TEMP4 0 0 | |||
// 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. | Thanks to James for the code. | ||
[[Category: Tutorials]] | [[Category: Tutorials]] |
Latest revision as of 17:09, 14 July 2012
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 0 gamevar TEMP2 0 0 gamevar TEMP3 0 0 gamevar TEMP4 0 0 // 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.