#arma3_scripting

1 messages ยท Page 478 of 1

cerulean crane
#

@waxen tide yea.

#

ree

waxen tide
#

You're probably restarting your mission all the time to test. You can put your code into some *.sqf file and then edit the code while the mission is running for a lot quicker testing. Especially if you do lots of trial and error.

cerulean crane
#

tried the SQF highlighting thing. It didnt like me

#

๐Ÿคฆ

waxen tide
#

๐Ÿคท

cerulean crane
#

I knew this was going to be a headache, i underestimated how much lol.

waxen tide
#

show me that code again

cerulean crane
#

I was like "pfft, how hard could it be to make something appear in a trigger, Ive worked on whole games."

#

lol

#
_loopCount = 0;
while {_random_pos_in_trigger isEqualTo [] && _loopCount < 100} do {
    _random_pos_in_trigger = trigger_spawn call BIS_fnc_randomPosTrigger;
    _random_pos_in_trigger = _random_pos_in_trigger findEmptyPosition [0, 0, "vehicleType"];
    _loopCount = _loopCount +1; //Prevents infinite executions with severe hit on performance if no position can be found
};
_nul = [_random_pos_in_trigger, 10, true] call anomaly_fnc_createFog;```
waxen tide
#

diag_log format ["Debug info: %1", _random_pos_in_trigger]; --------> "Debug info: [<null>,<null>,-2]" ??????

cerulean crane
#

aye.

waxen tide
#

๐Ÿค”

cerulean crane
#

๐Ÿค”

waxen tide
#

Let me tinker in the editor for a minute

cerulean crane
#

nods.

#

while you do that im gonna look into what it takes to setup a .sqf file outside of game

waxen tide
#

literally nothing. just save your mission in the editor, go to like C:\Users\Zombie\Documents\Arma 3\missions or C:\Users\Zombie\Documents\Arma 3\mpmissions and toss the *.sqf in the missionfolder.

#

and then you can call, execVM etc it to your hearts content

cerulean crane
#

yea. im looking up the formatting for a .sqf file now.

waxen tide
#

๐Ÿ˜„

#

just think of it as the same as your init field.

#

I've placed a test_trigger in editor.

_random_pos_in_trigger = test_trigger call BIS_fnc_randomPosTrigger;
diag_log format ["_random_pos_in_trigger: %1", _random_pos_in_trigger]; // "_random_pos_in_trigger: [2829.82,1472.43,0]"
#

seems to work fine

#

Without a trigger:

_random_pos_in_trigger = test_trigger call BIS_fnc_randomPosTrigger;
diag_log format ["_random_pos_in_trigger: %1", _random_pos_in_trigger]; // "_random_pos_in_trigger: any"
#

Conclusion: Your trigger is missing or has a different name ?

cerulean crane
#

oh wow

#

having it as a script makes much better debugging

#

it actually tells me what line

#
_random_pos_in_trigger = thistrigger call BIS_fnc_randomPosTrigge>
22:44:29   Error position: <thistrigger call BIS_fnc_randomPosTrigge>
22:44:29   Error Undefined variable in expression: thistrigger
22:44:29 File C:\Users\roypr\Documents\Arma 3 - Other Profiles\Zombie\mpmissions\ChernarusRedux_Ravage_Stalker_Escape.chernarusredux\script.sqf, line 4
22:44:29 Error in expression <_trigger = []; 
_loopCount = 0; 
while {_random_pos_in_trigger isEqualTo [] && _>
22:44:29   Error position: <_random_pos_in_trigger isEqualTo [] && _>
22:44:29   Error Undefined variable in expression: _random_pos_in_trigger
22:44:29 File C:\Users\roypr\Documents\Arma 3 - Other Profiles\Zombie\mpmissions\ChernarusRedux_Ravage_Stalker_Escape.chernarusredux\script.sqf, line 3
22:44:29 "Debug info: array"
22:44:29 Error in expression <loopCount = _loopCount +1;  
};
_nul = [_random_pos_in_trigger, 10, true] call a>
22:44:29   Error position: <_random_pos_in_trigger, 10, true] call a>
22:44:29   Error Undefined variable in expression: _random_pos_in_trigger
22:44:29 File C:\Users\roypr\Documents\Arma 3 - Other Profiles\Zombie\mpmissions\ChernarusRedux_Ravage_Stalker_Escape.chernarusredux\script.sqf, line 8```
unreal siren
#

For a piece of code to redress units, which iterates over newly spawned AI, would it be worh the performance difference to manually feed the magazine type into the weapon array instead of retrieving it dynamically via:

            {
                _mags = getArray(configfile >> "cfgWeapons" >> (_weapon) >> "magazines");
                {
                    _unit addMagazines [_x, 10];
                } forEach [_mags select 0];
            }
```?
waxen tide
#

You should also get an editor that has syntax highlighting, a linter, autocomplete for sqf and BIS_fnc's and preferably mikero's tools as well ๐Ÿ˜› people seem to mostly pick visual studio code, i like my sublime 3 with some adapted sublime 2 packages from the sublime 2 poseidon package. Makes it SO MUCH easier.

cerulean crane
#

ive got notepad++ i just need to download .sqf extension

unreal siren
#

I'm partial to Atom IO, but sublime has hands down the industry leading speed.

waxen tide
#

I haven't found anything that has all the features of my sublime yet.

cerulean crane
#

Conclusion: Your trigger is missing or has a different name ?
@waxen tide but its the trigger the call is in. I plan to use this type of trigger a lot. How should I call the trigger that the script is executed in?

#

im in a .sqf file now btw

waxen tide
#

hmmm

#

inside the trigger you can reference it with magic var this .. outside? just give it a variable name in eden (there is a field all the way on the top) and use that.

cerulean crane
#

hrm... but i plan to use this script to spawn a lot of different stuff with different triggers.

waxen tide
cerulean crane
#

basically the anomaly are like traps that will be all over the map. I just dont want to know where they are.

#

so im trying to use triggers to spawn them in an area, but i dont know where.

waxen tide
#

Simply spawn the triggers randomly and give them iterative names. you can do like a for loop and use the loop's internal _i variable inside the trigger name.

#
for "_i" from 100 to 0 step -1 do {
format ["trigger_%1", _i] // trigger_1, trigger_2 ...
};
unreal siren
#

LOL, sweet.

cerulean crane
#

hrm...

#

only problem i see with that is there will probably be hundreds of them. I didnt want them to spawn unless the player goes that way. Think of like an escape mission with zombies and traps. I didnt want it to spawn the traps unless the player actually gets near it.

waxen tide
#

is it a single player mission ?

cerulean crane
#

MP

#

players*

waxen tide
#

๐Ÿค” i think i would get the position of each player, then generate some random positions around each player, and put triggers for the anomalies there. obviously you need to update that at some reasonable interval. you could do like _old_pos distance2D _new_pos to check if the player moved far enough to justify re-calculation of the positions.

cerulean crane
#

oh thats interesting.

waxen tide
#

Idk about trigger performance, I think if they become too large it can become quite bad. Also they evaluate 3d coordinates and they're evaluated onEachFrame afaik. Depending on the precision you want you could do some lazy evaluation every second or so and just manually check distance2D or something.

#

I've always considered triggers to be something you use in eden if you don't want to touch scripts.

cerulean crane
#

๐Ÿ– ๐Ÿ˜‰

#

lel

#

i figured id doggy paddle before trying to swim

waxen tide
#

I didn't mean it judgemental, but obviously BI tried to make it easy to do elaborate missions in eden even if you have little to no scripting experience.

cerulean crane
#

yea.

waxen tide
#

if you're already slapping dozens of code lines into init fields, why bother with placing stuff in eden you can just script to appear randomly where you want it.

cerulean crane
#

Holy crap thats spyder

#

THA LEGEND

#

I scared him away

snow pecan
#

@unreal siren I didn't see anyone answer your question.. the difference is marginal, and you get the added benefit of easier-to-maintain code if you grab dynamically from config

cerulean crane
#

oh there he is

unreal siren
#

O:

#

Okay, sweet! How about random vs randomweighted?

waxen tide
unreal siren
#
Result:
0.0023 ms

Cycles:
10000/10000

Code:
getArray(configfile >> 'cfgWeapons' >> (_weapon) >> 'hgun_Rook40_F' >> 'magazines')```
#

Wow

#

That's fast, lol

snow pecan
#

You'll have to profile the difference between those commands, but I imagine they're similar in speed

#

Depends on exactly how they do weighted selection

unreal siren
#

Gotcha. The mission I'm working with, replaced some of their spawn/call compiles with execVM, before, restarts would be seamless for the player; IE loading right into intro, now there's a 2-4s delay on "debug island" (preinit location) before it switches to intro, so while optimizing I'm doing my best to worry about little things.

cerulean crane
#

lol @waxen tide i did something kinda funny.

i did

_nul = [_random_pos_in_trigger, 10, true] call anomaly_fnc_createFog;``` 
Inside the trigger.
#

instead of doing one fog, i think it did fog spawns in every position.

#

lol

#

fog clouds everywhere

#

oh wait. no

#

i think its working as intended

waxen tide
snow pecan
#

@unreal siren honestly the number one thing I would look at / learn is scheduled vs unscheduled. Unscheduled is very fast and scheduled is slow. If there is a lot of "init" work that needs to be done before the intro, I would do that work in unscheduled assuming it's behind the loading screen anyway.

unreal siren
#
Result:
0.0006 ms

Cycles:
10000/10000

Code:
dingdong
``` JEeeSsuuSSS
#

Oh wait, I've made a mistake

snow pecan
#

You can get some solid performance increases if scheduled execution is used when it's not needed

unreal siren
#

Ah, hence why they did that then?

#

var call compile final preprocess , replaced with execVM

snow pecan
#

Don't know why they would, especially if it interferes with the intro

#

No way to know I guess unless they say

#

Maybe they interpreted the faster loading of the mission as better performance, without considering how it affected the transition of loading screen --> intro

unreal siren
#

Outside of memory allocation (Which would be negligible at best?) I don't know either. Considering init code is ran once. I might revert if so

#

Appreciate the help! Here's the performance difference, assuming I did it right:

Result:
0.0023 ms

Cycles:
10000/10000

Code:
getArray(configfile >> 'cfgWeapons' >> (_weapon) >> 'hgun_Rook40_F' >> 'magazines')

second method:


Result:
0.0015 ms

Cycles:
10000/10000

Code:
_weapon = ['hgun_Rook40_F', 'dingdong'];_magazine = _weapon select 1; _magazine```
snow pecan
#

Well unless you store the contents of the file/function in a variable, there's no memory difference

#

Actually, I'm dumb should've seen this

#

Call waits for the init script to complete, execVM sends it to its own scheduler "thread"

#

So you might be seeing issues with that, assuming this is happening inside init.sqf

unreal siren
#

oooh

#

So it holds everything up until it all loads, perse?

snow pecan
#

Yes, if you are currently in scheduled scope, call will wait for the executed function to finish. ExecVM will start the script but then continue to execute in "parallel"

unreal siren
#

Ah, my bad. It was Spawn

#

"Tweaked: All spawn compileFinal preprocessFileLineNumbers replaced with execVM."

snow pecan
#

Ok, that makes sense. That change holds the same function, just making it easier to read

unreal siren
#

Ah, okay.

#

I have no idea why the intro is delayed then.

snow pecan
#

ExecVM will essentially compile the script then spawn it on its own

unreal siren
#

What do you make of the above benches? 0.0010ms difference worth it? ๐Ÿ˜‚

snow pecan
#

Definitely not, and I'm a performance hardass :)

unreal siren
#

What's a good hardline or indicator on "do this or face the consequences of a bad time"?

#

generally speaking

#

Since it varies

#

IE, a delayed intro isn't game breaking, but a niggle.

snow pecan
#

Basic things to keep in mind.
-how often does it run
-how intensive is the work done in the function as a whole
-what's the tradeoff between performance vs readability

#

Generally, you can just plug away until you see performance degrade

#

You'll get better intuition over time regarding when to trade readability and maintainability for performance

#

When in doubt, profile your options and judge your results. I've thrown thousands of things in the debug console for a quick test

#

And yes I realize I sidestepped your question ๐Ÿ˜„

unreal siren
#

lol, appreciate it.

waxen tide
#

Once wrote a script that crawls road objects with roadsConnectedTo and calls itself with new start points at each intersection. After a few seconds i had 100+ scripts running in parallel and after 10 minutes i wondered if it would ever complete. ๐Ÿ˜ณ

snow pecan
#

Basically, never test on altis

#

#1 rule

#

๐Ÿ˜‚

waxen tide
#

Tested it on Deniland, that's like 4x the size of Altis.

#

175.000 road objects total.

snow pecan
#

Ruh roh

unreal siren
#

Wooooah

#

I accidentally ran codePerformance on the old BIS function ๐Ÿ˜‚

#

If anyone is curious, 0.0024 ms for selectRandom VS 0.0078ms for the old function.

#

In my case, selectRandomWeighted was 0.0036

snow pecan
#

Wonder if the old function has been updated to use the command or not

#

Would think it would be much slower if not

cerulean crane
#

@waxen tide With a little playing with it, i think ive finally gotten it to do what i want the way I want. Thank you so much for your help.

#

you are a good dude for being so patient with me

waxen tide
#

Eh i've gotten so much help here, glad if i can actually help someone at times when no more-experienced people are here anyways.

unreal siren
#

Well, here's some funny maths

#

0.0024x1,100 (1,100 dudes spawned and this segment ran on) = an additional 2.64ms
0.0036x1,100 (1,100 dudes spawned and this segment ran on) = an additional 3.96ms

#

50% slower

#

However, considering it will be doing maybe 30 units at a time, that's fair.

waxen tide
#

I've done far worse to 150 units at once ๐Ÿค

snow pecan
#

is that just the difference between grabbing from config and using a defined array?

#

regardless, like you said, you're often not dealing with 1100 units ๐Ÿ˜„

peak plover
#

Are you trying to say that grabbing from config is slower?

snow pecan
#

well in that case they do more work than simply grabbing a config value

#

but yes grabbing from config is slower

unreal siren
#

Well, the array vs config file was 0.0015 vs 0.0023ms

#

Wait

#

Are you saying I could make use of the cached config from ACE for my mission? @peak plover

snow pecan
#

you could if its that important to you

#

just save the config value to a variable

#

then check if that variable exists before checking config

unreal siren
#

So maybe generate the cache at mission start?

peak plover
#

I doubt you need the same config, so make your own version of this

snow pecan
#

I would just do it inside the file

#

check if a var is nil, if so then grab the value from config and set the value equal to it. If the value exists already, just use that value

unreal siren
#

OooOh

#

Neat

#

The file gets called multiple times though, since it's in a loop.

#

The loop file does a pushback on AI if they don't have the var "yeahbroyouvealreadybeenredressed" essentially

#

Then calls it

snow pecan
#

are you running cba

#

you could just use the cba init event for units so you don't need an overarching loop

unreal siren
#

I am, yes

still forum
#

@waxen tide Or wait until Awoooo wakes up and gets bored no time for bored today. RHS update means busy :D
and they're evaluated onEachFrame afaik
Triggers are executed every 0.5 seconds. Their condition code is unscheduled.

@snow pecan You can get some solid performance increases if scheduled execution is used when it's not needed depends on which "performance" you mean. Scheduled get's you more FPS. But slower scripts.
@unreal siren var call compile final preprocess , replaced with execVM The Final from compileFinal was just idiotic dumb nonsense.
And if you remove that spawn compile preprocessFileLineNumbers is literally equal to execVM.
And both are dumb too for things that are executed more than once. You should use CfgFunctions.
Also your benchmarks are basically irrelevant if you run scheduled code anyway.
If you run unscheduled code you have to pay more attention to benchmarks but with scheduled it's not that important.

snow pecan
#

I was talking perceived execution speed

#

run one script in scheduled and other in unscheduled, one finished noticeably faster

#

useful tool if something is needlessly running scheduled

#

which is a lot of the time in many missions

waxen tide
#

I've done quite a bit of scripting for missions, and i've never really done anything elaborate in unscheduled. I literally do everything scheduled. Most stuff in mission scripts simply does not have to be realtime.

snow pecan
#

yeah it all depends on what you need

#

my point was that missions often contain inexperienced code (which is typically full of stuff running in scheduled)

#

and if you want something to run quicker

#

often times the easiest solution is to look and see if you can switch to unscheduled

waxen tide
#

sure

still forum
#

especially big mission frameworks that were worked on for years.

#

People always proudly say "I worked on this for 6 years"
Yeah.. Awesome.. That means most of your script is now horribly outdated and probably shit. Good job.

meager heart
#

๐Ÿ˜ƒ

waxen tide
#

Eh well, there are people who constantly rework almost everything and produce high quality code (speaking missions) and sometimes a project is passed on, refactored completely and overhauled. sometimes even twice in a row. But yeah, for sure, lots of really scary missions out there script wise.

#

fetches a really big stick and pokes @still forum

#

Write a blog article about arma debugging and profiling ๐Ÿ˜š

still forum
#

In the past I wanted to contribute to some missions but I was either faced with ignorance and "Why does that even matter??" or so much work that a rewrite would be the better approach. Which is what the KP liberation team is now doing ^^

waxen tide
#

I fixed a minor thing in "Antistasi" a few weeks ago and jesus that thing is a mess. 1000 lines of random shit in the initplayerlocal including like 200 lines of intro camera stuff ๐Ÿ˜ท

hollow thistle
#

Yeah, I think I have not seen any mission yet where code was well structured and documented.

waxen tide
#

Quiksilver's Invade is quite awesome.

hollow thistle
#

But most missions are so small that objectively thinking there is no incentive to spend a lot of time on optimization.

#

And documentation.

#

I will take a look at it. :D the more I know the less chance that we will have to rewrite the liberation rewrite ๐Ÿ‘€

snow pecan
#

its not good if you havent rewritten at least 3 times ๐Ÿ˜‚

hollow thistle
#

Permanent refactoring FTW.

waxen tide
#

I would argue that Dorbedo structured his Kerberos very well, i'm sure he has cut down on a lot of work for himself by automating things and even writing external tools for that, but due to lack of documentation i haven't yet met anyone who looked at his stuff and found it easy to work with.

snow pecan
#

Either it contains intercept

#

or he's doing an intercept rewrite

still forum
#

@waxen tide Quiksilver's Invade is quite awesome.
Uh... Quiksilver? He left this discord because so many people used him as example of bad code

waxen tide
#

๐Ÿ˜„

snow pecan
#

oh my god

#

that wall of private

#

that even makes the depths of ALiVE cry

waxen tide
#

When i got into A3 mission editing, the first stuff i looked at was his old I&A. That's excessively well documented to a point where even a noob will quickly find his way around. Haven't looked at his latest apex edition code, but it plays nicely for sure.

still forum
#

See ^
Because of things like that he left discord

waxen tide
#

Now if i looked at it again i would probably immediately be reminded of all the code performance stuff i was told here and find flaws.

#

So maybe horrible code, but well structured and documented ๐Ÿ‘†

still forum
#

Dorbedo definetly knows what good code is ^^

#

Uhhh... Intercept? :u

snow pecan
#

saw that too, I dont see the plugin anywhere though

#

so who knows how indepth it's being used if at all

random estuary
#

Question to anyone who has tested it, is there any performance difference between createVehicle using string "none" over "can_collide"?
"CAN_COLLIDE" creates the vehicle exactly where asked, not checking if others objects can cross its 3D model
Which I assume would cause the engine to do less checks than "none"

still forum
#

Correct. Engine does a "FindFreePosition" search if the placement type != CanCollide

snow pecan
#

Here's the result of a simple test

#
NONE
Time: 0.0120239

CAN_COLLIDE
Time: 0.00299072```
#

Keep in mind that'll vary a bit depending on the position

peak plover
#

6 years for a mission?

#

Damn

#

Maybe i should make missions

scenic pollen
#

Just make sure you plan ahead

#

6 years should do it

meager heart
#

you can start working on arma 4 cherno cti framework, nigel ๐Ÿ˜ƒ

austere granite
#

Uh... Quiksilver? He left this discord because so many people used him as example of bad code
i mean maybe that was a bit excessive though

#

Honestly there's not that many mods that have really good code all around. Some of it looks "good" because muh macros and shit

#

But I'd say most big mods out there you can find shit that is just silly, really because its older code or you are fighting against vanilla or whatever

#

Like when i look at ace medical i'm not like SUCH WOW MUCH GREAT CODE tbh

#

Probably the main thing that annoys me is when its just 200 functions thrown in a folder, instead of something at least organized per feature (modular is nice too obviously, but even just splitting it up in some logical areas is good)

errant jasper
#

Few people I know would not categorize 8-nested-conditionals as objectively bad code (unless auto generated and even then...). But rather than point people towards "bad code", maybe point them towards good code / recommended practices instead.

queen cargo
#

Few people I know would not categorize 8-nested-conditionals as objectively bad code you are living in the arma world
ever tried to do some else if chain?

errant jasper
#

Yeah. Never needed it to be deep though

austere granite
#

deeper = better

#

just ask yo mom

#

ยฏ_(ใƒ„)_/ยฏ

errant jasper
#

And for readability you can easily wrap it in a call and do exitWith instead.

queen cargo
#

@austere granite size != length ๐Ÿ˜‰

#

just got reminded that i should continue working on my modding stuff ...

#

but rly cannot be bothered to do currently

peak plover
#

@meager heart copy that

#

Will do

#

'gon start with cti today

#

Let's see how long it takes me

meager heart
#

take your time...

unreal siren
#

lol

#

this reminds me

#

The creator of the linter for GLUA is really passive aggressive

#

"Are you egyption? What's up with all these f**king scope pyramids"

peak plover
#

๐Ÿ˜‚

unreal siren
#

Is there any less garbage way to do this? ```sqf
player spawn {
while {
true
}
do {
waitUntil {
sleep 3;
alive _this
}
;
_this setVariable ["defcamo", _this getUnitTrait "camouflageCoef", true];
while {
alive _this
}
do {
if (stance _this=="PRONE") then {
_surfaceType=(surfaceType getPosATL _this) select [1];
_grassCover=getNumber(configfile >> "CfgSurfaces" >> _surfaceType >> "grassCover");
_newCamo=1 max 500 * _grassCover;
_this setUnitTrait ["camouflageCoef", _newCamo];
}
else {
_this setUnitTrait ["camouflageCoef", _this getVariable "defcamo"];
}
;
sleep 1;
}
;
}
;
}

;``` AI are spotting people through dense foliage on a cloudy rainstorm night. :/

#

Oh dear god

#

Let me try to reformat that

queen cargo
#

yes please

scenic pollen
#

Is this not how everyone formats their code? ๐Ÿ˜›

unreal siren
#

M.A.X.I.M.U.M P.E.R.F.O.R.M.A.N.C.E! N.O.L.I.N.E!

queen cargo
#
player spawn {
  while { true } do {
        waitUntil { sleep 3; alive _this };
        _this setVariable ["defcamo", _this getUnitTrait "camouflageCoef", true];
        while { alive _this } do {
            if (stance _this=="PRONE") then {
                _surfaceType=(surfaceType getPosATL _this) select [1];
                _grassCover=getNumber(configfile >> "CfgSurfaces" >> _surfaceType >> "grassCover");
                _newCamo=1 max 500 * _grassCover;
                _this setUnitTrait ["camouflageCoef", _newCamo];
            } else {
                _this setUnitTrait ["camouflageCoef", _this getVariable "defcamo"];
            };
            sleep 1;
        };
    };
};```
unreal siren
#

Ran that through a prettyprinter for CS because I'm lazy

#

Does a prettyprinter actually exist for SQF?

scenic pollen
#

If there's one for VS Code, please let me know

queen cargo
#

as far as i know, no

#

though ... could write one

unreal siren
#

ATOM IO please D:

#

VS Code and sublime are far faster though.

scenic pollen
#

I used to be a huge Sublime fan, then tried Atom for a bit, then started using VS Code and I haven't looked back haha

#

Yeah each have their pros and cons really

queen cargo
#

i always feel like those lack a lot of features i use on day-to-day base ...

#

stuff like ALT+Drag for block selection

#

CTRL+D for quick line duplication

#

i am fairly sure those are possible in there too ... but already that those are hidden behind weirdo combinations or "feature sets" ...

unreal siren
scenic pollen
#

What do you use @queen cargo

digital jacinth
#

Question about your code @unreal siren, do you intend for the camouflageCoef to go over 1? So far i have no idea what this returns getNumber(configfile >> "CfgSurfaces" >> _surfaceType >> "grassCover")

queen cargo
#

visual studio mostly currently
for everything else notepad++ @scenic pollen

scenic pollen
#

Fair

unreal siren
#

I'm honestly not sure, diwako.

digital jacinth
#

yeah all i am missing from code is alt+block select really

#

@unreal siren camouflageCoef is default 1 unless the unit is a sniper in the configs. the lower the number the less they can be seen. Well, or rather the more effective their camo.

#

so putting anything above 1 will make them more and more a lirghtbulb. I had a mission once in which we were sneaking around at night, but the mission maker set camouflageCoef to 30 as they thought it makes sneaking easier, but nope every ai saw us from miles away and it became a "RUN AWAY" simulator while being chased down by ai like light by moths

scenic pollen
#

Turns out there is a linter for sqf (for vs code)

unreal siren
#

Oh neat!

queen cargo
#

linter, yes

#

but no pretty printer

unreal siren
#

XD lol

hollow thistle
#

it has no code formatting. But I recommend it.

#

It supports CfgFunctions library ^^.

#

But has some problems with config parsing sadly.

digital jacinth
#

Yeah that is really helpful actually.

unreal siren
hollow thistle
#

eg.

class SomeClass
{
   someVal[] = {1, [1,2,3]}; // does not support nested arrays with []
}

will break parsing of config files and this fill break CfgFunctions parsing.

#

"addons/fpsFix" please share xD

unreal siren
#

Vehicle simulation

scenic pollen
#

Please can we also have a "addons/useAllCores"

unreal siren
#

lol

queen cargo
#

[...] also should not be valid in config at all

vagrant sedge
#

So I'm currently working on a script which spawns local objects. The objects have been "cached" with another script which saves their position, type, vectorDir and vectorUp,if it has simulation enabled, if it can receive damage and if it has a custom texture, the custom texture.

But when I create the objects with this code


params ["_objectInformation"];

if (isNil "BuildingsToDestroy") then {
BuildingsToDestroy = [];
};
{
_pos = _x select 0;
_type = _x select 1;
_dirAndUp = _x select 2;
_simulation = _x select 3;
_allowDamage = _x select 4;
_textures = _x select 5;

_obj = _type createVehicleLocal _pos;
_obj enableSimulation _simulation;
_obj allowDamage _allowDamage;
_obj setVectorDirAndUp _dirAndUp;
_obj setPosATL _pos;

if (!(isNil "_textures")) then
{
{
_obj setObjectTexture [_forEachIndex,_x];
}forEach _textures
};

BuildingsToDestroy pushBack _x;
sleep 0.01;
} forEach _objectInformation;

all objects which are not placed 100% vertical are moved a by a few meters.
Here is an example: http://prntscr.com/ki321q

Is there a way to spawn the objects correctly?

hollow thistle
#

@queen cargo val[] = [1,2,3] is not valid but val[] = {1, 2, [3,4]} and val[] = {1, 2, {3,4}} are both valid.

queen cargo
#

wut?

#

i highly doubt that somehow

#

as [...] should parse into a string

scenic pollen
#

@vagrant sedge Maybe something to do with 'can collide'?

#

"CAN_COLLIDE"

#

Afaik the engine looks to place the vehicle in a spot it deems 'safe', which may not necessarily be exactly where you tell it

#

But with "CAN_COLLIDE" it skips this check

tough abyss
#

@vagrant sedge Use get/setPosWorld

unreal siren
#

Still working on redoing parts of this redress code, can somebody explain what the first check does? ```sqf
if (_x=="this") then
{
_mags = getArray(configfile >> "cfgWeapons" >> (_weapon) >> "magazines");
{
_unit addMagazines [_x, 8];
} forEach [_mags select 0];
}
else
{

            {
                _unit addMagazines [_x, 8];
            } forEach [_mags select 0];
        };
    } forEach _muzzles;```
still forum
#

it checks if _this contains the string "this"

#

Ah I see

unreal siren
#

What for?

#

Locality check for addMagazines?

still forum
#

this inside muzzles means the weapon itself

unreal siren
#

Oh, weird

still forum
#

muzzles don't need to contain the weapon itself. But many do

unreal siren
#

Underbarrel?

#

Or just weird configuration?

still forum
#

that would be a different muzzle then

rustic pendant
#

Hi Guys, I need help with a bullet cam script, I want to simulate the missile real cam sensor, but I cannot find how to put the camera position in front of the missile, this is the script Im using

#

this addEventHandler ["Fired", {
_null = _this spawn {
_missile = _this select 6;
_cam = "camera" camCreate (position player);
_cam cameraEffect ["External", "Back"];
waitUntil {
if (isNull _missile) exitWith {true};
_cam camSetTarget _missile;
_cam camSetRelPos [0,-3,0];
_cam camCommit 0;
};
sleep 0.4;
_cam cameraEffect ["Terminate", "Back"];
camDestroy _cam;
};
}];

unreal siren
#

I gotta do the same for sidearms; this isn't a function. Should I run the whole block under another for each?

vagrant sedge
#

@tough abyss Thank you. Worked perfectly.

tough abyss
#

@vagrant sedge Exactly why it was added

rustic pendant
#

When I set the _cam camSetRelPos [0,-3,0]; to a positive value like [0,10,0]; the camera rotates to look the missile from the front to the back and I want to put int he fron looking to the front like a POV

still forum
#

Huh?

#

And.. why?

tough abyss
#

Unexpected

still forum
#

Also #rules description for each link that you post.

unreal siren
#

Shouldn't this be using cases?

    if ((count _SLunits) > 0) then
    {
        {
            removeHeadgear _x;
            _x addHeadgear _slheadgear;
            _x addMagazines ["SmokeShell", 1];
            _x addItemToBackpack "FirstAidKit";
            _x addMagazines ["APERSBoundingMine_Range_Mag", 1];

        } foreach _SLunits;
    };

    if ((count _SNunits) > 0) then
    {
        {
            removeUniform _x;
            _x forceaddUniform _snghillie;
            _x assignItem "NVGoggles_OPFOR";
            _x addItemToBackpack "FirstAidKit";
            _x addMagazines ["APERSBoundingMine_Range_Mag", 1];

        } foreach _SNunits;
    };```
#

There's probably seven of these, one for each "special" unit type.

earnest path
#

Hey guys i am in need of your help. I wrote a script to do building interior compositions to populate a few buildings with stuff to not have empty buildings. My script is currently targeting petrol stations. I had it running on the map Malden for quite some time without any problems and than i started hosting a mission on Chernarus. On chernarus there are no buildings of the class i wanted to populate so i am loading some building on the map trough scripting. What is happening is the objects that i place are sitting on random places when the players load up. Sometimes they look perfect other times the objects are displaced but the displacement seem to be the same every time it fails.

#

Any ideas how to what is causing the displacement and why if the server is placing these objects the coordinates are thrown off sometimes for everything that is referencing the host object.

#

The setting for the objects is [Server side : Simple objects for the interior objects, Normal objects for the buildings and interactive objects]

queen cargo
unreal siren
#

14:53:20 Inventory item with given name: [Headgear_H_MilCap_ghex_F] not found
WHAT

#

Locality for addMagazines causing this?

tardy ingot
#

is there a way to get the positions of weapons attached to a vehicle: I'm trying to draw UI in screen space at the position of a weapon pylon in world space?

selectionnames doesn't contain the actual names of the pylons in a way that's parsable without heavy processing of the strings

polar folio
#

maybe you can pull stuff from the configs

unreal siren
#

Wouldn't it be cheaper to simply unassign the item and let the commands silently fail if the unit doesn't have NV, than to use an if statement?
sqf _nvgs = hmd _x; if !(_nvgs isEqualTo "") then { _x unassignItem _nvgs; _x removeItem _nvgs; };

        _x unassignItem "NVGoggles_OPFOR";
        _x unassignItem "NVGoggles";
        _x unassignItem "NVGoggles_INDEP";```
meager heart
#

btw _x unassignItem _nvgs; _x removeItem _nvgs;->unlinkItem

edgy halo
#

Solved, after a bit of playing. Active Solution Configuration was 'Debug' and should be 'Release' in order to work.

mortal nacelle
#

Hello. I am editing a few scripts and trying to change positions however I am issues with this one script. Can somebody confirm to me what I am looking for (X / Y / Z) within these variables? Thank you. _posApts = [[0.0732422,8.21582],[0.723145,2.35547],[0.729004,-2.39551],[1.8501,-8.38477],[1.23389,8.32764],[1.61963,2.26953],[1.50342,-2.50537],[1.67139,-8.31201]]; _posAptsATL = [0.231,0.231,0.231,0.231,3.00974,3.00974,3.00974,3.00974];

austere granite
#

is there some magical reason why i can't preview a mission in singleplayer? I'm pressing the button in eden... and nothing happens

#

No RPT, no nothing whatsoever, it's after i added some macros from an include in description.ext and it just doesnt like working anymore

#

MP preview is still good

#

oh now when i am reloading the mission in eden it says 3:18:14 Wrong color format in RPT

#

I have 0 related to colors, nor any UI configs in my mission though

lament grotto
#

Hey guys a question I want to make it so when players are detected or they shoot the box spawned will delte itself. is there a way to do this? player addAction ["<t color='#009BFF'>Stealthbox</t>", {_box = "Land_PaperBox_closed_F" createVehicle position player; _box enableSimulation false; _box attachTo [player, [0, 0, 0.6]]; player setUnitTrait["camouflageCoef", 0.01]; player playAction "PlayerCrouch";}]; sleep 300;

still forum
#

@unreal siren Inventory item with given name: [Headgear_H_MilCap_ghex_F] not found it's a weapon. You can't add a weapon with addMagazine

#

@lament grotto or they shoot the box Hit Eventhandler on the box.

#

@edgy halo https://community.bistudio.com/wiki/Extensions#Visual_C.2B.2B_3
notice the outputSize-1
Why the F is it called num in there?? @queen cargo ? It was called output,outputSize,function since the page was created and btw is also how it's called in engine. Why was that changed?
It even still has the old names on the C# one but all the C ones were changed

Well.. Fixed now.

peak plover
#

Im trying to grab optic zoom from config

#

I can't figure out which one is the zoom

meager heart
#

afaik there is fov and distance

#

distanceZoomMax/Min and opticsZoomMin/Max/...iirc init ?

peak plover
#

found it

#

It's under itemInfo

#

optics modes

#

    private _maxZoom = call {
        private _items = primaryWeaponItems player;
        private _maxZoom = 1;
        {
            private _item = _x;
            private _modes = ('true' configClasses (configFile >> 'CfgWeapons' >> _item >> 'ItemInfo' >> 'OpticsModes'));
            {
                private _zoom = getNumber(_x >> "opticsZoomInit");
                if (_zoom < _maxZoom && _zoom != 0) then {_maxZoom = _zoom};
            } count _modes;
            false
        } count _items;
        _maxZoom;
    };
#
Result:
0.0491 ms

Cycles:
10000/10000

Code:
call zoom_fnc_eachFrame
#

How fast should eachFrame scrips be/

still forum
#

as fast as possible ยฏ_(ใƒ„)_/ยฏ

#

I'd say that thing is fast enough. But can probably be faster
And I can see you are running a Intel CPU. AMD users won't be that fast

peak plover
#

You are like google, knowing stuff about me without me telling you

#

Hmm, yeah

#

I guess I'll have to cache the config into a namespace

tough abyss
#

Dedmen knows how every instruction runs on the various CPU architectures, from your benchmark he can tell you make and model and your current clockspeed! Just accept it ๐Ÿ˜ƒ

peak plover
#

๐Ÿ˜„

#

Ain't nothing wrong with that ๐Ÿคท

still forum
#

I guess I'll have to cache the config into a namespace Yeah that would be one of my recommendations for the code you posted above.
But I don't know what zoom_fnc_eachframe does. Because just looking up a value and throwing it away each frame wouldn't make much sense

#

You don't have to cache the whole config. Just cache the current zoom and attachments. You don't need to make new config lookups if the attachments didn't change since last time.

tough abyss
#

Browsing config on every frame is bad

peak plover
#

zoom_fnc_readCache = {
    params ['_name','_code'];

    private _value = mission_zoom_cache getVariable _name;
    if (!isNil '_value') exitWith {_value};
    _value = call _code;
    mission_zoom_cache setVariable [_name,_value];
    _value
};

meager granite
#

I wonder what's best look up for such cache, STRING in ARRAY or OBJECT getVariable STRING?

peak plover
#

location getvariable

meager granite
#

Don't think there is much difference between different getVariable

#

in ARRAY will probably be very slow with big arrays

#

Gonna test this now

still forum
#

Yes. Both things are true

#

in ARRAY get's slower the further back your search value is. It is O(N).
getVariable is a hashtable. So roughly O(1) access time.

#

In addition in ARRAY is case-sensitive whereas getVariable isn't

meager granite
#
_obj = "UserTexture1m_F" createVehicle getPos player;
_arr = [];
_to = 1000000;

for "_i" from 1 to _to do {
    _obj setVariable [str _i, _i];
    _arr pushBack str _i;
};

_search = str _to;
[
    "STRING in ARRAY", diag_codePerformance [{_search in _arr}],
    "OBJECT getVariable STRING", diag_codePerformance [{_obj getVariable _search}]
]
#

["STRING in ARRAY",[0.00037,100000],"OBJECT getVariable STRING",[0.00036,100000]]

#

๐Ÿค”

#

Tried with very long strings instead of str _i, same result, I was expecting in ARRAY to perform worse

velvet merlin
#

is there a way to detect the reload state of a vehicle gunner?

#

or do you have to use firedEH, monitoring magazine change, etc yourself with timestamps

still forum
#

in ARRAY should also be much slower.. It isn't magic. I don't know what's wrong with your code ๐Ÿ˜„
I had that issue with find in CBA "hash"es.
It just get's incredibly slow if you have many elements.

#

Are you sure that local variables carry over into the code of diag_codePerformance?

#

How is the speed of diag_codePerformance [{_obj}] @meager granite ?

#

The 0.0037 might very well be the "variable is nil. I'll just skip this then"

meager granite
#

oh, good point

still forum
#

My own profiling commands accept local variables because they don't open up a new VM. But I think the BI ones do

meager granite
#

Yeah I was confused that something isn't right too

#

With that in ARRAY vs isKindOf comparison I did week ago where in ARRAY turned out to be many times worse

still forum
#

just try the same with global variables

meager granite
#

Just did: ["STRING in ARRAY",[0.171262,5839],"OBJECT getVariable STRING",[0.00066,100000]]

#

Both code pieces execute the commands now and as expected in ARRAY is nowhere close to getVariable STRING

#

Got too used to old BIS_fnc_codePerformance which ran in same thread and made this mistake

tough abyss
#

@velvet merlin Have you tried "Reloaded" EH?

velvet merlin
#

@tough abyss not yet, but was referring to that implicitly as its the same principle

tough abyss
#

@velvet merlin You will need to add this EH to vehicle to monitor reload of a vehicle gunner though

velvet merlin
#

yes. was just hoping to see a more simple variant

lament grotto
#

Hey guys back with the box script player addAction ["<t color='#009BFF'>Stealthbox</t>", {_box = "Land_PaperBox_closed_F" createVehicle position player; _box enableSimulation false; _box attachTo [player, [0, 0, 0.6]]; player setUnitTrait["camouflageCoef", 0.01]; player action ["SWITCHWEAPON",player,player,-1]; sleep 3; player playAction "PlayerCrouch"; sleep 40; player setUnitTrait["camouflageCoef", 1]; deleteVehicle _box; }]; I have this working but I am having trouble with my event Handler deleting the box. My init line is [player] execVM "scripts\mgsbox.sqf"; player addEventHandler ["Hit", {null = [] execVM "scripts\mgsend.sqf";}]; and the mgsend script is deleteVehicle _box; player setUnitTrait["camouflageCoef", 1];

still forum
#

add the eventhandler to the box

#

not to the player

#

adding the Hit eventhandler to the player will tell you when the player is hit.

lament grotto
#

will that still work if the box has disabled sim? or should I remove the disablesimulation?

still forum
#

need to remove it I think

lament grotto
#

I changed it, when the ai shoot the box, but the trigger doesnt fire

#

also the eventhandler for _box goes in the init? even though the box isnt spawned in at the start?

still forum
#

That doesn't make sense as you can see yourself

#

you cannot add a eventhandler to something that doesn't exist

#

add it in your script that spawns the box

lament grotto
#

okay will give it a try

#

still doesnt work, box gets hit and then nothing. ```script looks like this now
player addAction ["<t color='#009BFF'>Stealthbox</t>", {_box = "Land_PaperBox_closed_F" createVehicle position player;

_box attachTo [player, [0, 0, 0.6]];
player setUnitTrait["camouflageCoef", 0.01];
player action ["SWITCHWEAPON",player,player,-1];
_box addEventHandler ["Hit", {null = [] execVM "scripts\mgsend.sqf";}];
sleep 3;
player playAction "PlayerCrouch";
sleep 40;
player setUnitTrait["camouflageCoef", 1];
deleteVehicle _box;
}];
sleep 300```

still forum
#

can you try without the attachTo?

#

Also why are you doing null = [] execVM instead of just execVM?

lament grotto
#

I need the attachTo as I want it so the player can hide in the box, I do null as thats the way I first learned to do it. Sorry I am still new to most of this scripting

#

think metal gear

still forum
#

Yes I know that you need it.. I guess else you wouldn't have it there.

#

But I'm still asking you to try without as it could be that it's breaking the Hit eventhandler which means we need to find a different way

#

Does the box have collision? If bullets go straight through and don't hit it then you can't detect a hit.

lament grotto
#

it does I can hear the rounds hitting it

#

and see

#

not trying to sound grumpy or anything I really do appreciate the help

tough abyss
#

The _box is undefined inside your script, you could get the instance with attachedObjects player

still forum
#

Ohhh.. ๐Ÿคฆ duh. Didn't see that at all

lament grotto
#

could you explain that a bit more for me? sorry its getting late here and my brains all bio ed rn

still forum
#

A eventhandler is a new script.
Local variables don't carry over to new scripts

#

Also execVM additionally creates a new script

#

Which means that your _box variable that you try to deleteVehicle _box is undefined

lament grotto
#

okay

#

so how do i define it?

tough abyss
#

I would just add {detach _x} forEach attachedObjects (_this select 0); to your player Hit EH and be done with it.

still forum
#

he wants to delete. Not just detach

tough abyss
#

Detach makes more sense, anyway as I said I would just do it like this

lament grotto
#

no harm in trying it ๐Ÿ˜ƒ

still forum
#

Hit eventhandler already get's the object. So do this
_box addEventHandler ["Hit", {_this execVM "scripts\mgsend.sqf";}];

And then inside mgsend.sqf

deleteVehicle (_this select 0);
player setUnitTrait["camouflageCoef", 1];
tough abyss
#

Actually I would add some upwards velocity to the box as well upon hit for fun ๐Ÿ˜‰

lament grotto
#

okay

#

thank you for the help so far guys

tough abyss
#

The box might not have hitpoint to trigger Hit EH

lament grotto
#

if that does prove the case is there another eventhandler I could use?

tough abyss
#

Attach EH to player nothing is wrong with that, bullet will penetrate paper box anyway

lament grotto
#

so if I move the EH to a player, (i have swapped the box to a pennable one) how would I write the eh to delte the box

still forum
#

inside mgsend
{deleteVehicle _x} forEach attachedObjects player; will delete all objects attached to the player. If you know you'll have more objects attached than the paperbox that would get a little more complicated. Just a little though.

gleaming cedar
#

Hello

#

How to prevent AI from switching to drivers seat

lament grotto
#

works a treat thanks @dedmen and @tough abyss

tough abyss
#

lockDriver maybe?

gleaming cedar
#

How

ruby breach
weak coyote
#

hello, anyone have altis life mpmission with: Goverment, tax, laws ect? if anyone please pm me

tough abyss
#

Anyone know how to rotate an object around a certain point on the object vs the center of an object. setVectorDirAndUp seems to only use the center and I was wondering if i can change that to a certain point

indigo snow
#

No one stop command, but its basically a bit of struggling with vectors: rotate it normally, check the vector between the rotated point and the original position of the point, move he object by that vector.

tough abyss
#

ah so im going to have to ditch that command and do it manually

astral dawn
#

Is there an event handler which can be called when I restart my mission through editor? Mission event handler 'Ended' seems to be not firing.

tough abyss
#

@tough abyss you could probably try addTorque in combination with setCenterOfMass

#

sadly not a physx object

astral dawn
#

Im sure this topic is common among other 3D graphics topics, like rotation matrices, etc @tough abyss

#

Ok I think I know how to do it... in SQF there are cool commands like modelToWorld and worldToModel.

  1. Find the pivot point in model coordinates.
  2. Store the pivot coordinates in world coordinates somewhere.
  3. Rotate your object around its origin as usual.
  4. Convert the pivot point from model coordinates to world coordinates again. Calculate the offset by which the pivot coordinates have changed in world coordinates. Substract the offset from object's position. ๐Ÿค”
    I've never messed with these matrix transforms really, sorry if I'm wrong.
tough abyss
#

Ye I figured out the maths. Itโ€™s a matter of finishing it now

meager granite
#

How did I miss addTorque and addForce ๐Ÿค”

#

5 years later, we finally have some PhysX manipulation commands ๐Ÿ‘Œ

young current
#

uu those are pretty new right

meager granite
#

Still no way to disable physx state on bodies though, the most basic of basics

#

yeah, 1.72

peak plover
#

Ohh these are new

sinful kettle
#

Hello guys. Is there any tutorial for 3DEN dialog creation?

peak plover
#

@cosmic lichen

#

He made 3den enhanced

meager granite
#

Finally a proper scripting command

austere hawk
#

new? that was more than one year ago... used it to test out planes with 3d vectoring nozzles (for a custom flight model that's now shelfed)

snow pecan
#

new-ish

#

๐Ÿ˜„

astral dawn
#

These AGL, ASL, ATL, etc position systems give me a laugh every time, but now i've found one more: there is modelToWorld but then there is also modelToWorldWorld ๐Ÿ˜„

snow pecan
#

really?

#

never seen that one

astral dawn
snow pecan
#

๐Ÿ˜‚

still forum
#

Don't forget modelToWorldVisualWorld

astral dawn
#

Yeah naming is severely dammaged

still forum
#

You'll get used to it after a couple years

tough abyss
#

Letโ€™s not forget camConstuctionSetParams

austere granite
#

surely in Enfusion we'll have actual data types where AGL and ASL are different ones

#

try and put in AGL into an ASL command and computer says no

#

i wouldn't actually mind that

peak plover
#

๐Ÿ‘Œ๐Ÿป

queen cargo
#

i highly doubt that there would be two positions @austere granite
both most likely will get something like vector3
in fact: one could check right now ๐Ÿค”

ancient coral
#

Has any one figured out a way to order the new cruise missile launcher to launch only 1 rocket at a lased target on its own? I've got it to fire, but it fires several missiles

ancient coral
#

Never mind, found an answer further up the chat history, Discord chat search is surprisingly good!

austere hawk
#

when an object is killed, are the local variables it has destroyed ? Or should i delete them manually?
I assume when obj is deleted, local variables are deleted with it from memory?

austere granite
#

no, depends, yes

still forum
#

I hope in enfusion we do everything in world pos. And there will be functions to get the water/terrain/ground height at a certain position. Just like it is in engine right now ๐Ÿ˜„

#

@austere hawk variables are refcounted. Reference count goes to 0. Variable goes away

meager granite
#

I wonder what would be best way to change turret's owner as there is no setTurretOwner

#

Having an issue where all my client-side logic fails if you manual fire remote turret which renders all scripted controls over projectiles useless.

lean estuary
#

Whats a good average of server CPS to have with 1 player?

still forum
#

CPS?

#

You mean FPS?

#

With only 1 player and nothing else it should run at the full 50 fps

lean estuary
#

Thanks dedmen, we're having a issue where it is indeed 48 / 47 with 1 player. But as soon as more join it goes down to a horrible 12

inner swallow
#

sounds like rogue scripts and locality issues ๐Ÿ˜„

still forum
#

That's not trivial though

lean estuary
#

@inner swallow We thought that as well but we checked almost every running script both serverside as clientside

still forum
#

Almost every? Including all BI scripts that you don't even know are running?

lean estuary
#

No of course not

#

Just everything made by us

still forum
#

You can speculate for eternity now and try to guess around what could be wrong. Or you could actually check what's actually wrong using profiling build.

It can't be scheduled scripts. So it has to be something unscheduled going on

lean estuary
#

I've never used the profiling build but ill look into it. Thanks. Hope i can find the issue with it

still forum
#

run profiling build on server and your client. Execute diag_captureFrame on the server. It should then dump to some text file on the server.
Then you can run the command on the client to open the dialog and copy-paste the text from the file on the server into the dialog

lean estuary
#

Doesnt seem to be the issue since we had another server with 75 people run totally fine

#

using the same configs and box

#

A custom made one

#

No ai, not alot of objects.

round scroll
#

another performance troubleshooting related question: using diag_fps and diag_fpsmin I get the average of the past few frames. When I want to process these numbers further, what's the current state of the art approach to send the fps numbers further, to an external script? diag_log and parse the log? Or use some copy/paste buffer? Or one of the db approaches? Background is to create a tool for map development that checks where low fps are to be found on the map.

#

thanks

still forum
#

I'd just dump FPS, playerid, position to a database.
Problem is how to get the "slow script causing slowdown" and "many players around you causing slowdown" stuff out of there
Also general reduction of FPS the longer the mission goes. If everyones FPS gradually reduces and many people start from the same base on the terrain and go in the same general direction. It would look like further away has the lower fps.
And FPS in general are also not useful, has to always be compared to the average because some people just have slower PC's that only run 20 fps. Whereas some others run 90fps constantly

scenic pollen
#

Does anyone know if it's possible to compile a Linux .so (DLL equivalent) from C#?

#

Tried googling but didn't get any concrete results

queen cargo
#

Uhm... Why should it not be possible?

#

Or do you mean a c# DLL for Linux?

halcyon crypt
#

no, C# libraries are always a .dll

#

even with mono on Linux

#

most C#/.NET applications built on Windows would run on Linux

#

excluding using Windows only UI stuff

#

so you'll still be running the .exe and .dll binaries ๐Ÿ˜ƒ

scenic pollen
#

.exe and .dll on Linux? Hmm that doesn't sound right

lucid junco
#

hi, please help someone. cuttext ["<t size='10'><img image='titles.jpg' />", "PLAIN",-2, false, true]; I need show the picture little bit more down on screen. Im not able to put bold in there. And i dont want to use Plain down to have it down. How to use bold in this?

#

sorry got it - cuttext["<br /><<br /><br /><br /><br /><br/><br/><t size='10'><img image='titles.jpg' />", "PLAIN",-2, false, true];

#

forgot it can handle html

meager heart
#

you can do it with ctrlCreate "RscStructuredText" and less br br's ๐Ÿ˜ƒ

lucid junco
#

oh thank you ๐Ÿ˜ƒ

austere granite
#

Anyone happen to have some hacky way of establishing how big a location is?

#

I know in terrain making you actually give them a size, but cant find the command to return a location ๐Ÿ˜„

obsidian violet
#

Hey guys! making a small mission for some friends tonight, but need help with one thing.

The players are to find a downed pilot who is to wounded to walk so they have to carry him.

Basicly I would like the pilot (AI unit) to be in the wounded animation and then give the players the action to Carry him, eventully load him into a vehicle aswell.)

Any good links or ready scripts are most welcome. Thank you guys!

scenic pollen
#

@austere granite This probably isn't what you want, but you can use worldSize to get the size of the entire map

austere granite
#

it turns out it's just size one of those consistent named commands ๐Ÿ˜„

scenic pollen
#

Oh nice, didn't know that was a thing. Good to know ๐Ÿ™‚

#

And yeah I wish they'd deprecate some commands and replace them with more consistent names. In this case locationSize (like worldSize) instead of size. But I guess it's not really worth the effort, especially with Arma 4 being in the works

#

If we ever get some sort of object oriented language in Arma 4, I'd be very happy ๐Ÿ˜ƒ

austere granite
scenic pollen
#

Nice

austere granite
#

thats unrelated though

#

worldSize doesnt connect to locations at all

still forum
#

If we ever get some sort of object oriented language in Arma 4, I'd be very happy we do. But don't be happy yet. Even if it's object oriented it can still be crap

meager heart
#

size also rectangular for locations (too late...) ๐Ÿ˜ƒ

late gull
#

sqfO

scenic pollen
#

@austere granite Yeah I suppose
@still forum Yeah I was thinking that after I typed it haha. Ok, object oriented, fast, consistently named built-in functions, and a consistent syntax

#

๐Ÿ˜›

#

Optional typing would be cool, but perhaps a turn-off for newbies

peak plover
#

Isn't object oriented slower in most cases?

scenic pollen
#

Depends on how fast the runtime environment is. It is slower in theory, but can still be faster than current SQF runtime if implemented properly. Although tbf I don't know how well optimised the sqf runtime is, but I'm guessing not as much as it could be

#

If it's a compiled language (like Java) then it's pretty much guaranteed to be 1000s of times faster than sqf

scenic pollen
#

I wonder what happened

austere granite
#

priority switched to modelling railgun tanks and halo gunships ๐Ÿ˜ƒ

still forum
#

SQF runtime is shit.
Enscript is better. But neither have any kind of "optimizer" besides that community made one for SQF.

#

Also SQF is also a compiled language. But compiled to a intermediary. Same as Enscript

#

the Enscript interpreter is much better tho. And it's instructions are more low level

scenic pollen
#

Oh wow, I didn't realise it was already available. DayZ I'm assuming?

still forum
#

it's not already available. They only showed screenshots

scenic pollen
#

Ah I see

#

Hmm, syntax is a bit like C#

astral dawn
#

line 129: ... date.Get(1), date.Get(2), date.Get(3) ...
select has found a new home ๐Ÿ˜„

still forum
#

Line 133 and 135 look confusing though. Apparently the variables are passed by reference and output is written into them.. Why??

#

Why doesn't CastTo return the thing it casted to?
And why doesn't MatrixIdentity4 return the identity matrix?

#

Same on line 114/116... Why??

scenic pollen
#

Hmmm

astral dawn
#

No, really, TIntArray data = new TIntArray and then data.Get(1), i mean, they have invented square brackets for arrays in last century ๐Ÿค”

still forum
#

They are keeping the Arma like consistency alive I see

#

Oh lol. Didn't even think of square brackets

#

Look at line 150

#

square brackets are there

astral dawn
#

Hmm yeah because m_DemoPos is vector and date is TIntArray

#

Is it strong typed? ๐Ÿคท

still forum
#

yeah

errant jasper
#

Wait line 133, is that an upcast? Those need to be explicit? nvm.

still forum
#

Also.. Builtin debugging. You can see it on the left side

scenic pollen
#

Ok that is very nice (the debugging)

austere granite
#

You are very nice

scenic pollen
#

โ˜บ

still forum
#

They have object oriented code now.
But still do stuff like g_Game.ConfigGetFloatArray.
They are pushing everything into the game class instead of just making a config class.

And they are using g_Game everywhere which I read as "Global Game class singleton" but then in line 132 they call GetGame() instead of using g_Game.

Also look at how the config paths are built. They are space delimited. wtf?

astral dawn
#

#define _cd_ + " " +

#

I hope they have a preprocessor

still forum
#

Haven't seen any trace of one yet

astral dawn
#

๐Ÿ˜ฟ

tough abyss
#

Looks like this could be another inconsistent mess

still forum
#

Atleast they keep their traditions ยฏ_(ใƒ„)_/ยฏ

peak plover
#

They are keeping the inconsistencies consistent โ“

meager granite
#

Code still looks like a mess

still forum
#

Probably just because whoever wrote the code wasn't that gifted
And to part because of these shit consistent inconsistencies

meager granite
#

Also that SwapYZ, oh boy how much headache it will cause

fossil yew
#

Is it possible to assign a different name to a player instead of his profile name, just for a single mission? I need it for role-playing.

weak coyote
#

anyone here has scripted a goverment system with president and taxes for altis life?

#

i was thinking how to start it, should i create licenses due to sql licence section? or should i make new tables?

queen cargo
#

if it is lowlevel enough, one can create a highlevel-enough language to fix the problems introduced by the actual script language

forest ore
#

Error position, missing ] and what not with

    params["_unit", "_container", "_item"];
    
    if (_item isKindOf ["Bag_Base", configFile >> "CfgVehicles"]) then {
    hint "You really don't want this backpack";};
    };
];```
Can't point out why. Could someone else?
queen cargo
#

also i will gladly implement sqf-to-enscript "compiler" once we get our hands on enscript

still forum
#

@forest ore behind the semicolon of the hint

forest ore
#

};};]; is too much?

inner swallow
#

one of the }; is extra

queen cargo
#
player addEventHandler ["Take", {
    params ["_unit", "_container", "_item"];
    if (_item isKindOf ["Bag_Base", configFile >> "CfgVehicles"]) then {
        hint "You really don't want this backpack";
    };
}];```
#

there you go mate

winter rose
#

you da real MVP

queen cargo
#

nah
it is sqf-vm which did the thing for me โค

#
[ERR][5|C5]     Expected ']'.```
#

though ... there is a ^ missing below the ; for some weird reason ..

forest ore
#

Yep, thanks Dedmen, SuicideKing and X39. Extra semicolon there. How could I have known that *sigh'

tough abyss
#

Canโ€™t have semicolon inside array

queen cargo
#

by checking how sqf works actually ๐Ÿ™ˆ
the ; is a "end-statement" thing
not end codeblock

#

but it is ok
such mistakes happen to the bests

forest ore
#

^^

queen cargo
#

thinking now ... what about emulating SQF inside of enscript instead of writing some "port" thingy ๐Ÿค” that could get funny

#

i mean ... probably slow AF
bbbuuuuuuttt .. funny

still forum
#

The extra semicolon wasn't even the problem

#

you can have as many semicolons as you like

queen cargo
#

not in arrays

#

the rest of the code was syntactically spoken, fine

still forum
#

Ah lol. Didn't even see the error. I thought he had a }; too much behind the hint. Because of that horribly wrong indentation

queen cargo
#

yes ๐Ÿ™ˆ

#

was my first guess too

still forum
#

A indentation a day keeps the errors away

queen cargo
#

that is why sqf-vm now can pretty print files @still forum ๐Ÿคท

meager granite
#

Also wouldn't enscript be available alongside sqf? They have so many sqf scripted systems, I doubt they would rewrite all of them for Arma 4

queen cargo
#

they already do @meager granite

still forum
#

they scrapped all of SQF for dayZ

#

but for Arma we don't know yet

queen cargo
#
PS D:\Git\SQF-VM\Release\x64> .\sqfvm-cpp.exe --pretty-print file.sqf
player addEventHandler ["Take", {
    params ["_unit", "_container", "_item"];
    if (_item isKindOf ["Bag_Base", configFile >> "CfgVehicles"]) then {
        hint "You really don't want this backpack";
    };
}];
``` sqf-vm is love guys
forest ore
#

What happens in there? ๐Ÿ‘†๐Ÿป ๐Ÿ˜„

austere granite
#

they scrapped all of SQF for dayZ
Did they also scrap SQF support or just port all their own sqf to enscript?

forest ore
#

Would someone happen to know why "Put" eventhandler doesn't fire when I tell my subordinate AI to drop its backpack with the command "Drop some backpack"
buut the EH fires when I open the AI's inventory and right-click to drop items from its inventory

still forum
#

@austere granite they didn't say. They said they want to drop all SQF

inner swallow
#

iirc when asked "will there be a way to auto-port SQF to enscript", the answer was "no"

queen cargo
#

iirc i said "i will develop such an application"

#

๐Ÿคท

inner swallow
#

i wasn't talking about that ๐Ÿ˜„

#

but good luck with that, they seem to say that it's impossible because the two are so different ๐Ÿคท๐Ÿฝ

#

@austere granite for DayZ they say they ported the code manually

queen cargo
#

pff ... there might be some major incopatibilities for stuff

#

but in the end sqf also is just some code

surreal pine
#

converting between paradigms huh. sounds like a big challenge to me

#

gl

sleek token
#

talking fsm:
a private variable only exists in the state it was declared?

#

seems so

still forum
#

I'd say very few people know FSM here. You might have to wait quite a while to get an answer

tough abyss
#

Those declared in start state should be available everywhere

sleek token
#

one last question conserning the init oder

#

where does missinflow.fsm fit in?

#

it's not listed in the wiki

tough abyss
#

Donโ€™t think it is part of global init

sleek token
#

ok thank you m242, i think i will include it into cfgfunctions and call it postinit

minor lance
#

Anyway to put vertical text in a control?

twin comet
#

Is it possible to execute a function from a function library before the map screen automatically?

#

My issue is that postInit calls the function after the briefing screen init

#

and preInit before all the variables of 3den menues are setup

#

or is there a variable i can wait for to know that people are in the briefing screen?

astral dawn
#

Maybe getClientState ๐Ÿค”

peak plover
#

before the map screen?!??!

#

BEFORE?

#

What do you mean

#

preInit

#

well

#

Map screen shows up after postinit because otherwise you wouldn't have a map (map is added as an item after object initializes)

#

>postInit calls the function after the briefing screen

#

no it does not

#

Were u using sleep?

#

How do I check if camera is player again?

meager heart
#

cameraOn ?

#

talking fsm: a private variable only exists in the state it was declared?
just think about it as script with multiple local functions, except "start state" that will be like parent/main scope in normal script, that's it

peak plover
#

That won't work if camera is attached to palyer

#

example arsenal

meager heart
#

๐Ÿค”

#

maybe >

if (cameraOn == _unit && cameraView == "Internal")...
peak plover
#

It's also itnernal

#

It's internal to the camera object

twin comet
#

To be more precise i need to call the function between EExpressions of Eden Editor entity attributes are called and before Functions with postInit attribute are called

peak plover
#

what u mean ?

#

Like init fields?

#

expressions are called after inti.sqf

meager heart
#

so... maybe....

peak plover
#
terminate ten_handle;ten_handle =[] spawn {
waitUntil {
sleep 1;
systemChat str cameraOn;
};
};
#

open ace arsenal

tough abyss
#

waitUntil waits for true, systemChat returns nothing, so what is that code supposed to do?

peak plover
#

waituntil is just a loop

#

it's about displaying current cameraOn in chat

tough abyss
#

Ok

peak plover
#

it never exits, I just terminate the thread it is spawned on

#

lazy debug

minor lance
#

Hello! Is there any way that i can set a ppEffect to a camera that has been created by script and not the player camera?

#

Because setPiPEffect with 6 value doesnt work ๐Ÿ˜ฆ

minor lance
#

And also is Arma limited to have only 8 cameras created as max?

lament grotto
#

New question to the ones I posed the other day heres my script ```player addAction ["<t color='#009BFF'>Stealthbox</t>", {_box = "Land_PaperBox_01_small_stacked_F" createVehicle position player;

_box attachTo [player, [0, 0, 0.6]];
player setUnitTrait["camouflageCoef", 0.01];
player action ["SWITCHWEAPON",player,player,-1];
player addEventHandler ["Hit", {_this execVM "scripts\mgsend.sqf";}];
sleep 3;
player playAction "PlayerCrouch";
sleep 40;
player setUnitTrait["camouflageCoef", 1];
deleteVehicle _box;
}];``` I want to add a cooldown to using this action about 5 minutes how can I go about this?

#

my init file ```[player] execVM "scripts\mgsbox.sqf";

high marsh
#

Player is already defined if executed locally, so no need to pass it to the script.

#

Also, it looks like you may have some stray brackets at the end

lament grotto
#

Scripts working fine if there are stray brackets. Player is defined as I plan on making this mp compatible

high marsh
#

hm, oh wait. This is all part of the add action execution?

lament grotto
#

the first box is yeah

high marsh
#

you don't need to pass player object reference to the script, period.

#

What's the question you are trying to pose though?

lament grotto
#

I want to make this on a cooldown after use

#

so players dont spam cardboard boxes on themselves constantly

high marsh
#

Okay. Remove the action (add action returns action index id iirc), note the code and re add it after suspension.

#

Could make that a function and just call it after everything is done being used.

lament grotto
#

so at the top of the addction command I would do this? player removeAction 0; then at the end call the script to be added to a player with a sleep?

high marsh
#

Sure I guess. You don't know if 0 will always be the action id. So it's best that you actually find that value and use it instead of 0

lament grotto
#

okay how would I go about finding or setting the action id?

#

I think its this code _actions = actionIDs player;

high marsh
#

Number- The ID of the action is returned. Action can be removed withย removeAction(see alsoย removeAllActions. IDs are incrementing, the first given action to each unit has the ID 0, the second the ID 1, etc. IDs are also passed to the called script (seeย scriptparameter)

#

Return value of addAction

#

actionIDs returns an array.

meager heart
#
private _actionID = player addAction ...
high marsh
#

@meager heart I bet you cheated during math tests, giving straight answers.

meager heart
#

ยฏ_(ใƒ„)_/ยฏ

high marsh
meager heart
#

#orangecountychoppers ๐Ÿ˜ƒ

high marsh
#

:D

meager heart
#

what was his name...

high marsh
#

Dunno. It's been a little whike

meager heart
#

Paul

#

yes Paul Sr.

#

๐Ÿ˜ƒ

high marsh
#

๐Ÿ˜€

tough abyss
#

player removeAction (_this select 2); inside action code, then re-add it 5 min later

meager heart
#

also ez way will be >

private _action = ["<t color='#009BFF'>Stealthbox</t>", { /* code */}];
player addAction _action;
high marsh
#

I am sensing some MGS shit right here.

meager heart
#

also x2 there is ^ hit eh with execVM maybe just use code in eh without it

late gull
#

guys, i'm trying to run intercept and i'm getting this

#
Recursos insuficientes en el sistema para completar el servicio solicitado
Insufficient resources in the system to complete the requested service
still forum
#

Battleye

late gull
#

that's to me?

still forum
#

yes

late gull
#

it's a known problem? documented somewhere?

still forum
#

Extensions need to be battleye whitelisted

#

that's not a "problem" that's just how it's supposed to be

late gull
#

and how you know it's BE? where in that logs say something about BE?

still forum
#

I just know that message is BE

#

it blocks loading of the library on kernel level and that throws that message

tough abyss
#

Arenโ€™t BattlEye causing Extension cannot be loaded message? That other message could be win10 related as well

still forum
#

That above message is the own thrown in RPT

#

That is the reason for "extension cannot be loaded"

#

BE should also provide "normal" notification messages in the BE Log in the Arma Launcher

late gull
#

wow so much problems to try a addon

#

i mean "white listing the extension in BE"

still forum
#

usually if you just want to try stuff out.. You just disable BE.

late gull
#

hmm, better

tough abyss
#

Extensions can be exploited client side, hence whitelisting, you donโ€™t like it, switch off BattlEye

still forum
#

For Intercept addons you cannot debug anyway if you enable BE.
So you cannot really develop.

late gull
#

i wont make a public thing, just learn...

still forum
#

then disable BE.

tough abyss
#

Even more reason not to run BattlEye if youโ€™re just experimenting

late gull
#

that's so dramatic

still forum
#

Actually getting a debugger connected to the game with BE running would get you a global ban...

#

So I wouldn't even try that.

tough abyss
#

This ^^

waxen tide
#

Can you elaborate on that Dedmen? Like what exactly would be such a debugger? Not a debug console extension for arma, i figure?

still forum
#

No.

#

A... Debugger.

#

How should I explain that?

waxen tide
#

Better ?

still forum
waxen tide
#

Is it against BI terms to use one?

still forum
#

to debug your own code? no.

waxen tide
#

battleye is way beyond enraging me.

still forum
#

I've not used battleye since 2015

#

Am way happier ever since.

waxen tide
#

not playing much on public servers, eh?

still forum
#

ye

#

And I'm banned anyway ๐Ÿ˜„

waxen tide
#

figures

meager heart
#

life is unfair... ๐Ÿคท

#

(not that life, i mean life! ๐Ÿ˜ƒ)

still forum
#

maybe you mean both?
pay2win life servers and.. pay2win.. life....
Man.. That's unfair..

still forum
#

If you wanna send the RPT. please send the full RPT. You've sent all the useless unimportant stuff and omitted all of the important information.

#

Though all that "Attempt to override final function" sounds like something is very wrong. Seems like you are loading the vanilla PBO's twice or something...
And you are also somehow loading CBA twice.. wtf?

#

Create a logs folder in your Arma directory. Intercept will dump it's logs into there.
Launch your Arma to main menu. Then send me your full RPT and the latest of the intercept logs (should be the smallest file)

late gull
#

omw

#

there is no loading 2 times cba or pbo

still forum
#

For some reason it tries to register all BIS and all CBA functions twice though.

late gull
#

rpt + logs

still forum
#

I think the guide is missing the note that's supposed to tell you to look at that config file and change it as noted in the file

late gull
#

i did leave all by default

#

to try make it work before modify

still forum
#

Yeah. But it says "Change this" for a reason

#

the plugin name on Line 19 needs to be the name of your plugin. So "template-plugin"

late gull
#

ok

#

where it wass that error info?

#

well, that warning

still forum
#

In the intercept logs. Far bottom

late gull
#

ok

still forum
late gull
#

but the only real line to modify it's that 19 huh?

still forum
#

yes.

late gull
#

ok

late gull
#

great, thx

still forum
#

It's always hard for the developers to find issues like this. Because we know exactly what you are supposed to do and how things work.
I didn't expect that people would just ignore Change this and leave it as default and expect it to work.
But it seems logical now ๐Ÿ˜„

late gull
#

xD

#

well things like that happen when i fail to make it work

#

so i say, let it be by default and try, then understand how it works and then i'm ready to modify

#

atleast this is the way how i learn xD

#

this is not my first try to intercept, it's like 4, but this is the first time i ask for help

#

i failed the other tries

still forum
#

We are building up documentation as we go along and people fail to do some things :D
If you fail doing something. We help and then add the changes necessary to prevent others from making the same mistake.

late gull
#

so, i did not read the full documment

#

but i haven't seen the BE thing, about dissable BR or BE whitelist the extension

still forum
#

I expected extension devs to know about the fact that BE requires whitelisting

late gull
#

i'm not a extension devs and i'm learning ๐Ÿ˜„

late gull
#

great

#
[11:23:46]-{info}- Load requested [template-plugin]
[11:23:46]-{info}- Load completed [template-plugin]
#

worked

#

the AI it's not following me, but the extension works ๐Ÿ˜„

#

thx

inner swallow
still forum
#

already posted here yesterday

late gull
#

๐Ÿคท but interesting

#

do you think there will be a docummentation like SQF? for enfu?

still forum
#

there is already

#

though it's not as nice as the SQF doc

late gull
still forum
#

Community will probably make something easier to read

#

yes

late gull
#

i dont even know where to start with this xD

#

i will wait for the community movement :p

scenic pollen
#

Silly question, but do we have an estimate/guess on when Arma 4 will be available (alpha+)?

snow pecan
#

2035

tough abyss
#

Canโ€™t wait to bury A3, can we?

snow pecan
#

Then nobody can complain about futuristic warfare

inner swallow
#

I think it's inevitable that by the time A4 rolls around, there will be good documentation for enscript, and the community will of course make it better over time, just like with A3/SQF

still forum
#

This time atleast we seem to be getting a IDE with tooltips.. But they didn't show tooltips that show documentation about functions and their parameters. Probably because it's waaay not done. Even the existing tooltips what show how a variable was defined are bugged

inner swallow
#

it'll come i'm sure, they're still hiring programmers after all

#

(although this might be me not being involved with scripting until 2015...)

lusty canyon
#

i have a uav obj that i dont want anyone to be able to connect to it regardless of side. so i do

{ _x disableUAVConnectability [_uavObj , true];
} foreach allplayers;

(problem with this is when new players connect they can access it unless i do jip stuff?)
my headache starts here tho, doc https://community.bistudio.com/wiki/showUAVFeed
says

"#(argb,512,512,1)r2t(uavpipsingleview,1.25)"

how can i get that rsc thing into a customView pip like how a normal uav feed works in the navigation gps minedet etc panels? i want the player to still be able to connect to a normal spawned uav and see its feed as normal, but also have my custom uav in its own pip window thing without overwriting the default BIS uav stuff.

hope that made sense

late gull
#

@lusty canyon i don't know if will work, but you can try with remoteExec and use JIP option, that may solve the problem, i guess :p

meager heart
#

how can i get that rsc thing into a customView pip like how a normal uav feed works in the navigation gps minedet etc panels?
you can try just stream feed on custom control, something like this >

private _mission = uiNamespace getVariable "RscDisplayMission";
private _ctrlFeed = _mission ctrlCreate ["RscPicture", -1]; 
_ctrlFeed ctrlSetText "#(argb,512,512,1)r2t(uavpipsingleview,1.25)";
....
```also you can create camera, attach it to uav and do almost the same ^ (just stream on texture `_camera cameraEffect ["internal", "back", <rendersurface>];`)
#

or both at the same time

#

lol

scenic pollen
#

How difficult is it to create a cross-platform shared library (DLL for Windows, .so for Linux)? It looks like C# isn't an option, so I'm left with C/C++/Go. Any others I'm missing?

lusty canyon
#

thanks @meager heart ill try that

scenic pollen
#

@still forum I get the feeling you're the local expert in this area

queen cargo
#

@scenic pollen c# is an option
as long as you utilize mono on linux

scenic pollen
#

Ah that is music to my ears. Will do some googling. Cheers!

still forum
#

Are you sure though @queen cargo ?

#

linux tries to find a file named <extensionname>.so

#

it won't find the C# dll

queen cargo
#

about running DLLs on linux? yes, i am

#

using mono you 100% will be able to

#

about the c# extension stuff, well ... never tried

still forum
#

Linux Arma server.

#

Because that's what we are talking about here

queen cargo
#

it is old information from the previous wiki

still forum
#

I'd even say the wiki C# stuff was written before mono for linux was a thing

#

I'd just go with C++. That 100% works.
go should work too.
C will make easy things way to hard and errorprone for you

queen cargo
#

๐Ÿคท mono works
that is what i know
and as long as mono works, there is a way in which you can load a c# dll on linux too

still forum
#

I guess you can make some .so wrapper extension that forwards messages to the mono dll ๐Ÿค”

queen cargo
#

yeah ... though ... i doubt that would be much useful ๐Ÿคท

#

if you actually are concerned about linux, use c/c++

scenic pollen
#

Hmm yeah I'm doing some googling and not finding many results for how to compile a .so file (which Arma looks for when you call callExtension) from C#

queen cargo
#

because c# "DLLs" are no real dlls

scenic pollen
#

Ah. Damn

queen cargo
#

also, you would have to google for "mono dll linux loading" or something like that

scenic pollen
#

Looks like I'm gonna have to use C++ then. I've been trying to avoid it haha. Coming from a Java/Python background, C++ is a little daunting

#

I see, thanks @queen cargo

queen cargo
#

as you have to use mono to actually get your c# dll running

minor lance
#

Is Arma limited to have only 8 cameras created as max?

still forum
#

I can't find anything on the wiki or elsewhere about cameras being limited

minor lance
#

i create 20 cameras and assign them to a RSCPicture and only 8 are showing

#

sometimes ones and sometimes others

still forum
#

as PIP camera you mean?

#

yeah PIP is limited

minor lance
#

camCreate yep

#

any fix or solution

#

ยฟ?

still forum
#

no.

#

you can only have a limited number of picture in picture renders

minor lance
#

o ๐Ÿ˜ฆ

#

thanks

still forum
#

I just checked. Number is indeed 8.

#

Hardcoded. you cannot change it

minor lance
#

oh ::(

minor lance
#

I have a dialog to control some security cameras before knowing the limit, I had 20 pictured ad assign each camera to a picture but due to the limit i can only see 8. Now I have only 2 pictures and i ned to click ina list to see the camera into a picture BUT when i have clicked 8 cameras, the other ones are black. I remove and create the camera each time it changes

scenic pollen
#

I'd imagine 20 PIP would destroy performance anyway?

still forum
minor lance
#

ahhh my fault

#

not terminating the source

#

Thankssss <3<3

lament grotto
#

player removeAction 0;
_box attachTo [player, [0, 0, 0.6]];
player setUnitTrait["camouflageCoef", 0.01];
player action ["SWITCHWEAPON",player,player,-1];
player addEventHandler ["Hit", {player execVM "scripts\mgsend.sqf";}];
sleep 3;
player playAction "PlayerCrouch";
sleep 40;
player setUnitTrait["camouflageCoef", 1];
deleteVehicle _box;
sleep 120;
player addAction _action;
}];```
#

Hey guys I want to make that script show up as an add action, however it does not. Unless I put player addAction _action; at the bottom, however that duplicates my addactions

#

Is there a way to make only show the one action instead of two?

ruby breach
#

Remove the player addAction _action; from the addAction codeblock?

lament grotto
#

If i do that, will it appear again after use as I want it to remove the action then add it in after a cooldown

#

I removed it and I still get the double effect

digital hollow
#

Where are you running player addAction _action;?

lament grotto
#

at the end of the code, after }];

#

I think I found the issue

#

I was callling the script twice elsewhere

calm bloom
#

Hello, comrades! Need your advice again. I have some strange problem. My includes have stopped working inside pbo mission file.
Instead of #include "\pzn_camp\Campaign\Missions\description.hpp" game tells me that it cant find pzn_camp\Campaign\Missions\description.hpp file (no slash before the addon name). If i run local server from a folder everything works.
I even managed to bypass server crash if i land mission into server cycle, but includes are not working.
Has anyone faced this?

still forum
#

My includes have stopped working inside pbo mission file. correct

#

got broken with the 3DEN update

#

only fix is removing the #include

calm bloom
#

Thank you

minor lance
#

@lament grotto ```
actionBox = player addaction ["<t color='#009BFF'>Stealthbox</t>", {_box = "Land_PaperBox_01_small_stacked_F" createVehicle position player;

player removeAction actionBox ;
_box attachTo [player, [0, 0, 0.6]];
player setUnitTrait["camouflageCoef", 0.01];
player action ["SWITCHWEAPON",player,player,-1];
player addEventHandler ["Hit", {player execVM "scripts\mgsend.sqf";}];
sleep 3;
player playAction "PlayerCrouch";
sleep 40;
player setUnitTrait["camouflageCoef", 1];
deleteVehicle _box;
sleep 120;
player addAction _action;
}];

ruby breach
#

_action is now undefined

minor lance
#

The player removeAction 0; Removes the action with the ID 0, and your action possibly is not the action 0, actionBox has now thhe id and doing player removeAction actionBox;; will do the trick

#

ah

#

didnt see the last part

ruby breach
#

You could likely recreate the addAction using actionParams within the addAction codeblock

minor lance
#

player removeAction boxID;
_box attachTo [player, [0, 0, 0.6]];
player setUnitTrait["camouflageCoef", 0.01];
player action ["SWITCHWEAPON",player,player,-1];
player addEventHandler ["Hit", {player execVM "scripts\mgsend.sqf";}];
sleep 3;
player playAction "PlayerCrouch";
sleep 40;
player setUnitTrait["camouflageCoef", 1];
deleteVehicle _box;
sleep 120;
boxID = player addAction BoxAction;
}];

boxID = player addaction BoxAction;```

saving the action and its ID to a global variable will do the trick ๐Ÿ˜›
#

BoxAction contains the Action and boxID contains the action ID

ruby breach
#

Generic global variable names are usually not a great idea

minor lance
#

:/

#

player removeAction (_this select 2);
_box attachTo [player, [0, 0, 0.6]];
player setUnitTrait["camouflageCoef", 0.01];
player action ["SWITCHWEAPON",player,player,-1];
player addEventHandler ["Hit", {player execVM "scripts\mgsend.sqf";}];
sleep 3;
player playAction "PlayerCrouch";
sleep 40;
player setUnitTrait["camouflageCoef", 1];
deleteVehicle _box;
sleep 120;
player addAction BoxAction;
}];

player addaction BoxAction;
#

Just Using 1 global var

#

the _this select 3 is the current ID of the action so its easy to remove

#

to add it again...

queen cargo
#
BoxAction = ["<t color='#009BFF'>Stealthbox</t>", {
    _box = "Land_PaperBox_01_small_stacked_F" createVehicle position player;
    player removeAction (_this select 2);
    _box attachTo [player, [0, 0, 0.6]];
    player setUnitTrait ["camouflageCoef", 0.01];
    player action ["SWITCHWEAPON", player, player, - 1];
    player addEventHandler ["Hit", {
        player execVM "scripts\mgsend.sqf";
    }];
    sleep 3;
    player playAction "PlayerCrouch";
    sleep 40;
    player setUnitTrait ["camouflageCoef", 1];
    deleteVehicle _box;
    sleep 120;
    player addAction BoxAction;
}];
player addaction BoxAction;```
#

@minor lance you should start formatting your code

#

makes it much more readable

ruby breach
#

This may work with no global variables ```sqf
_arr = player actionParams (_this select 2); // before removing the action
_arr deleteRange [10,2]; //to make output match addAction input
player addAction _arr; //re-add the current action

#

Just use actionParams to get the current action's parameters, store them as a local variable while executing the action, and then use that variable to re-add a duplicate of the current action

minor lance
#

@queen cargo I just copied this guys code, how can i set the language?

queen cargo
#

```sqf

minor lance
#

ty

queen cargo
#

but was talking about indentation

minor lance
#

I indent my files, but as I copy paste from discord ...

#

I like indentation XD Its our friend

ruby breach
#
player addAction ["<t color='#009BFF'>Stealthbox</t>", {
    _box = "Land_PaperBox_01_small_stacked_F" createVehicle position player;
    _actionParams = player actionParams (_this select 2);
    player removeAction (_this select 2);
    _box attachTo [player, [0, 0, 0.6]];
    player setUnitTrait ["camouflageCoef", 0.01];
    player action ["SWITCHWEAPON", player, player, - 1];
    player addEventHandler ["Hit", {
        player execVM "scripts\mgsend.sqf";
    }];
    sleep 3;
    player playAction "PlayerCrouch";
    sleep 40;
    player setUnitTrait ["camouflageCoef", 1];
    deleteVehicle _box;
    sleep 120;
    _actionParams deleteRange [10,2];
    player addAction _actionParams;
}];``` there we go. That *might/should* work
minor lance
#

Its working @ruby breach @lament grotto

polar folio
#

does anyone know what could be the cause of createSimpleObject working with one model but but not another? trying to place some weapons. MX example i found works fine. if i replace the path with the one from one of the apex rifles, there is nothing to see

tough abyss
#

Could you show the code?

polar folio
#

works

 _rifle = createSimpleObject ["A3\Weapons_F_Exp\Rifles\SPAR_01\SPAR_01_F.p3d", getPosWorld player]; 
 
_rifle setVectorDirAndUp [[0,0,1],[0,-1,0]]
#

damn ๐Ÿ˜„

meager heart
#

```sqf
code
```

polar folio
#

ty

#

doesn't work

 _rifle = createSimpleObject ["\A3\Weapons_F_Exp\Rifles\CTAR\CTAR_F.p3d", getPosWorld player];  
  
_rifle setVectorDirAndUp [[0,0,1],[0,-1,0]]
#

difference is model path and result is. nothing is visible on second one. could be offset maybe? although i tried offsets and didn't see it still

ruby breach
#

Now look at your filepaths again. Are you sure there's nothing different about them?

austere granite
#

leading slash bois

#

_startsWith = {
    params ["_string", "_check"];

    if (count _string < (count _check)) exitWith { false };
    (_string select [0, count _check]) == _check
};

_endsWith = {
    params ["_string", "_check"];

    if (count _string < (count _check)) exitWith { false };
    (_string select [count _string - count _check, count _check]) == _check
};

params ["_modelPath"];

if (_modelPath isEqualTo "") exitWith { "" };

// -- Add p3d
if !([_modelPath, ".p3d"] call _endsWith) then {
    _modelPath = _modelPath + ".p3d";
};
// -- Remove leading slash
if ([_modelPath, "\"] call _startsWith) then {
    _modelPath = _modelPath select [1, count _modelPath - 1];
};

_modelPath

feel free to use that

#

just split it up in actual functions instead of inline pls

polar folio
#

@ruby breach i see. thx. was pulling from the config via gettext. assumed it was valid...

ruby breach
#

If there's one thing to know about Arma, it's consistently inconsistent. lol

polar folio
#

i wonder, if the config file paths will always be like that. do you know, if they need the \ to work? doesn't really matter since i gotta remove it but i could leave out the condition for it to be present, if that makes any sense

#

probably doesn't matter performance wise since it's not a frequent thing but, i sure would make the code more "dumb"/"blind", if i'm 100% all paths will look the same

lean estuary
meager heart
#

Container/Closed/Opened also Inventory/Opened/Closed < you can try those

#

(on the same page btw)

fringe yoke
#

Is there a way to recompile functions with CBA while the mission is running?

lean estuary
#

How to check if a item is a weapon, i need to also be able detect it while the item is in the player backpack or any other container. (This marks of currentWeapon)

chilly wigeon
#

iirc theres a bis function to detect item type

meager heart
lean estuary
#

Ah thanks lads. I hate how hard it is to find these bis fncs

lament grotto
#

Camper back at it again with a question. ```player addAction ["<t color='#009BFF'>Stealthbox</t>", {
_box = "Land_PaperBox_01_small_stacked_F" createVehicle position player;
_actionParams = player actionParams (_this select 2);
player removeAction (_this select 2);
_box attachTo [player, [0, 0, 0.6]];
player setUnitTrait ["camouflageCoef", 0.01];
player action ["SWITCHWEAPON", player, player, - 1];
player addEventHandler ["Hit", {
player execVM "scripts\mgsend.sqf";
}];
sleep 3;
player playAction "PlayerCrouch";
sleep 40;
player setUnitTrait ["camouflageCoef", 1];
deleteVehicle _box;
player removeEventHandler ["Hit", 0]
sleep 120;
_actionParams deleteRange [10,2];
player addAction _actionParams;

}];``` So I know this script works in singleplayer due the Player variable but how can I get it to work in Multiplayer?

meager heart
#
private _action = ["<t color='#009BFF'>Stealthbox</t>", {
    params ["_target", "_caller", "_actionId"];
    private _box = "Land_PaperBox_01_small_stacked_F" createVehicle [0, 0, 0];
    _box attachTo [_caller, [0, 0, 0.6]];
    _caller setUnitTrait ["camouflageCoef", 0.01];
    _caller action ["SwitchWeapon", _caller, _caller, - 1];
    _target removeAction _actionId;

    private _id = _caller addEventHandler ["Hit", {
        params ["_unit", "_source", "_damage", "_instigator"];
        _unit removeEventHandler ["Hit", _thisEventHadler];
        /* code here from scripts\mgsend.sqf */
    }];

    [_caller, _box] spawn {
        params ["_caller", "_box"];
        sleep 3;
        _caller playAction "PlayerCrouch";
        sleep 40;
        _caller setUnitTrait ["camouflageCoef", 1];
        deleteVehicle _box;
        sleep 120;
        _caller addAction (_caller getvariable "var_action");
    };
}];

player setVariable ["var_action", _action];
player addAction _action;
```like that ^ maybe
lament grotto
#

okay and then how bout this script that removes the box on hit. playSound "alert"; {deleteVehicle _x} forEach attachedObjects player; player setUnitTrait["camouflageCoef", 1]; player removeEventHandler ["Hit", 0]

meager heart
#

is that what you have in "mgsend.sqf" ? or

#

@lament grotto

lament grotto
#

yeah

meager heart
#
playSound "alert";
{deleteVehicle _x} forEach attachedObjects _unit;
_unit setUnitTrait ["camouflageCoef", 1];
#

replace comments with this ^

#

/* code here from scripts\mgsend.sqf */ < that comment there ^ ^ ๐Ÿ˜ƒ

lament grotto
#

I really do need to remember to make comments

#

so it would look like this ```private _id = _caller addEventHandler ["Hit", {
params ["_unit", "_source", "_damage", "_instigator"];
_unit removeEventHandler ["Hit", _thisEventHadler];
playSound "alert";
{deleteVehicle _x} forEach attachedObjects _unit;
_unit setUnitTrait ["camouflageCoef", 1];
}];

meager heart
#

yes

#

also

#

find this > deleteVehicle _box; and replace it with >

if (!isNull _box) then {deleteVehicle _box};
```in case your eh will fire before...
lament grotto
#

Ill give it a test thanks a bunch

meager heart
#

gl

lament grotto
#

works a treat on the dedi bo thanks @meager heart

fossil yew
#

Is there a MP friendly function for invoking animations? BIS_fnc_ambientAnim doesn't work in MP.