#arma3_scripting

1 messages ยท Page 578 of 1

wooden plaza
#

anyone help me with this please for exile server

Warning Message: You cannot play/edit this mission; it is dependent on downloadable content that has been deleted.
wy_sww
fleet sand
#

@wooden plaza you are missing the mod tha has wy_sww

wooden plaza
#

got the WY_Snow_Winter_Effects_and_Retexture_Pack mod on my server

#

only started getting when added the snow script in think that might be why

potent dirge
#

I have a minor problem that has been bugging me, this snippet gives a Generic Expression error, why?

waitUntil { time >= time + 30};

exotic flax
#

first of all because it will never continue, since it will always be false...

#

second; where and how is this used/called?

potent dirge
#

It's a cooldown timer, kind of got it from the example on the 'time' BIKI

#

infact the one on the BIKI copied verbatim also gives a Generic Error

exotic flax
#

example on biki is:

private _future = time + 30;
waitUntil { time >= _future };

Which will work because the future time is "static" within the waitUntil, yours will always return false

#

so most likely called at the wrong place/moment

potent dirge
#

Most likely

exotic flax
#

try:

0 = [] spawn {
   private _future = time + 30;
   waitUntil { time >= _future };

   // your code
};
potent dirge
#

It's supposed to be run after a function that depends on a trigger, I don't want the cooldown to be before the function runs as then you'll have to wait after trigger is met. Will the above format work normally?

exotic flax
#

so function -> trigger -> cooldown -> continue function?

potent dirge
#

More like trigger > function > cooldown > trigger again

#

Either way cooldown has to be last

exotic flax
#

so it shouldn't trigger again until the cooldown has ended, got it ๐Ÿ˜‰

#

in that case I would create a global value (eg. in missionNamespace) with the time of the last execution, and at the start of the function check if the old time is more than n seconds ago

potent dirge
#

That's seems like a better idea, also stops the function from running for too long. If it doesn't work I can always just use sleep

exotic flax
#
if (time >= missionNamespace getVariable ["lastTriggerTime", 0] + 30) then {
   // your code

   missionNamespace setVariable ["lastTriggerTime", time];
};
#

^^ not tested, but should give an idea on how to tackle it

potent dirge
#

Thanks a lot would have eaten my keyboard without you

exotic flax
#

np

sage flume
#

so is it

#

if(side _x == independent) then

#

or

#

if(side _x == indep) then

exotic flax
sage flume
#

been looking, could not find, thanks!

#

was just there and saw this,...INDFOR and thought hmm? never saw it like that before

#

I' having a awetime spawning as independent without NVG's

#

aweful

bold kiln
#
{
  showWindow = 0;
  hideOnUse = 0;
  priority = 6;
  role = 0;
  displayName = "Activate Impulse";
  position = "pilotview";
  radius = 9;
  condition = "(alive this)";
  statement = "0 = this spawn 3as_fnc_afterburnerMK1_turn_on";
};
``` When activated an error saying the statement line is missing a semicolon. Ideas?
exotic flax
#

exactly as the error says... there's a semicolon missing IN the statement

#
statement = "0 = this spawn 3as_fnc_afterburnerMK1_turn_on**;**";
bold kiln
#

Oops. thanks for that. It's still throwing the same error but I will double check for missing ;

exotic flax
#

in that case it's most likely in the function (bit hard to tell without the exact error)

tough abyss
#

How would I make a group of vehicles only start moving when players reach a waypoint?

exotic flax
#

use triggers

flat elbow
#

how do I create selectable options for a mission?

bold kiln
#

I can actually run the function in the debugger fine. It's somewhere in the cpp

exotic flax
#

in the snippet you posted there are no (other) issues, so it could be a missing ", {, } or ; somewhere

bold kiln
#

I've gone over the portion for my useraction classes in the cpp and still not finding anything. Maybe it is in the function and I'm just not seeing it
https://hastebin.com/gufexuzaki.cs

exotic flax
#

script looks fine by me

bold kiln
#

Does anyone here know if the Arma 4 release is real and if the engine will still allow most existing scripts to be used?

exotic flax
#

A4 rumours are fake...

#

as for SQF support in the Enfusion Engine, no idea... currently DayZ:SA uses a hybrid which still supports it, but there has been no news about how it will work in a game with only Enfusion.

flat elbow
hollow thistle
#

Only on objects. So units.

flat elbow
#

like, i want to offset every member of the squad to a certain position, do I have to iterate for every member or i can just squad1 setPosASL [1,2,3] ?

#

mmh so how do I move them without changing their relative position?

hollow thistle
#
{
    private _pos = getPos _x;
    _x setPos (_pos vectorAdd [0,0,1]);
} forEach units _grp;
#

Will offset Z of every unit in a group by 1

#

Not sure what do you want to achieve.

#

Do you want to move the squad and keep formation?

flat elbow
#

no it's like

#

i have a mission that is supposed to start in the sea

#

but since players are solid they keep drowing because they forget rebreathers

#

so i want to add an option to start on the beach directly

#

which means i have to move the players and the SDV (that is also the current arsenal) to the beach

hollow thistle
#

Trying to move them by offset does not sound like good idea for that.

flat elbow
#

how would you solve it?

#

my idea was to place an invisible marker and say "move them to this position keeping the same distancing etc."

hollow thistle
#

Move SDV to marker pos

#

Yeah. Not sure why you need to save distancing between players.

It's still not complicated but I don't want to explain this from a phone xD

flat elbow
#

because they don't spawn inside the SDV

#

they spawn on air and have to locate it

exotic flax
#

I get it; all players should move to a new position, where each player needs to stay in their relative position (just moved as a group). at least that's what I'm understanding from it

hollow thistle
#

Get leader pos, get position offsets via vectorDiff

exotic flax
#

^^

hollow thistle
#

Move leader move other units and apply saved offsets.

#

This should lead you into right direction. It's not a hard script to write.

#

almost 4am here. Glhf

sage flume
#

I'm having trouble with this code and getting an error that says missing {

#

{
_x unlinkItem "NVGoggles";
}
foreach allUnits;
};

flat elbow
#

yea it's not hard but i hoped there would be a shorter way to do it

exotic flax
#

@sage flume what is the full script, because there seems to be stuff missing...

#

if it's too long please put it on pastbin, otherwise use ```sqf code ```

sage flume
#

well I'm porting another mission and it's very complex. I was told by the author to just put it at the end of the "MainLoop.sqf"

#

may not be an easy question to ask I suppose

stuck musk
#

is there a way to check if two variables reference the same data?

exotic flax
#
{
   _x unlinkItem "NVGoggles";
} foreach allUnits;

this is correct (without the extra };, unless that's a part of the code before it)

#

@stuck musk except for checking if they contain the same data, no

stuck musk
#

oof

sage flume
#

This actually trails after it

#

//diag_log "------END OF MAIN LOOP------"
};

exotic flax
#

in that case there's a }; too much in your code

sage flume
#

I'll paste a bit before and after it so you can kinda see

#

_ww2cPos = position player;
[] call RYD_WW2B_AnimalsLoop
};

    //[] call RYD_WW2B_Sfx;
    [] call RYD_WW2B_Flyby;
    [] call RYD_WW2B_Smokes;
        };
        
        {
        _x unlinkItem "NVGoggles";
        }
    foreach allUnits;
    };
    
//diag_log "------END OF MAIN LOOP------"
};
#

THats just the very end of the file with stuff on either end of my NVGoggle issue

exotic flax
#

again... there's a }; too much somewhere, so I suggest counting the { and } and make sure they are equal

sage flume
#

lol, I've been looking for hours but I'm just to old to get it, Ha

#

at least youve given me a hint

#

I'll mess with the };

exotic flax
#

counting brackets since 2001 ๐Ÿคฃ

sage flume
#

oh Your old to !!!

#

lol

exotic flax
#

and programming for a long time, and it's always something too much or not enough

flat elbow
#

so uhm to get a list of all the units in the player's team is "members group player"? cuz it gives me a generic error in expression

exotic flax
flat elbow
#

oh, right...

#

8 years of not arma scripting made me forgot too many things

#

thank you very much

exotic flax
#

np

flat elbow
#
switch ({"Param_SpawnPosition" call BIS_fnc_getParamValue; }) do { 
    // Elaborate value on include/params.hpp
    case 0: {}; 
    case 1: { [teamLeader] spawn FG_fnc_membersOffset; }; 
    default { _enemyMinSkill = 0.40; _enemyMaxSkill = 0.60; }; 
};

FG_fnc_membersOffset = {
    private ["_squadLeader"];
    private _teamMembers = [];
    {
        _teamMembers pushBack _x;
    } foreach units group _squadleader;
    hint str _teamMembers;
};

No error but no hint either (i tried to hint "aaaa" but still no hint), what am I doing wrong?

#

(the "Param_SpawnPosition" call BIS_fnc_getParamValue; returns 1 btw)

exotic flax
#

private ["_squadLeader"]; must be params ["_squadLeader"];

flat elbow
#

yea and it was complaining about the {} in the switch statement too

#

well, not complaining, failing silently, but still

exotic flax
#

and why not do

_paramValue = "Param_SpawnPosition" call BIS_fnc_getParamValue;
switch (_paramValue) do { 

that will prevent a lot of issues

flat elbow
#

so, now i have an array with all the units in the group and their vectorDiff of their position against the team leader, so i can move the team leader then move the other units after subtracting the member offset from the final position

eager stump
#

Is this me or is this ArmA? On Stratis map, editor, play in MP - put into console: [[3421,6041,0], 30, 100, 12, 0, 0.25, 0, [], [3421,6041,0]] call BIS_fnc_findSafePos This will return only 3421 (number) and not a position [X,Y] (array). Removing the default position, returns world middle as [X,Y,Z].

still forum
#

Arma*

#

@eager stump wrong argument for defaultPos

opal turret
#

Hey folks,

Need a hand with this, tried wrapping my head around it but just can't get it working, would appreciate any assistance.

private _routeMarkers_01 = [];

(calculatePath ["wheeled_APC","careless",_convoyStart_01, _convoyEnd_01]) addEventHandler ["PathCalculated",{
    {
            if (_forEachIndex % 10 == 0) then 
                {
                    _routeMark_01 = createMarker ["convoy_marker_01" + str _forEachIndex, _x];
                    _routeMark_01 setMarkerType "mil_dot";
                    _routeMark_01 setMarkerColor "ColorRed";
                    _routeMark_01 setMarkerSize [0.6, 0.6];
                    _routeMark_01 setMarkerAlpha 0.6;    
                };     
    } forEach (_this select 1);
}];

I'm trying to get the markers that are created inside the EH into the _routeMarkers_01 array so they can be deleted later. Tried different iterations of pushback but so far no luck.

Any ideas?...also apologies for the poor formatting.

balmy creek
#

Hi community , could you please clarify me some issue .
I play some mission with my friends more 5 hours and we want save progress .
But if i add in source mision enableSaving [true,true];
Not work fine went after started misiion logic mission crashed .
How i can save progress in server after restart ? ( i know mission AntiAltis save progress work fine )

winter rose
#

before* restart

it depends on the mission, some work with databases.
if you use saveGame it saves on the server iirc, and this is useless if the server is a dedicated one.
You would have to use a specific script to save then

real tartan
#

Is there a function to create ORBAT module by script ?

winter rose
#

you can create all modules with createโ€ฆ createVehicle or createUnit though, I don't remember ๐Ÿค”

real tartan
#

want to avoid creating modules on map each time I create mission ...

fervent kettle
#

Hi, so i am trying to set a spawn up that spawn a BTR, removes it gunner and makes it move between point A and B and once destroyed delete the wreck.
Now the question is, how do i define it? right now i am using the "doMove" function:
_veh = "rhs_btr60_msv" createVehicle getMarkerPos "truckspawn"; this doMove (getMarkerPos "movebtr");

winter rose
#

right now, you only create the vehicle, not the crew.
this does not refer to anything

fervent kettle
#

oh right, what would i need to refer to the crew when it spawns?

winter rose
fervent kettle
#

aight, that worked so far, but how do i make them cycle between point A and B now? google wasnt realy helpful

winter rose
#

you can use a "CYCLE" waypoint

#

create one "MOVE" waypoint to "movebtr"
create one "CYCLE" waypoint to "truckspawn"

fervent kettle
#

i want the BTR to spawn when activating a script (unlimited use) so i cant pre define the waypoint

winter rose
#

you can, with addWaypoint ๐Ÿ˜‰

fervent kettle
#

so _grp will be the BTR name then?

winter rose
#

sorry, what?

fervent kettle
#

_wp name of the waypoint and _grp name of the vehicle to move?

winter rose
#

that is an example, _grp is the group to which you want to add the waypoint

fervent kettle
#

my group would be the vehicle in this case, right?

winter rose
#

no, a vehicle is an object
group would be the crew's group

#
private _spawnResult = [getMarkerPos "truckspawn", getMarkerPos "truckspawn" getDir getMarkerPos "movebtr", "RHS_BTR60_MSV", east] call BIS_fnc_spawnVehicle;
_spawnResult params ["_vehicle", "_crew", "_crewGroup"];

_crewGroup addWaypoint (...)
``` @fervent kettle
fervent kettle
#

thanks that worked so far, one last question, whenever i try to define the waypoint type it gives me an "undefined variable" error

still forum
#

how do you "define" a waypoint type

fervent kettle
#

probaply the wrong word for that, happens in math to me too :P
however i ment this one here truckspawn setWaypointType "CYCLE";

still forum
#

so its giving you undefined variable error. Then I would assume.. That you have a... hm.. undefined variable? there?

fervent kettle
#

I was that far too lol

still forum
#

where do you define truckspawn ?

fervent kettle
#

it`s in a marker

still forum
#

Ah its a marker then

#

markers don't have variable names

#

and markers are not waypoints

#

you cannot setWaypointType on a marker

#

setWaypointType sets the type of waypoints

fervent kettle
#

okay, thought i could just use it, how do i set the type of waypoint then?

still forum
#

you need to get the waypoint

#

From the snippet above, I think addWaypoint returns it

fervent kettle
#

after reaching point A it just keeps driving into the nowhere, do i need to implement waitUntil or smth?

real tartan
#

so I tried:
initServer.sqf

_module = createVehicle ["ModuleStrategicMapORBAT_F", [0,0,0], [], 0, "NONE"];
_module setVariable ["Path", configfile >> "CfgORBAT" >> "BIS" >> "O_Brigade", true];
_module setVariable ["Parent", configfile >> "CfgORBAT" >> "BIS" >> "O_Brigade", true];
_module setVariable ["Tags", [], true];
_module setVariable ["Tiers", -1, true];

but module is not showing

#

also tried:

_module = (createGroup sideLogic) createUnit ["ModuleStrategicMapORBAT_F", [0,0,0], [], 0, "NONE"];
_module setVariable ["Path", configfile >> "CfgORBAT" >> "BIS" >> "O_Brigade", true];
_module setVariable ["Parent", configfile >> "CfgORBAT" >> "BIS" >> "O_Brigade", true];
_module setVariable ["Tags", [], true];
_module setVariable ["Tiers", -1, true];
#

ok, so apparently variables need to be STRING, as function is calling call compile (_logic getVariable "Path")

winter rose
#

so the second works for creation?

real tartan
#

also createAgent works too

#

is there some way to convert
configfile >> "CfgORBAT" >> "BIS" >> "O_Brigade" to 'configfile >> "CfgORBAT" >> "BIS" >> "O_Brigade"' ?

winter rose
#
str { /* code */ }
```_perhaps_ ๐Ÿฎ
winter rose
#

Since A3 1.86 if you want to place a module with createUnit, you have to ensure that the module gets activated automatically by setting BIS_fnc_initModules_disableAutoActivation to false

real tartan
#

@winter rose got that in code, just excluded part from it to deliver simpler example

winter rose
#

okido - just to be sure ๐Ÿ‘Œ

flat elbow
#

does _name make the variable private automatically or do I still have to say private _name ?

#

as i am having some weird issues with the function

bright flume
#

_ is the private definer, yes.

still forum
#

does _name make the variable private automatically or do I still have to say private _name ?
no it doesn't, yes you have to set private if you want it private

winter rose
#

โ€ฆalthough it seems there is a mixup with private and local there too ๐Ÿ˜…

#

fixed

still forum
#

private keyword was called local in A2

winter rose
#

yep
but _var variables are local vars, not always private

#

I also fixed global variable โ†’ public variable

astral dawn
#

Finally, I have found it:

/*!
    Base script class for all motorized wheeled vehicles.
*/
class CarScript extends Car
{

The Car Script!

bright flume
#

ah...

winter rose
#

\o/

#

after all these years!

bright flume
#

sorry local == private to me...

hollow thistle
#

xDD

winter rose
#

spank spank

astral dawn
#

Yes it's in DayZ, I think the guy would be happy to know

bright flume
#

hey dont blame me for BI decided to rewrite the rules...

winter rose
flat elbow
still forum
#

local ones are cleaned up when they go out of scope

flat elbow
#

would it be useful to specify it in the "Deletion" section?

astral dawn
#

Well it's stated that
A variable is only visible in the script, or function, or Control Structures in which it was defined.
So if it's not visible then it's reasonable to assume that it has been cleared up... and it's like that pretty much everywhere else
But in arma world it's generally good not to assume anything ๐Ÿ˜„

flat elbow
#

not visible does not mean not allocated

winter rose
#

yep, a clearer message could do indeed

flat elbow
#

i can launch a while inside a function and create a variable that is 15GB large and it would still not be visible outside it

winter rose
#

anyway, #community_wiki ๐Ÿ˜› hehe
the "cleanup" part will be changed someday soon\โ„ข
if Ded' can confirm where the cleanup happensโ€ฆ exit of the scope, or exit of the script?

still forum
#

scope

#

not visible anywhere == gone

bright flume
#

wish they just followed java's terminology...

queen cargo
#

Mhh?

flat elbow
still forum
#

BI once had a native integration, got removed because a hacker missused it

#

but its basically as good as native one would be

flat elbow
#

heh it would be nice to have it and require, like this one, that battleye is disabled to use it

still forum
#

Well what would be the difference if I just take mine, and slap a BI sticker on it? ๐Ÿ˜„

#

Same thing

winter rose
#

it's Official\โ„ข

#

and not {{unsupportedTool}} ๐Ÿ‘€

#

(also, you may lose your copyright in the process ๐Ÿ˜„)

queen cargo
#

@flat elbow there is also sqf-vm ๐Ÿคซ

flat elbow
#

sqf-vm is imho not comparable at all

astral dawn
#

it has a ||very outdated(I must update it)|| VSCode plugin

flat elbow
#

the main difference would be that it would be native (ie no mod add required), supported, probably also more widespread as more people would use it, etc.

queen cargo
#

Sqf-vm has arma.studio Integration
And just lacks people to implement operators (with the most common already implemented)

flat elbow
#

it lacks the ability to test the script in a real scenario with all the mods and people on the server and units positioned mods etc.

#

after all it's a VM

astral dawn
#

It's useful for tests

#

but yeah VM emulator != debugger

still forum
#

SQF-VM is hands down the best for linting and automated testing on CI
Its preprocessor found so many bugs in ACE that noone noticed

astral dawn
#

oh yes, and this โ˜๏ธ its compiler reports even more errors than arma

flat elbow
#

i wonder why people don't all converge on one set of tools and improve it like it's done with ACE and CBA instead of developing parallel projects that mostly overlap

astral dawn
#

parallel projects like what?

#

well maybe you mean those pbo build tools

queen cargo
#

@flat elbow so something, no Tool ever can give you, to Show User errors?

flat elbow
#

12 code editors, 9 debug consoles, 4 SQF debug tools, 14 addon creation

still forum
#

There is one debugger, one profiler, and one emulator. They are all very different things

#

Debug consoles weren't integrated into the game in Arma 2 and older, which is why people made some

#

Different editing tools because there are different editors, and different types of tools, they aren't all the same thing

flat elbow
#

yea i remember arma 2 having no debugger integrated

#

but arma 2 is EOL now isn't it?

winter rose
#

yup

#

maybe Dedmen will add all the scripting commands from A3 to A2, dunno

still forum
#

HAH

winter rose
#

โ€ฆpwetty pwease? OwO

astral dawn
#

So many 'code editors' are because there are many IDEs for which these plugins are made. But why people were making own code editors I don't understand much myself, apart from the reason of fun

winter rose
#

for the glory of Satan, of course! ๐Ÿ”ฅ

astral dawn
#

yes!

flat elbow
#

i understand syntax highlighters, what makes my nose itchy is the lack of a standarized toolset of development for A3

#

like, i'd expect a "here is our IDE, you connect it to A3 like this, you interact with it like this, click here to see variables, click here to put breakpoints, here is the stack, here is to pbo the directory etc.etc.etc." and as a side project people create their own things for fun (for example for notepad++ or VIM or whatever)

astral dawn
#

I guess there should just be a 'latest tools for arma 3' page, because for instance the one you have listed above lists tools for all arma games

#

although... it can sort by game

flat elbow
#

it would help but the best would be a standarized toolchain

#

so we can just focus on creating content and code and not fight the custom toolchains too

astral dawn
#

for something 'standard' there should be some central authority, and there is no such person in the community of course ๐Ÿ˜„
everyone has his own favourite IDE, favourite pbo packer, etc

spark sun
#

Make a DevTool CDLC

flat elbow
#

like now i am trying this addon for visual studio code and it stopped doing any breakpoint

#

๐Ÿคทโ€โ™‚๏ธ

astral dawn
#

well... the case for debugger is special, it's the only debugger and therefore the best we have

#

I'd understand your argument if we had >1 ๐Ÿ˜„

flat elbow
#

i agree with you but we do have a central authority, BIS

#

that's why I said an official toolchain

astral dawn
#

....aand what do you expect them to do? to tell everyone to use a specific pbo tool for instnace?

#

ah ok, well there is one for DayZ

#

which is far better than std tools for arma 3 (in terms of scripting at least, not aware about models and such)

still forum
#

to tell everyone to use a specific pbo tool for instnace
they are already doing that. Didn't work

astral dawn
#

yes? which one? the std pbo packer?

#

'addon builder' sorry ๐Ÿ˜„

flat elbow
#

no, i'd expect to have an IDE with a built-in connection to A3 engine and all the toolset we need to develop content (and we already have some of them, there's A3 tools in steam, but it lacks an "official" IDE with a native connection for debugging)

astral dawn
#

okay, well in dayz there is such thing and it really works...

#

I doubt anyone will make one for arma 3 now

#

but for the next game, it looks like we'll have it ||finally||

flat elbow
#

i sadly don't have dayz so i don't know it

#

the only dayz i ever play was the A2 mod

astral dawn
#

trust my word ๐Ÿ˜„ took me a day to make the debugger work but it does work nice

#

and the for code is good enough

still forum
#

wanna hear how long it took me to make it work? HAH

astral dawn
#

idk, 10 minutes?

#

well it took me two days, I think ๐Ÿ˜„ until I figured out how TF it resolves paths

flat elbow
#

i mean, it can be bad, but it's at least something that we can improve on

#

which to my eyes is a better stance than having something some poor guy made and hope it gets updated with the news and gets fixed and gets features

#

and it does not get dropped the next month because the developer of the community tool stopped caring about it or does not play anymore

astral dawn
#

well ideally community should have same tools as game developers...

still forum
#

Or better ๐Ÿ˜„

flat elbow
#

such thing never made a game successful, we all know what happened to the Source engine

#

oh wait... ๐Ÿ˜›

astral dawn
#

Or better ๐Ÿ˜„
Haha... ha... ha? ๐Ÿค”

flat elbow
#

aren't BIS developing a new engine? i remember such a rumor

astral dawn
#

well it's part of dayz now

still forum
#

The correct abbrev is "BI"

flat elbow
#

isn't it Bohemia Interactive Studios?

#

(also all functions are BIS prepended ๐Ÿ˜ฎ )

still forum
#

Yes but they not-so-recently shortened the abbrev to BI. Because BIS is Bohemia Interactive Simulations

flat elbow
#

mmh it rings some bell in my memory about a skype conversation with one of the guys in the studio that told me something similar

queen cargo
#

Well... There is arma.studio... But it never gained traction so loads of stuff still missing + me rewriting mayor parts to make it easier to maintain
But it was the attempt to make it THE arma ide

flat elbow
#

arma.studio?

astral dawn
#

You can't yourself outdo MS and their VSCode in this field IMO

#

well because it has everything and you can make a plugin for it easily...

still forum
#

Arma.Studio is a scratch built IDE, was the first to have Arma debugging support, had syntax highlight and some linting, ability to have a integrated UI Editor.
But... Why spend weeks/months building a new tool, when you could just combine 3 already existing tools together and use that instead.

#

Might aswell make a plugin for vscode to add the UI Editor, Linting and syntax highlight plugins already exist, debugging plugin too, and tons of other plugins that are useful for developing are available too
So why make a completely new IDE instead if you could use a existing one, and add the rest with plugins

flat elbow
#

i agree with you, it could leverage VSCode, i'd expect a "here is BI plugin with native debugging integration to A3, install VScode, install it and go cry play with SQF!"

queen cargo
#

Well... ๐Ÿคทโ€โ™‚๏ธ๐Ÿคทโ€โ™‚๏ธ Wanted to integrate a ui editor too
Hard to do with a Code Editor

burnt cobalt
#

does anybody know how GUI_GRID_X etc are defined? I can return safeZoneX but can't find out how to get the value of GUI_GRID_

#

asking because I am trying to dynamically align dialog controls to others via scripting

crisp cairn
#

Hello all, just a quick question. Is there anyway to do a

headgear _player isKindOf ['_x', configFile >> 'CfgWeapons'];

so if it is true then return it false? like isNotKindOf

still forum
#

what

#

that code is nonsense, can you explain what you mean without code?

crisp cairn
#

Sure, simply I am wanting to use a reverse version of isKindOf. So if it isnt what I want it to be then show etc. I am doing RHS Helmets and using isKindOf to prevent all these helmets appearing through the class they all inherit off

#

if that makes any sense

still forum
#

!(headgear _player isKindOf "") ?

quaint ivy
#

We're working on a custom scripted mission and he was testing his function, all worked fine

still forum
#

reading #rules may benefit you o7

quaint ivy
#

Okay sorry, anyway. My guy went to the toilet, came back and changed a couple of settings in his function

#

all of a sudden the console doesn't want to run the function

#

like calling the function doesn't do anything

still forum
#

compile error somewhere i'd say

quaint ivy
#

the function recompiles and he can see it in the function viewer

#

no errors popped in both compiling and calling it

still forum
#

try [] spawn {call myfunction} in debug console

#

without spawn it runs unscheduled, which hides undefined variable errors

quaint ivy
#

ah okay, didn't know that

#

didn't work

#

no error at all

still forum
#

maybe something exitWith'ing the function then ยฏ_(ใƒ„)_/ยฏ

quaint ivy
#

Idk, it's so weird

crisp cairn
#

Dedbooper, thanks mate all good now

sage flume
#

is this correct (I'm new)

#

{
_x unlinkItem "NVGoggles";
}
foreach allUnits;
};

#

I keep getting an error

#

missing {

still forum
#

correct

#

two closing }, one opening { == missing one {

sage flume
#

thought so,...?

#

hmmm]

#

Aside from the consistant error I still spawn with them on

#

well note aside but rather still can't get it to work

winter rose
#

I feel like I saw this code beforeโ€ฆ ๐Ÿ‘€

sage flume
#

yup, just not working and I wanted to double check

quaint ivy
#

for anyone wondering about my issue: He accidentally added an { somewhere in the code and it completely borked everything without any error

sage flume
#

@winter rose what big eyes you have, lol

#

so, when you copy paste say from a forum post, how is it that you could a hidden charactor

#

copying script that someone might post that is

still forum
#

because the forum is broken

lapis ivy
#

Hey. My function call in multiplayer doesnโ€™t work, which is called respawn unit.
It works.
[this,"opfor","opfor_squadleader"] call SerP_unitprocessor;
This does not work.

  params ["_unit", "_corpse"]; 
  [_unit, "opfor", "opfor_squadleader"] call SerP_unitprocessor; 
}];```
My "description.ext"
```class CfgFunctions
{
    class mis
    {
        class Main
        {
            file="mis_funcs";
            class preinit
            {
                preInit=1;
                postInit=0;
            };
        };
    };
};```
Changing the value of "postinit = 1" does not help.
As I understand it, the function is called only at the start of the mission and it cannot be called during the mission. What can I do about it?
ebon ridge
#

like now i am trying this addon for visual studio code and it stopped doing any breakpoint
@flat elbow I haven't seen this problem. The only problems I know are that breakpoint line can be wrong (Arma preprocessor does not generate correct line numbers), and sometimes step function will stop working, although breakpoints will still be hit. What exactly did you see?

still forum
#

@lapis ivy your CfgFunctions doesn't define a function called "SerP_unitprocessor"

lapis ivy
#

It works, but only when starting a mission. All units are given inventory. It also works in a network game, but on the server the function does not seem to be called.

#

I use the Serp platform

#

It's mod

#

My File folder missions
mission/mis_funcs/fn_preinit.sqf
Serp_unitprocessor = compileFinal preprocessFileLineNumbers "Equipment\unitprocessor.sqf";

mission/Equipment/unitprocessor.sqf

_faction = _this select 1;
_loadout = _this select 2;

_item_processor = {
    removeAllItems _this;
    removeAllWeapons _this;
    removeAllItemsWithMagazines _this;
    removeAllAssignedItems _this;
    removeUniform _this;
    removeBackpack _this;
    removeGoggles _this;
    removeHeadgear _this;
    removeVest _this;
};

if (!isServer) exitWith {};

_unit call _item_processor;

_svn = format ["SerP_equipment_codes_%1_%2",_faction, _loadout];
if (isNil _svn) then
{
    missionNamespace setVariable [_svn, compile preprocessFileLineNumbers format ["Equipment\%1\%2.sqf", _faction, _loadout]];
};

[_unit] call (missionNamespace getVariable [_svn, {}]);```
winter rose
#

you should use the MPRespawn EH from the server only (and ideally remove it from init field)

#

@lapis ivy

flat elbow
#

@ebon ridge simply, i opened VScode on initServer.sqf and put a break point at the first line

lapis ivy
#

Do I need to use remoteExec?

winter rose
#

no

#

although, you could.

flat elbow
#

i was in editor with the mods enabled (RHS+ACE3+CUP+NiArms+CBA, some compatibility mods like for CUP to ACE3 from NiArms to RHS etc. etc., Spatial Sound mod and JSRS for them and the required mods to use the debugger) and i started the mission both in multiplayer and in single player, yet no break point was hit

#

then i exited the editor, opened it again, loaded the mission, launched it in SP, it hit the breakpoint, i said "continue", arma freezed

#

tried to detach the debugger and reattach it, no luck

#

had to kill arma3 process

lapis ivy
#

player addMPEventHandler ["MPRespawn"...?

#
  params ["_unit", "_corpse"]; 
  [_unit, "opfor", "opfor_squadleader"] call SerP_unitprocessor; 
}];```
ebon ridge
#

then i exited the editor, opened it again, loaded the mission, launched it in SP, it hit the breakpoint, i said "continue", arma freezed
@flat elbow Oh okay, I have never had this happen, can't say what the problem is either. I'm using the workshop version of ADE, and intercept, and my released version of the debugger plugin. However pretty much all my breakpoint work is done in scheduled code, I don't work in unscheduled at all, so that is not tested much by me.

winter rose
#

@lapis ivy if you insist on using the init field:

if (isServer) then {
  this addEventHandler ["MPRespawn", { 
    params ["_unit", "_corpse"]; 
    [_unit, "opfor", "opfor_squadleader"] call SerP_unitprocessor; 
  }];
};
flat elbow
#

is it possible to tell the AI to not shoot at a specific target (eg the helicopter) but still shoot at everyone else (eg. the players when they get out of it)?

winter rose
#

yes, with setCaptive @flat elbow

flat elbow
#

"If unit is a vehicle, commander is marked."

#

that means they will still shoot at the helicopter?

lapis ivy
#

@winter rose Does not work ๐Ÿ˜ฆ

winter rose
#

@flat elbow nope

lapis ivy
#

@winter rose maby "addMPEventHandler"?

winter rose
#

woops, yes

lapis ivy
#

Ok, i'll try now

lapis ivy
#

@winter rose This does not work...

#
  this addMPEventHandler ["MPRespawn", {  
    params ["_unit", "_corpse"];  
    [_unit, "blufor", "blufor_squadleader"] call SerP_unitprocessor;    }]; 
};```
exotic flax
#

remove the if (isServer) part, since it needs to run on all machines, especially respawn

winter rose
#

nonono, it is added to all machines but only triggers where the unit is local.

#

so remoteExec it is @lapis ivy

exotic flax
#

unless it's 100% certain that this is always local to the server

winter rose
#

me and not reading the EH description

#

anyway, 'night!

exotic flax
#

gn

lapis ivy
#

How do I properly run this using remoteExec?

#
  this addMPEventHandler ["MPRespawn", {  
    params ["_unit", "_corpse"];  
    [_unit, "blufor", "blufor_squadleader"] remoteExec SerP_unitprocessor;    }]; 
};```
#

?

gilded rover
#

quick question , is the only way to make a timer with sleep?

exotic flax
#

or waitUntil

tough abyss
#

Wrong chat

gilded rover
#

@tough abyss i don't understand?

tough abyss
#

Basically I have NO idea how to script and have been looking for a developer for the last past 3 days just been having difficulty getting help

gilded rover
#

what you struggling with

tough abyss
#

Basic understanding and knowledge

#

Of SQF

gilded rover
#

sqf is basically just a place where you write what you want to happen in code and execVM the script via a trigger or what not

#

sqf is scripts

tough abyss
#

Like I have so many ideas and not being able to make it is super frustrating

gilded rover
#

okay hang on ill PM you

winter rose
#

@lapis ivy ```sqf
// no "if isServer"

this addEventHandler ["Respawn", {
params ["_unit", "_corpse"];
[[_unit, "blufor", "blufor_squadleader"]] remoteExec ["SerP_unitprocessor", -2];
}];

lapis ivy
#

@winter rose
This does not work.
How do I do cfgfunctions correctly?
I already have it:

{
    class mis
    {
        class Main
        {
            file="mis_funcs";
            class preinit
            {
                preInit=1;
                postInit=0;
            };
        };
    };
};```
#

fn_preinit.sqf
Serp_unitprocessor = compileFinal preprocessFileLineNumbers "Equipment\unitprocessor.sqf";

winter rose
#

it is unitprocessor that you should functionise

lapis ivy
#
{
    class myTag
    {
        class myCategory
        {
            class myFunction {file = "myFile.sqf";};
        };
    };
};```
For such an example?
winter rose
west grove
#

ugh,i am a bit dumb right now. i am using BIS_fnc_holdActionAdd for an action assigned to the player -- but it is only supposed to show if the player is in x distance to the object.

#

now the thing is, i am actually adding multiple actions for multiple objects ... but i only want to use one script of course

#

and now for some reason i can't figure out the correct condition to make them show up

#

if it would be only one object, of course i'd simply check for that one object and be done

#

is only _target and _this working in the conditions?

#

pretty sure i'm just doing something simple in a complicated way

winter rose
#

one cannot help easily without code ๐Ÿ˜„

west grove
#

well, not much to show

#

adding it: [a_cm01] spawn fn_cm_HoldAction;

#

argument 1 is _object

#

(so a_cm01)

#

then the hold action condition: (_target distance2D _object < 5)

#

so i'm prett sure _object simply doesn't work in the condition here

winter rose
#

you are not using BIS_fnc_holdActionAdd here ๐Ÿค”

west grove
#

i am

#

it's inside fn_cm_HoldAction

winter rose
#

then the issue may be inside fn_cm_HoldAction ยฏ_(ใƒ„)_/ยฏ

west grove
#

like i said, not much to show

winter rose
west grove
#

yup, mentioned it above

winter rose
#

so why not _this distance2D _target?
or you want that once the object is close to the other, the action appears?

west grove
#

i have multiple objects which once the player is close to them, will enable the hold action

#

the player does not have to look at them (it's an area), which is why i made the player _target

#

otherwise the player would have to look at the object

winter rose
#

_object is indeed not known to conditionShow
then _this distance2D _target

west grove
#

then it shows up always

#

because the player is the action-attached object and the caller

winter rose
#

wait

#

global variable it is then

west grove
#

i feard such

winter rose
#

can't pass arguments to condition, I think

#

you could do one global var with array of objects and check, so you only add one action

west grove
#

i think i will make a trigger area and set a value in a variable. then i will check if the player is in the trigger and read out the value

#

hm

#

how do you check an array in the condition?

winter rose
#
Object_Array findIf { player distance _x < 5 } != -1
#

@west grove werkz?

west grove
#

still working on it. found another issue just right now

#

yes, works. thanks for the help

winter rose
#

oops

#

Noice! ๐Ÿ‘Œ

west grove
#

ok now i have other issues. looks like this isn't really how i can do it

#

i need to know which object the player is close to and then change the action text + code that runs

#

the code shouldnt be much a problem. just have to check where the player is closest to. but the action text ..

#

maybe i should just add the action whenever the player is close, and remove it when he is away.

winter rose
#

that would be easier, else you would have one script that deals all the text messagesโ€ฆ it's better to split one object = one text message I think

that, or add the text as a parameter, or a variable set on the object maybe?

west grove
#

ok, trigger worked.

#

doesnt look as fancy, but who cares i guess

#

player walks into trigger -> add action, save action id. player leaves trigger -> remove action based on saved id

winter rose
#

the important thing is it works!

west grove
#

yea ๐Ÿ˜„

#

pretty sure i wrote worse code in my life :>

winter rose
#

the worst code in your life so far! ๐Ÿ˜„

west grove
#

indeed

fervent kettle
#

Im trying to do
if (not canMove _BTR60) then { {_BTR60 deleteVehicleCrew _x} forEach (_BTRcrew _BTR60); deleteVehicle _BTR60; };
but it gives me a missing ) error

winter rose
#

_BTRcrew _BTR60 ?

#

that's two variables

fervent kettle
#

thought i had to name both, crew and car

winter rose
#

crew is a command, not a variable

fervent kettle
#

ok, worked, but the veh wont get deleted

winter rose
#

with deleteVehicle it should

fervent kettle
#

but it somehow doesnt :/

winter rose
#

paste your code please?
```sqf
your code
```

fervent kettle
#

private _RHSBTR60 = [getMarkerPos "truckspawn", getMarkerPos "truckspawn" getDir getMarkerPos "movebtrA", "RHS_BTR60_MSV", east] call BIS_fnc_spawnVehicle; _RHSBTR60 params ["_BTR60", "_BTRcrew", "_BTRcrewGroup"]; _BTR60 setVehicleAmmo 0; _BTRcrewGroup addWaypoint [getMarkerPos "movebtrA", 0]; if (not canMove _BTR60) then { {_BTR60 deleteVehicleCrew _x} forEach (_BTR60); deleteVehicle _BTR60; };

winter rose
#

```sqf
your code
```

fervent kettle
#

with 3 ยด ?

winter rose
#

as I posted.

fervent kettle
#

ยดยดยด
private _RHSBTR60 = [getMarkerPos "truckspawn", getMarkerPos "truckspawn" getDir getMarkerPos "movebtrA", "RHS_BTR60_MSV", east] call BIS_fnc_spawnVehicle;
_RHSBTR60 params ["_BTR60", "_BTRcrew", "_BTRcrewGroup"];
_BTR60 setVehicleAmmo 0;
_BTRcrewGroup addWaypoint [getMarkerPos "movebtrA", 0];
if (not canMove _BTR60) then
{
{_BTR60 deleteVehicleCrew _x} forEach (_BTR60);
deleteVehicle _BTR60;
};
ยดยดยด

#

i dont get it man

winter rose
#

```

fervent kettle
#
private _RHSBTR60 = [getMarkerPos "truckspawn", getMarkerPos "truckspawn" getDir getMarkerPos "movebtrA", "RHS_BTR60_MSV", east] call BIS_fnc_spawnVehicle;
_RHSBTR60 params ["_BTR60", "_BTRcrew", "_BTRcrewGroup"];
_BTR60 setVehicleAmmo 0;
_BTRcrewGroup addWaypoint [getMarkerPos "movebtrA", 0];
if (not canMove _BTR60) then
{
    {_BTR60 deleteVehicleCrew _x} forEach (_BTR60);
    deleteVehicle _BTR60;
};
#

oooh

winter rose
#

and edit to add "sqf" after the first one (and line return)

#

see the pinned message in this channel, it helps having colours

fervent kettle
#

aaah right

winter rose
#

perfect ๐Ÿ‘Œ
now! you did forEach _BTR60 , which is wrong

#

and your code does what you tell it to do - the created vehicle can move, therefore it is not deleted

fervent kettle
#

but itยดs not canMove and once i destroy it, it still doenst disappera

winter rose
#

your code says:

  • create the vehicle
  • if the vehicle cannot move, delete it

your code should be

  • create the vehicle
  • once the vehicle cannot move, delete it
#

so you could do```sqf
_BTR60 spawn {
params ["_vehicle"];
waitUntil { sleep 1 ; not canMove _vehicle };
{ _vehicle deleteVehicleCrew _x } forEach crew _vehicle;
deleteVehicle _vehicle;
};

fervent kettle
#

aah thanks ๐Ÿ™‚

eager stump
#

I created a script to spawn cars along road. I look for road segments and then align the car along it. Works perfectly. The road segment object ID looks like "166135".The problem is that the road may go over a bridge and the segment object ID looks like "70078: bridge_01_f.p3d". Spawning a car on the bridge results in explosion or other things. Looks like the car is spawned under the bridge. Any ideas how is could check if the segment is regular road or some other object like bridge?

#

Using isNumber or parseNumber does not work.

#

Answering to myself : count (str(segment)) for roads is 8. So anything else I consider a non-road.

sage flume
#

How to prevent enemy from spawning (populating) outside of map area?

#

I'm porting a mission so if there might be a setting in his code somewhere, could I search there or is it a "perimeter" issue?

round bane
#

Is there anyone who could spot the error in this? Its killing me.

addAction ["Heal",{[objNull, player] call ACE_medical_fnc_treatmentAdvanced_fullHealLocal;}]

I'm trying to set up a scrollwheel menu option to fully ACE heal someone

still forum
#

what are you adding the action to?

calm bloom
#

Hello everyone! Do you guys recall any existing fast body looting script? I mean the system which will transfer all rifles, gear, ammunition from near dead bodies to a vehicle for example

#

Its quite hard to google this, everything i find leads to dayz-wasteland loot placing systems

winter rose
#

does it exist?

calm bloom
#

i dont know, i just imagine it will take time to write the new one from scratch so tried to find existing beforehand

wispy cave
#

So arma sometimes gives combinations of certain guns and attachments a different classname than the normal gun. Is there any way to disable this? (I'm not counting on it) Or is there any way to make a gear restriction script work with this? I'm currently using the following code:

private _weapons = weapons player;
_weapons = _weapons apply {toLower _x};
{
    if (_x in _weapons) then {
        private _found = false;
        private _weap = _x;
        {
            if ( toLower(_x) find _weap != -1) exitWith { _found = true; };
            if ( _x isKindOf _weap ) exitWith { _found = true; }
        } forEach KP_liberation_allowed_items;

        if (!_found) then {
            player removeWeapon _x;
            _removedItems pushBack _x;
        };
    };
} forEach _weapons;```
#

But that doesn't work as intended, some items that should be allowed are still getting through

winter rose
#

recall got me confused; better say "know of any" :)

exotic flax
#

@wispy cave to get the base weapon (so without attachments etc) you can use BIS_fnc_baseWeapon

calm bloom
#

thanks im not native speaker

@wispy cave i used next config parent for that case, just find out propper config parameters to check for your case (for example, no linked items)

#

huh looks like there is nice bis function already

wispy cave
#

thanks, I'll give that a shot

exotic flax
#

the direct parent might cause issues for modded stuff, eg. I have weapons which inherit a config with attachments, so it would break in that case.

#

do note that the baseWeapon does require properly configured weapons, so might not always return the correct version for messed up mods

#

but it's a good start for vanilla, CUP, RHS, etc.

wispy cave
#

for now I'm just using vanilla and RHS so I should be good, gonna test it in a bit

tough abyss
#

I am very new to scripting, how would I go about adding string to this?

hint str _unit "has been killed!";
young current
#

hint format ["%1 has been killed",_unit];

still forum
#

name _unit prolly better?

tough abyss
#

Yea they both work, thank you โค๏ธ

tough abyss
#

Hey I don't understand what

displayName = $STR_SP_Reb_E;
#

this means

#

$STR_SP_Reb_E;

winter rose
#

sorry, what?

#

a config entry that refers to $STRsomething is looking for a translation, usually located in a stringtable

tough abyss
#

Ill have a look

#

Yea but in my case I am trying to understand the Altis life framework xD

winter rose
#

โ€ฆoh

ornate marsh
#

Hi, been trying to get this script to work on Dedicated servers. The EventHandler doesn't work I think, but not too sure.

[doubletap, true] remoteExec ["hideObjectGlobal", 2]; 
doubletap addAction   
[  
    "Get Double-Tap",   
    {  
        params ["_target", "_caller", "_actionId", "_arguments"];  
 timeFiring = -1;  
 idPerson = _this select 1;  
 _sus = [] spawn {  
 doubletap say3D "open";  
 sleep 0.8;  
 doubletap say3D "swallow";  
 sleep 0.8;  
 doubletap say3D "break";  
 sleep 0.8;  
 doubletap say3D "belch";  
 idPerson addEventHandler ["FiredMan",{  
 params ["","_weapon","_muzzle"];  
 typeWeapon = _weapon call BIS_fnc_itemType;  
 switch (typeWeapon select 1) do {  
  case 'SniperRifle' : {timeFiring = 0.5};   
  case 'AssaultRifle' : {timeFiring = 0.5};  
  case 'Handgun' : {timeFiring = 0.5};  
  case 'Rifle' : {timeFiring = 0.5};  
  case 'SubmachineGun' : {timeFiring = 0.5};  
  case 'MachineGun' : {timeFiring = 0.5};  
  case 'Mortar' : {};  
  case 'GrenadeLauncher' : {timeFiring = 0.5};   
  case 'BombLauncher' : {};   
  case 'MissileLauncher' : {timeFiring = 0.5};   
  case 'RocketLauncher' : {timeFiring = 0.5};   
  case 'Cannon' : {};   
  case 'Throw' : {};   
 };  
 if (timeFiring isEqualTo -1) exitWith {};  
 (vehicle idPerson) setWeaponReloadingTime [(vehicle idPerson), _muzzle, timeFiring];  
 }];  
 };  
 if (timeFiring isEqualTo -1) exitWith {};  
    },  
    [],  
    1.5,   
    true,   
    true,   
    "",  
    "true",  
    5,  
    false,  
    "",  
    ""  
];
winter rose
#

@lapis ivy my very bad;
it's ```sqf
remoteExec ["SerP_unitprocessor", 2]; // NOT -2

tough abyss
#

I know what it is just just know where it is to edit it

winter rose
tough abyss
#

Its okay I found it,

#

But yea good idea

tough abyss
#

god this place looks scary, so where do i begin to learn this master's launguage?

winter rose
quaint ivy
#

Hey, does every object act as it's own namespace?

#

Sorry, by it's own i mean it has it's own local namespace

winter rose
#

more or less yes, except that terrain objects may be unloaded/reloaded, and lose set variables (iirc)

real tartan
#

is there a limit for playSound3D how many sounds can 1 object emit ?

quaint ivy
#

@winter rose thanks

winter rose
#

not a coded one, but the sound source limit in your audio options @real tartan

tawdry tree
#

I'm very much new to scripting in ARMA 3. I'm attempting to write a script which marks a task as complete once the player has opened the ACE arsenal menu.

this addEventHandler ["ace_arsenal_displayOpened", {

["Task2","SUCCEEDED"] call BIS_fnc_taskSetState;

}];

This is currently in the init line of my designated ace arsenal box. Any help is appreciated as well as a link to the resource which helped you learn Arma 3 scripting.

still forum
#

addEventHandler is for engine eventhandlers, the ace one is a scripted eventhandler

#

to be exact a cba eventhandler

#

this will add a global eventhandler though, not one specific on that object

tough abyss
#

Hey guys, so i've got this idea in mind, but i've no clue how to do it.
So basically I want to place down a trigger, and whenever a BLUFOR player activates it an AI says something in chat. How would I go about doing that?

young current
#

set the trigger activation type as you like and in the onActivation line use one of the chat commands

tough abyss
#

Thanks!

west grove
#

^anyone got this to work?

#

ok, got it

#

missing argument in the example

winter rose
#

there are no examples

round scroll
#

can I somehow get the displayName of a magazine if I have the magazine classname as string, e.g from getPylonMagazines? A naive getText (configFile >> "CfgMagzines" >> "FIR_ALQ99_P_1rnd_M" >> "displayName") failed

surreal peak
#

alternatively

#

wait sos, I misread your post. Its class name you want from

round scroll
#

yeah, looks like configClasses works:

#

systemChat str "(configName _x) isEqualTo 'FIR_ALQ99_P_1rnd_M'" configClasses (configFile >> "CfgMagazines")

gilded rover
#

for my custom main menu background scene , I have a camera created by bis_fnc_camera a little distance away from the TV (as there is other stuff in the scene)
now the problem comes with the UAV live feed displaying on the target giving a white screen on the TV while the camera created works , but if the camera that is created does not exist the UAV feed works
initIntro.sqf

/* create camera and stream name */
private _camera = "camera" camCreate [0,0,0];
_camera cameraEffect ["Internal", "Back", "uavrtt"];
_camera camPreparePos (getPosATL drone vectorAdd [0,0,-1]);

_camera camPrepareFOV 0.1;
_camera camPrepareTarget tgt;

/* switch cam to NVG */
"uavrtt" setPiPEffect [0];

_camera camCommitPrepared 0;

/* apply render */
tv1 setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(uavrtt,1)"];

[
    //--- Spec-Ops Briefing area
    {
        ["InitDummy",["Altis",[10906.5,12117.3,1.86901],320.376,0.75,[-19.7727,0],1.75474,0,1120.02,0,1,1,0,1]] call bis_fnc_camera;
        setviewdistance 600;
    }
] call BIS_fnc_initWorldScene;

can anyone see why?

round scroll
#

jeez, simple typo, CfgMagzines instead of CfgMagazines, this one works: getText (configFile >> "CfgMagazines" >> "FIR_ALQ99_P_1rnd_M" >> "displayName")

gilded rover
#

jeez, simple typo, CfgMagzines instead of CfgMagazines, this one works: getText (configFile >> "CfgMagazines" >> "FIR_ALQ99_P_1rnd_M" >> "displayName")
@round scroll hate it when thats why you pull your hair out

west grove
#

"there are no examples" - except for the one after "Examples:" i guess.

winter rose
#

@west grove?

west grove
#

description

#

sure it's added by a bot, but it still says "Example"

winter rose
#

oh this one indeed

it is actually extracted from the function's header itself
which means the dev's documentation itself is invalid ๐Ÿ˜„

west grove
#

yeah, i guess it got changed at some point, but the note wasnt updated

#

what's missing here is the marker size as first argument

winter rose
#

Iโ€ฆ don't see "marker size"?

west grove
#

_missionChosen = [markerSize "m_map", getMarkerPos "m_map", _listOfMissions] call BIS_fnc_missionSelector;

#

this works.

winter rose
#

you opened the function itself?

west grove
#

yup

winter rose
#

๐Ÿ‘Œ
indeed, this page is max outdated

#

nooo, don't look at me like that

west grove
#

:>

winter rose
#

รจ.รฉ

#

okay okaaay

#

I'm on it ^^

#

if you can confirm, but I believe it returns a Number? @west grove

west grove
#

yes

#

the mission number

winter rose
#

index in the list, I think

#

stupid me, it was written ๐Ÿคฆ anyway, better check than sorry

molten roost
#

Is there a way to execute a code snippet on all clients, within a script executed on server only? For titletexts/hints as an example

winter rose
#

@molten roost yes, remoteExec

west grove
#

much :p

winter rose
#

correct though? ๐Ÿ˜„

molten roost
#

ah. Thanks! Appreciate the hasty response!

west grove
#

looks good to me

winter rose
#

hasty response in the middle of the night! ๐Ÿฆ‡

#

Thanks for the feedback, Mr le "French Cat" mao

west grove
#

:>

#

*taps head i guess

winter rose
#

and now have I tested the code, and it works ๐Ÿ˜„

gilded rover
#

@winter rose which code?

winter rose
#

the code from the missionSelector page I just filled :3

showUAVFeed uses PiP yes?

gilded rover
#

the code from the missionSelector page I just filled :3

showUAVFeed uses PiP yes?
@winter rose well done

#

if i understand UAVFeed correct it streams what the UAV sees

winter rose
#

as for your issue, I believe that a camera filming a PiP screen is a no-go, BUT: you can place a player unit where you would want the camera to be, and disable its simulation, add vignette effect AND have the PiP on your screen ๐Ÿ˜‰

gilded rover
#

how to disable crosshairs then xD

winter rose
#

place a civilian

gilded rover
#

like hardcoded disabled

#

oo

#

right

winter rose
#

no weapons, no crosshair, no animation

gilded rover
#

why do we always make stuff stuipidly overcomplicated

winter rose
#

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

hallow mortar
#

I'm trying to make a script where you point at an object, and do an action to "take a photo" of it. The script identifies the object you're looking at, how far away it is, and whether you've photographed it already. Here's the script: https://pastebin.com/0nNNDcg4
The problem: the second check in the sequence - determining whether it's already been photographed, by seeing if a variable is 1 or 0 - behaves as if it's 1 (photographed) even if it's the first time I'm using the action. As you can see, I'm using a default value of 0 when I check the variable, and in SP testing nothing else can be setting that variable, so I'm confused about what's happening.

unborn ether
#

Is multiplayer server list is some kind of "magic" listboxes too? Wondering if you can fetch players count data before connecting to a server.

quartz pebble
#

Anyone knows if <delay> setFog [...] uses ingame time or real time for transitions? I.e. is <delay> affected by timeMultiplier?

winter rose
eager stump
#

Why does this not work:

fn_giveArr = {
    _arr = [1,2,3];
<broken example - removed>
winter rose
#

because you don't call the code.

#
_arr1 = { code };
โ†“
{ code } select 0
#

@eager stump ^

eager stump
#

Sry, my example above is incorrect - I'm trying to reproduce the issue. Your comment is valid.

#

Oh, and thanks for answering my (stupid) question.

winter rose
#

that is what for this channel is ^^

fervent kettle
#

I was wondering how i can add an addAction to every playable char

winter rose
#

so one player could activate another's action?

fervent kettle
#

Naa more like every player has the option to call a single script, in this case healing

winter rose
#

use addAction in initPlayerLocal.sqf then ๐Ÿ™‚

fervent kettle
#

ok will try that ^^

#

worked, thanks (:

high horizon
#

hi does anyone know how to make a dialog button attached to player's head??

winter rose
#

dialog as in talking?

high horizon
#

but i cannot click on it @winter rose

winter rose
#

so a UI dialog button, ok. well do you have a dialog to begin with?

#

@high horizon

high horizon
#

yep @winter rose

#

And i want that button attached to each part of the body

winter rose
#

you would then have to use a mix of selectionPosition, modelToWorld and worldToScreen! ๐Ÿ™‚

#

@high horizon ^

modest parcel
#

Does anyone have experience with extDB3?
I have quite a lot of web application experience, SQL etc, but not so much in Arma, and I'm trying to connect web application to mission file. If anyone could help, that would be amazing.

high horizon
#

Something like this would work? Its just a preview
_posini = player selectionPosition "head";
_wortoscr = worldToScreen getPos _posini;
_button ctrlSetPosition _wortoscr;

@winter rose

winter rose
#

no, because selectionPosition returns a position and you cannot getPos a position

#
private _headRelativePos = player selectionPosition "head";
private _headWorldPos = player modelToWorld _headRelativePos;
private _headScreenPos = worldToScreen _headWorldPos;
_button ctrlSetPosition _headScreenPos;
```@high horizon - use `private` and name your variables properly so you can read your code easily
high horizon
#

Thx @winter rose

lapis ivy
#

@winter rose

  this addMPEventHandler ["MPRespawn", {
      params ["_unit", "_corpse"];
      [_unit, "opfor", "opfor_squadleader"] call SerP_unitprocessor;
  }];
};```
Equipment/unitprocessor.sqf remove the line:
```if (!isServer) exitWith {};```
So on init server adds MP Respawn globally for that unit. When the unit respawns the event only gets called where the unit is local.
Your previous !isServer was stopping the equipment script, as the unit is not local to the server, but instead resides on the player( clients ) machine.

This was suggested to me on the BIS forum
winter rose
#

if you remove isServer check, better remove "MPEventHandler" and just use the "Respawn" EH

lapis ivy
#

I already tested on the server, this works. If there are problems, I will try to do it.

winter rose
#

there might/will, as every connecting client will add an additional EH

#

wait I might have read that wrong, dismiss that.
anyway, if issues, sure go #arma3_scripting

bright flume
#

What determines what is loaded first for a mod like what actually is loaded in terms of order (if multiple) or is there a specific thing you define as load point for all scripts?

still forum
#

requiredAddons in CfgPatches sets loadorder

#

on top of that order in -mod parameter

bright flume
#

yeah Im refering to inside just one like what is the start point for the mod itself example ace or alive... trying to work up a flowchart so I can track script execution logic

still forum
#

don't know what you mean by start point

#

first thing that runs is initFunctions which compiles all CfgFunctions and calls the preStart/preInit/postInit eventhandlers

bright flume
#

the very first script to be run when a mod gets loaded and what/where is that defined.

still forum
#

most mods hook into one of these eventhandlers

bright flume
#

ah okay

still forum
#

like if a mod uses preStart, its preStart will fire according to mod load order in requiredAddons/-mod

bright flume
#

yeah its using cba so xeh pre/post are here

gilded rover
#

hey guys
so me and @winter rose have been trying to see why i get a white screen on a tv thats suppose to display a UAV live feed.
Lou managed to succeed and get it right and gave me his mission file which i only opened in editor (like im suppose to) but sadly when i ran the mission i got a white screen again.

#
/* create camera and stream name */
private _camera = "camera" camCreate [0,0,0];
_camera cameraEffect ["Internal", "Back", "uavrtt"];
_camera camPreparePos (getPosATL drone vectorAdd [0,0,-1]);

_camera camPrepareFOV 0.1;
_camera camPrepareTarget tgt;

/* switch cam to NVG */
"uavrtt" setPiPEffect [0];

_camera camCommitPrepared 0;

/* rotation loop */
[_camera, tgt] spawn {

    params ["_camera", "_target"];
    private _degreesPerSecond = 5;  // ROTATION SPEED
    private _clockwise = true;      // COUNTER/CLOCKWISE ROTATION
    /*
        private _distFromCentre = 200;
        private _altitude = 300;
        private _startDir = 0;
    */
    private _distFromCentre = _camera distance2D _target;
    private _altitude = getPosATL _camera select 2;
    private _startDir = _target getDir _camera;
    while { sleep 1; true } do
    {
        private _angle = (time % 360) * _degreesPerSecond;
        if (!_clockwise) then { _angle = -_angle };

        private _pos = tgt getPos [_distFromCentre, _startDir + _angle];
        _pos set [2, _altitude];
        _camera camPreparePos _pos;
        _camera camCommitPrepared 1;
    };
};

/* apply render */
tv1 setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(uavrtt,1)"];


/* "camera" settings */
player switchCamera "internal";
player enableSimulation false;
player hideObject true;
showHUD [false, false, false, false, false, false, false, false, false, false];

/* Post-Process */
private _vignetteEffect = ppEffectCreate ["ColorCorrections", 1501];
_vignetteEffect ppEffectEnable true;
_vignetteEffect ppEffectAdjust
[
    1,
    0,
    0,
    [0, 0, 0, 0],
    [1, 1, 1, 1],
    [0.299, 0.587, 0.114, 0],
    [.75, .75, 0, 0, 0, 0, 3] // [a, b, angle, cx, cy, innerRCoef, interpCoef]
];
_vignetteEffect ppEffectCommit 0;
"Mediterranean" call BIS_fnc_setPPeffectTemplate;
#

can anyone see why this would not work on a different PC?

#

also this mission is run in the intro phase as its a scene

west grove
#

are you sure pip screens are enabled in the video settings?

gilded rover
#

yeah i set mine to ultra

west grove
#

then i dunno. if it works on a different computer but not on yours, i'd first assume it is your hardware

#

do other pip screens work? mirrors in cars, etc?

winter rose
#

we checked, and yes

#

I asked him to run without mods and check game files too (done 100% w/o mods @gilded rover ?)

gilded rover
#

im running check files again while im not at my PC
ran without mods and still same issue

#

@west grove the diver screen of the T140 works (when you in soldier view and see the internal compartment)

west grove
#

weird

winter rose
#

anyone willing to try the test mission? I can send a zip. (dm me)

wispy cave
#

How would I, when using ace3, reset someone's stamina?

west grove
#

lou, send me the package

winter rose
#

we come to the conclusion thatโ€ฆ this mission is HAUNTED

gilded rover
#

@winter rose how so?

winter rose
#

with ghosts ๐Ÿ‘ป

#

hence the white screen obviously

gilded rover
#

xDDDDDDDDD

#

did @west grove also get a white screen

west grove
#

yes, but only on the first start

#

after loading the mission again it always worked

#

so i am blindly assuming this has something to do with loading parts of the map ... dunno

gilded rover
#

okay i dont know wtf just happend , i move the civi closer and it works... xD

west grove
#

yup

#

but even if i move him back again / load a different map and do the same again... suddenly it always works, even from further away

gilded rover
#

yeah it works now , I really dont know how

#

@winter rose I owe you big time , thanks!

winter rose
#

game file check or *(ar)magic*
you're welcome, let's hope it doesn't fail in the main menu!

gilded rover
#

oh boy , mak9ing me stress now , ill post update

#

you had to ginx it didnt you xD

#

so once i restarted my arma everything breaks
so i load your mission and everything works again

#

and now the PiP live feed works in the main menu

lapis ivy
#

How can I correctly use the lock on using face identification for selected units?
_success = lockIdentity player;
I add this to all units in init?

hallow mortar
#

Try lockIdentity this in the unit's init

#

If you have a list of the units you can put into an array, you can use a single forEach rather than many inits

winter rose
#

Also, try not using init field

hallow mortar
#

Why not? It should work fine if you're only doing a few selected units. Unless it breaks under JIP with this command, but I think remoteExec would solve that

winter rose
#

It is somehow a "bad practice", and is used wrong 90% of the time
Init fields get rerun on every player's connection, so if you have a setDamage 0.5 to begin wounded, heal yourself then someone else connects, you get back to 0.5 damage

winter rose
#

@hallow mortar ^

hallow mortar
#

should be fine for this command though, unless you want to unlock the identity later

#

if isServer can take care of a lot of init problems, which is good enough if you're only doing a few simple things and don't want to leave the editor

winter rose
#

which is why I said "try not"
if you know what you are doing, it is not that bad

for me it is a remnant of the past, and running code that does nothing because of bad locality (or does the same thing over and over again) should ideally be avoided

modest parcel
#
// Get the player UID 
_PlayerUID = "76561198054271928"; 
 
//Prepare the Query 
_query = format ["0:FETCHDATA:SELECT nation FROM roster_view WHERE armauid = %1", _PlayerUID]; 
 
//Query the Database 
_nation = "extDB3" callExtension _query; 
 
diag_log _nation select 2;

Sorry, addendum to my post earlier. I've got the database linked to the mission file now using extDB3. This above run in the debug console as 'Server Exec' works fine now and returns the nation of the player based on an external MYSQL database. Seems pointless, but it's just to prove the connection works.

My question as someone who's not really touched Arma scripting, is can anyone point me in the right direction on how I would for example add this functionality to a AddAction where a player can trigger it, but the script will execute the Query via Server Exec, and then perform some local action on the player, such as set a loadout.

My problem is more around the locality, I think. Sorry if this makes no sense!

#

Is it is simple as wrapping the callExtension in some Remote Exec?

still forum
#

Is it is simple as wrapping the callExtension in some Remote Exec?
you could do that

#

I didn't read the rest of the text and I won't so might not be the full answer

silver mauve
#

How do i make the player join an AI squad when he enters a heli?

fervent kettle
#

Let`s say i have player A & B, both have an action menu attached but i dont want that they see the others, can i just say

player addAction ["<t color='#0ac6d2'>Heilen</t>", "heal.sqf", "player distance player <0.5"]; 

cause the last part looks horribly wrong

copper raven
#

i don't know what heal.sqf does, but if u add the action locally for each player, you don't need any distance checks

#

like, if u add the action for player a on player a's machine, but dont add action for player a on player b's machine, player b won't see the action on player a anyway

fervent kettle
#

how exactly do i do that? I just bumped that line into initPlayerlocal

copper raven
#

what? you're asking for something else then

fervent kettle
#

Nono, when i test it and use an AI i can see the option from a far distance

copper raven
fervent kettle
#

can i send you a screenshot privatly to visualize it?

copper raven
#

i mean you've described the "problem" you have in two different ways so far, and as far as i can see none of them are referring to what it actually is, i've answered them both, and gave you solution for the second one

fervent kettle
#

maybe it helps you to understand a bit better what i`m trying to say

copper raven
#

so, add the action only to that player then

#

rather than every player(what you're doing now)

fervent kettle
#

naa, it just appears on playable chars, in this scenario i`ve taken over an AI and the "Heilen" option only appears only when i look at the playabler character

#

when i look away it dissapears

silver mauve
#
v1 engineOn true;
execVM "flyScript.sqf";
v2 engineOn true;
execVM "flyScript2.sqf";

How do i make the init.sqf execute both because it only executes the first one?

west grove
#

i am pushing a string to my array: MyArray = [localize "STR_MYSTRING"]; and it will save as ["here is my string"] instead of [localize "STR_MYSTRING"] ....anyone can tell me how to get around this? :>

copper raven
#

what you're trying to do doesn't make sense

winter rose
#

1/ store as "STR_MYSTRING" and then use localize on it
2/ store as { localize "STR_MYSTRING" } then call this

#

@west grove ^

west grove
#

i am doing 1 right now

#

problem is that i cant just do a quick debug "myest" because it will always look for a string to localize

copper raven
#

no you aren't doing that, you're storing the return value of localize

west grove
#

i know

#

that's why i asked how i can get around that ๐Ÿ˜„

copper raven
#

i am doing 1 right now

#

?

west grove
#

nevermind, i'll deal with it somehow

winter rose
#

it is for a remote execution I assume?

#

I just realised that because there is no hand-to-hand combat in Arma, all we do is remote execution ๐Ÿ˜„ ๐Ÿ˜„ ๐Ÿ˜„

west grove
#

just some testing around, nothing really important

#

i ~~probably ~~just have to think different

winter rose
#

if you need a second brain, beep me up (we may find someone)

round scroll
#

now testing the jamming stuff on dedicated server and of course it doesn't work at all. For SP I could tie into a per frame and second function setup by Yax for the F/A-18. But on MP with the WSO being in a remote plane (that is on the server), of course nothing works.

#

basically I need to run an eachFrame eventhandler for the WSO, sitting in a turret of the F/A-18

winter rose
#

F/A-18 is an airplane iirc, but what's a WSO?

round scroll
#

weapons system officer, the guy in the rear seat

#

the whole jamming exercise is meant to give those unlucky 2nd pilots something to do in MP ๐Ÿ™‚

fervent kettle
#

ok another Question, i want to make an AI play an idle animation but whenever a player activates a trigger it plays a short animation and then goes back to its idle state
sorry im fairly new to writing scripts so i dont know where to start

winter rose
#

see playMove and its list of moves on the wiki!

round scroll
#

gonna try this hack: ```sqf
if (((assignedVehicleRole _unit) # 0) isEqualTo 'Turret' and _unit in _vehicle and _unit != driver _vehicle) exitWith {
// gunner treatment
js_jc_fa18_lastPshRunGunner = 0;
["js_jc_fa18_perFrameHandler","onEachFrame", {
params ["_vehicle"];
if(js_jc_fa18_lastPshRunGunner == time) exitWith {};
[_vehicle] call js_jc_fa18_ew_fnc_perFrame;

//run per second based _systems
if(time > js_jc_fa18_lastPshRunGunner + 1) then {
  js_jc_fa18_lastPshRunGunner = time;
  [_vehicle] call js_jc_fa18_ew_fnc_perSecond;

},[_vehicle]] call BIS_fnc_addStackedEventHandler;

};

surreal peak
#

gate animate ["bargate",1]

#

there might be an event handler for setting it close/open

#

this should do

#
this addEventHandler ["AnimChanged", {
    params ["_unit", "_anim"];
        _unit animate ["bargate",1]
}];

@echo yew

#

if it opens on the script, then change animate number to 0

#

np, it's a bit hacky and bodgy as it doesnt block you from doing it. But hoipefully it works

tough abyss
#

Hey how would I add more spawn points to one garage?

life_garage_sp = "air_g_1";

oblique arrow
#

Hm I'm trying to script a tank firing its main gun at an object using

tank doWatch (getPos target); 
tank fire ((weapons tank) select 0);

And it seems like the tank is firing, but it doesnt actually play the shooting sound/ creates the muzzle flash

high horizon
#

Does anyone know why my mission doesnt insert vehicles on db on altis?

robust hollow
#

not without more information

high horizon
#

There is no error on showscriptserror

#

Just i buy a car and when i save it on the garaje it doesnt appear anymore

#

there is no clue of the car

robust hollow
#

what about sql logs?

high horizon
#

[01:20:38:458405 +02:00] [Thread 7596] extDB3: SQL: Error MariaDBQueryException: Field 'colorido' doesn't have a default value
[01:20:38:458530 +02:00] [Thread 7596] extDB3: SQL: Error MariaDBQueryException: Input: INSERT INTO vehicles (side, classname, type, pid, alive, active, inventory, color, plate, gear, damage) VALUES ('civ', 'pop_evox_bleufonce', 'Car', '76561198241514030', '1','1','"[[],0]"', '0', '584771','"[]"','"[]"')

#

maybe field "colorido" make this crash? @robust hollow

robust hollow
#

it is possible. fix it and try again.

high horizon
#

What should i do? make a default value on sql ?

exotic flax
#

the error explains exactly what is wrong, and how to fix it

robust hollow
#

set a default value to the colorido field in your database

high horizon
#

ok thx!!!

subtle timber
bright flume
#

@subtle timber might be a better question for #arma3_model or #arma3_animation if you tear apart the Liberty you can see how their sliding multipart doors work.

velvet merlin
#

what was the issue again with CBA options not working with skipIntro/world=none used?

bright flume
#

ummm

#

@velvet merlin lack of ablity to change settings unless 'in-game' I believe

robust hollow
#

i think i've have had issues with ui events not firing without a world loaded. possibly related ๐Ÿคทโ€โ™‚๏ธ

bright flume
#

I seen that notated somewhere but I cant find it now I changed mine back and now I can configure addons on my main streen.

velvet merlin
#

yep

#

one has to use uiNamespace in main menu

#

but curious what specific limitations they ran into

bright flume
#

dunno just went looking for it cant find it now ugh... too late ๐Ÿ™‚ ยฏ_(ใƒ„)_/ยฏ

velvet merlin
#

the issue could be the cutscene intro VM blocks the regular missionNamespace or sth along these lines

bright flume
#

I bet D knows. maybe just some types of scripts arent run without intro's allowed. /shrug

#

eyes discord warily...

jaunty ravine
#

I'm having some issues with assigning a custom CfgRank to a unit. I've tried both unit setRank "Cpt"; and unit setUnitRank "Cpt"; but still get the same error: Unknown enum value: "Cpt". Anyone got any ideas about why this is and a fix for this?

#

I've gotten the ranks to show on the ORBAT Viewer so I would imagine it is possible somehow.

verbal saddle
#

@jaunty ravine
You'll probably find that the possible values for that command are hard coded in engine and are not reliant on classes inside CfgRanks

jaunty ravine
#

Ah, well, that sucks

vernal venture
#

Any guesses why this wouldn't work in an object's init?
I have a row of sandbags called "cornerbags" that I'm trying to anchor this box to.
this attachTo [cornerbags, [1.024, 0.197โ€ฌ, 0]];

winter rose
#

what does it do?

vernal venture
#

Throws up an error saying missing ]

winter rose
#

then something else is wrong ^^

vernal venture
#

Which is why I'm asking here, 'cause as far as I can tell, that looks right.

#

Oddly, this works.
this attachTo [cornerbags];

winter rose
#

if you -just- remove this attachTo [cornerbags, [1.024, 0.197โ€ฌ, 0]];, is there an error?

vernal venture
#

No, no error without it.

winter rose
#

is this the only stuff in the init field?

try 0 = this attachTo [cornerbags, [1.024, 0.197โ€ฌ, 0]]; ?

#

no error on my side.

#

ah, I got your error
an invisible character after 0.197, as 0.197#, error message said

#

@vernal venture ^

vernal venture
#

Looks like adding 0 = works, too. Thanks.

winter rose
#

no need for the 0 = - your issue was this char. yw

bronze lotus
#

Via a script, is it possible to set recoil values of guns?

oblique arrow
#

I think that has to be done via a config edit? Not quite sure though

winter rose
bronze lotus
#

Its need to be done there too @oblique arrow, but its not working for a few guns in RHS so yeah.

#

Although I'm looking more detailed changes of recoil instead of just a coefficent for all of its values @winter rose, I still appreciate it because I could use that as a patch for the bugged guns.

winter rose
#

all the rest is config edit yes

bronze lotus
#

Yeah exactly but that's okay.

compact maple
winter rose
#

use getAllHitPointsDamage @compact maple

compact maple
#

I'd like to print the real name of these part, like getting their names with cfg

winter rose
#

what makes you think such "translations" exist?

compact maple
#

so it doesn't exist?

winter rose
#

I don't think so; these are internal model names/selection names, if you want translations you would need to make them yourself

compact maple
#

Alright, I will, thanks ๐Ÿ™‚

quartz pebble
#

any way to get a handle ID of a running spawn thread?

winter rose
#

private _spawnHandle = [] spawn {};

quartz pebble
#

Know that. But I have already spawned it๐Ÿ˜…

winter rose
#

no can do

jagged mica
#

Hey folks, quick question

#

I've got a MP mission I need to spawn a destroyer and I want to assign it to a public variable in the mission

#

so that it's available to all clients if it makes sense

#

I was building the mission initially in the editor and it was all gucci when I put it in init.sqf, but Im wondering how to do it best for MP context

winter rose
#

not the aircraft carrier, a destroyer?

TAG_MyPublicVar = createVehicle [โ€ฆ]
publicVariable "TAG_MyPublicVar";
jagged mica
#

yep, a destroyer

#

so this createVehicle etc can be executed on dedi yeah?

winter rose
#

yes, of course

jagged mica
#

sweet, thanks

jagged mica
#

awesome, thanks

#

I mean, Ive got the syntax already because Ive been executing it on the local side anyways

#

just wanted to make sure it's gonna be MP compliant

oblique arrow
winter rose
#

I am not smartz, my stupid is fast!

oblique arrow
#

heh Fair

winter rose
#

well ```sqf
tank doWatch (getPos target); // doesn't wait for the cannon to be aligned
tank fire ((weapons tank) select 0);

jagged mica
#

i was literally doing a similar thing for my mission yesterday

winter rose
#

@oblique arrow try using aimedAtTarget > 0.9 ?

#

in a waitUntil, might do the trick

it's always tricky to make a unit fire at anything non-target

oblique arrow
#

I mean it seems like the tank is theoretically firing (atleast the fancy CSAT dlc tank did the autoloader reload animation) but it just doesnt play the effects connected with firing

winter rose
#

I used a default NATO "Merkava", it shot immediately

oblique arrow
#

Hm

#

I'll try it with that

winter rose
#

use fireAtTarget to trigger the boom immediately

#

perhaps it will do everything needed in the CSAT DLC tank
(also, please note that it won't fire if it is still loading the ammo)

oblique arrow
#

I tried it with the merkava and it fired fine

#

weird

winter rose
#
[] spawn {
    tank doWatch target;
    waitUntil { tank aimedAtTarget [target, ((weapons tank) select 0)] > 0.9 };
    sleep 1;
    tank fire ((weapons tank) select 0);
};
```\*boom\*
oblique arrow
#

This is odd

finite sail
#

This is odd
@oblique arrow Welcome to Arma ๐Ÿ™‚

oblique arrow
#

So I tried it with the Merkava in the mission and it works fine, tried it with the CSAT standard tank and it doesnt want to work, tried it with a modded CSAT tank and it doesnt want to work either

#

heh yeah thats true

finite sail
#

it might be that ((weapons tank) select 0) doesn't return the main gun turret in the csat tank

oblique arrow
#

I added a hint that gives out the return value of that and its
cannon_125mm so that should be the cannon @finite sail

#

thats the standard CSAT tank

finite sail
#

you're right, it is odd

winter rose
#

shouldn't it be a muzzle and not a weapon?

oblique arrow
#

I tried it with the Merkava and it returns cannon_120mm

#

okay tried it with the AAF tank and it doesnt seem to shoot either

#

hint return is cannon_120mm_long

#

Nvm I rearranged the waypoints a bit and it did fire

winter rose
#

muzzle

oblique arrow
#

nuzzle neonuwu

winter rose
#

O___o

oblique arrow
#

you say that like I know what that means

round scroll
#

back to my multiplayer scripting problems. I have the code at https://pastebin.ubuntu.com/p/ph2MgwQ3S3/ showing me in the log that it is running, but nothing is displayed on screen: ```
15:11:01 "perFrameGunner: after display detected"
15:11:01 "perFrameGunner: after jamming check"
15:11:01 "perFrameGunner: doing stuff"
15:11:01 "perFrameGunner: setting freq 30000"
15:11:01 "perFrameGunner: setting freq 40000"
15:11:01 "perFrameGunner: setting freq 50000"
15:11:01 "perFrameGunner: setting vehicle O Alpha 1-2:3 REMOTE"
15:11:01 "perFrameGunner: setting vehicle B Alpha 1-1:1 REMOTE"
15:11:01 "perFrameGunner: setting vehicle O Alpha 1-1:3 REMOTE"
15:11:01 "perFrameGunner: setting vehicle O Alpha 1-3:3 REMOTE"
15:11:01 "perFrameGunner: after display detected"
15:11:01 "perFrameGunner: after jamming check"
15:11:01 "perFrameGunner: doing stuff"
15:11:01 "perFrameGunner: setting freq 30000"
15:11:01 "perFrameGunner: setting freq 40000"
15:11:01 "perFrameGunner: setting freq 50000"
15:11:01 "perFrameGunner: setting vehicle O Alpha 1-2:3 REMOTE"
15:11:01 "perFrameGunner: setting vehicle B Alpha 1-1:1 REMOTE"
15:11:01 "perFrameGunner: setting vehicle O Alpha 1-1:3 REMOTE"
15:11:01 "perFrameGunner: setting vehicle O Alpha 1-3:3 REMOTE"

#

that's from the client log

#

ok, the control is not ok: private _ctrl = _dsp displayCtrl _x; -> diag_log format ["perFrameGunner: ctrl is %1", _ctrl]; -> "perFrameGunner: ctrl is No control"

#

maybe the whole idea to control the display/dialog from a per frame eventhandler is not sound?

winter rose
#

"Draw3D" may be more suitable perhaps?

round scroll
#

ok. Question left is why it works in SP and not in MP with the display stuff

winter rose
#

that' s a big block of code, I'm afraid of it ๐Ÿ˜…

#

IDK, maybe your js_jc var are only defined server-side?
put systemChat to see if it fails at one point

round scroll
#

he he, yeah, took a bit to write it. I've now put some debug msg in, that yield: ```
15:20:38 "perFrameGunner: after display detected"
15:20:38 "perFrameGunner: after jamming check"
15:20:38 "perFrameGunner: doing stuff"
15:20:38 "perFrameGunner: setting freq 40000"
15:20:38 "perFrameGunner: ctrl is No control"

#

so it can be isolated to these lines: sqf if (dialog and {alive _jammer}) then { diag_log "perFrameGunner: doing stuff"; { diag_log format ["perFrameGunner: setting freq %1", _x]; private _ctrl = _dsp displayCtrl _x; diag_log format ["perFrameGunner: ctrl is %1", _ctrl]; _ctrl ctrlSetTextColor [0, 1, 0, 1]; _ctrl ctrlCommit 0; } forEach (_jammer getVariable ["js_jc_fa18_ew_jamFrequencies", []]);

#

not sure why this fails in MP: private _ctrl = _dsp displayCtrl _x;

robust hollow
#

is it possible there is already another display using idd 70?

round scroll
#

oh, that's a possibility, while I check isNull _dsp, let me see the log

robust hollow
#

i can find display 70 in a blank MP editor mission

round scroll
#

yes, you are right!

#

the no display check fails only before mission start

#

thanks, I give that a try with a different idd

#

works, thanks a bunch @robust hollow !

robust hollow
#

๐Ÿ‘

ebon ridge
#

We have a custom loading screen, I have added progress bar and text box with the IDCs corresponding to the docs, the progress bar works but the text doesn't change from default, any ideas?

round scroll
#

ctrlCommit is there?

ebon ridge
#

however hidden in the comments it says confusingly In Arma 3 default loading screen has no control do display text. The description of the command now contains information what is needed to create custom loading screen resource.

acoustic abyss
#

Hey everyone,

So I have an idea for a mission script. I want to create a kind of timer that reads out the remaining time in digital format, instead of displaying it.

For example: timer starts at 40 minutes, and is ticking down. Let's say you push its button when there's 37:46 left on the clock. A voice will then read out the digits of the remaining time at the moment you pressed the button ( "three...seven...four...six" ).

In case that sounds weird, here's an example of a clock that has a voice reading out the digits of the current time, over and over:

https://www.youtube.com/watch?v=S7KNhBAAY10

Note: has to work in multiplayer. Doesn't need to be incredibly accurate.

Mechanically it doesn't seem very difficult. I could make a countdown timer that updates a global (local) variable. Somehow translate the seconds counter to digital format with simple math. Then make pressing the button couple ten possible different sound samples with four free spaces.

I guess my question is whether somebody has already done something like this before, so I am not making busywork for nothing. Anyone?

winter rose
#

aaand I only read half of your question again.

as for the voice, it's no big deal - grab a voice generator,
and you can either spawn the script on every client, or remoteExec playSound

#

you may have to do it yourself yep.

acoustic abyss
#

I could probably have written that more efficiently ๐Ÿ˜…, true.

winter rose
#

nah it's me, lack of attention after work :p

acoustic abyss
#

Keeping it local is easiest since it doesn't have to be accurate to the second. By the way, I read that there are several "time" commands to specify client vs server time (of course). How much do they normally differ after an hour or so?

winter rose
#

time gets synchronised regularly, afaik

acoustic abyss
#

Of course! JIP.

#

Well in this mission there really aren't any JIPs. But I will have to change that. Public variables make my scalp crawl

#

Thanks for the tips.

winter rose
#

just remoteExec should be enough, maybe

acoustic abyss
#

Cheers. And take a break from the phone bud ๐Ÿง˜โ€โ™€๏ธ

winter rose
#

that's why I'm on PC ๐Ÿ˜„

#

but yeah, taking a break.

remote basin
#

Hey guys,
Got a bit of a dumb question (probably). But I've been scratching my head for a while.
Essentially what I am doing is creating a loadout selector using addAction and switch statements. This is for a dedicated server. I have a script that creates 10 actions, one for each type of role. Upon clicking these actions I receive the kit I chose, and it works perfectly (and on the dedicated server too!!).

The problem I have encountered is with the initiation of the script itself. Ideally I would like to be able to put the script (something like nul = execVM "SupplyBox.sqf") in the init field of the object the players will interact with to grab kits from. This is simply because I have used the vertical blue locker as the object the players will interact with, and have lined a wall with lots of them. I don't want to have to reference a unique "variable name" for each individual locker.

I have messed around with _locker = _this select 0; and then reference the private variable _locker in the script with _locker addAction [etc]; but to no avail. The script doesn't recognise _this and I get errors. Classic noob maneuvre...

I'm asking you brilliant people what you think the best solution is to create addActions to every container, and to do so from the objects init field in the editor? Is this the most practical way? My init.sqf is already cluttered like crazy, I want to try and minimise the impact on the server at launch.
Cheers blokes!

spark rose
#

alright gents, I've got a squad of players - player_1, player_2, etc. I have "enable damage" unchecked in 3den. Then I have a trigger which makes them vulnerable again. Works fine when testing in the editor, IE "play in multiplayer". When it doesn't work is when i pack the .pbo and run it on a dedicated server. So, I've tried "player_1 enableDamage false" in the serverInit.sqf. Still no dice. What am I doing wrong?

#

to be clear, the players aren't invulnerable on the dedicated server, but when testing through 3den they are

spark rose
#

it appears that the variable names (player_1, player_2, etc) are not being carried over to the players in a dedicated environment

ebon ridge
#

When you play in multiplayer in the editor its really self hosted mp so all globals are shared between the server and client without needing to call publicVariable. But you can also launch another client from the arma 3 launcher (select another profile) and it will act more like a pure client, so you can find MP issues there without needing to go to dedicated.

winter rose
#

@spark rose enableDamage doesn't exist, though. (it's allowDamage)

spark rose
#

yes i'm sorry Lou i have allowDamage not enableDamage

winter rose
#

Okido (can't help but remove "stupid" errors out of the equation)
if you look at https://community.bistudio.com/wiki/allowDamage , the "aL" & "eG" mean that the argument must be Local, while the effect is Global.
usesqf [player_1, true] remoteExec ["allowDamage", player_1]; or```sqf
{ [_x, true] remoteExec ["allowDamage", _x]; } forEach [player_1, player_2, player_3, player_4];

spark rose
#

thanks Lou, i will give that a try

ebon ridge
#

Is there any way to fully suspend server equivalent to startLoadingScreen for SP?

winter rose
#

@remote basin
in the init field:

[this] execVM "script.sqf";
```in script.sqf:```sqf
params ["_locker"];
#

@ebon ridge what do you mean?

remote basin
#

Thanks @winter rose I got it in the end, it was the underscore that was killing me. Cheers!

silk sparrow
#

Hi there,
I'm looking for a mod/script which allows players to load vehicles on others vehicles (eg. Load a quand onto an HEMTT)
Does anyone know a such script?
Thank you for you time and reading!

Regards

hallow mortar
#

the recently-added HEMTT Cargo and HEMTT Flatbed can load vehicles natively

dry rain
#

Don't suppose anyone with some experience using triggerAmmo could give me a bit of insight:
I'm looking at using this to clean up some of my functions for various fusing methods.
It works as expected with infantry weapons however, when trying the same method on a vehicle weapon, a tank/artillery shell for example (both shotShell) it appears to not work.

ebon ridge
#

I mean something like freezing time basically.

#

disable all simulation, interactions, freeze time etc.

#

I'm writing something to do it myself now, just want to see if there is some functions to help or canonical solution

winter rose
#

nothing native except enableSimulationGlobal forEach

ebon ridge
#

kk thanks

winter rose
#

@spark rose workz?

silk sparrow
#

Yup @hallow mortar but I'm searching something more general which can work with modded vehs for instance

winter rose
#

it can even with mod vehicles, depending on their mass/dimensions
now if you are looking for something like loading a tank on a quad, there is still attachTo ๐Ÿ˜„

spark rose
#

@winter rose haven't tested yet - I'm the de-facto babysitter at the moment!

hallow mortar
#

Actual vehicle-in-vehicle loading has to be built into the carrier vehicle to begin with, afaik. Some mod vehicles do support it, depending on whether the creator has set it up. (Any vehicle can be loaded into a configured carrier, mod or not, if it's an appropriate size and weight)

#

Any global solution to convert non-configured vehicles is going to be an attachTo bodge job and may need to be set up for each vehicle individually.

polar anchor
#

hi, anyone can link me a good guide to learn dialogs?

winter rose
#

ask the peeps in #arma3_gui @polar anchor ๐Ÿ˜‰

polar anchor
#

ty @winter rose

spark rose
#

@winter rose It works for me. The poor AI guys still perish though...

winter rose
#

do you execute this from the server?

spark rose
#

yes, it's tied to a trigger that is evaluated on the server.

faint oasis
#

hi, how to disable vanilla action ? example : Inventory action

winter rose
#

@spark rose should work ๐Ÿค”
@faint oasis perhaps mods

spark rose
#

hmmmm

#

so the initServer.sqf i have this ''{ [_x, false] remoteExec ["allowDamage", _x]; } forEach [player_1, player_2, player_3, player_4, player_5, player_6, player_7, player_8];''

#

{ [_x, false] remoteExec ["allowDamage", _x]; } forEach [player_1, player_2, player_3, player_4, player_5, player_6, player_7, player_8];

#

is remoteExec not disallowing damage for the server ai guys when players aren't there?

winter rose
#

it should send the command to the server, even if it is on itself

#

be wary that if a unit changes locality (a player joining or leaving, an AI unit joining a player's group) the command has to be repeated

spark rose
#

it seems to be a result of me being the groupleader and bailing out (even though aircraft is destroyed) they ride it in to their deaths

#

so they are invulnerable, that's passed correctly. they're just not getting out of the a/c

winter rose
#

ah, okay

hallow mortar
#

AI making poor decisions in Arma? ๐Ÿค”

#

try a GetOut eventhandler that automatically ejects any AI in your vehicle when you eject?

faint oasis
#

@winter rose what is perhaps mods ?

winter rose
#

to disable vanilla action
you can disable inventory thanks to event handler "InventoryOpened" (or intercepting the inventory key), but if you want to disable actions like healing, opening doors etc mods are required to do so

faint oasis
#

oh ok thx

polar anchor
#

hi, im trying to call a function but i get this error on mission startup: https://imgur.com/a/lD0djYi can anyone help me?
description.ext

    #include "Functions.hpp"
};```
**Functions.hpp**
```class crimiloFunctions {
    tag = "crimilo";
    class Functions {
        file = "functions";
        class playerJoin {};
    };
};```
**initPlayerServer.sqf**
```_player = _this select 0;

[_player] call crimilo_fnc_playerJoin;```
**fn_playerJoin.sqf** (located in functions folder, as specified in `file = "functions";`)
```private ["_player"];

_player = param[0];

hint format ["%1 joined", name _player];```
still forum
#

file = "functions"; sure thats correct? isn't that default?

#

private ["_player"];

_player = param[0];
no.
params ["_player"] yes

#

_player = _this select 0; no. Same as above, params.

polar anchor
#

what's the difference? from _this select index and params?

spark rose
#

@hallow mortar haha spot on, when don't they make poor decisions?

polar anchor
#

@still forum i changed them to:
fn_playerJoin.sqf


_player = param[0];

hint format ["%1 joined", name _player];```
**initPlayerServer.sqf**
```params ["_playerUnit"];

[_playerUnit] call crimilo_fnc_playerJoin;```
but still get the error
surreal peak
#

you dont need _player = param[0]; you already made _playerUnit

still forum
#

file = "functions"; I think thats default so I think you can remove that?

polar anchor
#

removed _player = param[0] and file = "functions";

#

but they're not related to the error. i can't say that error tbh

#

everything looks fine

still forum
#

checked RPT for file not found errors?

polar anchor
#

no idea what u talking about ๐Ÿ˜…

polar anchor
#

@still forum why private ["varName"] NO and params ["varname"] YES?

surreal peak
#

@polar anchor RPT is the debug file, found here: C:\Users\USERNAME\AppData\Local\Arma 3

polar anchor
#

oh i see, thx @surreal peak ๐Ÿ™‚

still forum
#

because private array and private string are bad performance and almost always bad

#

you should use private keyword

#

but params already has it integrated

#

so why do 5 steps, if you could just use params and do everything in one step

winter rose
#

also, underscore

jaunty shadow
#

Can you call an Admin Command in a Mission Init.sqf, and if so how would I go about doing that?
Looking to start a custom Fortify Preset for ACE, and it requires an Admin Command to make the preset available.

still forum
#

"admin command" ?

jaunty shadow
#

Per ACE 3:
If the Fortify module is present in the mission, server admins can use chat commands to set-up or change the different parameters. Useful to give players additional resources based on progress on the mission for example.

surreal peak
#

only server admins can use commands

#

should work regardless

jaunty shadow
#

Yes. I know Admins can use commands. It is called in Mission via Chat command with:
Then you will have to set the mission preset to myMissionObjects with #ace-fortify blufor myMissionObjects to enable it.

#

I am asking if that chat command can be called via Init instead of having to have the Admin manually call it each and every time they want to use it in a mission.
Such as using the serverCommand function from here: https://community.bistudio.com/wiki/serverCommand

hallow mortar
#

Doesn't the Fortify module have editor options to set up the presets?

jaunty shadow
#

Yes, but only for the included presets. To use a Custom preset you have to set up the preset in a description.ext file, then call it via serverCommand from an Admin user in chat.

#

We are trying to find a way to set it to automatically run that command on mission start instead of the Admin having to manually run it every time.

winter rose
#

Try and thy shalt see
Biki 4:10

hallow mortar
#

I feel like there should be a mission script command to do that without jury-rigging an automatic chat command, but you would need to look at the ACE documentation (or ask the ACE team) for that

surreal peak
#

@jaunty shadow what is the command the admions run?

jaunty shadow
#

#ace-fortify blufor myMissionObjects

#

myMissionObjects being the custom item preset.

surreal peak
jaunty shadow
#

yeah

surreal peak
#

should be able tyo do it with the acex_fortify_fnc_registerObjects