#arma3_scripting

1 messages ยท Page 27 of 1

sullen sigil
#

i will presume this is a no

amber lantern
sullen sigil
#

do you know how

tough abyss
#

@still forum Apologies for the ping but since this was being talked about earlier, I saw that the GitHub for intercept hasn't really changed in a couple of years, is this anything to worry about for development? I have a few scripters who are interested in using it (for performance reasons)

finite bone
#

I have this code:

{
 if ((_x isKindOf "LandVehicle") or (_x isKindOf "Air")) then {
    _vichitpoints = getAllHitPointsDamage _x;
    
    /* add 0.2 damage to specific parts over exisiting damage */
};
} foreach _nearbyunits;
``` I'm trying to add damage to specific parts of the hitpoints based on the hitpoint names received in the _vichitpoints list. How'd I go about in doing this in an efficient away instead of typing in all hitpoints individually.
finite bone
jade acorn
#

anyone here ever used the HALs Store script? I'm trying to add an ammo box as a valid type of container for stuff to buy or sell but no matter what classname I try, it doesn't show up. Container types are defined through containerTypes[] = {"LandVehicle", "Air", "Ship"};, I checked most of the files and couldn't find which one valids the type of container if it doesn't take anything else into that field

tough abyss
#

Does anyone know of a good youtube series to learn SQF/arma scripting?

finite bone
tough abyss
#

Mostly my struggle is with understanding the organization of scripts and mods

#

and also learning the language commands/types

tough abyss
dreamy kestrel
# blazing zodiac I would start by reading through these: https://community.bistudio.com/wiki/Arma...

Scripting commands and functions are indispensable IMO
https://community.bistudio.com/wiki/Category:Arma_3:_Scripting_Commands
https://community.bistudio.com/wiki/Category:Arma_3:_Functions
Would also suggest Visual Studio Code as your editor, including a couple of key extensions:
SQF Language Updated v2.1.0 (blackfisch) / https://github.com/Armitxes/VSCode_SQF
SQFLint v0.12.1 (SkaceKachna)
There are a couple other extensions depending on your editing environment and how automated you want things to be, i.e. time stamps.
Between the language and LINT, it's not perfect, but it gives you pretty decent clues how close your code is to 'working' before running any servers.
And of course any other tooling you might need, Git for source control, I use Beyond Compare as a difference viewer, and so on.

tough abyss
blazing zodiac
sullen sigil
#
switch ((_x in _array1) or (_x in _array2) or (_x in _array3) or (_x in _array4)) do {
case _array1: {/*run stuff*/};
case _array2: {/*run stuff*/};
case _array3: {/*run stuff*/};
case _array4: {/*run stuff*/};
};```
i dont think this is correct use of the `switch` statement, is anyone able to correct where ive gone wrong in the first line to make `case _array#` work please?
tough abyss
#

Switch on true and make the arr1 in arr2 statements your cases

sullen sigil
#

ah, thought it would be that simple -- thanks :)

crude needle
# tough abyss Is there an article or a resource for explaining file structure for scripts

It's pretty liberal. You can put your scripts just about anywhere you want as you have to define a relative path to it at some point; be that in configuring a function or using something like execVM command. What's your specific use case? It would be much easier to explain.

For missions they just need to be under the mission folder, addons (mods) can be slightly more complicated if your wish. This is a decent explanation of basic addon structure.
https://community.bistudio.com/wiki/Arma_3:_Creating_an_Addon#Addon_Prefix

tough abyss
#

SQF doesn't require integral types for switch statements like C/C++, can go pretty wild with them

sullen sigil
#

so something like

switch (true) do {
case (_x in _arr1): {systemchat "1"};
case (_x in _arr2): {systemchat "2"};
};``` and so on, right..?
tough abyss
#

yup

sullen sigil
#

hmmmmm

#

if _arr1 is an array pulled out of a .hpp file, it should still work, right?

tough abyss
ionic prairie
#

I am using CBA_loadingScreenDone in my initPlayerLocal.sqf, however even with that being used, my mission still has some sort of loading screen happening after I press start from the map screen, thus making me miss some seconds of being able to see my fancy pancy intro I am doing. does anyone know a better alternative way of waiting for loading screens to be done?

tough abyss
#

@sullen sigil Whether it's from a .hpp file or not is irrelevant - data included in a file via #include is basically just copy-pasted into the file at the spot where the #include statement is

#

so as long as the code in the .hpp file is valid, it shouldn't matter at all

sullen sigil
#

so just _arr1 = ["classname", "classname2"] right? (in the .hpp)

tough abyss
#

yes

sullen sigil
#

hm... systemchat checks dont seem to be working

tough abyss
#

what's the full code

sullen sigil
#
#include "classnames.hpp"
addMissionEventHandler ["Draw3D", {
    { switch (true) do {
    case (_x in _arr1): {drawIcon3D [getMissionPath "img\target.paa", [1,0,0,1], ((ASLToAGL getPosASLVisual _x) vectorAdd[0,0,1]), 2, 2, direction _x, "", 0, 0.03, "PuristaMedium", "center", true];};
    case (_x in _arr2): {drawIcon3D [getMissionPath "img\target.paa", [1,0,0,1], ((ASLToAGL getPosASLVisual _x) vectorAdd[0,0,1]), 2, 2, direction _x, "", 0, 0.03, "PuristaMedium", "center", true];};
    case (_x in _arr3): {systemChat "b"};
    case (_x in _arr4): {systemChat "c"};
    };} forEach (ASLToAGL getPosASL player nearEntities 20);
}];
tough abyss
#

that'd be your issue

sullen sigil
#

uh oh

tough abyss
#

The _arr1..._arr4 won't be defined in the Draw3D event handler

sullen sigil
#

ah right lol

tough abyss
#

move your #include inside the {} of the EH

sullen sigil
#

that also doesnt seem to work thonk

#

literally just flipped lines one and two

hallow mortar
#

Fix your indentations, I keep trying to read this and getting lost >:|

tough abyss
sullen sigil
#

here is vsc screenshot

#

(obviously with 1 and 2 not flipped here)

shut reef
#
call {
    if (_displayName == QGVARMAIN(Android_dlg)) exitWith {
        call {
            if (_mode != "BFT") exitWith {_mode = "BFT"};
            _mode = "MESSAGE";
        };
    };
};

Is there something about putting random code in call {} blocks that has any desirable effect?

hallow mortar
#

Not really, no

shut reef
tough abyss
#

Where is class CfgFunctions stored? in Description.ext?

#

because it's useful when you want to execute code without defining a named function separately

shut reef
hallow mortar
shut reef
tough abyss
#

Except you can store the return value

hallow mortar
#

Note that the actual function scripts are not usually in CfgFunctions, CfgFunctions just points to the script files located in the mission folder

tough abyss
#

In the case you're showing, yes, it's not very useful

shut reef
# tough abyss but it *can* be

If you stored it, sure, but the code I'm working with has this all over the place and I'm frankly offended. Thought I'd check with you folks to make sure I've not just not been initiated into some secret

tough abyss
#

In that case it's ugly code from someone who doesn't understand what call does

#

which is unfortunately common

#

same thing with people spamming execVM

shut reef
#

In it's defense, the code is about 8 years old

#

but wtf

#

xD

sullen sigil
tough abyss
#
class CfgFunctions // Functions library
{
    class ZEEK { // ZEEK_fnc_exampleFunc

        class FunctionsA { // the function category

            class example {}; // a function
            
        }

    }

}

And so the function example would be at <root>/FunctionsA/example.sqf

yes?

sullen sigil
#

as well as cfgfunctions biki

tough abyss
#

Okay

shut reef
sullen sigil
hallow mortar
sullen sigil
#

...and it is an issue with my code...

#

_x isnt classnames yet ๐Ÿ™ƒ

hallow mortar
#

That'd do it

sullen sigil
#

it did indeed

shut reef
#

What's that code doing? Painting target markers on other players?

sullen sigil
#

ya

#

x ray vision ๐Ÿ˜ตโ€๐Ÿ’ซ

shut reef
#

You might want to consider to move the logic out of the event handler and update it elsewhere, then just run loops over your arrays. Checking all entites over 4 arrays feels costly per frame

sullen sigil
#

proof of concept atm

hallow mortar
# tough abyss ```hpp class CfgFunctions // Functions library { class ZEEK { // ZEEK_fnc_ex...

If you're doing this from description.ext, it will look for the function at <mission folder>\Functions\FunctionsA\fn_example.sqf. It includes the Functions layer when in description.ext, but not when from a "true" config file (e.g. in a mod).
Note that you can specify a particular folder to look in in the category class, e.g.

class ZEEK {
  class FunctionsA
  {
    file = "FunctionsA";
    class example{};
  };
};```
will cause it to look for `<mission folder>\FunctionsA\fn_example.sqf`
Also note that the `fn_` at the start of the sqf file name is important.
<https://community.bistudio.com/wiki/Arma_3:_Functions_Library>
sullen sigil
#

optimisation comes later on

shut reef
hallow mortar
#

Side note, it bothers me a lot when people go "oh go ask config people" for CfgFunctions stuff. It is technically a config but it's so innately tied to scripting that there's no point arguing about it. It's also...not that complicated.

sullen sigil
#

config makers channel gets less traffic so is less likely to get lost in the soup

tough abyss
#

I am curious if you send script commands for an AI to do something does it override the engines commands

#

or are they competing

slender olive
#

Just need a bit of help knowing how to make a cutscene video play before a mission. I have the mission and cutscene made, and the video I want played is in .OGV format, I just want to know how to play the video, then have the mission start immediately after. It's for a campaign I'm working on

#

I also want to use the BIS_fnc_playVideo btw

tender fossil
#

My extension for Arma is finally complete! Yay! I've already done quite a bit of refactoring and once I finish it and test it more, I might release it as open source. (It's a "smart" anti-stacking system based on the scores of players in a TvT mission.) Related plug-ins might also follow. Thanks for helping me guys rotatingparrot

naive needle
#

Can I change the marker system that they are only local ?

south swan
#

what "marker system"?

naive needle
#

the one from arma

#

when I left click on the map

#

Is there a option to disable that its getting synced with every player in the channel.

#

And I dont want to disable the channel either

south swan
#

i don't think there is a vanilla option for that.
EH can maybe work, but no guarantees on it working at all (or not breaking stuff). sqf addMissionEventHandler ["MarkerCreated", { params ["_marker", "_channelNumber", "_owner", "_local"]; if (!_local && {isPlayer _owner}) then {deleteMarkerLocal _marker}; }];

naive needle
#

thank you, I will give it a try

tough abyss
#

What is the best way to organize scripts for missions? E.g how do I structure intro/task related scripts/sequencing etc?

open fractal
#

CfgFunctions categories imo

copper raven
copper raven
copper raven
sullen sigil
still forum
tough abyss
shut reef
finite bone
#

I'm trying to check whether the defined (user input) classname of the object exists before creating it. Which of these (if any) is correct for the said function? The input _input_vic is passed as a string.
A: ```sqf
if (!isNil _input_vic) then
_created_vic = createVehicle [_input_vic, [0,0,0], [], 0, "CAN_COLLIDE"];

B: ```sqf
if (!isNull _input_vic) then 
_created_vic = createVehicle [_input_vic, [0,0,0], [], 0, "CAN_COLLIDE"];
south swan
#

i'd say this, so you don't get log spam when creating scope=0 things ๐Ÿคทโ€โ™‚๏ธ sqf if (getNumber (configFile >> "CfgVehicles" >> _input_vic >> "scope") > 0) then { _created_vic = createVehicle [_input_vic, [0,0,0], [], 0, "CAN_COLLIDE"]; };

sullen sigil
#

having the big mind melt trying to do this -- how would i toggle the effects of a missioneventhandler? i.e -
code executes first time, missionEH added
code executes second time, missionEH removed
third time added, fourth removed etc

#

im like 90% sure its a super easy thing but i am super stupid

hallow mortar
#

Code sets a variable, and the first line in the mission EH is an exitWith depending on the state of that variable

sullen sigil
#

ah, thanks

cerulean badge
#

Hi

hallow mortar
#

Remember you can invert booleans with !, e.g.

kjw_var_state = true;
kjw_var_state = !kjw_var_state;```
sullen sigil
#

yeah, think i just suffer from the stupid

#

I use _thisEventHandler as the index in the remove, right?

hallow mortar
#

Yes, provided you are using it inside the EH code

sullen sigil
#

wait global variable is still local to each machine isnt it

hallow mortar
#

Yes, unless it's broadcast for some reason (publicVariable, setVariable with broadcast true, etc)

sullen sigil
#

god i really do suffer from the stupid

#

i was trying to do it all with private variables because i thought public variables = global variables

hallow mortar
#

The main reason for using private and local variables is to avoid conflicts with other scripts, or other instances and scopes of the same script. Just remember to account for that as applicable to your script (i.e. don't use super generic variable names)

sullen sigil
#

ah I can't use _thisEventHandler as the EH runs on each frame (Draw3D)

#

I guess I'd just make the index global?

hallow mortar
#

Seems likely

sullen sigil
#

goated

south swan
sullen sigil
#

because it removes it after each frame :p

south swan
#

you mean after running once?

sullen sigil
#

ya

#

i've got it working as intended now

#

i think

south swan
#

code executes first time, missionEH added
code executes second time, missionEH removed
third time added, fourth removed etc

because it removes it after each frame
adding EH on even frames and deleting on odd ones? What?

sullen sigil
#

I was initially checking if the EH had been added the frame after the EH was added and thus removing it

#

Rather than checking if the EH had been added the frame before the EH was added and removing it if it had been added already

south swan
#

extra O_o
So, 1 is "add EH - frame ends - run EH - it deletes itself"
and 2 is "add EH1 - frame ends - EH1 runs and doesn't delete itself - add EH2 - frame ends - EH1 runs, finds EH2 and deletes itself - EH2 runs"?

sullen sigil
#

no, should never be an EH2

#

im probably explaining this terribly

#

at the moment its

#

code starts -> checks if there is already an EH present, exits with deletion if so --if not--> creates EH

south swan
#

prevent from adding EH for the second time? Only allow one?

sullen sigil
#

yes

south swan
#

then yeah, saving the index returned by addMissionEventHandler seems to be the way. Or just any random "hey, EH is created already, don't bother" boolean flag.

sullen sigil
#

ya, its working now anyways ๐Ÿ˜„

chrome hinge
#

what options i have to play music to a specific player in multiplayer?

open fractal
#

playMusic

chrome hinge
#

I managed to get that to work but im having trouble picking specific player

hallow mortar
#

playMusic has Local Effect, which means it only takes effect on the machine where the command is executed. Options for targeting include remoteExec, use of addAction, or any other means by which code can be made to only execute on particular machines

open fractal
#

use remoteExec

#

you can input the player object

hallow mortar
#

Well, remoteExec is usually a pretty good choice for this kind of thing, but it can depend on exactly what you want to do. For example, if you want to play the music only for the players who enter an area, it might be better to check for that locally to each client, e.g. with a trigger with the condition player in thisList. That's usually easier than checking on the server and remoteExecing to the players, for that use case.

chrome hinge
#

Alright

#

the things im trying to do are basically situational music, halo jumping, underwater, in certain vehicle, close to target etc

quiet geyser
#

hi. i need some help. i want let ai say3d activated by player. the sound should be looped as long a player is in the triggerzone. what i got so far, ai called dead and in trigger i got this while {true} do { dead say3d "woundedguyc_02"; }; problem, loop dont stop when a player leave the triggerzone and frames drop till its unplayible. can someone please help me?

hallow mortar
# chrome hinge the things im trying to do are basically situational music, halo jumping, underw...

Those would all require various degrees of different implementation and some of it will be quite specific to how exactly those scenarios occur.
Usually a trigger is an easy way of activating something when the player is in a particular area - it's up to you to determine where that area is, so that could cover "situational", "underwater", "close to target".
For HALO jumping you could try an event handler that detects when the player ejects from a vehicle, or if it's already scripted, insert the music somewhere into the script. "In certain vehicle" could be covered by a trigger with condition player in yourVehicleVarName, but you might want other conditions too.

hallow mortar
# quiet geyser hi. i need some help. i want let ai say3d activated by player. the sound should ...

while {true} means the loop runs forever, not dependent on the trigger. It starts when the trigger is activated but stopping is not controlled.
You are also running say3D every frame, without waiting for the previous instance to finish. That stacks up pretty quick.

[] spawn { // spawn the loop into a scheduled environment so we can use sleep
  while {triggerActivated yourTriggerName} do  // This condition means it stops as soon as the   trigger is not activated
  {
    dead say3d "woundedguyc_02";
    sleep 1; // adjust this to the duration of the sound
  };
};```
quiet geyser
#

i got another thing that drive me crazy, to make ai stop talking i got this setSpeaker "NoVoice" work great on vanilla ai but for the mod max women soldiers it dont work. is there another way to do it?

open fractal
#

ask the author

south swan
#

this disableAI "RADIOPROTOCOL" seems to be another popular solution to make a unit stop talking

chrome hinge
#

i kinda could make a trigger for the objective proximity too but apparently large trigger areas are not very performance friendly

open fractal
#

attach a trigger to the vehicle
use an event handler

south swan
chrome hinge
#

Thanks for advice!

jade acorn
#

I have a "vehicle spawner" trigger that checks every half an hour for vehicles within half a click and spawns a new one if no vehicles in sight, chosen randomly from a switch do. However I would make it Darwin-proof in case player wants an award and keeps spawning these vehicles until the mission breaks.

how can i maintain these freshly spawned vehicles so if one is abandoned for some time, it will be deleted? I can't make some global garbage collector as there are pre-placed vehicles and some used by AI that should stay.

#

I thought about having them being given a variable and added to some kind of array, but I have no idea how to measure "abandonment" of these cars and idk how to assign variable with random number

#

it's for a SP mission so locality does not matter

open fractal
#

you can potentially add event handlers to timestamp when the vehicle was last used

#

and you can just append the object to an array right? is there a need to generate variable names?

jade acorn
#

I assumed I'd have to keep variables of these objects in array so there is no chance a non-spawned vehicle is deleted

#

and I can't find any EH that would work as a measurer, there is VehicleAdded but I don't think this is the one

willow hound
#
//Spawn new vehicle:
private _newVehicle = createVehicle [...];
MyVehiclesArray pushBack _newVehicle;
//Remove abandoned vehicles:
private _toDelete = MyVehiclesArray select {/* Vehicle abandoned condition */};
MyVehiclesArray = MyVehiclesArray - _toDelete;
{ deleteVehicle _x; } forEach _toDelete;
open fractal
#
TAG_activityTimestamp = {
    params ["_vehicle"];
    _vehicle setVariable ["TAG_timestamp",time];
};

{_vehicle addEventHandler [_x, TAG_activityTimestamp]} forEach ["Fired", "GetIn", "GetOut", "SeatSwitched", "Engine"];
``` quick concept for timestamping vehicle usage, this can be checked along with whether the vehicle is occupied and if there are nearby units for example
#
_vehicle getVariable "TAG_timestamp";
``` will return the last time any of those event handlers fired
little raptor
#

hey. I don't use it with battleEye.
afaik it is, but you should ask Dedmen to be sure

jade acorn
# open fractal ```sqf TAG_activityTimestamp = { params ["_vehicle"]; _vehicle setVariab...

So I set up it like this

  • trigger with condition (count (nearestObjects [travel_hideout_carholder, ["Car", "Tank"], 20])) == 0
  • Execution of file with following code:
_jeep = createVehicle ["C_Offroad_02_unarmed_F", (getPos travel_hideout_carholder)];
{_jeep addEventHandler [_x, HNG_activityTimestamp]} forEach ["Fired", "GetIn", "GetOut", "SeatSwitched", "Engine"];
_jeep setDir (getDir travel_hideout_carholder);
waitUntil { sleep 1; vehicle player == _jeep };
while { alive _jeep } do {
    _lastTimeUsed = _jeep getVariable "HNG_timestamp";
    if ((player distance _jeep > 10) && (_lastTimeUsed >= (time - 20))) then {
        deleteVehicle _jeep;
    };
    uiSleep 1;
}```
and it properly deletes a vehicle when I leave it, however a new vehicle will spawn only as long as I'm in the old one, when I leave it, new car never respawns
#

it didn't work without the waitUntil because variable was empty and this was the first solution that came into my mind

kindred zephyr
#

Hello,

I was wondering if there is a way to manipulate a player inventory based on objects ID, or in this case as described by the command "ID for primary gunner":

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

There are other similar commands that deliver specific IDs, but is there actually a way to interact/delete/modify them using the ID as reference?

little raptor
#

_lastTimeUsed = _jeep getVariable "HNG_timestamp";
if ((player distance _jeep > 10) && (_lastTimeUsed >= (time - 20))) then {
so driving the vehicle by a remote player or AI doesn't count as activity?!

jade acorn
#

these vehicles aren't supposed to be manned by any other player (singleplayer scenario) or AI, and since AI doesn't jump into non-assigned vehicles autonomically I felt it's okay

little raptor
#

ok meowsweats

little raptor
#

anyway, depending on how many vehicles you have you can go several ways about this
if there are several vehicles I personally recommend a single loop

#
while {true} do {
{
  if (player distance _x > 50 && {!alive _x || crew _x findIf {alive _x} < 0}) then {
    if (_x getVariable ["deleteTime", -1] > 0) then {
      if (time > _x getVariable "deleteTime") then {deleteVehicle _x;};
    } else {
      _x setVariable ["deleteTime", time + 60]; //delete after 60s of inactivity
    }
  } else {
    _x setVariable ["deleteTime", -1]
  };
} forEach spawnedVehicles;
sleep 2;
spawnedVehicles = spawnedVehicles - [objNull];
}

I'm a bit rusty... meowsweats

south swan
#

global array that stores auto-spawned vehicles. On spawning new vehicle if there are too many of them in the array - delete the one furthest from the player ๐Ÿคทโ€โ™‚๏ธ i am officially a slowpoke

jade acorn
little raptor
#

yeah

#

minus the select part and after

little raptor
#

actually wait crew also includes dead crew meowsweats

#

use crew _x findIf {alive _x} < 0

sullen sigil
#

is there any easy way to invert players wasd controls for a few seconds

wind hedge
#

This channel was pretty much "end of life" without you

jade acorn
tough abyss
#

I am beginning my scripting journey, hopefully I can find the right resources to actually become competent. So many commands! So many different conventions

south swan
#

SQF is broad but mostly primitive, tbh

tough abyss
#

Oh, the syntax of course, but the commands themselves to interface with the world.. yikes ๐Ÿ˜„

#

I also need to take some time to learn some vector math as well

worthy igloo
#
params ['_group'];
_group addEventHandler ["UnitJoined", {
    params ["_group", "_newUnit"];
    if(count units player > 1) then 
    {
      params ["_group"];
      [_group] spawn (SQLS_PublicArray#3);
    } else {};
}];
``` y is group undefined?
brazen lagoon
#

is it possible to get what addon a faction is from + get classnames from just that addon?

tender fossil
open hollow
#

there is any way to change a stance of a player via script?

jade acorn
open hollow
#

damn, im blind

#

thank you

jade acorn
tough abyss
#

But, A4 wont be out until, hell, 2026?

tender fossil
tough abyss
#

I doubt A4 will be out in 2024 if they just started development

tender fossil
#

It's been in development for a while already though (most likely), it depends on how you define starting the development

#

Engine? Been in the works since 2013. Game itself? We don't know

tough abyss
#

Well its obvious they have been focusing on DayZ/Reforger for a bit now, unless they have been secretly working on A4 in parrallel

tender fossil
#

They probably have been working on it in parallel. Can't say for sure, but it's normal practice in the industry

hallow mortar
#

Reforger is essentially a tech demo for Arma 4. Many parts of Reforger development are also Arma 4 development.

stable dune
#
private _actionPress = 
    params ["", "", "", "_action", "", "", "", "", "", "", ""];
    if (_action) then { 
     //myOwnCodeHere
     inGameUISetEventHandler ["Action", ""];
};
 ["Action", _actionPress];

Does EH return true for all AddActions (which are added to player or how this work , cannot test it currently)

little raptor
copper raven
little raptor
#

you can get which addons modify/create a certain faction

#

to get classname of objects and weapons from addons you can simply read the units[] and weapons[] entries in cfgPatches

#

it's not the best approach but it's the fastest one

stable dune
copper raven
#

_engineName: String - engine based action name ("User" for user added actions)
so _action isEqualTo "User"

#

"user added actions" i assume added via addAction blobdoggoshruggoogly

stable dune
#

Aa, okey

#

Well i must test this out at evening how it works

copper raven
#

but why not just execute code when action is pressed instead?

#

as in, in the action's activation code itself

#
_blabla addAction ["blablabla", {
  call blabla_fnc_onAction;
  // some more code
}];
blazing zodiac
#

Are there any known issues with remoteExec from headless clients to scripts on the server? I'm having trouble remoteExec'ing a script that's in a serverMod from the Headless Client and I'm not sure why else it's not working

winter rose
#

no such known issues AFAIK

blazing zodiac
hallow mortar
#

Have you tested it using a non-HC client?
I'm sure this is just a phrasing thing and you already know this, but just in case - remoteExec doesn't do "naked" scripts, it only does functions and commands. If you need to remoteExec a script, you have to remoteExec execVM with the script as an argument.

winter rose
#

depends if you remoteExec code, a script file, or a function indeed

blazing zodiac
#

It's a function registered in the functions library

#

The function is registered in a serverMod and no "file not found errors" are coming up in the server RPT, so the file as a function should be getting loaded properly

shut reef
#

Maybe the dedicated restricts what can be executed?

blazing zodiac
winter rose
#

your remoteExec code being?

blazing zodiac
# winter rose your remoteExec code being?

This is in the headless client mod and the line is successfully logged to the HC RPT

diag_log format ["HC DEBUG |-> MPKilled Called"];

[_unit, _killer] remoteExec ["HCServer_fnc_handleKillRequest", 2, false];
#

Then, in the server mod, and the inside the function registered as handleKillRequest in the functions library

params [
    ["_unit", nil, [objNull]],
    ["_killer", nil, [objNull]]
];

diag_log format ["HC DEBUG |-> handleKillRequest Called"];
#

I would expect that to get logged to the server RPT but it doesn't for some reason

#
class CfgFunctions 
{
    class HCServer
    {
        class handlers
        {
            file = "HCServer\addons\core\handlers";
            class handleKillRequest {};
        };
    };
};
#

Also, no errors of any kind are logged to either RPT

winter rose
#

file name?

blazing zodiac
stable dune
#

You can try if you change
file = "\HCserver\addons\core\handlers";

I'm done many UI where in description doesn't need 1st but in mod (addon) it is needed

shut reef
#

Have you done a nil check for that function on the server?

#

Or called it locally on the server?

blazing zodiac
#

I have not, but it's in a serverMod that is being loaded (confirmed in the RPT) and the RPT isn't throwing any file not found errors (it does that if it can't find a file that's supposed to be registered in the functions library but doesn't exist)

#

so it should be getting loaded fine, I will try that though

shut reef
#

Try it just to be certain maybe?
Something else might have gone wrong and there are no errors for functions that weren't found

blazing zodiac
drowsy geyser
#

how would i check if a camera was created via camCreate
i tried cameraOn but it still returns the player

warm hedge
#

AFAIK there's no way

drowsy geyser
#

i still love arma XD

warm hedge
#

I hate, no?

#

๐Ÿ˜›

shut reef
#

ah doesn't return, but you should be able to see it in the server logs

#

but yeah, basically join the server, open the console, execute isNil "HCServer_fnc_handleKillRequest"
And if that returns false, try executing it directly

blazing zodiac
#

hmm, so the isNil check when executed with SERVER EXEC does come back true

blazing zodiac
# shut reef yeah, what does it return?

But I did change the path to the file to see if the RPT error for that file missing came up and it did. When I changed it back, it didn't anymore. So it's definitely finding the file...

shut reef
#

Does it return true for this aswell?

isNil "HCServer_handlers_fnc_handleKillRequest"

winter rose
blazing zodiac
#

Alright, I finally got it. It was actually Addonbuilder packing it causing issues. Packing it with PBOman fixed it

south swan
#

as in "if you want to use it in 3DEN or something like that"?

blazing zodiac
#

Is there anyway to tell if a unit is owned by a headless client from the server?

south swan
#

owner _unit == owner _HC?

blazing zodiac
#

I'll try that out, thanks

pulsar bluff
#

is there any way around needing a different SQM file for each terrain, or rather, any way to have multiple SQM files in the same mission directory and have the mission/server select the correct one?

#

we can build a multi-terrain mission, but we need to keep a collection of inflexible mission.sqm around

#

would be ideal to have the ability to select terrain without changing PBO, maybe based on server.cfg

south swan
#

move the logic to the mod (possibly a servermod), keep the bare minimum inside the mission.sqm ๐Ÿคทโ€โ™‚๏ธ

patent lava
#

i remember seeing hearts and minds having multiple .sqm files in the mission folder

pulsar bluff
#

i am imagining in the arma engine, a fileExists search for "sqm\worldname\mission.sqm"

patent lava
#

no clue whatsoever what it does but maybe it is what you're looking for

pulsar bluff
#

thats pretty much what i do now, its just frustrating to need to mess around with mission.sqm files

#

imo if the "worldname\mission.sqm" file is in the directory, we should be able to select terrain from server.cfg and the game can find the correct sqm

sturdy sage
#

Not entirely sure what you are trying to achieve, but you can #include .sqm's in a description.ext i am pretty sure

south swan
#

inb4 using multiple mission folders with everything except mission.sqm sym-(or hard-)linked into them ๐Ÿฟ

pulsar bluff
#

hmm, but the server still requires the mission.sqm in mission directory. basically i want a single generic mission file where i can select the terrain in server.cfg :\

#

a fileExists search for "sqm\worldname\mission.sqm" would be ideal

copper raven
willow hound
#

Isn't the terrain dictated by the PBO name (i.e. missionName.worldName.pbo / the mission root folder missionName.worldName for unpacked missions)?

copper raven
#

it is

#

at most what you can do is some preproc stuff

#

with the __has_include and filepatching? perhaps? idk

#

where you conditionally #include something in the mission.sqm, but again, that will have nothing to do with terrain choice, only the mission data

pulsar bluff
#

hmm interesting, i thought mission.sqm was terrain linked

copper raven
#

it's not

#

mission.Altis > mission.Stratis, same mission.sqm will work just fine (ofc the placement will be total nonsense)

willow hound
#

The mission.sqm is also often the largest file (after media resources like audio or images), so making clients download several of them when they only need one is also krtecek

copper raven
#

just make some shell script that packs pbos for you using different sqms and names them accordingly

#

then in server.cfg all you will need to do is change the worldname

fair drum
#

I've been noticing Killzone_Kid has been using this in his new in-game functions:

// one example
private _valid = _this isEqualType configNull;
_valid = _valid || _this isEqualTo [];
_valid = _valid || _this isEqualTypeArray ["",0,0,0,0,0,0,0,0,0,[],0,0,0,0,false,false];

instead of using params

Is this the new best way of doing this? Or is it just something he always did that is old?

winter rose
#

they are not comparable, here he does more checks

copper raven
#

because you have to put your array argument into another array, else you will break things

#
_fn_setpos = {
  params ["_pos"];
  player setPosASL _pos;
};
[1, 2, 3] call _fn_setpos; // _pos will be 1
[[1, 2, 3]] call _fn_setpos; // ok
#

sometimes people do [_this] params ... to avoid it, but it's also wrong, because then if user passes it "correctly", it will break

cosmic root
#

So I've run into an error I have never seen before. Anyone know what this means?

GIAR pre stack size violation
#

It pops on runtime for the script, and I didn't make any significant changes to the script when it broke

south swan
#

check for this, i guess?

still forum
cosmic root
#

Problem located. I'm an idiot. It was a missing semicolon

sage creek
#

hello

#

Has anyone got any idea of how I would be able to reduce a 30mm autocannons accuracy via script

#

e.g. increase CfgWeapons dispersion value

#

without editing config

copper raven
#

use fired eh

hallow mortar
#

You can't modify CfgWeapons without...modifying CfgWeapons.
You could try reducing the accuracy skills of the gunner AI unit, although this won't affect players or any other AI that switches into the seat.
Possibly you could use a Fired EH on the vehicle to adjust the projectile trajectory after firing, but you'll have to have a very steady hand with the numbers.
You can also use this mod to affect AI accuracy with vehicle weapons overall: https://steamcommunity.com/sharedfiles/filedetails/?id=1862208264

stable dune
warm coral
#

weird question

#

would it be possible to turn the cruise missile into a tv guided missile?

copper raven
#

with some heavy scripting, yes

tough abyss
#

If you disable an AIs features like movement will it still respond to commands in a script? How could you override vanilla AI

copper raven
agile cargo
#

What's the consensus on using profileNamespace for long and complicated persistent missions? On my use case I would not just have one persistent mission, but multiple persistent missions that players can play. Think Antistasi, Mike Force, Vindicta and HeartsAndMinds all available to players.
My gut tells me that bloating the profileNameSpace is not a good idea. When is the profileNameSpace loaded? At every mission start?

copper raven
agile cargo
#

We would play persitent missions during the week, and proper scripted scenarios(missions) on the weekends. They all would be present on the server's mpmissions folder

agile cargo
copper raven
#

it can become corrupted

tough abyss
#

When is it best to separate your code into functions? And which calling method is appropriate?

copper raven
tough abyss
#

wdym boilerplate code

copper raven
#

there is no appropriate calling method, it depends on use case

#

duplicate code

tough abyss
#

ok

copper raven
#

better to seperate it and give each part a name

tough abyss
#

Trying to figure out how I would start fiddling around with scripting but im not sure what to practice

stable dune
granite sky
#

@agile cargo Worst problem for me in practice is that because all data for all mods and missions is in the one file, you can't swap one without the other.

shut reef
lapis ivy
#

Hello. I'm trying to turn the lights on and off. I have a sound from the light bulbs, but I do not understand how I can turn them off. say3d can only be disabled by deleting the object. Can anyone suggest? Mission for multiplayer.

[] spawn {
    while {electricity_on} do {

    if (electricity_on) then {
    
    hint"electricity_on";
        sleep 0.2;
        _obj= "HeliHEmpty" createVehicleLocal [0,0,0];
        _obj attachTo [blight1,[0,0,1.5]];
        [_obj,["neons", 20, 1]] remoteExec ["say3d",0,true];
        sleep 1.8;
        _obj= "HeliHEmpty" createVehicleLocal [0,0,0];
        _obj attachTo [blight2,[0,0,1.5]];
        [_obj,["neons", 20, 1]] remoteExec ["say3d",0,true];
        sleep 4;
        _obj= "HeliHEmpty" createVehicleLocal [0,0,0];
        _obj attachTo [blight3,[0,0,1.5]];
        [_obj,["neons", 20, 1]] remoteExec ["say3d",0,true];
        };        
};
};```
willow hound
#

What is the HeliEmpty object for?

lapis ivy
novel delta
#

Is anyone aware of a way i can add a script to a turrets init that when its upside down the crew wont bail?

#

cant just turn simulation off as i need it to still function

south swan
#

The alternative syntax provides the ability to keep the crew in vehicle when it is upside down.

novel delta
#

Thanks man

#

appreciate it

tough parrot
#
call compile format ["
  _wp setWaypointStatements ['true','[%1] call execParadrop']"
,_transport];

Getting an error about missing ] in the expression [O Alpha 1-1:2] call execParadrop.

south swan
#

translates to "your command doesn't make sense from the syntax standpoint"

tough parrot
#

What is the proper way to get the variable into the statement?

south swan
#

variable by name or the contents of variable?

#

by name - _wp setWaypointStatements ["true", format ["[%1] call execParadrop", "globalVariableName"], but you have a local/private variable (it starts with _) in your example, and it can't be transferred this way

#

by contents - i can't think from the top of my head. Maybe _wp setWaypointStatements ["true", format ["[%1] call execParadrop", _vehicle call BIS_fnc_objectVar], but that's "make a global variable for it and go by the name of this new global variable"

tough parrot
#

the param type is objNull

novel delta
#

another question lmao

Is there any way to disable gravity on a vehicle/turret without turning off its simulation so it still functions?
tried looking but was only able to find directions to disable simulation all together

south swan
# tough parrot the param type is objNull

format makes it into a string ๐Ÿคทโ€โ™‚๏ธ Another workaround would be to setVariable it onto a trigger or some other object, but that also is effectively making a global(-ish) variable

south swan
novel delta
#

alright, thanks regardless

south swan
#

on your "Is there anything similar to the zeus Attach to in eden?": something like [this, objectToAttachTo] call BIS_fnc_attachToRelative in the Init field may work ๐Ÿค”

tough parrot
#

@novel delta you can probably create negative gravity with addForce by using 9.8 in the upward direction per frame.

south swan
#

and it seems to work to hold a vehicle stationary in the air while still having it working ๐Ÿค”

#

as in "detecting enemies, rotating turret and shooting" and taking damage

hallow mortar
#

Attaching the vehicle to something is also a valid solution for having it float, as long as you make sure to do the attach before it falls out of the sky. Just put a dummy object somewhere out of the way and attach in place - there's no proximity requirement to attach

dapper cairn
#

So im trying to setup a teleport script ive used in the past but it keeps spawning the player on the ground/sea level when i need it to spawn them in a atc tower (entrance to a bunker)

Script is attached to a bunker

this addAction ["exit base", {player setPos (getPos in1)}]

(in1 is a cone and is the "spawn" point of the teleport)

#

is there a way to change the altitude it spawns them at so i can tweak it till its right

hallow mortar
#

Don't use setPos/getPos, it's slower and causes errors in translation because of how the two commands interpret positions differently

#

Use setPosASL and getPosASL

dapper cairn
#

ok

dapper cairn
tough abyss
#

how would i go about using an addaction on all helis ingame? i understand in allmission objects you can filter air is configclasses the only way to determine helis?

brazen lagoon
#

is there a good way to get all classnames for an addon? well more specifically for a mod. Is that possible? to figure out what addons make up a mod?

granite sky
#

You have to approach from the other direction, as far as I know. Scan all classnames, check their source mod/addon.

tough parrot
#

@tough abyss The existence of an entry within a vehicle config, like mainRotorSpeed, can be checked if you want to be very specific. You can also have an array list for them and add/subtract when vehicles are created/destroyed.

tough abyss
#

Do vehicles automatically travel on roads when their destination can be reached by road using Move or related commands? Or do I need to do something more to make vehicles move using roads

#

Second question, is there a SQF equivalent to yield, or some way to process lots of data without necessarily hogging engine time?

tender fossil
# tough abyss Second question, is there a SQF equivalent to ``yield``, or some way to process ...

spawn or execVM. They return a script handle that can be used to determine when the script has finished, see BIKI for additional info. AFAIK execVM should be used only for scripts that get executed only once during a mission if you want to optimize performance and we have CfgFunctions as further optimization anyways now.

Also, both commands operate within the limits of internal scheduler: max 3 ms of execution time per frame (the execution will continue in the next frame) and the scheduler itself just simulates threading aka being actually single-threaded, so if you add too much and/or too heavy scripts to it, the script execution will slow down noticeably. The script execution order is not guaranteed either, but there are workarounds for that now (see spawn BIKI page).

tough abyss
still forum
#

Add sleep

tender fossil
tough abyss
#

Or would this be a script that calls other scripts and sleeps in between?

tough abyss
#

I am new to SQF

tough abyss
still forum
#

sleep pauses the script

tough abyss
#

Ah

still forum
#

when its paused, it doesn't run

tough abyss
#

Does the script effectively get suspended until I assume a timer calls back to it?

still forum
#

it checks regularly-ish if the time is over yet

tough abyss
#

Is this done in SQF or the native C++ the engine is written in

#

so this can be useful for performance reasons

still forum
#

Engine doesn't run SQF for its stuff

copper raven
#

it's not more accurate

#

uisleep is ui time, sleep is simulation

still forum
#

When you run scheduled scripts, you don't have to worry about hogging too much cpu time

copper raven
#

if you pause the game, simulation doesn't run, and thus sleep just suspends indefinetly until you unpause (you use uiSleep then if that's not what you want)

tender fossil
#

I see, thanks for correction ๐Ÿ‘

tough abyss
#

I would assume all scripts are scheduled in a sense?

still forum
#

no

#

unscheduled scripts are not scheduled

tough abyss
#

๐Ÿค” I will need to look more into the differences

#

Is there a biki link

copper raven
tough abyss
#

Thank you

tough abyss
copper raven
#

no its not a function

tough abyss
#

Oh

copper raven
#

unscheduled code just means it runs here and now

tough abyss
#

Is it blocking?

copper raven
#

scheduled means this will run sometime later (unknown)

#

yes

tough abyss
#

Okay

copper raven
#

"return a value" is very vague in sqf

#

so you need to be more specific

tough abyss
#

How does sleeping work in a scheduled environment if execution is limited to 3ms, i assume results vary?

tough abyss
copper raven
#
blabla = { 1337; };
0 spawn {
  private _result = call blabla; // runs scheduled, but still "returns"
};
tough abyss
#

Hmm ok

#

โ€œRunning code in a scheduled environment starts a new script. The executing instance will not wait for the result of scheduled code and will continue on with its execution, so it is not possible to return any values from code executed in this manner although a Script Handle for started script is provided.โ€

copper raven
tough abyss
#

Hmm, the biki seems to be conveying that sleeping for example 1ms will not be 1ms due to scheduling differences

copper raven
#

yes, because it depends on frametime

tough abyss
#

Hmm ok

tender fossil
tough abyss
#

Do I need to use math a lot when dealing with positions or does SQF have most of that taken care of

copper raven
tough abyss
#

Ah

little raptor
tough abyss
little raptor
#

no. I'm taking a break from modding for a while

tough abyss
#

Ah alright

polar belfry
#

is there a script to see the memory points on a model

winter rose
#

mb, misread see as set

polar belfry
#

I mean the list of them as names

hallow mortar
polar belfry
#

oh and that writes them in clipboard?

hallow mortar
polar belfry
#

this selectionNames["Memory", { copyToClipboard str _this; hint str _this; }];

#

?

hallow mortar
#

No, that's not how sqf syntax works

polar belfry
#

I'll put it in init

hallow mortar
#

Put what in init? The code you just posted? Don't, it won't work

polar belfry
#

oh ok

hallow mortar
#
_memoryPoints = _object selectionNames "Memory";
copyToClipboard str _memoryPoints;```
Or you can use this in the debug console while looking at the object, and copy the results from the output field:
```sqf
cursorObject selectionNames "Memory";```
polar belfry
#

oh ok

#

thanks

hallow mortar
#

In the first example I wrote a variable name wrong. Fixed now.

polar belfry
#

is there a list of the default memory points

#

what they mean?

#

cause I found a lot of non english names

tough abyss
#

a lot of the names are czech

winter rose
young current
#

as in memorypoints vary a lot and pretty much all of them can be defined in config and model to be whatever

#

as long as they correspond to each other

willow hound
# lapis ivy Hello. I'm trying to turn the lights on and off. I have a sound from the light b...

The best option is to make a function, e.g. MF_fnc_flickerLight ...

params ["_origin", "_duration"];

private _sound = _origin say3D ["neons", 20, 1];
sleep _duration;
deleteVehicle _sound;
```... to use with remote execution:
```sqf
while {electricity_on} do {
  [blight1, 1.8] remoteExec ["MF_fnc_flickerLight", 0]; //Don't add this to the JIP queue (that would create problems).
  [blight2, 4] remoteExec ["MF_fnc_flickerLight", 0];
  [blight3, 0.2] remoteExec ["MF_fnc_flickerLight", 0];
};
polar belfry
fresh crater
#

so i made a fob with ai and props but i want all that to spawn when im in a certain distance of the fob

sullen sigil
#

Is there a way to grab all grenades (thrown and/or launched) similar to allUnits and vehicles?

tough abyss
#

@sullen sigil nearObjects with "Grenade" as the type

sullen sigil
tough abyss
#

allMissionObjects "Grenade" may work if the entire mission is your goal

sullen sigil
#

gotcha, thanks -- low gravity script meowsweats

tough abyss
#

have fun with that, messing w/ gravity without demolishing performance is a pain in the ass

sullen sigil
#

yeah, think ill just have to either take the performance hit or come up with some other excuse and only have it for grenades or something

tough abyss
#

also keep in mind network latency if you're planning on having it work in MP

sullen sigil
#

i am indeed planning on that however probably not indoors somehow so shouldnt be too big of a deal

tough abyss
#

good luck ๐Ÿ‘

sullen sigil
#

thank you ๐Ÿ™‚

#

speaking of, are you aware of any decent tools to help test network latency without having to just get 5 people onto a dedi server etc?

south swan
tough abyss
#

unfortunately not, and ultimately you're not going to see realistic results without actual MP playtesting

south swan
#

๐Ÿค”

tough abyss
#

ideally at some point we'd just get a setGravityCoef sqf command or similar that modifies gravity at the engine level

sullen sigil
#

that mightve just been the most stupid thing ive ever said nvm

tough abyss
#

but until then it's a tricky thing to pull off well

sullen sigil
#

I asked one of the devs already in the ace discord I believe

tough abyss
#

stupid if so, but wouldn't be the first hardcoded thing that usually wouldn't be hardcoded in any other engine ever

sullen sigil
#

that being said i cant seem to find when i asked them lol

#

oh no it was lou saying he thinks it may be hardcoded

sudden yacht
#
things = nearestObjects [testarea, ["HOUSE"], 500];{ 
_m1 = _grp createUnit ["ModuleCivilianPresenceSafeSpot_F", _x, [], 0, "NONE"]; 
_m1 setVariable ["#capacity",3]; 
_m1 setVariable ["#usebuilding",false]; 
_m1 setVariable ["#terminal",false]; 
_m1 setVariable ["#type",5];} foreach things;
_cen = getpos testarea;
_m = _grp createUnit ["ModuleCivilianPresence_F", [0,0,0], [], 0, "NONE"];
_m setVariable ["#area",[_cen,500,500,0,true,-1]]; 
_m setVariable ["#debug",true]; 
_m setVariable ["#useagents",true];
_m setVariable ["#usepanicmode",true];
_m setVariable ["#unitcount",10];
```Civilian Presence module being spawned. long story short how can i add in additional arguments for code executed on spawned units?
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
copper raven
sudden yacht
#

@copper raven ty

astral bone
#

I have an interesting question and I'm not sure how to ask it.
Basically, got an object I ain't attached too, but I want to copy the rotation values of it, then add to the object's forward-relative roll

#

im not sure if that makes as much sense as I hope xD

#

Making a clock. I have it so the hands are always the same orientation and position (offset) from the face object. But, now I want to have them rotate around the center.

#

I think I'ma need to do maths x3

#

Sadly, I never too- uh- is this trig? idk. Or if I did, I don't remember it xD

night sundial
fresh crater
#

i want the heli crew to turn engine off and leave the heli

#

heli1 action ["engineOff", vehicle heli1];
_grp1 leaveVehicle _heli1;

#

is this correct ?

copper raven
#

the pilot might still turn the engine back on

#

you cannot override AI's behavior on vehicle's engine

#

also it should be driver heli1 action ...

fresh crater
#

it works they land and turn off the engine but dont exit

copper raven
#

heli1 action leaveVehicle _heli1;

night sundial
#

is heli1 the pilot and _heli1 the vehicle?

fresh crater
copper raven
#

wat?

night sundial
#

so get rid of the underscore on _heli1

copper raven
#

vehicle heli1 why the vehicle then?

fresh crater
#

if i dont type vehicle it doesnt turn engine off

copper raven
#

heli1 is the driver here, otherwise your action wouldn't work, what i wrote here:

also it should be driver heli1 action ...
didn't realise

astral bone
#

is there a thing that will tell me if my code is obviously wrong? Like, missing a semicolon or something

fresh crater
#

yes

copper raven
#
private _vehicle = vehicle heli1;
heli1 action ["engineOff", _vehicle];
_grp leaveVehicle _vehicle;
#

(and also as Lou said, locality)

night sundial
fresh crater
copper raven
#

you should really name your variables better

night sundial
#

oops wrong reply

astral bone
fresh crater
#

yes to you

astral bone
#

what is it then?

copper raven
#

wat?

fresh crater
#

nvm ive done it

#

heli1 action ["engineOff", vehicle heli1];
_grp1 leaveVehicle _heli1;

astral bone
#

the thing that tells me if my sqf file has syntax errors

fresh crater
#

just removed the _

#

before the variable

#

it lands stops engine and they leave the heli

copper raven
astral bone
copper raven
#

make sure you have -showScriptErrors

fresh crater
copper raven
#

in the future name your variables better

astral bone
fresh crater
#

whats locality

#

im new to this btw

copper raven
#

underscore prefixed variables are local variables, in any other case except things like this, thisTrigger it's a global variable

astral bone
#

first line has 'heli1'
second has '_heli1'

#

Basically

hallow mortar
#

A local variable is one that only exists in the current scope (i.e. instance of script, function, etc.) and scopes derived from it.
Note: don't confuse local variables with network locality, which is to do with which machine code is running on in multiplayer.

astral bone
#
{//Scope A
  _valueA;
  {//Scope B
    _valueB;
  }
}

Not sqf exactly, but basically, an _ means "to child scopes"
_valueA will be accessible to Scopes A and B, however _valueB will not be accessible to scope A.
Not using an underscore means it global. All scopes can access the value.

astral bone
#

locality is very very annoying I find in SQF/Arma :P

sudden yacht
#

Question.... If i resume a saved game of a custom mission.... Will the initiation field... Reapply itself?

naive needle
#

The Item in the glasses slot gets deleted when you die and getting replaced by the glass item you have selected in the profile. Any Ideas how to stop that ?

copper raven
#

on respawn or?

jade acorn
night sundial
#

how can i create a tracer using scripts(not talking about the module)? Whenever i use createVehicle to make the projectile, there is no tracer effect

copper raven
#

what projectile?

#

there are projectiles with tracers, are you using them?

night sundial
#

yes

#

i assume there is a built in script to apply a texture to the bullet when it is actually fired, not spawned. Although i couldnt find the script, i found the tracer texture in \a3\data_f\tracer.paa

#

Maybe Lou knows

copper raven
#

ah apparantly you can't spawn tracers

#

you need to create some unit and make it shoot

night sundial
#

you can spawn them, they just dont have the tracer effect

copper raven
#

that's what i meant

night sundial
#

which is why im asking if theres some way to simulate it so that the tracer effect does appear

naive needle
worthy igloo
#
"message" remoteExec ["hint", clientOwner];
``` if u local exec this in debug is it gonna only run for the person who run it
south swan
#

then why not just hint "message";? What the remoteExec is for?

copper raven
brazen lagoon
#

basically what I actually want to do is. given a faction classname i want to get all classnames from the mod that the faction is from

granite sky
#

I don't really see the difficulty. There's configSourceModList and configSourceAddonList.

south swan
#

like, literally. sqf _cfg = configfile >> "CfgFactionClasses" >> "CUP_C_RU"; _modlist = configSourceModList _cfg; _result = "count ((configSourceModList _x) arrayIntersect _modlist) > 0" configClasses (configFile >>"CfgVehicles"); ๐Ÿคทโ€โ™‚๏ธ

copper raven
#

make sure you cache the result

drowsy geyser
#

why has addVest and removeVest global argument/global effect
but addBackPack and removeBackPack local argument/global effect ??

#

just want to know the reason behind it

night sundial
exotic flame
#

is there a reason lineIntersectsObjs [(eyePos player),(ATLToASL screenToWorld [0.5,0.5])],objNull,objNull, false, 32] is not detecting an object placed at 5m high ?

south swan
#

You don't have landscape at 0.5,0.5 - you don't get coordinates

south swan
iron jacinth
#

How would I add "this setSpeaker "NoVoice"" equivalent to units spawned from a module?

exotic flame
copper raven
#

addvest is a3 only and is argglobal

copper raven
#

vanilla modules usually have some "on unit created" script that you can use

iron jacinth
#

ARMST_mutantsModuleSpawn, ARMST_mutantsModuleMonster~, bottom one is interchangeable (armstalker monster spawners)

jade tendon
#

I'm using Bon's Ai Recruitment script and i want to change the spawning from random around the object with init code to on a position.
Original code

_unit setRank "PRIVATE";
[_unit] execVM (BON_RECRUIT_PATH+"init_newunit.sqf");```

Can i just shorten 
```_unit = group player createUnit [_unittype, [(getPos bon_recruit_barracks select 0) + 10 - random 10,(getPos bon_recruit_barracks select 1) + 10 - random 20,0], [], 0, "FORM"];```
to
```_unit = group player createUnit [_unittype, [(getPos markerPos "marker" select 0)], [], 0, "FORM"];```
tough abyss
#

It won't behave exactly the same, but you'd want to do

#

_unit = group player createUnit [_unittype, markerPos "marker", [], 0, "FORM"];

jade tendon
#

i spawned 2 ai, both spawned where i placed the marker

#

ty

tough abyss
#

np

wind hedge
#
private _nearMen = _chemLight nearEntities [["Car","Motorcycle","CAManBase","Air","Tank"],600] select {isPlayer _x};
#

Will that detect players inside the vehicles? When they are drivers? When they are passengers?

tough abyss
#

nearEntities explicitly ignores entites in vehicles, you'll need to use entities instead

#

entities [["CAManBase"], [], true]

#

alternatively, if you still need to make sure they're within a certain radius of your chemlight, you can do a distance check

#

i.e. entities [["CAManBase"], [], true] select {_x distance _chemLight <= 600}

wind hedge
#
private _nearPlayers = [];
_nearPlayers = allPlayers select {_chemLight distance _x < 600 && alive _x};
if (_nearPlayers isNotEqualto []) then {
    {[_chemLight]remoteExec["_VAL_fn_enhChemLightEffect",_x,true];} forEach _nearPlayers;
}; ```
tough abyss
#

isNotEqualto is not a valid command

#
if !(_nearPlayers isEqualTo [])
tough abyss
#

wtf when did they add that

wind hedge
tough abyss
#

nvm, my bad

wind hedge
tough abyss
#

one thing to note with allPlayers is that it'll include headless clients

#

so make sure that's ok for what you're doing

night sundial
#

how does the size parameter in setParticleRandom work? There seems to be some kind of exponential growth? How does this number affect the calculation for the size of the particle?

#

for example, setting the parameter to 10 on a particle source whose size is 1, the particles can be hundreds of meters larger

#

nvm, figured it out. the particle size increases/decreases by 2^(randomsizeparameter). Such a weird way to calculate it

tough abyss
#

When is it appropriate to use high level/low level AI functions? What is the difference

copper raven
#

what functions? example?

tough abyss
#

etc

copper raven
#

first one takes group, the second takes a single unit

copper raven
#

should use doMove though i've never seen anyone talk about it here

tough abyss
#

Well I would assume for say AI mods functions that deal with individuals not groups need the individual functions

copper raven
#

yes

copper raven
#

never heard of that one

copper raven
#

also: allPlayers select {_chemLight distance _x < 600 && alive _x}; you could use inAreaArray

tough abyss
#

oh yeah duh inAreaArray is way better

hallow mortar
#

For your usecase it should be safe to use playableUnits rather than allPlayers - automatically excludes dead people and anyone on the game logic side, so less filtering needed

ember pier
#

So I have a weapon with a working โ€˜hold space to unlock in arsenalโ€™ action, however there is also an option to pick up the weapon. How can I have the weapon model on the ground without the option to grab it?

hallow mortar
#

The thing on the ground isn't actually the weapon, it's a weapon holder (essentially an invisible box that just exists to have inventory space and display the models of items inside it) that contains the weapon. So you could try using lockInventory on it.

#

Other options to try:

  • disabling simulation: the option to pick up may still appear but nothing will happen when you try. Not certain your addAction will work though.
  • making a simple object of the weapon model: it won't be interactive, but also won't have attachments or a mag. You'll also need to make hidden non-simple object to attach the action to, since actions don't work on simple objects.
  • adjust the system: you could, for example, have a universal action on the player that unlocks their current weapon. They'd have to pick it up to unlock it but you wouldn't have to worry about this problem.
sullen sigil
#

on wiki page for BIS_fnc_replaceWithSimpleObject, it says "
Use with caution as this technique is not very clean - it should not be used for many objects and definitely not in MP games." -- why shouldn't it be used in MP?

tender fossil
sullen sigil
#

would make sense, localonly isn't working as desired for me sadly so need to optimise network as much as possible

night sundial
#

what happens when i put a private variable in the JIP parameter for remoteExec?

night sundial
winter rose
#

it works

copper raven
night sundial
#

yea its locality

#

i wasnt really thinking

copper raven
#

if you pass an object into the jip parameter, that remoteExec will happen on JIP machines too aslong as that object is still there

night sundial
#

thats why im putting an object in the JIP parameter

copper raven
#

so eh? why would you ask that if you know what it does? ๐Ÿ˜„

winter rose
#

brainfarts happen ๐Ÿ˜‰

brazen lagoon
#

how do you get if a turret is fixed or flexible?

#

or I guess a better question is how do I figure out what weapons a vehicle has + if they are gimballed or fixed

#

like what I want to do is get a list of weapons on a helicopter and see if they are fixed or flexible and I thought all weapons had to be in cfgvehicles >> classname >> Turrets but I'm not sure that's the case now?

south swan
brazen lagoon
#

well does allturrets work for, say, fixed wing aircraft

south swan
#

if it has any turrets - it would. If it doesn't have turrets - there are no turrets to list ๐Ÿคทโ€โ™‚๏ธ

brazen lagoon
#

well sure but then how does the gun work

#

like, the CUP Ka-50 has no turrets. but it does have an autocannon

#

how does the config for that work?

hallow mortar
#

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

Use turret path [-1] for driver's turret.
Non-pylon driver weapons are located in weapons in the base level config, e.g. configFile >> "CfgVehicles" >> "B_Plane_CAS_01_dynamicLoadout_F" >> "weapons".
_vehicle weaponsTurret [-1] will return all weapons under the driver's control, including non-pylon and pylon weapons.

brazen lagoon
#

hmm. any way to do that without spawning the object

#

i guess look at weapons

hallow mortar
#

Well yes, any config property can be looked up without spawning the object, as long as you know the classname

south swan
brazen lagoon
#

yeah I'll take a look at that

#

though it still doesn't really tell me if something is gimballed or fixed.. or I guess it kind of does

hallow mortar
#

You can also find the class' default pylon weapons by looking in configFile >> "CfgVehicles" >> "B_Plane_CAS_01_dynamicLoadout_F" >> "Components" >> "TransportPylonsComponent" >> "Pylons"

brazen lagoon
#

if it shows up in turrets it's gotta be gimbaled

south swan
#

whatever is not in turret is fixed. Whatever is in turret is gimbaled to its rotation limits ๐Ÿคทโ€โ™‚๏ธ

brazen lagoon
#

yeah

#

essentially I want to dynamically select attack/light choppers. it's kind of very difficult because there is not really a consistent definition of what an attack chopper is...

south swan
#

drawing lines is hard in general

hallow mortar
south swan
#

would Hummingbird with .50 minigun and a bunch of Hydras be a light of an attack? The answer is: ||it'll be whatever it's used for ๐Ÿคฃ ||

brazen lagoon
#

yeah. I had the same issue when selecting tanks. the line between tank and ifv is pretty porous

brazen lagoon
south swan
#

and then some bastard (like me) scripts a 155-mm howitzer onto a Neophron and gimbals it into a pilot camera as well ๐Ÿฟ

brazen lagoon
#

lol

brazen lagoon
#

well the game is able to

#

otherwise you'd be able to aim that 30mm

south swan
#

inb4 "Laserdesignator_pilotCamera" weapon is hardcoded in-engine to follow the camera

hallow mortar
#

It's probably something like that

brazen lagoon
#

๐Ÿคจ

#

I mean really the root question is

#

I want to figure out if a helicopter has an autocannon. if it's fixed or not idc, if it has an autocannon that fires type shotShell and has some amount of armor that's good enough to consider it an attack helo

hallow mortar
#

Well you can do that pretty easily by chaining config lookups

brazen lagoon
#

ye

#

that's not the hard part

#

the hard part is like. an Mi-24 has a 50 cal on a gimballed mount

#

but you'd still consider it an attack chopper despite the lack of a shell firing gun

#

but you can't just select has gimballed gun because lots of choppers have 50 cals on flex mounts that are definitely not attack helis

#

I guess if it has an autocannon it definitely is. and if it has a flex mount gun and enough pylons it is. but that makes the mi-8 v3 with the wing pylons an attack chopper

south swan
#

inb4 checking how the bots are supposed to name it and hoping for mod authors to fill that sensibly

brazen lagoon
#

LOL that's what I did originally

#

check if name singular is gunship

#

but nobody follows that

brazen lagoon
hallow mortar
#

Has autocannon -or- has pylons seems sensible to me. Anything that has pylons available is at very least a multirole, and most of them have a fair amount of firepower available on the pylons

brazen lagoon
#

yeah like it needs to have some amount of armor or its a light chopper

#

if it has a fair amount of armor and has no guns it's unarmed transport

#

if it has armor and guns but no pylons it's an armed transport

#

if it has armor and guns and pylons it's an attack chopper

#

if it has armor and an autocannon at all its also an attack chopper

south swan
#

and then somebody says "screw it" and just fills the lists with manually selected classnames

brazen lagoon
#

idk military designations are dumb they mean lots of things to different people

brazen lagoon
hallow mortar
#

if it has armor and guns but no pylons it's an armed transport
Unless it's an attack helo from before the dynamic pylons update / configured by someone lazy

brazen lagoon
#

eh in that case fuck em

#

just not worth the effort

south swan
#

the same vehicle can be classified as, say, "Tank", "Tank Destroyer" and "Anti-Tank Gun Self-Propelled" (if i remember the names correctly ๐Ÿคฃ )

brazen lagoon
#

the painful thing abt arma is that you have to deal with 20 some years of cruft going back to OFP

#

one of the biggest reasons I'm waiting for reforger to get big

hallow mortar
brazen lagoon
#

I mean it kind of is

hallow mortar
#

It is not

brazen lagoon
#

ifv is a better designation though

#

tank destroyer is better still

south swan
#

don't forget that "Snake" is "Man" in Arma

hallow mortar
#

well, in Metal Gear Solid as well

south swan
#

long story short, drawing lines is hell

winter rose
#

"CAManBase" is the class for the human-human

granite sky
south swan
#

nothing by default, or nothing compatible at all?

granite sky
#

Compatible in some cases.

south swan
#

"inconsistent in general"

hallow mortar
#

What kind of maniac lets a vehicle have config for pylons it visually doesn't have

brazen lagoon
#

CUP_B_30mm_AP_Green_Tracer is a bullet somehow

granite sky
#

Well, if it's some sabot penetrator...

brazen lagoon
#

sure, that's fair. but then so is CUP_B_30mm_HE

granite sky
#

hah

brazen lagoon
#

๐Ÿคฆ

south swan
#

class B_30mm_AP: BulletBase looks vanilla though?

brazen lagoon
#

yeah that's what I don't get. how is it a bullet when it has explosive filler. isn't that obviously a shell

hallow mortar
#

This is the same for vanilla 40mm autocannon rounds btw

brazen lagoon
#

so i guess it's better to look at cfgammo >> classname >> explosive and see if anything is >0

#

cant wait to find out that 12.7x108mm is somehow explosive

south swan
#

CUP 30mm HE inherits from vanilla 30mm HE. Vanilla 30mm HE inherits from vanilla 12 cal HE ๐Ÿคฃ

#

vanilla 12 cal HE inherits from BulletBase

#

the joys of digging in Arma configs

granite sky
#

I guess bullet vs shell is more about how simulation is synchronised? Like bullets get a local copy everywhere but shells are global.

hallow mortar
#

indirectHitRange config property is a reasonable way to tell if it's explosive

brazen lagoon
#

HOW IS A LASER BEAM EXPLOSIVE

winter rose
#

never watched Star Wars?

brazen lagoon
#

I thought that wasn't allowed here :^)

#

also i think those are called blasters or something

hallow mortar
#

That's the ammo used in the laser batteries for handheld designators. I'm like 90% certain it's just the ammo equivalent of fakeWeapon and it's never actually fired, so whoever did the config was probably just goofing. It also has a hit value of like 500

worthy igloo
#

how can I make a switch for ctrlCreate ["RscButton", 1601];

winter rose
worthy igloo
winter rose
#
switch (_cond) do
{
  case 1: {};
  case 2: {};
};
```https://community.bistudio.com/wiki/switch
worthy igloo
#

how do I define _cond

winter rose
#

however you wantโ€ฆ?

#

I have so far no idea of the context, the actual issue, etc.

worthy igloo
hallow mortar
#

How you need to define it is very contextual. It really depends on exactly what you're trying to do. Have a look at the switch page Lou linked and see if that helps.

ember pier
brazen lagoon
#

I'm actually reasonably proud of this script so I'm gonna put it here if anyone wants a script to dynamically select helicopters or get helicopters by faction - you'll probably need to make changes to it for whatever scenario you're using it for but I feel like it would come in handy for more ppl than just me https://sqfbin.com/xalimagotavulobuvuzo

#

at least seems to work w/ vanilla and cup reasonably well. haven't tested w/ rhs though

#

oh and obv it's written w/o performance in mind so it's slow. like 3 calls of that take nearly half a second. could prob be optimized down but it's intended for setting stuff up at the start, like a static data type thing

tough abyss
#

Are variables with _ in them local?

brazen lagoon
#

yes

shut reef
#

Is there a way to excecute sth exactly when the player opens their eyes for the first time? What I've found during research wasn't helpful.
Hitting the respawn time is easy, but the first spawn is elusive.
Background is that I have a greeting script and neither want to have people waiting long in front of a black screen nor have them miss it, depending on how quickly they load in

tough abyss
#

introSeq = [] execVM "intro.sqf"; Is this how you are supposed to execute a mission intro in init.sqf

exotic flame
#

Is there away to repair a drown engine ?

shut reef
drowsy geyser
#

will this wait until all players have loaded the mission and are in the game?
waitUntil {{preloadCamera getPosATL _x isEqualTo true}forEach allPlayers}; //initPlayerLocal.sqf

#

i need to ensure that all players have loaded the mission so i can execute a code

blazing zodiac
#

Does anyone know if we can measure performance on a Headless Client in a similar way to measuring server FPS on the server executable? diag_fps seems to consistently return 10 (or very close to it) which I assume is the headless clients actual framerate, not equivalent with the server's FPS

blazing zodiac
granite sky
#

@shut reef Maybe existence of display 46? Not tried it though.

brazen lagoon
#

@blazing zodiac depends on ai count. it'll cap at 50 fps

#

higher is better. below 25 fps is usually a bad sign

granite sky
#

In most cases you don't want to dump all the AI on the HC because then the server's not doing much.

blazing zodiac
brazen lagoon
#

I believe so

blazing zodiac
#

I see, I wasn't sure since the HC is technically a client and FPS is measured differently on the client as far as I know

#

I'll do some more testing, to see if it lines up

drowsy geyser
#

Is there a reliable way to ensure that all players have finished loading the mission?

exotic flame
#

I have a question: Is there a way to get the vectorDir of given selection of an object ?

hushed bobcat
#

I'm so stupid, can't seem to get a simple IF statement to work. What's wrong with this?

C = floor (random [1,5,10]);
if (C < 4) then
{
"mrk1" setMarkerAplha 1;
}
else { "It's false" };

granite sky
#

alpha misspelt, no semicolon at the end of the if statement.

#

oh, there's an else. Just the alpha then.

#

Also you really shouldn't use a global variable there although I think one called "C" is technically legal.

hushed bobcat
#

Thanks I'm so stupid, also huge thanks that tool will be a life changer

open fractal
#

is there a way to check if a unit's flashlight is on?

shut reef
shut reef
fair drum
#

has to do with sending the server a check that the client is ready, when all clients are ready, it will fire

shut reef
pulsar bluff
drowsy geyser
jade acorn
#

because initplayerlocal is executed for every player individually, initServer is for whole.

south swan
#

also, every machine (both client and server) gets its own copy of the trigger when it's not set to "server-only" :3

plush belfry
sudden pasture
#

I want my player to have limited respawn tickets for a mission, but if they collect items and return to base and give them to something it will restore some tickets.

Does anyone know if this is firmly possible or not and if it is possible does anyone know how to set it up?

south swan
trim tree
#

Hi guys, im having trouble with a script of mine.
I want to know when a mortar flare is being lit so i can execute code when it happens. Right now i got these two files:

Init.sqf:

mortar1 addEventHandler ["Fired", { munitionstyp = _this select 5; projektil = _this select 7; execVM "munitionfired.sqf"}];
munitionfired.sqf:

if (munitionstyp ==  "vn_mortar_m29_mag_lume_x8") then { 
    sleep 1; projektil addEventHandler ["SubmunitionCreated", {hint "flare is lit"}];
    };

My problem is, that once munitionfired.sqf is executed and the "submunitioncreated" EH is called, i get the following error:
Error Foreing Error: Unkown enum Value : "SubmunitionCreated"

I tried searching already and only found this page here https://community.bistudio.com/wiki/Unknown_enum_value which basically states that this type of error occurs when you did a typo, which doesn't apply here. So anyone got suggestions?

meager granite
#

@trim tree You're applying projectile-only event handler to a unit, not a projectile

#

_this select 7 is _gunner, the unit that pulled the "trigger"

#

Thus it errors out as that event handler is invalid for units

#

The shot is _this select 6

#

Also, pass arguments right into munitionfired.sqf instead of assigning them to global variable. What if you'll have two mortars firing, second one will overwrite global variables if both fire.

#
    mortar1 addEventHandler ["Fired", {_this execVM "munitionfired.sqf"}];
    private _munitiontyp = _this select 5;
    private _projektil = _this select 6;
    if (_munitiontyp ==  "vn_mortar_m29_mag_lume_x8") then { 
        _projektil addEventHandler ["SubmunitionCreated", {hint "flare is lit"}];
    };
fair drum
#

So for example, I start everyone off with a black screen that says waiting for players. When the client is done, it grabs an array variable that is public, modifies itself to it, then sends it back. Server is waiting until all of the clients are present in that array, then executes mission start.

trim tree
copper raven
#

if (munitionstyp == "vn_mortar_m29_mag_lume_x8") then { sleep 1; projektil addEventHandler ["SubmunitionCreated", {hint "flare is lit"}]; };
you don't even need to schedule a new script immediatly, stay in unscheduled for as long as you can, especially a fired event like this

trim tree
#

my i ask why?

copper raven
#

execVM (re)compiles the script everytime

trim tree
#

so performance reasons i guess?

copper raven
#

make it a function

#

and also call first to stay in unschd, then later, if it's the correct ammunition type, spawn the sleep part

trim tree
#

Because theoretically i would only need this called at the very beginning of the mission for one time only

#

the sleep was only put in there by me just in case there were some overlapping issues, it is not really needed

copper raven
trim tree
#

alright, ill have a look into it

sullen sigil
#

Am I correct in the assumption that playSound should be used for playing sound to the player and only the player in the context of an action bound to a key that makes a sound?

hallow mortar
#

It's either that or playSoundUI

sullen sigil
#

ty, was concerned with subtitles and such

tough parrot
#

anyone know what drag coefficent game uses on falling human bodies?

#

or where to find the data

#

or another way to find the gravitational velocity curve

#

or rather i should say the drag force, given that the game seems to not using shape at all

tough parrot
#

createVehicle command is broken. if you use "FLY" so that it does not immediately plummet to the ground, it ignores the z. so there is no way to make anything spawn at intended altitude.

south swan
#

it will be made airborne at default height
looks intended though?

#

or at least documented ๐Ÿคทโ€โ™‚๏ธ

tough parrot
night sundial
#

is it possible to get location of parts of an object? Such as position of your hand or position of a certain part of a vehicle

#

without using attachTo

night sundial
#

thx, i was searching "hitpoint" instead of "selection"

winter rose
south swan
#

createVehicle -> createVehicleCrew -> setPosATL in debug console seemed to work in my local testing ๐Ÿค”

night sundial
#

what exactly is the point of the "incapacitated" hit index?

granite sky
#

Wait no, that's createUnit :P

naive needle
#
 _TEST = [2,1,1,2,1,2,2,2,1,1,1,1,2,2,1,2,1,2,1,2,2,2,2,2,2,2,2,1,2];
{ 
 if (_x isEqualTo 2) then {_TEST deleteAt _forEachIndex;}; 
}forEach  _TEST; 
  
_TEST

Output: [1,1,1,2,1,1,1,1,2,1,1,1,2,2,2,2,1]```
#
_TEST = [2,1,1,2,1,2,2,2,1,1,1,1,2,2,1,2,1,2,1,2,2,2,2,2,2,2,2,1,2];
{ 
 if (_x isEqualTo 2) then {_TEST = _TEST - [_X]}; 
}forEach  _TEST; 

_TEST

Output: [1,1,1,1,1,1,1,1,1,1,1]  
#

is that normal ?

#

that deleteAT automatically resize the array and the forEachIndex is gonna be wrong for the next index

granite sky
#

Yes, don't delete from an array that you're iterating over.

naive needle
#

That explains so many issues XD

#

ty

mortal saffron
#

Can anyone help with making some BIS_fnc_holdActionAdd for players on a MP dedicated server?

warm hedge
warm hedge
#

How do I get a zeroing of the current weapon of a certain turret of a vehicle?

#
vehicle player currentZeroing [currentWeapon vehicle player];```Something like this doesn't help me
#

Oh wait - I need to pass player as the argument not vehicle itself?

#

However it only returns the manual zeroing, won't return lased distance

copper raven
#

there it's actually a value that does not rely on array elements, so using _arr = _arr - [_value] is better

tough abyss
#

How do I get a list of units within a group?

warm hedge
#

units groupName

tough abyss
#

Damn SQF is somehow complicated and simple at the same time

copper raven
tough abyss
#

The problem with SQF is less often that the language itself is complicated and moreso that a good deal of the commands have weird edge cases and alternate behaviors to consider

#

that and there's usually 3+ commands that can all do the same thing with various levels of efficiency/efficacy

#

which is why the biki should be your friend

warm hedge
warm hedge
#

Can you? findDisplay 300 can't find it

copper raven
#

ah, its a title probably

#

its probably initialized with the initDisplay thing which stores it in uiNamespace

copper raven
#

uiNamespace getVariable "classname" should work

warm hedge
#

Any of it. Let's say if you've an MX rifle then it should be RscWeaponZeroing

#

And urm, does it either? I only get nil from uinamespace getvariable "RscWeaponZeroing"

copper raven
#

is that a subclass of RscInGameUI?

warm hedge
#

Yeah

#

RscWeaponZeroing should have idd 300 but I can't find one in allDisplays either

copper raven
#

check the config, it should have some onLoad event

#

i dont have a pc next to me atm, would check ๐Ÿ˜„

#

i remember doing something similar though

warm hedge
#

Interesting. Let me know if you've got it

copper raven
#

will ping you

pulsar bluff
#

has anyone done a vehicle rearm script which doesn't use "setVehicleAmmo"?

#

looking at the vanilla re-arm, it steps through vehicle weapons and refills them 1 at a time

#

this seems preferable, however there seems to be some missing script commands

copper raven
#

whats the point of that?

#

setVehicleAmmo does exactly that doesn't it?

pulsar bluff
#

well different vehicle weapons would have different ammo counts vs capacities

#

setvehicleammo simplifies everything to the point there is no "getvehicleammo" getter

#

if a player drives onto a re-arm pad, do i set the rearm state to empty, add a sleep delay then "setvehicleammo 1" ... or add ammo to what is already there

copper raven
#

what commands are you missing?

pulsar bluff
#

I just want an array of the vehicles weapons (those that are affected by setvehicleammo), the current ammo count, and the ammo capacity

#

then i can just step through with "setammo"

pulsar bluff
#

ive been playing with "magazinesAmmoFull"

#

but it excludes things like countermeasures

copper raven
pulsar bluff
#

eventual goal is to disable the vanilla vehicle rearm stuff, since it allows bad behavior, like parking an AA gun right beside an ammo truck for unlimited AA

#

@copper raven that command has a bright red "broken" warning

#
Broken when vehicle has multiple magazines of the same type.```
copper raven
#

yes remove and readd them one by one if you have multiple

pulsar bluff
#

sounds complicated :\

copper raven
#

i don't know why you want to "step through" instead of using setVehicleAmmo

pulsar bluff
#

i dont want to reduce the existing ammo count

copper raven
#

reduce how? example?

pulsar bluff
#

if there are 85/200 shots in the machine gun and 19/24 shots on the cannon

copper raven
#

ah so you want to rearm the mag, and keep the 85 shots or what?

pulsar bluff
#

i want to rearm the 19/24 one by one, so 19,20,21,22, etc ... and keep the 85/200

#

thats roughly how the vanilla system works

copper raven
#

well then you need to use what i sent

#

no other way

pulsar bluff
#

if you start re-arm and then leave

#

"setvehicleammo" slightly annoying too, does not fully re-arm the vehicle, only the current mags, doesnt refill empty ones

#

"setvehicleammodef" does refill the empty ones, but then it overwrites any scripted weapon changes

#

all in all, an unpleasant experience to script vehicle rearm ๐Ÿ˜‚

drowsy sparrow
#

Does anyone know how to "cancel" and attachtorelative?
Example I am using

[ObjectOne, ObjectTwo] call BIS_fnc_attachToRelative;

I just want to know how to make this false after and "detach" the object

warm hedge
#

detach command

drowsy sparrow
#

oh... that's simpler than i thought lol

winter rose
#
[objectOne, objectTwo, relativePos, finalWorldPos] call BIS_fnc_detachFromRelative;
```๐Ÿ˜›
chrome hinge
#

Hey, is there any way to hide units from enemy high command on the map? The map markers seem to persist and follow the revealed unit for a long time after not being seen. How can i force them to be hidden?

proven charm
chrome hinge
#

thank you!

proven charm
#

yw

dusky wolf
#

So question about the wiki. I wish to add an example to a page but for years now it just says "Registraion of new accounts for the Community Wiki has been temporarily suspended. We apologize for the inconvenience." Is there any way to make contributions?

hallow mortar
#

You can ask for changes to be made in #community_wiki , and if you ask very nicely they may allow you to have an account

dusky wolf
#

Been a few things I would've liked to put up in the past couple years, but I can't remember what half of them are ๐Ÿ˜…

drowsy geyser
#

is it possible to change or remove the black background of hint notifications?

proven charm
#

hmm the player landing autopilot doesn't seem to land on the nearest airfield. I wonder what criteria it uses to select the airfield where to land at?

winter rose
proven charm
#

checking the distance to the middle of the runway

#

red shows the path

proven charm
tough trout
#

I received this line of code to input into a modded module(MGI Spawn Group Attack), and I was wondering if someone could help me edit it so it selects a marker position from a list.

params ["_group","_leader","_vehs"]; private _wp = _group addWaypoint [getMarkerPos "marker_0",0]; _wp setWaypointBehaviour "COMBAT"; _wp setWaypointSpeed "FULL" ;
stable dune
#

And setWaypointType "MOVE";

tough trout
#

Didn't even think about that one. Its purpose is to have the AI essentially try and capture a handful of zones (which is another demon I'm wrestling with)

granite sky
#

Do you have an array set up for the list already, or just a bunch of marker names?

tough trout
#

Currently neither. Was hoping for the how-to first

#

I have where I want the markers to be, just nothing set yet

granite sky
#
params ["_group","_leader","_vehs"];
private _mrk = selectRandom ["my_marker_0", "my_marker_1", "my_marker_2"];
private _wp = _group addWaypoint [getMarkerPos _mrk, 0];
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointSpeed "FULL";
#

But if you're doing zone capture stuff then you'll probably want to start writing proper scripts at some point, with unified data.

tough trout
#

For the time being, I'm just trying to get the spawned in AI to create an aerial presence. Because this will be applied to multiple modules, I may apply a Destroy waypoint to some to have different actions being executed. Thank you for your help.

sullen sigil
#

Is there any way to add/remove the open door action? (Locking variable won't work for this purpose)

hallow mortar
#

I believe making the building a simple object would do it, although it'll be indestructible

sullen sigil
#

Should be fine for this purpose as the doors are their own objects/can be -- though wiki says BIS_fnc_replaceWithSimpleObject should not be used in MP games, I need it to be MP compatible so

hallow mortar
#

If it's Editor-placed, tick the box in its attributes.
If it's script-spawned, you may have to create it as a simple object rather than converting it.

sullen sigil
#

So I'd have to replace the object with a simple object via createvehicle and setpos blah blah blah?

hallow mortar
#

Well, I'd recommend using createSimpleObject rather than createVehicle, or perhaps BIS_fnc_createSimpleObject

sullen sigil
#

oh right yeah but same principle

sadly not the answer i was hoping for but it'll work ๐Ÿ™‚

sullen sigil
#

me again, is there any way to easily change the direction that particles are emitted?

sullen sigil
#

i said easily ๐Ÿ™ƒ

night sundial
#

whats the issue, the velocity is the 7th element in the array, change that and leave everything else the way you want it

sullen sigil
#

trying to copy everything from CfgCloudlets precisely into a script format and not getting a single thing wrong is the issue lol

night sundial
#

there might be a function i dont know of, otherwise you will have to make your own

blazing zodiac
#

Hey all, I'm having some trouble getting the new Modded Keybinding system to work: https://community.bistudio.com/wiki/Arma_3:_Modded_Keybinding. I've added the following to my missionFile description.ext and they don't come up in the menu or in the config viewer.

class CfgUserActions
{
    class FK_groupPing // This class name is used for internal representation and also for the inputAction command.
    {
        displayName = "3D Group Ping";
        tooltip = "Create a 3d marker in the game world that your entire group can see.";
        onActivate = "";        // _this is always true.
        onDeactivate = "";        // _this is always false.
        onAnalog = "";    // _this is the scalar analog value.
        analogChangeThreshold = 0.1; // Minimum change required to trigger the onAnalog EH (default: 0.01).
    };
};

class CfgDefaultKeysPresets
{
    class Arma2 // Arma2 is inherited by all other presets.
    {
        class Mappings
        {
            FK_groupPing[] = {
                0x25, // DIK_K
                "256 + 0x25", // 256 is the bitflag for "doubletap", 0x25 is the DIK code for K.
                "0x00010000 + 2" // 0x00010000 is the bitflag for "mouse button".
            };
        };
    };
};

class UserActionGroups
{
    class ExileKeybinds // Unique classname of your category.
    {
        name = "Exile"; // Display name of your category.
        isAddon = 1;
        group[] = {"FK_groupPing"}; // List of all actions inside this category.
    };
};
jade acorn
blazing zodiac
blazing zodiac