dwarden

Scripting Discussion (dev branch)

1343 posts in this topic

Next to already revealed an known https://community.bistudio.com/wiki/Category:Arma_3:_New_Scripting_Commands_List

There are more script commands now :)

+ New scripting function: magazinesExt (tho it shall be soon to be renamed into magazinesAmmo)

command <vehicle> returns an array of subarrays with type names and ammo left of all the vehicle's magazines

example: magazinesExt player

... sneaky little great script command evaded the changelog

[magazinesExt] has been renamed to [magazinesAmmo] since ver.108360 so take my apology in a situation when this change corrupted your scripts ;)

the second thing: [magazinesAmmo] does NOT return already loaded magazines (e.g. magazine in handgun, etc.)

just because we don't want that behavior for this command. If you need to get info about actually loaded magazines,

you can simply use [weaponsItems](since 108367) or

[primaryWeaponMagazine],[secondaryWeaponMagazine] and [handgunWeaponMagazine]

and the last thing: we are trying to do our best in supporting community

that's why we have decided to create one magazines command in addition named [magazinesAmmoFull] with this output format:

// output format

// ["AmmoClassName"

// ,26 /*ammo count*/

// , true /*currently loaded*/

// , 0 /* 1 = primary mag, 2 = handgun, 4 = secondary, 0 = grenade */

// , "vest"("uniform","backpack") /*stored in ...*/ or "muzzleName" (when currently loaded)]

this command will be available since 108423

+ fixed http://feedback.arma3.com/view.php?id=12324

+

new commands were added in DEV. 108561: addMagazineGlobal, removeMagazineGlobal, addWeaponGlobal, removeWeaponGlobal

only discussion related to new or changed Arma 3 Beta/Dev Scripting allowed

Edited by Dwarden

Share this post


Link to post
Share on other sites
Here for starter

only discussion related to new or changed Arma 3 Beta/Dev Scripting allowed

Hello, this looks like a very useful addition to the API. For some context, I recently submitted the following

request ticket that relates to this type of functionality: http://feedback.arma3.com/view.php?id=12121

The magazinesAmmoFull function looks like it would address several of the problems that seem to exist in the current API, so this addition would be much appreciated. :yay:

There is probably more that could be said on this topic, but it would be useful to know a little more about some of the underlying design decisions and/or limitations that affect the semantics of the relevant functions.

Is there for example a specific reason for why many of the inventory related functions return class names rather than giving access to the inventory item objects?

andro2

Edited by Dwarden

Share this post


Link to post
Share on other sites

the addMagazineCargoGlobal ect makes life much easier any chance of getting a -- addActionGlobal as well :)

also addUniform and addVest are not global and would be much better if they were.

Share this post


Link to post
Share on other sites

The scripting commands: this addMagazine "Magazine Classname";this addWeapon "Weapon Classname"; which allowed you to add weapons from one vehicle to another is broken in Arma 3. It worked in Arma 2 but appears broken in Arma 3.

Made a ticket here: http://feedback.arma3.com/view.php?id=12324

Share this post


Link to post
Share on other sites

Erm... so who reported the Dwarden's post? Perhaps they misunderstood the meaning of the thread...

Share this post


Link to post
Share on other sites
Erm... so who reported the Dwarden's post? Perhaps they misunderstood the meaning of the thread...

there was typo in the tittle :) way too many s :)

Share this post


Link to post
Share on other sites
The scripting commands: this addMagazine "Magazine Classname";this addWeapon "Weapon Classname"; which allowed you to add weapons from one vehicle to another is broken in Arma 3. It worked in Arma 2 but appears broken in Arma 3.

should be fixed now.. see proper feedback tracker thread

Edited by Dwarden

Share this post


Link to post
Share on other sites

Any more info onBIS_fnc_nearestRoad available? It seems it could be very useful in laying mints, roadblocks etc by script.

Share this post


Link to post
Share on other sites

Since Java support is on pending, I think its a good idea to add "break" and "continue" keywords to sqf loops, if possible. Some time ago, going through the code written for some mods I found out that most people, even professional guys, were in need of such statements. The code use to shift too much to the right and became hardly readable.

I use to use a trick like bellow to avoid it, still those statements would add a bit of extra power to sqf.

for "_i" from 0 to (count Units - 1) do
{
if (true) then
{
              _unit = Units select _i;

              if (!(alive _unit)) 
                        exitWith{}; // skip dead units                

              if (speed _unit > 70) 
                        exitWith{}; // also skip fast units

              process _unit; // code not shifted 8 screens any more
               ....
};
};

Share this post


Link to post
Share on other sites

new commands were added in DEV. 108561: addMagazineGlobal, removeMagazineGlobal, addWeaponGlobal, removeWeaponGlobal

Share this post


Link to post
Share on other sites
new commands were added in DEV. 108561: addMagazineGlobal, removeMagazineGlobal, addWeaponGlobal, removeWeaponGlobal

The effects of those base commands were already global so what's the difference between addWeapon and addWeaponGlobal?

1 person likes this

Share this post


Link to post
Share on other sites

well.. not exactly.. when you use player addWeapon "className", all would be fine and the new weapon will be distributed around, but when u use non-local-player addWeapon "className", so weapon will be added only to a instance of non-local player on your client and after few MP engine simulations server returns a correct weaponsList depends on a station where "non-local-player" is local. With addWeaponGlobal you are able to add a weapon to all players even those who are non-local. And vice versa with addMagazineGlobal, etc.. For deeper description of usage, please ask Zonekiller :) He wanted these "Global" commands

Share this post


Link to post
Share on other sites
well.. not exactly.. when you use player addWeapon "className", all would be fine and the new weapon will be distributed around, but when u use non-local-player addWeapon "className", so weapon will be added only to a instance of non-local player on your client and after few MP engine simulations server returns a correct weaponsList depends on a station where "non-local-player" is local. With addWeaponGlobal you are able to add a weapon to all players even those who are non-local. And vice versa with addMagazineGlobal, etc.. For deeper description of usage, please ask Zonekiller :) He wanted these "Global" commands

Very nice, now we can assign weapons/ammo from the server-side and use BE Filters to prevent any clients from executing those commands.

Share this post


Link to post
Share on other sites

When I use the setObjectTexture command, its does not work on some of the vehicles: http://feedback.arma3.com/view.php?id=12463

I put this into the vehicle init: this setObjectTexture [0,"texture2.jpg"]; this setObjectTexture [1,"texture2.jpg"];

And some vehicles work with it and others don't for some odd reason.

Share this post


Link to post
Share on other sites

Ill quote a quick rant i had in a scripting thread

I wish there was a general listAllVariables command that you can use on objects and namespaces, would make tracking things down so much easier than trying to pull BIS scripts apart then using watch window to see what their global BIS_ variables are doing/set to. We get a nice handy function window but all their variables that they use just seem hidden away and frustratingly painful to track.

Plus their extra debug tools/addon would be good thought i saw a reference to it in the UI files was it @default or @debug.

So any chance of a listAllVariables command. Just to make clear im looking for something that will return a list of all Key/Value pairs from an object/namespace, maybe even with a search criteria e.g[table=width: 500, class: grid]

[tr]

[td]var name[/td]

[td]var value[/td]

[/tr]

[tr]

[td]LAR_player_money[/td]

[td]100[/td]

[/tr]

[tr]

[td]LAR_random_var[/td]

[td]"whatever"[/td]

[/tr]

[tr]

[td]LAR_player_score[/td]

[td]5[/td]

[/tr]

[tr]

[td]LAR_player_rank[/td]

[td]"Corporal"[/td]

[/tr]

[/table]

_playerVars = player listAllVariables ["LAR_player_"]
//_playerVars = [["LAR_player_money",100],["LAR_player_score",5],["LAR_player_rank","Corporal"]]

I would find this useful for both mission scripting and for debugging.

______________________

Seeing as there is now Physx in the game, does it produce any useful resources to constraints or is there access through the engine without modeling. So we can attach things via joints? e.g

_myConstraint1 = attachConstraint [[object1,pos/offset/memoryPoint],[object2,pos/offset/memoryPoint],"BallAndSocket"];
_myConstraint1 setConstraintLimits ["cone",[axis_x, axis_y, axis_z], angle, [shaft_x, shaft_y, shaft_z], friction];

//axis is a vector specifying cone orientation relative to object1 modelspace, angle at the base of the cone, shaft is a vector specifying shafts orientation relative to object2 modelspace, shaft is constrained to stay within the cones limits??

Im thinking heli lifts where the object your lifting is not statically tied to the bottom of your helo.

Vehicle towing were the line behind you twists rather than a static line of attached vehicles that raise in the air/clip through the floor on the lead vehicles gradient changes.

Only asking :P "hinge" type would be useful aswell :D

Edited by Larrow

Share this post


Link to post
Share on other sites

New scripting command for creating crew for given vehicle:

createVehicleCrew

Share this post


Link to post
Share on other sites
New scripting command for creating crew for given vehicle:

createVehicleCrew

Woho! Great new scripting commands! This comes in handy!

Share this post


Link to post
Share on other sites

I just noticed that in the latest dev build, fadeSound doesn't seem to work anymore. Is that intentional ?

Correction: fadeSound does not fade ambient sound, only shots fired, steps etc... the crickets and environment sounds remain...

Edited by Varanon

Share this post


Link to post
Share on other sites
I just noticed that in the latest dev build, fadeSound doesn't seem to work anymore. Is that intentional ?

Correction: fadeSound does not fade ambient sound, only shots fired, steps etc... the crickets and environment sounds remain...

I'm fairly sure this has been the case since the beginning of alpha (or it has now returned, if it was changed in the mean time). Remember the bug where gunfire sounds would cut out after you died and respawned? You could still hear environment sounds there aswell.

Share this post


Link to post
Share on other sites
I'm fairly sure this has been the case since the beginning of alpha (or it has now returned, if it was changed in the mean time). Remember the bug where gunfire sounds would cut out after you died and respawned? You could still hear environment sounds there aswell.

Hmm, I was under the impression this worked before. Intros for my missions always start with faded out sound, and I was pretty sure it worked, but it might also be that I just simply didn't notice until now :| Wouldn't be the first time...

Is there a ticket for this already ?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now