#arma3_scripting

1 messages ยท Page 260 of 1

tribal crane
#

If v1 is always down you could just convert to spherical coordinates and back after changing the "latitude".

dusk sage
#

You can just use the rotation matrix @tough abyss

steep matrix
#

new stuff

b:OBJECT triggerdynamicsimulation BOOL
b:STRING setdynamicsimulationdistancemult SCALAR
u:cantriggerdynamicsimulation OBJECT
u:dynamicsimulationdistancemult STRING
u:selectmax ARRAY
u:selectmin ARRAY

dusk sage
#
u:selectmax ARRAY
u:selectmin ARRAY
#

Neato

nocturne bluff
#

triggerdynamicsimulation

#

hmmmm

random glen
#

Mhm, is there a way to point player's camera toward a certain point?

#

It seems lookAt doesn't work in this case.

nocturne bluff
#

a unit

#

or a camera

random glen
#

I enforced first person view with 'this switchCamera "Gunner";', but I think it's still about the camera...

nocturne bluff
#

If you just want direction, you can do this setdir (this getdir target)

random glen
#

And if I want Z axis as well, I need to mess with a cursor target?(

#

Uh-oh, apparently I need to do a "cut-scene" with cameraEffect and camSetTarget...

tough abyss
#

@dusk sage i find matrix to be more complicated, i better understand polar/Spherical coordinates method. But i may also do some aprocimated method since all those are a bit heavy calculation. Just will know after some test.

dusk sage
#

It would probably be quicker and simpler to make a little equation for the rotation matrix, but whatever you find easier is best ๐Ÿ˜‰

tribal crane
#

Donnovan: Yeap, that's it.

dusk sage
#

Converting to spherical in something like this, just shouldn't happen ๐Ÿ˜›

tribal crane
#

The rotation matrix for an arbitrary axis is quite big IIRC.

dusk sage
#

Indeed

#

But it'll lead to some good practice

random glen
#

That's odd. I can use switchCamera on a player, but I can't access his camera to manipulate or place a created camera on it's position. >_>

random glen
#

That's not fair! =_=

steel mantle
#

For creating vehicles, is it possible to have multiplie turrets? and have a turret you can control from a console with also manual control so you can walk up to the gun and use it?

lusty hearth
#

attachto

random glen
#

Oh, is there any preset with local coordinates for attaching camera to character's head as if it's first person camera?

grand cargo
#

Can't you get the bone/whatever the model joints are? I believe the head is "pilot"

tough abyss
random glen
#

Well, @grand cargo, the problem here is the fact that I still need to give coordinates in _cam attachTo [_shooter, [0, 0, 0], "Head"];.

dim owl
#

Hey, is the pushback command global if i use it in a script ? so i can call my variable from all connected clients ?

grand cargo
#

i do not know what I'm talking about sorry

halcyon crypt
#

@dim owl no pushBack isn't synced between clients

dim owl
#

do you know how i can sync it ? ^^

halcyon crypt
#

some context would be nice

dim owl
#

so i hav a global variable test = []; test pushback [name player]; and i want to pushback my name into it on all connected clients and all clients who join later

halcyon crypt
#

I'm sure there's a better way to do whatever you're trying to do but that at least works ๐Ÿ˜›

dim owl
#

or maybe a function and remoteexecute it on anyone ?

halcyon crypt
#

it will overwrite test on all the other clients though

dim owl
#

i will give it a try

tough abyss
#

Anyone care about dynamic weather here?

random glen
#

I want to see it done right someday...

spark phoenix
#

@dim owl publicVariable is the most efficient method

tough abyss
#

That was my weather script

#

It wasn't formally finished

#

The newest versions got better code partitioning

#

But were never released

#

Newest version had getters and setters

dim owl
#

how can i check if a player/ai get a variable and then exit the script ?
my try:

test = [];
unit1 setVariable ["myVar",20,true];
test pushback [unit1];  //unit1 is the var name in editor
test pushback [player];
{
    if ((_x getVariable "myVar") isEqualTo 20) exitWith {hint "test test test";};
}foreach test;

i want to use this later for a whole faction check

tough abyss
#

Does it work? Already? @dim owl

dim owl
#

No and i ask me why ? xD

tough abyss
#

because

#

test pushBack [player] or test pushBack [unit1]

#

results in a double nested array

#

so test = [[player],[unit1]];

#

then you try looking using for each

#

which will return the double nested player array

#

and setVariable only works on objects and certain name spaces

#

If you wanted to get the index

#

you do this

#

test = [];
unit1 setVariable ["myVar",20,true];
test pushback [unit1]; //unit1 is the var name in editor
test pushback [player];
{
if (((_x select 0) getVariable "myVar") isEqualTo 20) exitWith {hint "test test test";};
}foreach test;

dim owl
#

okay

dusk sage
#

```sqf
//Code
```

tough abyss
#

Apologies @dusk sage

dusk sage
#

๐Ÿ˜‰

tough abyss
#
test = [];
unit1 setVariable ["myVar",20,true];
test pushback [unit1];  //unit1 is the var name in editor
test pushback [player];
{
    if (((_x select 0) getVariable "myVar") isEqualTo 20) exitWith {hint "test test test";};
}foreach test;
dusk sage
#

Or for sake of good practice, just get rid of those square brackets ๐Ÿ˜ƒ

tough abyss
#

^

dim owl
#

syntax error

tough abyss
#

Liner number?

#

Also unit1 setVariable ["myVar",20,true];

#

is setting the variable only for unit1

would also be needed

dim owl
#

my fault ๐Ÿ˜„

#

forgot to pushback xD

tough abyss
#

the unit1 is also it's own name space

dim owl
#

it worked thank you very much!

tough abyss
#

As I said make sure you use setVariable on the player as well

#

because the (_x select 0) getVariable "myVar";

dusk sage
#

namespace o.o?

tough abyss
#

will return nil

dusk sage
#

Just an object

tough abyss
#

Wouldn't object be effectively considered it's own name space?

#

in a general sense?

dusk sage
#

Many people would tell you it's part of an 'object namespace'

#

But the object itself is defined in the mission NS

#

As for actually answering the question, that would boil down to what a name space is, and what it does

#

I doubt it'll tick the same boxes though ๐Ÿ˜‰

tough abyss
#

So are the values for objects

#

actually stored on the objects?

#

and they can't be accessed by missionNameSpace ?

dusk sage
#

Named objects can be accessed from the MNS

tough abyss
#

but when it's a _object setVariable ?

#

It's local to the object?

dusk sage
#

The variable you set with setVariable is local to your client, unless broadcasted, yeh

tough abyss
#

ah k

#

So thats why people use modules

#

or GameLogics to store states server-side

#

and use setVariable of them

dusk sage
#

Eh

#

Not quite

#

You can still broadcast setVariable fine to all clients

tough abyss
#

getDir return ZERO when the player have the direction of axis y?

spark phoenix
#

@tough abyss yes

Unlike real math, for arma Y = cos X = sin

tough abyss
#

@spark phoenix thankyou.

#

@spark phoenix this affect the result of atan and acos?

#

atan 30 in Arma is the same as atan 30 in Math?

#

OH.. i feel silly.

#

for sure is....

dusk sage
#

Yes maths doesn't change

#

y = cosx = sin?

tough abyss
#

My transformation from [x,y,z] to spheric cordinates and then to [x,y,z] again is not returning the same values.

dusk sage
#

What equations are you using in your transformation

tough abyss
#

Part "Coordinate system conversions" Cartesian Coordinates

#

@dusk sage

dusk sage
#

If it's not returning as you'd expect, you've probably done something wrong

tough abyss
#

Yes.

#

The azimuth angle is from X axis on those formulas.

dusk sage
#

Yes, it's around the X-Y plane

#

It should never be any different, by definition

tough abyss
#

Arma Azimuth is from y axis. so 0 in Arma is 90 in Math.

#

But only if you use a function like setDir or getDir

dusk sage
#

Azimuth is usually taken from north

#

Which in this case would be your y axis

#

There is nothing different about it

#

Think of it as a bearing, if that's any easier to picture

tough abyss
#

When i get the two angles of spherical coordinates, i sum 360 to it.

#

Because i need to compare it to other 2 angles.

#

To see if they are in a near direction.

dusk sage
#

Huh?

#

What angles exactly?

tough abyss
#

Azimuth and altitude

dusk sage
#

Comparing to*

tough abyss
#

The angles of Spherical coordinates

#

I find Azimuth and Altitude for objects arround the player

dusk sage
#

I mean, you're comparing them to 2 other angles

#

Which are?

#

The angles calculated for the objects?

tough abyss
#

and i compare the azimuth and Altitude of one object with the Azimuth and Altitude of other objects

#

To see if they are in the same or in a near direction.

dusk sage
#

Why are you using spherical for this?

tough abyss
#

To this comparison be more easy, i add 360 to all angles

dusk sage
#

I mean, sure you can, but you could also just utilise the vectors you already have in Cartesian

#

Adding 360 to the angle won't change anything

#

It'll still be in the same direction

tough abyss
#

You is right, i can use acos (_direction1 vectorCos _direction2)

#

If the result is small, i suppose they are in a near direction.

dusk sage
#

Yes

#

That'll give you the angle between them

#

Yeh

tough abyss
#

I'm turning my self in a workaholic... ๐Ÿ˜›

#

Need a break.

#

Thanks for the help. Time to sleep.

dusk sage
#

Welcome

crude ibex
#

_texs = [""/tex/tex1.paa"",""/tex/tex2.paa""]; _rndtex = _texs call BIS_fnc_selectRandom; (_this select 0) setObjectTexture [0, _rndtex];
Is there any reason that won't work in an objects init?

#

I can't figure it out, I have even set up a useraction to do the same thing and for whatever reason it won't work.

#

I finally decided to have the useraction show a hint containing _ rndtex and it shows "any" instead of a texture path.

#

Sorry just realized I was in scripting and not in config.

tough abyss
#

Yeah no A3 doesn't like double quotation marks @crude ibex

#

Unfortunately it's not python.

#

@BoGuu#1044 Whats the limit arma 3 can run with AI?

#

and headless clients, without degradation of the client performance?

#

I know @tough abyss said it was about 60 maximum

#

How much can the HC's run without client performance degradation?

vague hull
#

Depends on hardware. We once had 250 on the hc and the client fps only dropped down like 10 fps due to there where sometimes 20 units on the screen
The HC fps were lurking somewhere 25 as far as I remember. Yet this doesn't necessarily need to apply to your instance either

tough abyss
#

Well my I7-5820K with 64 AI caused my FPS to drop a lot

#

particularly when the AI opened fire @vague hull

vague hull
#

Yeah that's all totally normal since you need to calculate alot more stuff. It's always a good idea to kinda limit the AI in one particular area of the mission

#

Did you play a SP mission?

#

Because if the host is your own pc it will become one hell of a clusterfuck for the engine..
Try setting up the server, client and hc so that all of them has different resources (cores, priority etc. Pp.

tribal crane
#

Performance drops with any number of AI, if you turn off vsync you can see frames go down with even small numbers.

#

The curve starts to sharpen downwards though at about 50.

vague hull
#

PM ME your scenario :)

tough abyss
#

@dusk sage what i'm trying to do is reorganize the 3D icons that overlap one above the other. So for that i need to know if those icons are in the same direction (vectorCos), what means they are overlaping, and then reorganize then in the "celestial sphere" (where the center is the players eye). On the second part, the reorganize part, i still cant go away from spherical coordinates. This reorganize is to make all icons readable.

west lantern
tough abyss
#

My tests done in Alpha suggests 150 and about 35 players. Since then I have evidence that limit should be lower because staying above 40 ticks on the server is important for AI behaviour and I seem to recall at the time we were going off Arma 2 performance which was above 20 and subsequently we determined the AI didn't respond well. I can't see any evidence on our server performance that anything has changed so absolute limits of 150/35 is still what I suggest but you should aim for less.

#

If any part of the chain, server or HC is below 40 ticks you will see AI degradation, you really do need to maintain 40+ in Arma 3.

little eagle
#

@west lantern It's on stable too and it seems to work
Unfortunately it's server only, so very limited when used by clients via remote execution due to network delay (fails very often on short distance shots)
it being tagged "dev" probably means that it's subject to change and you'll be blamed if it's broken or even removed in the next udate

tough abyss
#

What is the use of that setShotParents?

leaden knoll
#

Hi guys. Could someone point me in the direction of where I can find something on the execution of a script while within an area. What I am trying to achieve is to update a list of areas you can spawn to by moving a marker. The markers are attached to group leaders. When the group decides to split into multiple groups it should pick up the new group leader as well. The script only needs to execute while within the vicinity of the tele-pole. I wanted to use a repeatable trigger but the trigger wont fire continiously while within the area. Any help would be appreciated

little eagle
#

What is the use of that setShotParents?
set what killed and handleDamage report as shooter (can be 'gunners' vehicle)/gunner (can only be a person)

#

horrible command name

jade abyss
#

ParentOwner, sounds okay

tough abyss
#

They added a getShotParents, so they added the opposite aswell. Atleast its only a serverside command

little eagle
#

both names suck

random glen
#

This is amazing how DoFire is unreliable...

meager granite
#

DoFire is Engage command + target reveal

#

Basically exactly the same thing as when you command AI unit to engage something

#

So yeah if AI thinks it shouldn't shoot it wouldn't

random glen
#

if AI thinks it shouldn't shoot
OPFOR unit
point blank range
doTarget in place
Hmmm, indeed, why he should open fire in that situation... >_<

young current
#

hes a pasifist

random glen
#

pacifist
He consistently spares one of four targets. Cute.

crude ibex
#

@tough abyss yeah yeah, too bad I'm modding standalone and not arma 3 and I've come to realize you have to use double quotes in standalone. That still doesn't explain why it returns "any" but, regardless I have it figured out another way. Thanks for the input.

west lantern
#

@little eagle thanks for the heads up, I will pass your note among users.

#

horrible command name

hah what to say about getShotParents

#

damn it BI... <Batman cries>

tough abyss
#

setBulletGuyAndVeh

#

getBulletGuyAndVeh

dusk sage
#

Talking about spherical coordinates, my lecturer was fucking up so hard he switched to Cartesian ๐Ÿค”

little eagle
#

getShotParents too reminds me of batman

dusk sage
#

Wow

#

I felt a physical heart ache

#

Deep

velvet merlin
#

The development team is now fully focusing on a clean sweep of the game. This means that for the next couple of weeks we're solely fixing bugs, focusing on performance and minor, yet long-standing issues, and polishing the game. As a consequence, all of the work is under a lock - only approved and manually selected pieces of data get in the final game and the rest has to wait until the lock is released. The plan is to finish this sweeping period by delivering Update 1.66. Hopefully, after we have results of some first build checks done by our Quality Assurance, we'll be able to publish the Release Candidate by the end of this week.

i guess now is the chance to get the A3 teams attention for long time or important issues

little eagle
#

fix tank PhysX

velvet merlin
#

i guess this will take till end of 2017 ๐Ÿ˜

tough abyss
#

Best Arma 3 update! Where do i pay for it?

tough abyss
#

@crude ibex How are you even modding standalone without a manual?

#

For how the scripting language is DayZ standalone works?

halcyon crypt
#

It's the same as in Take on Mars

#

as far as I know

tough abyss
#

Wheres the scripting manual for taken on mars?

halcyon crypt
#

no clue

paper rain
#

Details of EnScript aren't released yet

tough abyss
#

Take on mars could have been so much more.

#

Ohhhh

#

Take on mars scripting language is low overhead

#

@paper rain Very interesting

#

Looks very similar to C++ includes OOP too

#

objects.methodss

paper rain
#

It's said to be more like Java/C#. There's a QA with the Enfusion lead on the DayZ youtube channel which answers a little.

tough abyss
#

And... people are trying to mod DayZ Standalone already?

#

without actually knowing how the language works?

paper rain
#

I think they're just champing at the bit

#

Also, quick gripe/rant: Why the hell is there no colon after the default case for switch do statements? It took me 5 hours trying to fix my script when all it was was default: https://community.bistudio.com/wiki/switch_do ๐Ÿ˜  ๐Ÿ’ข

tough abyss
#

Which example uses default: ?

#

Or which syntax @paper rain ?

paper rain
#

whoops, I means switch do

tough abyss
#

It's the same syntax as C++

#

or C I believe.

#

Also

#

If you need to use switch just do this

#

Keeps the speed of if

#

without using switch do @paper rain

buoyant heath
#

How much of a difference are you seeing when you a run a performance check?

tough abyss
#

From what I've heard switch is costly in terms of execution

#

When compared to a scope call then exiting it

#

even using a lazy execution of switch(true) do {}

#

Which in my opinion is dirty

paper rain
#

No @tough abyss the only difference between SQF and C is the missing : after the default in SQF. I'm a C guy, so that's what threw me for a loop. Also, especially since SQF doesn't have an else-if, switch statements will always be faster because fewer conditions need to be evaluated. Notice how that page stipulates this is only to be used if switch syntax won't work.

tough abyss
#

@paper rain I am currently learning C the hardway.

#

Learning how the C <-> ASM conversion works

buoyant heath
#

There's an easy way?

tough abyss
#

Technically yes and no.

#

When you learn C <-> ASM

#

it becomes evne harder.

#

Reason? I want to be hacker.

paper rain
#

C isn't hard. Good C is hard.

tough abyss
#

The book I have on the subject is.

#

No this is not a "script kiddy" hackers book either.

paper rain
#

Ooo.. I have that book... somewhere. I think it's back at the parent's place.

#

If you like that book, you should also check out youtube videos of talks from "Defcon"

tough abyss
#

I need to find me a good C programming book

#

Hahaha defcon

#

Oh yeah, seen the owned by owner?

#

or Pwn'd by owner?

paper rain
#

yes

tough abyss
#

xD

#

"Don't steal a hackers computer"

paper rain
#

I also like the one where they put a RPi on a drone, fly it over homes and hack WEP passcodes. Also the one on "Bitsquatting"

tough abyss
#

@paper rain I'm more into the RND "high tech hacker stuff"

#

E.g Laser-cuttering into a CPU to snoop on RSA keys

#

Or starving CPU's of power to to weak RSA encryption

#

weaken*

paper rain
#

lol

tough abyss
#

They did it no joke.

#

Or

#

GPU accelerated password cracking

#

That sort of RND stuff @paper rain

#

And I effectively live here

#

and here

paper rain
#

Fun

tough abyss
#

@paper rain Nanotechnology and advanced technologies are the future.

buoyant heath
#

Back to the switch code topic for a second: Unless you're trying to squeeze hundredths of a millisecond gains out of a script, I'm not seeing an appreciable difference.

dusk sage
#

vs what?

buoyant heath
#

call { if (cond1) exitWith {//code 1}; if (cond2) exitWith {//code 2}; if (cond3) exitWith {//code 3}; //default code };

dusk sage
#

Why the need to call it D:?

buoyant heath
#

No idea, ask GeekGuy5401

#

No real difference from multiple ifs either

dusk sage
#

if then will be quickest

buoyant heath
#

as I said, hundredths of a millisecond

dusk sage
#

Switches are quite slow (relatively), in ARMA

#

But it really doesn't matter

crude ibex
#

@GeekyGuy5401 I'm not sure if that's sarcasm lol. I can tell you though it's a lot like arma 3 but, it has more functionality. If you like modding arma 3 you'll love SA. https://www.youtube.com/watch?v=cgSdh_EmIZ4 if you want to take a look.

#

On my phone it's being a pain.

#

@GeekyGuy5401#9206

#

@tough abyss

#

Sorry phones being an ass.

native hemlock
#

I did a comparison between large amounts of exitWiths and switches, but I'm unable to find the spreadsheet at the moment. I think the call is just used in case you didn't want to exit the scope of where the if checks are.

paper rain
#

The switch statement should always be faster than the call-exit pattern. I'll test it when I get home. Sure, it may be a tiny amount, but that starts to matter a lot in the context of an onEachFrame

native hemlock
#

Yeah iirc my testing said the same thing. I'm not sure if that's always been the case, or if a more recent A3 update improved the speed of switches.

tough abyss
#

@paper rain exactly

dusk sage
#

IIRC my testing showed switch to be slower also

#

It's been and still is pretty sloppy, unless something has changed

tough abyss
#

ever seen code do this?

dusk sage
#

Do what?

tough abyss
#

E.g altis life ``` switch(true) do
{
case someCond: { code };

case someCond2: { code };

}; ```

#

Dirty code.

dusk sage
#

I have yes

tough abyss
#

Nope I've found that in Altis Life code before

#

Ew.

dusk sage
#

When SQF lets you abuse it this much, it's not that surprising

#

There is much worse than using a switch true

tough abyss
#

I mean while {true} isn't inherently bad.

#

It depends on the context.

#

Waiting for input is normally an acceptable method.

dusk sage
#

I'm not sure where your standards come from

buoyant heath
#

I've used switch true to help organize done larger functions.

dusk sage
#

In a totally dodgy scripting language

tough abyss
#

If you do.

#

I just use while {true} do if (some exception) exitWith {};

#

exitWith is basically break

dusk sage
#

There is also break for you to use

tough abyss
#

You mean BreakTo?

dusk sage
#

Or you could have just put the condition directly in

#

Yeh

tough abyss
#

Fun question which is faster?

#

BreakTo or exitWith?

dusk sage
#

Both do different things

tough abyss
#

To be honest I haven't see much code that uses BreakTo or BreakOut

dusk sage
#

And it should be used a lot more

#

all my current work has been trying to integrate them more

#

To stop exitWith trees appearing

#

Anything I code in SQF Mr. Taxman ๐Ÿ˜‰

tough abyss
#

Interesting

dusk sage
#

Any place I need to exit out of nested scopes

tough abyss
#

using if (cond) then {breakOut "Loopscope" };

dusk sage
#

Im not sure what you're looking for ๐Ÿ˜›

tough abyss
#

Wonder if it's faster than exitWith{}

#

Anyone want to test?

dusk sage
#

I wouldn't imagine so

tough abyss
#

It's definitely more readable.

dusk sage
#

exitWith will break your current scope

tough abyss
#

Well it's using if(cond) then {} which is the fastest if-then construct

dusk sage
#

However breakOut can break out of any scopes (current or parent)

#

So there has to be an overhead there

tough abyss
#

I thought it only breaks the specific scope?

dusk sage
#

Yes

#

But that specific scope could be any scope of your choice

tough abyss
#

BreakTo breaks ALL scopes

#

Breakout breaks a specific scope named from ScopeName "loop" at the beginning of a loop

dusk sage
#

breakTo will break all child scopes of your specified scope

#

Not strictly all scopes

tough abyss
#

Interesting breakout can be used as a return statement

dusk sage
#

and breakOut will break out of all child scopes, including your specified

#

It's incredibly useful

#

I.e:

tough abyss
#

Example 1 is wrong?

#
scopeName "main";
while {true} do {
    scopeName "loop1";
    while {true} do {
        scopeName "loop2";
        if (condition1) then {breakTo "main"}; // Breaks all scopes and return to "main"
        if (condition2) then {breakOut "loop2"}; // Breaks scope named "loop2"
        sleep 1;
    };
    sleep 1;
};
dusk sage
#

No

#

Which bit are you pointing to

tough abyss
#

the if conditions

dusk sage
#

What about them?

paper rain
#

Jesus christ, please no one ever use breakOut or breakTo ever

tough abyss
#

Why?

paper rain
#

It's essentially a scoped goto. Gotos lead to spaghetti code. Spaghetti code leads to the dark side.

tough abyss
#

True....

dusk sage
#

That would purely depend on how you structure your code, though

tough abyss
#

Still want to know if exitWith is faster than if (condition) then {breakOut "Scope" };

dusk sage
#

And would (if used correctly), be equivalent to chaining exitWiths

tough abyss
#

True

#

Because you can actually

#

use a single definition

#

for an entire exitWith

#

Instead of if (condition) exitWithception {}

#

Altis Life does this A LOT

dusk sage
#
{
    if () then {
        if () exitWith {}
    };
    if (exit) exitWith {}
} count ...
tough abyss
#

For checking illegal expressions

dusk sage
#

and further, is completely disgusting

tough abyss
#

But is it more disgusting than breakOut?

dusk sage
#

Yes

dusk sage
#

What if you are 3 nested scopes in, and have to exit out of the entire script?

tough abyss
#

Theres your illegal expression checks

#

if(shit) exitWith

#

if(moreillegalshit) exitWith {};

dusk sage
#

There is nothing wrong with that

tough abyss
#

Couldn't you just replace that with a params?

#

restriction?

dusk sage
#

You could, for incorrect types

#

But if something null is passed, it wouldn't trigger

tough abyss
#

But couldn't you just

#

instead of the exitWiths

#

a single scope definition at the top

#

if(null _unit) then {breakTo "end"};

#

?

#

That way a single check would only need to execute one condition?

dusk sage
#

I just tested an example with 3 nested scopes, using exitWith gave 0.0075ms across multiple runs, and 0.004ms for breakOut

#

That way a single check would only need to execute one condition??

tough abyss
#

Not what I meant

dusk sage
#

It exits the scope if any of those are true

#

I'm not sure what you're saying

tough abyss
#

You can check multiple condition and send it to a breakOut

#

of a specific scope

dusk sage
#

exitWith is breaking out of the parent scope, though

tough abyss
#
if (isNull _unit) then {BreakOut "end"}; //Dafuq?
if (_unit != player) then {BreakOut "end"}; //Dafuq?
if (life_is_arrested) then {BreakOut "end"}; //Dafuq i'm already arrested
_illegalItems = LIFE_SETTINGS(getArray,"jail_seize_vItems");
scopeName "end";
#

?

paper rain
#

That's not in the code you linked. the life code uses exitWith

tough abyss
#

I know

#

I'm giving an example of preventing the Spaghetti code. Name the scope to the end of the script

dusk sage
#

I'm not seeing why you think using a breakOut would some how make it any better?

tough abyss
#

that way it will just terminate?

dusk sage
#

It would be spaghetti code to breakOut to the end of the file

#

Instead of just breaking out the parent scope

#

Which it does

#

if _unit isNull, it'll break entirely out

#

for example

tough abyss
#

Oh this is interesting * When "name" is an undefined scope name or "", the script quits current scope. *

paper rain
#

Looking more deeply, depending on how scopes are stored, I'm assuming a stack, the SQF engine may have to do an O(n) operation to find the target scope, where exitWith is always O(1)

tough abyss
#

so if a scope name is "" not defined

#

it will effectively do the same as exitWIth {} ?

dusk sage
#

I would imagine it would be an O(n) search

#

Almost certainly

#

Or, due to the way scopeName is stored, it is not

tough abyss
#

Test it?

paper rain
#

Going off my previous argument, my best guess is actually "No" as a break will try and find the scope name through all available scopes

dusk sage
#

But in the case it has to exit more than one scope, it couldn't be

tough abyss
#

One thing I've learned about the A3 SQF language... assume nothing..

#

I've been caught several times because of it...

paper rain
#

Hmmm... according to Killzonekid three years ago, switches are surprisingly slow

dusk sage
#

I can confirm

#

O(n)

tough abyss
#

k.

dusk sage
#
scopeName "main"; 
if (true) then {
    if (true) then {
        if (true) then {
            if (true) then { 
                breakOut "main"; 
            }; 
        }; 
    }; 
};
tough abyss
#

Has to recursively search each scope?

dusk sage
#

Is almost 25% faster than

#
scopeName "main"; 
if (true) then {
    scopeName "main2";
    if (true) then {
        scopeName "main3";
        if (true) then {
            scopeName "main4";
            if (true) then { 
                breakOut "main"; 
            }; 
        }; 
    }; 
};
#

Could be due to extra code though

#

hold on

paper rain
#

huh, we sure that naming the scopes isn't what takes time?

tough abyss
#

Not defining the scope as I said

dusk sage
#

yep, checking

paper rain
#

try a breakOut ""

tough abyss
#

When "name" is an undefined scope name or "", the script quits current scope.

dusk sage
#

So it seems the time taken with scopeName "xxx" is linear with number

#

As expected

#

checking the above minus times now

tough abyss
#

Is that not the same for exitWith ?

#

number n times?

paper rain
#

did a fake switch with exitWith and breakOut, exitWith is 0.000375 ms per loop faster

#

40000 samples each

dusk sage
#

A switch, why a switch?

#

Post the code

paper rain
#
_num = 0;  
call {
    scopeName "fake_switch";
    if (_num == 0) then {_num2str = "0"; breakOut "fake_switch"}; 
    if (_num == 1) then {_num2str = "1"; breakOut "fake_switch"}; 
    if (_num == 2) then {_num2str = "2"; breakOut "fake_switch"}; 
    _num2str = "N/A"; 
};```
dusk sage
#

Well ofcourse, it's a single scope

#

That's what we said before ๐Ÿ˜›

tough abyss
#

Yeah BoGuu

dusk sage
#

Now try with 3 scopes nested

tough abyss
#

Do a single if (condition) then {Breakout "" };

dusk sage
#

No, why

#

That is just silly

tough abyss
#

compared to a if (condition) exitWith {} ?

paper rain
#
_num = 0;  
call {
    if (_num == 0) exitWith {_num2str = "0"}; 
    if (_num == 1) exitWith {_num2str = "1"}; 
    if (_num == 2) exitWith {_num2str = "2"}; 
    _num2str = "N/A"; 
};```
dusk sage
#

exitWith will be faster for a single scope

#

There is no doubt

tough abyss
#

Humor me.

#

Also if you have a wiki-account, could you possibly post your results?

dusk sage
#
if (condition) then {Breakout "" };
#

Isn't going to do anything

#

but continue execution

tough abyss
#

Oh. der sorry.

dusk sage
#

๐Ÿ˜‰

#
scopeName "g";
if (condition) then {breakOut "g" };
#

That would work

paper rain
#

so... private "_num2str"; _num = 0; call { scopeName "outer"; call { scopeName "inner"; if (_num == 0) then {_num2str = "0"; breakTo "outer"}; if (_num == 1) then {_num2str = "1"; breakTo "outer"}; if (_num == 2) then {_num2str = "2"; breakTo "outer"}; _num2str = "N/A"; };}; work?

tough abyss
#

Don't nest the scopes

#

tell us what scopeName "main" If (condition) then {BreakOut "main"};

dusk sage
#

There is no point in testing that

tough abyss
#

at all?

dusk sage
#

the difference* you'll get will be indeterminate

#

The fluctuations will be bigger than the difference between them

tough abyss
#

Damn. Still not a fan of exitWith

dusk sage
#

I don't see how you think

#
if (true) exitWith {};
paper rain
#

exitWith is just the same as a return statement

dusk sage
#

is worse than

#
scopeName "main";
if (true) then {breakOut "main"};
paper rain
#

๐Ÿ‘

tough abyss
#

Was for intellectual / curiosity sake.

dusk sage
#

Well, exitWith will break one scope

paper rain
#

Well, it's turning out to be slower and uglier (imo)

dusk sage
#

returns are more along the breakOut line

#

Like I said

#

do a nested example

#
scopeName "main"; 
if (true) then {
    if (true) then {
        if (true) then {
            if (true) then { 
                breakOut "main"; 
            }; 
        }; 
    }; 
};
#

with exitWiths

#

๐Ÿ˜‰

paper rain
#

riight

dusk sage
#

It's common to get buried in scope nesting

#

And exitWith won't suffice once

tough abyss
#

Thats because arma 3 doesn't know how to stop evalulating code after the condition is fals.e

dusk sage
#

Huh?

#

What code are you writing

tough abyss
#

I saw something along those lines on code optimisation page

paper rain
#

Ugh, Killzonekid's still right. switch is still slower than the exitWith idiom

dusk sage
#

I said that earlier!

#

Switches are the spawn of the devil in SQF

tough abyss
#

It was about how arma 3 continues to evaluate conditions even after they return false

dusk sage
#

In what scenario does that ever occur?

tough abyss
#

"Condition line"

dusk sage
#

which bit o.o

#

copy paste it

tough abyss
#

if (_group knowsAbout vehicle _object > 0 && alive _object && canMove _object && count magazines _object > 0) then {
    //custom code
};

You may expect the engine to stop reading the condition after the group has no knowledge about the object but that's false. The engine will continue evaluating the condition until the end even if any of the previous conditions evaluated false. 
#

I did

dusk sage
#

if (_group knowsAbout vehicle _object > 0 && {alive _object && canMove _object} && {count magazines _object > 0}) then {
    //custom code
};
#

enjoy ๐Ÿ˜‰

#

oh, just found it

#

your link went to the bottom of the page

tough abyss
#

I know sorry

dusk sage
#

I've no idea why SQF hasn't been made to short circuit by default, and I'm yet to find a use for it

#

The only uses I could imagine should never be done

paper rain
#

It's a standard speedup most languages have.,

dusk sage
#

Indeed, every C based language atleast

paper rain
#

So... in SQF, nesting if-thens can be faster than one condition. ๐Ÿคฆ

dusk sage
#

Than one condition?

#

Or you mean 'multiple conditions' w/ lazy eval?

paper rain
#

The latter

dusk sage
#

yep, indeed

#

It won't matter, unless you really do have a nice tree going on

paper rain
#

Well, Christmas is in a month

#

wait... why is >> faster than / for Config files?

buoyant heath
#

C222: How much of a difference? How many statements did you check?

dusk sage
#

insert something engine related here blah

paper rain
#

I'd guess the implementation of >> is newer?

tough abyss
#

No clue why.

#

Intercept probably helps to understand that.

buoyant heath
#

C222: I don't see a time comparison. Did I overlook it?

tough abyss
#

Directly interfaces with the engine

#

But that just exposes the C++ interface

#

Not the underlaying reason

dusk sage
#

You'd have to wait for somebody with more internal knowledge to answer that I think

dim owl
#

Hi, can you sort numbers in a listbox ?

dusk sage
#

An in order the rows via numbers?

tough abyss
#

sort using an array

#

then loop the result

dim owl
#

Im trying to sort my listbox by servertime. So they can choose in a combobox from latest to newest or from newest to latest. Now i want to know how i can do this. Im filling the listbox with a array which includes the servertime.

dusk sage
#

then sort the array via servertime before adding your relevant data

dim owl
#

And how can i do that ?

dusk sage
#

a quick google search for 'sort arma 3' returns a lot ๐Ÿ˜‰

dim owl
#

Thx :D

#

Lets say i have a combobox and fill it with following: "A -> Z", "Z -> A", "Recent -> Past", "Past -> Recent". How can i sort the listbox which is filled with foreach and a array like this: [["Testname",458,"Testvar"],["Second Testname", 480, "SecondTestVar"]]. (The numbers are the servertime). And how can i sort the listbox by the combobox ?

dusk sage
#

Did you google sorting?

#

You can sort arrays

dim owl
#

Yeah. So i would do it like this ?:

_test =[[["Testname, 460],["2nd Testname, 500]], [], {_x select 1},"ASCEND"]call BIS_fnc_sortBy;
dusk sage
#

You tell me

dim owl
#

How can i sort my array from a single element with the sort function ?
myarray = [[123,"test"],[124,"test1"],[125,"test2"]]; myarray sort false?
But how can i sort it by selected element like: myarray select 0 ?

urban anchor
#

If anyone knows this. I'm trying to make a old school style lightbar, The ones that rotate. I'm trying to figure out how I can do the ground effect so that it rotates with the lights. any ideas?

young current
#

not very well in armas lighting engine I recon.

velvet merlin
#

to the pFEH believers - why to use it for sth that isnt time critical?

tribal crane
#

To make sure scripts never interleave.

#

(Using unscheduled scripts is easier than thinking about what you're doing)

stable wave
#

Anyone knows why playSound would kick players out of server?

little eagle
#

teach me

#

teach me how to script

velvet merlin
#

@tribal crane good point thanks

#

still for single instance stuff (ie player only) and low frequency, i still cant see the point

tribal crane
#

Yeah, you should almost never do it.

velvet merlin
#

for example weapon state and magazines is not something that changes fast by any means (aside from scripting manipulation and there probably pFEH may even cause undesired outcome)

tribal crane
#

Besides, mutual exclusion on a single host won't help when you have a bunch of other hosts with MP.

little eagle
#

please stop. cringe
you all have no idea what you're talking about

tough abyss
#

and you do? You litereally asked how to script

buoyant heath
#

Heaping dose of sarcasm there.

tough abyss
#

@dusk sage want to know the error i was having with spherical coordinates?

dusk sage
#

Sure

tough abyss
#

@dusk sage the formula is in radians...

warped thicket
#

@velvet merlin

weapon state and magazines is not something that changes fast by any means
and how exactly would you manipulate anything with that without knowing at the time when it happens? knowing that few seconds later is already too late

tough abyss
#

obvious thing.

dusk sage
#

The formula can be in radians or degrees, they both represent the same quantity

#

Just don't get it wrong ๐Ÿ˜‰

tough abyss
#

yes, i know, but arma 3 functions use degrees.

#

so you need to convert before use

dusk sage
#

You started with degrees

#

No need to convert anything

tough abyss
#

can't trow degree in a formula made for radians

little eagle
#

*2pi/360 or something

dusk sage
#

Every term you have relying on either angle, is the same regardless of your choice

tough abyss
#

instead of 45 degrees i need to use pi/4

dusk sage
#

No, you don't

#

Unless the functions use radians explicitly

#

Which IIRC they don't

little eagle
#

sin / cos etc, use degree in Arma

dusk sage
#

So yeh, sticking with degrees would be more logical for these purposes

#

The only terms relying on angles are trigonometric functions, it won't matter

tough abyss
#

The formula i'm using to convert between spherical to cartesian uses radians

dusk sage
#

..

#

Post the equation

tough abyss
little eagle
#

where does that say radians?

tough abyss
#

i use degree: error

#

i use radians: no error

#

the test is convert [1,0,0]

#

result is know

dusk sage
#

Okay, so which term do you think will change, given using degrees instead?

little eagle
#

use atan2 instead of atan

dusk sage
#

Again, like said above, ARMA uses degrees for its trig functions

little eagle
#

it handles 0

tough abyss
#

convert degree to radians is simple

#

and vice versa

dusk sage
#

You don't need to

little eagle
#

x atan2 y instead of atan (x/y)

#

will probably solve your problem

dusk sage
#

The functions in ARMA take degrees, you need to use degrees

#

What you do on the other side, doesn't matter

indigo snow
#

as long as you dont use the radian angle to describe circumference all formulas work with both degrees and radians since its a linear conversion

little eagle
#

Guys. I really think the issue is dividing by 0

#

atan2 was made to handle this

#

specifically

dusk sage
#

Most likely

indigo snow
#

ye seems the most likely

#

just wanted to specify there are no radian vs degree functions if youre just using sine functions

little eagle
#

yeah. it's all basic triginometry functions. sin, cos, atan. they all use degrees in Arma

dusk sage
#

eh

indigo snow
#

only when the radian angle is used to discribe circumference but then theres no sine or cosine in sight

dusk sage
#

Any case where you are relying on an angle itself, yes

#

loads of cases

steep matrix
#

@warped thicket seconds is obviously way too long. however per frame is a frequency you not always need/no delay at all

tough abyss
little eagle
#

oh god excel

dusk sage
#

You've gone a bit backwards with your definitions

#

Perhaps drawing a sphere, your coordinate axes, and your vector will help you visualise it

indigo snow
#

I'm not sure what that snap shows other than that excel uses radians for sine and cosine

dusk sage
#

It shows he's mixing up what his theta and phi are defined as

little eagle
#

I actually think Excel does use radians for whatever reason

indigo snow
#

it definitively does

little eagle
#

I vagualy remember soething like that

indigo snow
#

and i think i see, boguu

little eagle
#

Should just either use pen and paper or directly enter the previous snippet into SQF

#

SQF is better than Excel for these few lines

#

this I mean

indigo snow
#

have you heard about our lord and saviour, MATLAB?

dusk sage
#

Don't need MatLab for this shit ๐Ÿ˜„

little eagle
#

Overkill. The answer is right in front of him/us

#

Don't need MatLab for this shit ๐Ÿ˜„
this

tough abyss
#

i believe a was talking shit hahaha

little eagle
#

No, you just used Excel for whatever reason

#

Freeware on Windows PCs

#

Excel has to die if it hasn't already

tough abyss
#

but in THIS formula, really don't matter if radians or degree...

dusk sage
#

yes!

tough abyss
#

but this is not a generic assumption

dusk sage
#

It is in the case you are relying purely on trig functions, such as this

tough abyss
#

yes, you just need to use the angle metric the trig functions are made for

little eagle
#

"angle metric" sounds wrong to me

tough abyss
#

i mean degree or radians

little eagle
#

well. it's clear which one it is

dusk sage
#

You should be using radians 99% of the time, but SQF, is well, SQF

little eagle
#

in SQF too

#

I think the only place is in model.cfgs. But everyone just uses "rad 45" etc. there, so it's almost the same

#

rad converts degrees to radians

#

deg does the opposite

#

But you'll almost never need them

#

certainly not for this

dusk sage
tough abyss
#

@dusk sage nice, thankyou.

dusk sage
#

study*, my typing is poor today

little eagle
#
private _polar = [x,y,z] call CBA_fnc_vect2Polar;
_polar params ["_r", "_dir", "_elev"];

_elev = _elev + 15;
private _cartesian = [_r, _dir, _elev] call CBA_fnc_polar2vect;
#

I think that should work

tough abyss
#

Awesome!

little eagle
#

Never used them, but now I remember they exist

tough abyss
#

@little eagle those 2 functions are old to CBA?

little eagle
#

yes, but they are improved with new commands from A3

#

vector commands, params, etc

dusk sage
#

eh

#

What form do these equations try to achieve

#

Seems like they are wrong

#

Nvm, just displaying the elevation instead

#

Bizarre

little eagle
#

?. Not sure if adding 15 to the elev was what he wanted. Can't remember exactly

dusk sage
#

The CBA_fnc_vect2Polar is returning an elevation, not an inclination, just confused me for a second while reading

little eagle
#

I think they mean the same thing

#

a vector in the form [magnitude, azimuth, elevation].

dusk sage
#

Your elevation is taken from the plane

#

The inclination is standardly defined from the z-axis

little eagle
#

oh, ok

#

maybe

#

wouldn't change anything

#

maybe the sign. plus or minus

#

idk

dusk sage
#

It would be 90 - elevation

#

Ultimately will make it easier to work with in ARMA though

little eagle
#

yeah. it changes the sign. +15 vs. -15

dusk sage
#

eh

#

oh right

#

_elev = _elev + 15;

little eagle
#

that's what I meant yes

dusk sage
#

I'm not sure what he wanted anymore

#

๐Ÿ˜„

little eagle
#

turn up a cartesian vector from 90 to 105 degree

#

iirc

tough abyss
#

this was just an example

#

what i want is reorganize 3D icons that overlap

#

in a way all of then get readable

tough abyss
#

for example, if 5 3D icons overlap i will calculate the average direction and create 5 positions -30 -15 0 15 30 above and bellow the average direction to put the 3D icons

#

or may be -12 -6 0 6 12

#

radius dont interfer since 3D icons dont have size affected by distance

#

so in the spherical coordinate of the icon i can use any r > 0

urban anchor
#

Anyone know how I can make the ground effects for a lightbar rotate constatly. I'm making an old style lightbar the one that rotates. I can't find a way to make it without a giant sqf

swift ferry
#

Bit of an odd request, is it possible to take the turret of the M4 Scorcher and attach it to the hull of the Kuma via scripts?

little eagle
#

no

swift ferry
#

Damn, that's a shame.

twilit nymph
#

Totally easy question I know: I am using a mod that makes my units start with one rangefinder in uniform and two in backpack (doesn't show in loadout editor). How can I use init field to remove these? I have tried this: removeItemFromUniform "Rangefinder";

#

Doesn't work

#

Changing it to: this removeItemFromUniform "Rangefinder"; fixed it, but added earplugs(ace3) and a rangefinder in vest instead

#

Seems like my mod is adding random stuff, because I gotta have it

tough abyss
#

SPHERICAL COORDS: The process to find a vector direction and elevation is really simple, just some equilateral triangles!

dim owl
#

how can i execute deleteat so it deletes a array on every client, but server ?

dusk sage
#

Think you're looking for right angle, not equilateral ๐Ÿ˜‰

#

Broadcast your array across the network @dim owl

dim owl
#

how could i do that ? actually i pushback the array global, but server. and how can i delete something global, but server ?

buoyant heath
#

global but server?

dim owl
#

i mean on every client but server

tough abyss
#

Make it into a function

#

run the function via remoteExec

#

@dim owl

#

It would also need to be a global variable

#

and maybe a publicVariable

#

missionNameSpace setVariable ["myArray",myArraysValue,true];

#

then on the clients

#

You could even use the command directly.

#

[{ myArrray deletaAt Index }] remoteExec ["call",-2,false];

#

That will run on every client but the serve

dim owl
#

so like

testvar remoteexec [deleteAt, 5, -2];

?

tough abyss
#

No.

#

the value in the remoteExec

#

after the "delete at"

#

is the targets

#

You could even use the player object in place of it.

#

[testVar,5] remoteExec ["deleteAt",-2,false];

#

or

#

[testVar,5] remoteExec ["deleteAt",player,false];

dim owl
#

ah okay i understand ๐Ÿ˜„ thank you ๐Ÿ˜ƒ

tough abyss
#

with player it will only execute on the player where local

#

so player might be more favorable.

dim owl
#

okay thx

tough abyss
#

Remember if this is Altis Life or the etc

#

you must whitelist the command

dusk sage
#

Not sure that remoteExec is going to work

dim owl
#

or maybe mp function

buoyant heath
#

Depending on what's going on and how the clients receive the array, you're also looking at a source of desync for JIP

noble juniper
#

@buoyant heath how to combat Desync with JIP players in this specific scenario ?

#

im just wondering, because i haven't coded JIP related stuff in ages

dim owl
#

i want to create a listbox and a listbox entry foreach array entry. and you can delete a entry of the array by clicking a button and now im not sure about deleting it. thats what i want to do ๐Ÿ˜„ so should i use mp function or remoteexec ?

noble juniper
#

Ebay / market system ?

#

for player trading ?

#

doesen't matter

#

I think your Architecture isn't that great in my mind.

#

but, never mind ...

#

@buoyant heath I now remember why i didn't have JIP problems, i did everything request based.

paper rain
#

I am trying to write a function to return the four corners of a rectangle marker. It works fine... until I ry and adjust for rotation

#

Does such a function already exsist?

tough abyss
#

@paper rain Why the horrible naming?

#

Couldn't you have commented them?

#

if you are going to use really short variable names?

#

I mean you make work for yourself...

#

Also do you absolutely need the the corners @paper rain

#

?

paper rain
#

I updated the naming, and yes, I want the corners

#

I'm trying to implement the math detailed here, but it's transforming the points incorrectly

meager granite
#
getMarkerCorners = {
    private _pos = markerPos _this;
    private _size = markerSize _this;
    private _dir = markerDir _this;
    private _wsin = (_size select 0) * sin (_dir + 90);
    private _wcos = (_size select 0) * cos (_dir + 90);
    private _hsin = (_size select 1) * sin (_dir);
    private _hcos = (_size select 1) * cos (_dir);

    [
        [(_pos select 0) - _wsin + _hsin, (_pos select 1) - _wcos + _hcos],
        [(_pos select 0) + _wsin + _hsin, (_pos select 1) + _wcos + _hcos],
        [(_pos select 0) + _wsin - _hsin, (_pos select 1) + _wcos - _hcos],
        [(_pos select 0) - _wsin - _hsin, (_pos select 1) - _wcos - _hcos]
    ]
};
#

here you go, wrote it just for you

#

Returns corners in order of: top left, top right, bottom right, bottom left

dim owl
#

how can i remoteexec on server only ?

meager granite
#

When 2, it will be executed only by server.

paper rain
#

Thank you so much @meager granite

earnest valve
#

@meager granite Just curious. Why write so many private commands beside the variables? When you could just do: private ["_pos", "_size", "_dir", "_wsin"];

twilit nymph
#

Is there a way to remove all items from uniform?

earnest valve
#

I believe there Is. But I'm on mobile atm, so I can't write the block of code for you. :(

#

You need to create a temporary loop or for loop. Then have some conditions to check if they are in the uniform or not.

twilit nymph
#

Ahh well maybe easier to remove all items, then add items to vest and backpack?

#

How to add more than one item?

#

"'''removeAllItems this;
this addItemToUniform "ACE_fieldDressing";
this addItemToUniform "ACE_morphine";"

#

'''removeAllItems this;
this addItemToUniform "ACE_fieldDressing";
this addItemToUniform "ACE_morphine";'''

earnest valve
#

Hmm. Well if you do that, then you might need to log/store the classnames in an array. But once I get back into ArmA (haven't updated it for 6 months, lol), I might drop a block of code for you. (I hope)

twilit nymph
#

Thanks alot

earnest valve
#

Oh

#

Interesting

#

The addItemToUniform sounds new. (I haven't seen the latest list. Sorry) >.<

paper rain
#

@earnest valve in the optimization guide, it points out that the newer-style private method is faster than the old private ["_things"];

earnest valve
#

Ohhhhhhhh

#

Cool, so that's good to know. Once I get back into DSS, I'll have a fiddle with some of the new code. :)

twilit nymph
#

How to format as multiline code in discord?

#
counter = 0;

while {counter < 10} do
{
    this addItemToUniform "ACE_fieldDressing";
    this addItemToUniform "ACE_morphine";
    counter = counter + 1;
}```
#

This did what I wanted it too

#

Just gotta add items like this

#

I know it is possible, but how to have several of these in a file for multiple units, rather than in the init of a unit?

#

Like placing it in a file inside the mission folder, and using like a variable name instead of this

#

Like teamLeader for teamleader and marksman

#

For marksman

#

Figured this out two

#

init.sqf

#

Know this is not huge for you scripters, but this might just be the start of my scripting career

paper rain
little eagle
#

@earnest valve It's faster to execute for the game and it's easier to maintain, since it contains no redunant information like private ARRAY does

earnest valve
#

Ok

halcyon crypt
#

and it just feels nicer ^^

twilit nymph
#

Thanks @paper rain

#

Anyone got an idea for me to add custom music to zeus?

twilit nymph
#

Init code for making AI ignore unit?

little eagle
#

ignore unit? as in ignore the enemies?

#

probably something like this.

this setBehaviour "CARELESS";
this setCombatMode "BLUE";
twilit nymph
#

Im trying to place a drone, but as my viewdistance (for videocard reasons) can't be that long I don't want the enemys to attack it

#

Simply pretend it doesnt exist

#

I tried setCaptive True

#

They didn't attack it, but I cannot control it with MCC either

halcyon crypt
twilit nymph
#

@halcyon crypt this made it not move, and somehow taking control of it and using thermal shows no thermal signatures even though there should be some there

little eagle
#

that's a problem with mcc then

#

setCaptive is the only way to make a unit be ignored by the enemies

#

They have to replace side _unit with side group _unit in their code everywhere. I've been saying this for years

steep matrix
little eagle
steep matrix
#

yeah that can be done but still leaves the useraction..

halcyon crypt
#

on a fancy loop or whatever

#

DEV only for now though

#

hmm it might be in 1.64 but the wiki says DEV (1.63)

#

also no clue if it works for the inventory action

little eagle
#

Pretty sure removeAction does only work with actions that were added by addAction in the first place

dusk sage
#

^ +1

tender fossil
#

Can you stop server from updating unit position to clients with enableSimulation false (ie. does the disabled simulation contain position updates)?

buoyant heath
#

No.

tender fossil
#

@buoyant heath So the server will keep syncing the unit to clients even with enableSimulation false?

buoyant heath
#

Actually, I'm not sure how that'll work out. I forgot enableSimulation is not a global effect.

warped thicket
#

enableSimulationGlobal

#

you can also disable it with just enableSimulation if you use it in object's init field

#

and most simple objects already have it disabled

#

and there is also a checkbox in Eden ๐Ÿ˜›

tender fossil
#

@warped thicket @buoyant heath I'm in Arma 2, so can't use the global version of the command

#

Working on sophisticated optimization for a resource heavy mission

waxen finch
#

Looking for someone with skills to collaborate on a Sci-fi Survival project, pm me if you have time and your interested. Forewarning, its a big project.

tender fossil
#

So I'll ask again: can you stop server from updating unit position to clients with enableSimulation false (ie. does the disabled simulation contain position updates)?

meager granite
#

Normally you can't

#

If you need it to have global entity stay at different positions on different clients I can suggest hacky approach

#

disabled simulation doesn't stop clients from getting general update packets from server for that entity

#

by general update I mean whatever is being regularly sent from server - position, orientation, damage, whatever else

tender fossil
#

"disabled simulation doesn't stop clients from getting general update packets from server for that entity" @meager granite yes, that's exactly what I'm trying to achieve.

#

Kind of kill all the information flow (under certain conditions) about unit A to unit B and then enable it again when needed.

paper rain
#

That sounds very engine-level. I'd be surprised if there were a way to achive it inside of SQF

tender fossil
#

@paper rain I know it has been done to some extent at least, but don't know how exactly.

paper rain
#

I've done it by accident kinda with disableSimulation in client-run code. Not sure it it stops updates though or just didn't display it.

#

Since that statement's effect scope is local

#

Sorry, meant enableSimulation

little eagle
#

why not use createVehicleLocal for this then?

tough abyss
#

Anyone that know a bit of ACE can help me?

#

BRPVP + ACE: injuries are not recorded.

#

I get damaged, but no injuries recorded.

#

Can we talk in private?

tough abyss
#

๐Ÿณ๏ธโ€๐ŸŒˆ

#

@clear tendon hey Jay, good news!!!

broken forge
#

how would I go about adding a 0 in front of the dayTime minute if below 10 min as well as adding a 0 in front of the sec if below 10 sec

#
//daytime = 1.66046
_hour = floor daytime;
_minute = floor ((daytime - _hour) * 60);
_second = floor (((((daytime) - (_hour))*60) - _minute)*60);
_time24 = text format ["%1:%2:%3",_hour,_minute,_second];
//_time24 = 1:39:37
#

the text below that code states that this doesn't add a zero in front of the minute and seconds if they are below 10 min and 10 sec, that there's more scripting that needs to be done to do that

vapid frigate
#

add if (_minute < 10) then { _minute = format ["0%1", _minute] }; just before the _time24 one

broken forge
#

thanks Lecks, now one more question if you don't mind

#

I'm also trying to get the date in a specific format. so if it's 1/1/2017, I'd like to get it to appear as 01 JAN 2017

#

Right now I have this as a script:

while {true} do {
    _locationType = ["NameCity", "NameCityCapital", "NameMarine", "NameVillage"];
    _nearestCity = nearestLocation [getPos player, toString(_locationType)];

    _hour = floor dayTime;
    _minute = floor ((dayTime - _hour) * 60);
    _second = floor (((((dayTime) - (_hour)) * 60) - _minute) * 60);

    if (_minute < 10) then {_minute = format ["0%1", _minute]};
    _time24 = text format ["%1:%2:%3",_hour,_minute,_second];

    //hint format ["%1",text(_nearestCity)];

    [text(_nearestCity), str(_time24), str(date select 2) + " " + "JAN" + " " + str(date select 0)] call BIS_fnc_infoText;
    sleep 300;
};
vapid frigate
#

i guess you want ["JAN", "FEB, "etc] select (_month-1)

broken forge
#

not sure how to implement that, but yes I think that's what I'm going for, that command takes out the number for the month and replaces it with abbreviation of the month right?

vapid frigate
#

that will return the text based on the month that 'date' returns, yeah

#

other than that it's just selecting the stuff out of the array

crude ibex
#

Is there anyway to tent the screen a spacific color? For instance if I put on goggles "X" it tents the screen green and if I put on goggles "Z" it tents the screen blue?

vapid frigate
#

@crude ibex ace3 does that

broken forge
#

@vapid frigate So I guess I'm still lost on where to put that command at, or how to implement it into what I already have.

vapid frigate
#

it's 'tint' btw.. might help looking it up

crude ibex
#

Haha thanks, was typing and watching a video. Wasn't paying much attention.

vapid frigate
#

it's done using these

crude ibex
#

@vapid frigate what about overlaying a texture?

#

That's possible as well correct?

vapid frigate
#

i imagine so, but i'm guessing the post processing would be faster

#

and might look different.. an overlay might remove some detail or something

#

or not change as well with lighting

#

i think it's the ColorCorrection PP effect

broken forge
#
while {true} do {
    _locationType = ["NameCity", "NameCityCapital", "NameMarine", "NameVillage"];
    _nearestCity = nearestLocation [getPos player, toString(_locationType)];

    _hour = floor dayTime;
    _minute = floor ((dayTime - _hour) * 60);
    _second = floor (((((dayTime) - (_hour)) * 60) - _minute) * 60);

    if (_minute < 10) then {_minute = format ["0%1", _minute]};
    _time = text format ["%1:%2:%3", _hour, _minute, _second];

    _month = date select 1;
    ["JAN", "FEB", "March"] select (_month - 1);

    [text(_nearestCity), str(_time), str(date select 2) + " " + str(date select 1) + " " + str(date select 0)] call BIS_fnc_infoText;
    sleep 300;
};
vapid frigate
#

just change str(date select 1) to _month

broken forge
#

k

vapid frigate
#

format is probably easier to read too

#

format ["%1 %2 %3", date select 2, _month, date select 0]

crude ibex
#

The overlay would consist of darkening the edges of the screen, particular texture for particular giggles.

vapid frigate
#

zelik: i guess if you want more than a tint then a overlay is probably the way to go

crude ibex
#

Any idea how to do that?

broken forge
#
while {true} do {
    _locationType = ["NameCity", "NameCityCapital", "NameMarine", "NameVillage"];
    _nearestCity = nearestLocation [getPos player, toString(_locationType)];

    _hour = floor dayTime;
    _minute = floor ((dayTime - _hour) * 60);
    _second = floor (((((dayTime) - (_hour)) * 60) - _minute) * 60);

    if (_minute < 10) then {_minute = format ["0%1", _minute]};
    if (_second < 10) then {_second = format ["0%1", _second]};
    _time = text format ["%1:%2:%3", _hour, _minute, _second];

    _month = date select 1;
    _date = text format ["%1 %2 %3", date select 2, _month, date select 0];

    [text(_nearestCity), str(_time), str(_month)] call BIS_fnc_infoText;
    sleep 300;
};

returns: Location, Time, Date, but the date only has 1 for it, the Name of the month and year don't show up

crude ibex
#

_date

broken forge
#

woops

crude ibex
#

It happens man.

broken forge
#

well everything is showing now, but the month is still 1 instead of JAN

#

just updated this:
_date = text format ["%1 %2 %3", date select 2, ["JAN", "FEB", "March"] select (_month - 1), date select 0];

#

now JAN shows up, will that work if the mission was set to April?

#

or would I have to put all the months in?

crude ibex
#

You have to put all the months in

broken forge
#

k, thanks

#

Final result is this:

    _locationType = ["NameCity", "NameCityCapital", "NameMarine", "NameVillage"];
    _nearestCity = nearestLocation [getPos player, toString(_locationType)];

    _hour = floor dayTime;
    _minute = floor ((dayTime - _hour) * 60);
    _second = floor (((((dayTime) - (_hour)) * 60) - _minute) * 60);

    if (_minute < 10) then {_minute = format ["0%1", _minute]};
    if (_second < 10) then {_second = format ["0%1", _second]};
    _time = text format ["%1:%2:%3", _hour, _minute, _second];

    _month = date select 1;
    _date = text format ["%1 %2 %3", date select 2, ["JAN", "FEB", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] select (_month - 1), date select 0];

    [text(_nearestCity), str(_time), str(_date)] call BIS_fnc_infoText;
    sleep 300;
};
crude ibex
#

Define a new array, for instance _monthabb = ["jan","feb", etc....] then update

broken forge
#

k

crude ibex
#

updated this:
_date = text format ["%1 %2 %3", date select 2, _monthabb select (_month - 1), date select 0];

#

@broken forge edited sorry

#

The reason for the _month -1 is because arrays alway start at 0. So then real month is 1 and the value in the array for Jan is 0. So you catch the month and -1 from it to get 0. Hope that makes sense.

#

Final result is this:
while {true} do {
_locationType = ["NameCity", "NameCityCapital", "NameMarine", "NameVillage"];
_nearestCity = nearestLocation [getPos player, toString(_locationType)];

_hour = floor dayTime;
_minute = floor ((dayTime - _hour)  60);
_second = floor (((((dayTime) - (_hour))  60) - _minute) * 60);

if (_minute < 10) then {_minute = format ["0%1", _minute]};
if (_second < 10) then {_second = format ["0%1", _second]};
_time = text format ["%1:%2:%3", _hour, _minute, _second];

_month = date select 1;
_monthabb = ["JAN", "FEB", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
_date = text format ["%1 %2 %3", date select 2, _monthabb select (_month - 1), date select 0];

[text(_nearestCity), str(_time), str(_date)] call BIS_fnc_infoText;
sleep 300;

}; @broken forge

#

You could also put an unused value at the beginning, like so.
_monthabb = ["N/A","JAN", "FEB", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] and then change this to
_monthabb select (_month)

vapid frigate
#

using events rather than while {true} would probably be better too

#

Put/Take events

#

err nvm, was thinking of zelik's problem lol

broken forge
#

well I'd like to get the script to only run when the player enters one of the locationTypes listed in the array

#

Something like this:

_locationType = ["NameCity", "NameCityCapital", "NameMarine", "NameVillage"];
_nearestCity = nearestLocation [getPos player, toString(_locationType)];

_hour = floor dayTime;
_minute = floor ((dayTime - _hour) * 60);
_second = floor (((((dayTime) - (_hour)) * 60) - _minute) * 60);

if (_minute < 10) then {_minute = format ["0%1", _minute]};
if (_second < 10) then {_second = format ["0%1", _second]};

_time = text format ["%1:%2:%3", _hour, _minute, _second];

_month = date select 1;
_monthToYear = ["JAN", "FEB", "MAR", "APR", "MAY", "JUNE", "JULY", "AUG", "SEP", "OCT", "NOV", "DEC"];
_date = text format ["%1 %2 %3", date select 2, _monthToYear select (_month - 1), date select 0];

if (nearestLocation [getPos player, toString(_locationType)];) then {
    [text(_nearestCity), str(_time), str(_date)] call BIS_fnc_infoText;
};
#

I'll have to put a loop in, but it be nice that if the player where to be in one of the locationTypes listed, then call BIS_fnc_infoText, instead of calling BIS_fnc_infoText every 5min

steep matrix
#

what was the check again for remote control safe player entity check?

tough abyss
#

by the way @broken forge the str()

#

is slower than format ["%1",_var];

little eagle
#

I'm pretty sure there is a BI function that can output a formated date

steep matrix
#

@little eagle ty

#

if i understand it correctly, one has to use this for every instance one uses currently "player", right?

little eagle
#

_

#

?

#

You just call this function and it reports the currently controlled entity

austere granite
#

Does anyone know how to disable the sound that gets played during setUnconscious true? Can do mod

icy raft
#

Sup

#

C++98 or C++11/14?

#

What's compatible?

halcyon crypt
#

everything

#

as long as it exposes the right C interface

little eagle
#

@austere granite you can do this, but only with changing configs and not wth SQF

#

Oh and clearing the array locks up the game, so set volume to 0 like the comment says

halcyon crypt
#

that's some weird ass behaviour ๐Ÿ˜›

little eagle
#

what is?

halcyon crypt
#

locking up if you remove the sounds

little eagle
#

Yeah. Same when using that dummy empty sound file

#

I think it tries to play a new one when the previous one was finished

#

and since both methods mean 0 seconds delay, it keeps trying to play a sound

#

-> look up

#

{"A3\Sounds_F\dummysound.wss",1,1}

austere granite
#

Thanks a lot ๐Ÿ˜ƒ

halcyon crypt
#

is there any info on the dynamic simulation stuff?

#

can't find much on the biki or the forums

little eagle
#

it's WIP

#

They'll explain it when they know what it actually can do

halcyon crypt
#

thing is, for the RC the dynamic simulation is an "area of focus" but not much to focus on without info ^^

#

hmm judging by the changelog for the dev branch it's just the simulation manager but integrated with Eden

#

Added: Disabled entities and entities with Dynamic Simulation enabled are now visualized (next to an entity's icon)

little eagle
#

nah, that sounds like they show which ones are disabled

#

doesn't sound like it has anything to do with the dymacially disabling stuff

halcyon crypt
#

I meant it as in a toggle for dynamic simulation/simulation manager for units

#

meh, we'll see I guess

little eagle
#

Fixed: The GetOutMan Event Handler did not return commanders when it was supposed to
Fixed: The GetOutMan Event Handler would return commanders too often

#

heh

halcyon crypt
#

lol

dim owl
#

hey guys, i set a missionnamespace variable in my script but if i want to request the variable from another client it returns []
trying it like this:

(missionNamespace getVariable "myVar") pushback [player, name player, getPlayerUID player, position player, false, date];

before i defined my variable "myVar"
missionNamespace setVariable ["myVar",[]];

buoyant heath
#

from another client - There's your problem

dim owl
#

how could i do this for the server so every client has the same array at the end ?

buoyant heath
#

objectName setVariable [name, value, public] You need to use the 3rd parameter to public the variable.

indigo snow
#

simply using pushBack will alter the pointer but not PV it yea

buoyant heath
#

There's that too

#

I see there's a note from a couple years back about missionNamespace not working with the public parameter. If that's the case, you should be able to use publicVariable to share the data

torn jungle
#

In a mission, I have dozens of CIV side units dressed in soldier gear doing patrols on a city, this way players can safely look for stuff around the city. Somewhere down the line i would like all of them to instantly switch to OPFOR (so players are now enemy number one).

#

because that one changes the group. from my understanding i could switch them all to an OPFOR unit's group, which would turn them into OPFOR, but the thing is i want them all to retain their respective groupings/patrol waypoints.

dim owl
#

im trying it now with publicvariable and a global var

vague hull
#

for objects that do not have a inventory "weaponsItemsCargo" returns null instead of an empty array, can anybody confirm this?

tough abyss
#

Test it yourself?

little eagle
#

yes it's true

lethal ingot
#

If I use "player" variable in scripts, does it work in MP and dedicated server and applies to all players on the server?

little eagle
#

to get around this, just use
[weaponsItemsCargo _this] param [0, []]

#

If I use "player" variable in scripts, does it work in MP
yes

#

and dedicated server
it will be a <null object> on non-interface machines (dedic, HC)

#

and applies to all players on the server?
certainly not. A script only has effects where it is executed, unless the executed command has global effects

#

player itself has no effects, so you can't tell this

lethal ingot
#

Okey, if I want to detect nearest player (any side) let's say, from trigger zone, what should I use?

little eagle
#

the nearest player from a marker?

lethal ingot
#

The purpose is if a player (any) walks into trigger zone, I need to know the distance to him and track him while he is in the zone. There could be several players from different sides.
(I am making wild dogs that will attack everybody except their own group), MP and DEDIC compatible

little eagle
#

if a player walks into a trigger, he is by definition the nearest player to the trigger

#

unless there already is another player in that trigger

#

The purpose is if a player (any) walks into trigger zone, I need to know the distance to him

#

This sounds like the distance from the player to... the player ?

lethal ingot
#

Well, no, from a group leader (of wild dogs) to a player

little eagle
#

so you want to get the nearest other player from a group leader?

lethal ingot
#

if a player walks into a trigger, he is by definition the nearest player to the trigger
unless there already is another player in that trigger
Then trigger isn't that good, it's better to hard code the minimal distance for detection. Dogs have to go after nearest player if he is in the minimal distance radius.
So here we go, how ti detect this nearest player?

austere hawk
#

is the lazy evaluation variant of
`(conditionA AND conditionB) OR ( conditionC AND conditionD )
this here:
' ( conditionA AND { conditionB }) OR { conditionC AND {conditionD}}
or did i get it wrong?