Home   Help Search Login Register  

Author Topic: Moving searchlight??  (Read 4871 times)

0 Members and 1 Guest are viewing this topic.

Offline R0adrunner

  • Members
  • *
Moving searchlight??
« 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? ???


Offline Cheetah

  • Former Staff
  • ****
Re: Moving searchlight??
« Reply #1 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.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Moving searchlight??
« Reply #2 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:

Offline messiahua

  • Members
  • *
  • Son of God
    • Armed Assault Ukraine
Re: Moving searchlight??
« Reply #3 on: 16 Feb 2007, 10:52:41 »
[name of the searchlight] exec "randomwatch.sqs"

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Moving searchlight??
« Reply #4 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
I know a little about a lot, and a lot about a little.

Offline R0adrunner

  • Members
  • *
Re: Moving searchlight??
« Reply #5 on: 17 Feb 2007, 01:55:48 »
[name of the searchlight] exec "randomwatch.sqs"

Thanx,  that was perfect :good:


Offline genji

  • Members
  • *
Re: Moving searchlight??
« Reply #6 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

Offline F2kSel

  • Members
  • *
Re: Moving searchlight??
« Reply #7 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.
« Last Edit: 20 Mar 2007, 13:47:24 by bedges »

Offline Blanco

  • Former Staff
  • ****
Re: Moving searchlight??
« Reply #8 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.
« Last Edit: 20 Mar 2007, 13:46:57 by bedges »
Search or search or search before you ask.

ghost60

  • Guest
Re: Moving searchlight??
« Reply #9 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

Offline Cheetah

  • Former Staff
  • ****
Re: Moving searchlight??
« Reply #10 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 ;).
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline satexas69

  • Members
  • *
Re: Moving searchlight??
« Reply #11 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?
« Last Edit: 21 Mar 2007, 00:29:48 by satexas69 »

Offline Blanco

  • Former Staff
  • ****
Re: Moving searchlight??
« Reply #12 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


Search or search or search before you ask.

Offline satexas69

  • Members
  • *
Re: Moving searchlight??
« Reply #13 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.

Offline The Unknown

  • Members
  • *
Re: Moving searchlight??
« Reply #14 on: 14 Apr 2007, 16:29:30 »
Blanco could you give us a update on how far you are with the searchlight script?

Offline Blanco

  • Former Staff
  • ****
Re: Moving searchlight??
« Reply #15 on: 15 Apr 2007, 20:29:40 »
Search or search or search before you ask.