For some reason, my screenshots are always darker when I take them with printscreen. When I ALT-TAB to desktop to see them, they look good, but when I exit OFP all the pitures I took become a lot darker;
Anyway, I took some new screens + the very neat mgspot-script from Sui with a small modification by me..
Maybe there's something wrong with it, I'm not a very good scripter...
As you can see the tablelamp is in the right position as long as there no object underneath it.
Why's that?
It's amazing to see what people try to simulate a searchlight euh?
Common, great addonmakers, please give us a searchlight...
AFAIK you can't place a light on a barrel, so Ai or player can't use it, .We can use the mgspot.sqs to make it turn, it's better than nothing
; -- MG Searchlight Script --
; Written by Sui
; Execution line:
; [MG,Left arc limit, right arc limit] exec "spot.sqs"
; eg. [mgun1,90,270] exec "spot.sqs"
; -- Selects the arguements: [Machinegun, left limit of search arc, right limit of search arc]
_mg = _this select 0
_llimit = _this select 1
_rlimit = _this select 2
; -- Set the variable that calls the 2nd loop (to track the player)
detected = false
; -- sets the initial direction of the MG inbetween the two limits
_newhdg = (_rlimit + _llimit)/2
;;=============================================
;;YOU NEED REALLIGHTS.PBO FOR THIS!!!
;;=============================================
_sp = "LRLDeskWhite" createvehicle getpos _mg
=============================================
_xpos = getpos _mg select 0
_ypos = getpos _mg select 1
_zpos = getpos _mg select 2
;;===================================================
;;Tablelamp position
;;===================================================
_sp setpos [_xpos,_ypos,(_zpos) +0.8]
;;=======================================================
;; it looks better when the tablelamp don't shine imho
;;=======================================================
;_sp inflame true
; -- First loop... random searchlight movements
#searchloop
~0.05
; -- finds the direction of the MG relative to a random heading between the arc limits
; -- If the MG's heading is within 10 degrees of the random heading, it chooses a new random heading
? (getdir _mg - _newhdg) < 10 and (getdir _mg - _newhdg) > - 10: _newhdg = ((random (_rlimit - 90)) + _llimit)
? (getdir _mg - _newhdg) > 0: _mg setdir ((getdir _mg) - 1)
? (getdir _mg - _newhdg) < 0: _mg setdir ((getdir _mg) + 1)
; -- find the direction of the player relitive to the MG
_dirplr = ((getpos player Select 0) - (getpos _mg Select 0)) ATan2 ((getpos player Select 1) - (getpos _mg Select 1))
? _dirplr < 0: _dirplr = _dirplr + 360
? _dirplr > 360: _dirplr = _dirplr - 360
;;=====================================
;;update the direction of the tablelamp
;;=======================================
_sp setdir getdir _mg +90
;;=====================================
; -- If the player is within 5 degrees of the MG's heading (in the searchlight) and the MG knows the player
; -- is there, the alarm is tripped
? (getdir _mg - _dirplr) < 5 and (getdir _mg - _dirplr) > - 5 and (_mg knowsabout player > 1): detected = true
; -- If the player hasn't been detected, and the MG still has an alive gunner, the loop repeats
? not (detected) and ((count crew _mg) > 0): goto "searchloop"
; -- Second loop... tracks the player with the searchlight
#detectedloop
~0.05
; -- finds the bearing from the MG to the player, and makes sure it is within range (0 - 360)
_newhdg = ((getpos player Select 0) - (getpos _mg Select 0)) ATan2 ((getpos player Select 1) - (getpos _mg Select 1))
? _newhdg < 0: _newhdg = _newhdg + 360
? _newhdg > 360: _newhdg = _newhdg - 360
; -- Moves the direction of the MG depending on the bearing to the player
? (getdir _mg - _newhdg) > 0: _mg setdir ((getdir _mg) - 2)
? (getdir _mg - _newhdg) < 0: _mg setdir ((getdir _mg) + 2)
; -- If there is still a live gunner manning the MG the loop goes around again
? (east countside (crew _mg) > 0): goto "detectedloop"