#arma3_scripting

1 messages · Page 159 of 1

meager granite
#

depending on your setup it might be tricky

#

I have no idea how it works, I suck with AI

haughty sand
#

how doi disable ai

meager granite
#

disableAI, read the wiki

#

no idea if disabling AI mid-drive will keep vehicle drying, maybe they'll just stop at once

#

I'm just guessing, you'll need to test it yourself

#

setDriveOnPath could be what you want, try it first

granite sky
#

setDriveOnPath won't normally run into other vehicles, only map objects.

#

disableAI + setVelocity might be a better bet.

meager granite
#

Thanks, that was it!

waxen sand
#

I requiring assistance in learning how to do some basic coding

#

So, basically, I want to be able to use as a Blufor UAV Specialist, Redfor UAV terminals and connect to their UAV.

#

Just this basic stuff.

pliant stream
#

They're just different tools, use a PFH if you need something to happen each frame

#

Also it has the advantage of running unscheduled

meager granite
#

but this will make everything attack them

#

and all waypoints will be lost

#

Otherwise you could script your own "hacked control" system but that's way out of your ability

waxen sand
#

I guess I'll trust lady Luck and my trustworthy MG42 with full tracers to hopefully damage it just enough for it to smoothly land somewhere and hack it manually

pliant stream
#

If on the other hand you want to sleep for one frame in the scheduled environment you might do something like _frame = diag_frameNo; waitUntil { _frame != diag_frameNo };

jade acorn
#

ok I think I don't understand something. I have a situation where I need to add some editable groups to the Zeus without knowing the module's varname, it's created on fly I believe (using the Zeus Wargame mod). Why does

_zeus = allCurators select 0;

_zeus addCuratorEditableObjects [units myGroup,true];

not work but

if (isServer) then
{
    0 spawn
    {
        while { true } do
        {
            {
                _x addCuratorEditableObjects
                [
                    entities [[], ["Logic"], true /* include vehicle crew */, true /* exclude dead bodies */],
                    true
                ];
            } count allCurators;
            sleep 60; // change to whatever fits your needs
        };
    };
};``` works?
2nd is taken of the wiki but I want to add specific group(s) like in the first example.
#

how do I get the first element of the command syntax if I know the zeus's group name/unit varname?

jade acorn
#

yeah just found it I wonder though why count allCurators works but allCurators select doesnt

south swan
#

maybe something creates an extra curator? Does allCurators only return one result for you there? Because when i run your first example in the editor with a single group and single Game Master module - it works alright.

jade acorn
#

count allCurators returns 1

south swan
#

strange stuff

jade acorn
#

my head hurts when I touch SQF...

south swan
#

and does units myGroup return what's expected for sure? And is the command run on the server? I can't think of any other points of failure here

jade acorn
#

yes, an array of units in the group

tough abyss
#

So I am getting this error, saying im missing a ; but im not. 🤔 ```sqf

[] spawn {
while {true} do {
// Notify the player that a new wave is starting
hint format ["Wave %1 start!", waveCount];
systemChat format ["Wave %1 start!", waveCount];
sleep 15;
// Spawn units for the current wave
for "i" from 1 to waveCount do {
unit1 = enemyGroup createUnit ["O_Soldier_F", spawnPosition, [], 0, "NONE"];
unit1 move (getPosASL EnemyObject);
};

// Spawn vehicle every 5th wave
if ((waveCount % 5) == 0) then {
truck1 = createVehicle ["O_G_Offroad_01_armed_F", spawnPosition, [], 0, "NONE"];

        //Driver assgin
        driver = enemyGroup createUnit ["O_Soldier_F", spawnPosition, [], 0, "NONE"];
        driver assignAsDriver truck1;
        driver moveInDriver truck1;
        //Gunner assgin
        gunner = enemyGroup createUnit ["O_Soldier_F", spawnPosition, [], 0, "NONE"];
        gunner assignAsGunner truck1;
        gunner moveInGunner truck1;

        //Moving truck1 to objective
        truck1 move (getPosASL EnemyObject);
    };```

I found out you can derictly assgin a vehicle to a group, right? you have to assgin a driver and put the driver in the group?

proven charm
#

driver & gunner are reserved variables / commands

south swan
#

and you can't name your variables such

tough abyss
proven charm
#

yea

tough abyss
winter rose
tough abyss
#

oh wait i read that wrong

#

sorrrry, yes i understand now thanks you everyone

proven charm
winter rose
#

e.g

driver _myCar; // orange Discord = command
_guy setDamage 1;
setDamage = 42; // nope
tough abyss
#

ahhhh okay, its making sense

winter rose
#

commands were actually protected only… during Arma 2's lifetime 😬 before that you could do something like true = false or player = objNull, etc

tough abyss
#

whoa lol

grizzled cliff
#

waitUntil isn't guaranteed, it'll execute at most once per frame, not at least once per frame.

tough abyss
#

so my code only spawn one truck at wave 5 but not two at wave 10?

winter rose
#

no, one each x % 5 == 0 step

tough abyss
#

10 % 5 = 0

winter rose
#

one at 5, one at 10, one at 15

tough abyss
#

wait

#

okay ya even still, it didnt spawn anything at wave 10? odd

winter rose
#

you may want to floor (x / 5)

#

if you want 5 10 15 to create 1 / 2 / 3 trucks

tough abyss
#

correct ya okay ill look it up and see

winter rose
# tough abyss So I am getting this error, saying im missing a ; but im not. 🤔 ```sqf [] sp...

this should work

[spawnPosition, getPosASL EnemyObject] spawn {

    params ["_spawnPosition", "_destination"];

    private _group = createGroup [opfor, false];
    private _waveCount = 0;

    private ["_soldier", "_vehicle"];

    while { alive player } do
    {
        _waveCount = _waveCount + 1;
        for "_i" from 5 to 1 step -1 do
        {
            cutText [format ["Wave %1 in %2...", _waveCount, _i], "PLAIN"];
            sleep 1;
        };

        // notify the player that a new wave is starting
        hint format ["Wave %1 start!", _waveCount];
        systemChat format ["Wave %1 start!", _waveCount];

        // spawn units for the current wave
        for "_i" from 1 to _waveCount do
        {
            _group createUnit ["O_Soldier_F", _spawnPosition, [], 0, "NONE"];
        };

        // spawn vehicle every 5th wave
        if (_waveCount % 5 == 0) then
        {
            _vehicle = createVehicle ["O_G_Offroad_01_armed_F", _spawnPosition, [], 0, "NONE"];
            _group createVehicleCrew _vehicle;
        };

        // move everyone
        _group move _destination;

        sleep 25; // 30s each
    };
};
noble comet
#

Can someone help me with a script that spawn a unit after the "A" unit was shot and add the eventhandler for the damage to this one

buoyant cairn
#

which script i should use to increase my player outgoing damage?

pliant stream
#

Yes i know that but it's more accurate than sleep 0.01 or something which may or may not pause at all

queen cargo
#

ye ... or just use sleep 0.0001
it will sleep then for at least one frame

#

unless you got a 1k framerate

thin geode
#

i might be being silly or just cant wrap my head around, i made a mission last year which i made a vehicle spawner, i tried doing the same method and it doesnt work...... have something change? alot has seem to change in the workbench editor

jade acorn
#

Are we supposed to guess the "same method"? Also this is an Arma 3 channel, Workbench is a Reforger tool.

jade acorn
tulip ridge
thin geode
#

i know im confused too as before i put down vehicle maintance prefab with a entity spawner adn that worked it doesnt now......

little raptor
#

Use Reforger channels instead

thin geode
#

oh sorry some reason i did click on reforger channel

buoyant cairn
little raptor
#

It's up to you. You can script it so that it only affects your shots

buoyant cairn
little raptor
#

You can use the FiredMan event handler to set a variable on your shots to distinguish them from other shots

buoyant cairn
#

would be something like: player addEventHandler?

little raptor
#

You mean how to add the EH? Yes

buoyant cairn
#

yes, also how it should be written

little raptor
#

The EH code and the stuff you need to do in them is the important part

#

I'm currently on mobile so I can't write the code for you
But you should do this:

  1. Add FiredMan EH to player, grab projectile, set some variable on it (e.g. "my_isPlayerShot", true)
  2. Add HandleDamage EH to every unit, in its code check if they're enemy and if so, get the dealt damage and multiply it by whatever factor you want (which is _damage - _currentDamage where damage is the EH damage and current damage is the hit point damage/total damage), then add the dealt damage back to current damage and return it in the EH
sharp torrent
#

if (_vharr = isClass (configFile >> "CfgVehicles" >> typeOf _vharr >> "Components" >> "TransportPylonsComponent" >> "Pylons")) then Getting "Parse Error: syntax error, unexpected =, expecting )" here. If I am corrent the code should check if class pylons exist to continue with then [command lines] and if returned false it should skip to else [further in the code]

buoyant cairn
#

im not experienced with it

#

but i'll give it a shot and see if i can do it

sharp torrent
warm hedge
#

Leo said remove _vharr =

sharp torrent
#

ok. no parsing error now

#

thx

thin fox
#

Hello. I'm trying to setup an artillery position with barriers and such by using modelToWorld. The barriers is floating and I'm already using a code to counter that.
My code:

    for "_count" from 1 to 3 do {
        private _barrier = createVehicle ["Land_HBarrier_Big_F", markerPos "ghost_spot" , [], 0, "CAN_COLLIDE"];
        switch (_count) do {
            // Front barrier
            case 1 : {
                _barrier setPosATL (arty1 modelToWorld [0,7,0]);
                _barrier setDir (_barrier getRelDir arty1);
            };
            case 2 : {
                // Side barrier
                _barrier setPosATL (arty1 modelToWorld [7,0,0]);
                _barrier setDir (_barrier getRelDir arty1);
            };
            case 3 : {
                // Side barrier
                _barrier setPosATL (arty1 modelToWorld [-7,0,0]);
                _barrier setDir (_barrier getRelDir arty1);
            };
        };
        _barrier setVectorUp (surfaceNormal (position _barrier));
    };

Is there a way to fix that without the use of like _barrier setPosATL (getPos _barrier vectorAdd [0,0,-3]);?

warm hedge
#

You want to make them stick to the ground?

warm hedge
#

intersect commands are your first resort. lineIntersectSurfaces etc

thin fox
warm hedge
#

vectorAdd [0,0,0] literally means nothing

thin fox
#

I know

thin fox
warm hedge
#

If there is an intersect, result can have both position in ASL and surface's vector normal

#

Which you can use in this case

thin fox
warm hedge
#

Basucally that's the idea

granite sky
#

Note that simply setting the ATL Z coordinate to 0 will anchor the vast majority of objects to the ground.

warm hedge
#

Urm, that is also an idea

granite sky
#

your modelToWorld calculations probably have a non-zero Z result.

#

Sometimes the orientation gets weird, but _object setVectorUp surfaceNormal _pos generally fixes that.

thin fox
granite sky
#

something like that, yes.

granite sky
#

That's only for orientation, not floating.

#

Only matters for some objects on very non-flat terrain.

#

which shouldn't be an issue here because I assume your artillery is sitting on flat terrain.

hallow mortar
#

I think you can use the new setWaterLeakiness command to stop objects floating hmmyes

thin fox
#

setPosATL [x,y,0] did the trick

#

thank you POLPOX and John Jordan

warm hedge
#

Positions are always pain anyways

tough abyss
#

is their a move aggesive "move", the enemies keep laying down and I wounder if there is a force combat walk?

#

I would also like to modify the asset list in warlords mode, is that done by creating a description.ext file?

tough abyss
#

oh ya that is gonna work, also having an issue with the randomSelect, should random index an arry, ya? ```sqf
infantryPositions = [getPosASL personalSpawn, getPosASL personalSpawn_1, getPosASL personalSpawn_2];

//==== Infantry Spawn ====//

[] spawn {
while {true} do {
// Notify the player that a new wave is starting
hint format ["Wave %1 start!", waveCount];
systemChat format ["Wave %1 start!", waveCount];
infantryPositions = selectRandom infantryPositions;
// Spawn units for the current wave
for "i" from 1 to waveCount do {

        unit1 = enemyGroup createUnit ["O_Soldier_F", infantryPositions, [], 0, "NONE"];```
#

ty community for da help btw

warm hedge
#

What issue with selectRandom

tough abyss
tulip ridge
#

You're trying to create a global variable in your for loop

#

Should be "_i"

warm hedge
#

And your selectRandom overwrites itself

tulip ridge
#

Yeah
You're declaring infantryPostions as an array, and then changing it to be a random element from that array

warm hedge
#

Which means, as far as we could assume, it will work only for once

tulip ridge
#

So then on the next loop you try to do selectRandom [x, y, z], and then kn the next loop you do selectRandom x (or any of the elements)

tough abyss
#

okay I am pretty such a noob'

#

okay so let me see if I undeerstand what you mean

tulip ridge
#

You basically go:

[[0, 1, 2], [3, 4, 5]]
[0, 1, 2]
2 // error
tough abyss
#
infantryPositions = selectRandom [getPosASL personalSpawn, getPosASL personalSpawn1, getPosASL personalSpawn2];
//==== Infantry Spawn ====//

[] spawn {
    while {true} do {
        // Notify the player that a new wave is starting
        hint format ["Wave %1 start!", waveCount];
        systemChat format ["Wave %1 start!", waveCount];
        infantryPositions = selectRandom infantryPositions;
        // Spawn units for the current wave
        for "i" from 1 to waveCount do {

            unit1 = enemyGroup createUnit ["O_Soldier_F", infantryPositions, [], 0, "NONE"];```??
tulip ridge
#

I don't even see what you changed

warm hedge
#

You're not getting the point is what I see

tough abyss
#

Clearly, Like I just stated I am pretty new at this.

warm hedge
tulip ridge
#

But no, instead of doing infantryPositions = selectRandom infantryPositions, just make a new variable

private _position = selectRandom infantryPositions;
warm hedge
#

I'm not blaming you anyways

tough abyss
#

okay I see, so does this look any better gentlemen? ```sqf
infantryPositions = selectRandom [getPosASL personalSpawn, getPosASL personalSpawn1, getPosASL personalSpawn2];
//==== Infantry Spawn ====//

[] spawn {
while {true} do {
// Notify the player that a new wave is starting
hint format ["Wave %1 start!", waveCount];
systemChat format ["Wave %1 start!", waveCount];
infantrySpawnpoint = selectRandom infantryPositions;
// Spawn units for the current wave
for "i" from 1 to waveCount do {

        unit1 = enemyGroup createUnit ["O_Soldier_F", infantrySpawnpoint, [], 0, "NONE"];```
tulip ridge
#

That works, but you're currently making all of those variables global, but do they need to be?

tough abyss
#

Ya nah all good, I am just so new so of this quick zoots over my head.

tulip ridge
#

You're good

warm hedge
#

I think suggesting global or local makes only headache for today

tough abyss
#

well, only the infantry will use this spawn so I soppuse it doesn't

tough abyss
tulip ridge
tulip ridge
#

Local variables always start with an underscore

#

And if you do need to make a global variable, you should give it a "tag", or prefix so you don't accidentally conflict with some other script

warm hedge
#

Well even though you're true

#

It still seems to be a stage of "at least my garbage is working"

tulip ridge
#

I wouldn't say garbage
I have seen far worse

#

Hundreds of lines of getter commands instead of just getting it once and checking against an array

#

That specific example is from one of WebKnight's mods, who is pretty well known for poorly written scripts

tough abyss
warm hedge
#

But anyways I guess you may need to keep it into a corner of your mind

tough abyss
#

Well it didn't work, I got the same error, so I tried this, ```sqf
[] spawn {
while {true} do {
// Notify the player that a new wave is starting
spawnOne = getPosASL personalSpawn;
spawnTwo = getPosASL personalSpawn1;
spawnThree = getPosASL personalSpawn2;
hint format ["Wave %1 start!", waveCount];
systemChat format ["Wave %1 start!", waveCount];
infantryPositions = selectRandom [spawnOne, spawnTwo, spawnThree];
infantrySpawnpoint = selectRandom infantryPositions;
// Spawn units for the current wave
for "_i" from 1 to waveCount do {

        unit1 = enemyGroup createUnit ["O_Soldier_F", infantrySpawnpoint, [], 0, "NONE"];
        unit1 move (getPosASL EnemyObject);
        unit1 setUnitPos "UP";
    };

    if (floor(waveCount) >= 5) then {
        heavyGunner = floor(waveCount / 5);
        for "_i" from 1 to heavyGunner do {
        unit2 = enemyGroup createUnit ["O_Urban_HeavyGunner_F", infantryPositions, [], 0, "NONE"];
        unit2 move (getPosASL EnemyObject);
        unit2 setUnitPos "UP";
        };
         
    };

    ``` maybe I dont need infantrySpawnpoint = selectRandom infantryPositions; anymore and just call infantryPositions
#

still getting this, maybe Im using getPolASL incorrectly?

meager granite
#

infantryPositions is already a position array

#

you then do selectRandom on it again which returns random number from the array

#

When it doubt, add debug hints/chats/logs

tulip ridge
#

Also for unit2 you still use infantryPositions

tough abyss
#

ya I saw this, thank you

meager granite
#
        infantryPositions = selectRandom [spawnOne, spawnTwo, spawnThree];
        systemChat str ["infantryPositions", infantryPositions];
        infantrySpawnpoint = selectRandom infantryPositions;
        systemChat str ["infantrySpawnpoint", infantrySpawnpoint];
#

you'll see what's going on

buoyant cairn
meager granite
tough abyss
#

okay so it's grabbing the coordinates?

buoyant cairn
# meager granite Post code

player addEventHandler ["HandleDamage", { params ["player", "", "50", "player", "bullet", "-1", "player", "CfgWeapons", "true", 0]}];

meager granite
meager granite
tough abyss
#

oh! well, I need just a random index of the arry

buoyant cairn
tough abyss
#

same brother

buoyant cairn
#

still have a lot to learn

tulip ridge
#

Also the spawnOne = ..., spawnTwo = ... aren't really doing anything for you
You can just leave it like you had it before

infantryPositions = [
    getPosASL personalSpawn,
    getPosASL personalSpawn1
    // etc.
];
tough abyss
#

wait, okay that make sense becuase once it indexs the arry the first time, it'll only be a single int?

buoyant cairn
#

oh well, i'll try a quick search to fix this mess of a code i made

tulip ridge
tough abyss
#

I feel like my brain synapsis has made a ton of connections today lol. wow. is this... learning?

#

it worked! just in the air? lol

#

setUnitFreefallHeight?

tulip ridge
#

Are the objects you're using as spawnpoints in the air?

tough abyss
#

no they are the transport pods on the ground

tulip ridge
tulip ridge
tough abyss
tulip ridge
#

Oh actually it's because createUnit takes a position / position2D, not a positionASL

tough abyss
#

damn brother how do you know all this?

tulip ridge
#

Or "biki" for Bohemia Interactive Wiki

tough abyss
#
type: String - classname of unit to be created as per CfgVehicles
position: Object, Group or Array format Position or Position2D - location at which the unit is created. In case of Group position of the group leader is used``` ahhhh okay okay.
tulip ridge
#

So you could actually simplify your code a decent bit by just using the object's variable names themselves, rather than getting their position

tough abyss
#

I am reading it but I dont see it

tulip ridge
#

Don't see what?

tough abyss
#

position2D

warm hedge
#

position2D is not a command you can use. It is just a "format" of an array which contains two numbers

tulip ridge
#

You could try just doing:

infantryPositions = [
    personalSpawn,
    personalSpawn1
];
#

Which would (should) just spawn the units on the object

I'm not sure what position format it uses when just using an object, but may work better for you

tough abyss
#

okay ya lost me, I am looking at the docs so I get that it just takes the x and y and assume Z

#

but how do I tell it to assume Z?

#

could I do this?

meager granite
warm hedge
#

setPosATL or others are more reliable and safer way

tulip ridge
#

A Position2D is just an array of two numbers, [x, y]. There is no z coordinate because it's well, 2D

It probably just spawns it at terrain height in that case

tough abyss
#

right, but I need to know the x and y corrs for each

warm hedge
#

About Ghost, indeed EHs IS complicated to understand in your first day. You seriously better to forget your idea for now, and start from very simple and reliable command. Like, just do Hello World

buoyant cairn
#

lol

tulip ridge
#

If it spawns them in the right spot, great

tough abyss
#

thats what is happening.

tulip ridge
#

Currently, or at least in the last code you sent, you're using their ASL positions, not just passing the object

tough abyss
#

oh okay the object is personalSpawn

#

uh, wait I though I needed to try getPosATL?

tulip ridge
#

That's a different position type (there's several, it will be confusing at first)

warm hedge
#

(It still is to me)

tough abyss
#

oh but ya know I think getPosATL is da winner chicken dinner

tulip ridge
#

But createUnit doesn't accept a PositionATL

tough abyss
#

thank yall so much

meager granite
#

createVehicle/createUnit takes PositionAGL

tough abyss
meager granite
#

So the rightestest would be ASLtoAGL getPosASL ...

#

or just do set [2, 0] after any getPos*

tough abyss
#

does medium right work?

buoyant cairn
#

@meager granite private["_damage"];
_damage = 100;

private ["_hit"];
_hit = [];
_hit addEventHandler ["Hit", {if (player == _this select 0) then {if (isNil {"CIV_Man" find in (_this select 1)} == false) then {_this setDamage _damage}}];

#

what is wrong with it now?

fair drum
#

everything lol

#

what are you trying to do

buoyant cairn
buoyant cairn
fair drum
#

i'll see if dart is gonna take that one before i answer

#

we really should be better with making threads here

tulip ridge
# buoyant cairn <@107672558320496640> private["_damage"]; _damage = 100; private ["_hit"]; _hit...

A couple of things

  1. Just use the inline private keyword, not the array version. It's slower and annoying to work with
private _varName = ...;
  1. You're trying to use addEventHandler on an array and not an object
  2. You can use https://community.bistudio.com/wiki/params to make variables out of passed arguments (or any array)
  3. _this select 1 (i.e. _source from https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Hit) is an object, not an array
  4. You reference _damage in your event handler code, but event handlers run in their own scope, so this variable is undefined
  5. isNil {"CIV_Man" find in (_this select 1)} == false what are you even checking here?
fair drum
buoyant cairn
#

okay, i need to take this very slow, so i'll make a thread here

#

How to increase the player damage

tough abyss
#

Do a create a description.ext if modify the warlords sset list?

cobalt path
#

Question, I have a script that adds ACE Self Interactions. However, if I put it in initPlayerLocal.sqf, it doesn't do anything (Not in SP atleast), and if I put it into init.sqf for some reason, only I had it, and noone else did.

_mgmaction1 = ["MGM","MGM","",{},{true}] call ace_interact_menu_fnc_createAction;
_mgmaction2 = ["Check Camouflage","Check Camouflage","",{
_mfcoef1 = player getUnitTrait "CamouflageCoef";
hint format["Your camo coef is %1 good luck",_mfcoef1];
},{true}] call ace_interact_menu_fnc_createAction;
_mgmaction3 = ["Adjust Eyes 1","Adjust Night Sight","",{
setAperture 3;
},{true}] call ace_interact_menu_fnc_createAction;
_mgmaction4 = ["Adjust Eyes 2","Concentrate Night Sight","",{
setAperture 1;
},{true}] call ace_interact_menu_fnc_createAction;
_mgmaction5 = ["Adjust Eyes 3","Day Sight","",{
setAperture 0;
},{true}] call ace_interact_menu_fnc_createAction;

[player, 1, ["ACE_SelfActions"], _mgmaction1] call ace_interact_menu_fnc_addActionToObject;
[player, 1, ["ACE_SelfActions", "MGM"], _mgmaction2] call ace_interact_menu_fnc_addActionToObject;
[player, 1, ["ACE_SelfActions", "MGM"], _mgmaction3] call ace_interact_menu_fnc_addActionToObject;
[player, 1, ["ACE_SelfActions", "MGM"], _mgmaction4] call ace_interact_menu_fnc_addActionToObject;
[player, 1, ["ACE_SelfActions", "MGM"], _mgmaction5] call ace_interact_menu_fnc_addActionToObject;
#

I can execute module while ingame/zeus, but its I dunno, its always perfect. Especially when players rejoin

stable dune
# cobalt path Question, I have a script that adds ACE Self Interactions. However, if I put it ...

works for me

params ["_player"];

private _mgmaction1 = ["MGM","MGM","",{},{true}] call ace_interact_menu_fnc_createAction;
private _mgmaction2 = ["Check Camouflage","Check Camouflage","",{
    private _mfcoef1 = player getUnitTrait "CamouflageCoef";
    hint format["Your camo coef is %1 good luck",_mfcoef1];},{true}] call ace_interact_menu_fnc_createAction;

private _mgmaction3 = ["Adjust Eyes 1","Adjust Night Sight","",{
    setAperture 3;},{true}] call ace_interact_menu_fnc_createAction;

private _mgmaction4 = ["Adjust Eyes 2","Concentrate Night Sight","",{
    setAperture 1;},{true}] call ace_interact_menu_fnc_createAction;

private _mgmaction5 = ["Adjust Eyes 3","Day Sight","",{
    setAperture 0;},{true}] call ace_interact_menu_fnc_createAction;

[_player, 1, ["ACE_SelfActions"], _mgmaction1] call ace_interact_menu_fnc_addActionToObject;
[_player, 1, ["ACE_SelfActions", "MGM"], _mgmaction2] call ace_interact_menu_fnc_addActionToObject;
[_player, 1, ["ACE_SelfActions", "MGM"], _mgmaction3] call ace_interact_menu_fnc_addActionToObject;
[_player, 1, ["ACE_SelfActions", "MGM"], _mgmaction4] call ace_interact_menu_fnc_addActionToObject;
[_player, 1, ["ACE_SelfActions", "MGM"], _mgmaction5] call ace_interact_menu_fnc_addActionToObject;
#

via initPlayerLocal.sqf

cobalt path
#

I copied your exact code, and it doesnt work for me

fleet sand
sharp grotto
cobalt path
#

okay now it works

stable dune
cobalt path
#

fiddled with some code, the code above the one I posted wasnt well. It was working. But for some reason game doesnt execute stuff under it

stable dune
cobalt path
stable dune
# cobalt path https://pastebin.com/hm6P8BRx

This part you should use in initServer.sqf

if (!isServer) then {
...

Then you can be sure that it will be executed on the server, and server only.

And stuff after that doesn't execute?

cobalt path
#

So you said I should create initServer.sqf and put it there?

stable dune
cobalt path
jade acorn
#

is there a command to get these values for Eden camera? get3denCamera gives only the object name

#

would be faster than double clicking the camera icon each time I need to get these numbers

patent goblet
jade acorn
#

hmm returns [] for each for some reason

cosmic lichen
#

getPosWorld get3DENCamera

#

getDir

raw vapor
#

I need to run a sleep function to delay some code in the init field of a unit I'm trying to spawn in Zeus via a composition. When the object spawns, I need it to wait 10 seconds before executing its code.

But normally, sleep is not allowed in this context according to the error I always get. How can I bypass this issue?

#

For example let's say my code is like,

this setGlobalTexture "whatever.paa";```
the ability to reference the spawning thing `this` is important for the code to work as a composition. What I'm doing is more than `setGlobalTexture` but I'm not gonna dump a page of junk on you.
raw vapor
#

I know that spawn is definitely the way to do it, but not sure why I can't get anything to happen.

fleet sand
raw vapor
#

Okay that looks like it'll solve my issue. I couldn't figure out params when looking at the wiki so I'll try that.

#

That seems to have done the trick! Thank you.

#

This is the full version of what I'm doing.

thorn charm
#

Hi! I am new script development in arma 3. I would like to ask you, when and why should I binarize the config and create the texheader? Also I would like to ask you if you know any way to verify that the texheader is correct.

#

I don't know how much difference there is between binarizing and not binarizing.

thorn charm
fleet sand
#

also this is pmc link for binirizing that is talking about it more.

thorn charm
#

okay thx!

winter rose
#

btw I believe this is modding, not scripting 🙂 see #arma3_config

tough abyss
#

posting here to if there is a possibilty to create a script..
Is it possible to "set up a base" when playing? like raising a flag, get a box of ammo/weapons and maybe 2 vehicles?

winter rose
fair drum
graceful kelp
#

Are there any eh I can trigger when a logic entity is deleted in Eden (& in Zeus secondarily)

bold mantle
#

Hey can somebody help me with this script? Trying to make a new radio using TFAR but its not even making the item to begin with, any help is appreciated thanks. Also please don't just link me the wiki, I've already read over the parts I'm confused about but it don't understand

eternal spruce
#

I'm using the USAF MOD, more specifically, the KC135, I'm having issues keeping the AI to stay in the vehicle after a unitCapture, they just keep getting out after they've embarked the aircraft. This is what i used but I'm not sure if I'm doing something wrong.Pilot moveInDriver KC135_1; CoPilot moveInGunner KC135_1;

winter rose
winter rose
eternal spruce
#

I'll try, thank you

hallow mortar
#

I'm trying to use setHit (or setHitPointDamage) to apply damage to specific parts of a vanilla vehicle.
getAllHitPointsDamage confirms "hithull" is an existing hit selection and has an associated hitpoint. However:

_unit setHit ["hithull",0.5];
_unit getHit "hithull"; // returns 0```
The vehicle has damage allowed. I have also tried a different type of vehicle, and a couple of other hit selections that the vehicle allegedly has (e.g. "hitengine", "hitturret") - still no effect.
I'm confused. This command......works, right?
#

Well, one issue would be that getAllHitPointsDamage returns hitpoint names first and selection names second, not the other way around

pliant stream
#

sleep n^-x isn't guaranteed to pause at all for higher x, at least when i tested it in a2oa, might be different in a3 can't speak to that.

versed trail
#

How would I make a projectile detonate prematurely or otherwise spawn an explosion? I've seen it happen in mods with airburst munitions, I want a mortar round or something similar to look like its detonating mid air. Apparently there are explosion types in cfgAmmo, can I find a list of those somewhere?

hallow mortar
#

triggerAmmo is the most straightforward way of setting off the projectile. Detecting when to set it off is more complex :U

eternal spruce
#

So...moveInDriver takes you to the driver seat
moveInGunner takes you to the Co-pilot seat
What is the script for the boom operator's ?

warm hedge
#

Turret maybe

eternal spruce
#

I did try that but nothing happened

tulip ridge
#

You'd have to get the turret path correct
Get in the seat and do vehicle player unitTurret player; and see what it returns

eternal spruce
#

It returned a [1]
then I used this player moveInTurret [_plane, [1]]; and it worked. thank you

versed trail
#

Is there a limit to how fast attached objects can be moving? I have a script to attach a vehicle to an MLRS after launch, so the missile launches, the vehicle spawns, and doesn't move from its spawn position with the missile. Going in it confirms the vehicle thinks its going 806 kmh where it's not moving at all. This issue doesnt seem to happen with slower stuff like mortars or static artillery

#

attachedTo confirms it's still attached to the rocket itself but the vehicle itself does not move from the spawn position

meager granite
#

It could depend on simulation type

#

All in all, attaching object to a projectile is a bad idea

#

Mortars probably use shotShell while MLRS is shotMissile

#

I'm guessing you're attaching a camera, the better idea would be setting position each frame to visual position of the projectile

ivory lake
#

nah artillery only works with shotshell

#

so mlrs would be a fake missile shotshell

#

class R_230mm_HE: SubmunitionBase
{
shotSubmunition I guess, same diff

meager granite
#

Oh yeah, getText(configFile >> "CfgAmmo" >> "R_230mm_fly" >> "simulation") => "shotShell"

#

Maybe you don't re-attach after submunition change then?

ivory lake
#

yeah thats the issue

#

the rocket artillery change half way through flight

#

(rocket engine burning out etc)

#

so you need like a submunitioncreated eventhandler or w/e

fleet sand
#

I think lean would be playing animation. and for looking up and down you would create a invisible target for ai unit and with lookAt or dowatch you would make him look.

little raptor
#

No

pallid palm
#

i'm wondering, is there a way to increase the threat of all WEST players, to like the threat of a Tank, so ai EAST shoot RPG,s at you Arma 3 ofcorse

#

or em i going about this the wrong way

cosmic lichen
#

These values are defined in config and cannot be edited via scripting.

valid lily
#

Is there a way i can use "disableCollisionWith" or some other command to disable an objects collision with all AI? Im trying to make some AI friendly tenches and because AI doesnt behave well with the trench objects from base game im trying to make it so i have invisible VR blocks for collision because AI navigates around them really well. I just need the trench objects there for looks without them effecting AI

little raptor
spare cave
#

If I want to set up a map location based action, how would I go about doing that? Say like how Simplex works with clicking on map to select support locations or SOG with the Radio Support system it uses? I want to build something similar myself that is mission specific and can be tailored for my own needs instead of working off someone elses work

meager granite
#

Using arrays as keys is such a convenient feature, wish you could do that with hashmaps too

#

Hmm, what if there was a way to get hashValue out of reference? 🤔

#

hashValueRef?

#

Nevermind my stupid ideas, won't do what I need anyway

#

Being able to use hashmaps as keys could've been useful though

#

to save on hashValue'ing keys and values manually

wind hedge
versed trail
#

I probably do just need to have an eachFrame handler update the position of the drone, it's just kind of a crummy solution performance wise. But it should be limited

proven charm
#

i dont understand whats the thing with Roadway LOD because it cant be disabled. but i dont know what Roadway really does lol

meager granite
#

But still setting position manually each frame is a better approach and gives you much more control

meager granite
#

otherwise they get stuck and arma'd

proven charm
#

i thought it was something like that just dont know why cant it be disabled

meager granite
#

Disabled where?

proven charm
#

i mean disableCollisionWith doesnt disable the roadway

meager granite
#

Command was probably introduced for debug purposes and they didn't care about roadways

#

[nil] in createHashMap => false
createHashMap set [[nil], 123] =>

21:31:32 Error in expression <createHashMap set [[nil], 123]>
21:31:32   Error position: <set [[nil], 123]>
21:31:32   Error Type Nothing, expected Number,Bool,Array,String,Namespace,Not a Number,code,Side,Config entry
#

hashValue works with nils properly though, why not let us have nil keys?

#

[hashValue [getPos nil], hashValue [name nil], hashValue [nil]] => ["HoH7344jsWU","UCA8SAEuf3Y","hOdp56wcI/s"]

hallow mortar
meager granite
#

Probably

#

🍝

little raptor
tough abyss
gentle fjord
#

so I am making a script to keep track of killed planes. I figure the easiest way to do this is to attach an eventhandler to each plane and when it does decrement a variable:

pseudo code:

_alive_planes = 2

for i from 1 to 2{
create plane
plane addMPEventHandler["MPKilled",{_alive_planes = _alive_planes -1}]
}

this has an issue though I noticed, _alive_planes is local to the surrounding script and so is not accessed by the eventhandler

I dont think SQF has anything like JS closure so the only way to access that variable is to declare it global right?

#

the actually script has a lot more busy work so I figure pseudo code is probably better. My specific question I need help with is really using the same variable. I don't think I can reference it without it being global?

#

maybe I could work around it in a cleaner way by adding all the planes to an array and doing an isAlive check

sharp grotto
gentle fjord
#

thats sort of what I was figuring

ionic talon
#

Hello everyone !
Can anyone tell me the function called when talking with Task Force radio?
(basically when you keep pressing the push to talk button).
I would like to integrate this into a button on one of my interfaces, because we are blocked when a dialog is open.

fleet sand
stable dune
ionic talon
#

With CreateDialog (I know that I had display and cutRSC we can move, but suddenly I no longer have access to my buttons ^^)

proven charm
ionic talon
pallid palm
#

thx R3vo for telling me i did not know that

versed trail
#

Is it known if setPos messes with stuff besides the normal movement of objects? I'm trying to attach a drone to a projectile and make it invisible, I can't use attachTo for this (discussed above), so it's set up as this:

addMissionEventHandler 
[  
   "EachFrame",
   {
      private _projectile = _thisArgs#0;
      private _drone = _thisArgs#1;
      _drone setPos getPos _projectile;
    }, 
    [_projectile, _drone]
];
//_drone attachTo [_projectile, [0, -1, 0]];
_drone hideObjectGlobal true;

The problem is, the drone despite being hidden after the EH is added is still clearly visible. It can be fixed by putting the hideObjectGlobal inside the eachFrame handler, but I'm worried it will have a hit on network traffic and performance with a decent amount of players (15-30) and multiple projectiles up at once.

meager granite
#

setPos/getPos are ancient and do a lot of unasked stuff

#

Just use setPosWorld/getPosWorld

stark fjord
#

would anyone happen to know spectrum device display id?

proven charm
warm hedge
#

Usually not. It is defined in CfgInGameUI (Or RscInGameUI, can't tell rn)

warm hedge
#

It also depends on your goal

stark fjord
#

nothing specific wanna mess with display a bit

candid narwhal
warm hedge
#

Post your entire EH

candid narwhal
#
params [
    "_entity"
];

if ((Array_of_Orks findIf {_entity isKindOf _x})>=0) then {
    _entity setIdentity "orks";
};

That´s the entire EH.
The creation of all EHs is done through another script using:

{
...
private _fileName = format["eventhandlers\mission\eh_%1.sqf",_name];
            private _file = preprocessFile _fileName;
            ["Adding mission event handler: %1 with file %2", _name, _fileName] call BIS_fnc_logFormat;
            private _id = addMissionEventHandler [_name,_file];
...
} forEach (configProperties [missionConfigFile >> "gamemode" >> "missionEventHandler"]);
cosmic lichen
#

Have you checked if the condition actually returns true?

candid narwhal
# cosmic lichen Have you checked if the condition actually returns true?

I have copied this condition from another of my EHs:

_idMEH = addMissionEventHandler ["EntityKilled",{
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    if ((ADALIB_airvehicle findIf {_unit isKindOf _x}) >= 0) then{
        _unit spawn {
            sleep 360; 
            deleteVehicle _this;
            
        };    // could create a more sufisticated function
    };
}];

which does return true.

#

(different mission and EH creation setup tho)

warm hedge
#

R3vo's point still stands. Are you suresqf ((Array_of_Orks findIf {_entity isKindOf _x})>=0)is true

#

Also what is Array_of_Orks

cosmic lichen
#

Is "orks" a valid config in CfgIdentities?

candid narwhal
# warm hedge Also what is `Array_of_Orks`

init.sqf

Array_of_Orks = [
    "TankBusta1_OP",
    "StormBoy1_OP",
    "Naked1_OP",
    "ShootaBoy1_OP",
    "New_Orks_Loota_BA_1",
    "New_Orks_Burna_BA_1",
    "ArdBoy2_OP",
    "Boss2_OP",
    "New_Orks_FreeBoota_1",
    "New_Orks_NOBZ_ES_1"
];
candid narwhal
cosmic lichen
#

Ok.

candid narwhal
#

Am I having a namespace brainfart here ?

cosmic lichen
#

Also effect is local so you need remoteExcec

#

Not sure though what's the locality of entityKilled EH

candid narwhal
#

ignore the EntityKilled EH, that one works flawlessly for now

candid narwhal
cosmic lichen
#

Please print the array and also the result of the condition.

#

Then come back.

candid narwhal
#

understood, brb

#

tested like this:

hint format ["%1",((Array_of_Orks findIf {"TankBusta1_OP" isKindOf _x})>=0)];

in the ESC Debug console.
It returns / hints true

warm hedge
#

That's not the suggestion. Test the code in the EH and let it print the result

candid narwhal
#

I put it verbatum into the MEH and it returned true for all units in the array.

params [
    "_entity"
];
hint format ["%1",((Array_of_Orks findIf {_entity isKindOf _x})>=0)];
if ((Array_of_Orks findIf {_entity isKindOf _x})>=0) then {
    _entity setIdentity "orks";
};
#

wait its working now 🤖

winter rose
#

you need to save the mission for description.ext changes to be considered

candid narwhal
#

It was a human error in my testing, I locally spawned the wrong Units originally I think. Thx for yalls help! I appreciate you guys <3
And sorry for taking up your time

proven charm
#

the editor should have reload description.ext button..

thin fox
#

Hello. Is there a better way than this to detect if a player is in a forest?

nearestTerrainObjects [player, ["FOREST SQUARE", "FOREST TRIANGLE", "FOREST", "TREE"], 20]]

I was thinking of getting those objects under a variable and then use count. If there are more than n objects in the array, the player is in a forest.

proven charm
#

the weird thing is that according to the wiki those FOREST objects dont exist in any map

hallow mortar
#

You could try getAllEnvSoundControllers

proven charm
#

so you would have to use "TREE", "SMALL TREE" etc

hallow mortar
thin fox
#

okay, that's a nice idea, testing now. But what about modded maps?

thin fox
#

Question. using doWatch, lookAt, glanceAt; the AI seems not to look at the correct position. Is there any other command to make an AI unit "aim" at?

jade acorn
#

all those functions make them look at a position. They look with their eyes technically, so they will not always turn their whole body or even head. doTarget makes them turn fully.

#

_unit lookAt unitAimPosition player is what I am using most of the time to make them actually look at something, but it's not always a body turn.

spiral canyon
#

Does anyone know if its possible to set a script to make TFAR seem like its being jammed? To cut comms to a selection of frequencies?

thin fox
jade acorn
#

then doTarget might be the best since binos are essentially a weapon

thin fox
jade acorn
#

then make them hold fire

thin fox
jade acorn
#

maybe disable autocombat? Or other AI functions for the timebeing

thin fox
#

also targetting

jade acorn
#

¯_(ツ)_/¯

bleak valley
#

if you turn them careless, they should not "understand" what they see but still follow the doTarget ?

tulip ridge
bleak valley
#

adding that information here so maybe the Biki can be modified : the BIS_fnc_fadeEffect does block every sound played once the player is fully blind (even the one from the end mission effect) (if the fade out time is set to 3 for example, the sound can be heard during those 3 seconds). It's not an information that the Biki has (and it took me too much time to figure out what was wrong with my sound script because of it)

thin fox
bleak valley
granite sky
#

Could also blind them with disableAI "CHECKVISIBLE"

thin fox
#

yup, I didn't want to come to that

#

but hey, it's a solution

#

thank you

thin fox
winter rose
#

nope

thin fox
eternal spruce
#

Just to confirm to make a custom sound in-game you have to have this in your mission's description.ext flie...right?

    sounds[] = {};      
    
    class EngineStartUp {
        name="EngineStartUp";
        sound[]={"Sound\KC135 Engine Startup.ogg", 0.5,1};
        titles[] = {};
};```
I have this in mine and when i try to play the audio `playSound "EngineStartup";` nothing happens, i get no error but in the console it returns `NOID <no shape>` and I'm not sure what that means, can someone tell me what I'm doing wrong
hallow mortar
#

The console return is just the return from playSound - a reference to the sound emitter object it just created, which is a nameless invisible object that doesn't even have a 3D model, hence "no shape". References to such objects don't translate very well into human-readable text.

#

Your cfgSounds is missing a closing }; for the EngineStartUp class

versed trail
# meager granite Just use setPosWorld/getPosWorld

Tried this, having setPosWorld getPosWorld doesn't seem to change any behavior; the drone is still visible after being teleported. Anything else I should try before I just brute force hide it each frame?

fair drum
#

if you force global hide it every frame, you will absolutely toast your network performance; which you have already acknowledged.

#

even changing its position every frame, the position will not update that fast over the network. it will look choppy on clients

versed trail
#

Ugh. Got the intended result working at least; have an invisible object that updates its position every frame to the shell, attach the drone to that invisible using attachTo, and hide the drone

#

I'm gonna do some more testing, but for my specific use case the clients shouldnt need to see the object itself, just maintained server side so the stream of fire is updated

meager granite
#

I still don't get your setup

#

Is drone remote?

versed trail
#

The idea is that I want to create the visual of a C-RAM intercepting incoming fire. The way I'm currently doing it, which is working (albiet with some difficulties) is attaching a drone (any aircraft works, just need something big enough to get picked up by radar from kilometers away) to the fired mortar projectile. The radar and Praetorian (CRAMs) will try to engage the drone and the projectile will explode in mid air a few seconds before it hits the ground to look like it's been intercepted.

#

Drone is just there because I need some kind of aircraft for the guns on the ground to target, it doesnt actually do anything besides follow the shell

#

It's working pretty well right now; I'm probably going to try a firedNear EH to blow the projectiles once they're targeted with a few shots, and figure out why ground radars simply refuse to pick up an aircraft as high as an artillery round or MLRS rocket. My main concern is performance though

fair drum
#

if its literally not for function, just visual, you can just aim the gun at a location and simulate its movement by moving the turret, then firing manually into the air

#

movement rate is just math of a point on a circle

#

with radius distance from cram

warm hedge
#

lockCameraTo may do it. But IIRC it's terrible because the "inertia" for AI aiming is always a case

timber shore
#

still struggling with this, I'm trying to run a script in debug globally, it should waitUntil typeOf cursorTarget in _list then action = player addAction "Click Me!"

#

but every way I write it, it won't wont

#

only if im staring at the object when i run it

#

would I have to put it inside a while{ ?

still forum
#

you mean it quits the waitUntil even when the cursorTarget is not in List? more details please

timber shore
#

while {true} do { waitUntil {(typeOf cursorTarget == "My_Object") && (player distance cursorTarget < 7)} action1 = player addAction ["Click Me!", { hint "working" }]; };

old owl
#

Quick sanity check for me- does BIS_fnc_apply not have support for _forEachIndex, continue or continueWith?

still forum
#

missing ; behind waitUntil {}
your pasting that in dbg console in editor?

last field
#

would it be possible to add a server script where a player is temporarily banned after dying?

warm hedge
#

Sanity check. What do you mean by BIS_fnc_apply

last field
#

thinking of doing it for an antistasi server

thin fox
old owl
#

Thank you for the sanity check I appreciate it!

last field
warm hedge
#

Indeed apply doesn't have _forEachIndex or _applyIndex (I wish TBH)

old owl
still forum
#

i think dbg console is running it non sheduled.. you may need to put a spawn {} around it just for testing

winter rose
#

heyyy!

warm hedge
#

Listen!

winter rose
#

d-did you just Navi me

old owl
warm hedge
#

Actually. I would concern the performance. But... I guess, not sure

still forum
#

it will quit in non sheduled because you cant sleep or waitUntil afaik

south swan
#

for some reason i remember apply skipping elements on continue, but i'm not sure at all

pallid palm
#

can i use, BIS_fnc_selectRandom inside an Eventhandler

warm hedge
#

Yes. selectRandom is better though

pallid palm
#

ah ok thx m8

old owl
pallid palm
#

wow that was fast thx you

old owl
faint burrow
old owl
faint burrow
#

You should use select instead apply. And yes, example 6 is OK for you.

old owl
faint burrow
#

No for _forEachIndex, not sure about the rest.

#

Also you can use forEach.

still forum
#

and remove the while. It will just cause the addAction to be executed endlessly if youre on target

warm hedge
#

If you need to fetch some values out of an array with _forEachIndex, it is actually better to use forEach actually. With pushBack... I guess

old owl
#

I really appreciate the help guys thank you. I think I kinda just planned poorly. Initially I was using apply because it was working in the context in the scope of what I was initially trying to do and I wanted it to be fast with what I am doing being on server. Just sucks that I may have to turn it back to a forEach anyways but might see if I can give a whirl of select first.

old owl
# warm hedge Yes. `selectRandom` is better though

Also last question I will yap in here- but do you know why this is? My understanding was that they were both the same thing, one was just it's tagged function library name and the other was just a short version for it. Would it be because the actual script name could potentially change but the alias likely wouldn't or is one faster than another?

warm hedge
#

BIS_fnc_selectRandom requires few more steps to execute just a selectRandom

pallid palm
#

nice

#

thats awsome thx m8s

old owl
little raptor
warm hedge
#

tldr, A function is made of bunch of commands

old owl
#

Ahhh wow that actually makes so much sense. Thank you guys for bearing with me, I really appreciate the responses I learned a lot this morning.

I know I did say last question so apologies but had a thought. I can think of a few different scripts where we have to run code on every frame for the sake of what we are wanting to do. Within that file we call a bunch of other files. Would there be a significant performance difference if I instead of calling those files- created commands for them instead?

little raptor
#

You can't create commands

#

They're built into the engine

#

Calling stuff every frame is ok as long as it never exceeds a few hundred microseconds at worst (ofc the faster the better, and you should try to optimize it as much as your can)

#

Use the code performance button in debug console to measure how fast your code runs

old owl
little raptor
#

Yes they are called macros. They just get expanded and replaced inline by the preprocessor.
You can define commands but not via SQF. You can use Intercept and use C++ for that (it's not officially supported tho)

hallow mortar
#

A Command is a direct instruction to the game engine. They're the native language of the game. We can use them, but we can't change them.
A Function is a collection of commands wrapped up into a single name for easy access.
Generally, if a command and a function do exactly the same thing it's because the command didn't exist when the function was made. Like-for-like, commands are faster (because the purpose of a function is to use multiple commands to do things).

If you have a lot of SQF files that are being invoked repeatedly with e.g. execVM, you should consider making them into functions with CfgFunctions. If you do that, they'll be compiled once on mission start, instead of being compiled again every time you execute them, leading to better performance in the long run. (Also lets you use call to run them "inline", and keep them unscheduled when required, unlike execVM which always creates a new scheduled thread)

still forum
still forum
still forum
#

your code works for me

old owl
# still forum your code works for me

That's so strange. I may have honestly just hard trolled and returned the original array or something then- not sure why else I would be getting different results. I really appreciate it 🙂

old owl
hallow mortar
#

That's one way in which the select or forEach/pushback methods would be a bit better - they'll automatically produce an array containing only the chosen elements and nothing else, rather than having to specifically filter out byproducts.

old owl
#

Right now I am really just storing data from certain events that are occurring from within an eventHandler for logging purposes so I don't really need to actually do anything with that data but might be worthwhile perhaps if I still checkout select. I kinda liked the idea of it keeping the <null> return so I could tell exactly how many skips were being performed but if there is a larger performance difference between that and select I may just use that instead

meager granite
#

Same as it would've been _applyIndex and _selectIndex if there was an index in these loops

#
useApplyIndex; // Next apply only
[100,200,300] apply {_applyIndex;};
``` => `[0,1,2]`
still forum
#

uff

#

no need when simpleVM can detect it anyway

#

problem is, non-simpleVM contents, pay the price when they don't need it then.
But they are already much slower anyway, so probably doesn't matter much

little raptor
#

Just create a variable meowsweats
Using a command is a terrible idea

vivid anchor
#

Hey! Where can I find AAF ORBAT code?

granite sky
#

kinda surprised that variables are faster than nular commands.

little raptor
timber shore
#

made the changes, but still no luck

still forum
#

whats going wrong exactly?

timber shore
#

I have no idea xD If I knew I'd fix it

still forum
#

^^ the action not showing up?

timber shore
#

yep

still forum
#

waitUntil {systemChat (typeOf cursorTarget); ((typeOf cursorTarget) == "My_Object") && (player distance cursorTarget < 7)};
use that and watch your chat.. and check if the type of cursor target is what you want

#

if its okay but still not working try systemChat str (player distance cursorTarget); to see if the distance is right

#

if everything is correct but still not working you know your error is on the usage of addAction

stray flame
#

Hello, so I found this one script for laser designation mission. How would I make this work on a server? ive tried many things but no results

#
//----------------- Laser Strike --------------------
sleep 4;
0 = 0 spawn {

    _loop = true;

    while {_loop} do {

        _targ = laserTarget vehicle player;

        systemChat format ["targ %1",_targ];

        if not (isNull _targ) then {

            if (cursorObject isEqualTo enemytruck) then {

                
                [Radio_man, "Target_Found"] remoteExec ["sideRadio",0];
                deleteVehicle Check_Block;
                _loop = false;
            };

        };

        sleep 1.5

    }

};```
cosmic lichen
#

CursorObject and player command doesn't work on a dedicated server.

#

This needs to run on the client that should identify the target.

stray flame
#

how can I make it run on a client?

#

it is expected a single specific player will carry the laser designators. So if this could reliably run just for them then that would be satisfactory

still forum
#

if not you still know where the problem lies

#

the addAction looks right but the waitUntil also does... id suggest using more brackets
((player distance cursorTarget) < 7)

timber shore
#

aha works now, fantastic

#

😃

buoyant cairn
#

what should be changed in this code, to affect all kinds of AI, but not players?

#

[] spawn {
while {true} do {
{
_x setVariable ["HAF_spawned",true];
_x addEventHandler ["handleDamage", {1}]
} forEach (allUnits select {isNil {_x getVariable "HAF_spawned"} && side _x == EAST});
uiSleep 2;
};
};

warm hedge
#

isPlayer

buoyant cairn
warm hedge
#

In allUnits select {} part

buoyant cairn
#

change "isNil" to isPlayer?

warm hedge
#

No

#

...Well, I'd like to ask, do you know how select or even a boolean works in this context?

buoyant cairn
#

Boolean is set to true or false right?

#

The select is defined by the _unit to be selected in the param

#

This is what i understood, at least

#

But feel free to correct me on any wrong answers

warm hedge
#

I actually asked that because you don't really seem to fully understand your code. tdlr:sqf [] spawn { while {true} do { { _x setVariable ["HAF_spawned",true]; _x addEventHandler ["handleDamage", {1}] } forEach (allUnits select {isNil {_x getVariable "HAF_spawned"} && side _x == EAST && !isPlayer _x}); uiSleep 2; }; };Even though this code is not really optimized/preferred anyways, this is the idea

buoyant cairn
#

would this result in every ai being killed in a hit, but none of the player?

#

also, it would only be applied to my player?

buoyant cairn
#

and you are correct, i don't fully understand the codes and their logic, im studying bit by bit with the limited time i have now lol

#

but i truly appreciate the help and the correction, i think i understand, the player was not defined in the code

#

that's why it wasn't fully working as it should

buoyant cairn
warm hedge
#

player is not something you define. I'd take some time to explain but I don't have time

fair drum
buoyant cairn
still forum
#

what was it? the brackets?

buoyant cairn
glass nest
#

Foreach ((allunits - allplayers) select {...

buoyant cairn
#

gonna give it a try

#

thank you

tribal lark
#

If I run a command on group player and there are multiple player groups on a server, does it choose a random one or run it on all of the individual groups? Or will it not work at all lol

timber shore
#

yep

warm hedge
#

Depends. It is a local getter command which means player means player himself in their computer. If dedicated server, it is objNull

stray flame
hallow spear
#

can you not use spawn for functions made with an addon?

#

[] spawn aph_fnc_MyFNC

tribal lark
#

What do I use to check a dead unit's inventory?

warm hedge
#

Same way with alive unit

still forum
#

yes you can

hallow spear
#

ok cool

tribal lark
#

this is probably really stupid coding but im not used to working with findif. I'm trying to make a script that finds any dead unit with a 'common' variable, not a 'gambler' variable, has a anprc152 in their inventory, and isn't within 150m of another player, and I assume this is the wrong way to do it since I've been trying to fix it for a while now

_deadPlayer = allDeadMen findIf
{(_x getVariable ["common", false]) 
&& 
!(_x getVariable ["gambler", false]) 
&& 
("TFAR_anprc152" in [assignedItems _x])
&&
([_x, 150] call CBA_fnc_nearPlayer)} == -1;
proven charm
tribal lark
#

lol I had that initially but thought it was wrong, didn’t change anything

faint burrow
#
_index = allDeadMen findIf {
    (_x getVariable ["common", false]) && { !(_x getVariable ["gambler", false]) }
        && { "TFAR_anprc152" in (assignedItems _x) } && { !([_x, 150] call CBA_fnc_nearPlayer) }
};

_deadPlayer = if (_index >= 0) then { allDeadMen select _index } else { objNull };
tribal lark
#

The problem is that it's not detecting a dead unit that passes all of those checks

#

ok nevermind wtf

#

it just worked

#

fucken ok then

tribal lark
#

actually nevermind i did a dumby

#

does not work i just made it fire when those conditions weren't met on accident

#

fuck

hallow mortar
#

Make sure that radio classname is exactly correct; in is case-sensitive

#

Also, I'm pretty sure TFAR makes individual radios unique by having a huge number of hidden classes of the same radio, that just have a unique ID (like TFAR_anprc152_1, TFAR_anprc152_2 etc). So the item in the inventory may not be just TFAR_anprc152, if it's been initialised into a unique radio.

exotic gyro
#

Though maybe not for dead units

tender inlet
#

hi, all people
I face a very strange issue when a unit is owned by an HC client, and I need you advice

if a unit is owned by the HC, the returning unit's position is different from the dedicated server or a classic client !!

let's say, you have created a unit and then transferring the ownership (setGroupOwner) to the hc and the you execute **globally **the code below, you don't get the same position !!

{
 diag_log [name _x, getpos _x];
} foreach (units west)

I've got the following result

log from dedicated server (same result on client)
13:50:01 ["Liam Anderson",[8524.19,25016,0.00141907]]
13:50:01 ["Chris Taylor",[8516.94,25031,0.00115967]]
13:50:01 ["Lucas Campbell",[8518.13,25031.9,0.00171661]]
13:50:01 ["Gillian Martinez",[8540.17,25055.6,0.00149536]]
13:50:01 ["Alexander Robertson",[8534.6,25018.1,0.00144958]]
13:50:01 ["Spencer Clark",[8447.86,25100.6,0.000762939]]
13:50:01 ["Harry Stewart",[8446.98,25099.5,0.0018692]]
13:50:01 ["pSiKO",[23585.8,18697.4,0.00143886]]
13:50:01 ["Jabr Noori",[23578.5,18628.1,0.00143886]]

log from the HC client
13:50:01 ["Anderson",[8524.19,25016,0.00117493]]
13:50:01 ["Taylor",[8517.09,25031.3,0.00102234]]
13:50:01 ["Campbell",[8518.11,25031.9,0.00175476]]
13:50:01 ["Martinez",[8540.38,25055.5,0.00156403]]
13:50:01 ["Robertson",[8534.6,25018.1,0.00143433]]
13:50:01 ["Clark",[8447.86,25100.3,0.000930786]]
13:50:01 ["Stewart",[8446.99,25099.5,0.00167084]]
13:50:01 ["pSiKO",[23585.8,18697.4,0.00143886]]
13:50:01 ["Noori",[23581.2,18668.3,0.00143886]]  <--- owned by the HC

look at **Noori **unit (owned by the hc), you see a different position and even the name return is different

and I don't understand why 🙂
if someone can tell me what's wrong ?

note, the HC and dedicated server are started with exactly same parameters

warm hedge
tender inlet
#

that not the name that annoy me but the position, because that lead to distance/ distance2D issue
on the hc, the unit is closer than when it's owned by the dedicated server

warm hedge
#

Yeah I get the point. But I simply find it is terribly strange to see

tender inlet
#

yes !, I'm not new to arma scripting, and the code running fine when no HC are in use,
but the position difference lead to error in distance calculation

#

and it's very unusual !

#

I try different approach, getposATL/ASL, distance from object or position, and I always got the same error

#

the distance seem to be the half on the HC (roughly)

#

if it may help, the dedicated run on linux, but the hc run on window

tender inlet
#

@warm hedge did you know a way to force an update of unit position across the network ?

flint topaz
#

Is the Linux port working well for you?

tender inlet
flint topaz
#

But at that point just do the maths on the server

tender inlet
#

I'll try a
_unit setPos (getPos _unit);

on the hc,
and the unit seem to be rested to the previous location
like if the location is not updated...

flint topaz
#

How far away is the headless client from these units?

#

As I know that can cause weird issues

tender inlet
#

very close < 50m

flint topaz
#

Really strange

tender inlet
#

indeed !

flint topaz
#

Like I’d get a little bit of deviation due to floating point maths etc

#

But those numbers aren’t even close sometimes

tender inlet
#

I order the unit to move, but the unit 'jump' back to his original location

fiery gull
#

is there a lot of latency between the HC and the server?

tender inlet
#

I can live with some minor difference, but actually it's a huge one!

flint topaz
#

And the unit is owned by the hc right?

#

owner _unit

tender inlet
#

the hc run on my pc and the dedicated run on hosted ser'ver (<30ms delay)

tender inlet
#

I can share sample code to reproduce the issue if interested

flint topaz
#

I have to agree you have found a very strange behaviour

flint topaz
#

My only thought is due to Linux vs Windows

#

But like maths is maths

#

Seems strange they would be different

warm hedge
flint topaz
warm hedge
#

This is also no. I've never wrote a DLL even

flint topaz
#

Interesting alright

tender inlet
#

// on Altis salt lake

// execute on **server **only

_pos = [23581.2,18668.4,0.00143886];  
_grp = createGroup [west, true];  
_unit = _grp createUnit ["B_Soldier_unarmed_F", _pos, [], 0, "NONE"];
sleep 1; 
_grp setGroupOwner (owner HC1); 
sleep 1; 
diag_log (groupowner _grp);
};

note: my headless name is HC1, you can change the value by the netid manually

// execute on **client **only
// cursor on the unit created above

[cursorobject] joinSilent (group player);

// execute globally

{
 diag_log [name _x, getposatl _x];
} foreach (units west);

now check the rpt log for unit position

//dedicated
15:16:16 ["pSiKO",[23583,18672,0.00143886]]
15:16:16 ["William Turner",[23592.6,18649.1,0.00143886]]

// hc
15:16:15 ["pSiKO",[23583,18672,0.00143886]]
15:16:15 ["Turner",[23582.4,18668.9,0.00143886]]

tender inlet
#

ok, the issue occur when I order the unit to join my group
like if having a remote unit in my group mess with the object info on the network
(but it work fine when the unit is remote but on the server)

neon plaza
#

Having Issue with a line of code that will not show up.

#

this addAction  
[  
    "It's just a weather balloon, agent Mulder",  
    {  
        [0, [0, 0, 0]] remoteExec ["setFog", 2]; 
    },  
    nil,      
    1.5,      
    true,      
    true,       
    "",         
    "true",     
    3           
];

#

Suppose to display the action but does not seems to show.

faint burrow
#

What object is this action added to? I think the object is so big that the radius is too small.

neon plaza
#

Its a telecommunication hub. I will try to switch object.

faint burrow
#

Try to increase the radius.

neon plaza
#

Where Is the range sir? Also thank you for the response.

#

When I change the object It worked.

faint burrow
neon plaza
#

Did not even know this was a thing. Getting tired of this #*$&#^$ game.

#

lol thank you sir.

faint burrow
candid narwhal
#

Greetings,
I am getting the error: "expected object (...) given type array" for this:

private _ChaosPortals = [
    ChaosBase,
    EastGate,
    SouthGate,
    WestGate,
    NorthGate
];

{
_x params ["_gate", "_target"];
    [
        _gate,
        format ["Teleport to %1", _target],
        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff1_ca.paa",
        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff1_ca.paa",
        "(_this distance _target < 10)",
        "_this distance _target < 10",
        {},
        {},                                                    
        {
            _this setPosAtl (getPosAtl _target); //Error here
        },
        {},
        [],
        2,
        0,
        false,
        false
    ] remoteExec ["BIS_fnc_holdActionAdd", 0, true];
}ForEach [
    [ChaosBase, EastGate],
    [ChaosBase, WestGate],
    [ChaosBase, NorthGate],
    [ChaosBase, SouthGate]
];

The _target is the destination of the teleport.

How do I go about adding the _target for this using my ForEach ?

faint burrow
#

I am getting the error: "expected object (...) given type array"
Which line?

candid narwhal
faint burrow
#

Yes, _this is an array.

candid narwhal
#

_this |#|setPosAtl (getPosAtl _target);
that´s where the error is

#

using _caller fixed it.

#

actually nvm: New problem:

_caller setPosAtl (getPosAtl _target);

Always teleports to the position of ChaosGate

faint burrow
#

That's because _target is not a gate.

candid narwhal
#
_x params ["_gate", "_target"];
...
}ForEach [
    [ChaosBase, EastGate],
    [ChaosBase, WestGate],
    [ChaosBase, NorthGate],
    [ChaosBase, SouthGate]
];

But it should be ?

#

ohhh lmao i think i have to rename it

faint burrow
#

No, _target is a gate in forEach scope, not in codeCompleted scope.

#

As I wrote, you should pass a gate through arguments param of BIS_fnc_holdActionAdd.

candid narwhal
#

I shall try! Thx for your help

granite sky
buoyant cairn
granite sky
#

Uh, what are you trying to achieve?

#

That handleDamage applies to all damage sources. If a unit is damaged, they die.

buoyant cairn
granite sky
#

Is this singleplayer?

buoyant cairn
#

yes, hosted in lan

#

kp liberation

granite sky
#

But only one player, who is the host?

buoyant cairn
#

but two friends of mine will join me

granite sky
#

no then?

#

Do you need this to work for all players or just you?

buoyant cairn
#

just me

#

for now

granite sky
#

Change the handleDamage EH code from {1} to this:

{
  params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"];
  [_damage, 1] select (_instigator == player);
}
#

reduced-readability version:
{ [_this#2, 1] select (_this#6 == player) }

granite sky
#

...probably

buoyant cairn
#

gonna test it out

thin fox
covert oak
#

Has anybody used say3D with simulateSpeedOfSound on recently? I tried last night, and added one argument at a time [sound, maxDistance, pitch, isSpeech, offset, simulateSpeedOfSound]
It worked as I added each, but when I set the speed of sound arg to q or true I got the error "6 elements expected, 1 provided"

edit, clarification
So something like
_object say3D ["mySound", 1000, 1, 0, 0] works, but
_object say3D ["mySound", 1000, 1, 0, 0, true] or
_object say3D ["mySound", 1000, 1, 0, 0,1]
Gives that error.

buoyant cairn
#

let me try

thin fox
#

no?

buoyant cairn
#

did it like this now

granite sky
#

Nah, it sets the HAF_Spawned variable to prevent re-adding.

buoyant cairn
granite sky
#

In that one you're missing the close bracket on the addEventHandler.

faint burrow
covert oak
buoyant cairn
granite sky
#

yes.

#

also a comma.

#

I can't fix it because you're pasting pictures rather than text.

buoyant cairn
#

[] spawn {
while {true} do {
{
_x setVariable ["HAF_spawned",true];
_x addEventHandler ["handleDamage" { [_this#2, 1] select (_this#6 == player) }]
} forEach (allUnits -allPlayers select {isNil {_x getVariable "HAF_spawned"} && side _x == EAST && !isPlayer _x});
uiSleep 2;
};
};

#

here

granite sky
#

EH line should be:

_x addEventHandler ["HandleDamage", { [_this#2, 1] select (_this#6 == player) }];
buoyant cairn
#

oh, i see now

thin fox
granite sky
#

Feel free.

buoyant cairn
#

side question, what does this uiSleep 2 is for?

granite sky
#

uiSleep is identical to sleep unless it's singleplayer.

hallow mortar
#

That makes the loop pause for 2 seconds before doing its next iteration. Without a delay like that, loops will iterate as fast as they can, multiple times per frame, which causes performance problems.

thin fox
buoyant cairn
#

oh i see, that is very interesting

#

like a mouse macro

#

where you set a delay in the code

thin fox
#

talking about this, is that bad to use commands like while waitUntil, like, we should always avoid to use them?

buoyant cairn
#

btw, thanks for the help guys

hallow mortar
thin fox
#

hmm, but doesn't the EH checks in each frame in the "background"?

hallow mortar
#

I'm not sure exactly how EHs work internally - but they do work internally, in the engine code rather than in SQF, so it's way way more efficient than continually checking an SQF condition

thin fox
#

aaa okay

hallow mortar
#

I mean, "way way more" in terms of tiny fractions of a second, unless your condition is awful

covert oak
#

Any loops you put inside an EH will only happen on the frame in which the event is triggered, so unless your loop takes more than about 1/60th of a second, nobody is likely to ever notice.

#

In computer time, that's forever.
I trsted this back in like 2014 having a loop that would calculate a square root of some arbitrarily huge number and ran it 1000 times every frame, worked fine.

#

I have a question regarding EH'S, specifically EachFrame.
I'd like to do something like

_myObject = <someObject>;
_mySecondObject = <someOtherObject>
addMissionEventHandler ["EachFrame", { 
drawLine3D[getPos _myObject, getPos _mySecondObject,[1,1,1,1,]];
}];

But the objects return nuls.
According to the wiki you can pass variables to the event ha dler, but, according to the wiki
"Only arguments of simple types get proper serialization. Objects, Groups etc will not serialize and appear as NULLs on game load."

buoyant cairn
granite sky
#

Correct.

buoyant cairn
#

perfect, i can't thank you enough

hallow mortar
covert oak
#

By the by, is there a language syntax you can use in discord to make sqf pretty like you can with lua

Str = "See, pretty pretty colors"
Tab = {"this extends","to tables","and numbers",0,45}
Str="and even functions"
Local function thisIsAFunction ()
     Str="more pretty colors"
     Return str
End```
hallow mortar
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```

// your code here
hint "good!";
covert oak
#

Hmm, that doesn't seem to work as I rememeber...

hallow mortar
#

Wait a minute, you already used the SQF highlighting like 3 messages ago :U

covert oak
#

I tried it but it didn't work.
Is it a local issue on my end?

hallow mortar
#

Discord doesn't show syntax highlighting on mobile

#

something something too busy ruining the username system to make their actual useful features work properly

covert oak
#

Huh, I thought it used to when I wrote a bunch of scripts for DCS (hence the lua).
Oh well.

hallow mortar
#

Apparently they briefly added it to a limited beta branch 3 years ago and then never mentioned it again

covert oak
#

That checks, that's when I was heavy-heavy into scripting.

buoyant cairn
# granite sky Correct.

funny thing about the script, it works on everything perfectly, but not on the Antistasi mod

#

the first shot removes the helmet (???) then the second knocks them out

#

it removes the helmet even if i shot the let or chest lol

covert oak
#

In other news,
I have a simple respawn script for my AI units (for reasons) and currently it just respawns them where they started, and then I essentially cheat to teleport them where needed (either my group or a high-command group)
Does anyone have a canned script to instead handle respawns by spawning a helicopter, then spawning the u it in the helicopter, then having the helicopter drop them off an despawn?

I could write one myself but it's a lot of work somebody has probably done already.

jade acorn
#

how can I convert the getDir value to a XYZ vector without the actual target position? For whatever reason camPrepareDir does not work and, and camSetDir does not accept the direction value anymore.

thin fox
#

antistasi has it's own way of handling AI

jade acorn
buoyant cairn
thin fox
hallow mortar
true frigate
#

Hey, does anyone know what the types available are for nearestObjects? Thanks 🙂

warm hedge
#

Pretty much everything CfgVehicles has to offer

true frigate
#

Specifically, I'm looking for all bridge_asphalt_02_center_f objects. But I'm not sure what it falls under - or if there's a different way to search for them.

hallow mortar
#

If that's the classname of the object then that's what you should use to search for it

warm hedge
#
[configFile >> "CfgVehicles" >> "bridge_asphalt_02_center_f", true] call BIS_fnc_returnParents;```
true frigate
#

That returns an empty array. I might have to just manually search aha

#

Thanks for the help anyway guys 🙂

hallow mortar
#

Objects that are part of the map and not Editor-placed might not be detected by nearestObjects, and also they aren't always properly associated with a config class. Sometimes they're a more "raw" object - even if a config class version of that object also exists.

true frigate
#

It's detected, it's the same way that I've done it before - my dumb ass just can't remember how I did it lol. But I appreciate it mate FeelsThumbsUpMan

buoyant cairn
granite sky
#

Similar if you were running with another revive mod, or ACE.

buoyant cairn
#

like deleting that line of code

#

side question, how can i disable things i don't want in ACE?

celest plover
#
statement="[this,'WBK_exo_take',25] spawn EPSM_PlaySounds; this playActionNow 'Exo_Gest_ACTIVATEEXO'; this setVariable ['WBK_AdvancedArmor',100,true]; this setVariable ['WBK_JumpPackPower',100]; this spawn WBK_EPSM_AdvancedArmour_Load;";``` Im having trouble finding where it constitutes what "WBK_AdvancedArmor" is and how I would add something to it. Would anyone have any idea? if not, how would I have it check for a specific piece of equipment instead? like " If _unit Player has Exo_Suit_Variant2 "
pallid palm
#

Medic On Me: we Got A Man Down

tulip ridge
buoyant cairn
tulip ridge
#

You wouldn't need to unpack anything, you shouldn't touch anything inside the pbos themselves

#

You can likely achieve what you want via settings though

#

Depending on what it is

buoyant cairn
#

mostly remove ui stuff, wind dispersion and whatnot

#

could also just remove the pbos

tulip ridge
#

Just disable those in the settings

buoyant cairn
tulip ridge
#

There's an option to force settings on servers / missions

buoyant cairn
#

even if im not the host?

tulip ridge
#

If it's a per client setting, then it would use yours unless the mission or server forced it to a certain value

#

If it's a global setting, ask the host to change it

buoyant cairn
#

i'm going to take a look at it

quaint oyster
#

Question, once a player has been killed and sent to the "select respawn" screen, is there a means to close that interface and give them control of the dead body again?

tough abyss
#

I have 2 scripts that needs to have info in the init file. how do I fix so both scripts work?
/ I don't know shit about scripts haha

warm hedge
#

Run two scripts so it will run two scripts

warm hedge
#

If you seriously don't know how it works, tell your current script. Otherwise the answer remains the same. Run these two

tough abyss
warm hedge
#

So what is your goal

#

There is no mention of script1.sqf in init.sqf

tough abyss
warm hedge
#
[] execVM "respawnmkr.sqf";
[] execVM "script1.sqf";```
tough abyss
neon plaza
#

The line of code we have does not seems to work. It Is suppose to remove the fog but the only thing we see Is the action button with no action. The line of code Is down below...


this addAction  
[  
    "It's just a weather balloon, agent Mulder",  
    {  
        [0, [0, 0, 0]] remoteExec ["setFog", 2]; 
    },  
    nil,      
    1.5,      
    true,      
    true,       
    "",         
    "true",     
    3           
];

warm hedge
#

First thing first, make it sure the code is actually running. Just hint or systemChat etc

faint burrow
winter rose
pallid palm
#

POLPOX selectRandom Works perfect in the addMissionEventHandler Thx for you help

tough abyss
warm hedge
#

You need to tell how it is not working

tough abyss
#

sorry! haha
I get the function in the scroll wheel menu, so I can choose "recruit", but it wont show up any reinforcements around me

fiery gull
#

do you mean "Call Reinforcements"? recruit isnt even mentioned in that script

warm hedge
#

Are you sure the action is not working

tough abyss
#

yes, sorry, meant "call reinforcements"

#

aint no one showing up haha

fiery gull
#

facepalm yes
instead of calling script1.sqf in your init just run the spawnReinforcements.sqf

tough abyss
fiery gull
#

correct

last cave
#

Does anyone have an idea how to make it so that an action that is tied to a memory can only be displayed if you look at the selection with that memory?

I want to make the same behavior for addaction as for door actions from the configuration.

meager granite
#

Try hiding actions unless you have needed selections in the middle of the screen or something?

last cave
#

No guesses at all

tough abyss
fiery gull
last cave
#

I need me to look only at the door.
Now the actions appear even if I don't look at the door.

tough abyss
versed trail
#

Does the firedNear EH work when a bullet is shot with its trajectory near a unit, or does it have to be the weapon itself firing near the unit?

#

All of my testing seems to confirm it's the latter, is there a another way to to replicate the former?

winter rose
#

most likely with the "suppressed" EH yes

worldly granite
#

dose anyone have any code that uses a trigger zone to teleport? Working with a small group where we want to respawn on ships and want it to be able to copy and paste between maps.

tulip ridge
buoyant cairn
#

@granite sky bro, i don't know why, but the script its not working anymore, gives me no errors, but it doesn't work at all

#

the script that adds a magazine once i shoot the last bullet works

#

but the damage one is not working, it was working before and now just stopped

#

since both scripts are in the same file, and one of them is working, then i have no solution so far to what is the problem

neon plaza
neon plaza
warm hedge
#

Within your addAction

hallow mortar
true frigate
#

Purely curious, but does anyone know why some instances are spelt dammaged, like the EH, for example?

hallow mortar
#

Someone in the early days of Arma development wasn't very good at spelling

#

BI is a Czech company, so for many of the developers, English isn't their first language. These days they've standardised more on developing in English, so devs are better at it and there are more English-speakers around to catch mistakes, but back then it was a smaller operation and working in English wasn't necessarily required (see: selection names being in Czech).

#

(also, as a smaller and less mature company at the time, in a games industry that was much less mature than it is today, things would've been done more ad-hoc, with less oversight and QA)

pallid palm
#

plus everything has to have a diff name

lament grotto
#

Does anyone know of a script that allows you to select and spawn on other members of your group?

I have one sorted for spawning on the SL and Commander but would like to have one for each group member in case the SL goes down...

#

Similar to Battlefield style of respawn system, and if it can check for hostiles nearby and disable it with a message thatd be even better.

If there is no such readily avaible script could someone point me in the right direction on where to go to create one?

#

Also if the respawn position is created how would I get it to have the name of the Player?

winter rose
split oxide
#

Is there a way to check what team a unit is in?
assignedTeam (https://community.bistudio.com/wiki/assignedTeam) doesn't work on units not in the local player's group although when you leave and region a group, the assigned team is not forgoton / does not change. Is there any other place this information is exposed?

meager granite
#

What an ancient system

#

Is there any network sync to this at all?

granite sky
#

Players on the same group all know each other's team, so it seems odd that it's limited to that.

split oxide
#

It definitely is synced to some extent, as you can join a non-local player's group and access the teams there (if defined)

winter rose
#

no SW mention/media, thanks

agile fox
#

I was asking for scripting help big rip

winter rose
agile fox
winter rose
agile fox
#

alright I will try it thanks

versed trail
#

Is there a way to prevent the AI from acquiring targets on its own? I've tried turning off AUTOTARGET but the drone it's disabled on (disabled for the AI crewman inside as well as the vehicle, not sure if they're linked) will still spot targets and engage them

little raptor
versed trail
#

The idea is that it only "sees" targets I reveal and assign with a script. But it might be easier to just disable the weapon until it sees the right target

versed trail
granite sky
#

You could turn off CHECKVISIBLE but I expect that'd prevent it shooting even once units are revealed.

versed trail
#

Well, they definently still shoot....these are AA guns and radars, so it's probably something to do with the radars, but they still have a bit of spotting capability on their own

proven charm
versed trail
#

open heart surgery with a hammer huh

granite sky
#

Vehicle with integral radar?

versed trail
#

Yeah it has internal radar. I can actually probably just disable it and all datalink, just have targets get revealed by script.

granite sky
#

Did some tests. CHECKVISIBLE does normally prevent firing even after reveal 4 by both foot troops and those in 50cal turrets.

#

They'll turn towards & aim but won't shoot.

#

Would be a lot better if that was two separate flags. Then you could do your own target-list management easily.

hallow mortar
#

tried setting its behaviour to force hold fire?

#

* combat mode, not behaviour

driver this setCombatMode "BLUE";```
versed trail
#

yeah, that's an alternative to do it manually but not exactly what im looking for. think I have a better solution

near snow
#

How does one properly set up sqf functions and and event handlers because I am having trouble getting my script working

The function is supposed to use the reload and firedman event handlers to execute the script when a certain magazine is fired but it isn’t executing

I have debug hints after each event handler but neither are being triggered

The function is viewable in the function viewer and when run in game with the advanced developer tools mod it doesn’t pop up with any errors

In the config I have
cfgfunctions class -> tag -> function root -> then the function init {}
Extended preinit EH for the player controlled variables which is working
And then the cfgammo and cfgmagizines classes that are both working as they should be

granite sky
#

Not entirely sure from that where you're installing the event handlers.

#

You can't install Reload or FiredMan from a preinit function directly because units don't exist at that point.

near snow
raw vapor
#

~~I have a wild idea, and I don't know if anyone has already looked into this.
https://steamcommunity.com/workshop/filedetails/?id=2915485125
https://community.bistudio.com/wiki/Reaction_Forces/Modules_and_Functions#Wildfire
Imagine a mission wherein certain weapons fired into certain areas had the capabity to spark a fire using the Wildfire module. Anyone who's played Far Cry 3 may recall a mission where you go through a weed farm and torch the place. I'd like to replicate that idea in ArmA 3, but I haven't the foggiest idea where to get started.

I'd be willing to pay anyone who can make a proof of concept. Current bounty is a modest $50 but if you think you can pull it off and want to ask for more on success, DM me to ask about it. I got too much on my plate right now to investigate the idea myself.

I would like to use the wildfire module mainly because you can also extinguish those fires, but I'd be willing to hear out other solutions or existing mods, I just won't pay the bounty for those.~~

tulip ridge
tulip ridge
raw vapor
tulip ridge
#

Whoever did it would probably write their script and test it in arma

#

That or you'd be paying for untested script(s)

bleak valley
#

hey guys

can somebody tell me why my script gives a "missing ]" error ? I can't find any syntax error

this addAction ["Commencer la mission", {player setPos (getPos rr)}; titleText ["<t size='5.0'>In the grim darkness of the far future</t><br/><t size='5.0'>there is only war</t>", "BLACK IN", 0.5]; ];

near snow
south swan
thin fox
#
this addAction ["Commencer la mission", 
{player setPos (getPos rr)}];
south swan
#

then you get an extra ]; in the last line. Doesn't make sense in general then blobdoggoshruggoogly

thin fox
#

just remove the last ]

bleak valley
#

there is a closing ] at the end of the script for that, because I want the addaction to have multiple fonctions

thin fox
#

ah

south swan
#

then why are you closing the } in the second line?

thin fox
#
this addAction ["Commencer la mission", 
{player setPos (getPos rr); 
titleText ["<t size='5.0'>In the grim darkness of the far future</t><br/><t size='5.0'>there is only war</t>", "BLACK IN", 0.5];
}];
tulip ridge
#

Here's a GetIn example from the CBA XEH wiki page

class Extended_GetIn_Eventhandlers
{
    class XYZ_BRDM2
    {
        class XYZ_BRDM2_GetIn
        {
            scope = 0;
            getin = "[] exec '\xyz_brdm2\getin.sqf'";
        };
    };
};
bleak valley
thin fox
bleak valley
thin fox
near snow
ashen urchin
#

Hi, i wish to create a script compat mods between PiR and Zeus Enhanced:

For the hurting part :

/*----- Hurt Unit -----*/

function hurtUnit
{
    params ["_unit", "_shooter", "_selection"];

    _unit = unit name;
    _selection = "head";
    _shooter = _unit;

    _unit setDamage 0.9;

    if ((!(PiR_DamageAllow_on) && (str (isDamageAllowed _unit) == "true")) or (PiR_DamageAllow_on)) then
    {
        if (isplayer _unit) then
        {
            [_unit, _selection, _shooter] remoteExecCall ["PiR0", 2];
        } else
        {
            [_unit, _selection, _shooter] remoteExecCall ["PiR", 2];
        };
    };
};

/*---- ZEN SIDE ----*/

private _hurtAction = [
    "[PiR] Hurt Unit",
    "Hurt selected unit",
    "\a3\ui_f\data\igui\rsctitles\mpprogress\timer_ca.paa",
    {hurtUnit (selectedUnit, player, "head")}
] call zen_context_menu_fnc_createAction;

[_hurtAction, [], 0] call zen_context_menu_fnc_addAction;

First the script looks good ?
I'm good on code but not with A3 directly (for differences)

Second, how i need to create/organize my mod ? I'm not really understand about cpp and minimum requirements

Third, can i try my code in game ?

buoyant cairn
granite sky
#

uh

buoyant cairn
#

Im asking cause ive set that init inside a mod that loads every time i enter a mission

granite sky
#

You can spawn something in preinit (well, preferably postinit) that waits for the player object to exist.

#

That would be the easiest option, although not entirely ideal.

buoyant cairn
#

Sometimes it works and the bullet kills, sometimes it just takes 5 to 6 shots to kill

#

So im guessing the way i implemented it is very wrong

#

Also because the script im using affects the units that spawn

#

Side question, should i delete the progress made in a mission every time i make a change in the script?

ashen urchin
# ashen urchin Hi, i wish to create a script compat mods between PiR and Zeus Enhanced: For th...

I created it :

class CfgPatches {
    class PiR_ZEN_Compat {
        units[] = {};
        weapons[] = {};
        requiredVersion = 1.0;
        requiredAddons[] = {"zen_context_menu"};
    };
};

class CfgFunctions {
    class PiR_ZEN_Compat {
        class Functions {
            file = "\PiR_ZEN_Compat\scripts";
            class healUnit {preInit = 1;};
            class hurtUnit {preInit = 1;};
        };
    };
};

But when i start in game, it give the error: Script \PiR_ZEN_Compat\scripts\fn_healUnit.sqf Not Found

tulip ridge
tulip ridge
ashen urchin
tulip ridge
#

Show your folder setup

#

Preferably in something like vscode to show files inside of folders

ashen urchin
tulip ridge
#

Just do something like systemChat str _this to see what arguments are passed

ashen urchin
#

it's directly when i enter in 3den, i've the error

tulip ridge
#

Though zen should have that documented somewhere

#

Show your function

ashen urchin
tulip ridge
tulip ridge
#

And you wouldn't create a variable for the function in itself, that's what CfgFunctions is for

ashen urchin
#

so how i organize my code, if i unput the function, where i need to put the zen call part ?

tulip ridge
#

It would be better to have a separate function that creates the context menu actions, which would then call their functions in their statements

#

So something like:

// fn_initActions.sqf
private _action = [..., {_this call PIR_ZEN_Compat_fnc_hurtUnit}];
[_action, [], 0] call zen_context_menu_fnc_addAction;
#

Then you just have that one function run in preinit

ashen urchin
#

lets go try

#
23:30:27 Error in expression <_shooter", "_selection"];

_unit = unit name;
_selection = "head";
_shooter = _u>
23:30:27   Error position: <name;
_selection = "head";
_shooter = _u>
23:30:27   Error Missing ;
23:30:27 File PiR_ZEN_Compat\scripts\fn_hurtUnit.sqf..., line 5
23:30:27 Error in expression <_shooter", "_selection"];

_unit = unit name;
_selection = "head";
_shooter = _u>
23:30:27   Error position: <name;
_selection = "head";
_shooter = _u>
23:30:27   Error Missing ;
23:30:27 File PiR_ZEN_Compat\scripts\fn_hurtUnit.sqf..., line 5
23:30:27 Error in expression <les\mpprogress\timer_ca.paa",
{healUnit (selectedUnit)}
] call zen_context_menu_>
23:30:27   Error position: <(selectedUnit)}
] call zen_context_menu_>
23:30:27   Error Missing ;
23:30:27 File PiR_ZEN_Compat\scripts\fn_initActions.sqf..., line 6
23:30:27 Error in expression <les\mpprogress\timer_ca.paa",
{healUnit (selectedUnit)}
] call zen_context_menu_>
23:30:27   Error position: <(selectedUnit)}
] call zen_context_menu_>
23:30:27   Error Missing ;
23:30:27 File PiR_ZEN_Compat\scripts\fn_initActions.sqf..., line 6

this kind of logs

#

no

#

i forgot some ;

granite sky
#

This is wrong:
_unit = unit name;

ashen urchin
#

Why

granite sky
#

I don't know what it's supposed to do. unit could be global variable but shouldn't be. name is a unary command.

ashen urchin
#

it's the original sharing

granite sky
#

It's wrong.

tulip ridge
#

Well that code is just wrong

ashen urchin
#

Ha

granite sky
#

As we don't know what the functions "PiR0" or "PiR" expect, we can't fix it.

tulip ridge
#

You get the array of units that are selected for the action, so you'll (presumably) want to do X thing to every unit in that list

ashen urchin
#

i've the 2 functions

#

PiR & PiR0 have the exact same params part

IF (!isServer) exitWith {};
params ["_unit","_selection", "_shooter","_shans", "_anim", "_armor"];
// Назначение действий на попадание ИИ

IF ((str ([".p3d", (str _unit) ] call BIS_fnc_inString ) == "true") && !(alive _unit)) exitWith {

     remoteExecCall ["", PIRjipId];
        [_unit, {
         _ehId = _this getVariable ["hitPartEhId", -1];
         IF (_ehId >= 0) then {_this removeEventHandler ["HitPart", _ehId];}
        }] remoteExecCall ["call"];    

};

IF !(_unit getVariable ["dam_ignore_injured0",false]) then {

_unit setVariable ["dam_krov_statys",0,true];
_unit setVariable ["dam_ignore_HealEffect0", 0,true];

...
granite sky
#

Well, you can see there that _unit is supposed to be an object, not a string.

ashen urchin
#

so _unit

granite sky
#

Ah I see, the example isn't complete code. You're supposed to be setting those three inputs yourself.

ashen urchin
#

during my call with zen action

granite sky
#

God knows whether any of this ancient trash is correct though.

#

str (isDamageAllowed _unit) == "true", really

ashen urchin
#

i didn't judge, i try to adapt a compat with no documentations and as my first sqf

granite sky
#

yeah maybe not the place to start :P

ashen urchin
#

i've 10yo of C, so it's not a problem, i need to adapt how the arma needs

#

and also, this compat is a big need

granite sky
#

well, if you want to use that first chunk of code as a function, just remove the three lines after the params.

ashen urchin
#
// Create heal unit action
private _healAction = [
    "[PiR] Heal Unit",
    "Heal selected unit",
    "\a3\ui_f\data\igui\rsctitles\mpprogress\timer_ca.paa",
    {healUnit, _hoveredEntity}
] call zen_context_menu_fnc_createAction;

// Create hurt unit action
private _hurtAction = [
    "[PiR] Hurt Unit",
    "Hurt selected unit",
    "\a3\ui_f\data\igui\rsctitles\mpprogress\timer_ca.paa",
    {hurtUnit, _hoveredEntity, _hoveredEntity, "head"}
] call zen_context_menu_fnc_createAction;

// Add both actions to the context menu
["Custom Modules", "[PiR] Heal Unit", _healAction] call zen_custom_modules_fnc_register;
["Custom Modules", "[PiR] Hurt Unit", _hurtAction] call zen_custom_modules_fnc_register;
["Custom Modules", "TEST HINT", {hint str _this}] call zen_custom_modules_fnc_register;


[_healAction, [], 0] call zen_context_menu_fnc_addAction;
[_hurtAction, [], 0] call zen_context_menu_fnc_addAction;

I'm blocked here, looks like that the module ZEN doesn't recognize it

#

It’s really not easy to start script for A3 in 2024, lot of documentations who everyone is against everyone NIdoggo

fleet sand
# ashen urchin ```C# // Create heal unit action private _healAction = [ "[PiR] Heal Unit", ...

To create a custom module it would be something like this in InitplayerLocal.sqf

["Custom Modules", "[PiR] Heal Unit", {
    params [["_pos",[0,0,0]],["_object",objNull]];
    
    if (isNull _object) exitWith {
       ["You have to place this on Vehicle or Unit", []] call zen_common_fnc_showMessage;
    };
    _object setDamage 0;
    hint format ["%1 has been heald",_object];
},"x\zen\addons\modules\ui\truck_ca.paa"] call zen_custom_modules_fnc_register;
ashen urchin
#

and where i put this InitPlayerLocal ?

fleet sand
ashen urchin
#

it's a mod i've

fleet sand
#

you are makeing a mod or a mission ?

ashen urchin
#

a mod

granite sky
ashen urchin
#

what works, i don't know.
What doesn't here, the module inside the Zeus Menu

granite sky
#

So the context menu actions work?

#

But none of the three modules?

ashen urchin
#

nop

#

i tried even the example, and nothing

granite sky
#

Do the context menu actions work?

ashen urchin
#

where's supposed to be the context menu ?

granite sky
#

Right-click.