#arma3_scripting

1 messages · Page 118 of 1

opal zephyr
#

Ah ok, I dont think that will work since I need hundreds of displays, or do you mean a display class to be used instead of rscDisplayEmpty?

meager granite
#

Its just one display for everything, of course

#
class MyDisplay {
    idd = -1;
    onLoad = "_this select 0 call myUI2TextureLoad";
};
opal zephyr
#

I dont think that can work for my use case. I need to be able to change one rendered display while leaving the others

meager granite
#

Game creates new display for each new texture

#

To make each texture different through that display, you just pass your needed arguments to it

opal zephyr
#

ok so this IS just to replace RscDisplayEmpty then

meager granite
#

Yes, you can't do onLoad in RscDisplayEmpty which is needed for precise display initialization

opal zephyr
#

okok

#

When would I actually apply the texture with setObjectTexture then?

meager granite
#

There is another problem of your textures displayed inside ui2tex display being loaded or not though. Personally I solve this by first reloading needed textures before starting the display.

meager granite
opal zephyr
#

I've been told that the display initializes only once though when the setObjectTexture is called, and then after that if you try and call it again its just black

#

Wouldnt this be an issue?

meager granite
#

Display is initialized when you see the procedural texture and then stays live.

opal zephyr
#

Hm, I have not had that be true in my testing... If I use it on something far away and then walk up to it, its black since it wasnt being rendered when I called the setObjectTexture

#

Ive gotten around it by creating a small object in my view, and setting its texture to the display, that way its cached and can be applied to things far away

meager granite
#

I suspect your scripts gave up before the display got initialized, thus you had 100% empty display which looks black because faces it was displayed on have no transparency.

opal zephyr
#

I was using a waituntil, so in theory it should have waited until the display was no longer null

opal zephyr
meager granite
#

I think dedmen tried to solve this by forcing the display to reload or something, but its still an issue on recent stable

opal zephyr
#

Ah ok

meager granite
#

How I solve this:

  1. Display needed textures on UI somewhere hidden
  2. Then do setObjectTexture with ui2texture that uses these textures
opal zephyr
meager granite
opal zephyr
opal zephyr
#

I will give all this a try tomorrow, thankyou for all the suggestions and help!

meager granite
#

👌

meager granite
#

The more I work with the damage, the more I suffer

#

This is a result of an empty car hitting fully healed player (car setVelocityModelSpace [0,-10,0])

#

Overall damage is 0.109323, the only parts exceeding 1 are hitabdomen, hitdiaphragm, hitchest but these don't kill you if you set them to 1 with setHitPointDamage

#

What's going on? Where other damage comes from?

meager granite
granite sky
#

That's how it works, yes :P

meager granite
#

HitBody has depends = "HitPelvis max HitAbdomen max HitDiaphragm max HitChest"; so it gets 1 after engine-driven damage to these parts, but not from script-driven damage

granite sky
#

Yup.

meager granite
#

and HitBody >= 1 does kill you

granite sky
#

I'm not sure if I checked whether that's also true for the HitHead.

meager granite
#

BUT it processes in HandleDamage:

["B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","head",0.552148,"B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","",2,"<NULL-object> ()","hithead",false]
```unlike `HitBody` ![thonk](https://cdn.discordapp.com/emojis/1098612853579206656.webp?size=128 "thonk")
#

Oh, because HitHead has armor = 1;, while HitBody has armor = 1000;

#

Really weird choice

#

Also no bleeding in such case of damage, only that weird HitHead fire before overall damage. Complete mess.

pulsar bluff
meager granite
formal nymph
#

for [{_i = 1}, {_i <= 5}, {_i = _i + 1}] do {
    _selectedLoot = selectRandom _lootPool;
    _triggerPos = getPos (format ["damLoot%1", _i]);
    
    // Create a loot holder at the trigger position
    _lootHolder = "WeaponHolderSimulated" createVehicle _triggerPos;
    
    // Add the selected loot to the loot holder
    _lootHolder addItemCargoGlobal [_selectedLoot, 1];
    
    // Set the position of the loot holder
    _lootHolder setPosATL _triggerPos;
    
};```

I'm trying to get a single item from this pool to spawn for each "damLoot" trigger i have placed, but executing this code spits out an error, giving this line the fault for the error:

```_triggerPos = getPos (format ["damLoot%1", _i]);```

doing ```_triggerPos = getPos damLoot1;``` works as it should with the trigger.

I have no idea if I'm using "format" correctly or not.
meager granite
#

Let me guess, ChatGPT?

formal nymph
#

lol yes, its actually helped me a few times

meager granite
#

Why triggers for loot positions?

#

ChatGPT sucks at SQF and Arma in general, it doesn't have enough data to train on, so it can only produce the most basic code, anything higher than that and it spits out nonsense.

#

I don't believe it can help you learn and it certainly won't produce working code for anything more advanced than most basic things

#

Anyway, you need to do:

_triggerPos = getPos (missionNamespace getVariable format ["damLoot%1", _i]);
#

Also change getPos to getPosATL

hallow mortar
#

format returns a String ("plain text"), which isn't a variable name.
As Sa-Matra shows, it is possible to procedurally generate variable names using format, but you need the intermediate step of getVariable to parse the generated string into an actual reference to the variable. The string on its own is just text.

pulsar bluff
meager granite
#

Its a sunk-cost fallacy at this point

pulsar bluff
#

hahaha

#

create a sunk cost objective for players as a satire allegory of the dev process of said objective

dreamy kestrel
#

Q: I need to determine if two road objects are connected, that is, are traversable, between them. they can be separated by any distance, although usually anywhere from 500-1000m or so. it can vary. was looking at calculatePath, but I'm not sure that quite does it. the result needs to be somewhat instantaneous, i.e. "can the two roads be navigated pts A-B". any thoughts? thanks...

pulsar bluff
#

you need to write a dijkstra procedure for road connections (the road node + its neighbours), itll also give you the shortest path

#

it is reasonably instantaneous

#

use the “roadsConnectedTo” command to get the node neighbours

still forum
meager granite
#

Cool observation about engine-driven vehicle explosion damage:

17:30:31 ---------------------------------------------------------
17:30:31 "Frame 1157837: Killed Both: B_MBT_01_cannon_F"
17:30:31 ["1a74d24e040# 1825868: mbt_01_cannon_f.p3d (B_MBT_01_cannon_F)","B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","<NULL-object> ()",true]
17:30:31 =========================================================
17:30:31 "Frame 1157838: HandleDamageMan: B_Soldier_F (ALIVE=true)"
17:30:31 ["B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","",4.00959,"B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","FuelExplosionBig",-1,"<NULL-object> ()","",false]
17:30:31 =========================================================
17:30:31 "Frame 1157838: HandleDamageVehicle: B_T_APC_Tracked_01_rcws_F (ALIVE=true)"
17:30:31 ["1a5cacb0080# 1818587: apc_tracked_01_rcws_f.p3d (B_T_APC_Tracked_01_rcws_F)","",0,"B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","FuelExplosionBig",-1,"<NULL-object> ()","",false]
17:30:31 =========================================================
17:30:31 "Frame 1157838: HandleDamageVehicle: B_MBT_01_cannon_F (ALIVE=false)"
17:30:31 ["1a74d24e040# 1825868: mbt_01_cannon_f.p3d (B_MBT_01_cannon_F)","",1.47041,"B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","FuelExplosionBig",-1,"<NULL-object> ()","",true]
winter rose
#

you cannot appreciate the beauty of little things

#

😄

meager granite
#

Tank blew up, _directHit is true for self damage from that explosion, false for damage to other entities

#

Still wishing for a better damage source info somehow

meager granite
#

So don't quote me on your fixes for texture loading not working, I still use old hacky approach

meager granite
#

Mostly working attributing damage towards EPE collisions aviator

#

Impossible to say who collided with whom of course

warm hedge
#

Why you put a comma after a line break notlikemeow

meager granite
#

Seriously though, its just easier to add new lines to arrays this way, I forget about trailing commas all the time, this solves it for me

warm hedge
#

So uh yeah, if you crash into a vehicle it will share the damage with?

meager granite
#
_array = [
    "Some data",
    "Some data but longer so its harder to see if you have a comma or not"
];
```and if you add a new line
```sqf
_array = [
    "Some data",
    "Some data but longer so its harder to see if you have a comma or not"
    "Some new line"
];
```its much harder to spot missing comma than if you had it like
```sqf
_array = [
     "Some data"
    ,"Some data but longer so its harder to see if you have a comma or not"
    "Some new line"
];
```you instantly see that there is no comma for the new line
warm hedge
#

Maybe 🤔

meager granite
#

PHP spoiled me by letting me have trailing commas without next item in array

meager granite
#

I base it off what engine provides in HandleDamage and if there is EPEContactStart on the same frame, I change no-source damage (_ammo="" , _source=null) to whatever was in EPEContactStart arguments

#

You also get buildings in EPEContactStart so I end up with damage reports with buildings as _source (_from_vehicle in my naming)

#

If only all this was provided by the engine right away, would've been much easier

#

Another difficulty would be figuring out how to attribute this damage to crew, its easy for local crew but remote crew doesn't trigger anything, just gets some damage number and that's it.

#

Anyway, enough boasting about the progress, time for more suffering

pulsar bluff
meager granite
pulsar bluff
#

analysis

meager granite
#

Manual after the fact?

pulsar bluff
#

if you had the last 3 second of player movement from both parties

#

you could reasonably calculate fault, even automated

meager granite
#

Just realized what I said, it IS possible to know who collided with whom, EPEContactStart reports two objects, meant to say who's at fault

#

As in who rammed whom

pulsar bluff
#

is this often troll vs stationary player?

#

if so then youre just checking the vel

meager granite
#

Often, but not always, you can slowly get in a way of fast moving player for example

pulsar bluff
#

i use things like proximity to road for fault

#

IE if player gets rammed while standing on a road, their report is given low weighting. if they are rammed while on hillside, then report given higher value

#

same with aircraft and helipad/runway. if you report a pilot for damaging you (on foot) while hes near a helipad, then your report is very low weight

#

ramming vehicle on vehicle is trickier obv

meager granite
#

Hmm, good ideas, perhaps you can decide who's likely at fault with some meta data

pulsar bluff
#

and weighting based on likelihood

#

also need to handle report griefers, the kind who step in front of your car

#

but for vehicle ramming id just capture the vehicle movement and blame the one at higher speed where they are facing the target

#

after enough reports i just “soft lock” players. can still play but no vehicle turret/driver access, bullets deleted if there is a friendly in center area of screen, tiny movement penalty

#

keep them on the server to pad the server stats but limit their enjoyment

#

also speed limited zones for vehicle ramming “black spots” like heli pickup points. i want to use cruise control for it but velocity dampening just works

meager granite
#

🤔

dreamy kestrel
dreamy kestrel
obtuse crypt
#

Hello, is it possible somehow extract informations about mods from mission file, but to get exact name of mod, not of addon, or steam id of mod?

hallow mortar
#

That returns all the mods that are loaded, not only those used by the mission

little raptor
#
_cfg = loadConfig "mission.sqm";
_missionaddons = getArray(_cfg >> "addons");
_mods = getLoadedModsInfo;
_alladdons = allAddonsInfo;
_missionMods = [];
{
  _addon = toLowerANSI _x;
  _addonIdx = _alladdons findIf {_x#0 find _addon >= 0};
  if (_addonIdx >= 0) then {
    _modIdx = _alladdons#_addonIdx#3;
    if (_modIdx >= 0) then {
      _modName = getLoadedModsInfo#_modIdx;
      _missionMods pushBackUnique _modName;
    };
  };
} forEach _missionaddons;
#

actually allAddonsInfo returns the addon prefixes meowsweats

#

so you should load the cfgPatches name manually...

#

I guess using configSourceMod makes more sense here:

_cfg = loadConfig "mission.sqm";
_mods = getArray(_cfg >> "addons") apply { configSourceMod (configFile >> "cfgPatches" >> _x) };
_mods arrayIntersect _mods;
obtuse crypt
#

["","@CUP Terrains - Core","expansion","@Šumava","@Unconventional Actors","enoch","@3CB Factions","@ace","@CUP Vehicles","@RHSUSAF","orange","@CUP Units","curator","@RHSGREF","@Task Force Arrowhead Radio (BETA!!!)","@CUP Weapons","mark","@Arma Srbija-Dodatni Modovi","@RHSSAF","@CUP ACE3 Compatibility Addon - Weapons"]

#

First one is empty

little raptor
#

so you can just remove it (_mods arrayIntersect _mods) - [""];

dreamy kestrel
#

plausible road connectivity algo. iterative in nature. thoughts?
assumes player is nearby a road object to start with.
yanks at the connected roads threads until there is nothing further to pull.
ideally might like to 'simplify' as a recursive algo, though.
seems to work, and is reasonably quick about it.

_x = player;
_local = 25;
_i = -1;
_maxdist = 1000;
_mindist = 500;
_x nearroads _local params [['_root',objnull]];
_threads = [[_root]];
_thread_counts = [0];
// iterate while there are still growing threads
while { (_threads apply { count _x }) isnotequalto _thread_counts } do {
  _y = _root;
  _thread_counts = _threads apply { count _x }; 
  _threads_to_pull = +_threads;
  _threads = [];
  {
    _thread = _x;
    _term = _thread param [0, objnull];
    _roads = roadsconnectedto _term select {
      !(_x in _thread) // putting the dijkstra in, preventing circular results, CRITICAL
        && { _x distance _root <= _maxdist }
    };
    systemchat format ['_i = %1, _thread = %2, _roads = %3, _thread_counts = %4', _i, count _thread, count _roads, str _thread_counts];
    _i = _i + 1;
    // grow the number of threads, or preserve the current one
    { _threads pushbackunique ([_x] + _thread) } foreach _roads;
    if (_roads isequalto []) then {
      _threads pushbackunique _thread;
    };
  } foreach _threads_to_pull;
};
// drop threads not meeting min dist criteria
_threads = _threads select {
  _term = _x param [0, objnull];
  _term distance _root >= _mindist
};
[_root, count _threads, _threads];
obtuse crypt
little raptor
#

ideally might like to 'simplify' as a recursive algo, though.
in SQF the recursive one might get too slow

dreamy kestrel
#

my results are, [1788043: ,48, [...], [...]] which seems like a healthy result so far.

little raptor
#

well I mean the count of your "old" connections are the same as "new" ones

dreamy kestrel
#

yes, which is the point. the connections are only growing when there is a new connected road off the terminal one.

little raptor
#

do you remove stuff then readd them to the list? (then iterate over them all over again?...)

dreamy kestrel
#

in this case, yes. re-start with a fresh list. either preserve the current, or add the mutated set from the new connections. i.e.

{ _threads pushbackunique ([_x] + _thread) } foreach _roads;
if (_roads isequalto []) then {
  _threads pushbackunique _thread;
};
tender sable
# dreamy kestrel plausible road connectivity algo. iterative in nature. thoughts? assumes player ...

Your going to find some issues. I have an astar road pathfinding system I am working on. In my esperience, I encountered not all maps are thoroughly connected esp around bridges and intersections. You'll come to a dead stop when you don't expect it. I wrote a system that actually fixes that by examining the while map and making my own nodes. Supports right and left hand drive. Adds 10 secs to load time but can pathfind across any map in a few seconds by batching the algorithm several nodes per frame.

dreamy kestrel
#

also with the caveat that in ARMA, we are not guaranteed road connections are bidirectional. i.e. because B is connected to A, does not necessarily mean vice versa i.e. A-B is the case

tender sable
#

I'm working right now but I can post a vid later and the source code

grizzled cliff
#

i just changed an sqf variable from "DOGDOG" to "CAT". I am so excited.

dreamy kestrel
dreamy kestrel
grizzled cliff
#

Did I mention I did this in C++? ;)

tender sable
dreamy kestrel
little raptor
#

as I said recursive one will get slow in SQF

dreamy kestrel
little raptor
#

using a loop is better

dreamy kestrel
#

true true might not be the best way to approach this particular algo.

grizzled cliff
#

i've got strings and numbers down, need to tackle arrays

tender sable
grizzled cliff
#

and objects are easypeasy

tender sable
dreamy kestrel
tender sable
#

yes, I have a RoadGraph object that has RoadNode objects

#

which uses an AstarSearch object and JobScheduling object... it's fully OOP

#

I havent announced anything about it because of bug fixes with createhashmapobject still in dev

#

It also needs some work and refinement but you can use that code to see what I do

dreamy kestrel
tranquil jacinth
#

Is there any way to track if the current waypoint of a drone is 'LAND'?

tender sable
#

no - no circular refs

dreamy kestrel
tender sable
dreamy kestrel
#

have not explored createHashMapObject much yet since it was deployed. but it sounds interesting.

tender sable
#

Actually technically wouldnt need to be client side if you do it right

dreamy kestrel
tender sable
dreamy kestrel
#

yep.
I have some modules I am considering a similar deployment pattern.
one LINQ style analog, functions like where, sum, zip, selectMany, aggregate. I even fixed couple of buts with BIS_fnc_sortBy, my LINQ_fnc_orderBy. to name a few.

tender sable
#

I would be interested in seeing that when you complete it.

dreamy kestrel
#

LINQ_fnc_orderBy I am encouraged by... besides supporting the baseline sortBy intent, has the added nice benefit of emulating a LINQ style [orderBy, thenBy [, thenBy ...]], if you understand how that pattern works.

#

something which is rather broken if you ever tried that in sortBy.

tender sable
dreamy kestrel
#

or as the dotnet community likes to brand recently, idiomatic.

#

sum for instance, surprised there is not a Math or Statistics primitive for this, or even BIS function, right. so that seemed like an obvious winner to me. or more generally aggregate, has some interesting use cases as well.

tender sable
#

I am interested in the LINQ stuff though.

dreamy kestrel
#

but I like also incorporating SQF patterns like magic variables. making an effort for that to be consistent with the BIS functions, primitive operators in general, i.e. your _x, sometimes also _y, or in the case of orderBy, consistency with the sortBy function.

dreamy kestrel
dreamy kestrel
tender sable
dreamy kestrel
dreamy kestrel
tender sable
hallow mortar
queen cargo
#

OK, apparently it just is the "hidden" link part

#

@dreamy kestrel just some @ because also relevant

dusk tulip
#

I have been working on the script for a long time (its been my pet project to learn scripting in arma) but I am stuck the issue of how to delete the lights if a "generator" is turned off. right now there is no way to remove them including the toggle lights zues module as well as deleting the assest its used in

``
_light = "#lightreflector" createVehicleLocal ASLToAGL getPosASL this;
_light setLightIntensity 300;
_light setLightAmbient [1,1,.6];
_light setLightColor [1,1,.6];
_light setLightConePars [300, 0, 1];
_light setVectorDirAndUp [[0,0,-1], [0, 1, 0]];

_light setLightDayLight true;

_light setLightUseFlare true;
_light setLightFlareSize .5;
_light setLightFlareMaxDistance 30;

_flare = "#lightreflector" createVehicleLocal ASLToAGL getPosASL this;

_flare setLightIR true;

_flare setLightIntensity 1000;
_flare setLightAmbient [1,1,.6];
_flare setLightColor [1,1,.6];
_flare setLightConePars [300, 0, 1];
_flare setVectorDirAndUp [[0,0,-1], [0, 1, 0]];

_flare setLightUseFlare true;
_flare setLightFlareSize 3.5;
_flare setLightFlareMaxDistance 30;
``

queen cargo
#

deleteVehicle

#

Everything that is of type "OBJECT" and was created prior can be deleted using deleteVehicle

dusk tulip
#

deleteVehicle _light? if I have many of these will it delete all of them? again im using this to learn so some obvious things may not be so to me just yet

queen cargo
#

It will delete whatever you stored prior

#

Imagine the _light thing as a box

#

With = you put something in that box

#

Everything you do with _light will refer to you taking contents out of that box

#

And putting the contents back (aka: you never empty that box unless you do a =)

#

there is one special exception to this rule, and that is so called "scoping"
A scope usually is defined by the {}

dusk tulip
#

oh ok nice so i can just do a trigger with something like when this is alive deleteVehicle _light

queen cargo
#

If you have a "box" prefixed with a _ you then will be local to that scope (which means that your box (variable) will become unavailable at the point where you leave the scope (}) initially created it by putting something in it using =)

#

Hope that helps

dusk tulip
#

ok so I should use = intead of _ to widen my scope allowing it to be changed in the future

wet shadow
#

Hey people, I'm working on a custom curator module and I got some questions if anyone here has experience with those.

How does the curatorInfoType -display if used interact with the function that is played when the module is placed. Presumably the idea is that values are passed from the display to the eventual function (e.g. defining the length of a time skip).

hardy valve
#

Hello i've added an action for a vehicle,

Is it possible to timeout this action so it does not show again for 5 minutes?

wet shadow
winter rose
limber thunder
#

Hi guys,
can anyone help me with the If function? I've been trying to find the right syntax for the boolean but can't seem to get it right
Here is the code:

_caller = p5;
if ((_caller == p5) or (_caller == p6) or (_caller == p7) or (_caller == p8)) then { 
 
hint "1";
 
  } else { 
 
hint "2";
 
 };
winter rose
#
if (_caller in [p5, p6, p7, p8]) then
{
    hint "1";
}
else
{
    hint "2";
};
```should work as well
limber thunder
#

yes that works 🙂

winter rose
spiral narwhal
#

Is there a way to disable voice chat on a custom radio channel created with ‘radioChannelCreate’ ?

#

The wiki isn’t suggesting anything like that

warm hedge
spiral narwhal
winter rose
tender sable
meager granite
#

Ask ChatGPT again, sure it can help

#

Also !code

#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
warm hedge
#

Don't bring ChatGPT here

fair drum
#

Already seeing too much of it on r/armadev

meager granite
#

Having such code often

    private _unit = driver _vehicle;
    if(isNull _unit) then {_unit = effectiveCommander _vehicle};
```makes me wish for something like
```sqf
    private _unit = driver _vehicle orIfNull effectiveCommander _vehicle;
#

orIfDead too, perhaps (alive check)

granite sky
#

It's a common construct but there are probably too many common conditions to make it worthwhile.

meager granite
#

Yeah, perhaps its too specific.

#

ENTITY || ENTITY hmmyes

#

won't fit for alive variant though

fair drum
#

I know you want engine based, but doesn't CBA have something like this?

#

or what about these?

private _unit = [effectiveCommander _vehicle, driver _vehicle] select (alive driver _vehicle)
private _unit = [effectiveCommander _vehicle, driver _vehicle] select (!isNull driver _vehicle)
dreamy kestrel
#

mentioned tangentially in my reference to LINQ...

meager granite
dreamy kestrel
pulsar bluff
warm hedge
#

We don't want to debug a code that nobody knows what and how it would work, and even no then after a if

fair drum
#

You mean you don't want to see:

"Can someone help me find why my code won't work"

Posts 200 lines of generated code with syntax issues throughout

echo abyss
#

Anyway, i have an issue regarding a simple script that i seem to not understand

warm hedge
#

Reading someone else's code is pretty painful job to do after all. Even if who wrote is months ago me

fair drum
#

guilty lol

echo abyss
#

im trying to make something to drop chemlights via Keybind/Keypress

dreamy kestrel
echo abyss
#

with this you wont need to carry chemlights

#

in inventory

#

with what youre referring to id need to have the grenade item

#

i dont script, so dont bash me too hard lol

fair drum
echo abyss
#

i've got the basic framework working, i get ingame change keybinds thats all sorted its just on keypress there is no Chemlight at my feet lol

#

it throws an error in RPT

#

DropChemlightYellow = {
_chem1 = createVehicle ["Chemlight_yellow", _chem>
22:35:31 Error position: <createVehicle ["Chemlight_yellow", _chem>
22:35:31 Error 0 elements provided, 3 expected
22:35:31 File zulufunctions\functions.sqf..., line 6
22:35:31 Error in expression <5];

fair drum
#

you are defining _chemPos after you try to create the chemlight

#

you are feeding createVehicle something that doesn't exist yet

echo abyss
#

hm, i see what youre saying. i just have such little knowledge of scripting lol

fair drum
#

just switch them around

echo abyss
#

oh

#

thats it?

fair drum
#

yup

#

do _chemPos first

echo abyss
#

oh

#

well then, i thought i'd need more honestly.

#

Thank you lol

warm hedge
#

Pretty much almost everything will work top to bottom not vice versa

#

If you have something defined but in bottom, won't work

fair drum
#

curious if you are new to scripting, why are you are jumping right into the CBA framework?

echo abyss
#

this is my first time even remotely making script and i did it very wrong lol so i appreciate the assistance

echo abyss
#

why not start near the heart of it

warm hedge
#

I don't rely on CBA though

echo abyss
#

if there is other easier alternatives, i dont mind you sharing i just thought everyone utilized CBA honestly.

echo abyss
warm hedge
#

Almost all, yeah

#

I've no clue how to use CBA after all

fair drum
#

CBA is great, especially their state machine and their unscheduled per frame handler/execute system. you just are diving into the deep end first.

echo abyss
#

DropChemlightYellow = {
_chem1 = createVehicle ["Chemlight_yellow", _chem>
22:50:54 Error position: <createVehicle ["Chemlight_yellow", _chem>
22:50:54 Error 0 elements provided, 3 expected
22:50:54 File zulufunctions\functions.sqf..., line 6
22:50:54 Error in expression <5];
};

#

think it spit the same issue out

echo abyss
echo abyss
#

just read that RPT a second time and noticed that lol

fair drum
#

hold up, so you are defining this function in two different places?

echo abyss
#

well at first i was doing 1 keybind, for all the chemlights with CBA option to change color of the Chemlight that you drop rather than doing what im doing now and making each individual one a keybind

#

forgot to comment out my Functions.sqf

#

i shouldnt need it i believe.

astral tendon
#

actually, after reading the function, I needed to use addVehicle on the vehicle crew I created

echo abyss
#

yeah that was my issue

#

i fixed it

#

thanks much

fair drum
#

right now, your function isn't secure. nafarious people can overwrite it.

#

define your functions either in CfgFunctions or use PREP in CBA

echo abyss
#

how would i go about sorting that?

#

oh

fair drum
#

XEH_PREP.hpp

#

then you include that in preStart and preInit. preStart caches it in uiNamespace, then compileFinal's it.

echo abyss
#

Gotcha, ill see what i can break 💀

fair drum
tender sable
dusk gust
tender sable
fair drum
#

Another fun fact: It used to be illegal in Switzerland to have only one guinea pig. They didn't want them to feel lonely since they are such social animals.

queen cargo
jovial aspen
#

hallo, i have this script that i got from the internet
nul = [9000] execVM "AL_intro\intro.sqf";

how do i make it remote exec to all machines at once

warm hedge
#

Use remoteExec

jovial aspen
warm hedge
#
[[9000],"AL_intro\intro.sqf"] remoteExec ["execVM"]```
jovial aspen
#

ohhhh

#

ya that makes sense

#

i need to study more thank you so much

queen cargo
languid halo
warm hedge
#

What exactly you've done

languid halo
#

and when that didnt work, I just wanted to test the Orginal code, to which also gave me the same error

warm hedge
#

I call that a summary and not what I want in order to help you. What code you've used

languid halo
#

fair fair

#

my bad

#

1 sec

#

[nil, "vehicles", [west], ["OPTRE"]] spawn BIS_fnc_exportEditorPreviews;

#

Literally just that, even [nil, "vehicles", [west], ["mark"]] spawn BIS_fnc_exportEditorPreviews; didnt work

warm hedge
#

Didn't work how? The error you've posted?

languid halo
#

Yes

warm hedge
#

At least the later one did work very finely for me

languid halo
#

Bruh

#

Just arma things

#

Let me re try it real quick

warm hedge
#

No, your something is broken

languid halo
#

Oh

warm hedge
#

I cannot say what is

#

Since my (mostly) vanilla game can run that very finely

languid halo
#

mhh

#

thank you for trying lmao

#

ill just do it the long way

warm hedge
#

It's very easy to verify. You can just run in vanilla, so you know who is the faulty

languid halo
meager granite
#

Looked into the function

_mods = param [3,[],[[]]];
``` (`["mark"]`)
then
```sqf
_mods = +_mods;
{
    _mods set [_foreachindex,tolower _x];
} foreach _mods;
```and then
```sqf
    {
        private _list = getArray (configFile >> "CfgAddons" >> "PreloadAddons" >> (_x # 0) >> "list");
        if(_cfgPatches in _list)exitWith
        {
            _dlc = _x # 1;
        };
    }foreach _mods;
```it iterates through it as if it was array inside array and not just a string
#

_fnc_getDlc changed at some point, looks like function is bugged now

languid halo
#

tragic

warm hedge
#

The exact code worked very finely on 2.15

meager granite
#

Bugs out in ["Arma 3","Arma3",214,150957,"Stable",false,"Windows","x64"]

#

Maybe its fixed in dev branch then?

meager granite
dreamy kestrel
dreamy kestrel
queen cargo
dreamy kestrel
wispy venture
#

16:58:37 No entry 'bin\config.bin/CfgPatches.rocket_s_r'.

How do i know what mod this is?

crystal iron
#

Anyone know of a simple farming/mining script/github link?

dreamy kestrel
languid halo
spiral temple
#

I've got a question about https://community.bistudio.com/wiki/publicVariable

"Using publicVariable too frequently and/or with a lot of data can cause other aspects of the game to experience bandwidth problems."

Does it only count for the publicVariable command or or also for the variable itself?

granite sky
#

I don't understand the question.

#

publicVariable is potentially expensive because it's a network broadcast.

warm hedge
#

The word count very much confuses me in this context

spiral temple
#

Uhm, what I meant is: the warning says the frequent use of publicVariable might cause problems. But does this also count for the call of the variable itself or only for the command?

warm hedge
#

call of the varaible as in?

glossy pine
granite sky
#

publicVariable broadcasts it once and once only. If you then modify that variable on one machine, that value isn't broadcast anywhere else unless you use publicVariable again.

royal quartz
#

hey guys not sure if this should be in here or config makers as its a bit of both.

im trying to turn some code I made for a mission into a mini script mod for a community that requested it.

The below code is saved in a file called "ResupplyBox.sqf" the code worked when running in a server init file for a mission but I changed it slightly for turning it into a mod. I added the Params that come from ticking the box in eden editor (added in the config.cpp ill post after this) and just changed the param of the object the addaction is running for.

params ["_targetEden", "_value"];

[_targetEden, ["<t>Resupply</t> <img size='2' image='\a3\ui_f\data\IGUI\Cfg\Actions\reammo_ca'/>",{ 

    params ["_target", "_caller", "_actionId", "_arguments"]; 

    loadout = [_caller,[localNamespace, getPlayerUID _caller]] call BIS_fnc_loadInventory; 
    _target setVariable [getPlayerUID _caller, false]; 

},nil,100,true,true,"","_target getVariable [getPlayerUID _this, true]",3]] remoteExec ["addAction", 0, true];
#

This is my config.cpp and the file structure of the mod is

@MaddonutsToolBox
  addons
    ResupplyBox (this is packed to PBO for testing ofcurse)
      functions
        ResupplyBox.sqf
      config.cpp
  mod.cpp
  
#
class CfgPatches
{
    class ResupplyBox
    {
        name = "Resupply Box";
        author = "Maddonut2";
        url = "";
        requiredVersion = 1.60;
        requiredAddons[] = { "3den", "A3_Data_F_Decade_Loadorder" };
        skipWhenMissingDependencies = 0;
    };
};

class CfgFunctions
{
    class TAG
    {
        class ResupplyObjectFnc
        {
            tag = "RSO"; //RSO_fnc_ResupplyObjectFnc
            file = "functions";
            class TAG_fnc_ResupplyObject {
                file = "ResupplyBox\functions\ResupplyBox.sqf";
            };
        };
    };
};

class Cfg3DEN
{
    class Object
    {
        class AttributeCategories
        {
            class MaddonutsTools
            {
                displayName = "Maddonut's Tool Box";
                collapsed = 1;
                class Attributes
                {
                    class ResupplyObject
                    {
                        displayName = "Is Resupply Object";
                        tooltip = "This will make this object a resupply object and add a one time use button per player to resupply their loadout from the last loadout they exited the Ace Arsnel with";
                        property = "ResupplyObjectProp";
                        control = "Checkbox";
                        expression = "[_this,_value] call RSO_fnc_ResupplyObjectFnc;";
                        defaultValue = "false";
                    };
                };
            };
        };
    };
};
meager granite
#

I wonder why isSimpleObject doesn't return true for map-placed simple objects (bushes, rocks, etc.) that don't have a class name?

#

Is it really different kind of object or it checks for object being mission-placed?

granite sky
#

@royal quartz This is going to make a function called RSO_fnc_TAG_fnc_ResupplyObject. Probably:
class TAG_fnc_ResupplyObject {

royal quartz
granite sky
#

Did you set a prefix on your addon PBO or are you using the undocumented implicit prefix?

royal quartz
granite sky
#

You can set the prefix manually in PBO manager, but bear in mind that it creates broken PBOs that won't load with signature verification enabled.

royal quartz
granite sky
#

k

royal quartz
# granite sky k

I tested with the code change I made above and it dident work so I guess your saying I need an addon prefix to point the cfgfunctions in the .cpp file to the right .sqf?

granite sky
#

I don't know. Dedmen said that addons without a prefix get a default one based on the filename, but I don't think that's documented anywhere.

#

Safer to set a prefix anyway. In your case it's just ResupplyBox

royal quartz
#

ah so just setting it as the addon folder name

#

and then will I need to change anything in the config.cpp for the location of the .sqf for the function?

granite sky
#

well, you're addressing the function file as ResupplyBox\functions\ResupplyBox.sqf

#

The prefix is where the ResupplyBox at the start comes from. Hence prefix.

royal quartz
#

oh right I see okay ill use addon builder to define a prefix repack the addon and see if that fixes it (also made the change for the function being called wrong thanks!)

granite sky
#

You can edit the prefix manually in PBO manager.

#

Hmm, maybe you can't add one there, only edit them.

#

ah no, you can right-click in the box.

royal quartz
opal zephyr
#

@meager granite Are you around, do you think you could give me a hand with the display stuff?

opal zephyr
#

_
It does look like I have found another solution to fix the screens I was creating not being deleted, Which was making the waituntil infinite. So the problem is solved. If you do have the time though Sa-Matra, id love to send you the onload code to see where I went wrong

opal zephyr
#

This is the code that creates it at the start of the mission:

UIE_texHashMap set [_uniqueUIName,_x];
_unit setObjectTexture [_forEachIndex, format ['#(argb,%1,%2,1)ui("UIE_Display","%3")', _texSize#0, _texSize#1, _uniqueUIName]]; 

And this is what the onLoad looks like of UIE_Display:

params ["_display", ["_config", configNull]];

_uniqueUIName = displayUniqueName _display;`
_tex = UIE_texHashMap get _uniqueUIName;

_screen = createSimpleObject ["J3FF_screenTest", AGLTOASL positionCameraToWorld [0,0,0], true];        
_screen setObjectTexture [0, format ['#(argb,%1,%2,1)ui("RscDisplayEmpty","%3")', 512, 512, _uniqueUIName]]; 

systemChat (format["%1",_tex]);

_pic1 = _display displayCtrl 1001;
_pic2 = _display displayCtrl 1002;

if ((ctrlText _pic1)=="" && (ctrlText _pic2)=="") then{
    //Re-apply the original camo texture.
    _pic1 ctrlSetText _tex; 
    
    //Apply the blank blood texture.
    _pic2 ctrlSetText "";
};

//Update Changes.
_pic1 ctrlCommit 0; 
waitUntil {ctrlCommitted _pic1};
_pic2 ctrlCommit 0; 
waitUntil {ctrlCommitted _pic2};
displayUpdate _display;
deleteVehicle _screen;
#

@meager granite ^

meager granite
#

How does your onLoad looks like?

#

Why have _screen and delete it right away?

#

You don't need ctrlCommit for ctrlSetText btw

opal zephyr
#

The onLoad just calls the code that I showed above

meager granite
#

You have waitUntils so its probably spawned or execVM'ed

opal zephyr
#

The _screen is something I used to use to cache the texture when it was too far to be rendered

meager granite
#

But _screen will create only if you're already close for it to be rendered, because its the moment of your UIE_Display creation

opal zephyr
meager granite
#

setObjectTexture doesn't create the display, looking at the texture does

#

So you if you set the texture for a far away entity, no display will create until camera is looking at it

opal zephyr
meager granite
#

If dedmen's fix worked, it shouldn't be black 🤔

#

Gonna try myself

opal zephyr
#

Im on perf profiling btw

opal zephyr
#

Another odd thing was that the unload wasnt firing for the display. I just had a systemchat in it and it never fired

meager granite
#

Just tested it and it works properly, no black textures

#

Added stripes to vehicle textures

#

Textures werent loaded before

#

Spawned a new vehicle that I didn't see this game launch, worked properly again

#

Spawned brand new vehicle 1km behind me (didn't see it this game launch yet so neither texture nor model was loaded)

#
  1. Vehicle spawned, nothing in chat (no textures loaded yet)
  2. Turned around, some textures loaded (that are needed for low LOD)
  3. Going closer, more textures
  4. Up close, textures are properly loaded for ui2texture
#

So I guess dedmen's fix did work

opal zephyr
#

Hm alright, so im just doing something wrong then

#

maybe its my config:

class UIE_Display
{
    idd = 6767;
    onLoad = "call J3FF_fnc_setControls";
    onUnload  = "systemChat 'UnLoaded'";
    class Controls
    {
        class RscPicture;
        class pic1:RscPicture
        {
            idc = 1001;
            text = "";
            x = 0;
            y = 0;
            w = 1;
            h = 1;
        };
        class pic2:RscPicture
        {
            idc = 1002;
            text = "";
            x = 0;
            y = 0;
            w = 1;
            h = 1;
        };
    };
};
meager granite
#

Here is a mission I threw together for this test

#

Execute in debug console:

["I_MBT_03_cannon_F", 1000] call func_createTexturedObject
#

will spawn a tank 1000 meters behind camera

#

Do a fresh game start, go into this mission and spawn some vehicles and let me know if you'll have a black texture anywhere

opal zephyr
#

It doesnt recognize your function haha, I guess its not initializing, hold on

#

Your code works

meager granite
#

Try reducing yours until its close to mine

opal zephyr
#

I've reduced it until it is now fundamently the same, or atleast appears to be to me, and it still doenst work

#

Hold on, I made a mistake. I think its working now

#

maybe its because I was using precreated controls instead of creating them like you were?

meager granite
#

Shouldn't be an issue

#

Try getting rid of waitUntils and displayUntil, make sure you call your function with your display from onLoad

#

I assume the code you posted is J3FF_fnc_setControls?

opal zephyr
#

yes

#

My onUnload still doesnt run, should that happen when the texture isnt loaded anymore? Like if I go out of its render distance

meager granite
#

Not sure how it works exactly, display probably gets unloaded once texture is unloaded completely

#

Through FLUSH or something like that perhaps

#

Looking away or having camera far away shouldn't be enough for texture to unload

#

Or that onUnload is just ignored, like it was for RscTitles until recently

opal zephyr
#

Ah alright ill do some performance testing and determine if I need to unload it manually or not. I was finding lots of displays to be a little laggy before

#

Thankyou again for all your help with the onLoad stuff, was annoying trying to make it work

meager granite
#

You don't need to worry about unloading, game handles that itself

granite sky
#

Note that onLoad is weird and gets called before the display's controls are created. Hence people often spawn from it instead.

opal zephyr
#

Is that why using existing controls might be an issue?

meager granite
#

Try systemChat'ing them to see if they're null?

granite sky
#

I haven't read your code. It's just a common error.

opal zephyr
meager granite
#

Thought I could make cool flaming texture tank but it looks meh

#

Either way ui2texture is cool

#

Wreck has a separate texture that you can't control, might have looked better there

#

Hatchback wreck is retexturable and it looks alright-ish there

opal zephyr
#

How do you get it to come up on your screen when you do it? I was looking earlier and couldnt find a simple way

meager granite
thorn saffron
#

Does anyone knows how audibleFire values, in ammo config, translate to distance in game? The MX has something like 45, the UGL has 30, while welrod from SOG has 0.035. Is it a curve or a linear interpolation or what?

sullen trellis
#

nvm it was a bugged map lol

cedar blaze
fair drum
cedar blaze
#

As far as I know

#

What should I screenshot to help you?

fair drum
#

Are you using 3den enhanced? It will help you find what I'm going to ask for faster

cedar blaze
#

Yes

fair drum
#

Ok, right click the unit and click find in config. Then in the config select the subclass event handlers. See if there is a property called init and see if it is loading a custom loadout function

cedar blaze
#

config didn't show up

fair drum
#

Link me the mod. In the mean time, copy your current load out to a base arma unit and use the same code you have above and see if it works.

cedar blaze
#

This is a big modpack, it would be too much to ask you to do this.

fair drum
#

Then try what I suggested with using a base arma unit

cedar blaze
#

I see an error in the console, but it's not from here.

#

But i can remove weapons from debug console

#

But other unit's under AI control is stripped

#

what...

fair drum
#

When stuff like this starts to happen, remove all mods and see if the code works in vanilla.

cedar blaze
#

I see, thank you for sharing

#

I'll start from scratch

winter rose
cedar cape
#

how would i go about editing an already existing faction, im looking to edit the NATO faction and replace everything with modded gear

fair drum
fair drum
#

if you replace the NATO faction, your mod will not be compatible with vanilla and can cause conflicts with other mods that use the vanilla as their base classes

#

its best to use the base classes of the vanilla factions as an inherit for your new classes

cedar cape
pulsar pewter
#

Hey folks!
Do characters have mempoints for different body parts? I kinda wanna see if I can attach stuff to specific body parts.

fair drum
fair drum
#

when you use attachTo, you can attach things to a memPoint

pulsar pewter
#

thanks Hypoxic!

placid root
#

hey guys i have a small datatype problem. i need a number but unfortunately the datatype of a position is a string. how can i convert it?

#

(getArray(configfile >> "CfgWorlds" >> worldName >> "Names">> "hama" >> "position")select 0)

#

return = "2280.96+2560"

vapid scarab
#

Hey. Is there a way to reduce/remove weapon sway? I tried setCustomAimCoef but it doesnt seem to do anything

#

I am using ace

placid root
#

parseNumber only gives me 2280.96 but not the sum

winter rose
#

try without ACE

vapid scarab
#

Well... ace is a requirement. But ace guys helped me out over on their discord.
ace_common_fnc_addSwayFactor

queen cargo
#

just some random assumption @placid root ...
your config says position[] = {"2280.96 + 2560", ...}?
because thats BS in its purest form
configs do not know SQF ((think there was something with the _EXEC macro to make it work, still its bad practise))

crude needle
light fox
#

Double-click a waypoint On Activation: vehicle this land 'get in'; and the heli flies up without me. I'm following a yt tutorial but this part is not working. How to make heli wait until I get in?

placid root
#

well i want to get a insurgency mission working on all locationtypes on PR Fata. unfortunately PR decided to put it's position coordinatea as a sum in a string. now i am trying to fix it in the insurgency script handling some exeptions

queen cargo
#

call compile

placid root
#

and yes that's what the position[] says

#

that was easy ^^

#

thx

#

i love you works like a charm

queen cargo
#
    {
        if (typeName _x == "STRING") then
        {
            _this set [_forEachIndex, call compile _x];
        };
    } foreach _this;
};
_result call _toCompiledArray ;```
#

feel free to use that lil function @placid root
should work
but maybe it does not

sullen sigil
placid root
#

thx ^^.

fair drum
#

that goes in the waypoint completion condition

candid sun
#

there's no return value!

queen cargo
#

yup

#

so?

#

it expects an array reference dude :P

#
_arr = _result;
_arr set [1, "MEH"];

diag_log str (_result select 1);
//RPT contains "MEH" now```
#

thats also why i said "might not work"
it should if arma handles arrays consistent
if it does not (which is something i never checked) then the code above will not work indeed

glossy axle
fair drum
#

register teleporter module

#

well i guess it doesn't solve your exclusiveness to the teleporter, might have to add that in on the next patch. it does do side exclusion though

glossy axle
#

Thank you, the unit I am in already has something similar, with the option to select a location, though I am looking for linking two singular teleports up

royal quartz
#

Hi guys cant seem to define this function correctly. Below is the config.cpp I am trying to call it in the new eden attribute defined in the config too.

Calling it with, which is commented out as I have it working with "ExecVM" but I would prefer to have it defined as a function

expression = "[_this,_value] call RSO_fnc_ResupplyObject;";
class CfgPatches
{
    class ResupplyBox
    {
        name = "Resupply Box";
        author = "Maddonut2";
        url = "";
        requiredVersion = 1.60;
        requiredAddons[] = { "3den", "A3_Data_F_Decade_Loadorder" };
        skipWhenMissingDependencies = 0;
    };
};

class CfgFunctions
{
    class ResupplyBoxFnc
    {
        tag = "RSO"; //RSO_fnc_ResupplyObject
        file = "ResupplyBox\functions";
        class ResupplyObject {
            file = "ResupplyBox\functions\fn_ResupplyObject.sqf";
        };
    };
};

class Cfg3DEN
{
    class Object
    {
        class AttributeCategories
        {
            class MaddonutsTools
            {
                displayName = "Maddonut's Tool Box";
                collapsed = 1;
                class Attributes
                {
                    class ResupplyObject
                    {
                        displayName = "Is Resupply Object";
                        tooltip = "This will make this object a resupply object and add a one time use button per player to resupply their loadout from the last loadout they exited the Ace Arsnel with";
                        property = "ResupplyObjectProp";
                        control = "Checkbox";

                        //expression = "[_this,_value] call RSO_fnc_ResupplyObject;";
                        expression = "[_this, _value] execVM 'ResupplyBox\functions\fn_ResupplyObject.sqf';";
                        defaultValue = "false";
                    };
                };
            };
        };
    };
};
#

I can see the function in the config viewer with it pointing at the file but cant call it.

digital hollow
#

You're missing the Category class

class CfgFunctions
{
    class RSO
    {
        class Category // Not in your config
        {
            class ResupplyObject {
                file = "ResupplyBox\functions\fn_ResupplyObject.sqf";
            };
        };
    };
};
royal quartz
#

I though the category name is changeable to whatever you wish to name your category? put a comment in the line below? Or do I specifically need one called "Category"

class CfgFunctions
{
    class ResupplyBoxFnc // <-- this is the category?
    {
        tag = "RSO"; //RSO_fnc_ResupplyObject
        file = "ResupplyBox\functions";
        class ResupplyObject {
            file = "ResupplyBox\functions\fn_ResupplyObject.sqf";
        };
    };
};
digital hollow
#

This is 3 levels. You need 4.

royal quartz
#

so you can change the TAG to whatever your TAG is
and the category name too? but you just need 4 levels

digital hollow
#

Right

granite sky
#

If you don't specify the file attribute then it uses the category name to determine the file path.

#

But even if you're specifying all your paths manually you still need the extra level.

royal quartz
#

id prefer not to specify the paths manually I just couldnt get it to work so I guess this would work?

class CfgFunctions
{
    class RSO
    {
        tag = "RSO"; //RSO_fnc_ResupplyObject
        file = "ResupplyBox\functions";
        class ResupplyObjectScripts {
            class ResupplyObject;
        };
    };
};

and then the path forthe function would be "ResupplyBox\functions\fn_ResupplyObject.sqf"?

#

and then I can call it via call RSO_fnc_ResupplyObject;?

#

yes it works! thank you so much guys

hallow mortar
#

You don't need to specify tag = "RSO"; - it will be automatically detected based on the top-level class being RSO

royal quartz
#

ahh okay thanks Ill remove that line aswell

#

how do you do inline code snippets? I only know how to do blocks

#

Something else I wasnt sure on is when writing mods how to you get scripts or functions to e.g on respawn, or when a player is initialized.

im talking about these files from missions but in mods

initPlayerLocal.sqf
onPlayerRespawn.sqf
granite sky
#

If you don't have a mission in your mod? You need to use preInit or postInit attributes on an init function. In the case of respawn, you'd add an event handler for respawn.

royal quartz
#

yeah id want some code to run on respawn and on init of the player only if that tick box I created in the eden editor is ticked. So I guess I just need to find out how to add an event handler for that but i guess I can do it just with the CBA function.

CBA_fnc_addEventHandler
hallow mortar
#

Note that syntax highlighting is not available for inline code, only for blocks

royal quartz
#

ah cheers

viral birch
#

I am creating a vehicle that spawns in front of the player, in the direction the player is facing, and as close to the terrain as possible to prevent the vehicle from bouncing or falling which will kill the player if they move too quickly before it settles. However, sloped terrain is an issue since I want the vehicle to be pitched at the same angle as the terrain.

Here is the code I have so far:

_vehicleClass = "B_T_QuadBike_01_F"; 
_player = player; 
_spawnPos = player modelToWorld [0,3,0.8]; 
_spawnDir = direction _player; 
 
_vehObj = createVehicle [_vehicleClass, _spawnPos, [], 0, "CAN_COLLIDE"]; 
_vehObj setDir _spawnDir; 
[_vehObj, 15, 0] call BIS_fnc_setPitchBank;
_vehObj setVelocity [0,0,0]; 

This works, but if I go to a different hill or terrain, the pitchBank angles still tilt the vehicle at a different angle than the terrain. Any idea how I can automate that so that it always uses the correct angles no matter the terrain slope? I'd imagine that I'd want to automate the setPitchBank and Z-index for modelToWorld -- just not sure the best practice on doing that.

fair drum
#

use surfaceNormal with vector commands

#

@viral birch

viral birch
hallow mortar
#

setVectorDirAndUp

meager granite
#

setVectorUp alone might also be enough, but it won't be a precise direction depending on a slope

#
_vehObj setVectorUp surfaceNormal _spawnPos;
```instead of `setPitchBank`
viral birch
meager granite
#
_spawnPos set [2, 0];
#

beware of rocks and other stuff though

viral birch
#

Rocks or other obstacles is fine, if someone deploys it in such a way then I feel like that's on them lol.

viral birch
meager granite
viral birch
hollow plaza
#

I wonder, is there some limit to PIP displays on at the same time? While testing a security camera system I noticed that 1 out of 9 camera screens will always appear black.
When resetting them the 1 black screen is always the last display being re-enabled, meaning it's not a specific pip camera being broken.

hallow mortar
#

I would usually recommend spawning a vehicle about 0.5 to 1 metres above the ground level. This will give it space to land on top of any small obstacles or irregularities in the ground (spawning at the bottom of a dip, for example) instead of clipping with them and exploding, and such a short fall is survivable without damage for most vehicles.

sullen sigil
#

is there some easy way to stop units freefalling

#

setunitfreefallheight doesnt re-evaluate if unit should continue freefalling

#

(for obvious reasons)

warm hedge
#

Maybe switchMove

sullen sigil
#

i wouldve preferred to not set animation but if thats the only way to do it then fair enough

#

switchMove does not actually do it 😄

opal zephyr
#

Are you trying to stop someone who is actively falling?

sullen sigil
#

trying to change it to freefalling

#

not freefalling

#

other way around

#

freefalling to regular falling after change in unit freefall height

opal zephyr
#

Do you need them to be in a standing position?

sullen sigil
#

the normal falling that happens if you fall off a building or something

opal zephyr
#

If switchMove doesnt work then all I can think of is to make the unit land on a surface and then switch the animation to standing and then resume the falling.

#

You could use a invisible object for them to land on for example

sullen sigil
#
player setUnitFreefallHeight -1;
player setposasl ((getposasl player) vectorAdd [0,0,200]);
0 spawn {
private _veh = "babe_helper" createVehicleLocal [0,0,0];
sleep(0.1);
player setUnitFreefallHeight 1000;
_veh setposasl (getposasl player);
sleep(0.1);
player switchMove "afalpercmstpsraswrfldnon";
sleep(0.1);
deleteVehicle _veh;
};```
this seems to work *ish*
#

just test code but

#

ideally it will work in mp without too much bullshittery

#

oh you dont actually need the sleeps 😂

candid sun
#

well fuck me, you're right, i just tested it

queen cargo
#

its callen "pass by reference"

#

thats why you sometimes see stuff like
foo = +array; in peoples code

#

and thats also why you should not change an arrays content inside of a function

#

((unless you do exactly that lil +array thingy :)))

candid sun
#

i just don't get it, i'd have thought
_arr = _result;
would make a copy of _result

distant walrus
#

hello, looking for help on a piece of code i had

    systemChat "DEBUG: part 1";
    _wp = createTrigger ["EmptyDetector", getPos player];
    _wp setTriggerArea [100,100,0,false, -1];
    _wp setTriggerActivation ["GROUP","PRESENT", true];
    systemChat "DEBUG: part 2";

    if (triggerActivated _wp) then
        {
        systemChat "DEBUG: part 3";
        (driver (vehicle _x)) action ["engineOff", (vehicle _x)];
        _x action ["Eject", vehicle _x];
        };
    sleep 10;
} forEach [Hunter1,Hunter2]; ```

Only part 1 and part 2 fires, the trigger does not activate at all. Script is for 2 hunting squads to come for the player. The seeking scripts are not here, if someone could help much thanks
sullen sigil
#

is that... while true do {} forEach ...?

#

or have you just got really really badly indented code

distant walrus
#

its stupid but eh works for now

sullen sigil
#

it doesnt.

distant walrus
sullen sigil
#

is this chatgpt generated

distant walrus
#

no i just suck at coding

sullen sigil
#

refer to biki

#

you cant do that.

#

use advanced developer tools for syntax stuff in debug console

distant walrus
#

elaborate please

distant walrus
#

Oh alright

sullen sigil
#

it will give you a better debug console

distant walrus
#

Cool thanks

meager granite
distant walrus
meager granite
distant walrus
#

group

meager granite
#

I have no idea how triggers work notlikemeow

sharp grotto
#

I don't know much either but i used this (And it worked (Multiplayer server))

_trgspos = [8148.1,14199.3,0];
_trgs = createTrigger ["EmptyDetector", _trgspos, false];
_trgs setTriggerArea [750, 750, 0, false];
_trgs setTriggerActivation ["ANYPLAYER", "PRESENT", true];
_trgs setTriggerStatements
[
   "vehicle player in thisList",
   "
    if(ExilePlayerInSafezone)exitWith{};
    [""|> Entered Buffer Zone <|""] spawn ExileClient_gui_baguette_show;
    if((driver (vehicle player)) isEqualTo player) then {vehicle player setCruiseControl [0, false]};
   ",
   "
    if(ExilePlayerInSafezone)exitWith{};
    [""|> Left Buffer Zone <|""] spawn ExileClient_gui_baguette_show;
    if((driver (vehicle player)) isEqualTo player) then {vehicle player setCruiseControl [0, false]};
   "
];
gray bramble
#

That's because you think like a sane person :P

distant walrus
sharp grotto
distant walrus
#

Oh, ok actually yeah imma try that

sharp grotto
#

The code inside was just as example for the trigger ^^

distant walrus
#

Ok

meager granite
#

How does this "GROUP" activation even works? I can't find any answers 🤔

#

Trying to synchronizeObjectsAdd player to trigger and other way around, trigger still never triggers

distant walrus
meager granite
#

Whole Group - This option is only available if the trigger is linked to a unit. The trigger will activate when the linked unit's entire group satisfy whichever of the six conditions below is being used.
Perhaps synchronizeObjectsAdd is not right command to link through a script?

#

Can you even link entities through script at all? Can't find any other commands.

#

Is it just an editor thing?

meager granite
#

Wish there was a way for color procedural texture to be non-1x1

#

For dynamically making text and list image spacers of needed width

queen cargo
#

@candid sun nope
its valid for values
but arrays are references to arrays

#

has to do with the underlying logic behind it

#
_arr2 = _arr1;```
is more or less this here:
```char[] arr1 = {1, 2, 3, 4};
char* arr2 = arr1;```

arr1 contains a pointer to the first element
and you give arr2 the value of the pointer
thus both point to the first element of the same array
gray bramble
#

See, the insanity :D

candid sun
#

i'm not sure i want to go further in learning sqf...it seems dangerous to mental health

queen cargo
#

@candid sun thats programming in general
do not do it if you enjoy being normal

gray bramble
#

Actually, many languages will let you have value semantics - the sane way. C++ included.

#

C not so much.

#

There are some fairly good reasons for this reference semantics thing, but making sense was not part of it.

queen cargo
#

ehrm ... in nearly no language you will have value semantics with arrays and objects

#

the reason why you do it is also simple: speed

gray bramble
#

If you stay away from the C part, C++ will easily allow you to do it - and thus use reference semantics only explicitly.

queen cargo
#

it wont "allow you to do"
you fucked your code if you do so as it is unperformant

#

pass by reference is way faster as soon as you go above a single value value

#

as you do not have to copy everything first and instead just the reference to one object

#

in most cases you also just want to read from an object

gray bramble
#

Use vector<int> or array<int,5> instead of int x[5]. Use string instead of char*. Then you have to explicitly use & to get reference semantics.

candid sun
#

i'm no expert but i'm half decent in php and i prefer it's method of dealing with arrays

#

even if it's also a horrible language

#

$bar = $foo; // copy

#

$bar = &$foo; // reference

queen cargo
#

and what will you do in all those cases @gray bramble? pass by reference
why? because it is faster

#

there are barely cases where you want passByValue

gray bramble
#

It doesn't matter if it's fast if you cannot get it correct because you cannot reason about it.

queen cargo
#

feel free to read

#

reason why is because it is fucking expensive to do passByValue

#

as you have to copy the whole object

gray bramble
#

I "grew up" in C, so I know that stuff.

#

I would have loved a const ref construct in sqf, btw. But I don't see a way it could be done reasonably.

queen cargo
#

tbh ... you should just think how many poorly optimized scripts you would have then
most would not know whats the difference and just ignore it straight thus ending up in a copy mess of arrays

blazing zodiac
#

Hey all. I'm looking for a way to kick a specific player via script executed on the server and have been having some trouble making something work. I've tested the RCON send commands and can kick with them by using slots and iterating through all players but I haven't been able to kick an individual player by name of directPlayID.

gray bramble
#

I know what you're saying, and, in the context of sqf, I agree - I was just wishing we could have a const ref, such that we know some function is not going to change our stuff underneath us.

#

In teaching C++ the sane way, you do introduce references early, and explain how to use them, what they're good for. Even as you stay away from pointers for as long as possible.

#

The key is that it's obvious when you're referring to the same object.

#

Compared to the 'surprise reference semantics' we saw above.

candid sun
#

i'm gonna create a ticket on the feedback tracker. see if they'll change the name of SQF to FML

sharp grotto
timid tulip
#

Im trying to chain some basic BIS_fnc_dynamicText together within a single trigger, with a delay between each, but i cant seem to get it to work using sleep or uisleep.

["<t size='2' color='#ffffff'>TEST TEXT ONE</t>",0,0.3,3,2] spawn bis_fnc_dynamictext; 
uisleep 4;  
     ["<t size='2' color='#ffffff'>TEST TEXT TWO</t>",0,0.3,3,1] spawn bis_fnc_dynamictext;```

Please help, im really new to this and would love to get some basic subtitles made
stable dune
warm hedge
timid tulip
warm hedge
#

Literally I linked

stable dune
#

Yeh, then take a look poplox link

timid tulip
#

Ah right it's all in there, gotcha

sharp grotto
timid tulip
stable dune
#

You need take
```//this will...```` comment away

timid tulip
#

gotcha, assumed thatd be ignored given its a commen PES_SadShrug

timid tulip
hallow mortar
faint hinge
#

Hello people of the scripting subsection. Is there a script that hides terrain objects in every map, vanilla or not?

fair drum
chrome hinge
obtuse crypt
queen cargo
#

FML? @candid sun

keen stream
#

Fuck My Life

stray flame
#

Hey, How do I make ai scan horizon

#

I have this recon unit that I want to look around a lil

little raptor
#

there's no scripting command for it

#

you have to use a while/for loop and use doWatch

little raptor
#

just check requiredAddons in CfgPatches recursively to build a list of all addons, then use the same code as before to convert them into mods

storm arch
#

Hey Im looking to make an AI unit invisible to everyone except for one player is this possible?

warm hedge
#

hideObject

storm arch
crystal iron
#

anyone have a link to a vanilla weed harvest/gather script?

#

or know a script to gather from a placed object like a plant

turbid nymph
#

yo anyone got a example or any info on a server script to blacklist mods, basically disconnect someone if they have a specific mod loaded?

warm hedge
#

Does it have to be a scripted solution? In Engine wise there is a way to kick if someone has not signed or accepted key'd Mod

granite sky
#

Engine's a whitelist rather than a blacklist.

#

It's not a difficult thing to implement with cfgPatches checks and endMission anyway, but it's really a client-side rather than server-side script.

warm hedge
#

Well true tho

#

If verifysig is sufficient we should to use, but it isn't so your Q?

granite sky
#

In most cases I'd say that verifysig is the correct approach, because "acceptable" mods often still break when they're not running globally.

sharp grotto
#

I thought about it a while ago because the BE signature kicks can get quiet annoying (Super buggy imho).

warm hedge
#

I'd say checking CfgPatches is better

turbid nymph
#

this is what i got for now :

    if(isClass(configFile>>"CfgPatches">>"modname1") || isClass(configFile>>"CfgPatches">>"modname2")) then {
        forceEnd;
    };
}```
#

it works when i put it in a init.sqf file

#

in the mission

warm hedge
#

Wouldn't that a bad idea actually

turbid nymph
#

i mean, it dont stop someone from having their own version of the mod and changing the cfgpatches name

#

but you know, thats already 99% of players dealt with

#

but yall think the !isDedicated makes the mission end only on the affected client that matches teh condition

#

just want to make sure i understand it right

warm hedge
#

It is nearly impossible to kick every such case I'd say. Maybe checking the function's code?

turbid nymph
#

well im not trying to make a brick wall of a blacklist to stop everyone, i just want to stop players from using personal arsenal n shit

#

like the normal player who does not know how to code or anything to get around it

warm hedge
#

Yeah agreed

granite sky
#

Not really sure what the isDedicated check is for. You're controlling what runs on the server anyway, right?

turbid nymph
#

well documentation says that it checks if its a dedicated server, if it is (any server hosted by a provider i guess) it skips teh check entirely to avoid stopping the mission for everyone

granite sky
#

Actually given what you wrote, I don't think you understand SQF locality.

turbid nymph
#

if its not it a dedicated server, it checks on every client when they enter the mission and ends the mission for that client if they have either mod

#

thats what i understand

manic kettle
# turbid nymph this is what i got for now : ```if(!isDedicated) then { if(isClass(configFi...

This works functionally as a blacklist and we used this method for years to avoid the most popular cheating mods. But ultimately my players started using dumb shit that affected server performance so I switched my script.
Now I use a whitelist method where I get all the cfgPatches on the server, all the cfgpatches of the player, the cfgpatches in a custom whitelisted mod file, and compare them.
If a player loads something not on the server or on the whitelist they get kicked.

I've had better luck with this method since keys constantly bring issues

warm hedge
#

Maybe this is better. Almost identical with verifySig way though

turbid nymph
#

yeah, im not the owner of the server so i dont get to choose, but i would do whitelist more than blacklist

granite sky
#

We blacklist for Antistasi to stop people trying to run it with known-broken mods.

turbid nymph
#

well some mods like to be annoying and spawn shit in if you run it on a server thats not theirs so i blacklist those

granite sky
#

known-mission-breaking, that is. Bloodlust is still allowed :P

turbid nymph
#

yea

#

its just whitelist means checking all the clientside mods people use and adding them

#

or just saying fuck that and cutting in the middle

#

but yeah, so this code works for my purposes i think

manic kettle
#

It does, and it's annoying, but at some point when things get too wild you need to just cut the shit imo.

turbid nymph
#

yea, the mission gotta run smooth

#

alrigth thx! ill test it a bit on an actual server and see if i got to change anything

meager granite
#

Huh, you get kill attribution even if your damage did not actually increase the damage, only having your shot trigger the HandleDamage is enough

#

That's how people shooting a tank with a rifle get a kill credit after it explodes a bit later from HitHull damage, because their rifle damaged a headlight a bit and that's enough, even if reflector hit points were already destroyed

#

Thought it was at least a little bit more complex

#

Wish there was a scripting command to get/set this kill credit on a vehicle to correct this

#

How to observe this if somebody is curious:

    player allowDamage false;
    deleteVehicle o;
    o = createVehicle ["B_MBT_01_cannon_F", vehicle player modelToWorld [0,15,0], [], 0, "CAN_COLLIDE"];
    o setDir (getDir vehicle player + 180);
    o setHitPointDamage ["HitHull", 1];
    {
        o setHitPointDamage [format["#%1", toLower getText(_x >> "hitpoint")], 1];
    } forEach ("true" configClasses (configOf o >> "Reflectors"));
    onEachFrame {
        private _d = getAllHitPointsDamage o;
        private _a = [format ["<t align='left'>Damage</t><t align='right'>= %1</t>", damage o]];
        {_a pushBack format ["<t align='left'>%1</t><t align='right'>= %2</t>", _x, _d select 2 select _forEachIndex];} forEach (_d select 0);
        hintSilent parseText format ["<t size='0.7'>%1</t>", (_a joinString "<br/>")];
    };
```Execute this, shoot the headlight with a gun once, wait till tank blows up, check the scoreboard.
meager granite
#

Wish you could empty hashmaps the same as you empty arrays with resize 0

#
private _array = player getVariable "array";
{
} forEach _array;
_array resize 0;
private _hashmap = player getVariable "hashmap";
{
} forEach _hashmap;
clearHashmap _hashmap;
```Something like this
#

muh microseconds moment again

pulsar bluff
#

is resize faster than = []?

meager granite
barren tiger
#

does anyone know a way to make it so that players can access remote turrets without needing a uav terminal in their inventory? like a static object they can interact with that allows them to gain control of the turret and remote operate it?

warm hedge
#

remoteControl and switchCamera

barren tiger
warm hedge
#

"Equip"? Cannot write a snippet right now but petty much BIKI can explain

maiden raven
#

Best way to stop a dog from moving, apart from shooting it or disablingAI anim? Seems like move/fsm/target have no effect.

#

tried both createunit and agent

sullen trellis
#

Hi i’ve been looking for a code to detect if a player is holding a specific weapon then runs a custom script. I tried currentweapon primaryweapon… etc, maybe someone got any clue

#

The idea is when holding/equipping an axe, u can cut trees 😄

meager granite
#
currentWeapon player == "your_axe_class"
#

as for "runs a custom script", depends on what you mean, do you want an addAction or something else?

sullen trellis
#

Makes a trigger=true, or execvm sqf file

#

Basically the script already adds action near trees, but should only be activated when player is holding axe

meager granite
#

Does it support removing the action so you can remove it after you unequip the axe?

sullen trellis
#

Nope

meager granite
#

What the script does, adds action with addAction?

#

You can simply add this condition in addAction's condition check

sullen trellis
#

Alright thnx let me try that

meager granite
#

Run your script right away, but make its actions only be visible with axe in hands check

sullen trellis
#

_cursorObject = cursorObject;
_weapontype = currentWeapon player == "WBK_axe";

if (!(['\tree',((getModelInfo _cursorObject && _weapontype) select 1),FALSE] call BIS_fnc_inString)) exitWith {

#

This is the whole addaction condi section, not sure how to add “_weapontype” as another condition here

meager granite
#

Seems like a very old script

#
if ( !_weapontype || !(['\tree',((getModelInfo _cursorObject) select 1),FALSE] call BIS_fnc_inString)) exitWith {
#

Didn't notice you added _weapontype somewhere in the middle meowsweats

#

Actually, not very old considering getModelInfo

#

Did you write this condition yourself btw?

sullen trellis
#

Weird, i can still chop trees without equipping the axe

meager granite
#

Post full condition script here

sullen trellis
#

No, i found this code in the web after 2 weeks of searching 😄

meager granite
#

Also changed it again, give it a try

#

Didn't realize its a condition for exit, not for the action to appear

#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
meager granite
#

Please format your code

#

You added your weapon check into action code, not condition code

#

tag_fnc_isTargetTree is the function that checks if its a tree

#

Check for the axe there

tough abyss
#

Createunits should work fine
With Units can get units to stop / override their move commands.
But with Agents you can't override the move command, best you can do is tell them to stop. But they will continue there movement when you allow them to

winter rose
#

@sullen trellis please use pastebin for big code chunks, thanks

sullen trellis
tough abyss
#

Am using doMove doStop etc

hushed tendon
#

So I’m creating essentially custom fortifications like a sandbag wall but with objects like the brown sack so they’re in pieces so they can be “built” up but due to there being like 10-30 objects per fortification I’m making them simple objects but also trying to detect when they take damage/shot. I was messing around with this last night and found that while the simple objects don’t detect being shot they still have bullet effects and block the bullet. I tested this by having an object behind them that detected when it was shot but the rounds fired at the simple objects were stopped by the simple objects. My question is, is there a way to detect when a simple object is shot as it seems to have collision or is there a way to fully remove the collision and just have something like a carpet that has had its texture removed so it’s “invisible” but still detects the shot from within the “wall” of the fortification?

#

Going to continue testing later but was wondering if any of you had some suggestions or knowledge on the matter

little raptor
#

It doesn't make much difference in terms of performance anyway (sandbags use the house simulation which is pretty much just as fast as simple objects)

hushed tendon
#

Like logs, h barriers, etc

#

Similar to Squad fortifications

#

Just worried about performance because just single fob would be like almost 1000 objects

little raptor
#

1000?!

hushed tendon
#

Well just one fortification like a sandbag wall like I’m doing is about 20 objects

#

I’m aware performance won’t be as great as if I’d just made my own models and such but trying to make it workable at least

little raptor
#

Well in any case using simple objects won't make much difference here

hushed tendon
#

Super simple objects?

stable dune
meager granite
#

HandleDamage doesn't execute on non-destructible objects, so your only choice is HitPart and Explosion event handlers

#

These won't tell you how much damage they did, but you can sort of estimate it

hushed tendon
#

Is there a way to just have a model using the p3d? Because the simple objects still has bullet collision

meager granite
#

Fire geometry is a part of model, you can't disable it

hushed tendon
#

:/

#

I love arma

still forum
#

(['\tree',((getModelInfo _cursorObject) select 1),FALSE] call BIS_fnc_inString)
and
((((getModelInfo cursorObject) # 1) find "\tree\") != -1)

are just
"\tree\" in (getModelInfo _cursorObject select 1)

stable dune
#

Awesome. Thanks.

meager granite
#
toLower(createHashMapFromArray namedProperties _object getOrDefault ["class", ""]) find "tree" >= 0
```Something like this could be better perhaps?
stable dune
plush belfry
#
//params defined by user.
params ["_objectname", "_pictureName"];

//To test info inside variables.
hint str _objectname;
sleep 5;
hint str _pictureName;

//To apply script to _objectname and use path stored in _picturename.
[_objectname, ["Show Image" , {_objectname setObjectTextureGlobal [0, "_picturename"]}]] remoteExec ["addAction"];

Hey, I am having trouble figuring out how can I insert variable information into a string.
Specifically this part.

[0, "_picturename"]

How do I get the script to insert the string saved inside _picturename?

hallow mortar
#

Just use _pictureName, no quotes. It already contains a string, no need to convert it, just provide the variable and its contents will be used.

#

You also don't need to do str _pictureName for your test hints - the variable already contains a string, so just hint _pictureName would work fine.

#

(I often find it easier to use systemChat for debug messages rather than hint, because it lets you have multiple messages in quick succession and they'll all be available in the chat log, rather than wiping each other out)

plush belfry
plush belfry
hallow mortar
#

https://community.bistudio.com/wiki/addAction
The action code has access to certain predefined variables, which you can access with params:

params ["_target", "_caller", "_actionId", "_arguments"];```
`_target` is the object the action is attached to, so you can use that instead of `_objectName`.
`_pictureName` is not inherently available on its own, but you can pass it into the action so it will be available in `_arguments`. Things to pass in as arguments can be specified after the action code when creating the action.
```sqf
[_objectName,[
  "Show Image", {
    params ["_target", "_caller", "_actionId", "_arguments"];
    _target setObjectTextureGlobal [0,_arguments#0];
  },
  _pictureName
]] remoteExec ["addAction",0,true];```
(note addition of `true` JIP flag in the remoteExec parameters, so the action will be available for clients that join after this code runs)
#

I'd suggest using some of the other addAction parameters too, such as the radius restriction - might want people to have to get closer than 50 metres to interact with the object...

plush belfry
cobalt sorrel
#

Hey peeps.

Our community is in the process of making an event, we're about to test PT1 or two, but there's one kink we want to iron out before doing a full test run on it.
It relates to this script.

We're trying to destroy dragon teeth objects when an explosive well... explodes next to it, for a beach landing.
The following works in SP and local MP, but not dedicated MP.
Could someone advice?

https://pastebin.com/1MAEJeA5

Edit: added pastebin link

#

Dang

winter rose
#

please don't post a big chunk of code

cobalt sorrel
#

It's to long to paste

#

Yeah..

winter rose
cobalt sorrel
#

haha

#

doing that now

little raptor
# obtuse crypt Hi, one more question, is it possible that it shows dependency mods also?
_cfg = loadConfig "mission.sqm";
_addons = getArray(_cfg >> "addons");
_cfgPatches = configFile >> "cfgPatches";
_addons insert [-1, configSourceAddonList(configFile >> "CfgWorlds" >> worldName), true];

_dep = _addons;
while {count _dep > 0} do
{
  _newDep = [];
  {
    _newDep insert [-1, getArray (_cfgPatches >> _x >> "requiredAddons"), true];
  } forEach _dep;
  _dep = _newDep - _addons;
  _addons append _dep;
};

_mods = _addons apply { configSourceMod (_cfgPatches >> _x) };
(_mods arrayIntersect _mods) - [""];
#

give that a try and let me know if it works

#

fixed some errors so copy again if you saw it before this message

spiral narwhal
#

right, so im currently trying to optimize a mod and turn a script into a function

#

since you can run it multiple times

#

will post code in a second

#

at first, it wasn't working. got an error. but after i tried to change the params of the call, my game just freezes and crashes

opal zephyr
#

Are you doing this in an addon or a mission config?

spiral narwhal
#

addon

obtuse crypt
little raptor
opal zephyr
# spiral narwhal addon

What does your cfgFunctions class look like in the config, and what does the call like look like

spiral narwhal
# opal zephyr What does your cfgFunctions class look like in the config, and what does the cal...

My cfgFunctions

class CfgFunctions
{
    class TLX
    {
        class Cars
        {
            file = "\tlx_base\cars";
            
            class uaz469
            {
                preInit        = 0;
                postInit    = 0;
                ext            = ".sqf";
                preStart    = 0;
                recompile    = 0;
            };
        };
    };
};

The call

[_this] call TLX_fnc_uaz469

The function start (which I imagine is the problem)

/*
Author credits here
*/
diag_log "LIGHTS WORKING";
private["_vcl", "_lights", "_lights0", "_lights1", "_lights2", "_lights3"];
_vcl = _this;
_lights = "forbidden_name\data\RKL_151_red_co.paa";
_lights0 = "forbidden_name\data\RKL_151_co.paa";
_lights1 = "forbidden_name\data\black_co.paa";
_lights2 = "forbidden_name\data\RKL_151_co.paa";
_lights3 = "forbidden_name\data\RKL_151_a.paa";
_lights4 = "forbidden_name\data\RKL_151_red_co.paa";
_lights5 = "forbidden_name\data\RKL_151_red_a.paa";

hint localize "STR_Veh_Lightbar_ON";

if ((_vcl getVariable "lights")) exitWith {

    hint localize "STR_Veh_Lightbar_OFF";

[...]
obtuse crypt
little raptor
#

well it only checks mission dependencies, not terrain

spiral narwhal
obtuse crypt
spiral narwhal
#

and it threw me an error for _vcl = _this, expected something got something else

#

so then i changed it to _this in the call and now my game crashes whenever it runs

opal zephyr
#

hm odd, if it was getting into the function that it should be actually calling correctly

spiral narwhal
#

so how its being called, or rather the circumstance i should say

#

its an addAction for the driver pos of a vehicle

#

before the call was

this execVM "\some\path";

little raptor
opal zephyr
#

try using params, replace your _vcl = _this to params["_vcl"];

spiral narwhal
opal zephyr
#

can I see the addactions code

spiral narwhal
#

perhaps addaction was the wrong word to use

#
class UserActions
        {
            class code2_3
            {
                displayName="$STR_Veh_LightBar";
                position="drivewheel";
                radius=1000;
                condition="driver this == player";
                statement="[_this] call TLX_fnc_uaz469";
                onlyForplayer=0;
            };
            MACRO_TURN_LEFT_ALLUMAGE
            MACRO_TURN_LEFT_ETEINT
            MACRO_TURN_RIGHT_ALLUMAGE
            MACRO_TURN_RIGHT_ETEINT
        };

#

UserAction inside a config.cpp

#

CfgVehicles

opal zephyr
#

The wiki says with useractions you should be using this and it refers to the object the action is attached to

#

is that the value you want to be getting?

spiral narwhal
#

i will try with "this" instead of "_this" and report back

#

i just read the description of "_this" in the magic variables wiki and was left dumbfounded

spiral narwhal
#

i think i cut off the code right before the problem

opal zephyr
#

no

spiral narwhal
#
diag_log "LIGHTS WORKING";
private["_vcl", "_lights", "_lights0", "_lights1", "_lights2", "_lights3"];
_vcl = _this;
_lights = "forbidden_name\data\RKL_151_red_co.paa";
_lights0 = "forbidden_name\data\RKL_151_co.paa";
_lights1 = "forbidden_name\data\black_co.paa";
_lights2 = "forbidden_name\data\RKL_151_co.paa";
_lights3 = "forbidden_name\data\RKL_151_a.paa";
_lights4 = "forbidden_name\data\RKL_151_red_co.paa";
_lights5 = "forbidden_name\data\RKL_151_red_a.paa";

hint localize "STR_Veh_Lightbar_ON";

if ((_vcl getVariable "lights")) exitWith {

    hint localize "STR_Veh_Lightbar_OFF";

    _vcl setVariable["lights", FALSE, true]; //<---------------- This is the first defining of the variable

    sleep 0.5;

    _vcl setObjectTextureGlobal[3, ""];
    _vcl setObjectTextureGlobal[4, ""];
    _vcl setObjectTextureGlobal[5, ""];
    _vcl setObjectTextureGlobal[6, ""];
    _vcl setObjectTextureGlobal[7, ""];
    _vcl setObjectTextureGlobal[8, ""];
    _vcl setObjectTextureGlobal[9, ""];
};

_vcl setVariable["lights", TRUE, true];

while {
    (alive _vcl) && (_vcl getVariable "lights")
}
do

[...]
opal zephyr
#

change the statement to, "systemChat(format["%1",this])" and see what it says in chat

spiral narwhal
opal zephyr
#

the one in cfgVehicles

spiral narwhal
#

ok

spiral narwhal
#

getting this error on boot

opal zephyr
#

show me the line in the config

spiral narwhal
sullen sigil
#

' not "

opal zephyr
#

oh, woops, use ' '

#

ya mb

spiral narwhal
#

thats what i was thinking lol

#

good thing for code editors and coloured syntax 😄

spiral narwhal
opal zephyr
#

Oh, well yes I should have expected that. If you're attaching it to you then it will show you as the object

#

What value are you trying to get out of this?

spiral narwhal
# opal zephyr What value are you trying to get out of this?

i'm not trying to return a value to the function. correct me if im wrong but execVM is deprecated now and since this script will be running more than once (its like on/off switch) a lot on a multiplayer server, im just trying to turn it into a function to save on performance

opal zephyr
#

yes the function seems to work fine, its not the problem. the problem is that the variable you are passing into the function is wrong

spiral narwhal
#

so originally, the statement was just this:

statement="this execVM '\forbidden_name\scripts\code2_3.sqf';";
#

it didnt really pass a variable (afaik)

opal zephyr
#

this is the variable its passing

#

It should have been passing the player object as the variable

#

What is _vcl supposed to be?

spiral narwhal
#

_vcl = _this;

#

to me it would make more sense that it would be vehicle player whats its passing

opal zephyr
#

😂 No I mean like what is the actual value, like is it a car, a tree, whatever what do you WANT it to be>

#

this when used with UserActions passed the object that the action is attached to, in your case, the player object

spiral narwhal
#

ah ok

#

so i will try [vehicle player] call my_function in the statement now

opal zephyr
#

if your player is in a car, then the car object will be returned instead of the player object. If you always just want the player object then use player

spiral narwhal
#

it passes "this"

#

how would i pass "this" with the function?

stable dune
#

Your userActions is added to class car?

statement = "this call TLX_fnc_uaz469";
opal zephyr
#

Ya give that a try

opal zephyr
#

whats the error

stable dune
#
23:57:14 "B Alpha 1-1:1 (prisoner) (Tl_Shore)"
systemChat "LIGHTS WORKING";
private["_vcl", "_lights", "_lights0", "_lights1", "_lights2", "_lights3"];
_vcl = _this;
diag_log str _this;
      class code2_3
            {
                displayName="Test";
                position = "camera";
                radius=10;
                condition="true";
                statement = "this call TLX_fnc_uaz469";
                onlyForplayer=0;
            };

if added to class car , to object, not class man

spiral narwhal
tawdry hatch
#
_spawncrate = _this Select 0;

if (!isDedicated) then {
    waitUntil{!(isNull player)};

///
    _statment1 = {"ACE_medicalSupplyCrate_advanced" createVehicle getMarkerPos "spawnCrate"};
    
    _medbox = ["medbox","Medical Supply Crate","",{_statement1}, {true},{},[], [0,0,0], 100] call ace_interact_menu_fnc_createAction;
    
    [_spawncrate, 0, ["ACE_MainActions"], _medbox] call ace_interact_menu_fnc_addActionToObject;
};
#

So ace interact works, but the statement line won't work

opal zephyr
#

you misspelt statement

tawdry hatch
#

thx

#

hmm still not working, crate won't spawn in

#

Works now

#

remove the brackets of Statement call in _medbox line

opal zephyr
#

ah ok, nice

dreamy kestrel
#

Q: on getOrDefaultCall, trying to prepare a _y with default arguments, but I wonder might be referring to an undocumented magic HASHMAP value, that is not there yet i.e. nil ... in keeping with apply etc.

private _spawnMarkerRoads = createHashMap;
private _mode_3d = false;
private _doNotSort = false;
private _y = ["", _roadTypes, _capRadius, _doNotSort, _mode_3d];
{ _spawnMarkerRoads getOrDefaultCall [_x, { _y set [0, _x]; nearestTerrainObjects _y }, true]; } forEach _spawn;
// SPAWN refers to some map marker candidates, CAP RADIUS what it sounds like, radious about which to consider
// _x, assumed to be a SPAWN marker, that, or also a magic var to the target key

The log:

23:35:25 Bad conversion: array
23:35:25 Error in expression <getOrDefaultCall [_x, { _y set [0, _x]; nearestTerrainObjects _y }, true]; } for>
23:35:25   Error position: <nearestTerrainObjects _y }, true]; } for>
23:35:25   Error 0 elements provided, 3 expected
dreamy kestrel
meager granite
dreamy kestrel
#

what is an invalid position?

#

oh wait I see it never mind duh

meager granite
# meager granite Log looks like typical invalid position argument

When you provide non-position as argument for position, like:

createVehicle [typeOf player, nil]
```=>

11:54:29 Error in expression <createVehicle [typeOf player, nil]>
11:54:29 Error position: <createVehicle [typeOf player, nil]>
11:54:29 Error 0 elements provided, 3 expected

#

Seeing that you use _x as key, you probably have map marker names instead of position there, thus the error

dreamy kestrel
#

I see it, was a marker _x, not markerPos _x

#

Q: 1e39 is infinity right... is -1e39 considered a number? getting not a number errors on, so I wonder:

_args params [
   ['_value', 0, [0]]
];

is there a way to receive that when it is so far invalid and "should" be that? i.e. infinity or -infinity
thanks...

granite sky
#

IIRC getOrDefaultCall surprisingly lacks any magic variables. So _x and _y will be from the calling code.

dreamy kestrel
meager granite
#

Use finite if you want to filter it out

granite sky
#

Works:

_v = -1e39;
_v call {
    params [["_w", 1e39, [1e39]]];
    _w;
};
meager granite
#

[typeName -1e39, typeName 1e39, typeName 100] => ["NaN","NaN","SCALAR"]

granite sky
#

Yeah, I guess the issue is that you'd also permit real NaNs.

#

I feel like if you're passing infinities around you're asking for trouble.

sullen sigil
#

the only infinity that exists in arma is my love for sqf

meager granite
dreamy kestrel
#

ah okay I see... good to know, thanks...

#

actually in this case I have [[], [], -_inf] as the response, so I test on the first two bits.
then if the response is valid, i.e. "not", I scan for the number afterwards.

chrome hinge
#

Anyone know if setVehicleTIPars affects the AI detecting vehicles with plane ir sensors?

warm hedge
#

It should AFAIK. It's undetectable 0 or detectable not 0 tho

chrome hinge
#

So its max range detection right when it heats up?

warm hedge
#

I think I haven't tested if distance vs tiPars is somehow related

rough dagger
#

Hello good people, I was wondering if anyone knew of a good VS Studio Code extension that can remove comments on a folder/bulk level (not file level), in SQF? Unlikely, but I thought I'd check in with the experts 🙂

maiden raven
#

@tough abyss doStoped it, but still keeps on running off, gonna just disable anim

tough abyss
#

Ahh yeah forgot about the unit group system, will try to regoup etc... its annoying

little raptor
#

you don't need an extension for that. a simple regex can do it

little raptor
hardy valve
#

Using trigger to play 3d sound if a plane is near by, it bricks the server... I think this is due to the fact its checking every unit in a 5 sec period.

Is there anyway to optimize a trigger and or add event handler to play 3d sound from a specified object if a plane is detected within X meters of the device? Or an alternative method that is not so heavy?

rough dagger
#

Ive been putting off learning regex haha .. I’ll give it a go thanks @little raptor

winter rose
#
  • you have an issue
  • you learn regex to fix it
  • now you have two issues
meager granite
#

Do units collide with GEOM or PHYSX of vehicles? 🤔

#

I guess it should be GEOM

meager granite
#
    onEachFrame {
        private _from = player modelToWorld [0,0,1];
        private _to = v modelToWorld [0,0,0];

        private _intersect = [v, "GEOM"] intersect [_from, _to];
        systemChat str _intersect;

        if(count _intersect > 0) then {
            drawLine3d [_from, _to, [0,1,0,1]];
            {
                drawIcon3D ["\A3\ui_f\data\map\markers\military\destroy_ca.paa", [1, 1, 0, 1], _from vectorAdd (_from vectorFromTo _to vectorMultiply (_x select 1)), 0.5, 0.5, 0, _x select 0, false, 0.04, "PuristaMedium"];
            } forEach _intersect;
        } else {
            drawLine3d [_from, _to, [1,0,0,1]];
        };
    };
```What am I doing wrong? Why cant I get any `GEOM` intersects with a CH-67 Huron?
#

v is the helicopter

#

Tried with a tank, it only intersects with a turret, not the body 🤔

#

Is intersect broken?

little raptor
#

What is it supposed to intersect with?

#

You're ignoring v

#

nvm this command works different meowsweats

little raptor
#

Use lineIntersectsSurfaces instead

meager granite
little raptor
#

I once had an idea to expand the lineIntersectsSurfaces command to have include and exclude filters

#

Instead of just exclude obj1 obj2

hallow mortar
#

At least an array of excludes rather than just 2 seems sensible

meager granite
#

Maybe turn first exclude into array of includes and second exclude into array of excludes

#

If these arguments are array, use new logic, if they're entity, use old single exclude

little raptor
#

That's the idea yes

meager granite
#
lineIntersectsSurfaces [pos1, pos2, [obj1, obj2, obj3, obj4], player]
#
lineIntersectsSurfaces [pos1, pos2, [obj1, obj2, obj3, obj4], units group player]
#

Anyway, my original intent for this was to try to find an object that's more likely collided with the player and damaged them

#

Sadly there is no EPEContactStart event even if EPE object damages the player

hallow mortar
meager granite
steel shadow
#

Is there a way to disable mortar cameras changing angle and elevation? (Don't know where else to ask this)

potent depot
#

Anyone know if using setGroupOwner with large ai group sizes( > 50)adds additional strain on server processing?

hallow mortar
#

It will probably take very slightly longer to complete the transfer because, well, more things to do, more/bigger network messages to send. But it's a one-time transfer, it won't have any effects after it's done, other than the receiving machine now having to handle 50+ more AI than before.

still forum
#

Transferring unit locality adds strain yes.

potent depot
#

Thought as much, but I dont think it would be significantly more strain than a smaller group right?

restive hinge
#

Hi guys, im tryna make an action button for ACE interaction menu. Ive had buttons that work ok, but for some reason this button wont work:

_playerUID = "76561198040777688";
_playerAction = ["PlayerActionName","Get Equipment","\a3\ui_f\data\igui\cfg\simpletasks\types\rearm_ca.paa",{
  // Action  
    _preset = ["myArrayPresetIsHere"];
    player setUnitLoadout _preset;
    hint "Action is complete";
    },{
        // Condition
        getPlayerUID player isEqualTo _playerUID;
        },{},[_unit],[0,0,0], 100] call ace_interact_menu_fnc_createAction;
[this, 0, ["ACE_MainActions"], _playerAction] call ace_interact_menu_fnc_addActionToObject;

I suspect the UID check condition to fail, although if i check the UID in debug using: getPlayerUID player == "76561198040777688"; or even strict comparison getPlayerUID player isEqualTo "76561198040777688"; it returns true, the action is created, but nothing happens, even the hint message.

#

I guess I have to pass the player variable as the parameter?

fair drum
#

You have _unit passed into the create action function

#

Geez formatting on phone looks terrible. Hard to read

restive hinge
#

Uh sorry for the array

#

Yep, I see

fair drum
#

You'll need to pass the uid to check too since that's not in the functions scope

#

Damn autocorrect lol