Home   Help Search Login Register  

Author Topic: Helo S&D waypoints not very effective!  (Read 5096 times)

0 Members and 1 Guest are viewing this topic.

Offline Burn

  • Members
  • *
Re:Helo S&D waypoints not very effective!
« Reply #15 on: 05 Jan 2004, 14:50:37 »
Quote
One thing I am curious about is the _loonsleft line.  I couldn't find `left' in the scripting command reference guide (you know, the big alphabetical one) but am I right in assuming you can use it for any array?  And does the script as it stands automatically deduct item 0 from the list using _loonsleft-1 when the target's been killed, so that the previous item 1 becomes the new item 0?
No see I used that _loonsleft-1 line with the count command that counted the units in the trigger that was listed in the _lonsleft array, and when there was no more units in the array the script would exit... ::) atleast that was the idea ;D :P

see, this [a,b,c,d,e,f] is an array

then I defined it as an local variable to ease scripting like so: _loonsleft = [a,b,c,d,e,f]

the array becomes _loonsleft.

Quote
Anyway, for the time being, given the pilot's lack of enthusiasm for the business of war, I intend to short-circuit the whole business by having the UH60 join the players team upon arriving.  That way the player can direct it to attack whomsoever he wants.  I'll see if I can get them to at least do that.
Hope that works out for ya. :D But I'll try to work something my self to see if I can't get this damn script to work or atleast create a workaround. ;) And hey, on the positive side atleast you've learnt something of this... so atleast you wont walk out of this empty handed :D ;D. Good luck m8. 8)

Pipski

  • Guest
Re:Helo S&D waypoints not very effective!
« Reply #16 on: 05 Jan 2004, 15:01:35 »
lol, I'm a numpty, I missed out the `count' command line when I first typed the script!  I shall pop it in and see if it makes a difference (though it shouldn't affect the attack aspects until the first loon is dead anyway).  So _loonsleft is a counting mechanism ... but in that case what prompts the script to move on from killing loon0 to killing loon1, 2 etc. ?  `Cause after it cycles back to #update it gets orders to doTarget _loons select 0.  Won't that make it keep on trying to slot the same dude?

Offline Burn

  • Members
  • *
Re:Helo S&D waypoints not very effective!
« Reply #17 on: 05 Jan 2004, 15:09:11 »
no. U see the line: _loons select 0?!
remember that I told u that _loons was an array?!
well what select 0 does is that it selects the first element in an array. 0 = first, 1= second etc...
did that clarify things alitle :)?!?...
Sorry for not explaining this erlier ;D.


Pipski

  • Guest
Re:Helo S&D waypoints not very effective!
« Reply #18 on: 05 Jan 2004, 15:19:53 »
 ???  Right, I get that bit.  Select 0 makes it select the 0th (i.e. first) unit in the array.  But what makes it select the 1st (i.e. second) unit in the array in this script?  After select 0 has made the script run doTarget and doFire on the first unit the array, it cycles back to #update and runs that bit again.  

Update

~1

? (_loonleft == 0) : goto "Done"

GBlackhawk dotarget _loons select 0
GBlackhawk dofire _loons select 0
_health = getDammage _loons select 0
@ _health == 0

_loonleft = loonleft_ -1

goto "Update"

But when it runs it again, when it comes to `dotarget _loons select 0' how does it know not to try and reselect the first element in the array again (the one that it's already killed?  Supposedly.  If the sods were actually up to killing anything!)?

Sorry for the endless stream of questions but I get the feeling that if I can get my head `round the one script then I should hereafter be able to get my head `round pretty much all of them!  btw, is this kind of scripting at all similar to Perl?

Offline Burn

  • Members
  • *
Re:Helo S&D waypoints not very effective!
« Reply #19 on: 05 Jan 2004, 15:33:42 »
Quote
Right, I get that bit.  Select 0 makes it select the 0th (i.e. first) unit in the array.  But what makes it select the 1st (i.e. second) unit in the array in this script?
I was hoping that tis would do that:

#Update

_loons = list triggername

_loonleft = count units _loons

...every time when a soldier in the arry is killed the arry should shange and make the chopper target another unit, because of this "update" every time the script loops...
Quote
Sorry for the endless stream of questions but I get the feeling that if I can get my head `round the one script then I should hereafter be able to get my head `round pretty much all of them!
Don't you worry about that, that's what the forums are for, ask away ;D ;)
Quote
btw, is this kind of scripting at all similar to Perl?
LOL :D... I would't really know as, besides OFP scripting the only scripting language I know is CNC scripting... ya know those BIG computer operated metal prosessing machines (or whatever the hell theyr'e called in english).   ::) :P
« Last Edit: 05 Jan 2004, 15:39:30 by Bizon »

Pipski

  • Guest
Re:Helo S&D waypoints not very effective!
« Reply #20 on: 05 Jan 2004, 15:46:31 »
Of course it would!  I get it.  Although ... hang on, that would work fine if the .sqs was executed by a trigger, say an "East" "present" trigger.  `Cause after a loon died they wouldn't show up to that trigger - being no longer present.  But seeing as I've got a list of entities triggering mine, [Crewski, RPGski et al.], will that still work?  My .sqs is triggered by the units listed in the On Activation box of the waypoint.  If one of them is dead will they be automatically ignored by the exec command?  And removed from the array if they get killed after it's exec'd?

Pipski

  • Guest
Re:Helo S&D waypoints not very effective!
« Reply #21 on: 05 Jan 2004, 17:31:24 »
Right, one big step forward, two steps back!  For a start I think I might know why the script didn't seem to be making an humongous difference to the choppers behaviour - it wasn't actually being run!  The `On Activation' box for waypoints only seems to be run when the vehicle moves on to the next wp and I had the exec command on the On Activation box of a waypoint that isn't left until all the loons are dead!  Therefore, it wasn't being run until all the targets were slotted anyway!  Have moved it to the wp before and it's being run now.

However, I keep getting errors with it.  This line seems to give it problems:
"BlackhawkG reveal _x" forEach _loons
... and I can't see why.  As far as I can tell the format is correct.  

If there is an error with a script is the rest of the script still run or does it abandon the script altogether?

Also, I can't seem to get the helo to join my team.  Have been typing BlackhawkG join group phil (where phil is the name of the player unit), which has worked fine for ground units.  Blackhawk join (without the G/D)doesn't work either.  Is it because the gunner/driver were created together with the Blackhawk as one unit, rather than me creating an empty Blackhawk and two pilots and bundling the pilots into it?  

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Helo S&D waypoints not very effective!
« Reply #22 on: 05 Jan 2004, 18:09:53 »
I'm no scripter and I haven't looked at this in detail but it looks like you're missing a line before the loop starts:-

_loonsleft = count units group _loons

Syntax not guaranteed and that may not even be what you need.  

_loonsleft is just a local variable.    If you can't find a command in the command ref, then it doesn't exist.

(I've just noticed that you've deleted your earlier reply and replace it with this new one)

If a script gets an error in general the script will pack up and go home.

For vehicles you have to get the crew to join your group individually.   Don't forget the square brackets [ ]

forEach requires an array so _loons should be an array.   If _loons is a group then it should be

... forEach units _loons

You are correct, the on activation box in waypoints fires when the waypoint is completed, not when the unit arrives there.
Plenty of reviewed ArmA missions for you to play

Pipski

  • Guest
Re:Helo S&D waypoints not very effective!
« Reply #23 on: 05 Jan 2004, 18:29:04 »
Cheers Mac.  I'm actually quite proud of myself `cause I managed to straighten out the script problem I was having (all to do with arrays instead of objects).  I have also added a move waypoint exclusively for the purposes of activating the script.  The waypoint after it is the S&D one so, in theory, the helo will activate the script at the move waypoint and, upon completing it, fly to the S&D.  At the mo' when it reaches the move waypoint it just stops there and hovers.  If it wasn't executing the script it would move on so it must be running it, it's just not doing much!  For some reason the doTarget and doFire aren't happening.  The activating code is [Crewski, MGski, RPGski et al.] exec Blackhawkstargets.sqs.  The script as it stands at the moment is:

_loonsleft = count _this               (i.e. total number of targets)

#Update

_loons = _this select 0                 (so _loons=1st thing in array, right?)
_health = getDammage _loons    (and it's health becomes _health)
~1                                                (wait a second)

? (_loonsleft == 0) : goto "Done" (once all targets dead go to the end)

Blackhawk reveal _loons              (so he knows where the suckers are)

BlackhawkD dotarget _loons        (driver should target him)
BlackhawkG dotarget _loons        (so should gunner)
BlackhawkG dofire _loons             (then ventilate him)
@ _health ==0                              (until his health is zero?)
_loonsleft = _loonsleft - 1             (whereupon loonsleft is reduced)

goto "Update"                               (and the whole business recommences)

#Done
exit

The bit I'm really not sure about is @ _health == 0.  Will the gunner actually repeat firing until the loon is dead or will he just fire once and then wait for the guys health to reach zero by some other means?

Other than that I can't see any reason why it wouldn't work great.

Offline Burn

  • Members
  • *
Re:Helo S&D waypoints not very effective!
« Reply #24 on: 06 Jan 2004, 00:34:58 »
This script works because I tested it myself, pretty damn sweet to se the mg on the uh-60 actually fire for once :D. Theres one thing that needs to be change IMO, and that is the movement... the helo just hovers at one spot until the unit is dead and the moves to the next... it would be cool to make it hover in circles around the target. Maby I'll do that later ;)

And sorry for the late reply :P... (wus watching a movie I dl'd :))

heres the script...
=====================================================
You need a helicopter named helo and a trigger named trigg.
Set the trigger up to be activated by the anemy, and you can make the trigg any type you want...
in the trigg's on activation field put [] exec "killer.sqs"
then make a text file named killer.sqs
=====================================================
*****************           killer.sqs      ***************************
=====================================================
copy the following code into the text file...
=====================================================
heli setbehaviour "careless"
heli setspeedmode "limited"

_loons = list trig

"helo reveal _x" foreach _loons

~0.5

#Update

_loonleft = count _loons

~1

? (_loonleft == 0) : goto "Done"

_dude = _loons select 0

heli domove [(getpos _dude select 0),(getpos _dude select 1)+20]
~1
heli flyinheight 10

heli dotarget _dude
~5

heli dofire _dude

~2

heli domove [(getpos _dude select 0),(getpos _dude select 1)+20]

_health = getDammage _dude

@ _health == 0

_loonleft = loonleft_ - 1

_loons = list trig

goto "Update"

#Done
exit
=====================================================
cheers m8 8)

[edit]
Any probs or q's please ask. If you don't get it to work I could host a samplemission for you. ;D

oh and the fly in height is to alter the flight-height in meters, to help the nearly blind gunner spot his enemies... change the value (10) if the helo crashes or you culd even try to remove it if nessecary :-X

[edit#2]
oh and remember to make the trigger as large as you need the area of available CloseAirSupport to be, I.e. the HOSTILE area...
And one final thing, it isn't possible to setpos or camCreate a trigger is it ???
If that was possible, you could make a smaller trigg, and setPos it with onMapSingleClick command... so you could divert the chopper to ANY hostile spot on the map just by clickin' on it :D... But for now just place the triggers over desiered hotSpots (yes you can make more than one ;D) and makem' radio triggers so you can activate them when desired ;)
« Last Edit: 06 Jan 2004, 05:08:21 by Bizon »

Pipski

  • Guest
Re:Helo S&D waypoints not very effective!
« Reply #25 on: 06 Jan 2004, 12:04:49 »
Jeepers Biz, this script is the biz!  (As good as anything by BIS!)  Works like a dream.  

I suspect the reason the previous ones didn't was the flyinheight.  Stupid command reference says the accepted values are 50-200!  It works fine at 10 or 15 but at 20 the copter starts having trouble locating its targets and tends to just sit still trying to work out where they are.  This is a bit of a bugger as at 15m I now have to rejig the mission to keep the daft ha'porth out of the trees   ::).  Still, I'm pretty sure I can manage that just by shifting the triggers around.  

The other bijou problemette is that he's now so lethal that I have to find a way of getting the player to take some loons out the old fashioned way, rather than letting the helo do all the work!  (This is not a complaint though, that bit's easy.  As it stands if there's an enemy AA or even an MGer they very quickly take the chopper down.)  It would be handy though if there were a way of setting the trigger to only detect certain loons, rather than "present" "East"?  

The only line in the script that foxes me is the second heli domove.  The first one is before the dotarget and dofire and will put the chopper in a good position to slap the loon, then it appears again after the dofire but before the getDammage.  I can't work out why it's needed but it seems to be vital because without it the copter only engages one loon and then freezes.  ???

Anyways, many thanks for the script, I will probably spend the rest of the morning sitting watching it in action!  And maybe writing a no fly zone script to keep the swine away from the foliage!

Cheers!   8)

Offline Burn

  • Members
  • *
Re:Helo S&D waypoints not very effective!
« Reply #26 on: 06 Jan 2004, 19:06:58 »
Thanks :)

If you're havin' trouble with the chopper crashing all the time try removing the flyInHeight command, and alter the following line...

heli domove [(getpos _dude select 0),(getpos _dude select 1)+20 ]

Change the number 20 to a higher number. It will make the chopper move further away from the target anabeling him to target him more easily... I think ;D.

Quote
The other bijou problemette is that he's now so lethal that I have to find a way of getting the player to take some loons out the old fashioned way, rather than letting the helo do all the work!
lol ;D

Quote
It would be handy though if there were a way of setting the trigger to only detect certain loons, rather than "present" "East"?
try changin it to detected by west... that way the helo only attacks loons any given west soldier knows about ;)

You may alter the script in any way you like, to fit your needs :joystick:

happy editing m8  :cheers:

[edit]
The script still has many limitations, bugs and atleast one typo ::)
I'll fix that later... but right now I don't have the time. C ya l8r :-* ;D
« Last Edit: 06 Jan 2004, 22:32:26 by Bizon »

zorbasphere

  • Guest
Re:Helo S&D waypoints not very effective!
« Reply #27 on: 24 Jan 2004, 00:29:20 »
Hi, I tried killer.sqs, and i have a BAS DAP called heli ,a tank called loon and a tank called dude but it aint working. Whats the correct way to use this? Please help Ive been loking for this for a long time, and now Im so close... :-\

1. does the heli need waypoints?

Whats the deal with loons and dudes here? Which is what? Is a dude the subordinate unit in a "loon" group? Or how does this work?

My error is Error Type Any: Expected Number
« Last Edit: 24 Jan 2004, 00:38:10 by zorbasphere »

Pipski

  • Guest
Re:Helo S&D waypoints not very effective!
« Reply #28 on: 24 Jan 2004, 01:48:15 »
OK, I used it by having a wp (`Move') in the area I wanted the helo to go hunting in.  In the `On Activation' box I had a condition (called CAS) made true (CAS=true).  Then I put a trigger with CAS in the Condition box.  In the On Activation box of the trigger I put [] exec "killer.sqs".  (Sorry if this is all pretty obvious to you already, just want to be sure I don't miss anything out!).  

Therefore, the helo flies to its Move wp, CAS becomes true which activates the trigger and fires the script.  In my experience the helo then flies around looking for targets (with variable success) until all are dead, whereupon the script ends and it proceeds to its next wp (which is where my editing problems begin!   :'( ).  

[NB:  The script is presented above has an error in it:

_loonleft = loonleft_ - 1

should be _loonleft = _loonleft -1

so if you just copied and pasted that might be causing your problem?

re:  Dude vs Loon.  Bizon could probably explain this better but let's have a stab at it.  When the trigger containing [] exec "killer.sqs" goes off it feeds an array into the script.  e.g. if the trigger is set to `East' `Present' then the array will contain the names of all East units in the area set by the trigger's radius.  This array is called _loons.  
The first unit in this array (i.e. in the zeroth (for mathematicians and programmers) / first (for the rest of us) position) is designated as _dude thanks to this line:

_dude = _loons select 0

Thereafter when the script refers to _dude it is talking about the first unit to appear in the list generated by the trigger.  So getting _dude's position is the same as getting the first enemy units position, and so on.  The script cycles so that once a _dude has been targetted and killed the array as drawn up fresh.  As that unit will no longer be `present' (being dead) it won't appear again and the unit in the zeroth position will be a different one.  When there are no units left the line

? (_loonleft == 0) : goto "Done"

ends the looping and goes to the final bit of the script that ends it.  

Hope that explains it to some degree!  (As you can see from the length of this thread it took some time for me to get to grips with it  ;) ).

I'd say that if you want to see how the script should work you can go to www.freewebs.com/mistletoe and d/l the mission I put it in, but it's still not working perfectly as regards the helo.  If you want to try it then v1.02 is better than 1.03 for seeing the script in action (in 1.02 the script works fine, it's just the helo doesn't land when it should).  Hopefully next week or thereabouts 1.04 will be out and fully operational.


zorbasphere

  • Guest
Re:Helo S&D waypoints not very effective!
« Reply #29 on: 24 Jan 2004, 16:24:01 »
That sounds great, Ill try it.
But the reason I want to eve use it is for a very open & large map..the idea is to get the choppers to stop hover, acquire & and fire from very far away, as they would realistically, not go charging into a firezone with million dollar choppers)
ill give it a try and let you know