Home   Help Search Login Register  

Author Topic: Disable ammo in chooper via script?  (Read 2225 times)

0 Members and 1 Guest are viewing this topic.

Offline jphilapy

  • Members
  • *
  • I'm a llama!
Disable ammo in chooper via script?
« on: 23 Dec 2005, 02:17:24 »
Hi,

I'm creating a chopper in game. I need to know how to create it without any ammo at all.

Thanks,
Jeff

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re:Disable ammo in chooper via script?
« Reply #1 on: 23 Dec 2005, 08:20:58 »
Code: [Select]
{helo removeMagazine _x} forEach (magazines helo)Where helo is it name of the chopper who's ammo you want removed.

If you want to add back the ammo at a latter time then try this:
Code: [Select]
helo_mags = magazines helo
{helo removeMagazine _x} forEach helo_mags
then later to put the magazines back:
Code: [Select]
{helo addMagazine _x} forEach helo_mags

Offline jphilapy

  • Members
  • *
  • I'm a llama!
Re:Disable ammo in chooper via script?
« Reply #2 on: 23 Dec 2005, 21:19:50 »
Hi, When I use the code, I get invalid # in expression. Any idea why?

Thanks,
Jeff

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Disable ammo in chooper via script?
« Reply #3 on: 23 Dec 2005, 21:50:59 »
Did you name your chopper as helo or did you give it another name?

If you gave it another name just replace helo with the name you used.

Also, it would be better to quote the error message you get.   ;)


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

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Disable ammo in chooper via script?
« Reply #4 on: 23 Dec 2005, 22:39:15 »

in the init field of the air unit place
removeallweapons this

or in a script use
removeallweapons heloname

will remove both weapons and ammo, if thats what you are after, that way a chopper cant rearm at a reammo truck either
« Last Edit: 23 Dec 2005, 22:41:10 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline jphilapy

  • Members
  • *
  • I'm a llama!
Re:Disable ammo in chooper via script?
« Reply #5 on: 23 Dec 2005, 23:10:46 »
Sorry the error message I get is "invalid # in expression"

or maybe "invalid number in expression".

I replaced the word helo with the word chopper1 because when I create a chopper in the mission, that is the name i give it. I am creating the chopper within the ini field of the player.

Thanks,
Jeff

Did you name your chopper as helo or did you give it another name?

If you gave it another name just replace helo with the name you used.

Also, it would be better to quote the error message you get.   ;)


Planck

Offline jphilapy

  • Members
  • *
  • I'm a llama!
Re:Disable ammo in chooper via script?
« Reply #6 on: 23 Dec 2005, 23:12:40 »
hi,


I tried your advice and it works for the mission. However I still like to understand the other way that is prescribed to me. As I dont want to be limited to doing only in editor things.

Thanks,
Jeff


in the init field of the air unit place
removeallweapons this

or in a script use
removeallweapons heloname

will remove both weapons and ammo, if thats what you are after, that way a chopper cant rearm at a reammo truck either

Offline jphilapy

  • Members
  • *
  • I'm a llama!
Re:Disable ammo in chooper via script?
« Reply #7 on: 23 Dec 2005, 23:38:11 »
Hi, quick correction. What you gave me works on 1.96. I am trying to implement code that works on 1.46. Sorry I should have stated that in the first post.

What I did so far on 1.46 is:

chopper1 removeMagazine "Rocket57x192"; Thanks for the previous post that helped me to discover this.

That works, but the foreach throws an error as I stated earlier.

Jeff


in the init field of the air unit place
removeallweapons this

or in a script use
removeallweapons heloname

will remove both weapons and ammo, if thats what you are after, that way a chopper cant rearm at a reammo truck either