OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: R0adrunner on 16 Feb 2007, 00:08:11

Title: Moving searchlight??
Post by: R0adrunner on 16 Feb 2007, 00:08:11
Is there anybody who know how to get the searchlight to move from left to right and back, and repeat it constantly? ???

Title: Re: Moving searchlight??
Post by: Cheetah on 16 Feb 2007, 00:22:29
I'm almost sure that Mandoble posted a script with a moving searchlight, can't find the post so it'll probaly be gone after recent downtime.

I'll do my best to find it on the net/in the archive on OFPEC, but maybe mandoble (think it was him) has the script on his pc and is willing to attach it to a reply.
Title: Re: Moving searchlight??
Post by: Mandoble on 16 Feb 2007, 09:17:32
Well, what I had is the moving (turning) light source of a lighthouse for OFP.

Code: [Select]
_dir = 0.0
#girar
?_dir > 360: _dir = 0
_dir = _dir + 5
~0.05
_pos = [(getPos faro select 0) + sin(_dir)*1.5, (getPos faro select 1) + cos(_dir)*1.5, 10]
luzfaro setPos _pos
luzfaro setDir (_dir+180)
goto "girar"
exit

luzfaro is the lightsource object (Mikero's editor update 103 Large White Flare type), faro is the lighthouse (Mikero's editor update 103 Stone Lighthouse type).

No idea about ArmA searchlights  :dunno:
Title: Re: Moving searchlight??
Post by: messiahua on 16 Feb 2007, 10:52:41
[name of the searchlight] exec "randomwatch.sqs"
Title: Re: Moving searchlight??
Post by: Planck on 16 Feb 2007, 21:37:37
Classname of the ArmA searchlight is "Searchlight".    :cool2:

However in-game you can give it a name in the name field....a name of your choosing.


Planck
Title: Re: Moving searchlight??
Post by: R0adrunner on 17 Feb 2007, 01:55:48
[name of the searchlight] exec "randomwatch.sqs"

Thanx,  that was perfect :good:

Title: Re: Moving searchlight??
Post by: genji on 17 Mar 2007, 17:52:38
nice script you posted Messiah

can it be made so that the searchlight seeks searching in one 180 degree arc, so that it basically is searching in just one direction?javascript:void(0);
Scratch Chin
Title: Re: Moving searchlight??
Post by: F2kSel on 18 Mar 2007, 15:44:31
A few years back I got the MC_Gunner to look left and right using a couple of game logic's and two triggers, from memory I thought I'd try it again and got it to work,it does work for the Searchlight but maybe not quite aswell as he seems to want to return to centre again but at least it moves.

I also used the script above but it didn't seem to work very well, it was very hit and miss.

Another method I tried  was to place two Game logics and just use a script forcing it to target alternate Game logics but again didn't seem to work as well as it should.

I'd like to move it to script so I can pass arrays so I don't have to do them one by one but time amd memory are not helping as I haven't run OFP for a few years.
Title: Re: Moving searchlight??
Post by: Blanco on 18 Mar 2007, 18:45:34
@genji

Lol, that' searchlight thingy was my first Arma script and just a test.

I will modify it so the user can define a searching arc or optional random.
But don't expect it this week, I'm too busy atm.
Someone else may modify it aswell offcourse, it's not that hard.
Title: Re: Moving searchlight??
Post by: ghost60 on 20 Mar 2007, 10:01:40
This is probably a bad way compared to others but this is how i did it.
You can either use a gamelogic or a unit to man the search light
Code: [Select]
;[unit, object, target1, target2] exec "search.sqs"
if !(local server) then {exit}
_unit = _this select 0
_object = _this select 1
_target = _this select 2
_target2 = _this select 3
#loop
? !(alive _object): {exit}
_unit dotarget _target
~6
? !(alive _object): {exit}
_unit dotarget _target2
~6
goto "loop"
The unit is of course the unit manning the searchlight. The object is the searchlight. Target and Target2 are empty markers that the searchlight targets. Then when the searchlight is "dead" the script exits. I though about puting in a line that sees what time it is and if it is daytime then exit, or pause ie
Code: [Select]
& _time >19not sure if this would work for when it becomes daytime but i was thinking of using
Code: [Select]
if _time > 7 then {exit} Well hope that helps. Again im sure this way sucks but i thought i would add my 2 cents.  :D
Title: Re: Moving searchlight??
Post by: Cheetah on 20 Mar 2007, 15:31:36
As far as I know, the _time variable can be used to determine how long a script has been running. It's probably in seconds too. So you can't think of it as an absolute value to determine if it's day or night. You'd have to use other commands or methods to incorporate such thing in a script. Or of course get every mission editor to set the mission starting time to 0:00, which is quite hard to achieve among the community ;).
Title: Re: Moving searchlight??
Post by: satexas69 on 21 Mar 2007, 00:03:46
Messiah,

Found a way to use that on a OPFOR (east) unit...

create EMPTY searchlight (NAME: SL2), added OPFOR unit (NAME: lampgunner2)

And in unit's INIT:    lampgunner2 moveingunner sl2


Also, for those using script and don't know scripting - when you put it in use, recommend you remove or "comment out" the "HINT" lines - so you don't have to get that text on your screen....

Also - when the unit dies using the opfor method, searchlight stays ON.. any way to turn it OFF if unmanned via the script?
Title: Re: Moving searchlight??
Post by: Blanco on 21 Mar 2007, 21:21:46
Quote
Also - when the unit dies using the opfor method, searchlight stays ON.. any way to turn it OFF if unmanned via the script?

Well, that a feature of the script...
If you don't want it delete all code below the #unitdied label and change :

Quote
?!alive gunner _unit : goto "unitdied"

into

Quote
?!alive gunner _unit : exit


Title: Re: Moving searchlight??
Post by: satexas69 on 22 Mar 2007, 15:49:24
After further playing with it - I like that it survives...

If you shoot the man "manning" it, it says on, but doesn't rotate. That's realistic.

If you want the light off, you have to shoot it out... easier to shoot in the glass to kill it versus shooting the backside of the cannister... also realistic.

Good job.... it's neat.

I like the way it plays just enough hell on the nightvision, making you having to deal with them on night missions if used correctly.
Title: Re: Moving searchlight??
Post by: The Unknown on 14 Apr 2007, 16:29:30
Blanco could you give us a update on how far you are with the searchlight script?
Title: Re: Moving searchlight??
Post by: Blanco on 15 Apr 2007, 20:29:40
Sorry, I don't have the time anymore...
A guy named Cloughy is working on it.

http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=76528fc5c5948e2a10c053382f09d879;act=ST;f=71;t=60032