Home   Help Search Login Register  

Author Topic: Loaders and gunners cooperation  (Read 993 times)

0 Members and 1 Guest are viewing this topic.

Ting

  • Guest
Loaders and gunners cooperation
« on: 06 Aug 2003, 15:41:25 »
Im trying to get some cooperation between mg loaders and gunners/ AT loaders and gunners.

First AT:
- Ive got a gunner and a loader. Each carry to Carl G rounds(addon). I want the gunner to replenish his stock from the loader when needed. As well i want the loader to take the weapon if the gunner dies.

MG: Here the replenisment isnt essential.

I am able to have the loader take the weapon when the gunner dies with

trigger condition:     this and (not alive t)
on activation:     aP action ["take weapon",t,0,0,primaryweapon t]


problem here is i havent found a way to get the loader close to the body, so the weapon is teleported :-\


For the replenishment part i am making no progress. :'(   Using the ammo command only works for the magazine in the gun, and not for the number of mags.


Does anybody have any ideas?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Loaders and gunners cooperation
« Reply #1 on: 06 Aug 2003, 18:44:07 »
Try adding an eventhandler "killed" to the gunner.   When he is killed, it starts a script.

The script makes the loader go to the body and perform the take weapon animation.   That's just an animation (I think).    The best way to transfer the weapon and ammo is to discover what the dead loon is carrying and remove it.    Then discover what the loader is already carrying, remove what you don't want and add back what you do.   Useful commands:-

removeWeapon
removeMagazine
addWeapon
addMagazine
secondaryWeapon
selectWeapon
primaryWeapon
weapons
magazines

 
Use getpos to find the position and save it within the script:

_deadManLying = getPos loon1

then something like

loon2 doMove _deadManLying
@ loon2 distance _deadManLying < 2: loon 2 action ["take weapon"]
loon2 addweapon CG

etc etc.   This isn't a script, its just a sketch of what might work.   Syntax not guaranteed.

Don't forget to check if the loader is alive at the start of the script.
Plenty of reviewed ArmA missions for you to play

Ting

  • Guest
Re:Loaders and gunners cooperation
« Reply #2 on: 06 Aug 2003, 19:15:52 »
Thanks, this should get me back on track, if I get stuck Ill ask again 8)

Ting

  • Guest
Re:Loaders and gunners cooperation
« Reply #3 on: 07 Aug 2003, 16:54:11 »
Ok, i got a good handle on the take weapon from deadguy with an addeventhanler for killed executing this script:

; Loader takes Carl Gustav when gunner is dead


_deadManLying = getPos AT_gunner
AT_loader doMove _deadManLying
@AT_loader distance AT_gunner < 2
AT_loader action ["take weapon",AT_gunner,0,0,secondaryweapon AT_gunner]





Now my problem is having the AT_gunner take ammo from the loader when the gunner has fired 2 Carl G rounds.  I think the answer is in the returned values for the at gunners. (Fired).   But if you or anybody else want to help a poor mission maker out, i'd be mighty gratefull ::)

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Loaders and gunners cooperation
« Reply #4 on: 07 Aug 2003, 17:40:28 »
Call this script with eventhandler fired.   As ever, this is not a script but a sketch of a script and the syntax is almost certainly wrong.


AT_gunner ammo "CG (or whatever its called)" >= 1: exit
AT_loader ammo "CG" == 0: hint "no more ammo"; exit

#loop
? (not (alive AT_loader) or (not (alive AT_gunner)): exit
~2
AT_gunner doMove getPos AT_loader
AT_loader doMove getPos AT_gunner
? AT_loader distance AT_loader > 2: goto "loop"

insert animation here
AT_loader removeMagazine "CG"
AT_ gunner addMagazine "CG"
exit


Edit:  you can use the array that the eventhandler returns to check which weapon was fired and exit the script if it wasn't the CG.
« Last Edit: 07 Aug 2003, 17:41:19 by macguba »
Plenty of reviewed ArmA missions for you to play

Ting

  • Guest
Re:Loaders and gunners cooperation
« Reply #5 on: 07 Aug 2003, 19:17:54 »
Thank you, i'm forever grateful, this should get me started :D