Jump to content

Recommended Posts

It has come to our attention that scripters need to use complicated expressions for basic operations on 3D vectors, so we've decided to expose some basic arithmetic operations on them to modders.

Thanks for making these available - It's not too bad at the moment with the vector functions but looking forward to being able to make use of these :)

Share this post


Link to post
Share on other sites

I've never came across the distance between two vectors before. Wouldn't you need a point on the vectors to measure such a thing?

Does it mean the magnitude of a resultant vector? (Aka, the distance between two points)

Edit: Also, appreciate the new commands! :)

Edit 2: Shouldn't the size related commands use magnitude/length instead? In mathematics the size of a vector implies the number of components. Obviously it can be derived that it means magnitude, but it could be confusing to people who're used to seeing mathematical terminology.

Edited by SilentSpike

Share this post


Link to post
Share on other sites

Documentation of new scripting commands:

- vectorAdd

- vectorDiff

- vectorCrossProduct

- vectorDotProduct

- vectorCos

- vectorMultiply

- vectorMagnitude

- vectorMagnitudeSqr

- vectorDistance

- vectorDistanceSqr

Edited by DarkDruid
Scripting commands crossProduct and dotProduct renamed to vectorCrossProduct and vectorDotProduct.

Share this post


Link to post
Share on other sites
Not available in ver 1.20 ! Stable

That is intended situation. You can check on links which you have posted, that these commands should be a part of the game from version 1.22.

Share this post


Link to post
Share on other sites

Hasn't "Script command magazinesAmmo works also for ammo crates now" made it into stable version?

I don't see it in the Spotrep and it doesn't work either...

Is it due in next patch or is it cancelled?

Share this post


Link to post
Share on other sites
Hasn't "Script command magazinesAmmo works also for ammo crates now" made it into stable version?

I don't see it in the Spotrep and it doesn't work either...

Is it due in next patch or is it cancelled?

It better not be! That command is very useful now.

Also, when's dev likely to move to 1.22? I'd like to try the new vector commnds but they throw errors (presumably as they aren't in dev yet).

Share this post


Link to post
Share on other sites
hardcoded to 3D vectors, ...

Bummer.

Any chances you might reconsider this decision?

..., I suppose people don't need a whole MATLAB simulator in Arma

Why not? Of course we do!

There are numerous (and relevant) problems that could be nicely modeled by a small linear system. You guys got some solver behind the scene? Well, make it available to us then, and it sure will find its place. Transpose, inverses, SVD, ... Bring it on!

But then again, maybe such stuff has to hold on, until Arma finally implements a language (Java, Python, whatever...) which already offers all that stuff in form of various libraries and packages (any news on that?). And why stop at linear algebra...

Just imagine what people would come up with, if a package like scikit.learn were available in Arma (8

Share this post


Link to post
Share on other sites

Could you add the actual mathematical formula to each function in the wiki? That way we could verify the behavior of the script commands if they break in the future for some reason.

Share this post


Link to post
Share on other sites
Could you add the actual mathematical formula to each function in the wiki? That way we could verify the behavior of the script commands if they break in the future for some reason.

I'll do that now.

Edit: Seems there's an issue with the <math> formatting on the wiki, fyi. Will just use letters for now, can switch to subscript once the laTeX plugin is sorted out as it looks much cleaner.

Edit 2: Actually, I'm just going to wait until the plugin is sorted out as it'll be much easier to follow the formula.

Edited by SilentSpike

Share this post


Link to post
Share on other sites

How the AI unit can be scripted to lay mines? I used before this, but then it stopped working around last fall:

unitname fire ["DirectionalMineRemoteMuzzle", "DirectionalMineRemoteMuzzle", "ClaymoreDirectionalMine_Remote_Mag"];

Found now there is new way to use forceWeaponFire-command (that work great for weapons and smokegrenades), but it still dont seem to work for mines with e.g. (even the unit have the mine):

unitname forceWeaponFire ["DirectionalMineRemoteMuzzle", "DirectionalMineRemoteMuzzle"];

Any tips or is it broken?

Made ticket, just in case: ;)

http://feedback.arma3.com/view.php?id=19097

Edited by SaOk

Share this post


Link to post
Share on other sites

Is there no removeSecondaryWeaponItem command in Arma 3?

I could have swore this command worked for me several weeks ago; but now it seems it doesn't, and it's not listed on the biki. There are counterpart secondaryWeaponItems and addSecondaryWeaponItem commands, plus the working removePrimaryWeaponItem and removeHandgunItem commands listed. Perhaps I was just imagining it was there.

I checked the Feedback Tracker and it was stated that the issue was resolved back when we had the old removeItemFrom*WeaponType* syntax instead of the newer remove*WeaponType*Item syntax, but removeItemFromSecondaryWeapon doesn't work either (I checked to see if it was just a matter of BIS not switching the command to the new syntax). Evidently that ticket resulted in a working removeItemFromHandgun/removeHandgunItem command but not a SecondaryWeapon one.

Share this post


Link to post
Share on other sites

Are the selectionPosition and modelToWorld commands working as they should?

I'm getting some weirdness when using them with planes. The position is displaced forward in proportion to how fast it's moving (in model space) when the plane is moving.

Here are some pics of it happening. The red sphere marks the position which is acquired by the following line of code:

_pos = _plane modelToWorld (_plane selectionPosition _gunName);

stationary: http://cloud-4.steampowered.com/ugc/558758155455082523/C1DE24648CB9B0C929E5BEC75123BC3DFEAB6583/

flying: http://cloud-3.steampowered.com/ugc/558758155455080484/7ADF1783ABB8C18606D152B6E3724B170EB406B8/

Same code, different outcome when flying. Why? Is it intended?

Edited by Xendance

Share this post


Link to post
Share on other sites

That problem has been noted in work by franze and others on interactive cockpits.

Here's an idea: How consistent is the memory point desync? Can we construct a reliable table based on magntitude of velocity vector -> magilnutude of displacement vector?

Share this post


Link to post
Share on other sites
That problem has been noted in work by franze and others on interactive cockpits.

Here's an idea: How consistent is the memory point desync? Can we construct a reliable table based on magntitude of velocity vector -> magilnutude of displacement vector?

It seems that memory points have nothing to do with it. It's just the ModelToWorld command that is messed up :|

Gotta check if I can do my own model space conversion tool, need to refresh my linear algebra skills...

Edit: Did a hack for it:

hackForConvertingModelSpacePosToWorldSpaceBecauseBISFunctionDoesNotWork = {
 _model = _this select 0;
 _modelSpaceGunPos = _this select 1;
 _dirVector = _this select 2;

 _magnitude = vectorMagnitude [0, (_modelSpaceGunPos select 1), 0];
 _vectorScaleAmount = _magnitude / (vectorMagnitude _dirVector);
 _vector = vectorMultiply [_dirVector, _vectorScaleAmount];
 _vector = vectorAdd [visiblePositionASL _model, _vector];
 _vector;
};

http://cloud-3.steampowered.com/ugc/558758155460501515/F8B068674EC171B45ECAC9D3800CAE6F382F01C2/

Still gotta displace the x and z dimensions of the _vector, then it should be pretty perfect.

Edited by Xendance

Share this post


Link to post
Share on other sites

is it just me or did the format of loadbackpack get changed to percentage? https://community.bistudio.com/wiki/loadBackpack

this makes the wiki description wrong. i'm almost certain that it has been changed since i just went back to older code of mine to resume work and it was designed to work with mass values and not percentage of max possible load.

just a heads up for whoever takes care of that wiki page and people who use this.

Share this post


Link to post
Share on other sites
Is there no removeSecondaryWeaponItem command in Arma 3?

I could have swore this command worked for me several weeks ago; but now it seems it doesn't, and it's not listed on the biki. There are counterpart secondaryWeaponItems and addSecondaryWeaponItem commands, plus the working removePrimaryWeaponItem and removeHandgunItem commands listed. Perhaps I was just imagining it was there.

I checked the Feedback Tracker and it was stated that the issue was resolved back when we had the old removeItemFrom*WeaponType* syntax instead of the newer remove*WeaponType*Item syntax, but removeItemFromSecondaryWeapon doesn't work either (I checked to see if it was just a matter of BIS not switching the command to the new syntax). Evidently that ticket resulted in a working removeItemFromHandgun/removeHandgunItem command but not a SecondaryWeapon one.

This command is perhaps what you're looking for? (Haven't used it myself yet so it might not be)

Share this post


Link to post
Share on other sites
This command is perhaps what you're looking for? (Haven't used it myself yet so it might not be)

He's asking for a command to remove attachments from secondary weapons, not to remove the weapon itself.

Share this post


Link to post
Share on other sites
He's asking for a command to remove attachments from secondary weapons, not to remove the weapon itself.

Doh, my mistake. Totally overlooked the word item.

Share this post


Link to post
Share on other sites

Is there any secondary weapon items at all?

Surely not in the vanilla.

Share this post


Link to post
Share on other sites
Is there any secondary weapon items at all?

Surely not in the vanilla.

There's silencers for Rook and 4-five, as well as sights for Rhino and 4-five.

Share this post


Link to post
Share on other sites

Those are handguns aren't they.

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

×