Hi,
I'm working on a scripted searchlight. I'm using the new AEF reallights addon and the mapfact barracks.
The searchlight is based on a M2 machinegun, but you can't board it for some reason. When I debug the crew it returns a NULL object, but there is really someone there, cos when I fire at the searchlight the light goes out, so there is something with brain (but he's invisible) in there because his behaviour changes from SAFE to AWARE. Even when I place an empty searchlight on the map, I still can't board it.
In my searchlight script I make the light turn via a setdir loop in random steps (max 40 degree) and I put a lookout behind it. The lookout is always watching in the same direction of the lightbeam.
That works fine now, and it looks pretty good, but still in Alpha phase
Next thing I want to add is that when the lookout spots an enemy he takes his weapon and the light turns in the enemies face and follows it while the lookout still watches in the same direction
I'm using GB findunits function for it. I have used it before with succes, but here it fails and I don't know why.
(I already emailed GB)
;[name of the searchlight, name of the lookout, array of unit to detect] exec "Search.sqs"
_SL = _this select 0
_lookout = _this select 1
_enemylist = _this select 2
_inrange = []
_range = 50
[_SL,_lookout] exec "putbehind.sqs"
_SL setbehaviour "safe"
_lookout setbehaviour "SAFE"
~1
; start the searchloop, the light will move in random steps (40degree max) , the lookout will watch in the lightbeam
#SEARCH
? behaviour _lookout != "SAFE" : goto "find_enemy"
?!alive _unit: hint "exit";exit
_gdir = getdir _SL
~0.5
_newdir = (_gdir + 40 - random 80)
?_gdir < _newdir : _turn = 1
?_gdir > _newdir : _turn = -1
[units _lookout, _newdir] call WatchDirection
#Turnlight
   ? behaviour _lookout != "SAFE" : goto "find_enemy"
   ?getdir _SL > 360 : _gdir = _gdir- 360
   ?_turn == 1 : _gdir = _gdir + 1
   ?_turn == -1 : _gdir = _gdir - 1
   _SL setdir _gdir  Â
~0.05
   ?(abs(_newdir - _gdir)) > 5 :goto "turnlight"
goto "SEARCH"
#find_enemy
_lookout setbehaviour "AWARE"
_lookout setunitpos "UP"
; here it comes...
_inrange = [_lookout,_range,_enemylist, false] call findunits
?count _inrange > 0 : player globalchat "OK"
The OK message never shows up while I'm within 50m distance of the lookout, I don't get it.
What the hell is wrong?
Please help
You can dl the testmision + needed addons (mapfact barracks & AEFreallight new version! ) on my webspace
http://users.telenet.be/blanco/Scripts/SL.ZIP