Page MenuHomeFeedback Tracker

Please port these scripting commands from DayZ to ArmA 3!
Acknowledged, WishlistPublic

Description

DayZ introduced many new scripting commands already, but they are not available in ArmA 3. However, I assume many scripters (including me) would find these commands very handy:
<b><i>synchronizeVariable</i></b> instead of having to construct code blocks using <i>BIS_fnc_MP</i>
<b><i>getClientUID</i></b>
instead of passing whole <i>player</i> object to server, plus resolves the problem if <i>getPlayerUID</i> cannot be used when <i>player</i> is not available
<b><i>setMagazineAmmo</i></b> set number of rounds in a magazine
<b><i>magazineAmmo</i></b>
get current number of rounds in a magazine

Usage:
object <b><i>synchronizeVariable</i></b> [variableName, value, (code)];
synchronizes the variable value to <i>object</i> with every connected client
used for variables added to <i>object</i> using <i>setVariable</i>
//<i>code</i> is optional and will be executed on each connected client as well

_clientUID = <b><i>getClientUID</i></b> id;
returns player UID; beneficial server side, especially if <i>player</i> object is not available
<i>id</i> is the same value as returned by <i>owner</i> command

magazine <b><i>setMagazineAmmo</i></b> number

_rounds = <b><i>magazineAmmo</i></b> magazine

Details

Legacy ID
550574476
Severity
None
Resolution
Open
Reproducibility
Always
Category
Scripting
Steps To Reproduce

n/a

Additional Information

If somebody should find other useful commands, place them in the note section and I'll add them to the list in the description (with credit).

Event Timeline

HereisJohnny edited Additional Information. (Show Details)
HereisJohnny set Category to Scripting.
HereisJohnny set Reproducibility to Always.
HereisJohnny set Severity to None.
HereisJohnny set Resolution to Open.
HereisJohnny set Legacy ID to 550574476.May 7 2016, 8:16 PM

Command "allPlayers" has just been added for the dev branch:

https://community.bistudio.com/wiki/allPlayers

"magazine setMagazineAmmo number"

Is this Dayz command? do you have a link?

It is a DayZ command, but there are no links to a wiki or so. All the commands I posted here, I found looking at the DayZ source code. You can find it e.g. in

modules_dayz.pbo\scripts\event\event_ammo.sqf

the reason I asked was because how you're supposed to know to which magazine to add ammo? For this you need to know exact id of the magazine and AFAIK this is WIP in Arma 3, so not really usable.

It's supposed to be used on magazine object - e.g. mags laying on the ground - not for mags in the inventory. In the mentioned script it's used to minimize the amount of usable rounds in a mag when it's thrown into a fire (backed by some random popping sound when a bullet explodes by the heat).

In Arma 3, I'd consider this useful for instance to spawn mags with a custom amount of rounds, because AFAIK you can currently only spawn full mags.

"because AFAIK you can currently only spawn full mags."

You sure about that?

https://community.bistudio.com/wiki/addMagazineAmmoCargo

"AFAIK" ;-)

To clearify, by "spawn" I mean <i>createVehicle ["someMag", ...]</i>.

Can you perform the same thing with the GroundWeaponHolder as with an ammo box? If so, my question would be, why they had to create a special command for DayZ. Plus, there could be cases where you might wanna change the amount of bullets in an already existing mag.

"there could be cases where you might wanna change the amount of bullets in an already existing mag."

see

"For this you need to know exact id of the magazine and AFAIK this is WIP in Arma 3, so not really usable.
"

You can change ammo in loaded mag, since you can id as the mag loaded into weapon.

"To clearify, by "spawn" I mean createVehicle ["someMag", ...]."

It will still need to create weaponholder, so might just do it yourself.

To update this a bit:

ArmA 3 allows to <b><i>addMagazine</i></b> with a custom number of rounds, so this could be used as a workaround for <b><i>setMagazineAmmo</i></b>.

The ArmA 3 command <b><i>magazinesAmmo</i></b> returns all rounds for all magazines on a vehicle, grouped by class name. But it doesn't say anything about a single mag, like <b><i>magazineAmmo</i></b> does in DayZ.

"_rounds = magazineAmmo magazine"

What is magazine param? Object? Then you can forget about it as Arma 3 has no such mechanics yet. String classname? Then how do you expect engine to understand which magazine you want ammo for if player has several mags with the same classname?