Home   Help Search Login Register  

Author Topic: How do i add mags to an ammo box from a trgger?  (Read 1045 times)

0 Members and 1 Guest are viewing this topic.

Offline D007

  • Members
  • *
How do i add mags to an ammo box from a trgger?
« on: 23 Jul 2008, 19:24:17 »
We are trying to have a script that adds weapons and mags to an existing ammo crate really..
It needs to be attached to a trigger though.

for example; we have a sniper on a tower that gets his personal clips reloaded when a trigger is hit.
that trigger is set to go off when a vehicle enters the trigger area.
we need a trigger to add 24 magazines of m107 rounds, to an ammo box that could already be existing.
or we need to create an ammo box with 24 sniper mags each time the trigger is hit.
but that trigger or script would have to remove the previous crate that was put down, so as not to have duplicating ammo boxes.

the problem is just that we can't seem to make the script work, to add magazines to an ammo crate,
that is attached to a trigger, that will go off only when the vehicle enters the trigger zone.

it's np to make an ammo crate with whatever we want in it utilizing the init line of the box it's self, but that won't work for this purpose .
the ammo box needs to only add mags to it when the trigger is hit and only have those specific magazines in it.

Honestly spent over a day now trying to make this work :(
we are using armaedit too btw. :P
thank you for the help guys, very much appreciated.

edit: got it working... idk what we were doing wrong for so long.. but it turned out simply making a script called "ammo"
and linking it to a trigger that set off "ammo.sqf" worked.
the sqs looks like this

clearweaponcargo ammo;clearmagazinecargo ammo; ammo addmagazinecargo ["10rnd_127x99_M107",24];
clearweaponcargo ammo1;clearmagazinecargo ammo1; ammo1 addmagazinecargo ["10rnd_127x99_M107",24];
clearweaponcargo ammo2;clearmagazinecargo ammo2; ammo2 addmagazinecargo ["10rnd_127x99_M107",24];

thw ammo box's names are ammo,ammo1 and ammo2.
we are using 3 ammo boxes.
it executes the sqf for each box simutaneously.
the initial ammobox it's self is also cleared out and reloaded using these commands.

the getpos/setpos commands allow you to set the ammo box to a height. we have the snipers on towers, so we needed to put the ammo boxes on the towers as well.

this setPos [getPos this select 0, getPos this select 1, (getPos this select 2) +15.2];clearMagazineCargo this; clearWeaponCargo this; this addmagazinecargo ["10rnd_127x99_m107",24];

Maybe this might help someone some day..lol.. enjoy..



« Last Edit: 23 Jul 2008, 21:09:42 by D007 »