OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: BLITZKRIEG_ROF on 10 Aug 2004, 13:14:48

Title: Conditional loss of ammunition for multiple units
Post by: BLITZKRIEG_ROF on 10 Aug 2004, 13:14:48
I'm making a MP mission (the same one from my time compression thread), and I've run into a snag.

What would be the best way to have all the shilkas on the map lose all thier ammo upon the destruction of a specific object?

Also, I'm wondering if it's possible to have a second group of shilkas that are linked to a separate destroyable object in the same way.

I'm going for a Freedom Fighters effect, where if you blow one thing up, it effects the entire map.
Title: Re:Conditional loss of ammunition for multiple units
Post by: Mud_Spike on 10 Aug 2004, 13:43:32
Put the shilka's names in an array and do something like
Code: [Select]
"removeAllWeapons _x" foreach shilka_arrayor:
Code: [Select]
"removeAllWeapons _x" foreach [shilka_0,shilka_1,shilka_2,shilka_3,......]
removeAllWeapons _should_ work, if not, play with removeMagazines with friends.
Cant verify this at work.
Title: Re:Conditional loss of ammunition for multiple units
Post by: macguba on 10 Aug 2004, 14:15:50
Mud_Spike's code could go in the On Activation field of a trigger.   In the condition line you might have

not alive loon1

or maybe its just an East not present trigger ... whatever the objective is really.
Title: Re:Conditional loss of ammunition for multiple units
Post by: BLITZKRIEG_ROF on 10 Aug 2004, 15:55:09
Okay, basically, I want to simulate a truck as a moble command center for the air defenses. When the truck is destroyed, the shilkas are rendered useless. I want it so that when a Ural truck is destroyed, all the shilkas don't have any ammo.

I've tried the removeallweapons command, and it didn'a work, as well as the removemagazinecargo one.

Any other ideas?
Title: Re:Conditional loss of ammunition for multiple units
Post by: Mud_Spike on 10 Aug 2004, 16:02:59
removeMagazineCargo is for ammo-containers (i.e., ammo-boxes, vehicles) and is
not used by the unit hosting them (in the case of vehicles).

removeAllWeapons should work. How are you using it?
Have you named your shilka units in the editor?
If so, does  hint format ["%1", shilka_unit_name]  report something like "EAST DELTA Black four",
or "...0xffffffffe.."?

Paste your removeAllWeapons code and tell us how it is being executed (Trigger conditions..)

Title: Re:Conditional loss of ammunition for multiple units
Post by: macguba on 10 Aug 2004, 16:06:49
Try removeMagazines.    Make sure you have the correct name for the ammo.
Title: Re:Conditional loss of ammunition for multiple units
Post by: BLITZKRIEG_ROF on 10 Aug 2004, 16:35:23
Alright, i'll give 'em a shot
Title: Re:Conditional loss of ammunition for multiple units
Post by: BLITZKRIEG_ROF on 10 Aug 2004, 18:29:49
The removeallweapons worked this time around. Perhaps I had done it wrong.

Alright, the other problem is liking the loss of weapons to the destruction of a Ural truck. What would be the best way to do that?
Title: Re:Conditional loss of ammunition for multiple units
Post by: Mud_Spike on 10 Aug 2004, 19:04:09

Exactly what MacGuba said:

Mud_Spike's code could go in the On Activation field of a trigger.   In the condition line you might have

not alive loon1

or maybe its just an East not present trigger ... whatever the objective is really.

where loon1 is the name of your comms truck.
Title: Re:Conditional loss of ammunition for multiple units
Post by: BLITZKRIEG_ROF on 10 Aug 2004, 21:17:29
Hmm. Excellent. Sorry for not reading more carefully.

Again, thanks for your help. I'll test it out, and if it works, i'll SOLVE the thread.