Home   Help Search Login Register  

Author Topic: Static Machine gun watch the South please!  (Read 1557 times)

0 Members and 1 Guest are viewing this topic.

Offline Bennet

  • Members
  • *
Static Machine gun watch the South please!
« on: 15 Dec 2007, 05:03:08 »
 :)

Hello, long time fan of this site, just got ArmA and love it! (though I'm really looking forward to more addons, anyone know where I can get some good stuff?)

Here's my question.

I've made a mission and have successfully placed a static Russ machine gun inside of a building.  I want him to watch a particular direction (let's say 180), now I know how to initially force him to watch a particular direction but he always veers in other directions often with his ass hanging out of the window (g/f thought that was just hysterical, but I was irritated) now I've looked this up in the search but the only thing I can find is from an old Flashpoint post and when I put this into the init field on the soldier I get an error.  Here's the link:

http://www.ofpec.com/forum/index.php?topic=2424.msg16813#msg16813

This is what it says to enter:

"Getdir _X >= 230" Count ThisList >0 && "Getdir _X <= 290" Count ThisList >0

I replace the "_X" with the soldiers name, but the program won't have anything to do with it.


Please help!  I am an armature at best!


 
Bennet

"Mr. President, I'm not saying we won't get our hair mussed. I do say, no more than ten to twenty million killed, tops! Depending on the breaks."

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re: Static Machine gun watch the South please!
« Reply #1 on: 15 Dec 2007, 08:21:18 »
heya bennet :D good u started posting  :good:

da command u r looking for is dowatch  :D da code u have dere is used 4 somin else :P

how 2 use dowatch :

unitname dowatch objectname

unitname is da name of da soldier/MG/watever
objectname is da name of da object being watched

or u cud try

unitname dowatch [positionarray]

unitname is da name of da soldier/MG/watever
positionarray is an array (made from three paramaters i.e. [1000,482,0]) dat indicates position 2 b watched :D)

if u got ny other questions feel free 2 ask ;)

and

WELCOME 2 OFPEC AND DA SEWERS OF EDITING M8

:D :D :D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: Static Machine gun watch the South please!
« Reply #2 on: 15 Dec 2007, 14:35:36 »
you might try setformdir

that would make the unit face that way to begin with until an enemy is sighted, or will make the unit return to facing that way, but if you dont mind making a gamelogic as a target for dowatch, then it pretty much does the same thing,

this setFormDir 180

however this is used for groups, so if the unit is in a group, your best off using dowatch.
Campaigns are hard, I'll stick with scripting for now!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Static Machine gun watch the South please!
« Reply #3 on: 15 Dec 2007, 15:29:43 »
Code: [Select]
"Getdir _X >= 230" Count ThisList >0 && "Getdir _X <= 290" Count ThisList >0
I replace the "_X" with the soldiers name, but the program won't have anything to do with it.
OK, I think the previous posters answered your direct question, but I'd like to explain what the problem is here. Since the syntax has changed slightly from OFP to ArmA, you need to use curly braces in the example rather than quotes:
Code: [Select]
{ Getdir _X >= 230 } Count ThisList >0 && { Getdir _X <= 290 } Count ThisList > 0

This could also be simplified as:
Code: [Select]
{ (Getdir _X >= 230) or (Getdir _X <= 290) } Count ThisList > 0

What this does is activate the trigger if anyone inside it (thisList is an array of vehicles/people currently inside the trigger zone) is facing between 230 and 290 degrees (260 +- 30 degrees which is looking approximately West by South). What the "{} count array" does is put each member of the array into the code block as _X and count how many blocks are "true". e.g.
Code: [Select]
{ _x > 10 } count [1, 5, 20]

Would be 1, since the 20 is greater than 10, but the other numbers aren't. This would be sort of equivalent to:
Code: [Select]
total = 0; if { 1 > 10 } then { total = total + 1 }; if { 5 > 10 } then { total = total + 1 }; if { 20 > 10 } then { total = total + 1 }; total
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Bennet

  • Members
  • *
Re: Static Machine gun watch the South please!
« Reply #4 on: 15 Dec 2007, 20:25:30 »
Thanks for all the help guys, :D :good: out of simplicity I think I'll go with the game logic dowatch info.

But, just out of curiosity:

Spooner, I tried your code:

This code must be in a trigger, is that correct?  It can't be applied to the init field?
Bennet

"Mr. President, I'm not saying we won't get our hair mussed. I do say, no more than ten to twenty million killed, tops! Depending on the breaks."

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Static Machine gun watch the South please!
« Reply #5 on: 15 Dec 2007, 21:38:17 »
I was intending to explain the example code you were trying to use, rather than giving you something to actually answer your question. Yes, this was intended to be in the condition field of a trigger, so the trigger fired if anyone in the zone was looking in a certain direction (so helps you not a bit).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: Static Machine gun watch the South please!
« Reply #6 on: 17 Dec 2007, 17:08:47 »
and by the way Bennet a lot of great addons are at www.armedassault.info and other www.armaholic.com to juice up your Ofpec missions :)