#arma3_scripting

1 messages Β· Page 95 of 1

wary needle
#

now the only two active objs are b and c

#

and a is out of the equation

#

@tough abyss

tough abyss
#

OK so does it depend on what side takes said objective?

wary needle
#

yeah

tough abyss
#

If blue has 2 objectives than delete first captured one objective right

wary needle
#

delete a untill b falls to red

#

you get the idea

#

disable would be better.

#

once b is controlled by red, then a becoumes an active obj

#

now i have a mission file i found that does some of this, it also has a script that interacts with the objectives. the only problem is, i cant spawn the objectives in with sqf

tough abyss
#

Why not? Do they need to be global executed or something

wary needle
#

refrence sqf file

#

idk why, it just doesnt spawn them

#

im on eu 02 testing it rn.

#

if i spawn the objectives myself in zeus and name them correctly the script still doesnt work on them. so i think they need to spawned in from sqf

tough abyss
#

Are you putting that code directly into a init box / comp and throwing it into public zues?

wary needle
#

using a debug consle in ezm

#

it def works, i tried makin some hints lol

tough abyss
#

Why are you getting a bi scope variable on a null object to then make the module? Also pretty sure instead of createunit it is recommended to use createmodules for modules

wary needle
#

idk, thats just what the sqf thing prints out

tough abyss
#

Wa

wary needle
#

you fine with hopping in a call, i think it would be easier to communicate

tough abyss
#

On mobile rn so na sorry hopefully someone else can help

#

For pub Zeus though I usually just go to a place called zam for help as they seem to know more around restrictions etc

wary needle
#

restrictions are not my issue

#

also i trolled too much

ornate whale
#

What is the main difference between functions and commands?

winter rose
#

setDir is a command

params ["_unit", "_dir"];
_unit setDir _dir;
```is a function
fair drum
#

@little raptor on ADT, when I click export config, nothing happens. Is it creating a file somewhere I need to look for?

kindred tide
#

is there any chance that multiple calls of setWaypointStatements on the same waypoint add statements instead of overriding existing statements?

ornate whale
sullen sigil
#

a function is a script

#

a script is just a load of code

#

(a script of things that the computer will do)

kindred tide
#

yeah i just got some behavior that looked like they were added but it musta been a bug in my code

kindred tide
#

this madness finally seems to work (the arrows aren't markers. they represent actual abstract objects in game)

#

it's basically my hand-written Warfare mode

#

i survived the init order hell

#

there's no easy way to port it to OFP. but i also want to play it in OFP lol

queen cargo
#

@tough abyss maybe a happy guy being friendly to everybody here

#

well

#

thx to SQF

#

i dont have to be "that guy"

jade abyss
#

<3 sqf

little raptor
little raptor
queen cargo
#

ha ha ... still have to finish my SQF guide
its title is "SQF - Hell on Earth" (actual title is "SQF - HΓΆlle auf Erden" but as that guide is written in german ... ye .. translated for ya)

#

that just came up into my mind as i saw that message of you @jade abyss

jade abyss
#

still: <3 sqf

#

:D

queen cargo
#

a lie just like the 🍰

jade abyss
#

nope. I realy like sqf

#

And don't blame the 🍰 !!!!

queen cargo
#

the cake was a lie

jade abyss
#

LIAR!

brisk lagoon
#

how would I disable the eagle eye zoom (RMB) on a server?

#

I can't find one answer in any of the forums I could use some help please

distant egret
#

It's not possible AFAIK.

brisk lagoon
#

it's possible, I played in a unit that had it, I would have asked the dude but that was like a year ago

distant egret
brisk lagoon
#

I'll try that

little raptor
distant egret
brisk lagoon
little raptor
#

it'll add a transparent overlay over enemies

brisk lagoon
little raptor
#

yeah

#

they're hexagons iirc not circles

brisk lagoon
#

how the heck do I disable RMB zoom then ffs, my old unit had it and VTN mod also have it

little raptor
distant egret
#

Ah though that was enemyTags. Wouldn't know have all that stuff disabled anyway.

brisk lagoon
little raptor
#

as in make the button not do anything

#

or better said override the action

#

not button

#

you can do it via addAction

brisk lagoon
#

oh

little raptor
#

that's for LMB (fire) tho

#

idk what the action name is for zooming temporarily

#

I guess opticsTemp?

brisk lagoon
#

I am about to ask ChatGPT notlikemeow 🀣

little raptor
#

looks like it doesn't work with RMB

brisk lagoon
#

sigh, chatgpt gave me some weird gibberish as well lol

#

// Function to disable RMB zoom (Eagle Eye) for binoculars
disableEagleEyeZoom = {
    player addEventHandler ["MouseButtonUp", {
        params ["_unit", "_click", "_button", "_shift", "_ctrl", "_alt"];
        if (_button == 2 && (currentWeapon _unit) == "Binocular") then {
            forceCommandingMenu "#USER:vehicleZoomOut"; // Use any harmless command to override RMB behavior
        };
    }];
};

// Execute the function when the player respawns
onPlayerRespawn {
    _id = _this select 0;
    _unit = _this select 1;

    if (hasInterface) then {
        _unit spawn disableEagleEyeZoom;
    };
};```
#

like wth

distant egret
#

A good reason why you shouldn't use chatGPT for arma... Well unless you know what you are doing...

brisk lagoon
#

Yeah no, never, I just wondered if he could find any answer, but idk wtf that is

distant egret
#

It's trying to prevent the user from using binoculars.

brisk lagoon
#

lol

little raptor
#

well it actually works if you fix it 🀣

#

just tested it

brisk lagoon
#

what is?

brisk lagoon
#

oh

#

how lol

#

what did you change?

little raptor
#

not gonna say πŸ˜›

brisk lagoon
#

bruh πŸ’€ meowsweats

#

I hope you're not serious I need it 😐

little raptor
#

$100

brisk lagoon
#

ain't no way this is happening

little raptor
#
EmptyMenu = [
    ["",true]
];
findDisplay 46 displayAddEventHandler ["MouseButtonDown", {
        params ["_disp", "_button"];
        if (_button == 1 ) then {
            showCommandingMenu "#USER:EmptyMenu";
        };
    }];
findDisplay 46 displayAddEventHandler ["MouseButtonUp", {
        params ["_disp", "_button"];
        if (_button == 1 ) then {
            showCommandingMenu "";
        };
    }];
#

well you still do see the menu πŸ˜…

#

but at least you can't zoom blobdoggoshruggoogly

brisk lagoon
#

the menu is referring to the AI command menu?

little raptor
#

yeah it's a commanding menu

#

well you can show a message in it

#
EmptyMenu = [
    ["Server Admin",true],
    ["Zooming is Disabled", [], "", -5, [["expression", ""]], "1", "0"]
];
#

there's probably a way to hide it too think_turtle

brisk lagoon
#

this actionKeys ["RMB", false]; will disable the use RMB completely I assume?

little raptor
#

wut? no

#

it's a getter

brisk lagoon
#

ah lol, I am noob at this sorry still trying to figure out stuff

#

ok I know chatGPT is somewhat dumb with arma 3 stuff but does this look right?


// Function to disable the AI command menu
disableAICommandMenu = {
    // Create an empty invisible control to capture mouse events and prevent AI command menu
    private _ctrl = findDisplay 46 createDisplay "ControlsGroup";
    _ctrl ctrlSetPosition [0, 0, 0, 0];
    _ctrl ctrlSetBackgroundColor [0, 0, 0, 0]; // Set the control background color to transparent
    _ctrl ctrlEnable false; // Disable the control so it doesn't capture mouse events
};

// Execute the function when the player respawns
onPlayerRespawn {
    _id = _this select 0;
    _unit = _this select 1;

    if (hasInterface) then {
        // Disable the AI command menu when the player respawns
        call disableAICommandMenu;
    };
};

// Execute the function every frame to prevent the AI command menu from showing
onEachFrame {
    // Find the displayed Commanding Menu and hide it (action menu ID 48)
    _ctrl = findDisplay 46 displayCtrl 48;
    if (!isNull _ctrl) then {
        _ctrl ctrlShow false;
    };
};```
#

to disable Command menu

little raptor
#

no

brisk lagoon
#

hahaha

#

a friend sent me this, said he saw this somewhere long time ago

#
{
    class disable_zoom
    {
        units[]={};
        weapons[]={};
        requiredVersion=1;
        requiredAddons[]=
        {
            "A3_Functions_F"
        };
        magazines[]={};
        ammo[]={};
    };
};
class CfgVehicles
{
    class All;
    class AllVehicles: All
    {
        class ViewCargo
        {
            initFov=0.75;
            minFov=0.75;
            maxFov=0.75;
        };
    };
};
#

nvm it doesn't work, just for vehicles I guess

sullen sigil
#

(my code still doesnt work im recording a video to show it now)

little raptor
#
dummy = "logic" createVehicleLocal [0,0,0];

dummy attachTo [player, [-0.0441161,0.152569,0.131032], "neck", true];
dummy setVectorDirAndUp [[-0.403727,0.856752,0.320582],[-0.0251403,-0.388644,0.920953]];
addUserActionEventHandler ["zoomTemp", "activate", {
        dummy switchCamera "internal";
    }];
addUserActionEventHandler ["zoomTemp", "deactivate", {
        switchCamera player;
    }];
#

@brisk lagoon probably the best thing you can hope for blobdoggoshruggoogly

brisk lagoon
#

I'll try one sec

little raptor
#

also it only "disables" the temp zoom

#

normal zoom still works (using Numpad+- or mouse thumb keys)

brisk lagoon
#

so I found a mod that disabled zoom when you don't ads, and it works with vanilla weapons but nothing else, SPS and all those don't work with that

sullen sigil
brisk lagoon
#

lmao

little raptor
sullen sigil
#

yes but same thing happens when submarine isnt attached

#

its just there to provide a better visual

little raptor
sullen sigil
#

(and i also attached a submarine to your example and it looked fine)

#

with the sine wave thingy

sullen sigil
little raptor
#

no plz don't meowsweats

sullen sigil
#

i must prove my point

little raptor
#

your videos are just too slow to load πŸ˜…

#

at least make them web optimized meowsweats

sullen sigil
#

i will compress it

#

probably

little raptor
#

you sure you tried this properly?

#

oh also I forgot to ask last night: is your server FPS stable?

sullen sigil
#

yes and yes

little raptor
#

as in locked exactly in a specific FPS?

sullen sigil
#

i remember trying that one properly bc i had to relaunch it to correct the _newDirAndUp select 0 stuff

sullen sigil
little raptor
#

well the example I sent you should've worked just as fine as the rotation thingy

#

the only thing wrong with it is this:

#

but it should only be a problem if your FPS is not stable think_turtle

#

well it doesn't hurt to fix it still blobdoggoshruggoogly

sullen sigil
#

see

sullen sigil
little raptor
#

what is it?

sullen sigil
#

thats the submarine logic object

#

just without the submarine

little raptor
#

not accounting for diag_deltaTime

sullen sigil
#

ah

little raptor
sullen sigil
#

suppose it's just a straight multiply by diag_deltaTime?

#

the submarine is just attached to the logic object

#

it doesnt get moved or touched at all

little raptor
#
{
    private _turnSpeed = (_config_TurnSpeed select _forEachIndex) * 45 * diag_deltaTime;
    _newOrientation pushBack ((_x min _turnSpeed) max _turnSpeed * -1);
} forEach _targetOrientation;
#

to get the same thing as when you test in 45 FPS

sullen sigil
#

I shall test it

#

could you not use diag_fps instead of 45? πŸ€”

little raptor
#

no

#

I wrote it for a fixed FPS

sullen sigil
#

roger doger

#

uploading now, thank you

#

nope, still juddering meowsweats

little raptor
#

(β•―Β°β–‘Β°)β•―οΈ΅ ┻━┻

sullen sigil
#

mood

#

at this point its usable but it could be better as you have evidenced meowsweats

#

for some reason the controls always seem to be flipped too regardless of their order in the controls array which is quite funny

#

but thats able to be fixed somewhat easily

south swan
#

and i still say that for jitter to happen you either need to have orientation applied not every frame or for multiple orientation sources to fight blobdoggoshruggoogly

little raptor
#

they're CW not CCW

sullen sigil
#

no as in pitch is now yaw etc

little raptor
#

so back then when you used BIS_fnc_rotateVector3D it was rotating them CW

sullen sigil
#

i could try take it out of a cba pfh?

little raptor
sullen sigil
#

unlikely that is the issue but its a possibility

#

could be causing orientation not being applied every frame on dedi πŸ€”

#

nope, exact same

boreal parcel
#

Anyone got any ideas why restarting a server normally saves mission progress, but an admin running the #restart command in-game would cause it to lose all progress/save data?

The mission in question is a modified version of liberation

#

though I dont believe the modifications are the issue. The issue apparently only started happening recently but no changes have been made to the mission in that time-frame

mystic scarab
#

Hello, I saw I can use the function backpackItems to get a simple list of every item in a unit's backpack. Is there a function that does the same for a container?

mystic scarab
hallow mortar
#

* when I say "vehicle" that also means crate inventories, they're the same system

mystic scarab
#

Related, what's the difference between addItemCargoGlobal and addItemCargo and similar functions?

hallow mortar
#

Network locality.
addItemCargo works only on objects that are local to the machine where the command is executed, and only adds the item on that machine. That means that if, for example, a client runs the command on an object that's currently local to the server, nothing will happen, and if it runs the command on an object that's local to that client, only that client will see the item. (Though inventories might be synced at some point regardless, not sure)
addItemCargoGlobal works on any object no matter where it's local to, and adds the item for all machines.

#

On the command page, this is displayed as argument locality (whether the object provided as an argument to the command must be local) and effect locality (whether the effects of the command are visible globally), using the small icons just below the title.

mystic scarab
#

I see, thank you, that really helped me make sense of it πŸ˜„

tough abyss
#

Is it possible to make draw3dIcon local to one player only? Meaning only one player gets to see the 3d icon and the rest doesn't?

tender fossil
foggy stratus
#

For an MP mission, what command can I use to get the names of all Mission Parameters? I know I can use BIS_fnc_getParamValue to get the value of a parameter, but I want the names of all the parameters so I can set them with my mod.

proven charm
granite haven
#

i got a q on CfgRemoteExec i have it on whitelist only, can the server still exec functions thats arent in the whitelist?

#

because i want to have a function wich the server can RE but the clients can't

south swan
granite haven
#

meowsweats my bad i didnt see that line, thank you

#

even tho its the first one on the page... smh

opal zephyr
#

Do event scripts work in an addon? For example im putting initServer.sqf in my pbo's root and it doesnt seem to run

little raptor
#

no

finite dirge
#

Oh, that's really odd. I'll see what I can do. I have some checking that basically finds if it's code vs text and forces to SQF if not text only, it must be breaking. Not sure why that would kill it though. Maybe the site hates x and decided to block hashtags wlizlaughlol

little raptor
#

so if you use that, that's why πŸ˜…

#

dunno about the rest tho

obsidian mirage
#

Is it possible to save a composition and use a script to spawn it?

jade acorn
#

although it requires a workaround as iirc there is no way to "really" spawn a composition, instead you use BIS_fnc_objectsGrabber to get an array of data of nearest objects and then BIS_fnc_ObjectsMapper to place them.

opal zephyr
#

Does anyone know why creating a display using the ui on texture stuff takes forever to be findable by findDisplay? Its taking up to 5 seconds before findDisplay is able to actually find the display by its unique name

little raptor
#

You mean the game freezes for 5s?

sullen sigil
#

are .ogv file formats able to support transparency? figure best place to ask is here

#

(video format arma uses)

opal zephyr
#

the game continues just fine

little raptor
#

And you do this in SP?

sullen sigil
#

sadge, thx

opal zephyr
#

I can work around it with a sleep and a faster loop, so I guess its not major

#

A bigger issue, is perhaps this one:

addMissionEventHandler ["EntityCreated", {
      params ["_entity"];
      if (_entity isKindOf "CAManBase") then{
          _entity addEventHandler ["Hit", {
              params ["_unit", "_source", "_damage", "_instigator"];
              [_unit] call J3FF_fnc_handleHit;
          }];
          [_entity] spawn J3FF_fnc_createBloodDisplays;
      };
  }];

The hit event refuses to run. This whole script is being executed on the server. The spawn works great, but the eventhandler does not

granite sky
#

Is the entity local to the server?

#

EntityCreated fires on non-local entities as well, and Hit won't trigger for those.

opal zephyr
#

The entity should be local to the server. Its an ai being spawned through zeus. I was under the impression all ai were local to the server, apart from ones on a headlessclient

#

I also tried remote executing the eventhandler onto the server

granite sky
#

depends. If you spawn them into a player group then they'll be local to that player.

opal zephyr
#

Ah, no they arent being spawned into a group

sullen sigil
#

ai spawned via zeus are local to the client that spawned them too iirc

granite sky
#

I would expect them to be spawned local to the curator object, but if in doubt, check it.

#

ugh, exitWith does that non-obvious-escape thing when used in a getDefaultOrCall.

#
_testHM = createHashMap;
_testHM getOrDefaultCall ["wibble", { if (true) exitWith {0} }, true];
_testHM

[["wibble",<null>]]

granite sky
#

Christ, HandleDamage generates two different general damage results for the same bullet in different frames

#

I shudder at the thought of the weird spaghetti code underneath this.

fleet jewel
#

Hi guys, who know how to set turret target by default for UAV. I set AR-2 Darter in Editor on 250 height, but when I connected to UAV, pitch of direction equals 0, how to set custom target for UAV turret(when I connected turret watch on target). Analog of uav lockCameraTo [guy,[0]]; without freezing turret.

tidal idol
#

Currently I'm writing a script with a buddy of mine that involves sending hints to specific units. In this snippet, _initiator can be a unit or an array of units (vehicle crew). The friend wrote this with the intent for it to be a multiplayer-compatible script that only displays the hint to the vehicle crew, but this means when in singleplayer, I can see the hint whether I am _initiator or not. This is obviously immersion-breaking (and would confuse anyone toying with the mod in SP), and I'd like the script to also be SP compatible because it is tied to a bunch of mod vehicles' config event handlers.

Is there some way I can check if the player is in SP, and if so, only display the hint if player is in _initiator?

"Scan complete:\nInitializing repair."        remoteExec ["hint", _initiator, false];```

Edit: I believe I have solved this by placing the hint calls in an `if` statement which checks a variable previously evaluated to be `player in _initiator`
kindred tide
#

if player summons a rain of cars that fall from the sky, and they kill someone on impact, how do i make it so the kill counts as being done by the player?

#

if the unit is killed by some object, who will be "killer" in the Killed EH?

#

basically i want the falling cars to be treated as projectiles

#

as if they were shot from player weapon

#

doc says it's the unit itself in case of collisions

#

what if it wasnt a collision but explosion of a grenade that was spawned using createVehicle

fleet sand
#

Quick question. Lets say i have a variable saved in player/server profile during run time on a mission. And i do restart the mission will that variable still be writen or will it desapear ?

fleet sand
granite sky
#

It's persistent until the profile corrupts itself :P

#

Closing the game properly will save the profilenamespace to disk, or you can force it with saveProfileNamespace (do not spam. It's extremely slow).

#

I'm not exactly sure when missionProfileNamespace saves to disk.

proven charm
#

can you change the engine added actions (scroll menu) somehow? like change the text?

warm hedge
#

No

proven charm
#

ok thats what I thought too

tender fossil
brisk plover
#

Alright lads, I'm completely new to scripts and was curious to see how difficult it would be to make a script that would allow you to switch between uniforms in your inventory. Does anyone have any idea if that's possible in Armas engine?

little raptor
brisk plover
little raptor
jade acorn
#

I think I'm missing something, how do I set up an outro for scenarios? Wiki says that initIntro.sqf is run when intro or outro is started but from what I have tried so far it activates only for the intro phase. Do I need some variable to make a part of the initintro.sqf to be run in outro phase?

little raptor
#

I'd say it depends how you end the mission

little raptor
# brisk plover Basically 0, I've written a couple of configs for uniforms but that's it

Well then it's kinda difficult
You need some SQF knowledge to understand this:

  1. Get the list of inventory items using something like items command
  2. Iterate over the items and check if item is a uniform. iirc uniforms are defined in cfgWeapons (or cfgMagazines). You can also use BIS_fnc_getItemType, I think
  3. Switch to the uniform using forceAddUniform and remove it from the inventory (removeItem iirc), and put your old uniform in your inventory (addItem iirc)
brisk plover
jade acorn
#

I know that Outro can be either Win or Lose but there seems to be no getter or any function to set a part of initIntro.sqf to be played in any of the outro phases.

hallow mortar
#

(or BIS_fnc_holdActionAdd)

still forum
still forum
#

Now is too late to make any more changes πŸ˜„

sullen sigil
#

Does anyone know if there's an order that should be done between setVectorDirAndUp and setPos[...] like setDir? πŸ˜…

#

(i am running out of ideas on how to fix my code)

#

if there is its not what was breaking it
have tested vectormagnitude of the new vectordirandups in both world and modelspace and theyre fine too
https://sqfbin.com/iwadevuhasoruzovubay same orientation stuttering as before

astral bone
#

wait, does curatorSelected give everything all curators have selected or?

hallow mortar
#

It's very likely that it's local only. It'd be really hard to do anything with it otherwise.

granite sky
#

It's local, yeah. Probably interface rather than logic object related.

granite fog
#

how to unify vehicles in array across clients ? I would like to record on server all vehicles on mission and get some of them on client later by publicvariable

little raptor
#

By making a function that receives an array as parameter, and appends to an existing array, and remoteExecing this function by the clients

#
[_clientArray] remoteExec ["my_fnc_add", 2]
params ["_arr"];
serverArray append _arr
#

This would not be very useful tho as you can't tell what belongs to who but it should give you an idea

granite fog
#

seems I wrote incorrectly. I would like to compare vehicles by some "ID"

#

is vehicle object have unique id like players ? Which must be same across all clientsis vehicle object have unique id like players ? Which must be same across all clients

little raptor
#

Well they have netId

#

But I still don't know what you mean blobdoggoshruggoogly

granite sky
#

Normally you can compare objects by comparing objects.

granite fog
#

yes but objects have netid which are different across clients, isn't it ?

granite sky
#

No, that's the point of a netId.

#

Also the objects... are the same across clients. Mostly.

granite fog
#

Mostly ?

#

Any exceptions ?

granite sky
#

Map objects are generally local, so a separate copy of them exists on each client.

#

you can create local objects intentionally with script as well, but every normal function will create objects globally.

granite fog
#

Understood, appreciate for answer

granite sky
#

For a practical example, you can publicVariable an array missionTrucks on the server at init, and then any client could do cursorObject in missionTrucks.

boreal parcel
#

in the eden editor the units/vehicles are listed via categories right?
for instance USA (USMC - D) and USA (USMC - WD), and each contain categories like Infantry (etc) Cars Tank etc

Is it possible via SQF to just grab units from a certain category without knowing any classnames?

#

I have taken a look at a script that grabs all units from one side:

_data = [
    [ [], [], [], [], [], [], [] ], //EAST
    [ [], [], [], [], [], [], [] ], //WEST
    [ [], [], [], [], [], [], [] ], //INDEPENDENT
    [ [], [], [], [], [], [], [] ]  //CIVILIAN
];

{
    if ( getNumber( _x >> "scope" ) isEqualTo 2 ) then {
        _index = switch ( true ) do {
            case ( configName _x isKindOf "CAManBase" ) : {
                0
            };
            case ( configName _x isKindOf "Car_F" ) : {
                1
            };
            case ( configName _x isKindOf "Tank" ) : {
                2
            };
            case ( configName _x isKindOf "Helicopter" ) : {
                3
            };
            case ( configName _x isKindOf "Plane" ) : {
                4
            };
            case ( configName _x isKindOf "Ship" ) : {
                5
            };
            case ( configName _x isKindOf "StaticWeapon" ) : {
                6
            };
            default{ -1 };
        };

        if ( _index > -1 ) then {
            _side = getNumber( _x >> "side" );
            if ( _side in [ 0, 1, 2, 3 ] ) then {
                _data select _side select _index pushBack configName _x;
            };
        };
    };
}forEach ( "true" configClasses( configFile >> "CfgVehicles" ));

this would work I guess, but is there a way I can determine if a unit/vehicle is from a specific mod?

astral bone
#

do you know the mod name

boreal parcel
#

Yeah, currently using RHS but I would be able to find out mod names yes

little raptor
#

but mods sometimes define their own
there's no standard

astral bone
#

I forget the command for it, but you can see what addon something is from

#

unless ya type object type

boreal parcel
#

hmm it might just be better to go about it the way this script is doing it and then filter based on mod

granite sky
#

configSourceAddonList, configSourceModList

boreal parcel
#

oh that looks like what I need, thanks

astral bone
#

unitAddons typeOf player;

#

also there's that

#

although, that gets the addon- err- "sub" addon.

#

OPTRE_UNSC_Units_Army in my current mission, as opposed to "OPTRE"

boreal parcel
#

gotcha, ill fiddle around with these and see what works best for me

#

this seems to be abouts what I need. When playing as a RHS USAF unit it returns @RHSUSAF which is the mod name. Good enough for me

hint str (configSourceMod (configFile >> "CfgVehicles" >> (typeOf player)));

Incase anyone is curious or needs it, I modified the above script like so to get units/vehicles etc from specific mods.
https://pastebin.com/86msrrTV

astral bone
#

is there a way to reduce overall brightness of lights?
It seems like EVERYTHING is blinding here xD

manic sigil
astral bone
#

Correction: for reflectors.

#

Or- wait- idek, all I know is headlights are blinding at night. But the decor street lights are perfect

#

gas price sign. obviously it's washed down b/c of how close I am, but still

#

maybe it is my brightness?

#

oh wait- nvm

#

ok, not something I can script to fix either x3

hallow mortar
#

You can try playing with setApertureNew

fading jay
#

is there a similar function to addHeadgear and addVest that lets you assign an insignia?

mystic scarab
#

Hello, I'm trying to write the contents of a container to an inidbi file and then read them back and add the items to the container to create a persistent stash. I keep getting an error that I'm trying to pass a string and it expects an array and if I try to convert the string to an array, I get an error that it expects an array and receives a string. Can anyone tell me what I'm doing wrong? Here is my code:

  _cargo = ["read", ["Stash", "Weapons", ""]] call ionStorage;
  {
    _currentItem = parseSimpleArray _x;
    operationStorage addWeaponWithAttachmentsCargo (_currentItem);
  } forEach _cargo;
hallow mortar
astral bone
#

is there an upper limit to light flare range

boreal parcel
#

so say I want my params to expect multiple data types, how would I go about that? something like this as far as I can tell?
_var should be either a string or an array of strings

params [
  ["_var", "", ["", []]];
];
#

also, say I was expecting a side what would I put for that?

south swan
#

any side blobdoggoshruggoogly You can consider it checking the input with isEqualType

boreal parcel
#

ah I see.

#

then for a function that will want the name of either one or multiple mods, and the side it should be getting for those mods I have something like this

params [
    ["_mod", "", ["", [""]]],
    ["_side", east, [east, [east]]]
];
#

I did read though would the length of the innermost array affect how many elements can be passed?

#

looking at examples on the wiki confuses me a little

south swan
#

["_mod", "", [""]] for only accepting strings

#

["_side", east, ["", east]] for accepting side or string

#

["_array", [0,0,0], [ [] ], [3,4]] for accepting only arrays of length 3 to 4

boreal parcel
#

alright I think I understand it a little more. so for my _mod var I would want to instead do something like so? and do I need to define the expected length of the array?

[ "_mod", "", ["", []], [1, 5] ],
grand idol
#

I need to format large numbers to strings with comma seperators. The following works but it seems like there has to be a simpler way:


_number = 58976504;
_string = [_number,100] call BIS_fnc_numberText;
_stringLen = count _string;
_iterations = floor (_stringLen / 3);
_leftOver = _stringLen - (_iterations * 3);
_array = [];

for "_i" from 1 to _iterations do {

    _sel = _string select [(_stringLen - 3), 3];
    _string = _string trim [_sel , 2];
    _stringLen = _stringLen - 3;
    _array pushBack _sel;
    };

_array pushBack _string;
reverse _array;
_newString = _array joinString ",";

This gives "58,976,504", which is exactly what I want. So is there a simpler way?

hallow mortar
#

I feel like there might be a function for it, but you can also use insert to avoid cutting up the string

little raptor
#

also just a side note: your number is too big

#

numbers in SQF are floats

#

you shouldn't use any integer larger than 16.7M

#

because it's not accurate anymore

#

for example, 58976503 and 58976504 produce the same output

grand idol
#

Great, thanks for that. That number was for testing, I won't be processing numbers larger than 9M, but that's very good to know.

south swan
boreal parcel
#

gotcha yep, I kept it anyway. My params appear to be working as intended.

#

is there a way to tell what side a unit is from just from the typename?

south swan
boreal parcel
#

oh perfect, thanks

#

just to refresh my memory, missionNamespace getVariable "TAG_var"; is the same as just using TAG_var right?

south swan
#

yes, outside of some specific circumstances (like with uiNamespace... block)

boreal parcel
#

so I should be able to do something like (missionNamespace getVariable "TAG_var") set ["index", "value"] assuming TAG_var is a hashmap?

south swan
#

it works

boreal parcel
#

awesome, dunno if what im fixing to do is considered janky or not lol. in my head it seems like a good idea

boreal parcel
#

hey so after all those questions this is my final result. It appears to be 90% working.
https://sqfbin.com/ixasutolonikavaqupaf

I am having an issue though, it seems like its missing some things? specifically aircraft. I know RHS USAF has more helicopters and jets than the results I am getting (a single jet listed as a helicopter, and a single type of helicopter with multiple variations)

anyone see any obvious problems?

#

I have checked, one of the missing helicopters (AH-64) does inherit the Helicopter base

flint sentinel
#

triggerActivated end_task_1;

How do I make the trigger activate when both end_task_1; AND a second trigger are complete?
Simple question but new to scripting

jade acorn
#

triggerActivated end_task_1 && triggerActivated yourSecondTriger in trigger condition

flint sentinel
#

&&, got it

#

thank you

jade acorn
flint sentinel
#

Thank you!! I couldn't figure out how to word my search earlier, but this is exactly what I needed

south swan
#

also, there's no need to set those arrays, they would be changed in-place. And setting the third parameter of getOrDefault to true would auto-create empties when attempting to get them blobdoggoshruggoogly

south swan
#

the problem with not all classes getting checked is likely caused by use of if (...) exitWith {}; in the body of forEach loop (or maybe that's just after my edits in the code). if (...) then {continue}; should be used instead

south swan
#

(another styling tidbit: in line 49 if ( getNumber( _x >> "scope" ) isEqualTo 2 ) then { can be changed to if ( getNumber( _x >> "scope" ) isNotEqualTo 2 ) then {continue}; to save the entirety of block from extra level of indentation)

tidal idol
#

Anyone able to help me pass parameters from a module to a function? I tried following the docs example, but that broke the bis music function call, so I reverted to an earlier iteration of my parameter setup, but now the script only uses the default switch case.

Edit: solved by replacing everything above _tracklist with:

_logic = _this param [0,objnull,[objnull]];

_TrackListIndex = _logic getVariable ["TrackListIndex", 5];
_TrackDelay = _logic getVariable ["TrackDelay", 5];```
boreal parcel
#

yep that solved it thanks. Cant believe I missed that still

sleek galleon
#

Howdy people, and welcome to today's episode of "I can't make a simple thing work".

I'm using this script : this setObjectTexture [0, "AT4meme.jpg"];

It's meant to display a little meme on some AT training. For some reason,whenever I close/open again the mission file, the image disappears from the mpmission folder, and therefore the script can't execute, any idea ? (I've tried closing arma, and only then adding the image, but once I reopened the mission in editor, the JPG disappeared again

warm hedge
#

Firstly, you're misunderstanding a bit - the code will be executed anyways, just it can't find the image.

How do you put the jpg? Where? and what do you mean by

I close/open again the mission file
?

sleek galleon
warm hedge
#

Big or small is not even a concern. Which is your billboard?

sleek galleon
#

Whiteboard

warm hedge
#

This is the texture that is used in Altis' Whiteboard

#

You already know why it does show bigger

sleek galleon
#

I see

warm hedge
#

Blank whiteboard texture is located in \A3\Structures_F\Civ\InfoBoards\Data\MapBoard_Default_CO.paa

sleek galleon
warm hedge
#

Opening PBO

sleek galleon
#

Imma look stupid but where do I open PBO ?

warm hedge
#

Well, Google can suggest. There is more than one ways

opal zephyr
#

Hello, I am still having issues using findDisplay to get a display created by a procedural texture on a dedicated server

#

It consistently gives No Display no matter how long I wait after I create it

#

This is the line that creates it:

_unit setObjectTextureGlobal [_forEachIndex, format ['#(rgb,%1,%2,1)ui("RscDisplayEmpty","%3")', _texSize#0, _texSize#1, _uniqueUIName]]; 
warm hedge
#

How's _texSize?

opal zephyr
# warm hedge How's `_texSize`?
_texSize = getTextureInfo _x;

if (_texSize#0 > J3FF_UIE_TexQuality) then{
    _texSize set [0,J3FF_UIE_TexQuality];
};
if (_texSize#1 > J3FF_UIE_TexQuality) then{
    _texSize set [1,J3FF_UIE_TexQuality];
};
#

This script works perfectly fine in singlePlayer, but mp breaks the display bit

warm hedge
#

What is J3FF_UIE_TexQuality?

opal zephyr
#

its a cba setting that returns 1024,2048,or 4096

#

all the tests have been with 1024

warm hedge
#

Okay then, how do you verify it is No Display?

opal zephyr
#

I use finddisplay and then remoteexec systemchat it

warm hedge
#

More precisely. More like the code itself

opal zephyr
#
//Buffers until the display is created.
_breakTimer = 0;
waitUntil {
    sleep 0.25;
            
    _breakTimer = _breakTimer+1;
    if (!isNull (findDisplay _uniqueUIName)) exitWith {true};
    if (_breakTimer>100) exitWith {true};
    false;
};
    
_display = findDisplay _uniqueUIName;
        
[(format["Display:%1",_display])] remoteExec ["systemChat", 0];
#

in theory it shouldnt be leaving until the display exists or until the timer exits it

hallow mortar
#

Is this running on the server itself? I don't know if the DS can do display/UI stuff since it... doesn't have a display or UI

#

Might need to do it locally on each client

opal zephyr
#

Its running wherever the ai is local, and the ai is placed in 3den, so very likely the server

opal zephyr
opal zephyr
#

Ok I think that worked @hallow mortar ! Im creating the displays on a client now. A slight problem is that I cant then find said display inside of a hit EH, it gives the No Display again

#

EH is being added wherever the client is local

#

mm maybe its because the display only exists where it was created... so on the client

#

okok

south swan
#

nah, on listen server setObjectTextureGlobal from any machine does create display on all (both checked) clients

opal zephyr
#

ya just tested it within my code too

#

I wonder why the hit Eh cant find it then

south swan
#

what's _uniqueUIName? How is it synced between machines?

opal zephyr
#

its attached to the unit as a variable when the display is created, and then is grabbed later

#

and ive just confirmed that the variable is valid and correct

#

Also, when I try saving the display itself instead of the name, it prints back as No Display in the hit event

south swan
#

saving display on any one machine is pointless as all displays are local blobdoggoshruggoogly

opal zephyr
#

So is there a way to do it then?

#

I even tried remoteExecuting the bit of code from the hit EH on the client where the display was created

south swan
#

what you're doing now: save unique name as a string, findDisplay locally on machine where it's needed blobdoggoshruggoogly

opal zephyr
#

Ill try it again, but it didnt work last time

#

I might have made a mistake with the publicity of the variable, testing it now

south swan
#

and given that each and every change to the UI texture would need to be remoteExec-ed (as all displays are local), just changing to remoteExec-ing setObjectTexture on every machine can work as well

opal zephyr
#

Alright I have it working mostly. Now I need a script to make sure the client that the display exists on is still in the game

south swan
#

all displays are local

opal zephyr
#

Ya... Ive modified it to be handled by the clients with just setObjectTexture like you suggested

ornate whale
#

How can I loop a sound "AlarmCar" for 10 seconds? Shoud I use playSound or createSoundSource?

opal zephyr
#

Depends if your sound was created in cfgSounds or cfgVehicles

gentle zenith
#

Hey all, wondering if anybody has any advice about an issue I'm having on my life server.

After the server has been up an hour or so and the population gets high, some players start becoming invisible to one another. I've seen this mentioned in other Arma 3 bug post on google and haven't found any solutions.

It was mentioned it may happen after a ragdoll has occurred to a player (such as being hit by a vehicle). I've got a few actions happening once the player stops playing the 'unconscious' animation, but hasn't helped the issue at all.

Could anybody offer any insight? I'm quite lost with this one.

tidal idol
#

Need some help with a module setting a variable to true, which is checked by a trigger...
My trigger has the condition _B47_WZ_ModuleMissileLaunched = true;, but it won't activate when the sequence reaches zero. Is it something wrong with the trigger? Module? I'm not really sure what since to my knowledge that's a global variable.

ornate whale
drowsy sparrow
tidal idol
#

Ah, thanks. I noticed that in a function a friend wrote, he used a setVariable command. Would it also be in good practice to use that on this variable in the missionNameSpace?

drowsy sparrow
drowsy geyser
#

how can a random sleep time be synchronized if the script is executed globally? i just noticed that it doesn't choose the same random sleep time for everyone

cosmic lichen
#

Store the value of the random sleep interval in a public variable

still forum
#

@opal zephyr display might only get created when it's visible on screen

manic sigil
#

@quiet pagoda

Look at disableAI and doSuppressiveFire

quiet pagoda
#

thanks a lot!

mystic scarab
# hallow mortar It's tricky to diagnose this without knowing what `ionStorage` is actually retur...

Hello and thanks for replying. I tried using the copyToClipboard commands and they don't copy the value. I can show the value of Weapons on screen through *hint str _x; * and it's ["hgun_P07_blk_F","","","",[],[],""] from the Weapons key in my inidbi file. The whole file looks like this right now (it only has a handgun, a separate mag and a bandage in there I put for testing):

[Stash]

Weapons="[["hgun_P07_blk_F","","","",[],[],""]]"
Magazines="[["16Rnd_9x21_Mag"],[1]]"
Items="[["ACE_fieldDressing"],[1]]"
Backpacks="[[],[]]"

When I try to pass it to addWeaponWithAttachmentsCargo it complains that it's a string and if I try to pass it to parseSimpleArray first, it complains that it's an array
ionStorage is a inidbi object made with ionStorage = ["new", "ionStorage"] call OO_INIDBI;

sullen sigil
#

copytoclipboard takes string

mystic scarab
sullen sigil
#

oh but parsesimplearray should return a string thonk

hallow mortar
mystic scarab
sullen sigil
#

is it emptying the clipboard or just not copying it

mystic scarab
#

erm, it's returning something now so I must've done something wrong with it before. This is the result from copytoclipboard str _x: ["hgun_P07_blk_F","","","",[],[],""]
Edit: so that specifically doesn't work with copytoclipboard (without str), but if I try to use it with addWeaponWithAttachmentsCargo it's telling me it's a string

#

Ok, I think I figured it out by feeding it the value directly and noticed I had ["hgun_P07_blk_F","","","",[],[],""] and it expected [["hgun_P07_blk_F","","","",[],[],""], 1]

ornate whale
#

How to give player a backpack? This player addBackpack "B_Messenger_Grey_F"; does not work.

tough abyss
south swan
ornate whale
south swan
#

in arsenal when editing unit loadout the classname is shown in popup. Or you can dive into config viewer

south swan
#

also, in editor it's "grAy", not "grey"

hallow mortar
tough abyss
hallow mortar
#

CfgVehicles West is not CfgVehicles Equipment :|

boreal parcel
#

so im looking in the wiki for Dynamic Simulation and I see it mention Global Dynamic Simulation settings, is there a way to set Dynamic Simulation settings per unit/object?

For instance with a unit chasing after a player, the player may easily get away but I dont want the unit to stop there with dynamic simulation, I would like for it to complete a waypoint back to where it came from or something like that.

Describing it to myself now it would probably be better to just write a script that manages Simulation for units huh?

jade acorn
#

just don't enable dynsim on that unit

#

or rather on a group it's in

kindred zephyr
ashen ridge
#

I'm using drawIcon3D and need to set the default value for textSize because i want to change drawSideArrowns parameter.
What is the default value for textSize? See Wiki description:textSize: Number - (Optional, default: size of system) text size

ornate whale
#

What is wrong with this piece of code? It says that I use wrong data type. if ((restrictedAreas select {player inArea _x;}) == []) then {suspicious=false;};

kindred zephyr
#

you are selecting from a list using a boolean while comparing an empty list πŸ—Ώ

south swan
#

arrays should probably be compared with isEqualTo

ornate whale
kindred zephyr
#

does select has that type of syntax? im half zombie right now

tidal idol
#

Is it possible to immediately cut the sideRadio of a unit without killing the speaker (it's a preset identity)?

ornate whale
south swan
#

screenshot for comparison. Left with those values manually set, right with defaults

little raptor
south swan
#

also, wiki seems to list incorrect default font

winter rose
#

stop finding wiki faults

boreal parcel
#

is there a way to just grab all map Locations or should I really just use nearestLocations with a radius the size of the map?

little raptor
#

afaik no

#

yeah no

boreal parcel
#

okey thanks then

ashen ridge
tepid vigil
#

I have a function that's printing out weird remoteExec errors, and I don't know why. A null object passed as a target to RemoteExec(Call) even though I believe that the function handles all possible null scenarios? This is the only place where this function gets remote executed so it must originate from here
https://pastebin.com/MgH6bPQ2

#

All I can think of is _unit being deleted while this function is running, but what are the odds of that happening?

little raptor
kindred tide
#

ctor must never have side effects. ctor must never have side effects. ctor must never have side effects. ctor must never have side effects.

#

i had to reinvent the concept of "constructor" because SQF doesnt have that lolg

tidal idol
#

How do I convert a string to a variable name? _CustomSender is a string parameter from a module, and defaults to an empty string '', which causes the if statement to return true and work perfectly fine.
However, if I place a unit in 3DEN called missileman and enter that into the string entry box of the module, the else condition fires as shown. Currently, this is causing errors saying that B47_WZ_ModuleMissileSpeaker is undefined.

Secondary question - how can I include a check to make sure that a unit with a custom name exists? (If it does not, I will fall-back to the if statement condition and make one.)

kindred tide
#

compile

#

though compile will output it as code, in {}

#

so call compile

tidal idol
#

so call compile _CustomSender;?

kindred tide
tulip ridge
kindred tide
little raptor
hallow mortar
fast lichen
#

hello, i want to open the two gates at the front with a trigger Land_Airport_01_hangar_F

ID animate ["door_1_rot",1]
works at the back entrance

["door_2_rot",1] or ["door_3_rot",1] does not work for the two doors at the front

how about the command for the two front doors?

stable dune
# fast lichen hello, i want to open the two gates at the front with a trigger Land_Airport_01_...

there is in config animate class

class animate {
}
[["door_1_rot",0],["door_1_locked_rot",0],["door_2_move",1],["door_2_locked_move",0],["door_3_move",1],["door_3_locked_move",0]]

so you can use

// Close
private _hangar = cursorObject; // or this , testing with cursorObject
_hangar animate ["Door_2_move", 0];
_hangar animate ["Door_3_move", 0];

// Open
_hangar animate ["Door_2_move", 1];
_hangar animate ["Door_3_move", 1];
granite haven
#

how can i check if a number is negative or positive

#

im not trying to make it so -4 becomes 4

#

but i need a check that only returns true if a number is positive not negative

south swan
#

_x > 0 blobcloseenjoy

granite haven
#

notlikemeow dayum.... thanks

#

xD

#

Brain isnt braining tonight

median zenith
#

Do people have a simple pop-up text script for a zeus op? Go on youtube and google and all I can find is "how to add pictures and videos to your intel" or "how to make it go into the map" and "this works in sp scenario" -_-

#

I just want simple pop up text like the one that comes when you complete a task in vanilla scenarios

manic kettle
#

If that's not what you mean you need to give more context

median zenith
#

I'll test that out, thanks!

But to give more context: I want my team to go to a laptop, interact with it (take intel), and when that's done they will get a short pop-up message that says the intel

manic kettle
median zenith
#

No other way? I really don't want achilles in my ops

manic kettle
#

Well sure. Here's a vanilla friendly way

  1. Put down the object in editor
  2. In the init create an add action
  3. Within the addaction use the hint command and write what you want
#
  1. The above works for sending the hint to the player interacting. If you want to send to all players you need to remote execute hint
median zenith
#

I ended up doing:

this addAction ["079001 or 074006", {}];"

And it satisfies my needs, even if it's very dull and amateur ish. You got me there, thank youπŸ˜‚

pulsar pewter
#

just change it slightly:
this addAction ["Search Laptop", {hint "YourMessageGoesHere"}];

tulip ridge
#

How can I hide a display without closing it?
I saw someone in a forum post use <layer> cutRsc ["default", "PLAIN", 0.5]; to hide an element, but that still seems to "delete" it.

I thought it may have just been because of how I was creating it, because I the display saved to a mission namespace variable. I thought that since I wasn't setting the variable to the new display value (when creating it), that's why it wasn't showing up.
It was because of that, forgot to update the other part of the code that I set up the display. Although I did use cutFadeOut to make it look nicer

ivory meteor
#

Does anyone know how to make like a underground complex turn dark because rn i Made one on the airfield but it has light coming through the outside

kindred tide
#

did you make it programatically or by editing the map/terrain

kindred tide
#

why does this create a new task every time it's called

#

oh i see now

#

wait no, i don't

granite sky
#

The createSimpleTask is executed regardless of whether it's used.

#

It's just an element in an array that's passed to getVariable.

kindred tide
#

i see, thanks

tulip ridge
#

How can I check if something returns "No Display" (when trying to find a given display/dialog)?

#

displayNull

warm hedge
#

isNull

tulip ridge
#

That too, realized the reason I was getting an error is because getVariable returned [No Display] and I forgot to select the first element

ivory meteor
#

Do I need to use deformer

jade acorn
#

Changing ground level won't change the map lighting, and you can't make tunnels in Arma because it's only capable of ditches, you have to cover the roof with objects. All you can do is change the daytime to nighttime

#

Alternatively set the overcast to 1 so light is very dim.

ornate whale
#

What is the best way to implement a script trigger without using a trigger entity or an indefinitely repeating if cycle? It seems like a very inefficient way to check a condition every x miliseconds. Can I, for example, create an event handler for when a player picks up an item or enters a vehicle? What are the other options?

jade acorn
#

You can change the number of seconds trigger checks for its condition. And it's in seconds, not milliseconds

ornate whale
#

Do you know why this command might not work? KillSpongebobTask setTaskState "Succeeded";

#

I have a create task entity with task ID KillSpongebobTask. But when I try to call this command, it does nothing.

ornate whale
#

Should I put there the variable name instead?

winter rose
#

a task ID is a string

ivory meteor
#

Does anyone know how to put images into intel documents for missions and they get a new task from grabbing them?

kindred tide
#

theres some weird html like language

#

i saw today, trying to find it

#

setDiarySubjectPicture and createDiaryLink, i think

#

idk what the expressions in <> are supposed to be and where to find their syntax

warm hedge
kindred tide
#

looks like it, yep

#

though it also has an "execute expression" in it , so it's not just formatting text

ivory meteor
#

I is confused

winter rose
#

hi confused, I'm dad!

ivory meteor
#

πŸ’€

iron tundra
#

Any ways on how to make 3rd person locked only on specific vehicles?

warm hedge
#

You can actually lock TPP only for infantry but not vehicles via Description.ext, but is that not something you look for?

ornate whale
#

How to make a separate AI squad leave an AI driven helicopter when it reaches a land waypoint? I tried leaveVehicle command, Unload, Unload Transport on the heli driver, and GetOut waypoints on the passenger group. They are just stuck inside. πŸ˜„

proven charm
#

maybe you need to synchronize the waypoints

#

did you place both groups in the editor? or via script

ornate whale
#

But they dont.

proven charm
#

did u try syncing with getout wp?

ornate whale
proven charm
#

hmm well I personally just use moveOut on the whole group

winter rose
#

mods?
like, AI mods?

ornate whale
#

None.

proven charm
#

what I use: ```sqf
manLeaveVehicle =
{
params ["_man"];

_man remoteExec ["unassignVehicle",_man];

[_man] allowGetin false;

moveOut _man;
};```

ornate whale
#

The problem was that I disabledSimulation of the vehicle, and then enabled again.

#

But somehow it disabled even the passengers.

#

When I apply, for example, flyInHeight 20;, should I give this command to the pilot or the vehicle itself?

winter rose
#

doc doesn't say
please try and report back so I can amend

kindred zephyr
#

I had been having a problem lately where a certain mod and my personal system for a mission conflicting in regards of animations, it looks like sometimes I can get locked in an animation where the phase never gets completed and get stuck in a weird camera position.

I've tried adding some countermeasures after my system ends its operation, which just does a switchMove or Playmove for the animation "" but that doesnt seem to reset my animation. This is a problem because the hip-torso position gets locked and the main display camera ends up pointing just to the direction of the head.

Had anyone had the animation get locked like that and if so, had found a solution for that kind of errors?

The mod that conflicts with my system is "Animate", and seems to happen when the "position detection" for large weapons happen (that changes the animation while the weapon is too close to a surface) and my animations play at the same time. I have some probable solutions in mind but other opinions/suggestions are appreciated.

Asking in a general way, since this seems like an issue on "stacking animations" rather than the mod itself being the issue.

mild pumice
#

Hey guys, what is the "cleanest" way to empty a hashMap ?
I'm doing like this right now

// init
CACHE_PLAYERS = createHashMap;

// add data
CACHE_PLAYERS set [_steamID, _data];

// reset cache
CACHE_PLAYERS = nil;
CACHE_PLAYERS = createHashMap;
winter rose
mystic scarab
#

Hello, I'm trying to get a persistent container using inidbi and thanks to your previous help I've gotten persistency to work for items, weapons and magazines, but now I need help with backpacks.
Is there any way to get the contents of a backpack? I tried using backpackItems but that doesn't return magazine ammo count or attachments.
Ideally, I'd like players to be able to place their backpacks in the containers and have them saved exactly as they are.

mild pumice
winter rose
granite sky
#

(hopefully)

winter rose
#

have a little faith, Arthur

granite sky
#

I have less faith in Arma the more I learn about it :P

fair drum
tulip ridge
#

More related to math than scripting specifically, but I currently have a UI element and decrease its height to represent a value lowering. It currently shrinks towards the top of the screen, since I'm just decreasing the height, but I'd like to have it shrink towards the bottom; which will require lowering the height and then moving it down.

Not sure if it will look janky in-game, but I'd like to try it to see if it's alright.

This is my current setup:

// Get current display values
private _ctrlFuel = _display displayCtrl 9001; // Idc for the fuel control

// Sizes for the fuel display, these values MUST match the ones defined in BNA_KC_Jet_Dialog
#define WINDOW_HEIGHT 0.3
#define FUEL_HEIGHT WINDOW_HEIGHT * 0.95// 95% height of background

// Animate the display lowering
_ctrlFuel ctrlSetPositionH (FUEL_HEIGHT * ([_jetpack, true] call BNAKC_fnc_GetJetpackFuel)); // Returns value from 0 to 1
_ctrlFuel ctrlCommit 1;
granite sky
#

In this case you'd just increase ctrlSetPositionY by however much you decrease ctrlSetPositionH by.

tulip ridge
#

There's not a way to just get the current position is there?
Didn't see any on the wiki

granite sky
#

ctrlPosition

tulip ridge
#

Ah I was looking for "ctrlGet..."

#

That makes that easier, thought I'd have to rely on "make sure to change the same value in two places" like I did for the height

granite sky
#

SQF commands usually skip the get

tulip ridge
#

Oh it returns the height as well, handy. Not as useful here, since I always need the max height of it

hallow mortar
#

There are a lot of get... commands

winter rose
#

if (random 1 < 0.5) then { _string = "get" + _string };

tulip ridge
#

All the commands were named by Chat GPT

granite sky
#

I think they'd be more consistent if they were

#

Also throw would have been for AIs chucking grenades :P

winter rose
#

"captain, the AI just threw a… string at the enemy?"

tulip ridge
south swan
#

inb4 CT_PROGRESS πŸ™ƒ

mystic scarab
fair drum
mystic scarab
wary sandal
#

can I define custom units with custom loadouts in mission config file?
it doesn't work when i do it with "createUnit"

granite sky
#

There is generally not much you can do with mission config.

wary sandal
#
import B_Soldier_F from CfgVehicles;

class CfgVehicles
{
    class test: B_Soldier_F {};
    class unit_rifleman: B_Soldier_F
    {
        displayName = "test unit 1";
        editorPreview = "img\wl_logo_ca.paa";
        uniformClass = "gear_UAF_kit01";
        linkedItems[] = {"gear_platecarrier_UAF_02","gear_ach_UAF_01","ItemMap","ItemCompass","ItemWatch","ItemRadio"};
        weapons[] = {"rhs_weap_ak74m"};
        items[] = {"FirstAidKit"};
        magazines[] = {"rhs_30Rnd_545x39_7N10_AK","rhs_30Rnd_545x39_7N10_AK","rhs_30Rnd_545x39_7N10_AK","rhs_30Rnd_545x39_7N10_AK","rhs_30Rnd_545x39_7N10_AK","rhs_30Rnd_545x39_7N10_AK","rhs_30Rnd_545x39_7N10_AK","rhs_mag_rgn","rhs_mag_rgn"};
    };
};
#

this is my config

granite sky
#

createVehicle won't look in mission config.

wary sandal
#

well i'm using createUnit

granite sky
#

Before you start listing all the creation functions you're using, just assume that none of them will look in mission config.

wary sandal
#

there's no way around it? I have to use addons?

granite sky
#

Well, you can setUnitLoadout...

#

but you can't define vehicles or weapons in a mission.

ornate whale
south swan
#

well, you can save a loadout in missionconfig and setUnitLoadout it onto freshly created unit, if i understand the question now blobdoggoshruggoogly eyyy, actually reading messages can save me from typing all of this

supple matrix
#

I need to gradually increase fog and overcast over time, in a MP mission.
But when i try to script it, the changes are not smooth, probably because as is written on the wiki, the weather system cannot process two commands at the same time (ie. fog and overcast).
(and i haven't even tried to see if it even works in MP reliably - i see a lot of complaints regarding the weather system, that it has syncing issues - but i can't tell if that is indeed current state, or if that's how it used to be ages ago)

Obviously, i could just set the appropriate sliders/values in the mission Intel settings.
But then i have no ability to control when the transition starts happening (i want to have an option of configurable and random delay).

I imagine i could divide it into stages and alternate between increasing the fog just a bit, then after its done do the overcast a bit, then fog again, then overcast, and so on, until both reach the desired value.
But that is just crazy talk! Surely there must be some less insane way?

Am i missing something?

wary sandal
#

has anyone ever made a script where you can only get the items in arsenal from addons (like RHSAFRF, RHSUSAF)?

iron tundra
hallow mortar
fair drum
gusty rivet
#

Hi, im trying to work on something for the tanks in the DLC, i have the tank set up with a custom ammo loadout, and it is linked to a respawn module, however when the tank dies and the respawn module respawns it, it fully resets the vehicles ammo to default, as well as its appearance and its inventory.

How can i set the respawn module to respawn the tank exactly as it was set in the editor before it died?

fair drum
#

You'll have to do some scripting

gusty rivet
#

i have tried by removing the shells and then adding in the custom loadout ammount of shells but even that gets reset when it spawns

fair drum
#

show me what you have so far

gusty rivet
#

yeah unfortunatly i deleted the whole thing, been trying for quite some time and kinda rage quit at it xD

fair drum
#

what is the tank class, and what do you want to modify. give me specifics and I can write something

gusty rivet
#

lemme just boot up my arma again and see if i can dig it up

opal zephyr
#

It would appear displays that are created while a player is tabbed out of the game turn black

#

To get around this, does anyone know a method of checking if a player is focussed on the game? This just seems like a really weird issue

opal zephyr
#

heck ya, couldnt find that with googles, thankyou

gusty rivet
# fair drum what is the tank class, and what do you want to modify. give me specifics and I ...

So the tank class is: "SPE_M4A1_75"

We are trying to give the tank the following ammo every time the respawn module triggers, and trying to get it to clear everything from its inventory:

(i believe all the shell class names are correct)
[APHE x 40] - SPE_M61_M1_AP
[HVAP x 20] - SPE_T45_M1_APCR
[HE x 20] - SPE_M48_HE
[WP x 5] - SPE_M64_WP
[Smoke x 5] - SPE_10x_M89_SMK

but for some reason the respawn module keeps reverting it to the default loadout, and appearance, though we had the following in the module to force the appearance but even that doesn't work?

_veh = createVehicle ["SPE_M4A1_75",position player,[],0,"NONE"];
[
_veh,
["standard_4AD",1],
["armour_hide_source",0,"star_hide_source",0,"stowage_hide_source",0,"rhino_hide_source",1,"logs_hide_source",1,"skirts_hide_source",0]
] call BIS_fnc_initVehicle;

Pretty new to coding with arma so not etirely fully sure on a lot of things atm :/

fair drum
#

alright give me a few

gusty rivet
#

Much appriciated

fair drum
#

have to download the compatibility data since i don't have the dlc

gusty rivet
#

ah, if its too much trouble dont worry about it

fair drum
#

its not, just takes some time. 20 gigs

wary sandal
#

how can I make an arsenal where you can only equip items/clothing from RHS for example?

wary sandal
fair drum
# gusty rivet So the tank class is: "SPE_M4A1_75" We are trying to give the tank the followin...
params [["_newVeh", objNull], ["_oldVeh", objNull]];

if !(local _newVeh) exitWith {};

// Delete all mags
private _mainMags = _newVeh magazinesTurret [0];
_mainMags apply {
    _newVeh removeMagazinesTurret [_x, [0]]
};

// Add mags
private _mags = [
    ["SPE_M61_M1_AP", 40],
    ["SPE_T45_M1_APCR", 20],
    ["SPE_M48_HE", 20],
    ["SPE_M64_WP", 5],
    ["SPE_10x_M89_SMK", 5]
];

_mags apply {
    _x params ["_class", "_count"];

    for "_i" from 0 to _count - 1 do {
        _newVeh addMagazineTurret [_class, [0]];
    };
};
#

confirmed working

gusty rivet
#

ah sweet, where would i apply this?

fair drum
#

pic 1 is your module

#

pic 2 is the file, you would just put that file in the root of your mission. or change it to whatever and update the path in the module

#

name it whatever. this is just to show you how its done.

#

you would change the starting amount, cause this only applies to respawns

gusty rivet
#

ah, is there any way i can apply this directly to the module itself so it can just run off of that or would this be the only way to do it?

wary sandal
#

I know how to open arsenal

fair drum
#

oh im tarded. one sec. thats just making it all avail

wary sandal
#

yeah

#

also note that i'm using virtual arsenal

fair drum
#

that's how you create your whitelists

fair drum
wary sandal
gusty rivet
fair drum
wary sandal
#

i'm thinking of getting all entries in cfgVehicles and selecting those that are added with RHS but i'm not entirely sure how to do that

fair drum
gusty rivet
fair drum
#

okay

1.) Create a file in the root of your mission folder and name it shermanLoadout.sqf
2.) Copy paste the code I wrote into it
3.) Save file
4.) Open game
5.) Place down the tank you want
6.) Change the tanks ammo loadout, or place in the init box [this] execVM "shermanLoadout.sqf"
7.) Put down your respawn module
8.) Connect your tank to the respawn module
9.) In the expression line place: _this execVM "shermanLoadout.sqf"
10.) Profit
11.) Repeat for other tanks (or sync the same tank type to that single module - other tank types need a different set of code+module)

#

I don't think I can make it more clear unfortunately

gusty rivet
#

ah ok, thanks alot man really appriciated

wary sandal
#

i want to basically exclude all vanilla content

fair drum
#

what item types? or you want everything in cfgweapons that is rhs?

#

@wary sandal

wary sandal
#

from mags to backpacks and weapons

fair drum
#

standby

fair drum
# wary sandal well any item type really lol
// Build array of things

private _configs = toString {
    "RHS" in (toUpperANSI configName _x)
} configClasses (configFile >> "CfgWeapons");

// Filter usable

_configs = _configs select {
    getNumber (configFile >> "CfgWeapons" >> configName _x >> "scope") == 2
};
private _classes = _configs apply {configName _x};

// return
_classes
wary sandal
kindred tide
#

since agents are groupless (i suppose they can't join a group at all?) , does it mean they will never use vehicles automatically to travel large distances? (because i can't addVehicle to them)

fair drum
kindred tide
#

oh no it's starship troopers lada edition

#

(they are all chasing me)

little raptor
#

Another easier way is just reading what's under weapons[] in cfgPatches

distant mirage
#

I went the whole ordeal to script a sound to a object to and have it be a 3d sound while the object is moving (like a loud speaker on a vehicle). but i want EVERYONE to hear it. unfortunately, i can hear it in my own server because i have the sound in my sqm. if i export the pbo to a server host the sound doesn't work.

kindred tide
#

is there any advantage in putting that in an actual fsm file? like performance

#

my goal is alive world with lots of AI agents living their routines

fair drum
kindred tide
#

so is it worse for performance? my update tick is 1 per second

#

idk how the engine handles when there's many FSMs, maybe it's hella optimized and despite running every frame it'll still be faster

kindred tide
#

idk if the distance calcs here being done every second for dozens/hundreds of agents is potentially a problem

granite sky
#

What you can do is set preconditions to early-out, but it's still running a chunk of SQF per frame per FSM.

ancient mural
manic kettle
#

is there a way to flag a specific AI to not be handed over to headless client?

warm hedge
#

You can probably just setVariable and check if you're about to pass AIs to headless

manic kettle
#

hmm yeah true

mystic scarab
#

So in my quest to make a persistent storage container, I got how to get weapons, magazines and containers such as uniforms, vests and backpacks.
How do I get misc items like medkits from a container, though?
getItemCargo returns those, but it also returns uniforms and vests, which I already get from everyContainer

mystic scarab
jade acorn
#

not sure where to ask but how does ragdoll work in Arma? If a dying body (through a script) is within 500m distance to player, the ragdoll will activate and body falls on the ground which is very nice. If it's outside that 500m radius (and killed through a script), it just immediately switches to that animation of lying on the ground with weapon in hand. But if I, a player, kill another unit that is in any distance, or it's killed by an AI that is close to the player, the ragdoll will play. Is there any FSM tied to that? Or some function? Or how could I bypass that ragdoll limitation to have it played on any killed unit no matter how far it is from the player?

#

the requirement is that the player's unit has to be constantly playable and it's a singleplayer mission, so teleporting player on Killed EH (or Hit) is a no no

wary sandal
#

?

[missionNamespace, _classes] call BIS_fnc_addVirtualItemCargo;
[missionNamespace, _classes] call BIS_fnc_addVirtualBackpackCargo;
[missionNamespace, _classes] call BIS_fnc_addVirtualMagazineCargo;
[missionNamespace, _classes] call BIS_fnc_addVirtualWeaponCargo;
["Open", missionNamespace] spawn BIS_fnc_arsenal;
``` this excludes unfiroms, vests, etc
wary sandal
little raptor
#

But what Hypoxic wrote should work too

wary sandal
wary sandal
#

rifles pistols launchers magazines work tho

little raptor
#

IDK just see all config commands maybe

little raptor
#

They're vehicles/weapons

kindred tide
#

will nearestObject "Road" work for finding nearest road segment?

little raptor
#

I doubt it

#

There's nearRoads

kindred tide
#

nearRoads requires a radius, and i need the nearest road at any distance

little raptor
#

You can use it with a radius of 69m

#

And sort

#

(and no that 69 is not a joke)

kindred tide
#

is that a hard coded magic number

little raptor
#

Kinda

#

It's ~70m

#

If the geometry LOD is larger then the size limit, it gets glitchy (collision does not work for example and the object may disappear at certain view angles). The exact value of the limit is not yet known, but it is somewhere around 50-60 meter from the center of origin (meaning that your object can be 100m wide/long at max if it is symmetrical to the center of origin).

#

Basically you can rest assured no object is bigger than that

#

Otherwise it won't work

#

In which case you can just ignore it

#

As does the game

little raptor
#

Roads usually don't have a class at all

#

Except maybe bridges

kindred tide
#

i'm really not connecting how "object size" is relevant. i'm trying to find the nearest road to some arbitrary position

little raptor
#

You said you didn't know the radius for nearRoads

#

What I said is max radius for any object

#

Even nearestObject uses a max radius of 50

kindred tide
#

wait, is it creating an invisible sphere and testing it for intersections with geometry, and the radius limit for that sphere is 70 meters

little raptor
#

No

#

The game uses some kind of quadtree

#

But don't know how exactly it does the search

#

Anyway that size limit is probably related to how small the smallest leaf node can get or something

hallow mortar
#

I think you're talking at cross purposes

kindred tide
#

ok so like, if there's a huge forest like 200x200 meters, and i take some arbitrary point deep in that forest near the center, there's no chance i can find the nearest road to it?

little raptor
#

You can

#

With nearRoads

#

But not with nearestObject

#

But you know fot sure no single road is on that point

#

Due to size limit

hallow mortar
#

nearRoads with a radius of worldSize or something would probably do it.......
.........but you can't use that because it's not in OFP

little raptor
#

Anyway I guess what I'm saying is starting to get confusing

#

worldSize / sqrt 2

kindred tide
#

i'm only confused because i'm unsure size of what is involved here, the meshes that make up the road surface?

#

like, it's not 1 huge mesh but many and their individual size doesnt exceed 70 m across

hallow mortar
#

Roads are made of segments. The size of a segment can vary but can never extend further than ~70m from its centre point. I think commands like nearObjects detect objects by their centre point, so in theory, you could have a road segment that extends into your search radius by up to ~70 metres, but is not detected because its centre is not in the radius.

#

I think there was a bit of confusion between what you were asking about and what was said, because this doesn't really matter for what you're trying to do.

#

Unfortunately, a lot of the commands that would be useful for what you're trying to do, were only added in A2 or later. So you're really limited on ways you can do this.

wary sandal
#

uniforms, vests, helmets, etc are vehicles right

#

so how do I whitelist RHS uniforms

keen stream
#

@queen cargo I think "SQF - Against all Logic" would be a better title..

wary sandal
#

I'd like to have a normal arsenal that is RHS only, is it possible?

hallow mortar
#

Vests, helmets, and uniforms are all CfgWeapons

nocturne bluff
#

SQF - How to not language

kindred tide
fair drum
boreal parcel
#

do buildings have any "tags" ? ways I can distinguish if they are medical, military, civilian buildings etc?

im looking into my options when it comes to spawning items/units based on the location type and so far my best plan is just to use Ellipse and Rectangle areas to mark out a radius/position of different types of areas and then also searching for specific types of buildings probably based on text in the typeName

supple matrix
#

I guess you could also get some config information from the config of a given class name.

hallow mortar
#

Buildings don't have any information like that. Unless they actually have a working support functionality (like fuel stations etc), the building's notional purpose is purely aesthetic. You can guess from the classname but there's no guarantee that tells you anything useful.

boreal parcel
#

Yeah so far im thinking my best bet might just be to either grab every building type on a map and classify it myself in the mission, or grab buildings on the go and guess what they are based on the class name

#

just wanted to be sure though

sullen sigil
#

if ("hospital" in myclassnameofmyhospitalbuilding) then {}; etc

#

but obviously not guaranteed

boreal parcel
#

I think im just gonna go with the former option and classify all buildings myself. Though this does make it difficult if I or someone ever wants to port to a different map

covert pendant
#

is anyone familiar or could offer advice on how to implement an SQL database to work in tandem with a MP server? I'm working on a mod that would add "combat effects" to a player. The player would be less affected by these effects over time.

sullen sigil
#

personally i would go with something like

if ("hospital" in toLower myclassnameofhospitalbuilding || {myclassnameofhospitalbuilding in myarrayofhospitalbuildingclassnames}) then {};``` so you don't have to do *everything*
#

sqfbin plz

#

or at the very least

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
covert pendant
# covert pendant is anyone familiar or could offer advice on how to implement an SQL database to ...
//
// Define the key to store the player data in the profileNamespace
private _playerDataKey = "MyTrainingMod_PlayerData";

// Function to retrieve the player data from the profileNamespace
private _getPlayerData = {
    profileNamespace getVariable [_playerDataKey, [0, 0]];
};

// Function to save the player data to the profileNamespace
private _savePlayerData = {
    profileNamespace setVariable [_playerDataKey, _this];
};

// Function to calculate the training level based on hours played
private _calculateTrainingLevel = {
    private _playtime = (_this select 1) / 3600; // Convert playtime to hours
    // Adjust the formula as per your preference
    // For example, linear formula: _playtime / 10
    // Exponential formula: 2 ^ (_playtime / 10) - 1
    _playtime / 10; 
};

#
//
// Function to decrease combat horror effects based on training level
private _applyTrainingEffects = {
    private _trainingLevel = _this;
    // Adjust in-game variables based on the training level
    // For example, reduce screen shake:
    player setUnitTrait ["camShake", 1 - _trainingLevel];
    // Adjust other effects as per your design.
};

// Function to update the player's training level and apply effects
private _updateTraining = {
    private _playerData = _getPlayerData call _this;
    private _trainingLevel = _calculateTrainingLevel call _playerData;
    _applyTrainingEffects call _trainingLevel;
    _savePlayerData call [_trainingLevel, (_playerData select 1) + 1];
};

// Initialize the player's data and training level when they join the server
if (isServer) then {
    if (isMultiplayer) then {
        // Use the unique Player UID as a key to store player data
        private _playerUID = getPlayerUID player;
        private _playerData = [_playerUID, 0];
        _savePlayerData call _playerData;
    }
    // Apply training effects when the player spawns
    player onPlayerRespawn {
        _updateTraining call _playerUID;
    };
};

// Periodically update the training level (e.g., every 5 minutes)
if (isServer) then {
    private _updateInterval = 300; // 300 seconds = 5 minutes
    while {true} do {
        sleep _updateInterval;
        {
            _updateTraining call _x;
        } forEach allPlayers;
    };
};
sullen sigil
#

did chatgpt write this

covert pendant
#

i used it to assist, yes

sullen sigil
#

yeah
dont

#

half of this makes no sense

covert pendant
#

fair enough, I can unfuck that -- question still stands on the SQL stuff though

sullen sigil
#

and i dont know why you're using profilenamespace if youre intending on using an sql database as well

#

but you will need to write an extension for that

#

unless someone has made one for a3 which is possible

covert pendant
#

I'd replace that so that it can't be stored locally and thereby edited by a player directly

kindred tide
#

is it possible to make agents walk instead of running? they ignore setSpeedMode

shell cipher
#

Is there a way to force a players vehicle radar to be turned off?

shell cipher
#

Yeah I was afraid of that, that removes the whole sensor though and would require me to re-enable it, I was looking to have it just switch off so the player is forced to turn it on manually, something like setVehicleRadar but working for players

shell cipher
queen cargo
#

good idea @keen stream
think i will steal it

foggy stratus
#

How do I test if an owned DLC is loaded or not? I use the following to determine if Spearhead is owned, but I also need to test if Spearhead was checked as loaded on the DLC page in Arma launcher.

#

_hasSpearhead = (1.17538e+006 in (getDLCs 1));

hallow mortar
#

Check for it in CfgPatches, I think

cosmic lichen
#
isClass (configFile >> "CfgPatches" >> "WW2_SPE_Core_t_Core_t");
foggy stratus
#

Thanks gents, that works great!

cosmic lichen
#

or

isClass (configFile >> "CfgMods" >> "SPE");
tawdry sparrow
#

Does anyone know how to stop a turtle (spawned as Agent) from being deleted as soon as surfaceIsWater returns true?

foggy stratus
#

If you don't need him animated,then maybe createSimpleObject. If you need him animated, then you could try attaching him to a hidden object that is in water at some relative position where turtle is out of water. Not sure if that would work though.

little raptor
tawdry sparrow
#

Thanks for the Answer!
The (sort of stupid) idea is to have a giant flying turtle, by having it attached to a helicopter.
and i want it to do the swimming animation.
Calling playMove or animate on the turtle created with createVehicle does not work (or i am doing it wrong)

#

But the turtle is deleted as soon as surfaceIsWater returns true for the turtle
:'(
I also have not found a eventHandler i could override to stop it from detecting surfaceIsWater

little raptor
#

Did you even try disabling the animal behavior like I said?

tawdry sparrow
#

yes

little raptor
#

Does it disappear or get deleted?

tawdry sparrow
#

99% sure it gets deleted

little raptor
#

Well verify using isNull (I'm pretty sure it doesn't)

tawdry sparrow
hallow mortar
#

Not in OFP~ :D

hardy valve
#

Hello i have edited the RHS su-25 to use skin from Ukraine faction and was able to change side, add sensors etc. But i am now stuck trying to change the pylons in the cfg and the patch doesn't seem to stick (or) I just don't have the correct base class. When i place the plane in the editor it still has its original pylon. Any help is greatly appreciated

sullen sigil
hardy valve
opal zephyr
#

Does anyone know of a consistent way to check if an object is being rendered?

#

Would checking if its visible work?

little raptor
#
  • occlusion or just being on screen?
opal zephyr
#

Well seen enough for a display to be created on it

#

Right now if the object isnt "visible" by the player the display just appears black

#

Right now im checking if theyre on screen and within a certain distance, and it works if theyre behind objects, but if theyre behind terrain then it doesnt seem to render the display

winter rose
#

world to screen aimpos & boundingbox corners, + tracing with line intersect perhaps 😬

opal zephyr
#

I can get a cheaper version of that with checkVisibility, but I dont want it to do it as soon as the player sees it because it creates a flicker thats unpleasant. Mainly when in buildings and close quarters its very obvious

#

Id rather it be able to do it through objects like buildings

little raptor
opal zephyr
#

I tried that with this, had mixed results

_surfaces = lineIntersectsSurfaces [(getPosASL player)vectorAdd[0,0,1.5], (getPosASL _unit)vectorAdd[0,0,1.5], player, _unit, true, -1];
    {
        if (_x#3 isEqualTo objNull) exitWith {_intersectsTerrain = true};
    } forEach _surfaces;
little raptor
#

I'd say something like:

count (worldToScreen ASLtoAGL getPosWorld _obj) > 0 && {
  _camPos = AGLtoASL positionCameraToWorld [0,0,0];
  _bbCorners findIf {!terrainIntersectASL [_camPos, _x]} >= 0
}
opal zephyr
#

wow terrainIntersectASL is a much better version than lineIntersectsSurfaces

#

Whats the point of the first bit?

little raptor
#

well it only checks the terrain

little raptor
opal zephyr
#

similar effect to this then?

((worldToScreen (getPosASL _unit))isNotEqualTo [])
little raptor
#

yeah

#

but iirc worldToScreen needs AGL pos

opal zephyr
#

ah, yes it does

#

thankyou

open fractal
#

is there a sqf extension available for vscodium? Nothing is coming up in search

jade acorn
#

it's basically the same thing as vscode no? Use the ones that are for VSC

tribal sinew
#

I'd like to disable some AI stuff for each unit when a scenario starts. For 3den placed units - not a big deal I guess, I can simply iterate over non-playable units. What about zeus placed units and units created/spawned during the scenario? Is there an event handler that I can insert into the mission itself that will handle those cases?

granite sky
#

Yeah, there's a whole bunch of curator event handlers.

#

Their locality is a bit non-obvious though.

tribal sinew
#

Got a tip from LAMBS discord to use the CBA_fnc_addClassEventHandler:

["CAManBase", "InitPost", {
    params ["_unit"];
    ...
}] call CBA_fnc_addClassEventHandler;
granite sky
#

If you have a CBA dependency, sure.

tribal sinew
#

Thanks a ton πŸ™‡β€β™‚οΈ

#

One more question - where would it be safe to call the addMissionEventHandler for e.g. EntityCreated. It has a local effect from what I see. So init.sqf would be fine?

fair drum
rustic lava
#

hey, could someone please help me. I am trying to get an array of buildings within a rectangular marker.

I was hoping the inAreaArray would do it but its returning an empty array.

This is how I have attempted so far:

buildings = ["Building"] inAreaArray "MOUT_RED";
hint str buildings; // testing to see if it works.

I have also tried with "House".

winter rose
granite sky
#

You're looking for something more like nearestObjects

winter rose
#

nearestTerrainObjects

rustic lava
#

yes but nearestObjects uses a radius

granite sky
#

Then filter using inAreaArray afterwards.

rustic lava
granite sky
#

nearestObjects and nearestTerrainObjects have different classification methods. Both of them suck.

rustic lava
#

so my understanding is this

allBuildings = nearestObjects [gameLogic, ["Buildings", "House"], 200];
redBuildings = allBuildings inAreaArray "MOUT_RED";

I am not able to test yet but will be soon.

stable dune
rustic lava
#

its not an equal sided rectangle 😦

winter rose
stable dune
granite sky
#

(no)

#

just pythagoras: sqrt (x^2 + y^2)

winter rose
#

okaaay, mister maths

#

(:p)

#

((divided by 2 if x/y are rectangle sides and not half sizes, ofc))

kindred tide
#

what is a working equivalent of doFire/doTarget for agents

winter rose
granite sky
#

It's kind of a shame that you can't use agents as a raw do-exactly-what-I-tell-you AI.

kindred tide
winter rose
#

I wish yes, but then "target something" is… AI-related

#

make normal AIs and disable most of their AI with disableAI?

kindred tide
#

can i use setDestination on normal units the same way as on agents, e.g "LEADER DIRECT" when the unit is stuck, so that it fazes through walls and gets unstuck?

#

agents are reliable because they can do that

#

i tried to setDestination a unit yesterday and it didnt work

#

yep, they're standing still

#

doMove and waypoints work, setDestination doesnt

granite sky
#

Have you tried using doStop on the AI first?

kindred tide
#

it did put some of them in motion but it's weirdly inconsistent and they don't drive after entering vehicles

#

also tried _grp setCurrentWaypont [_grp, 0]; and it's similar

winter rose
#

I would say it's better to know what you are trying to achieve

kindred tide
#

in short...
In the countryside there is a hidden suitcase with secret documents. Its location is completely random. There are locals that travel around the map, on feet and in vehicles. They enter buildings, climb ladders, and create a feeling of an alive world. You can approach them and ask about the suitcase. They either don't answer, or tell you an approximate distance to it. You should ask in multiple places to triangulate and narrow down the suitcase location. Some locals are secretly killers. They will be alerted when you ask them about the suitcase, and start stalking you at a distance, and then ambush and attack when you approach the suitcase. You are unarmed. Your home base is far away. Your goal is to find and return the suitcase.

winter rose
#

doesn't tell me why you mix agents and AIs

kindred tide
#

agents are reliable for navigation. i can trust that they get to their destination.

#

because they can go through walls if stuck

#

they climb ladders, enter buildings etc

#

and if my code detects that the agent is stuck, it changes it from "LEADER PLANNED" to "LEADER DIRECT"

#

is it possible to make a normal unit use simplified pathfinding like that, so that they ignore obstacles?

winter rose
#

use AIs where needed, use agents where needed

kindred tide
#

like, delete the agent and spawn a unit in its place when it's meant to engage in combat?

granite sky
#

That is entirely possible.

#

might be a small animation desync :P

kindred tide
#

it was in my different module where they could change profession and respawned as different class

supple matrix
#

How do you open car door?
Specifically the Tanoan police car, model offroad_01_unarmed_f.p3d,
class B_GEN_Offroad_01_gen_f.

Shouldn't it be something like _car animateDoor["door1", 1, true]?
...i tried any "door<whatever>" i could find in the p3d, but nothing works

winter rose
#

you may simply not be able to?

#

or try Door_L

supple matrix
#

i tried all these, just to make sure:
door1, door2, door3, door5, door7, dashboard_door_l, dashboard_door_r, hide_dashboard_door_l, hide_dashboard_door_r, hidedoor1, damagehidedoor1, door_L

...why would i not be able to? i mean the animation is clearly defined, otherwise yhou wouldn't be able to open...
OMG, crap, yeah, you are right, i just realized, the door may not be actually animated.
AAAAAAaaaaa, LOL

#

I keep forgetting that the game was made by "morons" like me πŸ™‚

#

I guess nobody thought it would be useful to be able to animate the door

winter rose
#

it was planned during alpha but ditched to focus on better things

supple matrix
#

yeah, well, i know exactly who to blame, what an irony πŸ˜„

supple matrix
# winter rose btw, tried `animateSource`?

yep, same result - nothing.
And its not surprising me, i just forgot all about the game - the car simply doesn't have openable doors.
You can only hide them, but not open.
The irony is that i may have been the one who made the config back then πŸ˜„ ...although, maybe not, i don't remember.

winter rose
#

who is this

#

found ya πŸ˜„

supple matrix
#

πŸ™‚

tulip ridge
#

Can't really think of a good way to word this, but I have some code that gets a list of units near a given point, runs some code, waits, and then finishes.

The thing is, if a unit walks towards the area after the list of units has been made, then nothing happens. I thought of maybe creating a trigger object and placing it there, and then running the code that way; but I feel like there'd be a better way.

Here's some omitted pseudocode for the rough kinda structure of my code

// nearEntities is faster than nearestObjects for normal units, but it does not sort by distance
private _nearbyUnits = _position nearEntities ["Man", _radius];

// do X for each unit in _nearbyUnits

// wait Y amount of time

// cleanup
little raptor
#

The thing is, if a unit walks towards the area after the list of units has been made, then nothing happens.
well obviously in that case the unit is not in the list. so you need a loop

#

nearEntities ["Man", _radius];
it should be "CAManBase"

granite sky
#

(otherwise includes goats)

tulip ridge
# little raptor > The thing is, if a unit walks towards the area after the list of units has bee...

But how exactly?
I get obviously I'd need to check the nearby units again, and then just run the same code for any potentially new units.

I run this code, sleep for some amount of time, and then run some cleanup code. I just don't see where/how I would check for new units

// nearEntities is faster than nearestObjects for normal units, but it does not sort by distance
private _nearbyUnits = _position nearEntities ["CAManBase", _radius];

{
    _x call BNAKC_fnc_someFnc;
} forEach _nearbyUnits;

sleep _duration;

// Delete smoke grenade, remove all handlers
deleteVehicle _projectile;
tulip ridge
little raptor
#

But how exactly?
it depends what you're doing

one example is:

private _units = [];
for "_i" from 0 to _duration step 0.5 do {
  private _nearbyUnits = _position nearEntities ["CAManBase", _radius];
  private _newUnits = _nearbyUnits - _units ;
  _units append _newUnits;
  {
      _x call BNAKC_fnc_someFnc;
  } forEach _newUnits;
  sleep 0.5;
};

or

_end = time + _duratioon;
while {time < _end} do {
  
  sleep 0.5;
};
tulip ridge
#

I definitely wouldn't have though of using a for loop to step through the time, that's smart
Duh it's just a number, but didn't think of it that way

#

I'll give those a shot, seems simple enough

kindred tide
#

it's meant to be spooky. while you're looking at the map, calculating where the next stash may be, and hear a car approach.

molten yacht
#

so a While loop will always finish itself up before rechecking its condition, right? It won't cut off mid-loop?

granite sky
#

It only checks at the start of each iteration, yes.

#

If you need to check in the middle you can do if (condition) exitWith

molten yacht
#

Okay, thanks.

proven charm
#

lobby is tricky because not all commands work in there. I ended up creating admin dialog when the mission starts and when user clicks start then the mission loads up

split scarab
#

I want to disable the automatic 4, Regroup and Contact, infantry, 300 meters west callouts, is there a way to have that automatically be disabled when the server starts?

jade acorn
#

no, you can't "replace" vehicles

#

either make your own version that supports both AA and AT rockets (Iguess it would be a matter of config entries but it's not me who does that stuff) or just have player leave the launcher and make an action to "change mode" of launcher which would hide one turret and show another in the same place.

drowsy geyser
#

I ran this code in init.sqf
but when I host the scenario, the laser is not visible to other players. I noticed that drawIcon3D is visible but drawLaser is not.

addMissionEventHandler ["Draw3D",
{ 
    if ((player getVariable ["moved",true])) then 
    { 
        drawLaser 
        [ 
            eyePos laserPointer vectorAdd [0, 0, 0], 
            (eyePos laserPointer) vectorFromTo (eyePos player), 
            [1000, 0, 0], 
            [], 
            0.7, 
            0.3, 
            500, 
            false 
       ];
    };
}];
south swan
#

u wot

#

both drawLaser and drawIcon3D only work for single local frame

hallow mortar
#

It's in a draw3d eh so single frame isn't the problem (probably)

#

Locality is though

south swan
#

so in the best case each player can only get a single laser that points directly into their camera

glossy pine
#

which type of files can u load with loadFile ?

little raptor
#

text files

glossy pine
#

ok thanks

#

its possible to detect with BE filters when someone tried to execute a disabled command?

warm hedge
#

BE does nothing to do with scripting commands

#

(AFAIK)

winter rose
#

there are regexes, buuut

glossy pine
south swan
open hollow
#

always have this doubt:

params dont "privatizes" the variables isn't it?

so this:

private _myvar1 = _this select 0;

is faster than:

params ["_myvar"];

i guess i should use private ["_myvar"]; before?

little raptor
#

params dont "privatizes" the variables isn't it?
it does

#

the first one is probably faster but it has nothing to do with private. the cost of private _var is 0 (but not private ["_var"])

#

it's because with params ["_myvar"] you also create an array. also params returns a value

open hollow
#

yea but worth it lol

#

we need tuples on sqf (?

little raptor
#

it'll never work, because of how SQF works.
it'll just be exactly the same as arrays

still forum
#

also the array creation cost for params will go away with sqfc.
So while the params is slower in debug console, if compiled from bytecode it would probably be faster

drowsy geyser
hallow mortar
#

I would usually use playableUnits + switchableUnits for that kind of thing. allPlayers includes dead people, virtual units etc. which you probably don't want.

grand idol
#

For a server-created public variable, are you supposed to re-declare it as public every time the server modifies it? If so, does the server publish specific indexes of an array? Eg: I have a variable that I created server-side, added an array value to is and then made it public:

BSFFlagPositions = [];
BSFFlagPositions pushBack [123,456,0];
publicVariable "BSFFlagPositions";

Then, in later scripts other values gat added so that we have [[123,456,0],[11627.4,11903.5,0.045191],[11362.8,11438.5,0.054359]]. If I log the variable on the client side, I only get the 1st array [123,456,0], but if I log it on the server, the whole package is logged. If I publicVariable "BSFFlagPositions"; after every entry the client has access to the whole package as well.

#

I was surprised by that.

leaden venture
#

!!!! Is it possible to get a refuel script so I can make a refuel station players can driver up to and get refueled?!!!!

grand idol
leaden venture
grand idol
#

No, the Huron crates.

#

and the repair depot thing.

#

B_Slingload_01_fuel_F
Land_Pod_Heli_Transport_04_fuel_F
Land_RepairDepot_01_civ_F
Land_RepairDepot_01_green_F
Land_RepairDepot_01_tan_F

fair drum
leaden venture
#

I cant make them work

grand idol
#

I don't use ACE, so I can't help there. Are you placing the refuel objects directly in your mission.sqm file, or in another script?

leaden venture
fair drum
#

Are you using the fuel pump lines? With ACE, it's not a proxy refuel

grand idol