#arma3_scripting

1 messages · Page 525 of 1

still forum
#

Buildings are vehicles 😉

quartz coyote
#

gotcha

#

looking

#

found it

#

["NonStrategic","Building","Static","All"]

#

Ok now I know how to do that as well. thx guys !

#

Ok so I just found out I didn't have to go through all that. I couldn't find it because i'd set the object as simpleObject and it wasn't taken into account by nearestObjects

dusky wolf
#

I have a radio trigger set up to pause all AI in the mission. Is there a way to limit it to just a few players in the mission file, preferably by class name?

vagrant mango
#

How difficult is it to iterate through all of the wheels on an IFV via scripts? I want to add an AddAction for a special type of re-sealable/inflatable set of tires that the commander can use once.

astral dawn
#

It's not hard, here's my code that iterates through wheels and tracks

AI_misc_fnc_isAnyWheelDamaged = {
    params [["_veh", objNull, [objNull]]];
    
    (getAllHitPointsDamage _veh) params ["_names", "_selections", "_damages"];
    pr _repairNames = ["wheel", "track"];
    pr _return = false;
    scopeName "s0";
    for "_i" from 0 to ((count _names) - 1) do
    {
        pr _name = _names select _i;
        // Repair wheels
        pr _isWheelOrTrack = (_repairNames findIf {_name find _x > 0}) != -1;
        if (_isWheelOrTrack) then {
            if (_damages select _i > 0.89) then {
                _return = true;
                breakTo "s0";
            };
        };
    };
    
    _return
};
vagrant mango
#

Dope.

winter rose
#

¿ pr ?

still forum
#

priv

quartz coyote
#

I'm creating a camera scene and I'd like to set the camera target to the front of a moving vehicle. How could I do that ?
This isn't working

_camera = "camera" camCreate [0,0,0];
_camera cameraEffect ["internal","back"];

_camera camSetTarget [1215.573,3865.788,2];
_camera camSetPos [getPosATL player select 0,getPosATL player select 1,(getPosATL player select 2)+200];
//_camera camSetFOV 0.5;
_camera camCommit 0;
waitUntil {camCommitted _camera};
[format["<t color='#FFFFFF' font='PuristaMedium' shadow='2' size='%1' align='left'>Created and Scripted by<br/>Flash-Ranger</t>",_size],-1,0,8,3,0,4002] spawn BIS_fnc_dynamicText;
sleep 10;

["someId", "onEachFrame", {_camera camSetTarget [getPosATL vehicle player select 0,(getPosATL vehicle player select 1)+10,getPosATL player select 2];}] call BIS_fnc_addStackedEventHandler;
_camera attachTo [(vehicle player),[0,0,2]];
_camera camCommit 0;
waitUntil {camCommitted _camera};
["someId", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
sleep 20;
player cameraEffect ["terminate","back"];
camDestroy _camera;```
I understand why tho, but would you guys have another solution
still forum
#

you can make the camera follow the vehicle

#

but I don't think you can let it follow the front

quartz coyote
#

mmmh...

still forum
#

Ah wait

#

Didn't fully see what you're doing there

#

_camera variable in first line is undefined

quartz coyote
#

this is only part of the script. let me compete it

still forum
#

whatever part is infront of that. _camera is undefined

#

the eachFrame handler is a seperate script. Local variables don't carry over to other scripts

quartz coyote
#

ah

#

that's different

#

yes indeed

#

I know that. That's why I was saying it wasn't working ^^ you taught me that 😄

still forum
#

Well if you know that's what's wrong. Why don't you fix it then?

#

you can make the camera a global variable. Or pass it into the eventhandler via the arguments

quartz coyote
#

I made it a global variable but it didn't work either

#

Still not working

["someId", "onEachFrame", {_camera = _this#0; _camera camSetTarget [getPosATL vehicle player select 0,(getPosATL vehicle player select 1)+10,getPosATL player select 2];}, [_camera]] call BIS_fnc_addStackedEventHandler;
_camera attachTo [(vehicle player),[0,0,2]];
_camera camCommit 0;
waitUntil {camCommitted _camera};
["someId", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;```
still forum
#

what exactly is happening?

#

If you remove the eachFrame EH it will ofc stop updating position

#

the waitUntil will only wait very briefly

quartz coyote
#

what is happening is that it is still targeting my previous target and not taking this new one.
I know, I need to delete the waitUntil. anyways I have a sleep 20; just after.

still forum
#

what is your previous target?

#

and removing the waitUntil is not the solution

#

that way your eachFrame EH is removed even sooner

quartz coyote
#
_camera = "camera" camCreate [0,0,0];
_camera cameraEffect ["internal","back"];

_camera camSetTarget [1215.573,3865.788,2];
_camera camSetPos [getPosATL player select 0,getPosATL player select 1,(getPosATL player select 2)+200];
//_camera camSetFOV 0.5;
_camera camCommit 0;
waitUntil {camCommitted _camera};
[format["<t color='#FFFFFF' font='PuristaMedium' shadow='2' size='%1' align='left'>Created and Scripted by<br/>Flash-Ranger</t>",_size],-1,0,8,3,0,4002] spawn BIS_fnc_dynamicText;
sleep 10;

["someId", "onEachFrame", {_camera = _this#0; _camera camSetTarget [getPosATL vehicle player select 0,(getPosATL vehicle player select 1)+10,getPosATL player select 2];}, [_camera]] call BIS_fnc_addStackedEventHandler;
_camera attachTo [(vehicle player),[0,0,2]];
_camera camCommit 0;
waitUntil {camCommitted _camera};
["someId", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
sleep 20;
player cameraEffect ["terminate","back"];
camDestroy _camera;```
still forum
#

Yeah you posted that above

#

did you check if the EachFrame EH is even executed once?

quartz coyote
#

No true.
I'll put a systechat in there to see what happens

#

okay nope it isn't executing at all

still forum
#

then maybe your waitUntil doesn't sleep at all and you remove the EH before it can execute

quartz coyote
#

crap indeed... my remove was before the 20 seconds pause instead of after .....

#

okay so now it is executing because I see my systemChat flooding my screen but it's not taking my target ....

still forum
#

missing camCommit

quartz coyote
#

smart

#

working

#

thx

umbral oyster
#

Which command removes the standard action on the mouse wheel? like "Open door"?

winter rose
#

@umbral oyster none

umbral oyster
#

Sadly

tough abyss
#

You can hide

#

With showHud but it will hide all actions

umbral oyster
#

no, i need only for one object

tough abyss
#

Then you need addon

quartz coyote
#

Hi all.
I'm creating then deleting a waypoint. But i'm getting an error on deletion Error: type Array, expected Number Can someone find my mistake ?

_wp1 = DDAY_grp1 addWaypoint [getMarkerPos "attack01", 0];
_wp1 setWaypointType "Move";
_wp1 setWaypointCombatMode "Red";
_wp1 setWaypointBehaviour "Aware";
_wp1 setWaypointSpeed "Full";
_wp1 setWaypointFormation "Line";

[...]

deleteWaypoint [DDAY_grp1, _wp1];```
still forum
#

Check again what addWaypoint command returns, and what deleteWaypoint command wants as arguments

rigid bloom
#

Guys, please help. I need to put an object relative to the mouse position and I ran into a problem. I use lineIntersectsSurfaces and screenToWorld, but screenToWorld returns the position relative to terrain. I need to put the object above the horizon line and I think I need to use positionCameraToWorld, but how to make the mouse position be taken into account. Sorry for my English if I misspelled something.

quartz coyote
#

Go it

#

thx

still forum
#

returns the position relative to terrain what's the problem with that?

rigid bloom
#

I tried to use this command, but it doesn't take terrain into account. Accordingly, I will not be able to put the object at a position that is above the horizon

still forum
#

screenToWorld returns the position on the terrain that you're aiming on

#

It does take terrain into account

rigid bloom
still forum
#

Not sure which LOD it uses to intersect. Might be GEO lod

rigid bloom
#

I used VIEW and GEOM, but it also didn't solve the problem.
Here is a good example of how it works. https://ibb.co/nM0wJLn
Arrow is in position below the red line, and I, for example, you need to put the object at the point where the mouse is over the red line (the blue circle)

still forum
#

which distance does that need to work on?

rigid bloom
#

not more than 100 meters

still forum
tough abyss
#

//200m infront of you that would be [0,0,200]

still forum
#

Not XYZ?

#

XZY 🤔

#

ffs

rigid bloom
#

Oh. Now I understand, but this is if I would need to put an object in the center of the screen. But it is necessary to put the object on the position of the mouse

#

I think it should look something like this, but with some wild math

getMousePosition params ["_xpos","_ypos"];
_pos1 = agltoasl ( positionCameraToWorld [ 0,0,0 ] ) ;
_pos2 = agltoasl ( positionCameraToWorld [ _xpos,-_ypos,200 ] ) ; 
_re = lineIntersectsSurfaces [ _pos1 , _pos2 , player , objNull , true , 1 , "VIEW" , "NONE" ] ;
still forum
#

positionCameraToWorld doesn't take mouse position :/

rigid bloom
#

I understand this, but it seems to me that through this method you can somehow get the same result as with screenToWorld, but with the correct position for the object. However, I do not yet understand how to do it.

digital hollow
#

Are you trying to get the line from camera to mouse?

rigid bloom
#

Yes

digital hollow
#

screenToWorld getMousePosition

#

Like Dedmen said

#

That should be your _pos2

rigid bloom
#

If I move the mouse for example in the ceiling of the house in which I am, the object is not put in this point. It will be placed in a position that is not above the terrain line. Therefore, this method did not win

#

The problem with screenToWorld will be clearly visible on the VR map. If you create a house on the ground and try to point the mouse at the roof of the house, your position with lineIntersect will be somewhere at a height of not more than 2 meters, but not on the roof of the house, where the mouse points

still forum
#

screenToWorld finds the terrain position. If you aim into the sky.. there is no terrain there

rigid bloom
#

That's why I say that screenToWorld does not give the desired result

digital hollow
#

Maybe use the camera vector, find the fov, get the partial angle using mouse position

surreal adder
#

hey, how can i make an addon that adds a new function to the game?

#

like, a new script function

tough abyss
#

you dont need addon for that

astral dawn
#

for combining existing SQF operators into a scripted function you don't need it, you just wrap them into {} brackets and then call it
if you mean to add a new SQF command/operator like player doMagic 123; then you can use Intercept addon

surreal adder
#

nah, i'd like it in an addon, because it has custom assets, and so i can use it in multiple missions without having to readd the script and assets

#

and without bloating the mission filesizes

tough abyss
harsh sphinx
#

Is there any way I can find a list of available speech options that can be used in the conversation system?

winter rose
#

CfgWords in config explorer yes

harsh sphinx
#

Thanks, legend. I somehow totally missed that.

winter rose
#

please use and abuse this page (and bring feedback if it were eventually incomplete or unclear)

next scaffold
#

Hi, I’m trying to attach an object to the player and make it look like it is attached to the backpack. My question is, what’s the memory point the backpack uses to move? I have tried with spine, spine 2 and spine 3. None seems to give the desired effect.

surreal adder
#

@tough abyss thank you, much appreciated

drowsy axle
#

I've forgotten how to pass information (params) into a forEach.

next scaffold
#

_x ? @drowsy axle

oblique vale
robust hollow
#

Can someone explain why they use 'spawn' instead of a normal call here?
no. there is no good reason.

that specific display waituntil is pretty pointless too

oblique vale
#

Ah okay, thank you for confirming

tough abyss
#

This script seem to be running in scheduled already no need to spawn another script from it and wait for it, if it is called the original script would wait for it to finish

chrome forge
#

Good morning all. I'm not as gifted as most of you are in terms of scripting and appreciate the scripts that you all have here on discord. I attempted multiple times browsing Armaholic and other sites for an enemy aviation script. I see it all the time in Invade Annex servers but wanted to place it in my EOS mission. Ideally looking for enemy aircraft to spawn at a certain frequency, fly over the mission at random and respawn after being shotdown. Any help? Thank you for your time. Please do an @ to let me know.

tough abyss
#

Try this:

SQF_fnc_flyThrough = 
{
    private _startPos = player getRelpos [1000, 180];
    private _plane = createVehicle ["B_Plane_CAS_01_dynamicLoadout_F", _startPos, [], 0, "FLY"];
    private _velocity = velocityModelSpace _plane;
    
    _plane setDir (_startPos getDir player);
    _plane setVelocityModelSpace _velocity;
    
    createVehicleCrew _plane;
    _plane doMove (player getRelpos [1000, 0]);
    
    _plane addEventHandler ["Fuel", 
    {
        _this select 0 removeEventHandler ["Fuel", _thisEventHandler];
        
        [] spawn
        {
            sleep 10; // respawn next plane in 10 seconds
            call SQF_fnc_flyThrough;
        };
    }]; 
    
    _plane setFuel 0.005;
};

call SQF_fnc_flyThrough;
#

why setVelocityModelSpace is not highlighted, what is this blasphemy?

drowsy axle
#

@next scaffold I don't mean _x

winter rose
#

@drowsy axle sqf { _x params ["_unit", "_damageValue"]; _unit setDamage _damageValue; } forEach [ [unit, damage], [unit, damage], [unit, damage] ];?

chrome forge
#

Thank you!

#

@tough abyss will this just loiter or do I need to set marker on map?

fluid wolf
#

Hey can anyone help me with this little snippit? I had it working at one point but I cant figure out what i did to do so, and its not working anymore

#

elevator = (nearestObjects [(getpos SpaceElevator), [], 600]); {this setFeatureType 2} foreach [elevator]

astral dawn
#

put a ; at the end of it?

fluid wolf
#

doubtful, it doesn't return an error it just doesn't have an effect.

astral dawn
#

just don't delete the ; to be safe

#

can I just have a look at the space elevator? 😄

#

oh wait I see the error!

#

foreach [elevator]

#

should be forEach elevator

#

also if you don't need the variable to reside with global variables, declare it as private _objects = nearestTerrainObjects ***

fluid wolf
#

They arn't terrainobjects though

#

they need to be, but they arn't

#

thats what I'm attempting here

#

let me see if thats indeed the error

astral dawn
#

elevator is an array and you put an array inside array foreach [elevator]

fluid wolf
#

Ahh

astral dawn
#

also
inside forEach
{this setFeatureType 2} foreach [elevator]
must be
{_x setFeatureType 2;} foreach elevator ??

fluid wolf
#

uhh I can try that

#

I thought running _this was giving me an error in the past

#

alright lets try that now

#

Nope

#

still not functioning

astral dawn
#

well then you must debug it properly

#

see what this thing returns
elevator = (nearestObjects [(getpos SpaceElevator), [], 600]);

#

like, type elevator in the console and see what's there, since it's global already

fluid wolf
#

now how exactly do I read what that returns, thats one thing i Never figured out.

astral dawn
#

like, you type 1+2 and type enter, it gives 3 at the bottom of the console

#

it should tell you contents of elevator variable at the same place

fluid wolf
#

ahh

#

its not returning anything

#

it can give you information from an array right?

astral dawn
#

yeah it should give you like [] at least

#

or [object_1, object_2, ...] a list of objects, which is what you need

#

if it gives you nothing then it's nil probably, try isNil "elevator";

#

also how do you run your script?

fluid wolf
#

isNil returns false

#

Running off a trigger denoted as true

#

on mission start

astral dawn
#

o_O then what it is it if it's not nil but returns nothing O_o 🤔

fluid wolf
#

idk... if i do elevator = (nearestObjects [(getpos SpaceElevator), [], 600]); the field is blank, but Isnil returns false

astral dawn
#

but it doesnt even return [] ??

fluid wolf
#

Nope

astral dawn
#

you don't understand, if you execute variable = 123; it returns nothing, because = operator returns nothing, so the console returns nothing

#

you should either do (nearestObjects [(getpos SpaceElevator), [], 600]); or elevator = (nearestObjects [(getpos SpaceElevator), [], 600]); elevator to make it return the result of nearestObjects

fluid wolf
#

Ohhh

#

oops

#

OK yes it does return what i need it to return now

#

it is infact seeing it

astral dawn
#

then {_x setFeatureType 2;} foreach elevator should do setFeatureType properly

#

IDK if setFeatureType itself works or not, never used it 🤷

fluid wolf
#

yea the popin for the place is a little jarring given how large it is, so I was hoping to use it since its a landmark on the mission

astral dawn
#

I want to see the space elevator 😄 is it going to space??

fluid wolf
#

Supposedly

#

Ugh... not thats not working either

#

is it specifically _x or?

#

oh yea _x is for arrays isnt it

drowsy axle
#

@winter rose before the first {

tough abyss
#

Cancels his SQF lessons with Sparker

chrome forge
#

@tough abyss thank you for the plane script but there was no altitude in there.. planes kept smacking into mountains on Lythium.

Is there a way to set the aircraft to go to a marker on the map and just loiter?

fluid wolf
#

I believe flyinheight works for that

#

I think there is an ASL version of it

winter rose
#

@drowsy axle then it's not "arguments for forEach" ? it's script variables used in forEach?

drowsy axle
#

Yeah, sorry.

winter rose
#
private _myVar = 5;```
still forum
#

@tough abyss why setVelocityModelSpace is not highlighted, what is this blasphemy? The highlighting library that discord uses is not maintained anymore. I made a PR adding new commands over a year back. They don't accept PR's anymore.

west grove
#

fellas, got a question again. actionKeysNames 'revealtarget'; gives me """T""" ... is there any way to grab just the T? even if i use splitString """"; after, i still get "T"

#

i'm using it in a custom text, in which it is then shown as "T", which is not what i want

tough abyss
#

hint call compile actionKeysNames "revealtarget"

west grove
#

exactly what i want. thanks.

#

now i just need to find the correct text color. based on my profile namespace variables it should be "gui_bcg_rgb_.." but it's too dark

#

ah, nevermind. it'll do it

#

welp, obviously it is darker.. the background color is darker as well

tough abyss
#

however if someone will have 2 or more keys bound to this action it will give an error

#

only works for single key

#

There is a reason the keys are in quotes because the result could be "A" or "Left" for example

#

or "Space" or "Enter" or "Middle Mouse Btn."

west grove
#

it's showing like that in the hint text, though

#

which is what i want to mimic

#

this sucks

#

is there a way to replace the "" with [] ?

#

then i dont mind about it. it's really only the "" that is bugging me

#

or i'll just call it "reveal target" .. then i skip that whole stuff

arctic igloo
#

Hi, I am new in the community of ArmA 3, and then, after playing some campaigns (I left them half-heartedly, since the mods were not very compatible ...) and I would like to do missions, I know the basics, but I need a Necessary piece, how do I make an activator that creates missions or activate them? Thanks in advance

astral dawn
#

an activator that creates missions or activate them
what?

arctic igloo
#

I mean, for example, you talk to a person, like a mission, and this one activates another besides completing the previous one

astral dawn
#

oh allright, I guess you mean the tasks, like when you press J button

#

I guess you need these

arctic igloo
#

thanks very much , sorry for my english , i'm a noob spanish XD

astral dawn
#

yeah it's allright, they just call it task in functions, not mission

arctic igloo
#

ok thanks

astral dawn
arctic igloo
#

thanks , i know that

keen bough
#

I have amount1 + amount2 which gives me result1 that i compare to neededNumber (bigger as or equal). After that, i want to make sure i get only the needed amount to reach the neededNumber. Quick example:
_s1 = 17
_s2 = 5
needed = 20
restult s1+s2 = 22

My thought was i would do result minus needed, then i would do _s2 minus newresult to have a final result which the amount is.

Would there be a simpler way? Or a command in arma 3 where i can test how much a number exceeds the needed endresult?

tough abyss
#

are you talking about min max commands?
(17 + 5) min 20 will return 20 even if the sum is 22

#

if not I have no idea what you need then

keen bough
#

_unlimited = 20;
_playerHas = 7;
_isAlreadyBox = 15;
_playerMustPay = ?;

The _playerMustPay should be 5, because thats the amount that you need to reach _unlimited. So the player does not have to play the other 2 (_playerHas is 7). Currently i just do it with a not so big mathematic line. But maybe there is a command already that i can use to figure out how much something exceeds. Like 7 + 15 = 22, so the excess amount from the 7 is 2.

I hope i am not too confusing XD

keen bough
#

haha, i mean my script works like a charm and if i have to write 2 lines or 1 line, isnt that big of a deal. :3

hushed lagoon
#

Would anyone know how to allow clients to interact with doors via an object spawned with createVehicle? The host can open doors of buildings, clients can see the action, but the doors only open for the host? Am I missing something here?

slate gull
#

is this syntax example ok? {WaitUntil{!isNil "PO3_core_init"};}; I think that second to last semi-colon might be the issue but there are a lot in this script im trying to debug and dont want to waste time deleting all of them if its correct.

keen bough
#

@hushed lagoon Cant you have blue? ^^ Well, if i am correct you probably didnt make the action opening the door global. I guess that you open the door on a local_client. If you havent, already, maybe look into https://community.bistudio.com/wiki/remoteExec

Maybe thats the solution to your problem.

hushed lagoon
#

@keen bough, I did not add the action, it's the default one that comes with the building. I'm not sure how I would do that if I don't have access to the action code.

keen bough
#

I try to understand it - so you want to be able to control a door withing or via a vehicle that was spawned with said commands. The created vehicles is used but only the door-open basic action is seen by host as well as the door opens only for the host?

Do you have any form of code eventually? I am not a pro-scripter but i may see eventually something.

hushed lagoon
#

This code is spawning compositions I have saved, the _type would be 'Land_Cargo_HQ_V1_F' for example { private _type = _x select 0; private _offset = _x select 1; private _newDir = _x select 2; private _obj = nil; _obj = createVehicle [_type, [0,0,0], [], 0, "CAN_COLLIDE" ]; [_source, _obj, _offset, _newDir] call BIS_fnc_relPosObject; _obj setPosASL [getPos _obj select 0, getPos _obj select 1, getTerrainHeightASL getPos _obj]; _obj setVectorUp (surfaceNormal (getPosATL _obj)); _compositions append [_obj]; } forEach _composition; It also breaks vehicles, not sure why. As I use the same createVehicle line of code elsewhere and it works fine.

still forum
#

@slate gull the part you sent looks okey. But no way to tell if your full script is okey without seeing the full script

slate gull
#

Thanks. Yeah i was just wondering about those semi-colons inside the end brackets. They looked out of place and since there are so many of them in this particular script i just wanted to confirm.

still forum
#

Don't need semicolon at end of code piece

#

{waitUntil{!isNil "PO3_core_init";};}; is just as valid as
{waitUntil{!isNil "PO3_core_init"}}; and also as valid as
{WaitUntil{!isNil "PO3_core_init";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;};;;;;;;;;;;;;;;;;;;;;;;;;;;;};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

slate gull
#

lol, ok. Thank you that is actually more helpful, now i dont have to wonder about it if i come across something like that

still forum
#

ACE/CBA also uses missing semicolon at end, to indicate that this line of code is a return value

slate gull
#

Ok. Thanks for help. You guys are awesome

keen bough
#

@hushed lagoon sadly i am not too fond to break that up. But i am very sure, the keen eyes uf @still forum for example may spot something.

For me it just looks very fine (but i tend to oversee things)

still forum
#

Ewww... wtf is that code man

keen bough
#

psch, be nice! Else i take away your hot chocolate.

still forum
#
{
    _x params ["_type", "_offset", "_newDir"];

    private _obj = createVehicle [_type, [0,0,0], [], 0, "CAN_COLLIDE" ];
    [_source, _obj, _offset, _newDir] call BIS_fnc_relPosObject;
    private _newPos = getPosASL _obj;
    _newPos set [2, 0];
    _obj setPosATL _newPos;
    _obj setVectorUp (surfaceNormal _newPos);
    _compositions pushBack _obj;
} forEach _composition; 

Okey now we can get started. What was the problem again?

#

Ah the actions don't work.. No idea. Don't see any problem in the code that would cause that

keen bough
#

1762 lines of code (-20% empty lines for separation) ... this shop-script is a hell lot a work. YET! Not a single error.

still forum
#

Split into multiple files :U

keen bough
#

already did, this is just the script where you pay. It checks for so many things and a lot of things are just redo-writings. Basicly the script is extremely simple ^^ But there are so many items, price-checks, is it unlimited, will it be unlimited, and so on.

#

having it near realistic has a price. And its more or less a lot of preparation work

queen cargo
#

there is no price involved in that ... just basic data
if the script has 1762 lines of code, you got a hell lot of stuff you should rewrite entirely

keen bough
#

yep, but sadly for some cases i didnt find well made tutorials. So i am left hanging and i am going with more line of codes until i figured out stuff myself 😃 i can easily rewrite that stuff then ^^

#

oh, and a lot of the lines are documentation 😃 i am not like most guys that have snippets but extreme well documented scripts :3

queen cargo
#

if you indeed need tutorials then you should not rewrite stuff

still forum
#

That's how I most often learn things. I build stuff, then improve my skills while doing that. And then later see what garbage I produced and rewrite everything 😄 and while doing that improve my skills again by seeing what I did wrong

winter rose
#

don't we all, scared by the output of our previous self we are forced to improve…

ornate sky
#

How to I make a forEach iterate early?

#

Like continue in Java etc.

#

exitWith will kill the whole loop right?

robust hollow
#
{

    if (condition) then {
        stuff
    };
} foreach [];```
there is no continue command, however you can skip elements that dont meet ur condition like this
#

yes exitWith exits the loop

ornate sky
#

That's what I thought, thanks

#

I'll have to use if

queen cargo
still forum
#

Or use findIf

#

once you return true, it stops iterating

#
{
    if (condition) then {
        stuff
    };
} foreach [];

Same as

[] findIf {stuff; condition}

ugh syntax highlighter doesn't know findIf ^^

queen cargo
#

nah
he wants to skip over certain elements:

foreach (auto iterator in new int[] { 1, 2, 3, 4, 5 })
{
    if ( iterator % 3 == 1)
        continue;
    // stuff
};```
ornate sky
#

breakOut needs labels and I think the simplest thing is gonna be an if

queen cargo
#

you just name the scope once

#

there is no "label" in sqf

ornate sky
#

I meant the scopeName

still forum
#

oh.. mixed up continue and break ^^

ornate sky
#

I got mixed up in Java, suffice to say, the if is gonna do the trick this time.

tough abyss
#

You can call another scope inside the loop and exitWith that if you want to skip but the fastest of them all will be if (cond) then {... without else

still forum
#

Heh....

#
{
    (condition) && {
        stuff
    };
} foreach [];

🤣

tough abyss
#

Huh! Curious if it is as fast

still forum
#

technically should be faster than if. Less values allocated, less script commands. Just doesn't know if it errors if code doesn't return a bool

tough abyss
#

Well sqf is often not what one expects

#

Gonna check in a minute

queen cargo
#

would expect it to error @still forum

#

soont™ stuff like this can be checked in SQF-VM sqf test cases

still forum
#

That is, if the test cases are actually correct 😄

queen cargo
still forum
#

Okey yeah. Throws a type error on non-bool.
But dunno if that kills the loop or if it just continues running

queen cargo
#

uff ... crap

#

forgot to double check that stuff in arma for count already 🤦

#

because if it continues to run, it just is a warning

still forum
#

Never understood how arma error handling really works. Sometimes errors kill your whole script. Sometimes it just continues running..

queen cargo
#

just at random

#

whoever implements a command decides it i guess

still forum
#

Nah there is no info about that in the command

queen cargo
#

implements not in the struct

still forum
#

Maybe scheduled vs unscheduled. Or it depends on what callstack level or whatever

queen cargo
#

presumably some check deep down the ground

#

but you do not want to follow that rabbit hole
or you discover eternal doom

still forum
#

Don't follow the white rabbit

queen cargo
#

Could somebody please check what the output of this is?

{
    private "_i";
    if (!isNil "_i" && {_i isEqualTo 1}) then
    { diag_log true; }
    else
    { _i = 1; diag_log false; }
} foreach [1,2,3,4,5]```
tough abyss
#

well, () && {} is faster if you need to return boolean, but if you don't but forced to do it to avoid error, if () then {} is obviously faster as you don't have to return anything

still forum
#

you mean return boolean inside the code of the && {}? not return boolean to the forEach

tough abyss
#

yeah it expects boolean from {}

still forum
#

have you tested if it exits the loop after the first error?

#

Maybe one can just keep using it despite puking out errors 😄

tough abyss
#

no but i can hold on

#

error -> writing into rpt -> major lag

still forum
#

except if you have -noLogs 😄

tough abyss
#

doesnt even run once

#

ah no had spelling typo

#

yea runs the loop with errors

#

you can return nil

#

bool or nil

#

that's fine no error

#

{(_x != 10) && {a = _x}} foreach [1,2,3,4,5,6,7,8,9,0] error

still forum
#

nil works? good to know.

tough abyss
#

so yeah I think usable but need to keep in mind assignment

still forum
#

Well last example returns nothing. That is.. Eval error? Or Generic error

tough abyss
#

3% faster

frigid raven
#

Hey my besties.
I have a dialog gui showing up and would love to blur the background to receive more focus on the GUI.
https://community.bistudio.com/wiki/ppEffectCreate
Found that but it looks like it will apply effects to the whole. Is there a way to blacklist Dialogs/Controls from that? Or another way at all to add that feature?

still forum
#

Always thought it only applies effect to actual game rendering, not dialogs and such 🤔

tough abyss
#

Yeah, same here, have you actually tried it or you assume?

frigid raven
#

Found that but it looks like it will apply effects to the whole - I assume by reading the biki that it affects the whole (game rendering)

#

or is game rendering != dialogs ?

#

Ah wait 🤔 when hitting ESC and pausing I am looking at Dialogs while the background is blurred

#

💡

#

Yeah, same here, have you actually tried it or you assume? @tough abyss nah at work atm so can't test stuff. Was just reading about the command in biki

still forum
#

allowedQM isEqualTo allowedAdmin; that line does nothing

drowsy axle
#

Other way around?

still forum
#

no

#

currentQuarterPlayerLoadout = currentQuarterPlayer setUnitLoadout currentQuarterMasterLoadout;
makes no sense. setUnitLoadout doesn't return anything

#

if ( allowedQM find (getPlayerUID (_thisList select 0)) )
if takes a bool, find returns a number

#

if you just want to check if the playerUID is in the array. Then just use in

#

Also trigger condition requires a bool. You return a IfType

drowsy axle
#

Changed.

#

_triggerQuarterMaster = createTrigger ["EmptyDetector", _posQuarterMaster, true]; Missing ; Getting this error.

tough abyss
#

Why do you think that is?

drowsy axle
#

oh ffs

#

😢

#

How did I not see that..

#

🤦

drowsy axle
#

Okay, so it works, code wise. ```sqf
allowedAdmin = [
"76561198079984427" // Capwell
];

allowedQM = allowedAdmin;

EC_QuarterMasterSystem = {

currentQuarterMaster        = nil;
currentQuarterMasterLoadout = nil;
currentQuarterPlayer        = nil;

_posQuarterMaster = getPos QuarterMasterPos;
_triggerQuarterMaster = createTrigger ["EmptyDetector", _posQuarterMaster, true];
_triggerQuarterMaster setTriggerArea [1, 1, 2, true];

systemChat 'Setting up QuarterMaster Trigger';
sleep 1;

_triggerQuarterMaster setTriggerActivation ["ANYBODY", "PRESENT", true];
_triggerQuarterMaster setTriggerStatements [
    "this",
    "
        currentQuarterMaster = (_thisList select 0);
        currentQuarterMasterLoadout = getUnitLoadout [currentQuarterMaster,true];
        systemChat format['Current QuarterMaster Loadout: Transmitted. %1 %2', name currentQuarterPlayer,currentQuarterMasterLoadout];
    ",
    ""
];

_posQuarterPlayer = getPos QuarterPlayerPos;
_triggerQuarterPlayer = createTrigger ["EmptyDetector", _posQuarterPlayer, true];
_triggerQuarterPlayer setTriggerArea [1, 1, 2, true];

systemChat 'Setting up QuarterPlayer Trigger';
sleep 1;

_triggerQuarterPlayer setTriggerActivation ["ANYBODY", "PRESENT", true];
_triggerQuarterPlayer setTriggerStatements [
    "this",
    "
        currentQuarterPlayer = (_thisList select 0);
        currentQuarterPlayer setUnitLoadout currentQuarterMasterLoadout;
        systemChat format['Current QuarterMaster Loadout: Received. %1 %2', name currentQuarterPlayer,currentQuarterMasterLoadout];
    ",
    ""
];

sleep 4; systemChat 'DEBUG: Triggers are now being deleted.';
deleteVehicle _triggerQuarterPlayer;
deleteVehicle _triggerQuarterMaster;

};``` However, currentQuarterPlayer / currentQuarterMasterLoadout etc. return as any, for both triggers.

tough abyss
#

_thisList is nil inside the trigger

drowsy axle
#

So how do I fix that?

winter rose
#

thislist

vagrant mango
#

Hey have any of yall used something like initInspectable to make a cell phone inspectable and show a text message when inspected? Or something of the sort?

digital hollow
#

That's not a thing but addAction would be a good bet.

vagrant mango
#

How is it not a thing? lol

digital hollow
#

Oh neat. Had no idea that was a function. I'd probably still use addAction anyway.

vagrant mango
#

Word.

#

I figured it out.

#

The documentation is less then stellar but meh.

#

Its pretty easy though.

#

Is there a place at all that has the pixel sizes for screen images?? Like to use something for a laptop screen for it to effectively not be over sized it needs to be 1024x1024 pixels or something like that?

young current
#

depends how the screen is unwrapped

#

textures always need to be power of 2

#

but the area used might not cover all of it

#

I dont think it works like that

keen bough
#

i dont get it from the current example that i found. Could someone explain me, how i take a variable from one script, to the next one?
As Example:
_mapleSirup = "Delicious";
_notMapleSirup = "Bleh";
["script2.sqf"] remoteExec ["execVM", 2];

I just want the _mapleSirup variable to be taken into the next script.

#

Got the solution to my own problem.
[[var1, var2, ...], "script.sqf"] remoteExec ["execVM", 2];

#

forgot the []

keen bough
#
class TG
    {
        tag = "TG";
        class server
            {
                file = "filepath\folder"
                class theScript {};
                ?question?
            };
    };

Okay. The first "class"-Tag is used so i have to write, as example "TG"_fnc_myScript or if it said class boob i would write "boob"_fnc_myScript. Right?

tag is furthermore the definition of the class before. If i name the class "abc" but the tag "def" i would have to write "def"_fnc_myScript, am i right?

Next up says class server. Which means, that this is the folder-name and with file = we define where the folde is. Am i still right so far?

now comes class "myscript" where i use the function. I name my script fn_myScript since arma would not know that this would be a function withouth the fn_ part, right?

The "?question?" is also this:
Where do i put the second function? Right under the old? Like just another "class myScript2"?

keen bough
#

... guys, why do i even ask here? I mean, really? I put in a question, i figure things out shortly after. But if i dont ask, it takes me days. Is this some form of programmers curse?! ...

spice axle
#

Yes

#

That's how you learn new things. Figure it out how not to do. Give up. Ask the question (you actual want someelse to understand so you think in other ways). Solution is in your mind. That is how it is done.

keen bough
#

Hm, the list-script (containts all the lists for magazines, weapons, vehicles) is just big because the lists kinda big. Should i split up for vehicles, items, weapons and so forth or should i put everything in one function script?

Return value is basically whatever. Magazines is the magazine bullet count, vehicles is if its east/west etc.

still forum
#

@keen bough I put in a question, i figure things out shortly after. It's called "Rubber duck debugging"

keen bough
#

There is a saying to this? hah, nice ^^ thanks

still forum
#

Hm, the list-script (containts all the lists for magazines, weapons, vehicles) is just big because the lists kinda big. optimally you generate the list on-the-fly from config

keen bough
#

Ah, i have more detailed lists as i need them for very specific tasks. Since i have to have high-tech and lo-tech as well as basic-tech split up and such.

#

End of switch do. Do i write
default: _myStuff =
or
default _myStuff =
?

#

Example only shows me code with hint.

still forum
#

Example only shows me code Yes because default is a command that takes code

#

you need to give it code

keen bough
#

a basically for me
default { _theResult = "Error"}; thanksies.

high marsh
#

Or just "Error", I believe you can store the result for the switch statement if you store it in a variable

keen bough
#

Interesting. If i dont forget it, i will test it as i test the functions.

still forum
#

Need a quick help. Can someone send me the Arma 3 dta/bin.pbo via discord DM?
Don't wanna remote boot my home PC to grab it

earnest ore
#

@still forum Would, if the file limit wasn't 5mb via discord. Want it through gdrive?

still forum
#

Narsiph is already sending it to me. Thanks o7

earnest ore
#

👌

still forum
#

Now I can do Arma stuffs at work 😄

tough abyss
#

That’s what BI devs say

slate gull
#

Is there a difference in defining a variable? example: i want to define _X to use in an array. it is going to take the properties of tz_blacklist. so can it be written tz_blacklist = _X or does it have to be _X = tz_blacklist ?

still forum
#

one assigns _x the other assigns tz_blacklist

#

so yeah.. there is a difference

#

and no. the computer cannot read your mind and figure out what you want. Thats why we have syntax

keen bough
#

Hmm. Already glorious 16 functions defined and finished roughly a third of them already. Sooooo much easier.

astral dawn
#

What are the scripting functions we have to interact with player's ragdolling state? Ideally I'd like to get this state and disable in some situations.

still forum
#

Afaik there are none

winter rose
#

setUnconscious triggers ragdoll for a few seconds, but that's the only command about it
no getter, no real setter

astral dawn
#

if I setPos will it stop player's ragdoll?

winter rose
#

ragdolling after what? being killed?

astral dawn
#

or maybe switch animation to previous 🤔

#

I was thinking how to disable this BS when you touch a car with your finger and start ragdolling

still forum
#

ragdoll cannot be stoppd. There is a hardcoded X seconds timer

#

That also runs locally on overy players machine

#

I mean. Stopping after it started

astral dawn
#

Damn that's sad but thanks

#

Are you totally sure it's not scripted somewhere? Then we could intercept it?

still forum
#

Too deep for intercept. You can start ragdoll. But not stop it after it was started

tough abyss
#

Captain Kirk:

  • Too deep to intercept. We can start ragdoll maneuver, but we cannot stop it once it is started...dramatic music
slate gull
#

Thanks @still forum. i just found the error in the script ive been staring at for days. thanks to you

edgy dune
#

idk if any of you know this, but there was this once scene in the 2013 godzilla movie where they do a halo jump and the guys have this red smoke on their foot. I wanted to try n do that so im using attachto and createvehicle to create and attach a smoke on to the left part of a players foot. But I noticed something that I couldnt spawn modded grenades. I can use this to spawn vanilla smoke grenades but I can say spawn the optre yellow smoke grenade

works

_the_thing = "SmokeShellRed" createVehicle (position player);

doesnt work

_the_thing = "OPTRE_M2_Smoke_Yellow" createVehicle (position player);

also doesnt work

_the_thing = "ACE_M84" createVehicle (position player);

any idea's why? Im in the virtual arsenal map so im not sure if that would cause issues

digital hollow
#

SmokeShellRed inherits from SmokeShell and
ACE_M84 inherits from HandGrenade
try it with ACE_M14

edgy dune
#

okay ill try that

slate gull
#

Is it better to include a separate script in your config by using "execVM" or "#include"??

keen bough
#
_className = _this select 0;
test3 = _className;

switch true do {
case (_className in _25rndMagazines): {_theResult = 25};
case (_className in _30rndMagazines): {_theResult = 30};
case (_className in _40rndMagazines): {_theResult = 40};
case (_className in _44rndMagazines): {_theResult = 44};
case (_className in _45rndMagazines): {_theResult = 45};
case (_className in _50rndMagazines): {_theResult = 50};
case (_className in _75rndMagazines): {_theResult = 75};
case (_className in _100rndMagazines): {_theResult = 100};
default {_theResult = "Error"};
};
_theResult

But i dont get _theResult. If i do test4 = [_name] narS_fnc_listMagazines; nothing happenes. But test3 gives me the magazine name which was clearly brought into the function correctly. Am i overseeing something with the case or switch do?

winter rose
#

use private "_theResult"; before the switch; else the variable is only declared in the case scope

keen bough
#

So before the case i define the private variables? I did before the block now

private ["_theResult"];

That correct, please?

winter rose
#

for example yes

keen bough
#

okay, running new tests.

#

uff, works. Thank you Lou! So in every function i should private all variables, would that be correct too?

winter rose
#

yes, that would avoid any other script interference

keen bough
#

so, as a save-run, i would private all local variables in any function/script to be safe and i still can give them to another script if needed with arguments? Just want to make it sure so i dont learn it wrong :3

#

(Of course, not global variables ^^)

torn kite
#

What is the ingame command to find the texture of the object your looking at? I remember its something like getobjecttexture but not sure

winter rose
#

@keen bough yes, no probs 😃 names are just references to values, you can name them and pass them as you will

torn kite
#

there is like a cusor target or something on the start and im not sure what that is

keen bough
#

Ah, okay - last question because i am unsure about the topic (harder to understand english than german). If i have a private variable and that variable has multiple use (like getting variable updates) within the same script. Does the private variable setting not forbid an update?

winter rose
#

context?

keen bough
#

like private _a;
_b = 1;
_a = 1;
_a = _b + _a;
_a = _a + _a;

winter rose
#

private does not make the variable readonly; it just says "the variable exists in this scope (script) only, and will be deleted once exited"

keen bough
#

ah, so i can do all kinky things to the variable and have no problems if i call functions with the script that use the same variable in the new called function (bot both private, so they dont interfere)? If thats correct i have understand it XD

winter rose
#
private _a = 1;
_a spawn {
    _this = _this + 1;
    hint str _this; // 2
};
hint str _a; // 1```
#

same as sqf private _a = 1; _a spawn { params ["_a"]; _a = _a + 1; hint str _a; // 2 }; hint str _a; // 1

keen bough
#

yes, since spawn is a new instance :3 i understood it ^^ wohooo! Can we now get drunk? 😄

winter rose
#

Cheers! 🍻

#

learning a new thing is always worth a celebration 😉 hehe 🍺

torn kite
#

@winter rose do you actually know the full command for getting the texture? its not working for me

winter rose
torn kite
#

yeh but what do I do with that?

keen bough
#

place down kickass ship. Name the ship "assKick" and do it like

myGlobalVariable = getObjectTextures assKick;
or
_myLocalVariable = getObjectTextures assKick;

@torn kite

torn kite
#

isn't there one where you just have to look at it

#

and you type it in the watch box

keen bough
#

hm, getCursorObject or something, i dont know all the commands, would've to look it up.

drowsy axle
#

Could someone help me out with this error:

#
    _selectFirstFirstStr = [_select>
 0:18:01   Error position: <;
    _selectFirstFirstStr = [_select>
 0:18:01   Error Missing ;
 0:18:01 File C:\Users\Jack\Documents\Arma 3 - Other Profiles\Lt%2e%20Capwell\mpmissions\EC_Training.hebontes\initPlayerLocal.sqf, line 33
 0:18:01 Error in expression <ectFirstThird, '"'] call CBA_fnc_replace;
    _selectFirstFirstStr = [_select>
 0:18:01   Error position: <;
    _selectFirstFirstStr = [_select>
 0:18:01   Error Missing ;
 0:18:01 File C:\Users\Jack\Documents\Arma 3 - Other Profiles\Lt%2e%20Capwell\mpmissions\EC_Training.hebontes\initPlayerLocal.sqf, line 33```
#
EC_uuid = [
    ["76561198079984427", 2400, "LT"], // Capwell
    ["76561198057050881", 1700, "SGT"], // Skid
    ["76561198054232175", 1800, "SSGT"], // Jagged
    ["76561194014843973", 1700, "2LT"], // ViBro
    ["76561198007468329", 1600, "SSGT"], // Kage
    ["76561198799159646", 1100, "PVT"], // Darky
    ["76561198101994293", 1600, "CPL"], // Passos
    ["76561193907264988", 1600, "SSGT"], // Irish
    ["76561198323567243", 1100, "PVT"], // Andronov
    ["76561198067428987", 1300, "PVT"], // AtomicVenom
    ["76561193764413242", 1100, "PVT"], // Classicsss
    ["76561193859459179", 1200, "PFC"], // Dannn
    ["76561193721197702", 1100, "PVT"], // Kampfkruemmel
    ["76561198450220482", 1400, "CPL"], // Farmer
    ["76561198063303666", 1400, "CPL"], // Oliver
    ["76561198132446948", 1000, "REC"], // Shuzurrow
    ["76561198354092237", 1000, "REC"], // Temperz
    ["76561198137961331", 1300, "PVT"], // Anton
    ["76561193766117918", 1100, "PVT"], // Viktor
    ["76561198133724195", 1400, "CPL"] // Will
];

_selectFirst = (EC_uuid select 0);
_selectFirstFirst = (_selectFirst select 0);
_selectFirstSecond = (_selectFirst select 1);
_selectFirstThird = (_selectFirst select 2);

_uid = getPlayerUID player;
_index = EC_uuid findIf {(_x select 0) isEqualTo _uid};

if (_index > -1) then {
    [player, _selectFirstSecond] call grad_moneymenu_fnc_addFunds;
    hint format['Your UID: \n %1 \n Operation Paycheck: \n %2 CR \n',_selectFirstThird, _selectFirstSecond];
    [player, _selectFirstThird] call CAP_fnc_rankSelect;
    hint format['Your UID: \n %1 \n Rank: \n %2 \n',_selectFirstFirst, _selectFirstThird];
} else {
    hint "Your UID has not been entered into the Payment System, yet... A log of your UID has been made.";
    diag_log format["----------------- [[[UID:]]] %1",_uid];
};```
ruby breach
#

Rather than whatever you're doing there... ```sqf
_uid = getPlayerUID player;
_index = EC_uuid findIf {(_x select 0) isEqualTo _uid};
if (_index > -1) then {/do things/} else {/don't do things/};

drowsy axle
#

Okay, thanks. 😃 Doesn't fix my issue though.

ruby breach
#

Looks like your semicolon isn't actually a semicolon (or whatever is making  show in there)

drowsy axle
#

I've sorted it out.

#

Changed the code over.

keen bough
#

i forgot the command to check the base weapon. You know, you get weapons witch attachements like "rifle+optic+anotherthing" and you can do
_baseWeaponClassName = checkForBaseName "thisweapon-with-stuff-on-it-classname";

Know what i mean? 😄

keen bough
#

found it! BIS_fnc_baseWeapon

round scroll
#

any ideas what might cause this duplication? It seems to go away when editing the mission objects again and again, but I cannot detect a pattern

violet gull
#

Can RscObject be used in .sqf based interface without a .hpp or description.ext defining the object? Tried ctrlSetModel and had no success.

#

Have been able to write an interface using 2D stuff like background, buttons, text, and listbox without a .hpp or description.ext

#

No luck with RscObject though. Trying to do it within a display

still forum
#

@slate gull
Is it better to include a separate script in your config by using "execVM" or "#include"??
You can't include scripts in configs using #include. Configs and scripts are entirely different things
execVM is also bad. Use CfgFunctions if you call a script more than once.

@keen bough when you are assinging a variable anyway use private _var = x
instead of
private "_var"
_var = x
The first variant is called private keyword and is ♾️'ly faster

slate gull
#

Well i dont know if that applies to any config that isnt config.cpp. To be more specific, i am trying to get a blacklist to work on my server where it reads what pbos the player has loaded and compares them to what is on a already defined array of banned mods. So in the "blacklist_config.sqf" script has all the banned mods defined and in "blacklist.sqf" is where the script is that does has the actual function of comparing the names. So in my blacklist_config i have it as calling up "execVM "blacklist.sqf"; and i was wondering if there is a better way. I know it calls it up because of the hints i put in it to tell me how far along it gets show up on the screen when i load in. But when i load in with a banned mod it doesnt kick me the way its supposed to.

still forum
#

add diag_logs to your blacklist.sqf and see why it doesn't kick you

slate gull
#

How would i implement that?

keen bough
#

i kinda check my stuff with "hint" or systemChat so i know where i have to look

slate gull
#

and i can put that at the top of the script?

still forum
#

no

#

everywhere

#

diag_log logs one line into the RPT

#

throw it everywhere in your script where something interesting happens. So that you can see exactly what your script is doing

slate gull
#

ok. and then where do i look to find the logs to observe what happened?

still forum
slate gull
#

ok. thanks. will def look into it

quasi sedge
#

How to get array classnames of all available vehicle (Planes tanks ifv helis )?

#

with my current mods?

#

like this one

quasi sedge
#

private ["_air","_land","_veh"]; _air = []; _land = []; _veh = ""; { _veh = configName _x; switch (true) do { case (_veh isKindOf "air") : {_air pushBack _veh}; case (_veh isKindOf "car") : {_land pushBack _veh}; case (_veh isKindOf "tank") : {_land pushBack _veh}; }; } forEach ("true" configClasses (configFile >> "CfgVehicles")); copyToClipboard format ["Наземная техника - %1",_land];

#

Solution

still forum
#
private _air = []; 
private _land = []; 
{  
    private _veh = configName _x;
    private _isLand = (_veh isKindOf "land");
    private _isAir = if (_isLand) then {false} else {(_veh isKindOf "air")};
    
    if (_isAir || _isLand) then {
        ([_land, _air] select _isAir) pushBack _vec;
    }
} forEach ("getNumber (_x >> 'scope') == 2" configClasses (configFile >> "CfgVehicles")); 
copyToClipboard format ["Наземная техника - %1",_land];

Better solution

#

Your solution will also list classes that are not spawnable. Like... "car" and "tank" and "air" and all the other base classes.
Also my version is "slightly" faster

leaden parrot
#

HI everyone.

Im trying to make a mission where your players spawn in, in a random place on the map, spawn different objects/barricades that can then be moved with ALiVE or some sort of move/drop script. and then just have unlimited waves of enemies spawning. The spawning part I have to tackle at some other point. Right now i've just set it up with /show/hide modules)

I'm pretty new to arma scripting and dont even know how to begin with how to let the game find a random place to spawn(or let the command player pick one if that is easier) or how to do the random spawning of movable objects. (so you can go around and scavenge to fortify a makeshift base or whatever)

#

Im sorry if this is way to much to ask. and Im not expecting someone to just dump me the solution, but any pointers would be helpful 👋

digital hollow
#

Look for an existing Deploy and Defend mission and see what they are doing for a starting point.

leaden parrot
#

So for the random spawning I could Make an object spawn at some random markers I place on the map ( or script the markers to be placed at random at a safepos?)

and then tie the players to that object and spawn them in after. ill give that a try first!

#

Thanks

leaden parrot
#

So i've found multiple ways to do the spawning in. The object I want my players to start at are randomly spawning on one of my invisible markers (yay). I want my players linked to the camp though. I thought I could just take the group leader and sync that to the object but that doesn't work. I then found some people talking about giving my leader a varaible name and running a script (I reckon it would be written in the int.sqf and one of them write this:

"_x setPos getMarkerPos ""marker_1" "" forEach units bravo"

What is "_x" referring to ? I guess I just dont understand the underscore X part of it. liek I dont have anything called "_x"

high marsh
#
[yourUnitList] joinSilent (group camp_leader);
#

_x is a magic variable

tough abyss
#

sus

high marsh
#

in this instance, it's the currently tested variable when running through the array you gave forEach

tough abyss
#

Yea

high marsh
#

so, say the array units bravo contained: ["BLAH!","BLah!","BLOO!","AAA"]
It would iterate through "BLAH!", "BLah!","BLOO", then "AAA"

#

_x contains whichever element it's testing

tough abyss
#

Yes

high marsh
#

Yes

tough abyss
#

Of course

#

That is the only logical solution

still forum
#

@tough abyss #rules what you are doing can be considered spam. So stop it.

high marsh
#

I don't know if a count loop is still the fastest or not though. ForEach is slower than count. But when using count, your condition has to return true (in order to return evaluated element)

still forum
#

true or nil

#

setPos in example above returns nil

tough abyss
#

I want to make the players in my server see what I say with systemChat, but my friends say they don’t see the message?

#

Only i can see it

#

Like its not global

#

Idk

still forum
#

need to remoteExec

#

See example 1. Just replace "hint" with "systemChat"

high marsh
#

doesn't have global effects yeah

tough abyss
#

Will try later, ty

leaden parrot
#

ah ha. ill have to try working with that and doing some stuff 😃 cheers

leaden parrot
#

alright. got it working. Justr wondering. who does the _x need curly brackets when the this = setpos (for example) can just run without?

#

im asking because im not always sure when it need to be curlied or not

leaden parrot
#

Ok, so I wanna use the "findsafepos"

and I've tried this:

_pos = [_MiddleMarker, 1, 15000, 3, 0, 10, 0] call BIS_fnc_findSafePos;
campfire setPos [getPos _pos];

so my thinking was that the _pos would be defined from ´the middle of my marker and 15 kilometers out adn then I would use that location to setPos my campfires location. But it just tell me "undefined variable in expression"

Im guessing I dont get a hold of my middlemarker properly but what do I look up to go on from here?

ruby breach
#

BIS_fnc_findSafePos returns an array in format [x,y], setPos accepts this, not sure what your [getPos _pos] is for

leaden parrot
#

I thought I had to move that result I get from BIS_fnc_findSafePos to my setpos by telling it that I could get it from the _pos but I can just straight up do setPos _pos?

ruby breach
#

Yup. Should work

leaden parrot
#

Alright. And am I calling my marker correctly or is there a better way to do that? Right now it doesn't work unless I use an object

ruby breach
#

If _MiddleMarker is a marker, the first parameter of BIS_fnc_findSafePos has to be an Object, Position, or an empty array https://community.bistudio.com/wiki/BIS_fnc_findSafePos. You'd have to use getMarkerPos to get the position of the marker and then use that as the first argument instead.

leaden parrot
#

Cheers mate. Ill get it working

#

Sorry, maybe im just stupid, but it is true that I cant run a sleep in an objects init before it runs?

astral dawn
#

Object Init Event Handlers are called All Unscheduled

Unscheduled < so... no you definitaly can not sleep in unscheduled

#

What do you want to achieve? Probably you need to spawn some code in which you can sleep and then run something, but then your objects will not initialize in a synchronous manner, but probably you don't care about it anyway if you want to sleep there

leaden parrot
#

👉 👉 that would be my problem then.

So i have crate and some other object that I want to spawn next to my campfire. right now I just have this in each of the objects inits
this setPos [(getPos campfire select 0) + 0, (getPos campfire select 1) + 5, 0];

to tell it where to be placed realtive to the campfire, but I want it to be executed after the script have chosen a random place 😃

astral dawn
#

so you have another script that generates the position and this position must be passed to the script in init field of multiple objects to place them?

#

If so, placing your code in the init field is a wrong approach

#

Instead you should run your code in init.sqf

#

Just give names to your objects and manipulate them from one place (init.sqf)

#

well... maybe you can also manipulate them all from init field of one of the objects... I would prefer init.sqf though

leaden parrot
#

my code is running in my init, and those objects are placed inside the ditor with that line in their init field.

so I would then just call them one by one and apply their respective line of code?

#

dont know enopuhg about arrays to do a foreach for each of the objects and let it choose a lione of code.

astral dawn
#

ugh... it's hard for me to tell without seeing the architecture of all your code

#

You know you double click on an object in the editor, and type something like obj_0 in 'Variable Name' field?

leaden parrot
#

well its really simple. I can DM you the few lines

#

ye y e

astral dawn
#

then the game will make obj_0 a global variable with object handle of this object, which you can access later

#

just put the code here, no?

leaden parrot
#

sure thing

#
_markerpos = getMarkerPos "MiddleMarker";
_pos = [_markerpos, 1, 15000, 1, 0, 5, 0] call BIS_fnc_findSafePos;
sleep 0.5;
campfire setPos _pos;

sleep 2;

{_x setpos (getpos campfire)} foreach units Bravo1;```
#

I just simplified it so it's just 4 tents

astral dawn
#

so... why does it need sleep then?

leaden parrot
#

The first sleep was becuase I got a weird bug with the findsafepos where the player and AI would always get launched into the air. The sleep fixed that. the second sleep is just for me to be able to see whats going on

#

Then I have my 4 tents in the scene called; Tent_N, Tent_W, Tent_E, Tent_S

#

and I want them to be placed accordingly with their init line:


 this setPos [(getPos campfire select 0) + -5, (getPos campfire select 1) + 0, 0];

this setPos [(getPos campfire select 0) + 5, (getPos campfire select 1) + 0, 0];

this setPos [(getPos campfire select 0) + 0, (getPos campfire select 1) + -5, 0]; ```
astral dawn
#

well you can just set their pos after setting pos of bravo members

#

or before that

leaden parrot
#

So i would just do a Tent_N = setPos [(getPos campfire select 0) + 0, (getPos campfire select 1) + -5, 0];

for each?

astral dawn
#

hmm no, you would do
Tent_N setPos [(getPos campfire select 0) + 0, (getPos campfire select 1) + 5, 0];

#

just four lines for four tents

#

Tent_N setPos ...
Tent_S setPos ...
Tent_E setPos ...
...

leaden parrot
#

roger roger.
would it make sense to do it with a foreach if I had like 20 items and then letting it sort the lines out accordingly?

astral dawn
#

sure, IDK if you really have four or four hundred 😄

leaden parrot
#

so why is it sometimes "tent_N setpos" and other times with the equalssign? what determines that? Sorry for all the noob coding questions

astral dawn
#

Do you have to put them at some distance around campfire in a uniform pattern? If yes, you can do like...

{
private _angle = _foreachIndex * 45; // 45 degrees per object
private _pos = _posCenter getPos [15, _angle]; // 15 meters from center, at given angle relative to North
_x setPos _pos;
} forEach _objects;
#

WHere did you see it like object = setPos ... ?? It's a totally wrong syntax and makes no sense, setPos returns nothing, and takes one argument on the left and one on the right
https://community.bistudio.com/wiki/setPos

leaden parrot
#

yeps that exactly what im doing. just so it not all cramped up. I just want a cargo box, a a whiteboard or whatever for some addactions and hescowall around the campfire

#

okay sorry, so setpos was just an example. its just looking and some of the init coding in the editor I sometimes write "this = setpos" but writing scripts outside of it does not need an equalssign

astral dawn
#

It neither needs an equal sign inside an init box or outside of it or anywhere at all 😄

#

I mean setPos syntax is the same everywhere

#

Probably setPos was launching your team members into the sky because you were setting their position to exactly the same place, then simulation would start up and produce weird effects because it had many objects at exactly the same coordinates

leaden parrot
#

oh yeah. forget about setpos. cant come up with an example where I used it right now haha, just saw that sometimes it needs the equalssign and sometimes not.

the script you just pasted in. why did you use the private and not just make up a new name for the variable?

#

ah, so if I give my unit move line a random distance from the position instead it shouldnt be an issue I guess. I've read anout that somewhere today!

#

ill find it haha thanks.

astral dawn
#

why did you use the privateand not just make up a new name for the variable?
there are global and private variables in SQF
you don't want to make global variables without a really important reason

#

if you do like myVar = 123; then it's global variable

#

so... you typically want to have all variables private

leaden parrot
#

so the variables I made in te start of my script should be set to private as well ?

also do I jsut comment out stuff with double forward slashes? //

astral dawn
#

well... in your script you already start var names with _ so it's fine, but typically it's better to have all marked as private

leaden parrot
#

alright 😃 Didnt know that. Thanks

astral dawn
#

if you just declare them like _pos = [1, 3, 2]; and you call a function my_fnc_findSomePos which has a variable declared as _pos = ... inside it, then it will overwrite the first initial _pos variable in upper scope, it's terrible and thus you should declare variables as private _pos = ...

#

if you declare both as private, the function you call won't overwrite the variable in the upper scope

#

also do I jsut comment out stuff with double forward slashes? //
yes, // single line comment or

multi
line
comment
 */```
leaden parrot
#

👌 Thank you so much. I really need to try these things out now and get to know them a bit better. It makes sense im just not the best logical thinker 🙂

astral dawn
#

ah, so if I give my unit move line a random distance from the position instead it shouldnt be an issue I guess.
probably you can just add some random value to each component of the position and it will do

slate gull
#

Question: How do you get the dark box around your messages?

winter rose
#

```text```

#

as to format sqf,
```sqf
if (true) then { hint "true"; };```

slate gull
#

three apostrophes on either side of the message?

robust hollow
#

no, three ` things

#

on the same key as ~

slate gull
#

ah ok

tough abyss
#

Lies, I’ve got ` on the same key as ‘

plain cliff
#

If I create a unit with createUnit and call removeBackpack right after (or any other remove command) the unit still has a backpack. It seems like the units loadout is added sometime after the call to createUnit returns. Does this make sense?

#

If I wait 2-3 seconds the remove succeeds.

#

Does anyone know if there is a proper check to know the unit is fully initialized?

mortal yoke
#

afaik it depends on the unit / mod too. some mods have scripts randomizing after init.

dont know of any eh.

keen bough
#

if i am correct - when i let a player start a script (press a button whatever) and use "clientOwner" i get his personal ID so i can refer to that within all scripts if i hand it over with params, right?

lavish ocean
#

there were some questions about the recent #perf_prof_branch 1.90.145620 build fix of waitUntil
it fixes the situation when waitUntil statement returns nil, it got stuck on that and cluttered the script scheduler
now waitUntil is aborted and the error message is displayed to the user like some examples below:

Error Type Bool expected Bool
Error Type Any expected Bool
Error Type Nothing, expected Bool
Error Type Obj expected Bool

etc.

still forum
#

@queen cargo ^

#

Already see it breaking scripts that expected that nil==false in a waitUntil...
Most people probably think "this will exit when I return true"
Now returning nothing is also wrong, while it was valid before. And people also used it before.

waitUntil {variable == 5}
will wait till it's 5, but also till it's actually defined. No need to wait for isNil too.

winter rose
#

sqf script errors explode in the distance

queen cargo
#

😂 😂 😂 👌 👌 @still forum

tough abyss
#

waitUntil {variable == 5} will wait till it's 5, but also till it's actually defined. No need to wait for isNil too.
No one is using it like this. an undefined variable error is written in the logs every frame

#

There is no good example when someone want to rely on returned nil but in badly written scripts it will be a hog spamming rpt and holding the script in schedule. At least now it will just abort it with error

lavish ocean
#

mumbles you wanted performance, you got fix and performance, in single package evilgrin

queen cargo
#

uhm ...

#
private _arr2 = [0,1,2];
{
    _arr2 deleteAt _x;
} forEach _arr2;
diag_log _arr2; // [1, 2]


private _arr2 = [2,1,0];
{
    _arr2 deleteAt _x;
} forEach _arr2;
diag_log _arr2; // [2]
still forum
#

wat

#

Oh _x

#

First is correct.
Second is correct too

#

all fine

queen cargo
#
private _arr2 = [0,1,2,3,4,5]; 
{ 
    _arr2 deleteAt _x; 
} forEach _arr2;
diag_log _arr2; // [1,2,4,5]


private _arr2 = [5,4,3,2,1,0]; 
{ 
    _arr2 deleteAt _x; 
} forEach _arr2;
diag_log _arr2; // [5,4,3]
still forum
#

what's the problem?

queen cargo
#

thought arma is copying the bloody arrays around

still forum
#

nope

queen cargo
#

writing some testcases for sqf-vm now ... and got surprised with this

still forum
#

deleteAt is by ref

queen cargo
#

count has the same "issues"

still forum
#

not an issue

#

atleast not from my pov

queen cargo
#
private _arr2 = [0]; 
{ 
    _arr2 pushBack _x; 
    true
} count _arr2;```
still forum
#

it iterates by index.
After 2nd element comes the 3rd.
If you delete a element such that what was 4th is now 3rd. It will go to that

queen cargo
#

it is an issue 😄

still forum
#

Well... People can always break things if they want to I guess 😄

queen cargo
#

need to fix SQF-VM now .-.

#

i just copy stuff around ... because simpler and cheaper -.-

#

now everything needs the actual arraydata

#

and additional boundary checks

still forum
#

"because simpler and cheaper"
copying a full array is cheaper than just forwarding a pointer to it?

queen cargo
#

then adding the whole arraydata to literally all files

#
  • less checks
#
  • everything ...
#

need to modify ton of commands now

queen cargo
#

well ... all fixed now

dusk sage
#

It's an issue because it wasn't the same as sqf-vm 🙃 ?

queen cargo
#

it is an issue because it just blew my expectations away

#

SQF-VM already has adapted, an annoyance at best to me 😛

rocky drum
#

Is there a way to exempt all but vehicle tires from receiving damage?

#

So the vehicle itself doesn't simply explode?

tough abyss
#

Yeah you will need to do some voodoo with HandleDamage event handler, but no one really knows how it works

queen cargo
#

mhh?

#

HandleDamage is fairly basic ...

#

though ... you rly are better off to just do:

_veh addEventHandler ["HandleDamage", { [] spawn { /* whatever you want fixed */ }; }]```
as that is simpler
#

though ... that will break them for a brief moment

tough abyss
#

@rocky drum Actually it is easier than I thought at first:

_quadbike addeventhandler ["handledamage", {if (_this select 7 == "hitlf2wheel" || _this select 1 == "") then {_this select 2} else {0}}];

you can explode a nuclear bomb on it but only left back wheel can be damaged

tough abyss
#

Anyone know how to createVehicle but when you do it, the player is inside it, “teleports” inside, cant think of the right word

still forum
#

moveInDriver/moveInCargo

tough abyss
#

Ty

ionic orchid
#

does anyone know of a way to get how far into the ground a unit has sunken when they're at a distance?

#

I hoped getPosVisual (or any of the Visuals) would do the trick, but they give the same result as the non-Visual versions

still forum
#

maybe the ground moves up, instead of the units down

ionic orchid
still forum
#

oof

winter rose
#

Yeah, quite the difference!

still forum
#

quite some high rise eyes they have

vale sky
#

Got some problems with a fairly long Script. My if conditions in the While Loop are not Working, also the Countdown-thing doesn't work like it should. Its hard to explain in text, when you look at the Script you know what it is for and what Part i mean. Should i just paste it right in the Channel or do you Guys want it on Pastebin?

astral dawn
#

Depending on how big it is

#

Try here, you can delete the message anyway

#

just do it in the code block

vale sky
#

I just realized its to long for Discord, about 140 Lines. Will post it on Pastebin. Wait a Sec

#

Its a Type of Law Enforcement Mission thing iam currently working on, the Scipt is like a Mission generator.

still forum
#
private "_marker";
_marker = [

No.

private _marker = [

yes.

vale sky
#

And for the Record, weirdly enough the first if Condition seems to work. Thx Dedmen btw

still forum
#

what is up with your sometimes private, sometimes not private, and using the bad syntax?

#

which line breaks?

vale sky
#

need to optimize it a bit, not so experienced in scripting. Its like pre-pre-pre-alpha xD

still forum
#

if (debug) don't use global variables with such generic names. If you have a global, then put a tag infront of it.
tag_debug

astral dawn
#

or use a debug macro 😄

still forum
#

Line 72
while {true} do

#

You can never exit that while loop.
never ever.
So line 81 can never be called ever

vale sky
#

Oh

still forum
#

why is debug even a global variable, when you define it directly in the script at the top? Why not make it local then.

vale sky
#

tryed to fiddle around in the Script trying to get it to work, maybe was Private one before idk

still forum
#

123 if (speed (veh) == 0) then useless parenthesis around veh.
Also I'd say don't check for == 0. Maybe do something like < 2

vale sky
#

Ok

still forum
#

" also the Countdown-thing doesn't work like it should" countdown variable is only set once? outside of the loop

#

meaning it's value will never be updated

#

so it will also never get 0 if you only grab it once, and do that right at the start of the countdown

#

call Bis_fnc_selectRandom;
don't do that.

#

Also choose one style. Don't mix.
Bis_fnc_selectRandom vs BIS_fnc_selectRandom vs bis_fnc_initVehicle
First letter captical. Tag correctly capital, or all lowercase.
Choose one.
I'd say go for the correct variant like it's shown on the wiki and in all BIS scripts which is
BIS_fnc_...

#

countdown = missionNamespace getVariable "bis_fnc_countdown_time"; That's nonsense. You are already in missionNamespace

#

that's the same as
countdown = bis_fnc_countdown_time

#

just store the time, and then compare if current time > storedTime+300
for 300 seconds.

still forum
#

so I assume countdown launches a script which runs in parallel. Total waste, don't need that at all. You can just check the time yourself

vale sky
#

Ok, will try that, do you thing that solves the Problem with the If-Conditions ?

still forum
#

Don't know which if condition

#

but global variables that never change, and expecting them to still change won't work

vale sky
#

Wait, if i use pre placed triggers on the Map it wont work ?

still forum
#

Don't know where the variables come from and what you do with them

#

you can also add diag_logs to your script to check what's happening and to debug your problems

vale sky
#

How can i do that? Looked on the Wiki page, do i need to Add one at the Start of the Script to use it or...?

still forum
#

at every line where you wanna log something

#

didn't I tell you that already days ago?

vale sky
#

ehm no, on the armaworld forum maybe? I never used the Arma Discord to report my Problems.

still forum
#

Someone asked the exact same thing about putting diag log into first line recently. Dunno where

vale sky
#

Whatever, will try your Ideas, will report if anything doesn't work.

still forum
#

Meanwhile.. Dev branch changelog
Added: addWeaponWithAttachmentsCargo and addWeaponWithAttachmentsCargoGlobal script commands
orgasms

keen bough
#

O_O omg really?!

keen bough
#

<screams in delight>

still forum
#

Gotta find the code now and write docs

keen bough
#

god, if that command is somewhere decent it would help me so much ^^

still forum
#

It is. God I hope I didn't overlook anything

#
//container addWeaponWithAttachmentsCargoGlobal [weaponClassname, muzzle, side, top, bipod, [(primaryMagazine), (ammoCount), (secondaryMagazine), ammoCount], (count)]
//count is optional. you can supply empty array for magazine if you don't want any

Here

keen bough
#

that means i dont have to check for grenade launcher anymore?! 😄

tough abyss
#

Basically the same as for unit only for container?

keen bough
#

it seems so

still forum
#

yeah.

#

and in one command

#

Aaand I found the first flaw.

keen bough
#

which flaw?

still forum
#

If you want secondaryMagazine. You have to provice ammoCount for the primary. If you provide 0 you'll get empty magazine I assume
Maybe -1 works. I need to double check. but that's certainly something I didn't think about

#

🤞

#

Nope -1 doesn't work.
Not fatal, but not good either. Easy to fix tho

keen bough
#

yes, not too spectacular of a problem 😃

still forum
#

perfection!

#

Can anyone throw me a command that has a array argument, with optional values? can't find any on biki 😄

winter rose
#

kbTell iirc

still forum
#

YES! thanks

#

argumentArray1toN (Optional):
I'm supposed to write optional before the colon. already expected that I'm missing that

#

Dedmen at job interview at bohemia: "Why do you think that you are the best for this position" well if you'd look into your game binary you'd find my name in there already.

lavish ocean
#

edited my post about the waituntil fix, to make it clear there could be more different error messages

still forum
#

@lavish ocean permission to edit the Dev branch changelog of waitUntil to add instead it now throws a script error to make it more clear?
I'm sure oukej wouldn't mind

lavish ocean
#

well i didn't edit it either with the link to my preliminary documentation of server timeout and votekick settings

#
tough abyss
#

Aaand I found the first flaw. in your intercept one or in dev one?

still forum
#

Both are the same

slate gull
#

So it turns out that the blacklist.sqf i was trying to de-bug and get working was just entirely too complicated. And it was trying to call an array from another script which just wasnt working. I just kept chipping away at any things that didnt make sense or just didnt work and eventually succeeded.

#

It went from looking like this ```waitUntil{!isNil "tz_isExempt"};
waitUntil{!isNil "tz_util_isAdmin"};
// hint "tz_isExempt loaded";
sleep 2;
_name = name player;

_i = 0;
_o = 0;

if (player call tz_isExempt) exitWith{hint format ["Welcome %1 I hope you had a good day Middle Finger", _name]};

if (tz_warning == 0) then
{
{
tz_blacklist = _X;
for "_n" do {
if(isClass(configFile>>"CfgPatches">>_X))then {
_i = _i + 1;
};
};
}forEach tz_blacklist;

if (_i > 0)then{ 
hintC format ["%1 You will now be kicked back to the lobby", tz_kick_message];
sleep .01;
_o = _o + 1;
    if (_o > 0)then{
    endMission "END3";};
    {
    tz_isExempt = _X;
        for "_n" do {
        hint str format ["%1 was kicked for have %2 mods on", _name, _i];
        };
    }forEach tz_isExempt;
};

};

if (tz_warning == 1) then
{
{
tz_blacklist = _X;
for "_n" do {
if(isClass(configFile>>"CfgPatches">>_X))then
{
_i = _i + 1;
};
};
}forEach tz_blacklist;

    if (_i > 0)then
    { 
        hintC format ["%1 You will now be kicked back to the lobby", tz_warning_message];
        sleep .01;
        _o = _o + 1;
        if (_o > 0)then
        {
            {
            tz_isExempt = _X;
                for "_n" do 
                {
                    hint str format ["%1 has %2 mods on", _name, _i];
                };
            }forEach tz_isExempt;
        };
    };

};```

still forum
#

Eww

slate gull
#

to looking like this ```_name = name player;
_X = _blacklist;

hint "Blacklist read";
sleep 2;
if(isClass(configFile>>"CfgPatches">>"bannedMod1")) then
{
hint format ["%1 is being checked",_X];
sleep 2;
hintC format ["%1", _kick_message];
sleep 5;
hintC format ["You will now be returned to the lobby. Have a nice day %1", _name];
sleep 2;
endMission "END2";
};

if(isClass(configFile>>"CfgPatches">>"bannedMod2")) then
{
hint format ["%1 is being checked",_X];
sleep 2;
hintC format ["%1", _kick_message];
sleep 5;
hintC format ["You will now be returned to the lobby. Have a nice day %1", _name];
sleep 2;
endMission "END2";
};

sleep 2;
hint "Congratulations on not being a cheater ;)";```

still forum
#

still eww

#

but way less eww

#

gimme a sec

slate gull
#

I know but it works exactly how it should

still forum
#
private _name = name player;

hint "Blacklist read";
sleep 2;

{
    if (isClass(configFile>>"CfgPatches">>_x)) then {
        hint format ["%1 is being checked",_x];
        sleep 2;
        hintC format ["%1", _kick_message];
        sleep 5;
        hintC format ["You will now be returned to the lobby. Have a nice day %1", _name];
        sleep 2;
        endMission "END2";
    };
} forEach _blacklist;

sleep 2;
hint "Congratulations on not being a cheater ;)";

Not sure what your _x at the top is. That won't work my way. But this way it's easier to maintain

slate gull
#

_X is the array of names of banned mods.

still forum
#

So if you already have it.
Can just iterate
My code with forEach _blacklist

slate gull
#

Where would i put that?

still forum
#

} forEach ["bannedMod1", "bannedMod2"]; replace that part

#

Edited my post above

slate gull
#

So i can just write that whole thing once? instead of repeating for every mod?

still forum
#

yeah

slate gull
#

whats the purpose of putting private before _name?

still forum
#

Can't overwrite local variables from scripts that called yours.

#

probably not a problem in your case. But a good thing to make a habit out of

slate gull
#

ah ok.

slate gull
#

@still forum I just tested the way you did my script but it didnt work. The script cant resolve an array here if (isClass(configFile>>"CfgPatches">>_blacklist)) then where _blacklist is. I have tried many different ways of getting an array in that spot but it just wont take. So thank you for the help. The way i have it now works, yes its longer and a bit messier but its easy to read and understand and most importantly, works

still forum
#

I edited my script

#

like 10 seconds after I wrote "I edited my post" and fixed that

#

"I have tried many different ways of getting an array in that spot" the array being there is the error. there is not supposed to be an array here

#

so trying to put different arrays there won't do anything

slate gull
#

Yeah. So unless there is a way to, looks like the way i have it is ok.

still forum
#

huh?

#

I already told you how to fix

#

I already fixed it in the code snippet I posted above

slate gull
#

Yeah thats what i just tested, it didnt work.

still forum
#

the one with _x?

slate gull
#

yes.

still forum
#

That means blacklist doesn't actually contain the names of the mods like you told me it does

slate gull
#

Tested with _X, tested with _blacklist

#
    Run this through init.sqf with  
    [] execVM "admin_tools\blacklist_config.sqf";
*/
waitUntil {!isNull player};
waitUntil {(vehicle player) == player};
waitUntil {(getPlayerUID player) != ""};

_blacklist = 
[
    "KA_Suitcase_Nuke", 
    "SSPCM", 
    "NSS_Admin_Console", 
    "balca_debug_tool",
    "LAGO_SCannon",
    "LAGO_KU3K",
    "LAGO_CP",
    "LAGO_Weapons_Pack",
    "LAGO_ku3k",
    "LAGO_ku5k",
    "LAGO_ku98k",
    "LAGO_kuoook",
    "CCS_Armour_BlackSun",
    "Jaffa_Hand_Mounted_Cannon",
    "backpack",//Super high capacity backpack mod
    "sn_carryall_backpack_plus",
    "sn_carryall_backpack_lite",
    "TIOW_AutoWeapons",//Warhammer mod
    "a40K_wepbase",//Warhammer Mod
    "Cadian_Weapons"//warhammer Mod
];```
still forum
#

Yeah. That's correct and mine should work

#

how does blacklist.sqf get the _blacklist variable?

#

It's a local variable. so blacklist.sqf can't access it

slate gull
#

It doesnt. that was another problem. So i just ended up pasting it into same file as the _blacklist

still forum
#

Don't understand the problem then. My code should work just fine with that

slate gull
#

where _X is. thats where the problem lies. There isnt supposed to be an array there. So if _blacklist is an array and _X=_blacklist then its not going to work.

still forum
#

and _X=_blacklist then its not going to work. it's not

#

_x is a magic variable set by forEach

#

it contains the current element inside _blacklist that is being iterated

#

so _x will be "KA_Suitcase_Nuke"

#

And you DON'T SET _x yourself. It's done automatically

#

Just like in the snippet I posted

slate gull
#

I copied and pasted your post.

still forum
#
_blacklist = 
[
    "KA_Suitcase_Nuke", 
    "SSPCM", 
    "NSS_Admin_Console", 
    "balca_debug_tool",
    "LAGO_SCannon"
];

{
    if (isClass(configFile>>"CfgPatches">>_x)) then {
        systemChat format ["%1 is being checked",_x];
    } else {
        systemChat format ["%1 is not being checked",_x];
    };
} forEach _blacklist;

Just plugged that into debug console to test it.
Exactly this.
Result: https://s.sqf.ovh/arma3_x64_2019-04-19_02-15-51.png
no error whatsoever. Runs through perfectly fine

#

And that is the code I posted above. Which works fine

slate gull
#

hmmm.

still forum
#

No idea what you're maybe copy-pasting wrong

slate gull
#

lol

still forum
#

maybe show me the full script instead of just parts of it

keen bough
#

i do

[_v1, _v2] call awesomefunction;

And within the next script "_this" is filled with all informations. But when i do

_nV1 = _this select 0;
_nV2 = _this select 1;

_nv2 would be (always) empty. Am i overseeing something or do i do something wrong?

#

_nv2 should be within my test an everyContainer array.

#

My workaround would be storying my values within an array with all the params i want. like _tekeThis = [_v1, v2];

Yet i wonder what i do wrong.

keen bough
#

So, what is the cfg for general items? Items like whatever's not a weapon, weapon attachment and so on? Like vests, uniforms, bandages and so on?

winter rose
#

CfgVehicles, CfgBackpacks (iirc), and some others

drifting copper
ornate marsh
#

Hi, need help with a script. Is there anyway to make a health regen script for ace medical? looked online and there's no solutions. im also wanting a trigger to last for a certain amount of time e.g, once the trigger is activated, some walls spawn in and these walls should last for 500 seconds. i got the walls spawning in script

bright coral
#

@tough abyss
1.92 RC adds third party DLC support to the launcher. Now guess how far 1.92 is away 🙂

steep gazelle
#

How to use "diag_captureSlowFrame ['total',0.3]"? Every time I want to use it I get error

Error missing ;```
still forum
#

only works in profiling build

steep gazelle
#

I have profiling build. still get the error

still forum
#

you don't

#

How did you get profiling build

#

Maybe you just got the performance once?

steep gazelle
#

Through steam, when I launch Arma I have green badge in top left corner of the launcher saying "profiling"

still forum
#

Steam only has one branch. perf/prof

#

and afaik that's only prof

#

check ingame with script command productVersion

#

I always install them manually through dropbox. much easier

steep gazelle
#

["Arma 3","Arma3",190,145620,"Stable",false,"Windows","x64"]

still forum
#

"Stable"

#

that's not "profiling"

#

I'd recommend just installing manually from dropbox

steep gazelle
#

So I have to download profiling using dropbox?

#

So, I installed profiling and performance builds and problems with freezes disappeared so I don't have any possibility to check what's wrong with my game.

still forum
#

well if that fixes the freezes. then it will be fixed in next game update

steep gazelle
#

Hopefully, I'm on literal binge for arma

ornate marsh
#

im wanting this set of code this setHitPointDamage ["hitHead", 0]; this setHitPointDamage ["hitBody", 0]; this setHitPointDamage ["hitArms", 0]; this setHitPointDamage ["hitLegs", 0]; to execute every 15 seconds

#

or even better, execute 5 seconds after they take a hit

digital hollow
ornate marsh
#

right, so how would i make my code trigger when a unit gets hit by anything. Essentially im trying to make a health regen script for ace3

#

so im using this script: ```this addEventHandler ["Dammaged", {
params ["this", "_selection", "_damage", "_hitIndex", "_hitPoint", "_shooter", "_projectile"];

}];

this setHitPointDamage ["hitHead", 0];
this setHitPointDamage ["hitBody", 0];
this setHitPointDamage ["hitArms", 0];
this setHitPointDamage ["hitLegs", 0];``` and im getting "local variable in global space"

digital hollow
#

Leave the params line unchanged and just work with _unit inside the braces.

ornate marsh
#

what would i use instead in a units init file?

#

gotcha

digital hollow
#

Try a systemChat str [_unit, _selection, _damage, _hitIndex, _hitPoint, _shooter, _projectile]; to get familiar with what values get put into those variables.

ornate marsh
#

where do those results go

#

would i do params systemChat str [_unit, _selection, _damage, _hitIndex, _hitPoint, _shooter, _projectile];?

digital hollow
#
this addEventHandler ["Dammaged", {
    params ["_unit", "_selection", "_damage", "_hitIndex", "_hitPoint", "_shooter", "_projectile"];
    // you can now use those ^ variables inside the braces {}
    
    //see what they hold
    systemChat str [_unit, _selection, _damage, _hitIndex, _hitPoint, _shooter, _projectile];
    
    //do the stuff you want
    
}];
ornate marsh
#

ok so that script is working but my heal script isnt working

digital hollow
#

did you put it inside the braces?

ornate marsh
#

as in?

digital hollow
#

put your heal script where it says //do the stuff you want, and make sure they are working with _unit instead of this.

high marsh
#

Or better yet:

systemChat str _this;
digital hollow
#

I don't think he's ready for that yet xD one magic variable at a time

ornate marsh
#
    params ["_unit", "_selection", "_damage", "_hitIndex",      "_hitPoint", "_shooter", "_projectile"]; 
         
[objNull, player] call  ace_medical_fnc_treatmentAdvanced_fullHealLocal;     

}];```this is now working, essentially i get hit, and it instantly heals me. now i want it to register i get hit, wait 5 seconds, then heal me
#

could i just do sleep 5 in between the eventhandler and the script

#
    params ["_unit", "_selection", "_damage", "_hitIndex",      "_hitPoint", "_shooter", "_projectile"]; 

sleep 5;        

[objNull, _unit] call  ace_medical_fnc_treatmentAdvanced_fullHealLocal;     

}];``` here's my script. its registering im hit and then immediately healing me, and isnt waiting 5 seconds
high marsh
#

Unscheduled

ornate marsh
#

?

digital hollow
#

Read the page for sleep, look at the Description and Example.

ornate marsh
#

ah, so would i replace that sleep 5 with [] spawn {sleep 5;};

still forum
#

then you will launch a new script. that sleeps for 5 seconds and then does nothing and exits

ornate marsh
#

so thats what im wanting right?

high marsh
#

Spawn needs the parameters from the EH still

still forum
#

You want to do nothing?

high marsh
#

_this spawn { }

still forum
#

I thought you wanted to heal after 5 seconds. So you gotta put the heal part in there too

ornate marsh
#

i wanth the first event handler to execute, wait five seconds, then heal me

still forum
#

currently you are doing
heal instantly, then wait 5 seconds and do nothing

#

you have to put the heal after the 5 second sleep

ornate marsh
#

[] spawn {sleep 5; [objNull, _unit] call ace_medical_fnc_treatmentAdvanced_fullHealLocal; };

#

is that it?

still forum
#

Yes

#

now _unit is undefined though

#

you have to get it into the spawned code

#

If you look at

#

you'll see that you can pass arguments into it

ornate marsh
#
    params ["_unit", "_selection", "_damage", "_hitIndex",      "_hitPoint", "_shooter", "_projectile"]; 

[] spawn {sleep 5; [objNull, _unit] call  ace_medical_fnc_treatmentAdvanced_fullHealLocal; };   

}];``` this is my code so far
still forum
#

yup.

ornate marsh
#

coul i replace _unit in the sleep script with player

still forum
#

We don't know what your unit is

high marsh
#
_this spawn {
     params["_unit"];
      sleep 5;
     [objNull,_unit] call ace_medical_fnc_treatmentAdvanced_fullHealLocal;
};
still forum
#

which units init are you putting that into?

#

fullHealLocal only works for local units

ornate marsh
#

this is all in the init of a player

still forum
#

singleplayer?

ornate marsh
#

i have 6 players which will be on a dedi server, each having this code in the init

still forum
#

That means player1 will have the dammaged eventhandler on player2

#

and player1 will try to heal player2

#

which doesn't work. fullHealLocal only works local

#

meaning the player can only heal himself

ornate marsh
#

thats what im wanting

still forum
#

So you have to only add the eventhandler to yourself. Not to all other players

ornate marsh
#

when a person gets hit, it should wait 5 seconds, then heal them. I want this on each person

#

so could i not put the script in each person's init

still forum
#

Have you ever used a scriptfile? init.sqf or initPlayerLocal.sqf?

ornate marsh
#

a bit but not too experienced

still forum
#

you'd want the eventhandler to be added in initPlayerLocal.sqf

#

then just add it to player

#

and then you also don't need _unit and can just use player in the heal script

ornate marsh
#

but i would still need _unit in the eventhandler?

high marsh
#

Nope

#

Adding to loacal player, using / healing local player

still forum
#

I just told you you don't need _unit

#

and then you ask that you still need _unit?

ornate marsh
#

you said i dont need _unit in the heal script, i didnt know that included the eventhandler

#

i have hardly done scripting so no need to be condescending

still forum
#

you don't use _unit anywhere else

#

only place you use it is in the heal script

ornate marsh
#
    params ["_unit", "_selection", "_damage", "_hitIndex","_hitPoint", "_shooter", "_projectile"]; ```
#

right there

still forum
#

params is not using variables

#

it's creating them

ornate marsh
#

right, so is that what i need in the initPlayerLocal.sqf, and that will check every player?

still forum
#

It will check yourself

#

as each player is himself. Yes.

#

Each player runs that script. And the script checks the local player

ornate marsh
#

right, so then where do i put the heal script/sleep thingy?

#

init of each player

still forum
#

initPlayerLocal.sqf

#

Told you that 6 minutes ago

#

Move the whole thing that you have in init boxes now. Into that script file

ornate marsh
#
    params ["_unit", "_selection", "_damage", "_hitIndex","_hitPoint", "_shooter", "_projectile"]; 

_this spawn {
     params["_unit"];
      sleep 5;
     [objNull,player] call ace_medical_fnc_treatmentAdvanced_fullHealLocal;
};``` this is what I have in the initPlayerLocal
still forum
#

you don't need to pass _this to spawn anymore

#

you don't need the params for _unit as you don't use it anymore

#

and as you've been told before. this can only be used in specific ways.
And as you've also been told before then just add it to player
add the eventhandler to player. not this

ornate marsh
#
    params ["_unit", "_selection", "_damage", "_hitIndex","_hitPoint", "_shooter", "_projectile"]; 

spawn {
      sleep 5;
     [objNull,player] call ace_medical_fnc_treatmentAdvanced_fullHealLocal;
};``` better?
still forum
#

You are missing one };

ornate marsh
#

i know nothing about this so sorry about not grasping everything

still forum
#

You are opening the brace on addEventHandler. And opening another one at spawn. But you are only closing it once

#

You have to have a equal number of opening/closing

#

You are also not closing the [ of addEventhandler

ornate marsh
#

i know that just didnt see it xD

#
    params ["_unit", "_selection", "_damage", "_hitIndex","_hitPoint", "_shooter", "_projectile"}]]; 

spawn {
      sleep 5;
     [objNull,player] call ace_medical_fnc_treatmentAdvanced_fullHealLocal;
};```?
still forum
#

no

#

You had it correct in the beginning

ornate marsh
#

wut

#
    params ["_unit", "_selection", "_damage", "_hitIndex","_hitPoint", "_shooter", "_projectile"]}]; ``` surely this has closed em all off
still forum
#

No

#

Okey yeah this variant is more correct

#

but now you don't have any code in the eventhandler. besides the params which I've told you to remove

#

You want to execute your healing script when the eventhandler fires

#

so you have to put it INISIDE the eventhandler. Not just next to it

#

The eventhandler executes the code you give it, when the event fires

ornate marsh
#
    params ["_unit", spawn {
      sleep 5;
     [objNull,player] call ace_medical_fnc_treatmentAdvanced_fullHealLocal;
    };
    ]
    }
]; ``` any better?
still forum
#

worse

ornate marsh
#

i had no idea what to do with the brackets at the bottom 😛

still forum
#

I told you to remove params 3 times now

#

you still have it

#

and now you've stuck the spawn into it which makes no sense at all ^^

#

Also I told you you had it right before when it was still in init box.

#

Just scroll up in the chat and look what you did there

ornate marsh
#

thats the thing, i dont get what your saying, if you perhaps showed me instead of just telling me im wrong i might understand

#

i dont grasp code well at all

#
[] spawn {sleep 5; [objNull, player] call  ace_medical_fnc_treatmentAdvanced_fullHealLocal; };   

}];```
still forum
#

👏 👍

ornate marsh
#

wo thanks for your passive aggression

#

felt that

still forum
#

But now you've reverted what you previously did right and are now doing it wrong again ^^

ornate marsh
#

but then do i remove the this at the start

still forum
#

As told 3 times: this

#

yes

#

like you had it in your second last script

ornate marsh
#
player addEventHandler ["Dammaged", { 
[] spawn {sleep 5; [objNull, player] call  ace_medical_fnc_treatmentAdvanced_fullHealLocal; };   

}];```
#

ignore sqf at start

still forum
#

```sqf
<code>
```
instead of
```
sqf
<code>
```

ornate marsh
#
player addEventHandler ["Dammaged", { 
[] spawn {sleep 5; [objNull, player] call  ace_medical_fnc_treatmentAdvanced_fullHealLocal; };   

}];
#

ah i see

#

right thats working thanks for the help

leaden parrot
#

quick question: I want to place some units offset to an object I have on both X and Y axis. I can move them in one direction by using getpos [6, 0]; and then do a _foreachIndex * 5; to move each 5 meters when placing them in my array.

but what if I want to place them offset on the Y axis?

still forum
#

getPos takes a direction

#

so instead of northwards, just move them east or west

leaden parrot
#

yeah so i would to [5, 180]to move them south of my object. but now I want to spawn them on the right side of the first dude. so I get a line going west to east.

still forum
#

use 90 degrees then

leaden parrot
#

but then they get offset 5 meters to the right but they are still placed northwards.

#
    private _posCenter = campfire getpos [5, 180];
    {
        private _grouppos = _foreachIndex * 5;
        private _unitpos = _posCenter getPos [_grouppos, 0];
        _x setPos _unitpos
    } 
    forEach (units Alpha1);
astral dawn
#

this question is rather in geometry domain, it's better resolved by taking a paper (with grid) and drawing what you want to achieve 🤔

leaden parrot
#

Am I right in thinking I cant get the getpos to take in multiple axis at once? The wiki had the "getposATL " which takes 3 axis input, but changing it to that and feeding it 3 numbers didnt work.

astral dawn
#

getPos has special syntax which can return position relative to another position by taking heading and distance, other commands dont have such functionality

still forum
#

but they are still placed northwards. Yes. Because you are placing them northwards

#

private _unitpos = _posCenter getPos [_grouppos, 0];
Direction 0° which is north.

#

Am I right in thinking I cant get the getpos to take in multiple axis at once? it takes a direction. Compass direction.
If you make it northeast it will move on X AND Y axis. So it can do multiple axis

leaden parrot
#

..

#

so

#

Dunno what happened before.I already tried changing my second degree input and they just got placed in a circle. I probably did it so the foreachindex was adding the rotation up per placement

#

but of course it works now. I can place them in a line offset from the object now. Thanks for keep helping me

leaden parrot
#

maybe this is to advanced for me. is there any way to make "BIS_fnc_findSafePos" choose a place that includes at least one building or structure?

tough abyss
cosmic lichen
#

Has anyone tested the new calculatePath command yet?

#

For me it returns an agent

still forum
#

you apparently need to add the PathCalculated eventhandler to the agent

#

and then it will eventually fire

#

unless you add it too late and miss it

cosmic lichen
#

I see. Thought I could use that command to draw the path a unit would take before actually giving the order.

#

Guess I'll wait until the documentation is finalized

still forum
#

can spawn agent on same position and let it calc path. Should be same result

cosmic lichen
#

I'll wait and see. Could be an intersting little command.

tough abyss
#

I'll wait and bleed... inside my shell

astral dawn
#

Hahaha really?? Why did they add a calculatePath command?

#

I have made a forum thread a year ago or more like' could you expose game's path finder to SQF because It's stupid to see people make their own super slow A* planner all the time'

still forum
#

guess that was the easiest way ¯_(ツ)_/¯

astral dawn
#

Yes the way it's done is pretty... interesting...

keen bough
#
private _thisArray = _this select 0;
private _countThisArray = count _thisArray;


for [{_loop = 0}, {_loop < _countThisArray}, {_loop = _loop + 1}] do
{
  _select = _thisArray select _loop;
  removeAllActions _select;

  [_select, [
  "Scrap Wreck",
  {

      params ["_target", "_caller", "_actionId", "_arguments"];
      // put function for wreck here
    [] call narC_fnc_vehiclePlayerWreck;
  },
  [],
  1.5,
  true,
  true,
  "",
  "true", // _target, _this, _originalTarget
  6,
  false,
  "",
  ""
  ]] remoteExec ["addAction", 0, true];

in my called function i cant access _this. What am i doing wrong, please?

#

If i am correct it says, it sends those informations in params automatically over. But it wont. I am now a bit clueless.

astral dawn
#

it looks like you are missing a bracket [ at start or am I wrong?

keen bough
#

thats the selected vehicle, thats fine. action works but i dont get any params.

astral dawn
#

oh wait i was looking wrong

#

you mean _this at first line or where?

keen bough
#

Cant tell. addAction told me, when i use the action, basically activating the action, i get the params in the new script i call. like _caller _target n' such.

#

the wiki i mean.

still forum
#

which line in there is going wrong?

#

your fnc_vehiclePlayerWreck?

keen bough
#

its working all fine, but in my fn_vehiclePlayerWreck the "_this" mVariable is empty. But the wiki stated that i get all the named params like _target, _caller and such. Or did i misunderstood that?

still forum
#

correct

#

you are passing [] as arguments to call

#

and _this is your arguments

#

thus _this=[] when you pass []

keen bough
#

are the params, that addAction gives me already filled with the informations? If so, i could put them all into an aray, or if its something else, what can i write into [] before call?

still forum
#

you can either fill the empty array with the things you want.
or do a _this call to pass it through directly.
OR. Just do a call without arguments.
Which will leave _this undefined in your fnc_vehiclePlayerWreck. Which means it will use the _this of the next higher scope. Which will be the arguments of your action then.

keen bough
#

ah! i will try it. Didnt know that. I could pass _this within the [] before call too?

still forum
#

sure.. But why pass array inside array just to pull array out of array again.. If you could just pass _this directly

keen bough
#

hehe, sure, just wanted to be fully sure :3

#

<squeaks> all the functions run so perfect. So smooth, so awesome. I can write scripts now double the speed and bugfix even faster!

keen bough
#

Currently still on the lookout. But i ask anyway: Is there a way i can check if something already has an addAction / action active? So i dont have to remove everything all the time and re-add it? (current workaround)

#

i check in the player vicinity if there are wrecks so they can salvage or repair those wrecks. Script runs on live server every 30 seconds, for testing every 15 seconds. Everything works perfect but... i get annoyed when the action pops up all the time when i am near the vehicle wreck.

#

(if iam near to it)

#

hmm. That would work. How precise does it need to be? straight look at the very specific point where the vehicle exists or 'general direction'?

#

or how precise is it.

#

Hmmm. Not particular to my liking.

#

Still the vehicle easily can be intersecting and the thing popping up. Its not like crazy - we have it in different other situations too even with ace-stuff or rhs-stuff. So i guess there is no pure clean solution to it i guess

#

Only thing i can imagine is, instead of an automatic check i could make it an interaction check. I mean... A wreck is not that hard to see XD