Home   Help Search Login Register  

Author Topic: just wait already!!  (Read 1323 times)

0 Members and 1 Guest are viewing this topic.

Offline ONoSixIsDown

  • Members
  • *
just wait already!!
« on: 13 Jan 2006, 16:45:35 »
 >:(


ok heres the deal... i found a script here that is supposed to make a vehicle stop at a waypoint, wait untill all members of a group are aboard then go about it buisness...

well, when i implemented it into my mission, it just does not seem to work correctly.  


heres the script (named bradwait.sqs)
Quote

; BEGIN
_vehicle = _this select 0

; loop until all of the players squad have got in
#for1

~0.5

; make the vehicle wait until the whole squad is in
_lead = leader player
_playerArr = units group _lead
_num = count _playerArr

_incount = 0
_tmp = 0

#for2
? vehicle (_playerArr select _tmp) == _vehicle: _incount = _incount + 1
? _tmp < (_num - 1) : _tmp = _tmp + 1; goto "for2"

? _incount != _num : goto "for1"

; the vehicle will move off on it's waypoints
_vehicle setfuel 1

; END SCRIPT


first, i put a logic(named bradlogic) at the move waypoint where i want the vehicle(named brad) to stop and wait for the group to board.  I then made a trigger with these parameters

condition: brad distance bradlogic <5

activation: brad setfuel 0; [brad] exec "bradwait.sqs" this is how i get the vehicle to stop at the move waypoint...

from what the script tells me is that once the vehicle is out of fuel it will then be refueled once all the members of a group are aboard.  now i did see that part at the top of the script that says "_vehicle = _this select 0" but i didn't see an array thingy ??? that specifies the group that is to get in....  :help:

sorry for the long winded post... just trying to explain as best i can
« Last Edit: 13 Jan 2006, 16:48:04 by OhNoSixIsDown »
CRIMSON REIGN COMMING..... eventually :/

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:just wait already!!
« Reply #1 on: 13 Jan 2006, 17:48:22 »
Isn't this bit the array of the groups units, in this case it is referring to the players group?:

Code: [Select]
; make the vehicle wait until the whole squad is in
_lead = leader player
_playerArr = units group _lead
_num = count _playerArr
...
...
...


Planck
I know a little about a lot, and a lot about a little.

Offline ONoSixIsDown

  • Members
  • *
Re:just wait already!!
« Reply #2 on: 13 Jan 2006, 18:04:01 »
i thought so but was thrown off by the lack of a "select this"... would i need to call the script like this?

  activation: [brad,player] exec "bradwait.sqs"


CRIMSON REIGN COMMING..... eventually :/

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re:just wait already!!
« Reply #3 on: 13 Jan 2006, 18:28:24 »
I'm sure you don't need a big script to get a vehicle to wait. Surely there's a simple way. I'll try.

I'll assume the vehicle isn't the player's and also that it isn't in your group.

Vehicle gets to waypoint.

Code: [Select]
[] exec "BradWait.sqs"
In BradWait.sqs.

Code: [Select]
Brad SetFuel 0

#Loop
? Not (MyGroup In Brad): GoTo "Loop"
GoTo "Fuel"

#Fuel
Brad SetFuel 1
Exit

You might want to check the bit where it checks for the group, it may be wrong.
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Trapper

  • Honoured Contributor
  • ***
  • I'm a llama!
Re:just wait already!!
« Reply #4 on: 13 Jan 2006, 18:29:15 »
The current script (first post) is able to stop any vehicle you wish but only for the player's group.
« Last Edit: 13 Jan 2006, 18:30:12 by Trapper »

Offline ONoSixIsDown

  • Members
  • *
Re:just wait already!!
« Reply #5 on: 13 Jan 2006, 19:06:59 »

Code: [Select]
[] exec "BradWait.sqs"
In BradWait.sqs.

Code: [Select]
Brad SetFuel 0

#Loop
? Not (MyGroup In Brad): GoTo "Loop"
GoTo "Fuel"

#Fuel
Brad SetFuel 1
Exit

You might want to check the bit where it checks for the group, it may be wrong.

tried it and got an error saying "gereric error in expression"... what ever that means :-\

any other ideas?
CRIMSON REIGN COMMING..... eventually :/

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:just wait already!!
« Reply #6 on: 14 Jan 2006, 01:58:05 »
Can you give the error exactly?   Including the #, which usually marks exactly where in the code the error occurs.
Plenty of reviewed ArmA missions for you to play

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:just wait already!!
« Reply #7 on: 14 Jan 2006, 03:27:12 »
you need to name the group you're waiting to get in named mygroup

althought i do spot an error:
Code: [Select]
? Not (MyGroup In Brad): GoTo "Loop"
you have to check for each unit in the group individual


Code: [Select]
_All_In = true
"?! (_x in brad):_All_In = false" foreach mygroup
?!_All_In:goto "loop"

although looking at the original script, it should work, so long as its a player group

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:just wait already!!
« Reply #8 on: 14 Jan 2006, 10:45:53 »
Sometimes a group will still contain dead units - for a while until the leader knows they are dead.  For that reason I would do something like this in a script:
Code: [Select]
@({_x in Brad} count units mygroup == {alive _x} count units mygroup)
In a waypoint condition field the following will do it:

{_x in Brad} count units mygroup == {alive _x} count units mygroup

Putting it in the condition field of a waypoint means the vehicle will wait at the waypoint until the condition is true and so you do not need to play around with fuel levels and you don't need a script!  All you need is that one line in your waypoint (it replaces the word 'true')

See attached missionette
« Last Edit: 14 Jan 2006, 11:24:37 by THobson »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:just wait already!!
« Reply #9 on: 14 Jan 2006, 13:18:47 »
The reason for the new post is that I want to attach a new file.  

As I was stepping away at the gym earlier it occurred to me that there was a subtle problem with the solution I posted above.  That solution counts the number of units that are in the Bradley and compares it with the number of units that are alive.  There may be a problem if one of the units in the Bradley is dead.  The following is a better line to put in the waypoint condition field:

{(alive _x) and not (_x in Brad)} count units mygroup < 1

What this does is counts the number of living units that are not inthe Bradley and allows the vehicle to continue once that count is < 1

Offline ONoSixIsDown

  • Members
  • *
Re:just wait already!!
« Reply #10 on: 16 Jan 2006, 23:14:07 »
thanks, works great now ;D
CRIMSON REIGN COMMING..... eventually :/