#arma3_scripting

1 messages ยท Page 490 of 1

young current
#

is that left or right hand then?

meager granite
#

PussyublicVariable ๐Ÿค”

tough abyss
#

PubicVariable

still forum
#

stealing my ideas even though I don't tell anyone about them

unborn ether
#

Just mentioned Altis loading screen hint saying: "Once upon a time I was living in a fire-breathing volcano"

#

Someone got tired of writing those hints? ๐Ÿ˜„

wide hamlet
#

alright so im trying to edit a public script to add items to the ground instead of a players inventory if the inventory is full. The base script is: /* Harvest the good shit by GolovaRaoul */ private ["_player","_weed"]; switch (true) do { disableUserInput true; _weed = nearestObject [player, "CUP_p_fiberPlant_EP1"]; deleteVehicle _weed; systemChat "Started Harvesting the Good Shit Man"; if(vehicle player != player) exitWith {}; for "_i" from 0 to 2 do { player playMove "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon"; waitUntil{animationState player != "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";}; sleep 2.5; }; systemChat "You hands are all sticky, but you harvested some good shit man! Go sell the money at Trader City!"; disableUserInput false; player addItem "CUP_Item_Money" exitWith{}; };๏ปฟ

I am replaceing player addItem "CUP_Item_money" with if (player canAdd "ITEMNAMEHERE") then { player additem "ITEMNAMEHERE"; } else { _hemp = "groundweaponGolder createVehicle position player; _hemp addMagazineCargo "ITEMNAMEHERE"; _Hemp setPosATL getPosATL player; };

#

However, after making that edit, the script no longer runs, and i have no idea why

#

i of course replaced "ITEMNAMEHERE" with my correct class

meager granite
#

No longer runs as in errors out, nothing happens, added just to player but not ground?

wide hamlet
#

nothing happens

meager granite
#

You're missing " after GroundWeaponHolder

#

And its Holder, not Golder

wide hamlet
#

uno momento

#

So it is correct in my file. I just typed quickly here.

meager granite
#

addMagazineCargo takes array instead of class name

#

And use addMagazineCargoGlobal instead

wide hamlet
#

^ im assuming thats the issue. Will test and let you know

tough abyss
#

switch (true) do {....not a single case or even default...} ๐Ÿค”

wide hamlet
#

^ i noticed that too. But it was the base script so i dunno

tough abyss
#

That is one fucked up base script, I suggest you forget what you saw ASAP and never ever use scripts from that guy ever again

unborn ether
#

In this case using case is a real case.

meager granite
#

disableUserInput, so user friendly ๐Ÿ‘Œ

wide hamlet
#

cant let them look around when harvesting that sweet mary jane lmao

meager heart
#

also if you need place some items on the surface (not in the air above) use "WeaponHolderSimulated"...

meager granite
#

There is setPosATL getPosATL and player already should be on surface

tough abyss
#

exitWith is not a stand alone operator and even if it was, there is semicolon is missing after player addItem, so it is not real script, he probably collaged it together with no clue

meager granite
#

He probably replaced his attempt with original addItem line and forgot semicolon

unborn ether
#

Oh an btw disableUserInput sometimes glitch out not giving controls back even if false was done. Seem to mostly happen when your PC lags a bit.

meager heart
#

maybe that was the plan ๐Ÿ˜ƒ

#

aslo that uber script has errors, maybe you can try -showScriptErrors startup param...

wide hamlet
#

That param being client or serversided? Im assuming client seeing how it relates to on-screen?

meager heart
#

server has no ui...

#

client sided ๐Ÿ‘Œ

wide hamlet
#

Im assuming client seeing how it relates to on-screen? ty for the repeat ๐Ÿ˜‰ was just double checking

unborn ether
#

aslo that uber script has errors, maybe you can try -showScriptErrors startup param... Error: Word aslo, expected also

meager heart
#

i don't have that param for discord...

unborn ether
#

meh, casuals

peak plover
#

Yeah, also having a game logic and setting it's owner to hc to remoteExec ['function',headless_object];

grizzled rain
#

Could someone help me with this?

" alarmH = nil;
this addaction ["ALARM ON", {if(isnil "alarmH") then {alarmH = createSoundSource ["AlarmC_sound", position player, [], 0];};}];
this addaction ["ALARM OFF", {if(!isnil "alarmH") then {deleteVehicle alarmH; alarmH = nil;};}];}"; "

https://gyazo.com/9505e337837804f0c50f6cc0087e11a0
โ€‹
Im trying to look up a guide for a custom alarm to use via scroll wheel but my luck is running out. >.>

meager heart
#

for that kind of "on/off" ^ switch things you can use one addAction and change the text with setUserActionText

#

also what you did there is not "MP friendly"... ๐Ÿ˜ƒ

#
action_id = this addAction ["ALARM ON", {
    params ["_target", "_caller", "_id"];
    private _alarm = missionNamespace getVariable ["var_alarmSource", objNull];
    if (isNull _alarm) then {
        private _source = createSoundSource ["Sound_Alarm", _target getPos [0, 0], [], 0];
        missionNamespace setVariable ["var_alarmSource", _source, true];
        [_target, [_id, "ALARM OFF"]] remoteExec ["setUserActionText"];
    } else {
        deleteVehicle _alarm;
        missionNamespace setVariable ["var_alarmSource", objNull, true];
       [_target, [_id, "ALARM ON"]] remoteExec ["setUserActionText"];
    };
}];
```something like this ^ @grizzled rain
#

probably dude is gone already... ๐Ÿ˜ƒ

peak plover
#

he's from the US

#

So I'd assume he is sleeping right now

meager heart
#

๐Ÿคท

tough abyss
#

say3D but will need config

marble basalt
#

anyone know how i can get a script to call on all vics of a certain type

tough abyss
#

Whatโ€™s vics?

compact maple
#

^

tough abyss
#

Victims?

marble basalt
#

vehicles

compact maple
tough abyss
#

No shit! ๐Ÿ˜‚

compact maple
#

?

#

@marble basalt what do you want to do

still forum
#

get all vehicles with vehicles then filter your type with select and isKindOf

marble basalt
#

any way i can do it based off of vehicle id

#

trying to remove ammo from a heli on mission start

#

and its not for a scenario

tough abyss
#

{if (typeOf _x == "victypeโ€) then {...whatever}} forEach vehicles; @marble basalt

marble basalt
#

noice

marble basalt
#

having issues getting the helis ID anyone know how

still forum
#

what "ID" ?

marble basalt
#

the name i need to pull to have the script effect all of the helis of that type

#

like B_heli_transport_01_F

#

but doesnt seem to be working

#

@tough abyss what does _x standfor

still forum
#

that's the classname

#

_x is the object of the vehicle

marble basalt
#

ok

still forum
#

are you sure you have vehicles of EXACTLY that type?

marble basalt
#

not %100 but pretty sure

#

type in the name and thats only one i can see in editor

#

or atleast of the heli im useing

meager heart
#

also you can > <something> isKindOf "helicopter"

marble basalt
#

heres what i got

#

if (isDedicated) then {
{if (typeOf _x == "CUP_B_UH1Y_Gunship_Fโ€) then {removeMagazinesTurret ["CUP_PylonPod_7Rnd_Rocket_FFAR_M",[-1]]}} forEach vehicles;

}

else {
};

still forum
#

removeMagazinesTurret that's not how that works

marble basalt
#

ok so how can i do this

frigid raven
#

In my showDialog.sqf I have a waitUntil statement that is polling for a variable. When using closeDialog 1 to close this Dialog and open another afterwards the waitUntil logic is still polling. When spamming to open the mentioned Dialog I'd expect the polling logic to stack so I'd see like 5-6x times the amount of messages appearing (debug message of the waitUntil code). So a waitUntil will only die out if the condition goes true? Even when the scope is killed (which I thought closeDialog 1 would do)?

meager granite
#

Killed dialog != killed scope

frigid raven
#

I see

meager granite
#

Have a check inside waitUntil for this dialog to end

#

Do you have display as variable in that thread?

frigid raven
#

Ehm yea I stored it in a private

meager granite
#

do waitUntil {something || isNull _display};

#

Otherwise somehow terminate the thread if dialog is closed through onUnload event

frigid raven
#

So when closing the display isNull _display yields true?

meager granite
#

When you open the dialog, save its display in variable and then do isNull _display check to see if dialog associated with your script thread was closed.

#

Alternatively save your script thread into some display variable and then terminate it when dialog closes, this might be simplier actually

frigid raven
#

u mean

_myDisplay setVariable ["waitUntilCode", _waitUntilCode]

and then using it within

waitUntil { call _myDisplay getVarible "waitUntilCode" }
meager granite
#

Not really

#

How do you start your script thread when dialog opens?

#

execVM \ spawn in onLoad event I assume?

frigid raven
#

by call

meager granite
#

From where?

frigid raven
#

no spawn

#

sorry

meager granite
#

spawn in onLoad event?

frigid raven
#

nah in the chaining of initPlayerLocal.sqf

meager granite
#

So you do createDialog 'something' and then spawn after it?

#

Aw shucks, need to get off right now.

#

Anyway, you either check inside your spawn script that dialog was closed with isNull check

frigid raven
#

well createDisplay is within my showDialog.sqf

#

Alright gonna try

meager granite
#

Or assign your spawned script to display with variable and then terminate it when display closes on onUnload event

frigid raven
#

did worked with the nullcheck

#

thx bud

meager granite
#
createDialog 'whatever';
0 spawn {
    _display = findDisplay 12345;
    waitUntil {!alive player || isNull _display};
    if(isNull _display) exitWith {};
    // something else here
};
createDialog 'whatever';
0 spawn {
    _display = findDisplay 12345;
    _display setVariable ["script", _thisScript];
    _display displayAddEventHandler ["Unload", {
        terminate (_this select 0 getVariable ["script", scriptNull]);
    }];
    waitUntil {!alive player};
    // something else here
};
#

And i'm off

#

Two ways to approach this

#

And instead of displayAddEventHandler you can do some call on onUnload in display config too

tough abyss
#

_x removeMagazinesTurret ... @marble basalt read wiki

grizzled rain
#

Thank you! @meager heart Do you know if theres and guide? for doing this? Haha

meager heart
#

i don't know any...

#

imo the best guide is your own experience

frigid raven
#

Is there any difference between [_x] call X11_fnc_myFunction and _x call X11_fnc_myFunction

still forum
#

yes

#

one makes an array. The other doesn't

frigid raven
#

Because when it comes to CBA_Hash I have to use [] it seems because the values disappear if not

still forum
#

Same as the difference between [x] and x

frigid raven
#

hm that makes a bit sense since a CBA hash is a helluva nested array

still forum
#

Yeah. CBA hash takes an array. And for params to properly take that out it might have to be inside a nested array like [[x]]

frigid raven
#

Alright thx - that produced so much bugs for me ๐Ÿ˜ฆ

#

is it save to always use [] ๐Ÿ˜› also for only one arg

still forum
#

no

frigid raven
#

just to stay save in the future

#

meh..

still forum
#

If the function properly uses params. Then [] or not doesn't matter in most cases

#

But it's best to always look at the function header and check what arguments it expects

#

if it doesn't have a proper header, throw it away

fringe yoke
#

Is there somewhere to look for default arma stringtable values?

still forum
#

Well. you can look into the Arma stringtables

fringe yoke
#

is there somewhere in game? or just in the game files?

#

I was hoping for an online resource

meager heart
#

language_f.pbo

frigid raven
#

Ah fuck ...

params ["_profile"]

This is how I declared my params for a 1 arg funciton

#

this is wrong right?

#

If I want to have calls without []

#

What is the way to have a single argument func parameter

#

When I dont want it to trim an given array

#

is there a way at all? or do I have to make sure to give an array argument with [] around?

grizzled rain
#

Oh I thought there was to add custom sound and such that can be played via scroll wheel from an object

tough abyss
#

Just use _this

frigid raven
#

ah this is actually the param array right?

meager heart
frigid raven
#

and there for a 1 arg the whole arg itself

#

ye was looking for that

#

thx buds

still forum
#

@frigid raven no that's not wrong. It's correct

#

As I told you before

frigid raven
#

yea but how to properly avoid the CBA Hash being trimmed? Type contraint on array?

#

So it knows - the argument value is actually an array and there doesnt need to be... ehm trimmed to the first index-value ?

#
params [["_cbaHash", EMPTY_HASH, []]]

Will this be a way ? Gonna try it out now anyways

still forum
#

That way will only work if you pass a nested array

frigid raven
#

meh sorry I was triggered to try out stuff before reaching your comment :/

#

Now I get it tho

meager heart
#

follow the white rabbit Dedmen's comments

neon snow
#

What is the action name for tailhook?

meager heart
#

check BIS_fnc_AircraftTailhook from inside, maybe you will find something there ๐Ÿค”

neon snow
#

OK thanks ๐Ÿ˜ƒ

meager heart
#

probably hardcoded...

neon snow
#

Turns out that is a custom action

still forum
#

You can trigger tons of things using the action command. You just need to find out the name of the action and it's parameters.
Which are mostly undocumented

meager heart
#

BIS_fnc_AircraftTailhookAi < has all of the animations

neon snow
#

@meager heart yep, that was my issue, I didnt know about that func and I just wanted for the AI to extend its tailhook

meager heart
#

๐Ÿคท

neon snow
#

Thank you ๐Ÿ˜ƒ

fringe yoke
#

Does anyone happen to know of an easing script? For camera or for control movement

peak plover
#

uhh

#

This?

#

Also camera has camCommit

#

Shouldn't that work as easing?

#

camCommit with 5 seconds and change the direction and commit again at 2.5

#

something like that

fringe yoke
#

I was looking for something done via scripting, not in the editor

meager granite
tough abyss
#

ENGINE Fixed: Attenuation for transport internal sound yeah bitches! Sounds good ๐Ÿ˜Œ๐Ÿ‘Œ

#

Pun intended

runic surge
#

using the value returned by surfaceNormal would it be possible to determine which direction the slope of a terrain goes?

#

like determining which way is 'up' on the side of a hill or something

signal kite
#

Hello!
I try to make a soldier constantly shoot at a pop-up target (at a firing range). I put
"while {alive this} do {this doSuppressiveFire scheibe; sleep 10;};"
in his init field but it returns "undifined variable" and he does nothing - how to fix that? (scheibe is the variable name I gave to the target)

runic surge
#

what is the name that it says isn't defined?

signal kite
#

this

runic surge
#

also I don't think you can use sleep in a unit init field

meager granite
#

@runic surge

_sn = surfaceNormal getPosWorld player;
_dir = (_sn select 0) atan2 (_sn select 1);
if(_dir < 0) then {_dir = _dir + 360};
hintSilent str _dir;
runic surge
#

thanks @meager granite
I don't get how you can figure that out so easily

#

I'll test that

meager granite
#

atan2 is a way to go to calculate angles, applicable in lots of places

#

You can do that through vector* commands too but I think it will be bit more lengthy

fringe yoke
#

@meager granite That link should help, thanks!

drowsy axle
#

Is setVariable/getVariable the same as in the editor typing a string into Variable text field?

hollow thistle
#

set/get variable, sets gets variable on object/namespace/location...

#

If you type some name into variable in editor it is kinda an equivalent to doing ```sqf
missionNamespace setVariable ["typedVariable", <this_object>];

frigid raven
#

What is the canonical event when a player finally spawn first time in a mission?

#

Besides "Respawn" if sb. wants to mention that

weary pivot
#

Is there a script that would allow me to walk up to letโ€™s say a supply crate and choose units that I need?

frigid raven
#

like adding units to your group?

weary pivot
#

Let me explain. Iโ€™m doing a police style mission with tasks that will randomly pop up, each one is different, I need the ability to pick the guys I need for the task. For example if Iโ€™m at the police HQ And a riot gets called in I need to choose the number of swat members that I need! Or for a search and rescue I need helo pilots and ground searchers

frigid raven
#

if you need an example script tho

#

think that is what you want eh? see how others did it

unborn ether
#

My eyes are bleeding seeing this dialog.

#

๐Ÿ˜ƒ

frigid raven
#

yea the yellow is definitely missing

weary pivot
#

yes thatโ€™s perfect! I saw it before on a creative server and couldnโ€™t find it thanks!

drowsy axle
#

} forEach (SpawningHeli + SpawningPlane + SpawningCar);
OR
} forEach SpawningHeli + SpawningPlane + SpawningCar;?

#

They're Arrays ^

weary pivot
#

Another thing Iโ€™m trying to figure out. I downloaded a few good police and gun mods for my mission and they have sirens and lights is there a way I can have all ai react to them by either pulling over and if thatโ€™s to complex, then just stopping

drowsy axle
#

From an approach i'm thinking of would be quite complex.

tough abyss
drowsy axle
#

Okay

#

@tough abyss would the IF statement at the bottom work? ```sqf
CAP_Helicopter_Classnames = [
"RHS_AH64D_wd"
];

SpawningHeli = false;

for [{i=0}, {!isNil ("Helicopter" + str _i)}, {_i = _i + 1}] do {

private _Helicopter_obj = missionNamespace getVariable ("Helicopter_" + str _i);

CAP_Helicopter_Vars pushBack _Helicopter_obj;

private _Helicopter = (CAP_Helicopter_Classnames select _i) createVehicle [
    ((getposATL _Helicopter_obj) select 0),
    ((getposATL _Helicopter_obj) select 1),
    ((getposATL _Helicopter_obj) select 2) + 0.2
];

_Helicopter setDir (getDir _Helicopter_obj);

_Helicopter setposATL [
    ((getposATL _Helicopter_obj) select 0),
    ((getposATL _Helicopter_obj) select 1),
    ((getposATL _Helicopter_obj) select 2) + 0.2
];

if (isNil ("Helicopter_" + str _i)) then {
    hint "Helicopter Spawning is Finished";
    SpawningHeli = true;
};

};```

tough abyss
#

Yeah you need brackets there, isNil is Unary, so it has prio over +

drowsy axle
#

MP you?? no, but I might PM you.

earnest ore
#

I don't know how to express this feeling in SQF.

drowsy axle
#

lol

#

@tough abyss isNil ("Helicopter_" + str _i) would this become true?

tough abyss
#

Depends on if the variable with name "Helicopter_<value of _i>" is undefined or not

drowsy axle
#

Okay and when it becomes undefined it's true.

tough abyss
#

But your if statement is outside of loop so _i in str _i is undefined

drowsy axle
#

Right.

#

Sorted

#

Just to confirm. isNil isTrue when _i is undefined.

tough abyss
#

If _i is undefined, str _i is undefined , adding to undefined makes result undefined, and isNil undefined is also undefined. if (undefined) will not execute at all

#

Enable errors

drowsy axle
#

Right i get that logic now

#
if (isNil _i) then {
        hint "Car Spawning is Finished";
        SpawningCar = true;
    };```
tough abyss
#

isNil "_i"

#

But I donโ€™t think you can test if car spawned this way as it makes no sense

#

Also you asked only about bottom if statement but your whole code above it is broken in more places than you can count, so ๐Ÿคทโ€โ™‚๏ธ

drowsy axle
#

lol

#

I give up lol

meager heart
#

๐Ÿ˜”

austere hawk
#

so i was doing _HP_classes = [configFile >> "CfgVehicles" >> _vclass >> "HitPoints", 0] call BIS_fnc_returnChildren; in the hopes to get the names of the sub-classes as string. Instead i got the paths (e.g. bin\config.bin/CfgVehicles/myTank/HitPoints/HitHull)
What can i use instead to get just the string names of the child classes instead of the path?

meager heart
#

configProperties maybe

wide hamlet
#

so editing the server.cfg, looking at onHackedData, would adding this code both show the hint and kick the player after 60s?

                                          _steam = parseText  "<t color='#db0f26'>Steam Mod Collection: </t><a href='redacted'>redacted</a>"; 
                                          _att = format["WARNING %1!",name player]; 
                                          _text1 = parseText "<t color='#db0f26'>You seem to have some data that is modified in some way!</t>"; 
                                          _text2 = parseText "<t color='#db0f26'>Make sure to use A3Launcher to download the correct mods, or use steam workshop to download them directly!</t>"; 
                                          _att hintC [_text1,_text2, _steam, _discord]; 
                                       sleep 60;
                                       kick (_this select 0)";```
tough abyss
#

does selectRandom reliably produce a 50/50 result or nah

#

i imagine it does

#

as it iterates more

#

i just want to be sure

meager heart
#

if you need 50% chances you can just if (random 1 >= 0.5) then { or if (random 100 >= 50) then {

tough abyss
#

i don't need EXACT 50/50

#

i'm just trying to pit semi-even number of players against each other for one last battle

#

exact split isn't necessary for me

#

also, this is going to sound hilariously noobish, but i'm having a brainfart -- how do i add a value to an array? I.E -- i have a position, i want to add 200m of altitude to said position

#

well, add 200 to the Z value

#

vectorAdd [0,0,200]

#

vectoradd works in this case? nice

#

i knew of that command i just didn't know if that was what i wanted

#

arigatou

#

@wide hamlet no

#

Try configName on each result @austere hawk

wide hamlet
#

@tough abyss so how can i show a custom notification when they have unsigneddata/hackeddata while still kicking them

tough abyss
#

You canโ€™t

austere hawk
#

@tough abyss thanks that does the trick. configProperties (with isClass filter) also just returns the path, just as the function does

wide hamlet
#

no way at all? Fuck ight

tough abyss
#

Use configClasses then no need for filter

#

No way at all

meager heart
austere hawk
#

i must get both, in correct order and with correct inheritance -> config level

#

that command also contains hitpoints from Turrets for example, also reflectors and so on

meager heart
#
"true" configClasses (configFile >> "CfgVehicles" >> _class >> "HitPoints") apply {configName _x}
#

iirc there could/will be missing points ๐Ÿค”

austere hawk
#
_HP_classes=[]; 
{ //forEACH        
    _HP_classes append [configName (_x)]; //extract config names from path
} forEach _HP_paths;``` - thats what i have now. Yes, it just extracts hitpoints in main vehicle class - which is exactly what i need
meager heart
#

you can replace that append with forEach with one apply

#

if you need path too...

tame lion
#

is there any good guide out there that explains all the commands and concepts regarding vectors?

leaden venture
#

So my group and I have been getting a lot of great usage out of the Liberty, but there aren't ways to really store vehicles on it properly. When you unload them from a blackfish, they tend to spawn inside of the ocean, so we're making a script using worldtomodel that will put the vehicles back onto the ship. Its working out pretty well so far using hold-actions, but I wonder if there's a better way.

still forum
#

@tough abyss yes selectRandom is supposed to be uniform distribution. If you don't want that you can use selectRandomWeighted

#

@tame lion the BI wiki has all the commands and explains what they do

leaden venture
#

@tough abyss Marshalls, actually

tame lion
#

Sorry, to clarify, I was more so looking for an explanation of how to do vector style scripting. I know its all involved in finding the relation of positional/rotational/speed of objects, but I'm not sure how to use that in scripting. I guess what im really asking for is a good math lesson lol

leaden venture
#

@tough abyss We put them inside of the giant hangar. You can fit 2 rhinos, 4 marshalls and like 30 infantry in there and we put the blackfish on the aft deck

#

Yeah, we've repeatedly gotten the blackfish to land back on the ship no problem but we can't jsut get the APcs back on

#

We do aircraft carriers sometimes, we even have the funky LHD mod. But sometimes the liberty has a really cool feeling to it. We'll see what happens with holdactions

neon snow
#

Is there a way to set target(cursor) for player?

still forum
#

you mean. Move the players cursor? Via script?

#

Not really. You can use setDir to rotate the player. But you can't really move.....
Okey I think there is a script command to move the mouse around

#

with that and a ton of math you could probably do it

neon snow
#

Sorry my bad, I should say cursorTarget. In other words to make player lock target

still forum
#

Well. As I said. Use script commands to move the mouse cursor of the player such that it aims onto that target. And then you can use disableUserInput to disable all input of the player so that he can't move away by himself

neon snow
still forum
#

Oh.. cursorTarget returns that thing? ๐Ÿ˜ฎ

neon snow
#

Yeah tried them none work unfortunately :/ setPilotCameraTarget is only for PilotCamera

still forum
#

use action to cause the "switch target" action and repeat till cursorTarget returns what you want ๐Ÿ˜„

neon snow
#

thats one way ;d

tough abyss
#

Wut? How do you move mouse by script that is not a cursor on the control @still forum ?

still forum
#

Wait. Letme look it up ๐Ÿ˜„

#

Ahhhhh... Derp

#

ACE uses setVectorDir to rotate the player.
There was a ACE Pull Request that wanted to add a "mouse movement" Extension which was never merged

tough abyss
#

I mean you can replace player with AI brain and order it to aim somewhere then put player back but this is just ๐Ÿคฎ

meager heart
#

setMousePosition ๐Ÿค”

austere hawk
#

so uh yesterday i was getting the paths unexpectandly and wanted just the class name
Today i thought i'd just use the paths i already got to extract some of the data. Seems i dont know how to use the path correctly

private _vclass= "Base_chassis";
private _HP_paths = [configFile >> "CfgVehicles" >> _vclass >> "HitPoints", 0] call BIS_fnc_returnChildren;  
private _y = _HP_paths select 0;    
// example: _y = bin\config.bin/CfgVehicles/Base_chassis/HitPoints/HitHull
private    _param_name= "EVDS_hittype"; 
private    _retrieve= (_y >> _param_name)call BIS_fnc_GetCfgData;
diag_log ["retrieved hittype first",_retrieve]; 
if (isNil "_retrieve") then {
    diag_log ["Param first Nil, retrieved hittype second",_retrieve]; 
    _retrieve= [_y,_param_name,false] call BIS_fnc_returnConfigEntry;
};```
returns 'any' for both logs
still forum
#

you can use
```sqf
```
For proper syntax highlight

austere hawk
#

now in color

still forum
#

so _retrieve is any but _y is not?

austere hawk
#

yeah

#

y is like the example i commented (logged earlier)

still forum
#

BIS_fnc_getCfgData geturns nil if the config entry doesn't exist

#

like if your _y class doesn't have a EVDS_hittype entry

#

And the second log has to be nil. As your isNil check makes sure of that

#

you probably want to switch the diag_log and the BIS_fnc_returnConfigEntry lines

neon snow
#

@still forum would you possibly know what is the action name for switching target ? I can't find it

austere hawk
#

oops yeah, that was just my error condensing this for here

still forum
#

it's probably not documented yeah... I'll see what I can do

grabs shovel and pickaxe

neon snow
#

๐Ÿ˜€

austere hawk
#

ok... turns out the parameter in the config was actually missing/ was under false name...

still forum
#

There is a "lockTarget" action apparently.... somewhere.. I've striked it with the pickaxe but I don't really have it yet. I'll keep digging

neon snow
#

You are really great at it ๐Ÿ˜€

still forum
#

LockTargets or UALockTargets or LockTarget or UALockTarget
I don't think that'll work ๐Ÿค”

neon snow
#

How do you do it? Maybe I could try aswell

still forum
#

What do you mean?

neon snow
#

The digging ๐Ÿ˜€

still forum
#

No you can't

neon snow
#

Oh, ok then

#

Anyway thanks for your time ๐Ÿ™‚

gleaming cedar
#

Hellow

#

How do I disable a smoke module sound

cedar kindle
#

the one with fire?

gleaming cedar
#

No

#

just normale smoke

#

@cedar kindle

tender fossil
#

Is this correct syntax? (Note: Arma 2: OA)

if (!(vehicle player isKindOf "Air")) then {
cedar kindle
#

@gleaming cedar afaik it spawns smoke grenades so not possible

#

yes @tender fossil

tender fossil
#

Thanks @cedar kindle ๐Ÿ˜ƒ

weary pivot
#

Is there a script that will open a bar gate when you get a certain distance from it?

radiant egret
#

U can do it via trigger

weary pivot
#

How do I do that? Iโ€™m still pretty new to this stuff.

tough abyss
#

Do you know how to put trigger down in editor?

weary pivot
#

Yes

#

I believe I would have to give the bar gate a โ€œ variable nameโ€ then put the name in the trigger, right?

young current
#

yes and use animateSource script command

#

in the trigger

tough abyss
#

Make trigger repeatable and put open animation in activation and close animation in deactivation

weary pivot
#

So like โ€œGATE1 openanimationโ€?

tough abyss
#

No GATE1 animateSource ["whatevertheanimationname", 1]

#

And then 0 instead of 1 to close

weary pivot
#

Ohhh, ok thanks.

weary pivot
#

Another question that I have is how to I do sequences of animations. I know {Soldier1 playmove โ€œacts_navigatingchopper_inโ€ } but I want him to do โ€œchopper outโ€ ?

nocturne basalt
#

Hi guys. Can I trigger a script when changing weapons somehow? Dont think theres an eventhandler for that

high marsh
#

@nocturne basalt

while{alive player} do
{
    _primary = primaryWeapon player;
    if !(primaryWeapon player isEqualTo _primary) then 
    {
        //primary weapon has changed
    };
};
nocturne basalt
#

Ok ty. Yeah I knew I could use an infinate loop for it. Just wondered if it was possible to save CPU by only running when it happens

#

Instead of constantly checking

high marsh
#

Unless you want to check once a switch weapon action is pressed

#

Add some suspension, it shouldn't be so taxing. Unless you have 100+ of these. This could run on the client

nocturne basalt
#

Yeah sleep 1 should be ok

#

Or maybe use waituntil?

high marsh
#

waitUntil, same thing

#
waitUntil {
     _primary = primaryWeapon player;
    if !(primaryWeapon player isEqualTo _primary) then {
        //code
    };
    alive player;
};
tough abyss
#

What do you need weapon change event for?

nocturne basalt
#

We made a left handed melee weapon that is actually a facewear object. Want to be able to "hide" it when changing weapons

#

Or delete it

#

And then spawn it when changing back

high marsh
#

Why not just make it a weapon?

nocturne basalt
#

Cause its dual weilding

#

Gun in right hand, sword in the left

tough abyss
#

Pretty sure you could config to hide it during animation

nocturne basalt
#

You cant hide stuff on a man class

#

So we need to add/remove gear

tough abyss
#

Not 100% but I think you can do tonnes of shit with animations

digital hollow
#

Perhaps the Anim EHs will work for you.

high marsh
#

^ Possibly, but you'd need to check for rifle, pistol, and launcher anim. Plus modded weapons might have custom anims

nocturne basalt
#

That sounds much more tricky

digital hollow
#

I mean just use that as a check frequency, not look at the animations.

nocturne basalt
#

Oh yeah thanks gonna check it out

#

Maybe thats less stressful

digital hollow
#

I use it for stuff like checking if a group has gone into combat mode.

austere hawk
#

got another error i dont quite get what is actually wrong
https://pastebin.com/p5FvQVK9
around line 47 is the error.

private _index;
_index = _gvar findIf {_x select>
  Error position: <_index;
_index = _gvar findIf {_x select>
  Error exitwith: Undefined variable in expression: _index
File \EVDS_main\Scripts\cfgcache_init_delayed.sqf [EVDS_fnc_cfgcache_init_delayed], line 47```
How can index not be defined? I just dont see it
digital hollow
#

I think it's _x that is undefined.

austere hawk
#

but _x is part of the findIf thing, at least should be

digital hollow
#

oh, sorry. my bad

high marsh
#

Yes, _x is a magic variable in findif for the currently evaluated element.

austere hawk
#

but i'm somehow suspecting that its got something to do with the findif thing that is not working as i think it does

high marsh
#

try defining _index, set it to nil

#
private _index = nil;
#

Oh, nevermind. Hold on. write private before your find if definition

meager heart
#

_gvar = missionNamespace getVariable [_varstr,false];

#

bool ^

#

_index = bool findIf {(_x select 0) isEqualTo _class};

austere hawk
#

but bool only if it doesnt find the variable

#

and that is checked with isEqualtype []

#

at least that's what i want to happen - the error could also be in there

meager heart
#

is it [[]] or [] ?

austere hawk
#

the _varstr global variable content?

meager heart
#

_gvar is just array or nested aka [[],[]] ?

austere hawk
#

its different stages of arrays nested unsymmetrically
look at line 6 the example for "_content"
the variable i try to retrieve is an array of multiple _content's gvar=[_content1, _content2, _content3,...];

#

_content* = [<string>, <array with lots of sub arrays>, <array with strings>]

meager heart
#

also

    private _index;
    _index = _gvar findIf {(_x select 0) isEqualTo _class};
``` >
```sqf
 private _index = _gvar findIf {(_x select 0) isEqualTo _class};
high marsh
#

^ was what I was saying earlier

austere hawk
#

ah, yeah, the little things^^

#

ill post a rpt log with the diag_logs enabled, hold on

meager heart
#

also

private ["_time","_gvar"];
``` >
```sqf
private _time = 3*(random 100)/100;

private _gvar = missionNamespace getVariable [_varstr,false];
austere hawk
#

thanks, appreciate the little pointers. It's 5am code...

#

arma is rebelling, refuses to alt tab properly for some reason ... need a reboot

meager heart
#

๐Ÿ˜ƒ

austere hawk
#

๐Ÿค” weird... i dont get the error anymore...

meager heart
#

idk if you removed > private _index; but i guess that was the problem ๐Ÿคท

austere hawk
#

yea i moved it in front of the findif _index

ruby breach
#

That was at least part of your problem then, private _index; will error

austere hawk
#

so private _variable only if you add a value in the same line ?

ruby breach
#

Correct. Otherwise private "_index";

austere hawk
#

ah, ok

high marsh
#

no, syntax is private var or private array

ruby breach
#

private <STRING>, private <ARRAY> or private <VARIABLE> = <VALUE>

high marsh
#

Nevermind. I misread.

#

Either way, the new syntax should be used

austere hawk
#

seems i just stumble from one error to another... sigh...

high marsh
#

Logs

#

?

austere hawk
#

it's another function (though similar) , i'm looking into it currently

austere hawk
#

alright, another error, same function as previous - but caused by different input. Log is on the bottom
https://pastebin.com/sJ1NAH5t

Error in expression <;isEqualTo _class};  
 
if (_index == -1) exitWith {
_gvar = missionNamespace get>
  Error position: <exitWith {
_gvar = missionNamespace get>
  Error exitwith: Type Array, expected code
File \EVDS_main\Scripts\cfgcache_init_delayed.sqf [EVDS_fnc_cfgcache_init_delayed], line 48
#

oh wait... i see it. exitWith cant have else

#

exitwith is pointless there anyway

tough abyss
#

It would defeat its purpose if it had one

austere hawk
#

yeah

#

"just let me add a diag_log so i see if it doesnt exit as planned"... is how i got there i guess

astral tendon
#
_wp =(group _TeamLeader) addWaypoint [position MissionArea, 1]; 
_wp setWaypointType "Move"; 
_wp setWaypointCompletionRadius 100;
_wp setWaypointStatements ["true", "{ unassignVehicle _x; moveOut _x} forEach (units group this); deleteWaypoint [group this, currentWaypoint (group this)]"];

The waypoint never finish, the group is inside of a vehicle but they are not driving, I missed something?

#

And the group is in a distance less than 100 of the waypoint area.

tough abyss
#

alright

#

am i a fucktard

#
_firstShot = {showCinemaBorder true;
    _cameraOne cameraEffect ["internal", "BACK"];
    _cameraOne camCommand "inertia on";
    _cameraOne camPrepareTarget [5103.57,4552.96,70.666];
    _cameraOne camPrepareFOV 0.75;
    _cameraOne camCommitPrepared 0;

    _cameraOne camPreparePos [4570.37,4810.58,14.549];
    _cameraOne camPrepareTarget [5103.57,4552.96,70.666];
    _cameraOne camPrepareFOV 0.75;
    _cameraOne camCommitPrepared 10;
};
waitUntil {scriptDone _firstShot};```
#

screaming that 'waitUntil` has a generic error in its expression

#

really making me think

#

yes i know the waituntil would fire immediately if it worked

digital hollow
#

_firstShot is just code. scriptDone is expecting a script handle from spawn or execVM

tough abyss
#

ah

#

well

#

i did try using

#
_memeTimer = time + 10;
waitUntil { time > _memeTimer};```
#

and that also gave me an error which is confusing because i uh

#

i use it in other parts of my mission

meager heart
#
_firstShot = {
   /* code here */
};
waitUntil {scriptDone _firstShot};

you sure nothing is missed here ? ๐Ÿ˜ƒ

tough abyss
#

shh

#

i mean though tbf ```sqf
_firstShot = [_cameraOne] spawn {showCinemaBorder true;
params ["_cameraOne"];
_cameraOne cameraEffect ["internal", "BACK"];
_cameraOne camCommand "inertia on";
_cameraOne camPrepareTarget [5103.57,4552.96,70.666];
_cameraOne camPrepareFOV 0.75;
_cameraOne camCommitPrepared 0;

_cameraOne camPreparePos [4570.37,4810.58,14.549];
_cameraOne camPrepareTarget [5103.57,4552.96,70.666];
_cameraOne camPrepareFOV 0.75;
_cameraOne camCommitPrepared 10;

};
waitUntil {scriptDone _firstShot};

#

doesn't work either

meager heart
#

maybe _cameraOne does not exist ๐Ÿค”

tough abyss
#

ah

#

that's not full file

#

here

#
_cameraOne = "camera" camCreate [4586.29,4859.84,3.10599];

_firstShot = [_cameraOne] spawn {showCinemaBorder true;
    params ["_cameraOne"];
    _cameraOne cameraEffect ["internal", "BACK"];
    _cameraOne camCommand "inertia on";
    _cameraOne camPrepareTarget [5103.57,4552.96,70.666];
    _cameraOne camPrepareFOV 0.75;
    _cameraOne camCommitPrepared 0;

    _cameraOne camPreparePos [4570.37,4810.58,14.549];
    _cameraOne camPrepareTarget [5103.57,4552.96,70.666];
    _cameraOne camPrepareFOV 0.75;
    _cameraOne camCommitPrepared 10;
};
waitUntil {scriptDone _firstShot};

// End of camera shots
cutText [" ", "BLACK IN", 3];
_cameraOne = "camera" camCreate (getpos player);
_cameraOne cameraeffect ["terminate", "back"];
camDestroy _cameraOne;
"dynamicBlur" ppEffectEnable true;   
"dynamicBlur" ppEffectAdjust [100];   
"dynamicBlur" ppEffectCommit 0;     
"dynamicBlur" ppEffectAdjust [0.0];  
"dynamicBlur" ppEffectCommit 4;```
#

no matter what i try with waitUntil i am always getting a generic error in expression

austere hawk
#

another issue near or at a findIf statement, other function :/

https://pastebin.com/NH8xxDNu (log with input at bottom)
generic expression error line 29

_index = _gvar findIf {(_x select 0) isEqualTo _class};  
if (_debu>
  Error position: <select 0) isEqualTo _class};  
if (_debu>
  Error Generic error in expression```
meager heart
#

i'm not sure if findIf even supports nested arrays...

austere hawk
#

i was expecting it to just go through the first layer...

jade abyss
#

findIf = new?

austere hawk
jade abyss
#

ah

meager heart
#

yeah

austere hawk
#

so you think its findIf's limitations?

queen cargo
#

gimme few minutes @austere hawk

austere hawk
#

โค

queen cargo
#

okay .. forget it

#

arma denies to run without steam having installed it proper ...

#

and steam can fuck off

#

because i cannot just free magical GBs on my SSD

#

however ... to debug this, execute this:

#
[[1, 2, 3], [4, 5, 6], [7, 8, 9]] findIf { systemChat str _x; false; }```
#

and tell me what it actually outputted

#

@austere hawk

austere hawk
#

will try

meager heart
#
[["A"], ["B", "C"]] findIf {_x select 0 isEqualTo "A"} != -1 // true
["A", ["B", "C"]] findIf {_x isEqualTo "A"} != -1 // true
austere hawk
#

@queen cargo

[1,2,3]
[4,5,6]
[7,8,9]
#

sry, typo ^^

queen cargo
#
[[1, 2, 3], [4, 5, 6], [7, 8, 9]] findIf { systemChat str (_x select 0); false; }```
#

what is this doing?

#

should print 1, 4, 8

austere hawk
#
1
4
7
queen cargo
#
[[1, 2, 3], [4, 5, 6], [7, 8, 9]] findIf { (_x select 2) == 5 }```
should return 1
#

and as it does, as expected, nested arrays work in findIf

#

chances are, your actual _gvar content is the problem

meager heart
#

yeah... no troubles there ^

queen cargo
#

so you may want to add some debug capability to it

#

eg. systemChat str _x; after the findIf {

meager heart
#

i guess that's what you're doing there

["A", [1,2,3,4]] findIf {_x select 0 isEqualTo "A"} != -1 
```and thats why those errors there @austere hawk
austere hawk
#

you can see the gvar content in the log at the bottom ... that big lump of data on the bottom

queen cargo
#

see @meager heart msg

meager heart
#

yeah

#

["V_T_IMP_Chim_APC_stan_MB000_imp",[["HitTank01","fuel","HitTank01",100,0.05,0.05 .... < that is your variable

austere hawk
#

no, that should only be one element of gvar

#

[content1, content2, content3]
what you quoted is equivalent to content1

queen cargo
#

then fallback to what i said

#
private _index = _gvar findIf {systemChat str _x; (_x select 0) isEqualTo _class};
#

though ...

#
private _index = _gvar findIf {systemChat typeName _x; (_x select 0) isEqualTo _class};``` should be enough
#

chances are, it will print for the last element right before the error not some array

austere hawk
#

i see it already in the log now, first element is in in array itself, which shouldnt be
[[content1], content2] instead of [content1, content2]

#

thanks you two

meager heart
#

๐Ÿคท

queen cargo
#

๐Ÿ˜‰

austere hawk
#

ok, i was wrong again, it was actually [content1, bi,ts,of,con,ten,t2]... ๐Ÿ™„

meager heart
#

lol

tough abyss
#

is there any way to increase the duration of which BIS_fnc_typeText stays on screen?

#

ah, guess i should use typeText2

#

_if typeText is so good then why isn't there a typeText 2?

meager heart
#

afaik nope, but you can edit the original thingy or just make your own version...

tough abyss
#

eugh.

#

ECH.

#

Seems silly.

meager heart
#

typeText 2 there... just for more awesomeness

#

they both kinda epic

tough abyss
#

hrmn

#
    ["<t align = 'center' valign = 'center' shadow = '1' font='EtelkaMonospaceProBold' size = '0.7'>R E C L A I M  Y O U R  S K I E S.</t>"]``` doesn't vertically align like expected(?)
meager heart
#

https://pastebin.com/89M89KUd < did that long time ago but afaik still works without troubles, that is just "custom" version of that typetext thingy... just edit it how you want...

#

text blocks there exactly the same as in the original >

private _scriptLoading = [
    [[localize "STR_outro_loading","<t align='left' shadow ='1' size ='0.85' font='PuristaMedium'>%1</t><br/>"]], 
    0.015 * CTRL_W_X, 0.015 * CTRL_H_Y
] spawn SL_fnc_typeTextX;
#

@tough abyss

tough abyss
#

noice

#

i'm ripping apart typeText right now

#

working it to my needs

#

really enjoying how safeZoneX + safeZoneW / 2, safeZoneY + safeZoneH / 2, isn't returning the center of my screen

#

not at all

#

that's a pretty neat little snippet honestly

frigid raven
#

good morning buds

high marsh
#

๐Ÿ‘‹

frigid raven
#

@tough abyss pls link or repo to the script. Gonna need that in the future ๐Ÿ˜„

high marsh
#

They're nested Quik. Maybe that the cause?

#

Although it's by index and not necessarily by number?

#

or even the data itself

peak plover
#

hmm

#

Why do you event only need from 0 to 3

#

you can just do for loop and make a 2nd array

still forum
#

@nocturne basalt CBA has a weaponChanged eventhandler.
@austere hawk https://pastebin.com/p5FvQVK9 Line 46. That's not how the private keyword works. private is a keyword manipulating the behaviour of the = operator. Without = it just tries to call the private command.
You need to private _index = _gvar...
It's complaining about it being nil because it is. You are trying to call the private command with a nil variable

#

Also why are you mixing private ARRAY and private keyword?
Just be consistent and use the keyword (Because it's way more performant)

if (_index < 0) exitWith { //index =-1 if not found -> add to gvar You write as a comment what you meant to do. But you do something different.
If you want to check if the index is -1. Then you should do if (_index == -1) exitWith {

#

These are some of the reasons why I have to keep every SQF beginner as far away from your scripts as possible. They are just teaching too much crap to people

tough abyss
#

It is enough to wrap consecutive expressions in code tags individually

still forum
#

If you wanna argue readability. You can also format them properly if you want.

if ( alive _x && 
    {local _x && 
    {(side _x) isEqualTo _side}}
    ) then {
meager heart
tough abyss
#

A && {B} && {C} seems to be as fast as A && {B && {C}}

#

More readable if anything

queen cargo
#

A && {B && {C}} should in theory be faster then A && {B} && {C} for A := false, B := true/false, C := true/false

still forum
#

It depends on what you are doing. But the second one is definetely faster if A is false. Because the second && doesn't need to be evaluated

nocturne basalt
#

@still forum awesome thanks

still forum
#

@meager heart
If
Vehicle is alive and
vehicle is a vehicle and
vehicle is not a soldier and
vehicle is less than _radius away from _position and
vehicle is not already in list of vehicles (Hint... We have pushBackUnique for that.. You don't need to manually do that) abd
vehicle is not in the Air, not flying.
Then put it into _vehicles list.
Btw.. We have select CODE for that..

#

I'll make it more readable for you

meager heart
#

๐Ÿ˜ƒ

#

thanks

peak plover
#

based @still forum

still forum
#
        {
            _vehicle = _x select 2;
            if (alive _vehicle) then {
                if (_vehicle isKindOf 'AllVehicles') then {
                    if (!(_vehicle isKindOf 'CAManBase')) then {
                        if ((_vehicle distance2D _position) < _radius) then {
                            if (!(_vehicle in _vehicles)) then {
                                if (isTouchingGround _vehicle) then {
                                    _vehicles pushBack _vehicle;
                                };
                            };
                        };
                    };
                };
            };
} forEach _targetsKnowledge;

->

private _targetVehicles = _targetsKnowledge apply {_x select 2}; //Filter out the vehicle's from the Arrays (That is what "_vehicle = _x select 2"; does in the original script)
_vehicles = _targetVehicles select {
    alive _x &&
    {isTouchingGround _vehicle && //Notice how I reordered the condition after the execution time they need.
    {_vehicle isKindOf 'AllVehicles' && //Only vehicles
    {!(_vehicle isKindOf 'CAManBase') && //Exclude Humans
    {(_vehicle distance2D _position) < _radius //Is in range
    }}}}
};
_vehicles = _vehicles arrayIntersect _vehicles; //Remove possible duplicates
#

Or alternatively (I prefer this. But Quiksilver does even the minimalistist and least useful microoptimizations so I guess he wants best performance and not readability)

private _targetVehicles = _targetsKnowledge apply {_x select 2}; //Filter out the vehicle's from the Arrays
_vehicles = _targetVehicles select {
    alive _x &&
    {isTouchingGround _vehicle} && //Exclude flying air vehicles
    {_vehicle isKindOf 'AllVehicles'} && //Only vehicles
    {!(_vehicle isKindOf 'CAManBase')} && //Exclude Humans
    {(_vehicle distance2D _position) < _radius} //Is in range
};
_vehicles = _vehicles arrayIntersect _vehicles; //Remove possible duplicates
meager heart
#

is it really need that "allvehicles" there ? ๐Ÿค”

still forum
#

I don't know what _targetKnowledge contains. There might be buildings in there. Or rocks/trees/street signs n stuff.
In that case it would really be needed. But if it only contains vehicles/units then it's useless

meager heart
#

kk

still forum
tough abyss
#

@queen cargo yes, it is faster in practice too, someone should add this to biki

still forum
#

comparison between nested if's and lazy eval would probably be useful too

tough abyss
#

Not clear enough

#

Should be emphasised

#

If speed is a factor the it should be nested all the time

#

Other examples not needed

still forum
#

Other examples are needed to show why they are bad

#

Actually.. That example doesn't even work

high marsh
#
class CfgRespawnPositions
{
  class tanoa
  {
    west_hq[] = {west,{2104.49,3426.79,0},"HQ"};
  };
};

Say I have a config like this, how would I get all of the positions inside the class tanoa?

tough abyss
#

But 99% of them are not nested, should be at least balanced

still forum
#

true || {{false} || {false}}
The {false} || {false} is syntax error

#

Can you do a test?
true && {true && {true}}
vs
true && true && true

I guess the first one is slower because it has the additional overhead of calling the code conditions

tough abyss
#

0.023 vs 0.014 for me

still forum
#

Yeah see. If the conditions are mostly true, the second variant is better

#

What matters most is that you know what your code is doing. If it's just a check to prevent a rarely occurring thing. Lazy-eval might not be the best choice

tough abyss
#

The text is fine on biki just need to emphasise that if you go for lazy eval it should be nested for better performance

still forum
#

@high marsh
https://community.bistudio.com/wiki/configClasses

_arrayOfSubclasses = "isArray _x" configClasses (configFile >> "CfgRespawnPositions" >> "tanoa");
{
_content = getArray _x;
_position = _content select 1;
} forEach _arrayOfSubclasses;
high marsh
#

Excellent, thank you. Had a brain fart.

still forum
#

Ah now I understood what you meant. Yeah. IF lazy eval then also nested yeah

tough abyss
#

Lazy-eval might not be the best choice I think it already says that

still forum
tough abyss
#

Overwritten under condition

still forum
#

Never used if condition doesn't return true

tough abyss
#

Probably left overs

#

Can sqf-vm find unused vars?

still forum
#

Afaik no

#

But I think the SQF Linters can

tough abyss
#

Another feature that would make it desirable

still forum
#

But I don't think they'd detect this example. Of a variable being assigned, but in a too high scope where it's always reassigned before being used

#

@meager heart wanna know what part of Code I myself can't understand?

#

I just can't make any sense out of this "code"

real tartan
#

This is my initial persistent testing. I am trying to execute "saveProfileNamespace only on server" from user action on object (bis_fnc_holdActionAdd executed on every machine). When I reload my mission, change is not saved on server's profile (dedicated server). Here is very simple test mission: http://701sog.cz/public/save.VR.zip . It contain 3 boxes. On each I change color and save it to server profileNamespace.

still forum
#

[0,1,_side] call (missionNamespace getVariable 'QS_fnc_AIGetKnownEnemies') Wat? You are already in mission namespace? Why do you call getVariable?
[0,1,_side] call QS_fnc_AIGetKnownEnemies ?!

#

@real tartan are you sure that the server's profile file has write access and such?

high marsh
#

Ded, doesn't work. Configlcasses doesn't even pickup tanoa as having any arrays

still forum
#

Ah duh.

#

yeah they are not classes

#

^ that

#

@real tartan the holdAction code doesn't execute on the server

#

it executes where you execute the action

real tartan
#

remoteExec ["bis_fnc_holdActionAdd", 0, true];

still forum
#

I can read

high marsh
#

Wow much bully Ded.

still forum
#

Doesn't change my statement

meager heart
#

@high marsh better store them manually without configs...

still forum
#

If you want to set the var on the server. You have to remoteExec the setVariable onto the server.
But you cannot remoteExec the getVariable part so that's gonna be a little inconvenient

high marsh
#

@meager heart I want to be able to throw new positions in there without manually writing static data. I also want to make it easier for the end user to change htem

still forum
#

@high marsh
configProperties [configFile >> "CfgRespawnPositions" >> "tanoa", "isArray _x"]

tough abyss
#

You donโ€™t want to remoteExec persistent function call to all on an object unconditionally. Use object instead of true, this way if object is deleted so is persistent call

still forum
#

if he uses a object instead of true. Only that object will get the action

#

He probably wants the action to show up for every player though

tough abyss
#

Wut?

still forum
#

Scratch that

#

Mixed up 0 and true

tough abyss
#

How do you scratch on mobile

still forum
#

๐Ÿค” Interesting. Thought you can use true as Target..
~~scratch~~

meager heart
#

@high marsh oh.. it is framework, i thought you was making mission there... then gl ๐Ÿ˜ƒ

high marsh
#

Thanks.

still forum
#

@real tartan your ] remoteExec ["bis_fnc_holdActionAdd", 0, true]; makes sure that the action is added for every client. But it has absolutely nothing to do with the code inside the action. That code is still locally executed. Thus not on server

real tartan
#

then I need to cuddle setVariable into function and remoteExec that function inside bis_fnc_holdActionAdd

#

and remoteExec it only for server

high marsh
#

Alright, so I got this working now. However, in the config west is indicated as a string?

still forum
#

yeah. It is

#

What did you expect?

high marsh
#

I expected it to be not a string?

still forum
#

Every "invalid" config value automatically get's wrapped as a string because otherwise it would be a syntax error

high marsh
#

Okay. That makes more sense

still forum
#

You can't just write scripts into config if that's what you expect

#

configs aren't scripts

high marsh
#

understood.

real tartan
#

_s = [[format["a3f_save_%1", _target], _color_new], "save.sqf"] remoteExec ["BIS_fnc_execVM", 2];

#

color did not changed after mission restart

#

thinking: loading wrong profileNamespace for initial state | profileNamespace not saving | setObjectTextureGlobal bug

still forum
#

loading wrong profileNamespace for initial state I already told you that, that was the case with your old script

#

_color_old = profileNamespace getVariable [format["a3f_save_%1", _target], "white"]; There. That code runs clientside

#

your serverside profileNamespace variable won't magically appear in every clients profileNamespace

#

just move the whole code to the server instead of just the save part

real tartan
#

_color_old = [[format["a3f_save_%1", _target], "white"], "load.sqf"] remoteExec ["BIS_fnc_execVM", 2];

#

load.sqf

#
diag_log format ["load.sqf | _variable: %1 | _defaultValue: %2", _variable, _defaultValue];

if !(isServer) exitWith { diag_log format ["load.sqf | load only from server"]; };

profileNamespace getVariable [_variable, _defaultValue];```
still forum
#

I already told you that, that doesn't work

#

why don't you just do what I recommend you to do?

real tartan
#

I am on learning curve. Don't tell me solutions, that way I feel like to go here to get work done for me.

#

I want some more "general solution" rather than solving problem with current script

#

And I did, load.sqf worked nicely

#

@still forum thank you! I appreciate your input

still forum
#

Problem is that remoteExec cannot return results back. So either you build something where you execute something on the server, then the server executes something back on you.
Or you just do everything on the server if possible

real tartan
#

remoteExec - Return Value: Anything - Nil in case of error. String otherwise. If JIP is not requested this is an empty string, if JIP is requested, it is the JIP ID. See the topic Function for more information.

still forum
#

It returns the JIPID which you can see in the last example

quasi thicket
#

Can anyone tell me if this following line is correct?

publicVariable "activatedAbort"; 
activatedAbort = false;
this addAction ["Upload Abort Codes", {activatedAbort = true; if (isServer) then {activatedAbort = true; publicVariable "activatedAbort"};}];```

Trying to put an addAction on a laptop which changes a variable to activate another trigger. At first i didn't make it a publicVariable, so it would only activate the trigger for the player that used the addAction, but i want it to trigger for everyone
still forum
#
publicVariable "activatedAbort"; 
activatedAbort = false;

Don't you want to swap these?

#

activatedAbort = true; if (isServer) then {activatedAbort = true; publicVariable "activatedAbort"}; ifServer will never be true unless self hosted multiplayer

#

Also use Tags on your global variables

quasi thicket
#

i don't know if i wanna swap there... i'm a terrible scripting noob ๐Ÿ˜›

still forum
#

Well... You know what publicVariable does? or not

quasi thicket
#

make it visible to all clients

#

that's about it ๐Ÿ˜›

still forum
#

Yeah. But if you set the variable after sending it to the clients

#

you throw warm air at the clients. And then take your potato out of the fridge

tough abyss
#

You probably donโ€™t want to let others upload codes if someone already did

still forum
#

The clients won't get hit by a potato that way

quasi thicket
#

yeah could probably do that by removing the addAction after it's been used

tough abyss
#

The action condition should rely on the activatedAbort value? If it is false, show, if true, hide

quasi thicket
#
activatedAbort = false;
publicVariable "activatedAbort"; 

this addAction ["Upload Abort Codes", {activatedAbort = true; publicVariable "activatedAbort"},nil,1,false,true];```
tough abyss
#

Otherwise you have to remoteExec remove so it could get ugly fast

quasi thicket
#

oh wait, that's not removing it

#

it's just "close the action menu after the action is used"

tough abyss
#

I donโ€™t know if you are putting the whole code you posted in init or only part of it, because it makes huge difference what is going to happen

quasi thicket
#
if (isNil "activatedAbort") then { activatedAbort = false; };

this addAction ["Upload Abort Codes", { missionNamespace setVariable ["activatedAbort", true, true]; }];

Someone suggested that on Reddit ๐Ÿ˜›

tough abyss
#

Yeah

#

Handles the variable better but far from perfect

quasi thicket
#

i think i will just disable JIP for the mission ๐Ÿ˜›

#

dont have to hassle with that

tough abyss
#

In MP you should do the logic in one place - server

quasi thicket
#

i don't wanna mention all the other spaghetti triggers i used in this effect :p

#

First i have a trigger that launches a SCUD missile, that enables a new objective to upload abort codes. At the same time, i start another trigger with a condition triggerActivated trgLaunch && !triggerActivated trgStartAbort; and a 600 seconds timeout that will trigger another trigger with the Lose Mission statement ๐Ÿ˜›

#

I also just realized while i wrote that there's nothing stopping the player from going to the laptop and uploading the abort codes before the missile is launched

#

oh wait, no i did think of that. The missile launch is triggered by blufor presence when they approach the SCUD. And the laptop is in that trigger zone

proven crystal
#

hello, im looking for a way to find all units available to a faction.
currently i use _availablegroups = ("true" configClasses (configfile >> "CfgGroups" >> _strside >> _faction >> _category)) apply {configName _x};
this finds me all groupclasses. for some reason i cant figure ot a way to get to an array of all units....

#

ideally by air,man,car...

proven crystal
#

i think this should give me all blu_f Men? _availablemen = "(configname (_x >> 'vehicleclass') == 'men') && ((_x >> 'faction') == 'BLU_F') " configClasses (configFile >> "CfgVehicles");

meager heart
#

you need getText there ๐Ÿค”

#

getText (_x >> 'vehicleClass') == 'Men'

#

getText (_x >> 'faction') == 'BLU_F'

proven crystal
#

hmm i tried with configname, slipped me in the code above (added it)

#

that returns me an empty array though

#

gettext indeed returns something

#

but thats an array of long paths now

meager heart
#
"(
    getText (_x >> 'vehicleClass') == 'Men' && {getText (_x >> 'faction') == 'BLU_F'}
)" configClasses (configFile >> "CfgVehicles") apply {configName _x}
```something like that ^
proven crystal
#

ah got it

#

availablemen = ("(gettext (_x >> 'vehicleclass') == 'Men') && (gettext (_x >> 'faction') == 'BLU_F') " configClasses (configFile >> "CfgVehicles")) apply {configName _x};

#

yep i kept forgetting code either on the one side or the other ^^ thanks

tough abyss
#

@still forum correct, I had to spawn my script which is fine because I don't need to return any variables and I don't need to watch for it to be done

proven crystal
#

i think i need to do this in a different wa. all the mods use their own variety of classes there.

#

how can i ask for parents, such as "Land" "Man"

still forum
proven crystal
#

excellent thanks

#

otherwise id have an issue because RHS seems to use a different vehicleclass for every camo pattern

astral tendon
#

Is there a specific command to make a single UAV crew? I want to make the driver from diferent side than the gunner.

winter rose
#

createUnit B_UAV_F for example, iirc @astral tendon

astral tendon
#

Did not find anything about B_UAV_F in Biki and google

#

Find it about B_UAV_AI though, I will see what I can get from that.

meager granite
#

What would be the way to remove icon from listnbox item? Setting "" with lnbSetPicture doesn't do anything, having thin invisible line as new picture add some padding before the text. What else can be done?

#

Setting invalid texture seems to remove the icon but create an error message

#

Thin vertical invisible line as picture seems to be the only solution here

#

2x64 of invisible pixels, no noticable padding compared to no picture

tough abyss
#

lnbDeleteColumn?

meager granite
#

Delete entire column?

austere granite
#

set empty texture

#

something something ca_empty.paa or something

#

Unless the indenting is a problem for you, I think for that what i always used to do wwas just set empty pictures by default, so at least they would be aligned

meager granite
#

Yes, picture has to be thin to look like there is no picture though.

tough abyss
#

Yes entire column with pictures in it

meager granite
#

Can you create column back in place of it later though?

tough abyss
#

Is this for some engine called control?

meager granite
#

Unless I have to keep column last all the time

#

Not sure what you mean

tough abyss
#

Ignore me, l donโ€™t understand what your doing

mild pumice
#

Hi guys, someone knows how to use setVectorDirAndUp correctly ? At the moment, i'm using setDir, setPosATL and modelToWorld to spawn something at a specific spot in a house, but it doesn't work in every case
https://i.imgur.com/hFqfJll.jpg

tough abyss
#

If you want to spawn something inside the house it is better to have relative coordinates, so you can attach it to these coords, set orientation then detach it

narrow musk
#

Quit arma like 3 years ago but hopefully my old script file is helpful here.

Attatch:

_vehicle = "classnameofitemhere" createVehicle position player; 
_vehicle attachTo [player, [3, 3, 3]];```

Detatch
```sqf
{ detach _x; } forEach attachedObjects player;
wet cobalt
#

a Noob question: does mods have to be run as servermod to hit the "isDedicated"-conditions?

still forum
#

No

wet cobalt
#

ok good ty. having some issues with ryan zombies having big conflicts with cars. Just wanted to scratch that theory real quick.

narrow musk
#

'Ryan Zombies' i know some of the exile boys have fixes for that if you can't figure it out.

#

Good luck tho, i have never used it.

wet cobalt
#

ye they pointed me towards the rz. And I noticed pretty fast that they are probably right. Need to find the cause my self though. Guessing on the caralarm feature. Thanks! :p

mild pumice
austere hawk
#

groan ok nvm... found the issue myself

#

when magic variables turn out to be not to be quite as magical, but instead produce errors because you nested them >.<

tough abyss
#

You can nest them

austere hawk
#

i get errors with (simplified)

{
    //do stuff with _x
    _somevariable = _someVariableUpperCase apply {tolower _x};
} forEach _arr1;
#

i get errors with (simplified)

{
    //do stuff with _x
    _somevariable = _someVariableUpperCase apply {tolower _x};
} forEach _arr1;
tough abyss
#

{{{systemchat _x} foreach _x} foreach _x} foreach [...]

#

{{{systemchat _x} foreach _x} foreach _x} foreach [...]

#

{{{systemchat _x} foreach _x} foreach _x} foreach [...]

austere hawk
#

maybe if they are supposed to be the same, but in this case it's not
_x in my _arr1 is a config
_somevariableUpperCase contains strings
result:
Error tolower: Type Config entry, expected String

tough abyss
#

Post simplified example that is real code and you will see it works

austere hawk
#

i can post full example that makes you see it doesnt work

still forum
#

Error tolower: Type Config entry, expected String that means _somevariableUpperCase doesn't contain strings

tough abyss
#

Works for me

austere hawk
#

_x input from a {}forEach _configPaths

{
_param_name= "EVDS_AffectedHitPointSelections";
_retrieve= (_x >> _param_name)call BIS_fnc_GetCfgData;
if (isNil "_retrieve") then {
    _retrieve= [(_x),_param_name,false] call BIS_fnc_returnConfigEntry;
};            
if (NOT(_retrieve isEqualType [])) then {
    diag_log ["EVDS ERROR: Config problem: Parameter ",_param_name," of hitpoint",(_HP_classes select _forEachIndex)," from vehicle ", _vclass ,"not found in config. Fix config! Assuming None[]"];
    _retrieve = [];
};
//convert all to lower case 
diag_log ["EVDS CfgCache Veh: retrieve of EVDS_AffectedHitPointSelections before applying tolower:",_retrieve];
diag_log ["EVDS CfgCache Veh: _HP_data before pushback of retrieve affectedHPsel",_HP_data];
        
if (count _retrieve > 0) then {
    _retrieve = _retrieve apply (tolower _x);
};
//these are just the classes, we need to aquire the IDs after this whole loop -> See line ~340        
_HP_data pushBack [_retrieve,"TODO-ID-Placeholder"]; //affectedHPsel[] to first element of index 5
}forEach _configPaths;

diag_log lines from rpt

diag_log ["EVDS CfgCache Veh: retrieve of EVDS_AffectedHitPointSelections before applying tolower:",_retrieve];
diag_log ["EVDS CfgCache Veh: _HP_data before pushback of retrieve affectedHPsel",_HP_data];
still forum
#

๐Ÿค” That doesn't seem correct

#

the RPT lines

#

๐Ÿ˜„

austere hawk
#

line with apply is where i get the error

still forum
#

your rpt lines are wrong

austere hawk
#

oops yeah because i took them from the script, not the config...

still forum
#

Ahhh

#

_retrieve apply (tolower _x);

#

apply doesn't take string on right side

#

wrong braces

austere hawk
#

fuck me... i could have sworn that where curly brackets but i'm already seeing blurry

#

lesson learned

#

wear glasses

tough abyss
#

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

#

How did it not error wrong type?

still forum
#

because it already errored before toLower could run

austere hawk
#

i was getting mixxed errors - generic expression error and also "got code expected string" at some point while trying to debug and fumbling around like a fool

tough abyss
#

Thatโ€™s the one

#

Got string expected code maybe?

austere hawk
#

too late

still forum
#

use a proper IDE with a linter. For example VSCode

#

I think Golias' SQF Linter should detect that

tough abyss
#

Apply mother***r apply, why donโ€™t you apply?

austere hawk
#

exactly... i wanted to be snazzy like all the cool dudes and use apply instead of a for 0 to igoplaces

tough abyss
#

Premature optimisation

still forum
#

apply is the right tool for the job here though

#

wouldn't call "taking the right tool" a optimization

austere hawk
#

yeah, it occured to me, which is why i wanted to use it. But i was in the believe (first mistake...) that you cant nest two magic variable using things

#

but i forgot that when trying apply the first time (here)...

#

but real question now - you said foreach can be nested no problem

{
      {
             // how do i use the _x from the outer loop in this nested one ?
       }forEach _arrC
}forEach _arrP;
still forum
#

{
    private _outsideX = _x;
      {
             // use _outsideX and _x
       }forEach _arrC
}forEach _arrP;
austere hawk
#

ok... yeah... makes sense

astral tendon
#

Is there a way to disable control of a UAV driver?

austere hawk
#

ok maybe really dumb but general question - how do i best live code precompiled functions?
way i do it now is stupid time wasting i suspect -> write the .sqf functions, define in cfgFunctions , pack addon, launch game and mission, fail, repeat.

still forum
#

Go to debug console.
functionName = {code};

Execute. Try. Fail? edit code in debug console and execute again to replace function. Try again.

austere hawk
#

the functions are too many and too complex to be comfortably edited in debug console

still forum
#

If you'd use the CBA system you could recompile all functions with a single click. But that might be too much work

#

enable filePatching. Let your scripts be loaded that way. Then you only have to restart the mission to make it recompile I think

austere hawk
#

so i need to replace all the TAG_fnc_myfunction with discrete path values to the .sqf files?

still forum
#

no

#

Setup your p-drive for filePatching

#

it will automatically load the scripts from there instead of your pbo

#

just like with models/textures and so on

tough abyss
#

You can disconnect player driver from UAV @astral tendon

astral tendon
#

How?

austere hawk
#

p-drive is set up, anything else for filepatching to do with it? Launching A3 with filepatch tag, ok i have that
Not sure how to have it load scripts from P drive instead of my @modfolder - does that do it automatically?

#

also, how to specify what i want filepatched and which not? I dont want other addons (e.g. large models) to load from P-drive, takes ages (compared to binarized ones)

tough abyss
still forum
#

Arma tries to load everything from Arma directory first. And if it doesn't exist it takes it from pbo

#

so if you have a file in x\stuff\file.sqf inside your PBO. And also Arma 3\x\stuff\file.sqf. It will take the one from Arma folder

#

so in that example you have a x folder next to your arma3.exe

austere hawk
#

so i can just put it(that folder) directly in the arma folder and skip P drive? ok that i like

tough abyss
#

pop quiz:

#

what's the best way to get a vehicle to move like it's being piloted

#

but keep it local

unborn ether
#

inivisible AI unit on driver

#

X-files music

still forum
#

X-drivers music

unborn ether
#

2Fast2Arma

still forum
#

hey can you add reactions to my messages? Or do they disappear when you try?

#

I mean that @unborn ether guy :u

#

I know that you can ๐Ÿ

unborn ether
#

Your messages are so advanced, so my screen shakes when i try so ๐Ÿ˜„

tough abyss
#

okay but unironically

#

trying to have a local cutscene

still forum
#

Ahh. So we solved the mistery. You can detect if people have blocked you that way

unborn ether
#

๐Ÿ‘€ I didn't

tough abyss
#

yeah

#

you can't react to people's posts

#

if they have you blocked

austere hawk
#

oh darn, my secret life people sniffer is now public...

austere hawk
#

a function can spawn itself, right?

ruby breach
#

Yes. Beware recursion

winter rose
#

You should google recursion

tough abyss
#

^^^ this ๐Ÿ˜‰

dusk sage
#

Only in a while true

rough heart
#

๐Ÿฟ

wary vine
#

any idea why i get spammed Attempt to override final function - lega_fnc_gangmanagement_server_fetchgangs with a compileFinaled pvar on the server ?

meager granite
#

You're broadcasting it while its already defined on client

tough abyss
#

is it possible to make players move while BIS_fnc_cinemaBorder is in effect?

tough abyss
#

Create overlay yourself

sonic bane
#

Does anyone know why this doesn't work?

    while {ctrlShown _RscSlider_1900} do {
         systemChat "123";
        };        
tough abyss
#

Undefined control?

sonic bane
#

Nope

#

while {ctrlShown(findDisplay 0 displayCtrl 999 getVariable '_comb#101')} do {

#

This one doesn't work aswell

tough abyss
#

Do systemchat str _rscslider_1900 just before the loop

sonic bane
#

okay

#

```systemChat format["%1", _RscSlider_1900];``
does return the idc.

tough abyss
#

What number?

sonic bane
#

Yeah

#

control #12067

tough abyss
#

Ok and systemchat str ctrlShown _RscSlider_1900; ?

sonic bane
#

returns true

#

Its like the while loop doesn't even check it just skips it

#

really weird

tough abyss
#

That is some sorcery

sonic bane
#

ikr

#

nvm

#

ik why

#

now

proven crystal
#

hello again. i have an issue with UAVs. when i spawn a group with BIS function using an array, i dont see UAVs flying.

#

i see that UAVs are being set up by the soldiers, but then the dont launch

thorn saffron
#

Does anyone knows if the ballistic computer display scripting stuff is somewhere that we can access?
Alternatively: is there a way to get position data for the calculated impact point or the target lead indicator? Just so I can draw a 3d marker over that position.

austere hawk
#

afaik it's not possible. You can use a simple ballistic curve formula for calculating the solution manually, for A3 vanilla artillery however -> it doesnt have airfriction on the shells

#

if you want to also do it for stuff with airfriction things get more tricky

thorn saffron
#

The reason why it shows up in the gunner camera seems to be because BIS hardcoded the ballistic computer to show up ONLY in gunner view. Meaning you can't get it even if you are in first person, but not in gunner view.

#

That is why I'm looking for way to get the CCIP data

#

That data has to exist as it is passed to the MFD HUD so it can be displayed if you had that configured

#

I'm looking for a way to get that in 3rd person

austere hawk
#

yeah no ballistic computer is like a black box - no way to access it, not even the outputs. Shitty system.
Just like the new radar. neat functionality but no way to access it in any way.

thorn saffron
#

if there was a command like getCCIPpos [vehicle, weapon] and getTLIpos [vehicle, weapon] we could do a lot of fun stuff with it

#

sadly we are stuck having to script completely new system because bis does not give us any access to the data

austere hawk
#

but ccip is an entirely different system altogether, and not designed for very long range stuff (the longer the range, the higher the computational cost) - pretty sure there is some sort of cap put on how far and strong the curve can be for ccip

#

exactly... i#ve been moaning in the dev forum feedback for the radar on several occasions for exactly this reason (politely of course). Deaf ears.

#

such a waste of potential...

fringe yoke
#

Does anyone know a way to get all the variables set on a object or namespace using setVariable?

tame lion
fringe yoke
#

๐Ÿ‘ Yeah that will do it, thanks!

tame lion
#

note that it will only return the variable names, not their values

#

you'd have to take an extra step to do that

austere hawk
#

so for the custom vehicle damage system i work on i need a way to do a MP score system, as the system scripts damage, so everything that dies through the script is otherwise lost for the purpose of score (also for killed EH's)

My plan is to let mission creators/admins define a function name (via string in a global mission var) that gets executed remotely on server

private _scoreFNC = missionNamespace getVariable ["EVDS_score_fnc",""];
if (_scoreFNC != "") then { 
 [_victimvehicle,_instigator,"kill"] remoteExec [_scoreFNC,2]; 
};```
What happens when i pass the victim like that, that is already dead and might be deleted quite soon after?  Is there a chance that the score function when executed will just end up with a non-existing object?
still forum
#

yeah. It could receive a nullObj

austere hawk
#

hm...

#

i could pass the classname of the unit instead... would lose some options of what is possible in the score function then though

#

instigator could also be dead by the time the vehicle explodes (after burning a while)... damn.

dusky pier
#

i'm trying take % from number. For example 10% from 6

still forum
#

6* 0.1 -> 0.6

frigid raven
#

heya guys

dusky pier
#

i tryed for this linearConversion ๐Ÿ˜„

still forum
#

Well technically you could

tough abyss
#

is there any way to return a true value if a player has disconnected in the past 5 minutes?

#

Hm

#

Well

#

I guess I can just use initPlayerLocal

#

and do some waitUntil

austere granite
#

player based on what? generally you do a disconnect EH on the server, then keep an array of UID and servertime to see when someone disconnecte

tough abyss
#

basically, what i want to do is add support for if someone disconnects or is a JIP

#

i want them to be able to teleport to a command vehicle

#

but if they just die normally, they have to wait for logistics

#

and honestly, just adding a waituntil in initPlayerLocal will suit that need fine

#

i don't think it has any performance implications either

astral tendon
velvet merlin
#

is there some particular faster/fastest way to count the number of occurances of different strings into a large array (100k to 1+m elements)

#

with as result an array like

 [9999,"XXX"],
 [1111,"YYY"],
 [555,"AAA"],
...
]```
#

what about sort array, count array, take first element, remove -[element] to drop all its duplicates, count array to get the amount, repeat

errant herald
#

Hello everyone,

I'm getting a 'Type Array, Expected Object' error with this script:

_car = _this;

while{alive _car} do { 

    if ((_car animationSourcePhase "light_source") == 0.75) then {
        _car setHit ["Light_L",0];
        _car setHit ["Light_R",0];
    } else {
        _car setHit ["Light_L",1];
        _car setHit ["Light_R",1];
    };
    sleep 0.01;
};
#

would anyone happen to know why?

austere hawk
#

can i

switch (_true) do {
 _write = _code + _here+ "?" ;
 case (_condi1): {_result=_write + ".";};
 case (_condi2): {_result=_write + "!";};
}; 
dusk sage
#

yes @austere hawk

#

@errant herald How is that being called? What is being passed? Do you understand what _this is?

errant herald
#

@dusk sage I think I've got it

dusk sage
#

๐Ÿ‘

errant herald
#

I got it!

#

was calling it wrong ๐Ÿ˜›

tough abyss
velvet merlin
#

ty. sounds about right. will check the implementation

#
paramsCheck(_this,isEqualType,[])

private _cnt = count _this;
private _cntNil = count (_this - _this);
private _ret = [];

{_ret append [[_x, _cnt - count (_this - [_x])]]} count (_this arrayIntersect _this);

if (_cntNil > 0) then {_ret pushBack [nil, _cntNil]};

_ret```
#

arrayIntersect makes this fast i'd assume. thus simple and elegant

tough abyss
#

I donโ€™t know about million + elements but engine iteration will probably be faster than if you construct it in sqf

calm bloom
#

Hello, comrades! Does anyone know if battleye allows to whitelist logged admin to use console?

tough abyss
#

is there a function or command to return a true value when the player is able to see the world

calm bloom
#

thanks

tough abyss
#

๐Ÿ‘

#

There is an event handler PlayerViewChanged I would expect it will be connected to what player sees. It is local to client.

high marsh
#
Fired on player view change. Player view changes when player is changing body due toย teamSwitch, gets in out of a vehicle or operates UAV for example.
tough abyss
#

agreed

tough abyss
#

im not sure if this is possible, but im trying to make it where players are still able to move while BIS_fnc_cinemaBorder is in effect because normally it prevents all movement when it's activated, is there any way around this?

meager heart
#
0 spawn {
    ("BIS_fnc_cinemaBorder" call BIS_fnc_rscLayer) cutRsc ["RscCinemaBorder", "PLAIN"];
    playSound "border_in";
    sleep 5;

    ("BIS_fnc_cinemaBorder" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
    playSound "border_out";
};
```into debug console ^ @tough abyss
tough abyss
#

this is a good start, is there a way to give the borders a smooth transmition (sliding in and out of the screen)? @meager heart

meager heart
#

yeah...

#

layer cutRsc [class, type, speed, showInMap] < speed there

tough abyss
#

thanks! i'll give it a shot

meager heart
#

glhf

neon snow
dusk sage
#

You also don't need to use BIS_fnc_rscLayer, you can just supply that string as layerName in layerName cutRsc [class, type, speed, showInMap] , see alt. syntax #2 @tough abyss

meager heart
#

or just number, or nothing...

#

and he can't "supply that string" there ๐Ÿ˜ƒ

dusk sage
#

Giving a number is just going to give rise to conflicts, and yes, he can

#

Unless that is a specific layer that already exists?

meager heart
#

yep

dusk sage
#

Then again, I don't see why it wouldn't also still grab the layer

#

So it should be fine

meager heart
#

first layer in allCutLayers is "" and reserved for usage in cut commands without layers names

tough abyss
#

im very new to this so pls correct me if i did something wrong,

i did some changes and did this instead (same effect as @languid forge 's code from earlier)

    cutRsc ["RscCinemaBorder", "PLAIN", 1.8]; 
    playSound "border_in"; 
    sleep 5; 
 
    cutRsc ["RscCinemaBorder", "PLAIN", 1.8]; cutText ["", "PLAIN"]; 
    playSound "border_out"; 
};```

still no smooth transition though
dusk sage
#

Supplying the layer name to cutRsc will create and or use that layer

#

Given that is it already a layer, it'll pick up the correct one

tough abyss
#

so with cutRsc i cant make the borders slide down like how BIS_fnc_cinemaBorder does it?

neon snow
#

Can I simulate a key press?

meager heart
#

ok what about this >

0 spawn {
    disableSerialization;
    "blake_cinemaBorder" cutRsc ["RscCinemaBorder", "PLAIN"];
    private _borderDialog = uiNamespace getVariable "RscCinemaBorder";
    private _borderTop = _borderDialog displayCtrl 100001;
    private _borderBottom = _borderDialog displayCtrl 100002;
    private _height = 0.125 * safeZoneH;
    private _offset = 0.1;
    showHUD false;

    _borderTop ctrlSetPosition [safeZoneX - _offset, safeZoneY - _height - _offset, safeZoneW + 2 * _offset, _height + _offset];
    _borderBottom ctrlSetPosition [safeZoneX - _offset, safeZoneY + safeZoneH, safeZoneW + 2 * _offset, _height + _offset];
    {_x ctrlCommit 0} forEach [_borderTop, _borderBottom];

    _borderTop ctrlSetPosition [safeZoneX - _offset, safeZoneY - _offset, safeZoneW + 2 * _offset, _height + _offset];
    _borderBottom ctrlSetPosition [safeZoneX - _offset, safeZoneY + safeZoneH - _height, safeZoneW + 2 * _offset, _height + _offset];
    {_x ctrlCommit 5} forEach [_borderTop, _borderBottom]; 

    waitUntil {
        sleep 1;
        ctrlCommitted _borderTop &&
        ctrlCommitted _borderBottom
    };

    sleep 5;
    "blake_cinemaBorder" cutText ["", "PLAIN"];
    playSound "border_out"; 
    showHUD true;
};
```lets hope BoGuu will like that name > "blake_cinemaBorder" ๐Ÿ˜ƒ
#

@tough abyss

tough abyss
#

No. A control button press, yes

neon snow
#

@tough abyss what do you mean by that?

tough abyss
#

I mean exactly what I wrote, what is unclear?

#

@meager heart the borders slide in just the way i want it to however it does not slide out, also i love the layer name lmao

meager heart
#

well... you can use ctrlSetPosition and "slide" them out ๐Ÿ˜ƒ

tough abyss
#

for reference, im trying to mimic what halo does with the black bars and text on the bottom right

neon snow
#

I dont understand what do you mean by "control button press"

#

You may call me stupid, I just dont get it

meager heart
tough abyss
#

UI dialogs with button, you can press button by script, thatโ€™s about the only time you could replace user interaction

neon snow
#

Ok thank you, so basicly inputAction actions are untouchable by scripts(you can detect them but not execute)

tough abyss
#

Some of them could be called using action command, like Gear for example. But majority donโ€™t have scripted action. And you asked about simulating key press and not wether or not there is a scripted way to launch some action, because as I was trying to explain, some actions can be scripted, most not.

neon snow
#

Yes I know, I just asked about simulating key press as I asked about some actions earlier, few days ago. There is no way to to lock vehicle/target via script, and Dedmen was trying to help me finding action for that but he didnt find it. I thought today that if there is inputAction command than there is some command to inverse that and for example simulate the DIK Code press

tough abyss
#

You could do that via extension probably, send a key press to the system

void badge
#

Hi! I'm trying to center a RscText inside its control but it seems ST_CENTER is not changing the alignment :/

astral tendon
#

Unit inits start frist than the InitServer.sqf?

tough abyss
#

Way way before initserver

astral tendon
#

/\ I already read that, what part represent the unit init?

#

oh Objects not only units

#

I see,I was trying to make a fucntion to work as a normal script in InitServer.sqf and them make the unit call it.

tough abyss
#

If you add your function to cfgFunctions you can call it from unit init

astral tendon
#

Yeah, I was just jumping steps for laziness.

tame lion
#

when scripting for a headless client, how do i reference the client internally? (similar to how player refers to the player on a regular client)

tame lion
#

i know you can name the clients to reference them, but that doesn't help me with what im trying to do. I'm trying to make each of them display their current FPS on a map marker generated on their position with their names on them which updates every couple of seconds with their fps.

velvet merlin
#

crash/shutdown the HC and have a looping batch script or sth to restart the HC exe if its down?

peak plover
#

HC is using the same exe

#

It should be the same

#

I don't think arma client/server can tell other servers and clients to restart

velvet merlin
#

well just duplicate the exe and use the second for HC startup

unborn ether
#

@tough abyss You can't restart HC

#

And tbh why would you need to restart it?

dusky pier
#

@tough abyss use .bat file.

#
 taskkill /IM arma3server_x64.exe
#

you can rename your exe and kill HC process without server.

tough abyss
#

how to force-restart a headless client exe? make extension

tame lion
#

@tough abyss I've tried using player in the HC scripting and it doesn't seem to work

nocturne basalt
#

Can a backback trigger a script when picked up or dropped?

nocturne basalt
#

Those eventhandlers must be set on the man right? Didnt work putting them on the backpack

quartz coyote
#

Hello, i'd like to trigger a

{_x setdammage 1.0} foreach thislist;```
only to opfor player in the area of the trigget
#

I guess I'd need to change the thislist ?

#

or probably the foreach is not adapted to this situation

still forum
#

{_x setDamage 1.0} forEach (thisList select {side _x == opfor});

hollow thistle
#

setMousePosition [0.5, 0.5]; should set the mouse in the middle of the screen? Shouldn't it ?

#

Since I got 3rd monitor it sets my cursor in lower right corner ๐Ÿค”

#

getMousePosition returns [0.5, 0.5] when cursor is in middle of the screen. ๐Ÿ™ƒ

still forum
#

(โˆฉ๏ฝ€-ยด)โŠƒโ”โ˜†๏พŸ.*๏ฝฅ๏ฝก๏พŸ

drowsy axle
#

Is there anything wrong with? ```sqf
c_outpost_tel addAction ["Teleport: USS Freedom", {

hq sideChat format["%1, please wait 7 seconds for transportation..",name player];
[outpostTerm,3] call BIS_fnc_dataTerminalAnimate;
sleep 5;
[outpostTerm,0] call BIS_fnc_dataTerminalAnimate;
sleep 2.5;
player setPosATL (getPosATL c_freedom_obj);

}];``` As I seem to be having a locality issue. Works in SP.

still forum
#

What exactly doesn't work in MP?

#

the sidechat, the teleportation or the animation

drowsy axle
#

Teleport

still forum
#

That should work.

#

Maybe the script is unscheduled and you cannot sleep in there?

drowsy axle
#

The side works and displays the correct name. (only for that person, no one else sees the sidechat).