Home   Help Search Login Register  

Author Topic: How to make a script to check/wait if/when a chopper has cargo? HELP  (Read 673 times)

0 Members and 1 Guest are viewing this topic.

makkaramies

  • Guest
hello  ;D

iÂ'm working with scripts that could make choppers to act more realistic and maby add some random events for the chopper, crew and possible cargounits.

i have done searching and read numerous tutes, but iÂ'm still meganoobie for sripting. I found few older scripts and modded them a little. tested and got quite good resuts. I promise to post them here when ready. But first i ned HELP from you .OK?

this is the chopper init field [heli1] exec "HEKODAMMAGESTART.sqs"
ItÂ's checking / waiting for the conditions, and launcing scripts.

all possible cargotroops will be using GET IN-waypoints for getting in.
chopper will use LOAD-waypoints for loading. ITÂ'S USERFRIENDLY ;D

heli1 is the choppername, and thats all the script knows knows.

_heli = _this select 0
_pilot = driver _heli
_gunner = gunner _heli

1. How can the script check if choper has cargo?

2. get the cargounits name or groupname if it finds unit in cargo?

3. Count cargounits and display the result(number) maby in the radio or hint text?
_pilot VehicleChat "cargo on board (heliname, howmanyinnumbers)"


iÂ'm loosing my mind here help...?
Relly messed up with the commands
? is IF am i right, and it still allows the script move on
! is NOT am i right,                          "
@ is WAIT am i right, it stops the script to wait
: is THEN am i right
; is AND am i right

 

OK. enough...  seeya :P

« Last Edit: 10 Mar 2005, 22:05:37 by makkaramies »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Investigate the command crew.   It will give you most of what you want.

To make a loon gunner use the commands moveInGunner, assignAsGunner and probably join.

Once you have an array of the loons in cargo you can grab one with [array] select i, where i is the number of the loon you want.

Read the section "Scripting Topics" in the command reference.     You are basically right.   In summary

? = if
: = then
@ = wait until this next bit is true
; = now execute the next command
! = not
&& = and
« Last Edit: 27 Feb 2005, 03:04:48 by macguba »
Plenty of reviewed ArmA missions for you to play

makkaramies

  • Guest
YES SIR THANK YOU SIR.

hereÂ's the last thing i tried if i remember it right: it didnt work

#start
_heli = _this select 0
_pilot= driver _heli
_gunner = gunner _heli
_crew = [_pilot, _gunner]
_cargo = (crew _heli)- [_pilot, _gunner]
_aunits = _cargo

_j = (count _aunits)
_i = 0

@ !(ALIVE _gunner)

#checkifcargo
~3.0
?_j>=_i:goto "repgunner"
?_j==_i:goto "checkifcargo"

#repgunner
_j
(_aunits select _i) action ["movetogunner", _heli]
(_aunits select _i) GroupChat "GUNNER IS HIT, MOVING TO GUNNERS SEAT"
(_aunits select _i) assignasgunner _heli
~0.5

exit

makkaramies

  • Guest
HEY CMON U GUYÂ'S. PLEASE HELP ME, I REALLY NEED YOUR HELP.

Today i got everything in most of the scripts working pretty fine but i just cant get this trough my thick skull....

@(_aunits in _heli) dont work
@?(_aunits in _heli) dont work
?(_aunits in _heli) dont work
@_j>_i dont work
?_j>_i dont work
list goes on and on...

iÂ've tried almost everything and always error 200 times?????

ALL I NEED IS THE SCRIPT TO WAIT or COUNT UNTIL _heli HAS CARGOUNIT(s) ON BOARD.

please help me with the command.

SEEYA :cheers:
« Last Edit: 28 Feb 2005, 19:17:57 by makkaramies »

Offline ACF

  • Members
  • *
  • Llama?? Ain't that French for tanks?
Not the whole story but: _aunits In anything won't work because _aunits is an array as you've defined it while the In vehicle command operates on a unit, according to the comref.

Surely the simplest logic is something like:

?(!Alive Gunner _heli && Count Crew _heli >= 2): Crew Select ((Count Crew _heli)-1) MoveInGunner _heli

In English: if the gunner's dead and there are at least a full flight crews-worth of live loons on board then detail the lowliest cargo member as gunner.  If the gunner's not dead or there are only flight crew on board nothing will happen.

It will need a) testing and: b) refining to make sure the pilot doesn't get moved to gunner - that would not be good.  You've already cracked how to extract the flight crew from the Crew so you can work the detail.

Of course, Count Crew _heli may need to be >= 3 depending on the type of chopper.

EDIT - rather critical Count command added.
« Last Edit: 15 Mar 2005, 00:48:44 by ACF »

makkaramies

  • Guest
THANX FOR YOUR REPLY ACF ;D

and thanx for trying to help me. Unfortunately your code is not working.
I tried to mod it but noooo.... error...error...

took a good look at the comref again, but ... me so stupid ???

I dont want to use the movein-command because it will automatically throw the dead unit out from the vehicle. moveto-command just moves it to the backseat. that looks better.. mkay

THE PROBLEM IS, that when, or if the pilot / gunner is hit when vehicle doesnt have cargo inside, the script will naturally exit. because nothing is keeping the script waiting until the vehicle has cargo.

And after that, when the vehicle is loading, the gunners seat wont be manned.

HERE IS THE SCRIPT THAT WORKS ONLY WHEN VEHICLE HAS CARGO:

_heli = _this select 0

_pilot = driver _heli

_gunner = gunner _heli

_crew = [_pilot, _gunner]

_cargo = (Crew _heli) - [_pilot, _gunner]

_aunits = _cargo

_j = (count _aunits)

_i = 0

@!(ALIVE _pilot)

#pilotdead
~5.0
_gunner action ["movetodriver", _heli]
~0.02
_heli sideChat "gunner: PILOT IS HIT..!! TAKING CONTROLS... OVER. "  
~0.02
_gunner assignasdriver _heli

;checkcargoloop should be here

#pilotdead
~3.0
(_aunits select Random _j) GroupChat "CHECK IF THE PILOT IS STLL ALIVE, AND GIVE HIM FIRST AID..!! "
~3.0
(_aunits select Random _j) GroupChat "WE NEED A GUNNER OVER HERE..!! "
~1.0
(_aunits select _i) GroupChat "ROGER, MOVING TO GUNNERS SEAT"
~2.0
(_aunits select _i) action ["movetogunner", _heli]
(_aunits select _i) assignasgunner _heli
~1.0
(_aunits select Random _j) GroupChat "THE PILOT IS A MESS... HEÂ'S WAYSTED.. "
exit




#cargocheck
hint "cargocheckloopforreplacement"
?_cargo >= 1: goto "pilotdead"      <---- HERE IS THE PROBLEM!!
~1.0                                                  
goto "cargocheck"                      

OK EVERYBODY. SO I STILL NEED YOUR HELP WITH THIS ONE.

AND PLESE DONT TELL ME TO CHECK OUT TUTES... TRUST ME, I AM CHECKING.... me so stupid...

 :tomato: :cheers: :help:
« Last Edit: 10 Mar 2005, 22:08:03 by makkaramies »

ProfTournesol

  • Guest
?_cargo >= 1: goto "pilotdead"      <---- HERE IS THE PROBLEM!!

Yes, I think its because _cargo is an array, and isn't > anything ! You must count it before checking..., like count _cargo

Offline ACF

  • Members
  • *
  • Llama?? Ain't that French for tanks?
Just a bump to say that I also missed a Count command before - now corrected above.

makkaramies

  • Guest
YEEEEESSSS!!!!!!! :cheers: :gunman: :thumbsup:

ACF && profTournesol you are the coolest!! THANKS..MILLIONS OF THANKS ;D

This is basically solved now. and i can think many uses for this thing. Now i see that i was many times very close to solving the problem my self, but when you dont know what you are doing, itÂ's like shooting in the dark....

working code for script to wait / check if vehicle has cargo depending how meny alive crew members it has on board:

#loop
~1.0
?(Count crew _heli) >2: goto "nextaction"
goto "loop"

#nextaction
blah...blah...

IÂ'm going to do some testing before i press the solved button, but i think this is it.
 
thanks again ACF && profTournesol

I just found this from the editing /scripting: general section, by THobson
if (count ((crew chopper) - [driver chopper,gunner chopper]) > 0) then {hint"Loons in cargo"} else {hint"No loons in cargo"}

 :cheers:
« Last Edit: 20 Mar 2005, 02:49:25 by makkaramies »