#arma3_scripting

1 messages Β· Page 181 of 1

eternal spruce
#

But it doesn't work

granite sky
#

Well yeah

#

The code in the forEach should be {AI disableCollisionWith _x}

eternal spruce
#

so it should be {AI disableCollisionWith _x} forEach [_platform]?

granite sky
#

ah no, that bit is wrong too :P

eternal spruce
#

sorry i dont understand

granite sky
#
_platform = [plat_1, plat_2, plat_3, ….etc];
{ AI disableCollisionWith _x } forEach _platform;
#

[] declares an array. You don't just put it around random things.

eternal spruce
#

oh i see, i was looking at an example on the wiki and i thought it was correct, thank you very much

blissful current
#

Code in the object init field gets ran when a player JIP, right? So if it put this there then the object might zorp around if players join?

this setPosATL (getPosATL (selectRandom [cache_file_pos_1, cache_file_pos_2, cache_file_pos_3]));
eternal spruce
#

@granite sky So this is what i had originally and didn't want to do it this way because i have to do it individually for each object but it works.

AI disableCollisionWith plat_2; 
AI disableCollisionWith plat_3; 
AI disableCollisionWith plat_4; 
AI disableCollisionWith plat_5; 
AI disableCollisionWith plat_6; 
AI disableCollisionWith plat_7; 
AI disableCollisionWith plat_8; 
AI disableCollisionWith plat_9;```

But for some reason this one doesn't.

```_platform = [plat_1, plat_2, plat_3, plat_4, plat_5, plat_6, plat_7, plat_8, plat_9];
{ AI disableCollisionWith _x } forEach _plat;```
granite sky
#

forEach _plat

granite sky
blissful current
#
if (isServer) then {this setPosATL (getPosATL (selectRandom [cache_file_pos_1, cache_file_pos_2, cache_file_pos_3]));};
granite sky
#

Unless you have other code in there that needs to run everywhere, I prefer if (!isServer) exitWith {}; for readability reasons. Also you can drop most of those brackets because the SQF parser handles command command in the only reasonable manner.

lime rapids
#

is there any method to get any throwables near an object besides a loop to get nearby objects and sort for a grenade in mp in a decently optimized manner? it appears that fired near event handler does not work in mp to get the actual thrown weapon.

#

and from digging into contact alien which has same use case it uses firednear since sp notlikemeowcry

formal stirrup
#

If I put this in a initplayerlocal, only the player that enters the trigger will have rain right?

[] spawn {
    waitUntil {sleep 5; ([outsideTrigger, player] call BIS_fnc_inTrigger)};
    0 setRain 1;
};

hushed turtle
#

Yes

proven charm
#

ah yes I see the info now, but it says it will turn to server setting, so setting it on client doesnt work

hushed turtle
#

It depends what soon means and what MatthewL wants

proven charm
#

well interesting that the two other syntaxes are marked "local effect"

placid root
#

can anybody tell me why the last three command return/do nothing?

stable dune
#

But if you use
Alt syntax that is local

setRain rainParams
Parameters:
rainParams: Array - array of custom RainParticles params - see rainParams. Use empty array [] to reset to default config values

have a local LELocal effect

stable dune
hushed turtle
#

What about that green box saying it has local effect when executed on client?

stable dune
hallow mortar
formal stirrup
#

Well I am using the setRain params

0 setOvercast 0.5;  
0 setRain 0;  
0 setFog 0.7; 
setHumidity 1; 
enableEnvironment [false, true];  
forceWeatherChange;  
setRain [  
 "a3\data_f\snowflake4_ca.paa",  
 1,  
 0.01,  
 15,   
 0.1,   
 2,   
 0.5,   
 0.5,   
 0.02,   
 0.02,   
 [0.1, 0.1, 0.1, 1],   
 0.1,   
 0.1,  
 5.5,  
 0.3,  
 true, 
 false  
];

This is above, Im setting the rain to 0 here, and want it to only start when the player enters an area, would I just do setRain with params again?

hushed turtle
#

And it's bad solution regardless, on listen server, the server host would essentially make changes global, while any client would make changes only for him temporary

#

Which is of course weird

#

either way

formal stirrup
placid root
#

I can't reach 1500 anymore, even with th debugconsole

hushed turtle
formal stirrup
#

will it only run on the people that enter the trigger though, its not gonna do it for everyone everytime someone enters the trigger?

tough abyss
#

yes

stable dune
formal stirrup
#

Yes

#

I only want the rain to appear to people who are in or have been in the trigger

stable dune
#

you can just add

//Condition
player in thisList
//on activation
// Your local rain setup

So it will locally execute current event.

placid root
#

so?

#

systemChat _data;//nothing

hushed turtle
#

Are Arrays faster than HashMaps? Even if items are accessed in random order?

proven charm
#

i guess that depends on how do you use them. if you need to search for something in array then hashmap would be faster

tender fossil
still forum
#

Array also has constant lookup time, if you know the index you're looking up.
What order you access items in doesn't matter

blissful current
stable dune
blissful current
#

So in my example this is what would happen:

Player A enters the trigger (local rain for player A).

Then player B joins the game. Player B enters the trigger (local rain for player B).

sharp grotto
#

Doubt this will work, client will sync weather with server automatically.

stable dune
hushed turtle
#

I was kinda curious. Since HashMaps could be used to group related variables with string based key representing variable name. SQF does not have any structs like C does have.

scarlet tree
#

I'm at my wits' end with removing unused aircraft pylons and I need some help.
For some reason, when calling as a vehicle respawn script (referencing _this select 0 in the BIS vehicle respawn module), the following lines seem to have no effect, but work perfectly when executed separately in launcher console:

{_plane removeWeaponTurret [_x,[-1]]} forEach [
    "Missile_AA_04_Plane_CAS_01_F",
    "Rocket_04_HE_Plane_CAS_01_F",
    "Bomb_04_Plane_CAS_01_F",
    "Rocket_04_AP_Plane_CAS_01_F"
];
proven charm
scarlet tree
#

Oops, typo, meant console. _plane is the 0 param for [_this select 0] call av6_fnc_setPylons as called from the vehicle respawn module.

#

The same function also adds the new loadout, and that part works as intended. I'm just left with the empty pylons from the default loadout, despite the code I pasted here.

vagrant geode
#

Hi, anybody know how to make onPlayerKilled.sqf and onPlayerRespawn.sqf to work properly for 20 people on the server?

scarlet tree
#

What's the issue?

proven charm
scarlet tree
hushed turtle
shut basin
#

Is there an event handler I could use for a certain type of vehicle being close to a unit?

granite sky
#

Unless you count attaching a trigger to it, no.

frozen seal
#

hello! I'm looking for a way to write a function that would put an argument object into one of three categories:

  1. Vehicles - any car, plane, truck etc that a player can ride in.
  2. Crates - any object that can not be controlled but that has inventory.
  3. Props - any object that can not be controlled and does not have an inventory.

I'm checking the wiki and there seems to be no methods like "hasInventory" or "canBeDriven" so I'm a bit lost here. What would be the best approach?

granite sky
#

For vehicles I went with fullCrew [_object, "", true] isNotEqualTo []

#

That does include statics. You could check directly for a driver slot otherwise.

proven charm
granite sky
#

isKindOf will generally work but inheritance doesn't strictly determine anything.

proven charm
#
object isKindOf "Crate" ```
 might work? πŸ€”
frozen seal
#

I was thinking about using isKind of but then the question is which classes to use

frozen seal
proven charm
#

me neither

frozen seal
flint topaz
#

Your idea of having seats etc checks is likely a better option

granite sky
#

There's probably a better way with config lookups but I couldn't be bothered to figure it out at the time. That stuff is poorly documented.

trail smelt
#

Hello, I try to do temporary black screen to be able to make some changes to objects in the background.. I was able to do it in sp/localmp but if I try to edit the script for execVM and remoteExec the script doesn't work at all on the dedicated server do you know how to fix this script ? (black screen for all players in a certain circle or at least for all players...)

Object init:

call{tr1 addAction ["Renive barricade", {
[] execVM "scripts\blkfade.sqf";
tr1 say3D ["music4", 1000, 1];
["scripts\strombarik.sqf"] remoteExec ["execVM",2];
}]
}

blkfade.sqf:

["", "BLACK FADED", 0.30] remoteExec ["titleCut", 0, true];  
[1] remoteExec ["fadeSound", 0, true];
hint "Script TEST";  // Test Hint

Thanks πŸ˜„ for any hint .

flint topaz
#

private _hasInventory = getNumber (configFile >> "CfgVehicles" >> _objectClass >> "maximumLoad") > 0;

#

@frozen seal this could tell you if it has an inventory

#

Then with the has crew idea

granite sky
#

yeah, maximumLoad is the most plausible one I could find.

flint topaz
#

You can work out if it’s a vehicle or a β€œcrate”

#

Anything else is a prop per your theory πŸ€·β€β™‚οΈ

frozen seal
#

well.. I have myself made a mod that had an item with maximumLoad set to 0 but the inventory would still open for some reason πŸ˜„
Though for my purposes it does not really matter, if maximumLoad is 0 the inventory would always be ampty anyways.

#

thanks!

granite sky
#

You might need to check for existence of maximumLoad to work around the zero issue.

#

Objects that don't have the inventory action don't seem to define it at all.

#

So isNumber rather than getNumber? Behaviour for missing entry isn't documented.

frozen seal
#

maximumLoad should always be a number if it exists, so if it either does not exist or if it's set to 0 - it's a prop

winter rose
#

it returns the default iirc
e.g 0

frozen seal
#

I guess

granite sky
#

getNumber does, yes. That's also not documented but well-known. Not sure what isNumber does.

winter rose
#

return false if not present I believe, that would not make any sense if it returned true but I feel your SQF experience asking 😁

next gust
#

what can be done to prevent player running around naked for others? - seems to happen if people spawn in vehicles

winter rose
#

. . . clothes

winter rose
next gust
#

i see

tulip ridge
plain linden
#

I am having an issue with my script. then end goal is to give everyone (MP) the intel after a timer goes. But I am not sure how

                player createDiarySubject ["cryptoKey", "Crypto Keys"];
                player createDiaryRecord ["cryptoKey", 
                ["Public Key",  
                "-----BEGIN PUBLIC KEY-----<br />MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMYejiS/zTosFFUWo8CWh7KJGh<br />+4kL+yd4AOGWCGquQiE7FEHBD4R6Y0aXb6Gf5iorsZIa+zpDFGN2dKy9/c9ttGZ4<br />6EphJWE4X6tfHcVdc9fVsWpsFwwwg4a11uVkfaIamloCyPalh9fKhZXHPle7lDM/<br />5lrEHByLu0w+THQbKwIDAQAB<br />-----END PUBLIC KEY-----"]];
            };```
blissful current
plain linden
#

so theres a trigger already to do a countdown so long as they are in the trigger area

blissful current
#

So you want that code to run at the end of the countdown correct?

plain linden
#

ya and i got the timer to go and it does give the intel, but only to the person in the trigger, i want it to go to every player in the server

granite sky
#
[player, ["cryptoKey", "Crypto Keys"]] remoteExecCall ["createDiarySubject", 0, true];
[player, ["cryptoKey", ["Public Key", "all that shit"]]] remoteExecCall ["createDiaryRecord", 0, true];
#

I don't know the diary API so I'm just replicating the local effect. remoteExecCall ensures that the two commands are executed in order.

#

JIP enabled because you probably want it to apply for players who join later too.

plain linden
#

should i still keep it nested in if (hasInterface) ?

#

or does that matter

granite sky
#

Ideally you'd change it to server execution.

#

Otherwise that's a lot of crap being spammed into JIP.

plain linden
granite sky
#

Change the trigger to server only, make sure it triggers on any player, and remove the hasInterface condition.

granite sky
#

The more proper way to do the remoteExec there is to create a function that runs the createDiarySubject and createDiaryRecord, and remoteExec that instead. But if you're working from the editor then creating a function is a bit of a stretch.

proven charm
#

why is the output of exportJIPMessages so cryptic?

cosmic lichen
#

Security

pallid palm
#

hello Awsome Arma 3 friends; What would be a good way to implemant the briefing, i have a briefing sqf, and i execVM it from the init.sqf is this the best way or is there a better way

#

or is that what John Jordan is saying up there

sharp grotto
#

initplayerlocal.sqf

waitUntil{player == player};
call Your_Briefing_function;

That's how i used it.

pallid palm
#

ahhh ok i see thx m8

#

so i don't need it in the init.sqf

sharp grotto
#

init.sqf runs on client and server, can be used but better to just put it into initplayerlocal.sqf imho.

pallid palm
#

ok cool thx man awsome

pallid palm
#

so if i want my briefing to work in SP MP and DED i would still need to exec it in init.sqf i found

hushed turtle
#

Why initplayerlocal.sqf wouldn't work for briefing? Just recently tried it on SP and listen server

pallid palm
#

in the Editer the player as in SP is the server so i didn't see the briefing when i had it in the initplayerlocal.sqf

#

that might be cuz i didn't pbo the mission file

#

and was just playing it from the Editer

#

im not really sure

#

or maybe i need if (!hasInterface) exitwith {}; at the top of my briefing .sqf

proven charm
#

or in briefing .sqf but point is to use init.sqf because it always triggers

pallid palm
#

copy that brother

#

thx @proven charm i trust eveything you say, you are one of the great people in here imho

hushed turtle
#

I might launch the game just to re-test it. I rally didn't notice any issues with briefing not appearing when calling createDiaryRecord from initPlayerLocal.sqf

open hollow
#

hello, im doing a script where all civilen "damage" is heavely punished.
I want to add an dammage or handleDamage to every civilian house in a large area ( like 4 or 5 km2)

its too heavy to do this? its quite inexpensive ?
will be only on the server side

errant iron
#

I'm using the following code to paradrop vehicles for my halo jump mechanic, which I derived from BIS_fnc_curatorObjectEdited (maybe modified by CBA?): sqf private _pos = getPosATL _unit vectorAdd [0, 0, 1]; private _parachute = createVehicle ["B_Parachute_02_F", _pos, [], 0, "CAN_COLLIDE"]; _parachute setDir getDir _unit; _parachute setVelocity velocity _unit; _unit attachTo [_parachute, [0, 0, abs (boundingBox _unit # 0 # 2)]]; But under windy conditions, the parachute will blow sideways and land on the ground at an angle. After the parachute collapses in this situation, the vehicle is usually banked into the ground and either flings into the air or explodes. Is there a better way to paradrop vehicles?

errant iron
# open hollow hello, im doing a script where all civilen "damage" is heavely punished. I want ...

for something that affects all objects, i would consider using a mission event handler for this instead, perhaps EntityKilled? for example:
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#EntityKilled sqf addMissionEventHandler ["EntityKilled", { params ["_unit", "_killer", "_instigator"]; if (typeOf _unit in ["some civie house type"]) then { // ... }; // You could also check for civilian kills here: if (side group _unit isEqualTo civilian) then { // ... }; }]; It's simpler, but it won't tell you if a building was partially damaged

meager granite
#

I solved this by running ray check under the vehicle, then detaching the vehicle

errant iron
#

i think i got the name of that command wrong, but i know i used a similar command for my signal flares
(oh nvm, i mistyped it in wiki)

meager granite
# errant iron ah, lineIntersects? ill look into that
    private _z =  boundingBox _vehicle # 0 # 2;
    private _pos = getPosASLVisual _vehicle;
    private _pos2 = _pos vectorAdd [0,0,_z];
    if(lineIntersects [_pos, _pos2, objNull, _vehicle] || getPos _vehicle select 2 < 2) then {
        detach _vehicle;
        //systemChat str "detach";
    };
errant iron
meager granite
#

I have it above the vehicle so it doesn't matter

#

you can include it into command if you want

open hollow
rich bramble
tribal crane
#

There's select <code> too now.

nocturne bluff
#

Now

#

imagine

#

A future with createNamespace

#

:O

hushed turtle
#

_x is local variable within the forEach, I don't think it exists within addAction code

#

You can sent it to addAction by argument

faint burrow
hushed turtle
#

}, _x select 1, 1.5, false] and in addAction code createVehicle [_this select 3,

stable dune
#

if your bb_asset is not defined in editor that will error because bb asset doest exit .

#

And if you are creating MP environment, then your bb_asset is only defined on the client where you use addaction.
Other clients variable doens't exist if you don't do PublicVariable of it

#

or yes, if you want a player to spawn only one vehicle at a time (bb_asset), it works.
And it will delete the last spawned vehicle (bb_asset) when spawning a new one.
Don't know how you want and where (SP or MP) and how to limit and for who

keen stream
finite bone
#

So when I use lookAt the AI turns upto the point it can see the target I'm referring to, meaning, not the whole body is turned towards the target. How do I go about this?

Essentially, I want unit A to have its whole body and head face unit B regardless of where A and B might be located.
I tried getRelDir, using vectors, atan2 and none seems to be working.

proven charm
finite bone
#

I did, and it still does not face directly against the player. The AI tunrs upt until the point where its head can visually see but not fully turned ot face the player head-on.

proven charm
#

setdir?

finite bone
#

Used setDir, setFormDir, lookAt, doWatch, and sqf _ai lookAt (unitAimPosition _pla1 vectorAdd (velocity _pla1 vectorMultiply 0.2));

#

Theres always a 15 - 30 degree offset

proven charm
#

weird if setdir doesnt work. maybe you need to disable the AI features to make it stay at the set direction

indigo snow
#

yes

#

effects: Local

#

in fact, to quite from the linked page: This command has local effect. Created action is only available on the computer where command was executed.

blissful current
#

How about placing an object further away from the tank and having the AI look at the object instead. Keep adjusting it until it a appears as if the AI is looking at the tank?

finite bone
#

Thats the problem, lookAt and doWatch both induce between 30 - 72 degree offset from the actual target.

blissful current
#

Ah I see, so it might look right one time but not other times because the range of offset varies.

finite bone
#

Yea it looks perfectly at the target for like 1 frame, and then immediately turn to a random offset range throwing off the time. I'm essentially looking at a laser cannon AI track the player and shoot after 10 seconds (kind of similar to how it is in Example 3: https://community.bistudio.com/wiki/lookAt)

#

But the onEachFrame would be costly (and I don't want continuous tracking, just select a random player, set the cannon's direction towards the player, and shoot)

keen stream
#

Ok. Thanks! I'll start abusing the hell out of bis_fnc_mp. πŸ˜ƒ

tender inlet
#

hello,
any one know how to disable UAV markers ?
I'm able to hide almost all blu markers (custom difficulty, disableMapIndicators)
but the uav (darter) drone still show up

proven charm
#

clearGroupIcons probably

tender inlet
#

nope, the uav marker seem to be different from other markers (unit, unit in vehicle)

#

even in Veteran they are show ?!

#

I'll try
groupIndicators = 0
friendlyTags = 0;
mapContentFriendly = 0;
(in custom diff),

  • disableMapIndicators
  • setGroupIconsVisible

with no luck

#

as soon as the drone have a crew there is an icon (representing the uav)

#

when the uav is unmanned the marker gone

proven charm
#

makes sense because its the crews group that has the icon, not the uav

#

i guess πŸ˜„

tender inlet
#

ok, and how to hide/disable the icon when the uav is crewed ?

#

hmm, there is something else with the uav

#

I'm able to hide a truck (or any other vehicle) with ai in it, but not the uav

#

the uav marker seem to be show, no matter what you try (and work for any other vehicles)

proven charm
#

you used clearGroupIcons for the group right?

tender inlet
#

yes, and it work for others vehicle

proven charm
#

hmmm

tender inlet
#

just not the uav (I'll try with darter)

#

look like it's hardcoded πŸ™‚

proven charm
#

ive got similar problems before. what i did was just call clearGroupIcons in loop πŸ™‚

#

i think that worked.....

tender inlet
#

hehehe, dirty trick :), but even with that icon still show !

#

{ clearGroupIcons _x } foreach (groups west)

should do the job ?

proven charm
#

i guess

#

i meant while loop that keeps calling clearGroupIcons

tender inlet
#

I'll try, no luck (work for other vehicles)

proven charm
#

ok

tender inlet
#

the uav marker is something 'special' πŸ™‚

proven charm
#

seems so

tender inlet
#

thanks for the help anyway

proven charm
#

np

errant iron
#

I'm working on yet another magazine repack function, and I noticed there was a recent addition to magazinesAmmoFull including the "magazine id" of each entry returned. Is it possible to use this ID to remove that specific magazine from the player, or will I have to suffice with removing all magazines and adding them back?
https://community.bistudio.com/wiki/magazinesAmmoFull

granite sky
blissful current
granite sky
#

If you use forceWeaponFire, sure

hallow mortar
#

They also will if you walk in front of their gun. MOVE doesn't stop their combat behaviour, it only prevents them from moving.

granite sky
#

I forget whether I tried using selectWeapon on "Throw" instead.

blissful current
#

Is there a way to see how many hours you have on a particular mission file?

#

I'm curious how many hours I've put into mine.

hollow stirrup
#

Excuse me scripting people, i have a friend that wants to learn scripting/coding for arma, any of you know any good tutorials they can follow?

indigo snow
#

there are no good up to date ones really

#

just start with small things, keep wiki open at all times, ask questions here

native hemlock
#

As with any programming/scripting, nothing beats playing around with it

wind hedge
#

the identity is "Kerry" but the head = "KerryHead_A3"

#

☝️ That has all the identities but not the name of the heads....

#

Is there a command I can use to find out a character's head name?

warm hedge
#

Just look up some configs. Why you need to know head name?

wind hedge
#

To make custom identities

#

example: ```sqf
displayname = "Jack";
texture = "val_tat_b\data\MacTavish_co.paa";
head = "DefaultHead_A3";
identityTypes[] = {"Head_NATO"};
author = "Val";
material = "val_tat_b\data\MacTavish.rvmat";
disabled = 0;
materialWounded1 = "A3\characters_F_EPB\Heads\Data\m_IG_leader_injury.rvmat";
materialWounded2 = "A3\characters_F_EPB\Heads\Data\m_IG_leader_injury.rvmat";
textureHL = "val_tat_b\data\Taurus_handslegs_co.paa";
materialHL = "val_tat_b\data\Taurus_handslegs.rvmat";
textureHL2 = "val_tat_b\data\Taurus_handslegs_co.paa";
materialHL2 = "val_tat_b\data\Taurus_handslegs.rvmat";

#

impressive that there is no getter for heads and nobody asked for it

warm hedge
#

Because you simply get it through config

blissful current
#

I'm using this code to place a file cabinet in 3 random positions using invisible helipads. The issue I'm having is that some get placed backwards or at weird angles relative to their surroundings (like backwards against a wall). I tried to hold shift and orientate the helipad in the editor to see if it did anything (it did not). Any ideas how to solve this?

if (!isServer) exitWith {};

this setPosATL (getPosATL (selectRandom [obj8_1, obj8_2, obj8_3]) );
warm hedge
#

Use setDir and getDir

blissful current
#

Thanks, if I setDir, I'm guessing that it would work for one of the random spawns but might look weird for the other two. How could I make it know which spawn it's at? Maybe like some if statements in the object's init perhaps?

warm hedge
#

You want to setDir using getDir's of obj8_1 etc, no?

blissful current
#

I'm probably misunderstanding but let's say I getDir of of the position I like. Now when I go to setDir it should look correct for the "spawn" I tested it in. But if it ends up at a different "spawn" it might look weird because it would need a different setDir there, right?

warm hedge
#

What's your attempt?

blissful current
#

See how this is misaligned from the wall? You are saying I use setDir to place it properly, right?

warm hedge
#

Urm, I meant your code

blissful current
#

Well that's fine for this house it is in. But it could spawn in two other houses which probably wont work for the setDir of the first house.

#

Oh I posted the code above. I was asking for direction of how to solve this issue.

warm hedge
#

Ah I see

#

Point is, if these obj8s are meant to get pos and dir, you can use getDir. However you need to reconstruct your code a bit since you don't want to selectRandom it twice

#

So store the selectRandom'd obj, use it to getPosWorld and getDir

blissful current
#
if (!isServer) exitWith {};

this setPosATL (getPosATL (selectRandom [obj8_1, obj8_2, obj8_3]) );

if (getPosATL obj8_1) then {setDir XYZ};
if (getPosATL obj8_2) then {setDir XYZ};
if (getPosATL obj8_3) then {setDir XYZ};

Maybe something like this in the obj8 init?

#

One moment while I read your suggestion/

tender fossil
blissful current
#
if (!isServer) exitWith {};

private _selectedObj = selectRandom [obj8_1, obj8_2, obj8_3];

this setPosATL (getPosATL _selectedObj);

if (_selectedObj isEqualTo obj8_1) then { this setDir XYZ1; };
if (_selectedObj isEqualTo obj8_2) then { this setDir XYZ2; };
if (_selectedObj isEqualTo obj8_3) then { this setDir XYZ3; };
warm hedge
#

Oh urm... why there is XYZ1 etc?

blissful current
#

Nice. Now how do I get the position value in the editor?

tender fossil
blissful current
#

I guess my next step is to find what those values are. I wonder if I can grab them from inside the editor.

warm hedge
#

I actually thought you wanted to use obj8 etc to get both pos and dir

#

One easy and obvious way is, open up the preview and check getDir and getPosWorld return values

blissful current
#

Maybe one of these?

blissful current
warm hedge
#

Yes, big bottom right button

blissful current
#

Thank you both for the help. This should keep me busy for a bit.

native hemlock
#

@tough abyss I think this would work [player,['My action',{hint 'hello world';},nil,0,true,true,'','true']] remoteExec ["addAction", -2];

#

There is also a ghetto/less secure way [{player addAction ['My action',{hint 'hello world';},nil,0,true,true,'','true']}] remoteExecCall ["BIS_fnc_call",-2];

wind hedge
#

Is there any way to hide Miller's hair while he is wearing a cap/helmet?

warm hedge
#

No

wind hedge
# warm hedge No

I guess one could brute force their way into changing to a hairless identity with an inventory closed event handler

#

I hope changing identities mid game on a MP match doesn't cause issues thou

vagrant geode
#

Hi. I'm trying to add the custom asset list to the game arma 3 - warlords, it looks impossible. I've seen all manuals and watched all youtube tutors (there arent many), but still cant edit a single thing in the asset list.
Got any idea?

meager granite
#

I have no idea how Warlords works but just a glance at configs suggests you have to use WEST and EAST too

#

fn_WLParseAssetList.sqf:

    if (typeName _target == typeName sideUnknown) then {
        {
            _entries append (configProperties [configFile >> "CfgWLRequisitionPresets" >> _x >> str _target >> _type]) + (configProperties [missionConfigFile >> "CfgWLRequisitionPresets" >> _x >> str _target >> _type]);
        } forEach BIS_WL_shoppingList;
    } else {
        {
            _entries append (configProperties [configFile >> "CfgWLRequisitionPresets" >> _x >> str (side group _target) >> _type]) + (configProperties [missionConfigFile >> "CfgWLRequisitionPresets" >> _x >> str (side group _target) >> _type]);
        } forEach (_target getVariable "BIS_WL_requisitionPreset");
    };
#

Yeah, you must use stringified side as config name

#

BLU_F and OPF_F are faction names, not sides

scarlet tree
#

Is FSM an appropriate method for mission flow handling in multiplayer scenarios?

#

I've no experience yet but since the code isn't scheduled it seems like it might be very heavy on resources.

warm hedge
#

Yes

jade abyss
#

I think watching KKs Scripts without the basic knowledge is like pumping yourself Heroin, when you just smoked Cigarettes before πŸ˜›

#

(overload)

golden mirage
#

and im making a mission

#

but i use HashMapObjects for everything πŸ˜†

faint burrow
#
golden mirage
#

scheduled is always the way to go imo

#

i run my entire AI Commander in SQF yeah its 2k lines but honestly could just break it down into a diagram yourself in Paint while your coding and leave in it in ur files for people to find so they understand.

#

i.e i left a huge readme for mine

#

like ye technically FSM is scheduled

#

its really up to the readers opinion

#

since HashMapObjects exist i dont see any reason to NOT have a giant 10k line HashMapObject

#

because the methods are clearly defined.

nocturne bluff
#

@keen stream use remoteExec

dim elk
#

I'm trying to use an array of possible magazines in order to get a count of how many mags the player has that fall within the array, but it's not returning the value, instead it is stuck at 0.

Below is my initPlayerLocal.sqf:


[] call SOCOM_Vests_JPC_fnc_reloaded;
[] call SOCOM_Vests_JPC_fnc_take;
[] call SOCOM_Vests_JPC_fnc_put;
[] call SOCOM_Vests_JPC_fnc_arsenalCheck;

missionNamespace setVariable ["SOCOM_Vests_JPC_ArsenalOpen", false];

SOCOM_PrimaryMags = [
    "TOTT_PMAG_Blk_30rnd_A1",
];

missionNamespace setVariable ["SOCOM_PrimaryMags", SOCOM_PrimaryMags];

Then in my fn_countMags.sqf I have this to get the mag count:


private _totalMags = count (magazinesAmmo player select { (_x select 0) in _trackedMags });

Not sure wehre I'm going wrong here.
Hard coding _trackedMags with just the class name works fine, but I want to have an array of possible mags to be tracked.

proven charm
#

do you have script errors on?

flint topaz
#

As it might be a timing issue?

#

Can you add a check into countMags to print out the result of _trackedMags

proven charm
#

i think theres a syntax error in SOCOM_PrimaryMags

#

, there

flint topaz
#

True

#

Config would accept that, but not sqf

hallow mortar
#

That , is the primary suspect, but also keep in mind that in is case-sensitive - check and double-check that your specified classname is exactly correct.

dim elk
flint topaz
dim elk
#

So I have this under the trackedMags:

systemChat format ["Player has %1 primary mags", _totalMags];

It just says I've 0.

flint topaz
#

Tracked mags not total mags

#

I want to see the array

dim elk
#

The array is just one item, I just wanted to make sure it actually passess the class name correctly.

hallow mortar
dim elk
hallow mortar
#

In the array of tracked magazine classes

flint topaz
#

Then in my fn_countMags.sqf I have this to get the mag count:

systemChat str(_trackedMags);

private _totalMags = count (magazinesAmmo player select { (_x select 0) in _trackedMags });
#

Can you do this for me regarding the countMags

#

I’ll let Nikko do his part first

hallow mortar
# hallow mortar In the array of tracked magazine classes

In SQF, , is used to separate elements in an array from each other - if there's no element after it to be separated, it's not valid. So you can't have a , after the last element in an array. This is a hard blocker and will cause a script error.

dim elk
#

Stand by, booting up

dim elk
#

Disrgard, an empty array is returned

hallow mortar
#

What's in SOCOM_Vests_JPC_fnc_arsenalCheck?

dim elk
#
["ace_arsenal_displayOpened", {
    missionNamespace setVariable ["SOCOM_Vests_JPC_ArsenalOpen", true];

    [] spawn {
        while {missionNamespace getVariable ["SOCOM_Vests_JPC_ArsenalOpen", false]} do {
            [] call SOCOM_Vests_JPC_fnc_countMags;
            sleep 0.1;
        };
    };
}] call CBA_fnc_addEventHandler;

// Event handler for when the Arsenal is closed
["ace_arsenal_displayClosed", {
    missionNamespace setVariable ["SOCOM_Vests_JPC_ArsenalOpen", false];
}] call CBA_fnc_addEventHandler;
#

I gotta get going to work, if you have any ideas just @ me so I'll be able to catch your messages when I'm back home. Appreciate the help

hallow mortar
#

_trackedMags being empty indicates that SOCOM_PrimaryMags is undefined, and the getVariable is using its default value. But we can see SOCOM_PrimaryMags being defined here.
Possibilities:

  • something in one of those called functions is broken or has an inline suspension, which prevents everything after that in initPlayerLocal.sqf from being run
  • something is overwriting SOCOM_PrimaryMags with [] or nil
    Notes:
  • You don't need to setVariable SOCOM_PrimaryMags. A global variable (no _ prefix) is a missionNamespace variable by default, so doing that setVariable is effectively the same as SOCOM_PrimaryMags = .... You'd only need the setVariable if you wanted to change it from local to global, set it in a different namespace, or use the network broadcast feature. This shouldn't cause the main issue, though.
wind flax
#

Is there a way to apply Depth of Field effects that are used in Splendid Camera to a player (ie without the camera open)?

visual epoch
#

I'm trying to get a vehicle to have it's texture changed when it's respawned, but I can't seem to get it to run the script - It's always the default appearance.

#

running the function outside of this expression field works fine, so I don't know what I'm doing wrong.

crimson lion
#

instead of newVehicle try (_this select 0)

stable dune
#

So

[(_this select 0), ["Bluefor",1],true] call BIS_fnc_initVehicle

this select 0, select 1 element from the array (params ["_newVehicle","_oldVehicle"])

visual epoch
#

Ah...

#

I feel like it should know how to pass the parameters on it's own, odd.

visual epoch
#

Hasn't worked, sadly :(

#

Here's the vehicle respawn module, synced to the mrap

keen stream
#

@nocturne bluff I'll take a stab at it.

scarlet tree
#

If you're looking for this (vanilla Strider HMG), you might want to name it "Blufor" instead

visual epoch
#

no way I messed that up, hang on...

#

Oh my god you're right

native hemlock
#

Either of the two examples I posted in response to Quiksilver should work for you @keen stream

errant iron
#

How do I open the player's inventory while they're in a vehicle? I've tried the following:
https://community.bistudio.com/wiki/Arma_3:_Actions#Gear sqf player action ["Gear", objectParent player]; But the inventory dialog doesn't actually show up. FWIW, I noticed Project SFX: Remastered was still able to play their inventory sound, and looking in their source code, they're using the InventoryOpened event handler so that likely fired, but my magazine repack system relies on the opposite InventoryClosed handler to know if it should stop repacking the player's magazines.

vagrant geode
#

Hey! Anyone knows how to remove sectorpopulate in warlords without having to remove INF_F from warlords init bcs it throws a ton of errors into log? I mean it works like this, but it's impossible to find other errors in the log bcs of it

proven charm
errant iron
#

but apologies for not editing my message earlier, i figured out it works if you replace the command with actionNow, which i guess makes sense, you aren't supposed to perform the inventory animation inside vehicles

#

another bug squashed :)

nocturne bluff
#

@keen stream same as bis_fnc_mp just a command version of it

tulip ridge
#

Your issue is because you're not setting the frequencies on the specific radio that a player has, but the basic version

#

I.e. You're using TFAR_ANPRC152 instead of TFAR_ANPRC152_x where X is the id of the radio they have

proven charm
#

what's "local hint" in the code above? πŸ€”

glossy pine
#

whats the purpose of CBA_missiontime ? have a synchronized time between all the clients ? Its not the same as serverTime ?

tulip ridge
#

Yes

#

time won't be the same for each client, and serverTime doesn't work in SP

hushed turtle
tulip ridge
glossy pine
#

ok, thanks

golden mirage
#

in SQF.

#

syntax doesnt bother me but i coded in LUA with Classes which is basically OOP

#

everything is oop there iirc for games like Supreme Commander FOrged Aliance which Lua 5.0.1 (Moholua specifically)

#

having HashMapObjects is what got me into coding in SQF

frozen seal
#

hello!
I am a bit confused about functions like setRain and setOvercast.
For most of them wiki tells that they have local effect, however there is also the forceWeatherChange that is supposed to be executed on the server?

If that's the case, how do I go about changing the weather from scripts? Should I first call all the set- commands locally for all clients and then fire forceWeatherChange only on the server?
Or will forceWeatherChange force the server to broadcast weather parameters?

hushed turtle
#

Weather is synced with server

granite sky
#

from the server.

#

All the weather functions are effectively server-effect in A3, I think. Some of them will have temporary local effect.

frozen seal
#

so I should call all the set- functions on the server and then fire forceWeatherChange to sync it?

hushed turtle
#

How often does weather get synced? Is that several seconds?

granite sky
#

forceWeatherChange just shortcuts the transitions, I think.

tidal ferry
#

Does it basically just initialize a radio repeater?

sharp grotto
wind flax
wind flax
#

Any chance of that being introduced?

#

Could be cool for night vision. You could apply focus to emulate lens caps, or focusing on nods.

visual epoch
#

Can one group have multiple formation leaders?

meager granite
#

like you could in OA

visual epoch
#

not what I meant - formation leaders aren't controlled by the player if I understand it right.

#

They're what controls who the AI follow in a formation.

hushed turtle
#

You can have multiple formations if you for example give move order to multiple units in your group or to achiev this by scripting I belive that's what doFollow command is for @visual epoch

visual epoch
#

gotcha ,thanks!

still forum
faint trout
#

Heya I have the following code, unluckly for some reason the EVH never triggers. Anyone got some Ideas? Feel free to ask for missing context!

private _group = createGroup [EAST, false];
_group addEventHandler ["EnemyDetected", {
    params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"];

    diag_log format ["EnemyDetected! - _this: %1", str _this];
}];
#

The Player that should trigger the Script is CIVILIAN sided with the following known Changes:

EAST setFriend [CIVILIAN, 0];
player addRating -1e20;
granite sky
#

You can't make east consider civilian as enemy, IIRC.

#

civilian has some hard rules. It's not as flexible as the other three factions.

faint trout
#

Sad me, thanks to responding

spiral narwhal
#

So I have an object that has an addAction, which then calls a function

#

I have a variable defined in the init of the object

#

The function gives me an undefined variable error when its called

hallow mortar
spiral narwhal
#

The object/addAction:

this setVariable ["meth_cooking", false];

this addAction  
 [  
   "Cook Meth",   
   {[player] call drugsys_fnc_cookMeth},  
   nil,    
  1.5,    
   true,    
   true,    
   "",     
   "(playerSide == civilian);",    
   5,     
   false,    
   "",     
   ""     
 ];

The function:

params ["_labObject", "_isActive"];

_labObject = "meth_table";

private _isActive = _labObject getVariable |#|meth_cooking;
// Err - undefined variable in expression here ^

if (_isActive) exitWith {hint "ERROR: You are already cooking meth!"};
hallow mortar
#

getVariable requires a "string" for the variable name

spiral narwhal
hallow mortar
#

You have other problems with this function though

spiral narwhal
#

i can already see a few

hallow mortar
#
  • The function requires 2 parameters, _labObject and _isActive, but when you call it you only pass 1, the player who activated it
  • you then overwrite the _labObject anyway...with a string, which you then try to use for things you can't use a string for
spiral narwhal
hallow mortar
#

Change [player] call drugsys_fnc_... to [_this#0] call drugsys_fnc_... - this will pass the object the action is attached to into the function. (There's more to this but I'm going to answer your question first)

hallow mortar
hallow mortar
tidal ferry
#

Or will they amplify any signals they recieve?

spiral narwhal
#

i dont think at this time im at the point where i need to be passing anything to the function

#

i removed [player] to blank and it still worked duckshrug

#
private _methlab = meth_table;

_isActive = _methlab getVariable "meth_cooking";

if (_isActive) exitWith {hint "ERROR: Someone is already cooking meth!"};

this is working fine now

hallow mortar
#

(I already wrote this and it's useful information so I'm just hitting send)
It's not essential, but I'd suggest using the other syntax of getVariable, which allows you to specify a default value that gets used if the variable isn't defined (I recommend false in this case). That way, you don't have to bother doing the initial setVariable, because your getVariable will simply assume it's false until you specifically set it to something else.

spiral narwhal
#

this syntax?

varspace getVariable [name, defaultValue]

hallow mortar
spiral narwhal
still forum
dim elk
vague sparrow
#

do bleed tickets/respawn tickets actually work or nah?

blissful current
#

I move this object with the following code. In the object properties I have simulation enabled. So why is it still floating?

#
this setPosATL (getPosATL _selectedObj);
tulip ridge
#

Not all objects have gravity

blissful current
#

If I put the invisible helipad on the ground then the car in half inside the terrain. How could I make it so it looks normal?

tulip ridge
blissful current
#

Thanks I'll give that a shot!

keen stream
#

@native hemlock Looking at it now πŸ˜ƒ

tidal ferry
blissful current
#

Sometimes setDir works and sometimes it doesn't. I can't figure out why. The code seems simple enough:

private _selectedObj = selectRandom [obj9_1, obj9_2, obj9_3];

if (_selectedObj isEqualTo obj9_1) then { this setDir 96; };
if (_selectedObj isEqualTo obj9_2) then { this setDir 318; };
if (_selectedObj isEqualTo obj9_3) then { this setDir 120; };

this setPosATL (getPosATL _selectedObj);
granite sky
#

Are you saying this behaviour is deterministic or not?

blissful current
#

I'm saying that I can't reproduce the behavior at will.

granite sky
#

wait, where is this code?

#

Given that the only thing it does is run setDir on a random object, it's probably not the setDir that's the problem.

blissful current
#

This is placed in the object init in the editor. Full code:

if (!isServer) exitWith {};

private _selectedObj = selectRandom [obj9_1, obj9_2, obj9_3];

if (_selectedObj isEqualTo obj9_1) then { this setDir 96; };
if (_selectedObj isEqualTo obj9_2) then { this setDir 318; };
if (_selectedObj isEqualTo obj9_3) then { this setDir 120; };

this setPosATL (getPosATL _selectedObj);

if (_selectedObj isEqualTo obj9_1) then { obj9 setVectorUp surfaceNormal getPosASL obj9 };
if (_selectedObj isEqualTo obj9_2) then { obj9 setVectorUp surfaceNormal getPosASL obj9 };
if (_selectedObj isEqualTo obj9_3) then { obj9 setVectorUp surfaceNormal getPosASL obj9 };
#

It transports a car to 1 of 3 random spots. The Biki said to do the setDir first then setPosATL. After than it does the surfaceNormal so the car isn't inside the terrain if there is a hill.

granite sky
#

And sometimes it doesn't set the direction of the car? No dependency on the position?

blissful current
#

Hmmm. Let me check that with ADT. I will move the invisible helipad and run the code again in different spots.

visual epoch
#

Do waypoint IDs change as they're completed, or are they static after they're first assigned?

hallow hound
#

question, completely new with scripting but i was wondering if anyone has a script that allows me to add teleported in eden

visual epoch
hallow hound
#

i would like them to interact with a terminal

blissful current
hallow hound
#

but a a script where you just get tp'd if u get close to something also works

visual epoch
#

Yeah, that's easily doable. I can't get to my PC right now, but you can make use of addAction and setPosATL

granite sky
hallow hound
visual epoch
#

Sorry, can't write it tonight, but I'm sure someone here will help

hallow hound
#

all good, thx tho

blissful current
granite sky
#

It's not a car? :P

blissful current
#

Oh it is, lol. But it seems the SOG:PF devs did not intend for it to be driven. (EDIT: It's because I chose "prop" in the editor) In my mission there's a holdAction on it to search it for intel.

#

Well it's working now, but idk why I can't use this in the init for it though.

keen stream
#

Not really.. I haven't touch BIS_fnc_MP in a very long time and never looked at remoteExec(call) up until now.

quasi gale
#

Is their a proper/efficient way to have a helicopter pocket you up after all tasks are completed and take you back to base to end the mission?

I'm building a mission and I want it to end with the helicopter pick up, then back to base and mission ending.

primal trench
#

Is there an EH or something like that that's triggered when you use the ranging function of an optic?

hallow mortar
mint flame
#

@hallow mortar Hi Im trying to spawn a batalion group vehicle using arma commander mode but when i do the camo's i have applied aren't applied when spawning ingame, do u know how to fix this

hallow mortar
#

I don't know anything about "Arma commander mode"

#

Asking the channel in general is usually better than pinging specific people. I help when I can but I'm not on-call support.

visual epoch
#

I'd like to remove a communication menu that was assigned to an entire group after someone in the group uses it. What's the best way to go around it? I fear I'll have to keep track of each one somehow.

visual epoch
#

Yeah. I was gonna include a link to that but the server doesn't allow it for some reason.

proven charm
#

ok well its been a while since i played with that but theres this removeAfterExpressionCall = 0;

#

hth

visual epoch
#

I know about that, but I am adding the same command menu item to everyone in a group, and I'm not sure if one person using the call would also remove it from everyone else.

#

Hard to test multiplayer stuff like that

proven charm
#

ok

mint flame
hallow mortar
#

I still don't know anything about "Arma commander mode"

visual epoch
# proven charm hth

I'm also testing to see if running this monstrosity would do the same.

    _unit = _x;
    {
        [_unit, _x] call BIS_fnc_removeCommMenuItem;
    } forEach supportUsers;
} forEach units spear1;```
`supportUsers` is an array of commandmenu IDs from when they're being created.
While this _does_ technically work it also throws a bunch of errors in the function itself - Probably because I'm giving it commandmenu IDs that don't exist on the given unit, too.
#

Probably best to limit these things to single persons in the future, huh.

proven charm
#

can you post the errors?

visual epoch
#

Aye, 1 sec

#

Yeah it's related to trying to remove nonexistent menus, no dobut

stable dune
# visual epoch

You are sending unit and unit in function.
Not unit and index

mint flame
stable dune
#

_unit = _x
And your _x is unit
[_unit, _x] ,
So is same as
_unit , _unit or _x,_x

visual epoch
hallow mortar
# mint flame how do usetg a global trigger

That's a very broad question. Global triggers have many uses, and many ways to use them. It's more important to know what the actual objective is that you want to achieve.
More important for someone else to know, that is. Please stop pinging me.

proven charm
#

if you really want to use that approach you can just make sure the "loop" hasnt ended: if(isnil "BIS_fnc_addCommMenuItem_loop") then { // bail };

visual epoch
#

@stable dune Am I understanding this correctly? what would I need to change?

stable dune
mint flame
#

I have a very aggressive ai spawned in, ti attacks even independent even after setting it to be peaceful, why

stable dune
visual epoch
stable dune
visual epoch
#

Agh, right

#

So [_unit, _x] remoteExec ["BIS_fnc_removeCommMenuItem"];

stable dune
visual epoch
#

oh yeah that's clever.

#

I'm still getting used to what should be local and what isn't.

#

I should probably do the same for adding them.

stable dune
visual epoch
#

Hm, I have a different problem now.
Executing it remotely means I don't get the list of IDs I was using, because I don't get the addCommMenuItem returns.

hallow mortar
#

It's time to ✨ make a function ✨

visual epoch
#

Is that really the only way to get around to it?

hallow mortar
#

A function is essentially a script contained in a variable. When you remoteExec a function (that's defined on all machines involved) the target machine executes that script locally. This means you can easily remoteExec complex code that does stuff with its returns.

#

Functions are super useful and quite easy to make once you know how, so it's worth learning.

#

The most proper way to do it is with CfgFunctions (https://community.bistudio.com/wiki/Arma_3:_Functions_Library, long page but a lot of it isn't actually important for your usage), but you can also just define variables like this:

my_fnc_someFunction = {
  params ["_one", "_two"];
  systemChat _one;
};```
and then broadcast with `publicVariable` or `setVariable` if needed.
visual epoch
#

One thing I am confused about - BIS_fnc_addCommMenuItem is a function and it doesn't return anything when I remotely execute it. How would me creating a function encompassing it change something?

hallow mortar
#

If that function returns nothing, it would still return nothing. I don't think there's anything useful it could possibly return to you, though, so...

visual epoch
#

sorry, typo. edited

#

I found a way to cheese it since the IDs are persistent in this case, but I still wonder how this would've changed things.

hallow mortar
#

The advantage is being able to do this (simplistic example):

my_fnc_addAndSave = {
  private _ID = [ ... ] call BIS_fnc_addCommMenuItem;
  missionNamespace setVariable ["my_local_commItemID", _ID];
}:
my_fnc_getAndRemove = {
  private _ID = missionNamespace getVariable ["my_local_commItemID", -1];
  [player, _ID] call BIS_fnc_removeCommMenuItem;
};
publicVariable "my_fnc_addAndSave";
publicVariable "my_fnc_getAndRemove";
0 remoteExec ["my_fnc_addAndSave",0];
sleep 5;
0 remoteExec ["my_fnc_getAndRemove",0];

The basic function doesn't return anything when remoteExec'd because remoteExec doesn't transfer returns back to you, from anything - it can't, practically speaking, because it can't wait for an unknown number of other machines to report back. But when you put it inside another function, you can handle the return locally within the outer function. The return doesn't need to go back to the originating machine.

#

(I have a message with a more advanced, JIP-safe example of doing this. I'm going to find it while you read that.)

visual epoch
#

This will take a while for me to process so I'm on the same page

hallow mortar
#

#arma3_scripting message
This is about addAction but it's also an ID-based thing, so the principle is essentially the same

visual epoch
#

I'll have a look at it, thanks

hallow mortar
#

To try and explain further:
When you remoteExec a function, you're essentially telling the target machine to look up its own local copy of the function, and execute it normally - just the same as if there was no remoteExec involved. That means all the normal scripting principles behave exactly as normal, locally to the target machine. The originating machine doesn't (and can't) receive a response, but that's okay, because everything is being handled on the target machine, within the function.

visual epoch
#

Or do I need to run execVM through remoteexec, too?

tender fossil
weary zodiac
#

hey i've never scripted before but am trying to get chatgpt to make me a script where the AI Plane/pilot can't go below 3k meters and cant bomb while below 3k meters, this is the script:

    params ["_plane"]; // Reference to the AI plane
    private _minAlt = 3000; // Minimum altitude for bombing (in meters)

    // Set the plane's behavior to COMBAT to enable bombing
    _plane setBehaviour "COMBAT";

    // Continuously monitor the plane's altitude
    while {alive _plane} do {
        private _altitude = getPosASL _plane select 2; // Get altitude above sea level

        // If the altitude is below the minimum, adjust the altitude
        if (_altitude < _minAlt) then {
            _plane flyInHeight _minAlt; // Set the plane's altitude to the minimum
        };

        // If the altitude is above the minimum, command the plane to drop bombs
        if (_altitude >= _minAlt) then {
            // Define the target type and search radius
            private _targetType = ["Tank", "Car", "StaticWeapon", "Man"];
            private _radius = 2000; // Search radius in meters

            // Find the nearest target within the specified radius
            private _targets = nearestObjects [getPos _plane, _targetType, _radius];
            if (count _targets > 0) then {
                private _target = _targets select 0; // Select the closest target
                _plane doTarget _target; // Set the target
                _plane doFire _target; // Fire (drop bomb)
            };
        };

        // Wait for a short period before checking again
        sleep 2;
    };
};

but am getting getting an error saying "init: missing }" can someone help please?

hallow mortar
# visual epoch I assume that files tied to the scenario (init, description, other sfm files) ar...

Everything that's included in the mission folder gets packed into the PBO and is distributed to all machines.
Whether it's executed is different. Event scripts like init.sqf or onPlayerRespawn.sqf are automatically executed by everyone according to their event conditions. Normal script files are executed on any machine that...tries to execute them. Commands like execVM are Local Effect, so they only execute that script on the current machine.

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
hallow mortar
weary zodiac
stable dune
hallow mortar
granite sky
#

I can't actually spot the syntax error in that one. The setBehaviour and doFire are wrong (plane rather than group/unit) but they'd throw a different error.

#

Also flyInHeight ASL vs ATL mismatch, and the bombing probably won't work.

vapid root
#

hey i have a quick question for any1 that can answer me so i made a unit and the insignia shows on most uniforms but me and my friends use custom uniforms and the insignias dont show at all is this a coding issue ? or is it the uniform just being too big to display the patch ? or soemthing different ? i put this in another channel as well and dont know if this is a issue with uniform scripting or something different

hallow mortar
blissful current
# weary zodiac yea makes sense

Nikko makes a very good point. I want to add a caveat, though. This is from the perspective of someone who is very new to programming and from the perspective of someone who has 15 years of experience as a mechanic. One thing my instructors taught me in mechanic school was that you can't just rely on scanners to give you the correct diagnostic code on a vehicle all the time. But you can use the codes as clues to help you diagnose an issue. The scanner is a tool.

It's the same thing for ChatGPT. It is a tool. You have to be smarter than the tool to know how to use it correctly. But if you can do that then it can have some benefits. For example, for me, it has helped me understand concepts and even specific commands of SQF. I like to ask it how things work and why it works that way. Then I often cross check this info with people here.

It is not my first source of info (mostly it's the last). I will come here first. But sometimes everyone is asleep when I post and ChatGPT is literally the only source to help me break a roadblock by myself and it has helped me plenty of times. Just remember, be smarter than the tool.

weary zodiac
versed trail
#

I'm trying to make a camera move with unitCapture / unitPlay, and only the movement isnt working. I have my item and

testCamera = "camera" camCreate getPosATL testPos;
sleep 0.5;
[testCamera, testCameraCapture] spawn BIS_FNC_unitPlay;
testCamera cameraEffect ["internal","back"];

This puts the player in the camera but it doesnt move with the capture data. I can use [player, testCameraCapture] spawn BIS_FNC_unitPlay; to move my player on the capture arc perfectly fine; am I missing some sort of fundamental incompatibility or is there a different way to move cameras? (that's MP compatible, I used keyframes to get the movement but its not MP compatible) There also aren't any script errors when using a camera

granite sky
foggy stratus
#

I have a script for moving boats through positions using eachFrame and setVelocityModelSpace. This allows boats to navigate narrow rivers that AI with waypoints could never do. One small problem is that engine noise does not match the forced speed of the boat. The boat engine is on, but always at the low idle noise. When a player drives a boat and accelerates fast you get a louder noise.

#

Is there a way to force engine noise louder via code?

pallid palm
#

ChatGPT does move bad then good, it F's up your thinking

#

don't use ChatGPT just learn from others and BIS too

#

plus it leaves things out and F's you up even more

pallid palm
#

i wish i could use ChatGPT to fix my Golfswing lol hahahaha

meager granite
#

Unless you want to write your own version of the function, you can try spawning some static entity and attaching camera to it

#

Not sure which will work though, Logic maybe?

versed trail
#

hm. okay, that's a good catch. thank you

meager granite
#

Spawn logic, spawn camera, attachTo camera to logic, do a playback on the logic

versed trail
#

yeah, I used the keyframe camera attached to a game logic unit before for the recording. can probably do it again. otherwise I can just modify the function

meager granite
#

Wish there was a scipting command to set and return RPM

#

general purpose

#

Could make scripted events like engine failure, save/playback RPM values like in this example, etc.

#

Maybe limited to only some sim types if its much of a hassle

hushed turtle
#

Any ideas what do to with units stuck in rocks? It prevents mission from ending, since all enemy units need to be killed

proven charm
#

write a script that counts all alive units excepts those inside rocks

#

consider the ones in rock as dead

#

simplest way. or move then out of the rocks...

#

something bad with the AI spawn code (I guess) if they end up inside rocks

jade abyss
#

There is no big difference in the format. @hasty violet

golden mirage
#

most defensable location!

proven charm
hushed turtle
#

They somehow just walk in sometimes

#

I've seen AI walking through walls in this game

#

Or other objects like trees

#

How to check if they are inside a rock?

proven charm
#

first get the rocks with nearestTerrainObjects [_cpos, ["HIDE","ROCK","ROCKS" ], 50];

#

if they overlap

hushed turtle
#

Ok, this seems like good enough solution

#

Thanks

proven charm
#

(HIDE = rocks btw)

hushed turtle
#

Unit standing right next to rock might overlap too sometimes, but it is still better than stuck units

proven charm
#

yep

#

you could also try lineintersect to see if unit is inside rock

drowsy geyser
#

how would i add an action to a vehicles specific memoryPoint or selection? i want to show the addaction only if the player looks at the rear door

this addAction
[
    "Open rear door",
    {
        params ["_target", "_caller", "_actionId", "_arguments"];
        if (_target doorPhase 'Door_4_source' > 0.5) then
        {
            _target animateDoor ['Door_4_source', 0];
        }
        else
        {
            _target animateDoor ['Door_4_source', 1];
        };
    },
    nil,
    1.5,
    true,
    false,
    "",
    "true",
    2,
    false,
    "", //?
    "" //?
];
proven charm
#

its the 11 argument "selection"

#

or "memoryPoint" 12

drowsy geyser
#

yes, but i dont know what to enter

proven charm
#

well the selection are in the vehicle config so you can use config browser to find them

warm hedge
#

Or selectionNames

drowsy geyser
#

i mean simply type in for example: door4 ? using selectionNames

warm hedge
#

There is no guarantee that the rear door has selection

drowsy geyser
#

door4 stands for rear door but whould simply type in the selection argument door4?

warm hedge
#

Same answer. Animation name is not selection name

drowsy geyser
#

door3 stands for the side door of the "C_Van_02_vehicle_F" and writing door3 as the memoryPoint works but door4 for the rear door does not work πŸ€”

drowsy geyser
#

okay for the rear door it is: Door4_sound

finite bone
#

Is there a page that lists all the BIS_fnc functions and its syntax?

finite bone
#

Ah I'm an idiot looking just at the Scripting Commands kmao

visual epoch
#

I have a scenario with a lot of vehicle units that start out with simulation disabled, but once they're enabled again, I'm having a hard time getting them to follow their waypoints, or move at all.

proven charm
#

code?

pallid palm
#

hello Awsome Arma 3 Friends: So i use getPosASL for stuff above, What about stuff Below sea Level is it still getPosASL

dusty steppe
#

As far as I know, you just get a negative height if it's below sea level

pallid palm
#

like under water

#

they should make a getPosBSL he he

#

so i guess i still use getPosASL and it will give me a like a negative height

#

if the thing is under water

#

rgr m8 thx

visual epoch
# proven charm code?

It's a trigger for OPFOR units. On Activation looks like this: {_x enableSimulationGlobal true;} forEach thisList;

proven charm
#

so everyone in trigger gets their sim on?

visual epoch
#

That's the intention, yeah.

pallid palm
#

gets there sim on lol thats funny

visual epoch
#

the units are enabled, I've checked in zeus enhanced at runtime, it's just that they refuse to move their vehicles in any way.

#

Only solution I found is to have the units start outside of the vehicle and get them to get in afterwards, but that feels like a lazy solution to a problem I shouldn't have an issue with.

proven charm
#

are you sure? you could debug it using single vehicle like: simulationEnabled TestVeh

#

in console

visual epoch
#

returns true

pallid palm
#

did you check all the units attributes

proven charm
#

hmm , the enableSimulationGlobal should be run only at server but idk if thats a problem. are you testing from editor?

visual epoch
proven charm
#

ok

visual epoch
#

I could send u the scenario so you can see for yourself.

proven charm
#

maybe crew has its simulation toggled different way than vehicles

#

no need

#

as i cant think of anything good :/

pallid palm
#

somtimes we copy and past units and we forget to set the attributes bact to normal

visual epoch
proven charm
#

maybe just forget the triggers for now and test everything in console

#

take one vehicle and play with that

visual epoch
#

will do

visual epoch
#

Units with disabled simulation within a vehicle with disabled simulation will not move at all once the simulation is enabled on both the vehicle and the crew within.

proven charm
#

humm maybe it matters in wich order you enable vehicle vs crew

#

try enable vehicle first

pallid palm
#

why must you disabled simulation cant you just put use doStop

#

and then change command after that

visual epoch
proven charm
#

well if you cant get this to work you could try using enableAI/disableAI "ALL" on the men

pallid palm
#

yeah just use doStop on the w8ting units

visual epoch
proven charm
#

ok

pallid palm
#

or just spawn in the units as you need them

visual epoch
pallid palm
#

you can customize spawned in units

#

messing with disabled simulation can be messed up i found over the years

visual epoch
pallid palm
#

heres an Exsample of a customize unit

#
"O_Soldier_unarmed_F" createUnit [getPos leader (_grp), _grp, "_handler = this execVM 'loadouts\CSAT_SoldierAK.sqf';", 0, "MAJOR"];
#

i use the unarmed unit so it does not throw a erra in the RPT

#

all you need to do is build the CSAT_SoldierAK.sqf loadout

#

and name it as u wish

#

if you want the CSAT_SoldierAK.sqf just let me know

#

then you can just edit it

visual epoch
pallid palm
#

why do you want it to be in the description.ext

visual epoch
#

so that it's local to the mission. creating a unit with a full loadout and then changing it's loadout with another script feels... inefficent?

pallid palm
#

in the sqf it will be local to the mission

#

the description.ext is not the solve all to local

#

the description.ext is just like a params file as it were

#

local and nonlocal is some what of a diff thing

visual epoch
#

Okay, but why create a unit with a full loadout, only to give it a different loadout a second time? there must be a better way.

pallid palm
#

what do u mean give it a second time ? theres no second time

#

the unit only get a load out 1 time theres no second time

#

the unit gets spwaned in with the loadout

visual epoch
#

Can I see the sqf file you mentioned?

pallid palm
#

yes sure m8 np 1 sec

#
//Server Run
if (!isServer) exitWith {};

scriptName "CSAT_SoldierAK";
//Gear names
_vestArr = selectRandom ["V_BandollierB_cbr","V_Chestrig_khk","V_BandollierB_cbr"];
_backpackArr = selectRandom ["B_FieldPack_cbr","B_FieldPack_khk","B_FieldPack_blk"];
//comment "Remove existing items";
removeAllWeapons _this;
removeAllItems _this;
removeAllAssignedItems _this;
removeUniform _this;
removeVest _this;
removeBackpack _this;
removeHeadgear _this;
removeGoggles _this;
//comment "Add weapons";
_this addWeapon "arifle_AKM_F";
_this addPrimaryWeaponItem "30Rnd_762x39_Mag_F";
//comment "Add containers";
_this forceAddUniform "U_I_L_Uniform_01_tshirt_skull_F";
_this addVest _vestArr;
_this addBackpack _backpackArr;
//comment "Add items to containers";
for "_i" from 1 to 5 do {_this addItemToUniform "FirstAidKit";};
//comment "Add items to containers";
for "_i" from 1 to 3 do {_this addItemToVest "30Rnd_762x39_Mag_Tracer_Green_F";};
for "_i" from 1 to 3 do {_this addItemToVest "HandGrenade";};
//comment "Add items to containers";
for "_i" from 1 to 2 do {_this addItemToBackpack "SmokeShell";};
for "_i" from 1 to 6 do {_this addItemToBackpack "HandGrenade";};
for "_i" from 1 to 4 do {_this addItemToBackpack "30Rnd_762x39_Mag_Tracer_Green_F";};
//comment
_this addHeadgear "H_Booniehat_tan";
//comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "ItemGPS";
visual epoch
pallid palm
#

not the unarmed unit does not

#

you know unarmed

#

oops need the selectRandom at line 6 also

#

can't beleive i missed that wow

#

there fixed

#

theres a hole host of ways to edit units

visual epoch
#

I think I'll just look at how BI did it in the campaign.

pallid palm
#

ok sure np m8

#

yull find my way is way easyer

#

iv have all ready done that what u just said

#

and my way works awsome with no erras and super fast gaming

#

cuz of all the guys in here that teached me

#

like Dart and Gencoder8 and so may others i cant even remember all the names that helped me

#

i guess im getting up there in age im 64 now on Feb 17 woohoo

#

no work and Arma 3 all day woohoo hell yeah

#

lol

#

i ask my friend how are you and he said he is tired i said hi tired im retired lol he he

#

woohoo

visual epoch
#

If someone who isn't 12yo could respond, I'd be grateful.

pallid palm
#

lol he he

#

i take that as a compliment

hallow mortar
# visual epoch Is there a way to create custom units (like that `"O_Soldier_unarmed_F"`) and ha...

Unfortunately there isn't. New soldier classes are part of CfgVehicles, which doesn't work in description.ext (except for a very small part of it relating to sound sources). You can't create new classes without a mod.
The only thing you can do is use an existing class and immediately replace its loadout.

You do have the choice of using setUnitLoadout versus using individual addWeapon etc commands.

visual epoch
pallid palm
#

yes choice we like choice

hallow mortar
# visual epoch I see, thanks for the explanation!

Don't worry too much about the efficiency. Because this is the only way to do this, it's really common to see it done - if there were major problems with it you'd have heard about them. As long as you're not continually spawning huge numbers of units, the game will manage just fine, and even then you'd probably die of having a billion AI active rather than noticing the loadout script's overhead.

foggy stratus
jade abyss
#

[Params] remoteExec ["Functionname",Target];
[Params,Function,Target] call life fnc mp
iirc πŸ˜„ No big deal

pallid palm
#

hello Awsome Arma 3 friends: What would i put in a script, if i want every Land_MetalBarrel_F on the map, to expload if it gets destroyed

#

even if i spawn in the Land_MetalBarrel_F or if it exsist all ready

#

i can do it if i name all the barrels

#

but i can't seem to get it right for all barrels with out names

pallid palm
#

i know its just a simple like 6 or 7 line script but i can't seem to get it right

#

if someone can get me started with the top lines i can do the rest

proven charm
pallid palm
#

ahhh ok yeah thx m8 why didnt i think of that 😦

#

your the best m8 thx @proven charm

proven charm
#

assuming barrels can "Die"

pallid palm
#

yes they can yup

proven charm
#

Good

pallid palm
#

thx again brother

proven charm
#

yw

pallid palm
#

as a matter of fact i already have a EH for destroying Caches without names, So all i need to do is adapt it to Berrels woohoo

#

i just forgot lol

foggy stratus
# pallid palm as a matter of fact i already have a EH for destroying Caches without names, So ...

Here's a link to a sample mission with full featured exploding barrel scripts. Includes fire fx, burns a little before exploding, launches exploded barrel, sets near units on fire and they scream. See the video and link to download sample mission from dropbox. Scripts work well, but are ugly to read (I wrote them 10 years ago). You can use them as is, or take some code or fx from them as you please. My very first script I ever wrote was exploding barrels for OFP probably 20 years ago...holy shit I'm getting old. https://forums.bohemia.net/forums/topic/174218-jboy-burningexploding-barrel-script-released/

pallid palm
#

lol ok cool m8

foggy stratus
pallid palm
#

lol that video is awsome lol i also been playing as far back as OFP m8 woohoo

foggy stratus
#

That is the sample mission you can download. I just tried it and it still works. Start mission and start shooting barrels.

pallid palm
#

ok thx m8 will do

hushed flower
#

Anyone able to help with this script I am trying to make for corrosive rain?

#

``[] spawn {
while {true} do {
// Check if it's currently raining
if (rain > 0.2) then {
{
// Skip AI, OPFOR, and INDEPENDENT
if (!isPlayer _x || {side _x in [east, resistance]}) exitWith {};

            if (alive _x) then {
                private _isInside = [_x] call fnc_isSheltered; // NEW shelter detection method
                private _isProtected = [_x] call hasProtectiveGear;

                if (!_isInside && !_isProtected) then {
                    [player, 0.5, "body", "burn"] call ace_medical_fnc_addDamageToUnit; // Apply burn damage
                };
            };
        } forEach allPlayers;

        sleep 10; // Apply burn damage every 10 seconds
    };
    sleep 5; // Check rain status every 5 seconds
};

};
``

#

``[] spawn {
while {true} do {
// STORMY WEATHER (Transition over 60 seconds)
[1] call BIS_fnc_setOvercast; // High overcast for rain
60 setRain 1; // Max rain over 60 sec
60 setFog 0.4; // Thick fog over 60 sec
60 setLightnings 1; // Enable lightning
forceWeatherChange; // Ensure weather syncs in MP

    sleep 180; // Storm lasts 3 minutes

    // NORMAL WEATHER (Clear conditions + rainbow, transition over 60 sec)
    [0] call BIS_fnc_setOvercast; // Clear skies
    60 setRain 0;
    60 setFog 0;
    60 setLightnings 0;
    60 setRainbow 1; // Add rainbow
    forceWeatherChange; // Sync changes

    sleep 180; // Normal weather lasts 10 minutes before repeating
};

};``

#

It will not rain and if I set weather changes in eden it doesnt effect the player

pallid palm
#

holy cow my exploding barrel EH just blew me up big time lol hahahahaha

#

well thats what i was going for

fair lava
#

if im using ace and cba, where would be the correct place to put setWind [0, 0, true]; in a mod to have the server run that at the start of every mission?

#

one of the XEH files i assume? rooThink1

#

the function on the wiki states it needs to be executed server side, not sure when during mission loading it needs to be run to actually set the wind

tough abyss
#

When scripting a a texture onto an object what is the best dimensions for that picture being put on the object?

fair lava
proven charm
#

actually that's preInit / postInit

hallow mortar
#

If you're using ACE Weather then you might need to do something more complex - I've found that it tends to interfere with other attempts to set wind conditions

rapid vortex
#

Are there any functions which can tell me which player is in which slot in the lobby/role assignment?

broken pivot
#

Good evening people,
can someone explain me the output? What does it show to me?
Input:

_getLayerInfo;

Output:

I only see that there are 2 classnames of the objects in these Layers. But I dont know the rest...

hallow mortar
#

Each of these:

2a6a5806080# 487395: rail_concreteramp_f.p3d Land_Rail_ConcreteRamp_F

is one entity. It's a representation of a reference to an object that doesn't have a variable name set. It consists of some object ID, the model name, and the classname.

#

These two:

[],[<NULL-group>]

are the non-object things in the layer: markers (empty array because no markers) and groups (grpNull, presumably also no groups)

hallow mortar
daring cave
#

I'm trying to create an endless zombie spawner that has a max cap of how many can be spawned, I have a loop script setup below
while {alive player && (player inArea "endlessZone") && {alive _x && side _x == east} count inArea "endlessZone" <20 } do { *whatever script* }
I've confirmed everything about the script works except the {alive _x && side _x == east} count inArea "endlessZone" <20 I think its something to do with the brackets and parenthesis stuff but idk what order those go in or how they work, could someone rewrite this where the count inarea cap works?

#

Basically it should stop looping the script if the number of zombies breaches 20 (they're east/opfor)

granite sky
#

Your usage of inArea is invalid.

#

{alive _x} count (units east inAreaArray "endlessZone") < 20

#

Also works but slower:
{alive _x and _x inArea "endlessZone"} count units east < 20

daring cave
#

thank you I will try this

indigo wolf
#

If I remoteExec a function that has a createVehicle in it, it creates the vehicle for everyone that has been remoted executed to right? Like, if there were 5 people and I remoteExecuted it to everyone, does it create 5 vehicles or just 1 vehicle?

warm hedge
#

Correct. createVehicle is a global command (which means if one calls it, it will be sent over the network and everyone eventually sees it/creates it)

indigo wolf
#

So if I execute createVehicle in the server (remoteExec 2) can all players see and interact with it?

warm hedge
#

Or, just don't remoteExec it

modern osprey
#

I'm create my extension in c#. I can already accept calls via callExtension, etc., but I don't fully understand how I can save some information between calls to my extension?

proven charm
still forum
still forum
proven charm
#

then you can use the callback callback("extName", "fnName", "your data" );

#

maybe I misunderstood

still forum
proven charm
#

yeah i must have misread what he said. well there's some bonus info πŸ˜‰

flint topaz
#

Yeah I have a function for loading data cause of the limit per load back that splits the data into chunks then sends

#

But it uses the static variables in C# to do this

#

So you could use that idea for your use case.

still forum
#

Which limit?

#

callback has no limit, and input data for RVExtension also has no limit (well up to the maximum string limit)

flint topaz
#

From the DLL to ingame due to string limit

still forum
#

callback's limit is 9mb

modern osprey
flint topaz
#

I’m not using callback I’m using it just like a post request idea

proven charm
#

unless it crashes then its unloaded right?

modern osprey
still forum
#

Yeah but, you'd probably have a much easier time using callback, because then you don't need to deal with the limit and constantly polling

still forum
proven charm
#

i meant the DLL crashes

still forum
#

When the DLL crashes, the game crashes

flint topaz
#

^

flint topaz
proven charm
#

huh it hasnt ever happened to me that when there is bug in my DLL arma also crashes . i guess thats because the safe environment due to try-catch

flint topaz
#

It has for me

#

If I ever had a mistake in the DLL it hard crashed

proven charm
#

which language your using Jerry?

flint topaz
#

C#

proven charm
#

oh me too

still forum
#

I also had a C# extension crash the game recently, was missing a try catch

#

I think we could also give an option to increase the output buffer size for normal RVExtension. But probably not worth it, if you need it you might aswell pass data back using callback

flint topaz
#

And it’s only like 4 calls max the data isn’t massive

#

But I do like the callback idea

#

The fact you can tell it get me this whenever it’s done is nice for that essentially async benefit

proven charm
#

callbacks play well with MT

copper plinth
#
_veh = createVehicle [ASORVS_CurrentVehicle, ASORVS_VehicleSpawnPos, [], 0, "CAN_COLLIDE"];
    _veh setVehicleLock "UNLOCKED";
    _veh setDir ASORVS_VehicleSpawnDir; sleep 210; hint "Π’Π°ΡˆΠ° Ρ‚Π΅Ρ…Π½ΠΈΠΊΠ° Π±ΡƒΠ΄Π΅Ρ‚ ΡƒΠ΄Π°Π»Π΅Π½Π° Ρ‡Π΅Ρ€Π΅Π· 30 сСк."; sleep 30; deleteVehicle _veh;
    _veh disableTIEquipment true;
#

Hello, i get _veh disableTIEquipment true; doesn't work

#

I still have thermal on gunner

hallow mortar
#

You're only doing disableTIEquipment after the vehicle has been deleted

#
sleep 30;
deleteVehicle _veh;
_veh disableTIEquipment true;```
These things happen in the order they are written in
ocean folio
#

I assume its intentional but in case its not, that vehicle will only exist for 4 minutes no matter what happens.

copper plinth
#

Thanks!

minor timber
#

Hey boys do you think its possible to help with shadow distance changing ?

Problem is, when You zoom in as tank gunner, and your shadow distance is set to 200 (for fps safety), you will see very deformed objects in distance. When You zoom even more, objects at a greater distance are totally screwed. Only solution I've found is to change shadow view distance, that means, you will see perfectly modeled objects for set shadow distance, but when you get back on normal zoom, shadow distance is still for example 700, so fps drop will be significant.

Can I ask for very, very simple mod, which will change shadow distance for 2 zoom mods of rhs tanks ? Default zoom could have players default shadow distance setting, or just something around 300.

I would appreciate help greatly!

hushed turtle
#

You could use CH View Distance, which can increase object draw distance based on current zoom

#

But I don't anything about dynamic shadow draw distance

eternal spruce
#

How do I force/prevent an AI unit from falling unconscious?

minor timber
minor timber
primal trench
hushed turtle
#

Is it possible to disable music on death screen? It stops current music from playing, which I don't like when I can just switch to other alive unit using teamswitch and keep playing

finite jackal
#

bump, find any way for local AI? createAgentLocal /s

dusk gust
primal trench
#

How do I return the display of the scope you're looking down?

granite sky
#

display?

primal trench
#

in order to get the value of the 151 idc (range)

dusk gust
#

Like... the zeroing value on the Hud?

dusk gust
hallow mortar
dusk gust
#

Ah that makes a bit more sense

dusk gust
# primal trench How do I return the display of the scope you're looking down?

The display IDD is 300, with the classname as "RscUnitInfo" using _x getVariable ["BIS_fnc_initDisplay_configClass", ""];
The issue stems from the display being used in multiple locations for other HUD elements.
The control IDC for range is 198.

The below code will grab the display you want in vanilla for the nightstalker, however your mileage may vary due to mods, or things I may not have taken into account

(uiNamespace getVariable ["IGUI_displays", []]) select {
  _class = _x getVariable ["BIS_fnc_initDisplay_configClass", ""];
  _class isEqualTo "RscUnitInfo" && !(isNull (_x displayCtrl 198))
};
primal trench
magic dust
#

I was trying to public a script handle, have tried

_vehicle setVariable ["bot_vehicle_scriptHandle", _scriptHandle, true];

and

publicVariable "bot_scriptHandle"

but got same warning in RPT file like:
11:02:46 Performance warning: SimpleSerialization::Write 'bot_vehicle_scriptHandle' is using type of 'SCRIPT' which is not optimized by simple serialization, falling back to generic serialization, use generic type or ask for optimizations for these types

so, I assume that a script handle could not and should not be publiced, is that right?

granite sky
#

Script handles wouldn't have any non-local meaning. What are you trying to do with them?

magic dust
#

terminate a script via remoteExec :/

granite sky
#

Store the script handle locally to the script (on the vehicle probably), call a function to do the terminate.

magic dust
#

Yeah its definitely a simpler way, thanks.

and now I realized how stupid I am trying to public a script handleπŸ’€

eternal spruce
dusk gust
eternal spruce
#

Ok, so if I set the unconscious state of a unit to true, is it a one and done thing or do i need to loop it, i'm trying to work around an issue I have but it might be a conflicting mod

dusk gust
#

if you use setUnconscious, it should keep the unit incapacitated until woken via script iirc

eternal spruce
#

Ok thank you I’ll try this but it will also work in the opposite way correct. Meaning I want to keep it from going unconscious

dusk gust
#

You can't prevent someone from using setUnconscious unless you completely disable the command

flint topaz
eternal spruce
#

It has to be, everything was fine before so I got to uncheck what mod is causing the issue

dire island
#

Does anyone on here have any experience with scripting TFAR channel/frequency data? I've been trying to assign channels for all players in a mission by using, for example,

[(call TFAR_fnc_activeLrRadio), 1, "50.0"]  call TFAR_fnc_SetChannelFrequency;```
run from initPlayerLocal. It works fine in testing with <10 players, but when I tried using it on an op with 30+ players, the players seemed to get split into 2-3 different subnets (player A and player B, despite both being on 50, couldn't hear each other).
The issue is not:
* Radio assignment. When we've played with the exact same radio equipment, but assigned channels manually (without scripting), it works fine.
* TeamSpeak or player settings. When we've played with the same people on the same TS3 server, it works fine.
The issue could be:
* Scripting stereo settings (but doubtful, since stereo settings shouldn't make you unable to hear certain players) (I used stuff like ``[(call TFAR_fnc_activeSwRadio), 2] call TFAR_fnc_setSwStereo;``)
* ``TFAR_fnc_setChannelFrequency`` somehow also randomly changing the passed radio's encryption scheme (but then again, why would someone build that functionality?)

I am asking on here instead of doing additional testing because the only way to reproduce the problem would be to take a not insignificant amount of time from our regularly scheduled games, so I thought I'd check if anyone has any experience with this first.
still forum
plucky lava
#

hey, can I get a small help with object hide scripts, I am not sure why but even if I am trying to hide a vehicle, the unit inside stays on. any way I can deal with this??

warm hedge
#

What do you mean by on?

plucky lava
#

they dont get hid

#

youd see floating units

winter rose
#

you can hide crew too

plucky lava
#

I tried which is weird for me lmao

warm hedge
#

Your try is weird? That's weird

#

Actually, if you hide a vehicle, the crew are also

#

What exactly you try then

plucky lava
#

i tried to hide the vehicle, unit stays visible

#

i did for the unit

#

similar

warm hedge
#

I am asking what code you run

plucky lava
#

i havent done any code since i tried to hide them manually

#

tried the module

warm hedge
#

What module then

plucky lava
#

show/hide

warm hedge
#

It hides the crew too for me

plucky lava
#

arma being arma?

warm hedge
#

Your something being your something

plucky lava
#

true

warm hedge
#

Now, a serious question, how do you make your synchronization

#

Post your Eden Editor's setup screenshot

plucky lava
#

sorry what?

warm hedge
#

What is unclear

#

This is how I did, and it works

eternal spruce
plucky lava
#

@warm hedge here

warm hedge
#

Try vanilla unit/vehicle then

plucky lava
warm hedge
#

What about vanilla game

plucky lava
#

Probably mod side

warm hedge
#

I am saying try it

plucky lava
#

On it

#

Vanilla works fine

warm hedge
#

Then you may have a wrongly made Mod

lean raven
stable dune
dire island
# still forum > initPlayerLocal That sounds too early. By that time the handheld radios are no...

I am doing it in this roundabout way because I want to set people to different default channels and alternate channels based on roles (so the JTAC always has air net as alternate, squad leaders always have platoon net, everyone starts on their own squad channel, etc).
The script waits ten seconds before changing any channel settings, and the channels do get switched so it isn't initiating before the radios are ready, it's just that when the script does run, some people can't hear each other.

still forum
#

Well you could turn off radio encryption, to see if that changes it. But I don't see how this could mess that up

idle remnant
#

Reading some code where they are spawning #particlesources with createVehicle instead of createVehicleLocal, does that actually have any effect or does it still spawn only locally?

charred monolith
#

Hi ! Is there a way to use the Arsenal Camera Movement without the menu of the arsenal to be used in another script ?

sullen trellis
#

anyone knows how i can make a bomb/missile to belong to the player or any unit i choose? so that whenever
that missile explodes and kills any enemy unit, it would count as the player (or a chosen unit) did the kill
i tried the following script while placing an opfor unit next to the missile for testing, you can see i tried setOwner but doesn't work

private _missile1 = "USAF_GBU28" createVehicle getPos h1;
_missile1 setOwner (owner player);
_missile1 setDamage 1;

dusk gust
little raptor
modern osprey
#

how can I catch it loading into memory in extension (c#)?

#

And when is the extension loaded on the first call or when starting arma 3?

tender fossil
sullen trellis
royal quartz
#

Hi guys does anyone know where arma 3s Vehicle in Vehicle functions are in the files? I want to know how this function works to make my own version with the same cargo space limitations etc. I just need better control over it. I know about the config setup I just want to see what the function does internally.

https://community.bistudio.com/wiki/setVehicleCargo

tulip ridge
#

Which is why you use a command to use it, not a function

royal quartz
#

dam shame, okay. Well I can easily guess what it does but rewriting it is more of a nightmare than just seeing how it does it. okay thanks ill get to work

wind pawn
#

What's the script for deleting a group of units via a trigger?

#

DeleteVehicle didn't seem to work

#

Also if another trigger affects that squad & the squad is deleted before the other trigger is triggered, will that cause errors?

granite sky
#

deleteVehicle works but you run it on each unit, not the group.

wind pawn
#

Ah ok, thanks

errant iron
#

Does someone happen to know if ACE has an equivalent scripted event handler for their arsenal? I'm adding compatibility for it and need to ensure that I can restore the player's last loadout/reuse it for the player's recruits.

Ah figured it out, ["ace_arsenal_displayClosed", {}] call CBA_fnc_addEventHandler;

little raptor
split oxide
#

Am I correct in my understanding there's no way to read current compass declination / deviation set using setCompassDeclination or setCompassOscillation, respectively?

little raptor
#

Yes

frozen birch
#

hello everyone I need help with setShotParents , where is the wrong ? private _pos = getPos _drone;
private _owner = owner player;

private _grenade = createVehicle ["GrenadeHand",  _pos, [], 0, "CAN_COLLIDE"];
_grenade setOwner _owner;

[_grenade, _owner ] remoteExec ["setShotParents", 2];
triggerAmmo _grenade;
dusk gust
split oxide
#

Is there a way to reference the UI compass model arrow angle?

south swan
#

owner player doesn't seem to make much sense in general

split oxide
# split oxide Is there a way to reference the UI compass model arrow angle?

Alright, you can get the map compass control, but because it's a model.cfg animation source it doesn't appear there's a way to access the rotation of the map compass. The same would be true for UI compass if Iknew how to find it (I don't think it's a control/display since it's odd? or at least I couldn't find the relevant display)

little raptor
split oxide
#

I would also love to know the animated direction of the compass tbf

little raptor
#

Did you manage to find the model control?

split oxide
#

Yeah

little raptor
split oxide
#

Does that work when there aren't config animation sources?

#

I'll find out

little raptor
#

Well it should. It works with models not objects (models don't have configs)
Just make a simple object using the model path, then use animationNames to get all anims

dark pecan
#

Hello guys, i'm having some troubles with spawning a specific unit in a invisible helipad. The problem is, i used this code for spawning a vehicle:

this addAction ["Spawn Warhound->MP->Mega Bolter on Pad 12", {_pad12 = getPosASL Spawn_Pad12;_dir = getDir Spawn_Pad12;_veh = createVehicle ["TIOW_Warhound_MP_VMB_BLU",[0,0,0],[],0,"NONE"];_veh setPosASL _pad12;_veh setDir _dir;},nil,7.5,true,true,"","true",5,false,"",""];

But how can i spawn a blufor unit the same way i spawn a vehicle?

little raptor
#

Using the createUnit command

#

First create a group using createGroup west, then use createUnit to create a unit into the group

dark pecan
dark pecan
# little raptor Using the createUnit command

I typed this but it's giving me an error, where should i type the create group, before the addaction?
this addAction ["Rifleman", {_pad12 = getPosASL Spawn_Pad12;_group = createGroup west;_dir = getDir Spawn_Pad12;_veh = createUnit["B_Soldier_F",[0,0,0],[],0,"NONE"];_veh setPosASL _pad12;_veh setDir _dir;},nil,7.5,true,true,"","true",5,false,"",""];

granite sky
#

It depends, but you need to be passing the group into createUnit anyway, like _group createUnit [other shit]

eternal spruce
dark pecan
#

It is giving me this error:

granite sky
#

No, like I wrote :/

hallow mortar
dark pecan
#

Ok, it worked. thank you.

This is the code:
this addAction ["Rifleman", {_pad12 = getPosASL Spawn_Pad12;_group = createGroup west;_dir = getDir Spawn_Pad12;_veh = _group createUnit["B_Soldier_F",[0,0,0],[],0,"NONE"];_veh setPosASL _pad12;_veh setDir _dir;},nil,7.5,true,true,"","true",5,false,"",""];

royal quartz
#

Hi guys, does anyone have any idea how I can get a more realistic dimensions of an object in game? Im currently using boundingBoxReal and that returns the same as zues when highlighting an object. Which as you can see for some vehicles is well... not accurate...

however arma 3s Vehicle in Vehicle system somehow knows the true dimensions of the vehicles because when loading this tank in a C17 it attaches at the right point to look like its parked in the back.

granite sky
#

boundingBoxReal [_obj,'geometry']; gives you a pretty close fit apparently.

#

Of course we have no way of knowing what VIV uses :P

royal quartz
#

ill test that now thanks. Also another one... Im using this code to try and find the landContact point for vehicles. And well it returns [0,0,0] which means it dident find one and I doing something wrong? Ive checked the names array and get this for a humvee. Which is its land contact names lol

["wheel_2_2_damper_land","wheel_2_1_damper_land","wheel_1_2_damper_land","wheel_1_1_damper_land"]

names = (cursorObject selectionNames "LandContact");

cursorObject selectionPosition [names #0, "LandContact", "FirstPoint"];
little ether
#

Maybe a strange question, but how would people here go about getting the dice game from KCD2 into arma 3? Traditionally it's called Farkle or 10,000.

My concept atm is to just have an ACE self interaction be able to roll a varying amount of D6 up to 5, and have players manage their scores on their own. - This idea is easy (I think) but not the whole picture of the game.

I WANT the custom dice from KCD2. This means weighted dice, dice with weird sides, dice that always roll 3 etc that players can collect and build a "strategy" with and THIS is the hard bit in my mind.

My only idea for this atm is an item for each dice type that gives its own action to the ACE self interaction pool. Dice always rolls 3's? Its FNC (or whatever I have to make/call) determins what it rolls and players just have to remember that if they're scored you don't roll them

Additional features that would be amazing but I don't think will be worth the effort atm;

  • Automatic scoring
  • Removing of scored dice until the next round
  • Some sort of UI, even just numbers on the screen

How would you go about implementing this game yourself? (not looking for people to do it for me obviously ❀️ just thoughts and ideas)

ivory lake
#

look at the example by lou at the bottom

little ether
#

Yeah 100% what I'll be doing if I go that route, easy enough to make the custom dice and values as I've already got loot tables going using randomweighted

It's more the scoring, rolling of individual dice, rolling of groups of dice etc

Good to know I'm looking at the right things though

tidal ferry
#

Quick sanity check

Is code within IF/THEN statements scheduled, unscheduled, or dependent on scope?

#

Specifically, statement code rather than condition code

granite sky
#

That's not quick :P

tidal ferry
#

It'd be quicker with an answer to my question 🀣

#

Anyways, figured it out on my own

So the madness continues

granite sky
#

Oh? What's the answer?

tidal ferry
#

Answer is I still have no clue, the problem I was trying to solve fixed itself

#

I assume it's dependent though

granite sky
#

Natural answer is dependent, but it's also possible that the scheduler can't break within a code section executed by an if.

#

I guess you can write some pretty epic code within an if so it'd have to be capable of breaking.

royal quartz
royal quartz
granite sky
#

Looks like a bug to me, but you'd do better to ask someone who works with models.

royal quartz
hushed turtle
#

Is it possible to select random element from HashMap?

warm hedge
#

toArray and selectRandom

faint burrow
#
_randomValue = _hashMap get (selectRandom (keys _hashMap));
warm hedge
#

Wiser solution

tulip ridge
fervent delta
#

Hello there, is it possible to increase health/armor of a Rhino MGS so it can survive more hits ?

warm hedge
#

HandleDamage Event Handle can make some trick

fervent delta
#

Will it work in pub zeus for example as well ?

warm hedge
#

If it allows you to use scripts, yes

fervent delta
#

Alright thanks a lot

royal quartz
#

Strange that I couldn't access the land contact points using there named selections maybe a bug but this will do nicely. I'll try it later

royal quartz
winter rose
delicate swan
#

_unit addHeadgear "H_HelmetO_ViperSP_ghex_F ";

#

Something stupidly simple yet not working

#

Forums are down sooo, what do I do?

#

I want the helmet to be added to my unit spawned via script

hallow mortar
#

Do you add an NVG slot item immediately afterwards? The Viper helmets have built-in NVGs and adding an actual NVG item at the same time might conflict

delicate swan
hallow mortar
#

That wasn't the question

delicate swan
#

No I do not add any other items

#

It's only the helmet

hallow mortar
#

Is the unit a vanilla type, or does it come from a mod? Some modded units (e.g. from 3CB Factions) have initialisation scripts for gear randomisation, which can overwrite your changes if the timing is right

winter rose
hallow mortar
#

Or that

delicate swan
#

Oh wait

#

hold on

winter rose
#

yes that
"H_HelmetO_ViperSP_ghex_F ";
↓
"H_HelmetO_ViperSP_ghex_F";

delicate swan
#

lmao

#

Ye ye

#

Well I guess problem solved

winter rose
#

only if you confirm it werkz!

delicate swan
#

Yes can confirm

#

Lmao

#

What a stupid error

#

Making orbital cannons, SCPs

winter rose
#

happens to the best of us, one more example 😎

delicate swan
#

yet a space killed me

winter rose
#

Space Wars

errant iron
#

I'm updating a task's description every ten seconds, and initially I was going to cache the description to avoid calling BIS_fnc_setTask* too often, but after looking at its source code, it seems that it's smart enough to not broadcast unchanged variables, but it will always JIP remoteExecCall at the end: ```sqf
if (_global) then
{
[_id, _notification] remoteExecCall ["BIS_fnc_setTaskLocal", 0, toLower _id];
}
else ...

-# \* I'd use BIS_fnc_taskSetDescription, but their param call only allows bare strings, and rejects the arrays I need for my stringtable keys :(
granite sky
#

Does remoteExec(Call) happen to avoid network traffic if its parameters are always the same?
No, although if you're using the same JIP ID then it'll replace the entry in the JIP queue.

proven charm
#

you can always check if something has changed and then use remoteExec

sacred turtle
#

Hey guys, Im trying to get spectator to work when players die. Essentially players will have a 3 minute respawn time, during which I want them to be able to spectate their team mates.

These are the settings Im currently using,

Description.ext
respawn = 3;
respawnDelay = 60;

onPlayerKilled.sqf
["Initialize", [player, [], true]] call BIS_fnc_EGSpectator;

onPlayerRespawn.sqf
["Terminate"] call BIS_fnc_EGSpectator;

The only issue im experiencing, Is as soon as the players die, they are able to spectate for roughly 2-3 seconds and then are forced back to the map screen where they can select their respawn point.
If ayone can think of a work around or have any advice please @ me

stable dune
sacred turtle
#

Rgr, I wasnt aware of which place would be best. I normally just get shouted at telling me its not the right channel

stable dune
#

Yes. You will , but more you will get if you crosspost every channel

sacred turtle
#

Rgr

thin fox