Editors Depot - Mission Editing and Scripting > Arma3 - Editing/Scripting Multiplayer

Unlimited Smoke Grenades and Chem Lights

(1/1)

StressfulGengar:
I am the dedicated mission developer for the clan I am apart of and I have run into a bit of trouble with the latest mission.

A bit of background info is probably needed here. The whole campaign on Altis is to clear the invading CSAT forces off the island mission by mission and it follows a Story line which I have written out with event's, ect. At the point my clan mates are they have gotten in contact with the ADF and are fighting with them to take back the island.

The mission objectives at hand are as follows:
Clear Minefield & IEDs along route
Deliver Supplies to ADF forces via truck (the reason behind clearing IEDs and Minefield) and by Helicopter.

What I need to know is how do I create endless spawning smoke grenades and chem lights so that I can mark the location for the Heli team to put down the supplies as they will be doing this using Slings.

Thanks in advance for the help!!

h-:
:welcome:
Welcome to OFPEC :)
(or if you're old user with new creds, welcome back :P )

Do you mean endlessly spawning into your inventory or endlessly spawning on the groud once thrown there?
Just checking but I'm suspecting the latter..

JohnAJ:
If anybody happens upon this thread when searching Google, I'll be a nice guy and give you my answer, assuming you want every unit to have an unlimited amount of smoke grenades and chemlights. Here's what I'd do:


--- Code: ---replenish = {
_unit = _this select 0;
_weapon = _this select 3;
_magazine = _this select 5;
if (toString _weapon == "Throw") then {
_chemlight = toArray _magazine;
_chemlight resize 9;
_smoke = toArray _magazine;
_smoke resize 10;
if (toString _chemlight == "Chemlight" or {toString _smoke == "SmokeShell"}) then { _unit addMagazine _magazine; }
};
};
{_x addEventHandler ["Fire", {_this spawn replenish}} forEach allUnits;

--- End code ---

Something like that? Should work, haven't tested it though. You should probably privatize the variables too. Also, it might not be a good idea to run this entire thing everytime someone fires. I don't know.

Lone~Wolf:
Don't worry, I work a lot with scripts running whenever anyone fires: It's not a problem.

Your code looks fine. The logic is sound, even if the user wishes to tweak it a bit to their own needs.
The method I used to always use in OFP was to check for when a magazine (or in this case a smoke grenade) disappears from the inventory, then give another one. Linking it to the throwing has a lot more finesse though.

Navigation

[0] Message Index

Go to full version