#arma3_scripting

1 messages ยท Page 97 of 1

ashen ridge
#

Thanks a lot, POLPOX.

ashen ridge
#

This function only works in Eden Editor?

#

Attributes are available only within the Eden Editor workspace. You cannot access them in scenario preview or exported scenario!

warm hedge
#

Yes

#

This *command only works in Eden workspace

crude egret
#

im having a problem with my script atm...

I want to make a zone with ai spawning that hunts a player, i got the ai spawning etc set up and it works fine. player enters area, ai spawns, ai runs towards player.. i also made a max ai value so it doesnt infinitely spawns ai till the game/server crashes.

The only problem i have is.. im too stupid to make it so that if i kill enemies it removes the killed unit from the array (that array contains all the enemy units) so another one can spawn...

hopefully i explained it good enough bcs my english sucks xD Can any1 help me?

warm hedge
#

deleteAt and find can achieve to remove a certain value from an array

crude egret
#

can u give me an example?

#

so
(missionNamespace getVariable "activeAI") - [this select 0]];
doesnt even work?

#

(in the "killed" event)

warm hedge
#

Haven't looked your script yet, but this partially work. The issue is you didn't save it

crude egret
#

uhh

#

so everytime i change it i need to save with "saveProfileNamespace;"?

warm hedge
#

Wait what?

#

How does it even matter?

crude egret
#

or "saveMissionProfileNamespace;"

#

What u mean?

#

i did this now:

_x addEventHandler ["Killed", {
                _tempGrp = (missionNamespace getVariable "activeAI");
                _tempGrp deleteAt (_tempGrp find (this select 0));
                missionNamespace setVariable ["activeAI", _tempGrp];
                saveMissionProfileNamespace;
                hint "AI Unit died! Removed from activeAI";
            }];```

But it doesnt work. i tried to fix it for like 2 hours now ._.
warm hedge
#
  1. missionNamespace already is the default namespace
  2. profileNamespace or any other namespaces shares nothing with it
  3. saveMissionProfileNamespace doesn't exist
crude egret
#

so how do i fix my code? can u give me an example? the problem is just about removing the unit from the array when it dies

warm hedge
#
activeAI = activeAI deleteAt (activeAI find (_this#0))```
crude egret
#

uhh can u explain the "this#0" to me?^^

warm hedge
#

# is almost equivalent of select

crude egret
#

that was almost rude xD

warm hedge
#

?

crude egret
#

kk ty, im new to arma scripting so i might ask many stupid questions xD

#

but doesnt it select the first value in the array with "0"? How should i know where the unit is in the array?

warm hedge
crude egret
#

ah now i understand

#

kk ill try it out

warm hedge
#

You've already said you're rude or stupid or new to this, they are all don't matter as long as you can/want to learn and thank anyone who helps you

crude egret
#

i will thank everyone who helps me, but since i was trying to find a solution for more than 2 1/2 hours by now and tried like 20 different approaches, im kinda tired of spamming the google/biki search bar. at this point i just want a result, because even if i didnt found it myself, i still learn from it. for me its not about learning to code, its just about learning how to get something done in arma since its a whole lot different to java and other languages that i know.

warm hedge
#

SQF actually is not really a good language to learn programming 101, since this is about 20 years old and never updated the syntax or somewhat

crude egret
#

yea thats what im realising ^^

warm hedge
#

But you know what, this is the only language I can handle

crude egret
#

sqf just seems so confusing to me

crude egret
#

_tempGrp = _tempGrp - [_unit];
missionNamespace setVariable ["activeAI", _tempGrp];

works...

warm hedge
#

Again missionNamespace is the default namespace unless in a special case

drowsy geyser
#

what does this mean?
sleep (1 + random 4); sleep between 1-4 or sleep 1 + random from 1-4?

#

i need it the sleep between 1-4 but guess its the latter one right?

warm hedge
#

1 + random 4 is 1 to 5

drowsy geyser
#

thank you

leaden ibex
#

Hey there, can I spawn a "zeus" via script.

I got the game master module in the mission with #adminLogged as the owner, but let's say I need a second one for someone not logged in as admin, but he will have access to console.

Is there a way, to spawn a zeus for him, so when he presses "z" he will be transported into him, similary like the "admin's" one works? monkaHmm

manic kettle
leaden ibex
leaden ibex
gusty flame
#

Hey, I'm pretty new to Arma scripting and got a few questions, anyone able to give me some help? (In PM or here if that's the norm I guess)

drowsy geyser
#

why does this throw an error msg?
drone1 flyInHeight [100, true];
error msg:
error flyInHeight: type array, expected number

#

the drone is an "C_IDAP_UAV_06_antimine_F"

cosmic lichen
#

That's why

sullen sigil
#

not released yet

drowsy geyser
#

haha my bad meowsweats

oblique spoke
#

@gusty flame you're probably better off just asking your question(s) here and waiting for a reply.

ashen ridge
#

๐Ÿ˜‚

#

I made a line around

gusty flame
#

@oblique spoke Alright. Here goes: Is it possible to have a function-call as the condition in addAction? Something like this: http://pastebin.com/vv9scbEQ
I can't get it to work, if it's possible: What am I doing wrong?

cosmic lichen
#

Perfect

oblique spoke
#

my scriptfu is weak, but you have asked in the appropriate place. one of these goons will straighten you out i'm sure.

kindred tide
#

i havent opened A3 since 2020

#

has a lot changed?

little raptor
#

scripting wise yes there are many new commands
engine wise, kinda. the thermal imaging has changed. there were some mod-related stuff too
content wise no (apart from CDLCs)

kindred tide
#

back then i made a similar "find a hidden item by triangulating its location" mission for A3, but you were followed by invincible zombies rather than semi-friendly/helpful villagers

sullen sigil
#

that sounds like dayz

kindred tide
#

it's like a very lightweight dayz

#

just no survival mechanics, and ALL of it was pasted into 'init' field in a gameLogic object placed in editor

#

(i wrote the code in external file and pasted it back every time)

#

i'm having difficulty getting over A3 being 10 years old, for me it still came out yesterday

ornate whale
#

How to check, if player is prone? This does not work addUserActionEventHandler ["Prone", "Activate", { hint "Action!"; }];

tulip ridge
ornate whale
#

Thanks, but how can I incporporate that in an event handler? I don't want to use some while-do cylce or something.

hallow mortar
ornate whale
hallow mortar
#

Oh, try one for moveDown as well.

#

The prone (Prone Toggle) action is not bound in any of the default presets and it's likely you'll be using moveDown (Prone / Stand Up) instead

#

Note that this action is likely to trigger if the user presses the same action again to stop being prone, and won't trigger if they stop being prone because of a different action (i.e. crouching), so you'll probably need multiple handlers and some additional checks to cover every possible case

#

....and you'll want to monitor adjustUp and adjustDown as well, in case they get prone by cycling through all the intermediate stances

little raptor
daring thunder
#

I tried using
vehicle1 disableCollisionWith vehicle2;
to disabel collisions but it keeps telling me "Int: Missing ;" WHAT AM I DOING WRONG??? I typed it in correctly

tulip ridge
#

Can you show more of the actual code?
Can't really tell where the problem might be happening without it

daring thunder
#

helicopter attachTo [destroyer, 0,0,0]
helicopter disableCollisionsWith destroyer;

Im trying to make a goofy lil compisition

tulip ridge
#

No semicolon after [0, 0, 0]

daring thunder
#

but arma 3 doesnt want me to make it goofy

tulip ridge
#

Also I assume you're wanting helicopter attachTo [destroyer, [0, 0, 0]];?

daring thunder
#

Yeah

#

They attached just fine but the helicopter keeps exploding so I assume it was because the two are inside each other

tulip ridge
#

Try disabling the collision first, and then attaching

daring thunder
#

How do I disable collisions without scripts?

tulip ridge
hallow mortar
#

Make sure the helicopter isn't inside the destroyer when it's created.
attachTo will handle the position it ends up in, so the helicopter can be created anywhere...ideally somewhere with plenty of free space.

daring thunder
#

Im trying to find the screenshot but I can only steam screenshot in arma 3 gimmie a second

#

Doesnt work

open fractal
#

that tends to give you the missing semicolon error

granite sky
#

collision not collisions

daring thunder
#

Im going to chuck my computer out a fucking window it worked

#

Now I cant fly the chopper anywhere

hallow mortar
#

Well, no, because it's attached to the destroyer

tulip ridge
#

Are you wanting the other way around?

daring thunder
#

Im trying to make it where the helcopter flies the destroyer around

tulip ridge
#

Swap helicopter and destroyer

daring thunder
#

Okay

#

And its not attaching

tulip ridge
#

destroyer attachTo [helicopter];

daring thunder
#

The codes in there

hallow mortar
#

Something to keep in mind is that destroyers aren't actually one object. They're made up of multiple sections in order to keep within the engine size limits. The object you see in the Editor is a dummy. So there is more complexity here if you want to do it this way around.

daring thunder
#

Damn

#

I give up

#

Thanks for the help anyways guys

tulip ridge
#

Ah yeah, I forget it's multipart, only messed with them once for a retexture

daring thunder
#

I might come back later for something else

#

Trying to make custom aliens in arma

tulip ridge
#

Odd question, but has someone written a quicksort (or any algorithm really) for sqf?
Need to sort an array of units based on the length of a variable in the unit. I tried modifying a quicksort algorithm I found on this website, but I was doing something wrong since it kept returning the array out of order.

gusty flame
#

Alright, great :) Thanks

ornate whale
# little raptor animStateChanged is another EH you can use

Thanks all, it works now. Can I use this code, when I have more players in MP game, which can respawn or switch units, disconnect and reconnect?
{addUserActionEventHandler [...]; } forEach allPlayers; Or do I have to make onPlayerConnects event. I think I have answered my question. ๐Ÿ˜„

tulip ridge
#

You'd need an onPlayerConnects

granite sky
#

@tulip ridge You can use the engine sort to do it by making arrays with the target number as the first element, or BIS_fnc_sortBy will do the same thing for you.

#

sort is weirdly slow for an engine command but it's still going to be faster than anything you can do in SQF.

candid sun
#

malow that's incorrect code afaik

tulip ridge
#

Not sure I understand what you mean by "making arrays with the target number as the first element"

#

What "target number"?

granite sky
#

The one you want to sort by.

granite haven
#

is there like a CfgEmotes section somewhere? so that i can just get a huge array with emotes instead of adding one by one emotes to an array

tulip ridge
# granite sky The one you want to sort by.

I wanted to sort them by array length:

_units = [...]; // something like player, unit1, unit2, etc. etc.
{
    _arrayVar = _x getVariable ["someArray", []];
} forEach _units;
// Unit with the longest `someArray` would be _units#0, second longest would be _units#1, etc. etc.
granite sky
#
_units2 = _units apply { [count (_x getVariable ["someArray", []]), _x] };
_units2 sort true;
_units = _units2 apply { _x#1 };
tulip ridge
candid sun
#

why can't you just use the
'ACE_microDAGR' in (items _unit + assignedItems _unit)
bit from the function instead? tidy it up and have it as the condition

gusty flame
#

Because I'm planning on making the conditions more complex, checking if players has the DAGR, and if they're close enough to certain areas etc. It might be possible to add it all as one long line of conditions in the addAction call, but it would be so much better and easier if I could use a function for it I feel.

tulip ridge
#

"Oh nice, select already has a syntax for what I nee-"

little raptor
#

what do you need?

#

that syntax already works

#

the optional part is since 2.14

tulip ridge
#

Oh it's just optional in 2.14?

#

Oh nice

little raptor
#

if the command itself was since 2.14 you'd see the game version next to the syntax itself

tulip ridge
#

Gotcha
Makes sense looking back at it now, since the the syntax following it was 1.56

#

And also the big blue notice right under it...

candid sun
#

be careful, the condition is checked every frame if it's attached to the player

jade acorn
#

why does _unit lookAt getPos player make the AI turn itself to face that position but _unit lookAt player makes them either to not react, turn only a bit or just face a completely opposite way?

#

is it a bug or intentional? If they count glancing at player as looking at him then why looking at position doesn't do the same?

gusty flame
#

Is running script-code every frame on the client going to have any negative effects to performance? I come from using stuff like Unity etc. and there you could probably calculate PI in a script every frame without any affect on the performance for the client. I've read that in Arma you do need to be careful with executing too much script code, but will just a few extra conditions that are checked every frame actually make a noticeable performance impact even?

little raptor
#

iirc they look back and forth

#

did you use time acc?

jade acorn
#

nope, nothing touched

little raptor
#

also _unit lookAt getPos player is completely wrong

little raptor
jade acorn
#

the idea was to have the AI immediately turn facewards to player for a conversation and the 2nd script did that. But I hoped that with lookAt player AI would turn to face the player and keep looking at him, otherwise I have to loop that

little raptor
#

well like I said the first one is just wrong

#

it should be _unit lookAt unitAimPosition player

jade acorn
#

the getpos one worked so I guess it's not wrong at all? If I understand you the difference is that getpos returns a point at unit's feet while unitAimPosition is some memory point near the head

little raptor
#

getPos is also AGLS

#

the command needs AGL

#

and getPos is slow af

candid sun
#

i'm not schooled enough in programming to give you a good answer, but i know c# is way way way faster than sqf, and unfortunately sqf generally starts to look pretty ugly once you start doing complex stuff

pulsar pewter
#

hey folks, how can I get an array of all classes in CfgVehicles>>UAV for use in scripts?
Specifically, I need this array so i can add a variable to each class, not necessarily with same value.

candid sun
#

i'm probably over stating the performance impact - i'm sure someone more clever than me will give you a good answer soon

pulsar pewter
#

nvm seems like what I want is BIS_fnc_getCfgSubClasses

halcyon temple
#

hey guys

#

any way to get objects on a dead unit, like the result of getUnitLoadout, but objects, I want the damn objects... ๐Ÿ˜‰

granite sky
#

I feel like you have some very flawed assumptions here.

#

It doesn't create a load of objects just because a unit dies. Just one (or two?) for the dropped weapons.

halcyon temple
granite sky
#

Fair question. Not sure.

halcyon temple
#

"dropped weapons", didn't these exist already ?

granite sky
#

I'd guess that they're still assigned to the body.

halcyon temple
#

so "any way to get objects on a dead unit"

granite sky
#

No, because weapons aren't objects. What it does is create a simulated weapon holder object and transfers the weapon item to that.

halcyon temple
#

dummyobject

granite sky
#

If you want to find the weapon holder with script then you'll either have to search for it or add a Put event handler to the unit before it dies.

halcyon temple
#

this is were I'm at, https://pastebin.com/B7CT2my4

following from

if (_x isKindOf "Man" && ! alive _x) then {
    diag_log format ["TGF_fnc_addTransferAction | _nearObjects: %1 is a dead man", _x];
    [_x, _target] call TGF_fnc_transferLoadoutToContainer;
}

the idea is to create all items on dead unit and respective contents/configuration in a target container

    _unitLoadout params [
        "_primary", "_secondary", "_handgun", "_uniform", "_vest",
        "_backpack", "_headgear", "_goggles", "_binoculars", "_assignedItems"
    ];
gusty flame
#

Alright, thanks for the info nonetheless :) It is however not possible then to use a function-call in the conditions-parameter of addAction? I'll just have to slam all the conditions in there in the parameter?

flint sentinel
#

Hello! Hopefully a quick question

I have a few .sqf files not being ran when on a dedicated server. They run fine on hosting, but nothing happens while uploaded to the server.

I'm new to scripting, so I think there's something I need to do, probably basic, to make scripts run on a server. Anyone have an idea?

#

incase it's relevant, code

winter rose
flint sentinel
#

It's three to teleport to three different birds, I'm new enough to scripting that I didn't know that I needed to call them, I thought having them in the mpmissions folder would be enough

winter rose
#

well you say it works in SP

flint sentinel
#

I technically ran it as MP, just for clarification

#

but yeah it works fine on hosting. when uploaded to the server, it's like they're not being used at all

hallow mortar
#

Script files don't run themselves, apart from engine-recognised event scripts like init.sqf. You must be doing something (execVM, for example) to activate the scripts, even in self-hosting.

flint sentinel
#

I'm using an init box on a prop to call them, then

#

No init.sqf or anything

hallow mortar
#

What is the exact code you're using to call them?

flint sentinel
#

pulling it up now

#

basically a 'this addAction ["text", "code.sqf"]

#

each RGteleport is the same with the exception of changing which helo name they're using

granite sky
#

Have you checked that these sqf files are actually in the mission PBO?

flint sentinel
#

I have not, I'm not sure how to go about that.

My troubleshooting steps were ensuring it worked through Eden>host MP, and then uploading the entire mission file to my server's mpmission

#

I haven't attempted to get .sqf files working on a dedicated server before, so this is new to me

hallow mortar
#

There's nothing different about how .sqf files work on a server. There are differences in how some commands work, but that's not really important here.

#
  • When you say uploaded the whole mission file, did you upload the unpacked mission folder, or did you export it as a PBO first and then upload that?
  • When you say the scripts are "being ignored", do you mean the actions are missing or the actions don't do anything?
flint sentinel
winter rose
#

what I suspect is that you created the mission in the Missions directory
then saved in MP missions (which copied the sqm only)
then exported as MP mission

#

that, or you need to restart the server to refresh the pbo

hallow mortar
flint sentinel
#

No, Unless I'm misunderstanding you, I can see through my FTP I have all .sqf's with the mission

hallow mortar
#

I would recommend exporting it as a PBO and uploading that

winter rose
#

^

#

what is moveInCargo's locality?

hallow mortar
hallow mortar
flint sentinel
#

I don't see Pbo as an option, I have export to MP, Terrain Builder, to SQF

hallow mortar
#

Export to MP

hallow mortar
#

Exported PBOs are located in your Arma 3 install folder in the MPMissions folder

flint sentinel
#

So I have been exporting to MP, my understanding is they came back as files and not .PBOs

Maybe I've been messed up this entire time, but wouldn't I find my exported mp missions through Docs>Arma3>mpmissions?

#

welp

fleet sand
#

I think your problem is how you execute the script with addaction. becouse You use addaction ["text","Script.sqf"]; That Scrit.sqf is executed with ExecVM witch is GA/LE and that is why it dosent work on server.

flint sentinel
#

I see the .PBOs, I'll give that a shot

granite sky
#

I'm now puzzled what mission you've been testing :P

hallow mortar
flint sentinel
granite sky
#

I didn't think there was any way to get a dedicated server to load an unpacked mission.

hallow mortar
# flint sentinel mpmissions>RC001>.sqfs

Is "RC001" the exact name of the mission folder? Does it have a map suffix (e.g. .Altis)? If not, the server may be interpreting it as a free-floating mission.sqm that simply happens to be in a subfolder, not as a mission folder.

manic kettle
#

Wait so is "script.sqf" the same as {execvm "script.sqf"} for the addaction input?

flint sentinel
manic kettle
#

TIL.
Maybe you're not passing arguments correctly then. If the action shows up but it doesn't work

flint sentinel
flint sentinel
#

I was going through Docs instead of arma source, didn't know it was .PBOs I had to load in

Thank you so much for the help!

gusty flame
#

Also another question: Is there any way to access inventory-items by id? I'm making a missions where the players are going to use a limited amount of datapads (ACE microDAGR), and going close to a location lets you download data to the datapad, and going close to another location lets you upload this data to base. I would like for the data to actually be attached to the actual item in the inventory, meaning you can drop it, give it to other players, or enemies can kill you and take it. So I need to track each of the ACE_microDAGR's specifically to know which one has what data on it. Googling a bit I haven't been able to find a good solution to solve this. Does anyone know how this could be accomplished?

faint oasis
#

Hi, i have a question ? I put some units in a truck and everytime the mission start, they are starting to get out so is there a way to prevent that ? I tried to addVehicle but it's not working ๐Ÿ˜ฆ

winter rose
#

vanilla?

faint oasis
winter rose
#

try to repro in vanilla

hallow mortar
#

A quick fix is usually to lock the vehicle

fair drum
#

Or disabled AI pathing

faint oasis
# hallow mortar A quick fix is usually to lock the vehicle

I tried but sadly it's not working.

{ 
    _grole = assignedVehicleRole _x; 
    if ((count _grole) <= 1) then 
    { 
        private _gindex = (this getCargoIndex _x); 
       
        _x assignAsCargoIndex [this, _gindex]; 
    } 
    else  
    { 
        _x assignAsTurret [this, (_grole # 1)]; 
    }; 
}forEach (units mygrp);

that solved the problem but i think there is a bug with the truck because there is 2 ffv turrets and only one is detected as a turret, the other one is detected as a cargo with a turret index but it still need to be assigned as a turret.

harsh sedge
#

Is it possible to overwrite certain mod/BIS functions with functions declared in Description.ext to test changes?

open hollow
#

there is any 3den enventhandler that is executed when a object is placed?
i cant fin any ๐Ÿ™‚

wild prairie
#

Is there a way to access a model's RVMAT's properties ingame?

wild prairie
#

I'm aware of that. What I'm interested in is accessing the properties of the RVMAT itself (if I understand correctly it may not necessarily be available under configFile).

open hollow
shut carbon
#

3den, I thought you said Zeus ๐Ÿ˜›

wild prairie
#

bulletPenetrability/bulletPenetrabilityWithThickness specifically. I'm not happy with using armor directly. Working on an armor penetration system for infantry that takes ammo caliber property into account more reliably.

shut carbon
#

actually, nvm, on 3den i'm not sure.

open hollow
#

yea, it seems to work

#

in the end 3den is a mission lol

open hollow
shut carbon
#

CuratorObjectPlaced works?

open hollow
shut carbon
#

ah nice

open hollow
wild prairie
#

I guess I can use loadConfig, but that'll hurt.

open hollow
#

yea, you will need to know what bisurf you are hiting, and then search the surface data in the config

open hollow
tulip ridge
#

Issues when running on dedicated server

gentle zenith
#

Good afternoon/morning/night

On my server I have a vehicle clean up script that deletes dead vehicles after x amount of minutes, however lately it appears to be deleting the bodies of any dead players that were inside of it. This means their friends can't revive them (people that arrive after the vehicle has cleaned up).

Does anybody have a decent way to eject dead bodies from a vehicle? I've tried setting the unit's pos to the pos of the vehicle before cleaning it up but this hasn't worked

granite sky
#

You have a revive system that uses corpses? Unusual.

#

moveOut works fine on corpses but you might need to catch them early. There are various vague hints on the wiki about some sort of corpse state change after a time.

tough abyss
tulip ridge
#

Yeah but you still can't delete uncon players in ace

#

You can delete the bodies once someone actually dies, but not while uncon

tough abyss
tulip ridge
#

ACE should (may not be remembering 100% correctly) either just prevent the vehicle from being deleted altogether or eject the uncon players and then delete the vehicle

tough abyss
candid sun
#

inventory items are just strings afaik

#

dayz took it a step further - like you can write on pieces of paper - but it's not possible in arma 3

fair drum
#

what variables hold the UI colors clients have selected?

warm hedge
#

A function can get them, forgot which was but GUIColor or smth

fair drum
#

oh i forgot im using a config lol

warm hedge
#

Yep that's what I meant

fair drum
#

cant use that

warm hedge
#

Then you can try a macro, ui_f has such macro

fair drum
#

oh it looks like you can use code in the array:

colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",1};
warm hedge
#

And that can be alteted into a macro

#

Which is easy to handle

little raptor
#

or loadFile if you want it raw

jade acorn
#

what's the script counterpart of player squad leader giving MOVE orders to individual group members?

#

can't find anything in waypoint or group commands

winter rose
jade acorn
#

"units go back to formation" like they immediately go back from the point i have given them?

winter rose
#

that's what doMove says

jade acorn
#

ah I see that now

#

doStop should counter it so I guess it's worth trying. I'd rather avoid making separate groups

signal drum
#

Hi there, I'm trying to make a mod out of the two functions I've created in a test mission. This is a screenshot from my mod folder and Config.cpp:

#

I packed the pbo and copied it into the addon folder of a mod folder. I can load the mod with the launcher but the script "addVehicleDamageEventHandler", which is supposed to be run pre init, does not trigger. I think I messed up the script paths somehow.

#

Can anybody let me know how to set up the folder structure to make them work with the config file I created?

warm hedge
#

The function couldn't find which file it is

warm hedge
#

More like you forgot to specify it is

signal drum
warm hedge
#

Re-read please, Category part of it

signal drum
#

In my mind, this here would mean <my mod folder>/Vehicles/fnc_handleVehicleDamage.sqf would relate to the class in my config:

warm hedge
#

Below that

#

Or you can specify the file path in the function's class itself too

south swan
#

it's config.cpp, though? So ROOT>\Category\fn_functionName.sqf should apply?

signal drum
#

I see. Is there no way for it to work without specifying the file path? Like in the first example above your red circle?

signal drum
warm hedge
#

I have never heard that without file = would work

south swan
#

i assume it's PBO prefix shenanigans blobdoggoshruggoogly

warm hedge
#

...Maybe that too

south swan
#
        class Arrays
        {
            file="A3\functions_f\Arrays";``` from vanilla functions_f's config
#

so yeah, correct prefix + path to folder in file= property of prefix sounds like a solution blobdoggoshruggoogly

signal drum
#

Okay, thank you guys for the help. I'm going to give that a go and let you guys know how it went after I had lunch.

winter rose
#

doc to be amended then
edit: done

signal drum
#

I still can't get it to work, clearly I'm doing something wrong. This is my folder structure and Config.cpp now:

warm hedge
#

You forgot your pboprefix

signal drum
#

Oh, hold on

#

This is the pbo:

warm hedge
#

Click the gear icon

signal drum
#

Does the path need to be "NPC_Avoid_Vehicle_Eplosions\Functions\Vehicles"?

winter rose
#

Eplosions btw

warm hedge
#

If there is no pboprefix

signal drum
#

Eplosions facePalm

#

Oh god

winter rose
#

yes?

signal drum
#

I've fixed the name and added the PBO prefix, but the functions still don't show up in the function viewer ๐Ÿ˜ต

#

It's weird, I feel like I should at least get an error that my function location isn't found when I start the game, but I don't even get that

south swan
#

click the gear button in PBO Manager and check what PBO prefix is listed there blobdoggoshruggoogly

warm hedge
#

Wait a minute, do you even have CfgPatches?

signal drum
#

I do not

#

Do I need one?

warm hedge
#

Must

#

You CANNOT skip it

signal drum
#

Ah dang

warm hedge
#

Also... which software you use to pack it into pbo?

signal drum
#

At the bare minimum, the config.cpp file requires a CfgPatches class.

#

Arma 3 Addon Builder

warm hedge
#

Ah, at least not PBOManager

signal drum
#

I think the missing CfgPatches was my problem all along

warm hedge
#

And since is a config topic, let's move on #arma3_config if you still have questions

winter rose
signal drum
warm hedge
#

We're all here to be the inconvenience ๐Ÿ˜„

signal drum
#

Thanks to you guys I managed to get it working now ๐ŸŽ‰

signal drum
#

When launching, I'm getting the following error:

#

Seems like it's not looking for the script inside the pbo, but rather in the root folder

#

I assume you need the file attribute after all, or maybe there's still something that's not right

south swan
#

"inside the pbo" isn't a thing. Like, at all

signal drum
#

Inside the mod folder then

granite sky
#

You need the file attribute if your PBO has a prefix. Which it should.

ornate whale
#

What am I doing wrong?

#

When I call TAG_fnc_myFunction; it does not work.

south swan
#

you're skipping one whole level of class hierarchy blobdoggoshruggoogly

ornate whale
#

category is mandatory?

south swan
#

yes

ornate whale
#

Why dont I see the chat? systemChat "Hello world!"; Could the UI be hidden when in Eden mission playtest?

proven charm
#

sleep 0.1

ornate whale
#

I am calling it from command line in game

proven charm
#

messed up gui positions?

ornate whale
#

default

proven charm
#

hmmm

wild prairie
#

HitPart doesn't fire for vests/backpacks, only the unit itself notlikemeow.

ornate whale
# proven charm hmmm

So, don't know what it was, but it works now. But how can I add a variable in the chat? systemChat ("EnemyDetected" + str _newTarget)

ornate whale
# proven charm or format

Maybe the problem is that I call it from the eventHandler. And that might not be considered as client. meowhuh

ornate whale
#

I placed it out of the eventHandler. ๐Ÿ˜„

pulsar pewter
#

Probably a locality issue then. Wherever the EH was firing wasnโ€™t local to the client.

granite haven
#
player setUnitTrait ["Engineer", true, false];

How come if i exec this locally i cant repair damaged vehicles?

hallow mortar
#

You still need a toolkit

#

(and there's still a limit on how much you can repair, you can get things working but not 100% fixed)

granite haven
#

i have a toolkit

#

i set the vehicle damage to 0.7, is 0.7 not damaged enough maybe?

#

ah shit it wasnt enough

#

0.9 works, my bad

manic kettle
#

This depends on your settings.
Are you looking at the individual broken parts?

granite haven
#

what do you mean?

manic kettle
#

Oh nevermind you're taking about vanilla probably

molten yacht
#

I'm having trouble with my mission

#

despite having briefing explicitly enabled in my description.ext the dedicated server seems to always skip it

hallow mortar
#

Does the DS have briefingTimeOut set to a low number in its config file?

molten yacht
#

hmmm

molten yacht
#

also sorry

#

I meant debriefing

#

but that is also >900

#

like the mission ends and it goes straight back to mission select

#

There's no missions cycling setup

pulsar pewter
pulsar pewter
#

I've tried setting up both "UAV" or the class name "b_uav" and I get missing file errors both types.
createMarkerLocal [_markerName, _controller, 1];
_markerName setMarkerTextLocal "Drone Operator's Position";
switch (side _caller) do
{
case west: {_markerName setMarkerType "b_uav"};

cold mica
#

Wiki says "String" so you have to use the Name of the marker, not the classname.

pulsar pewter
#

That's what I initially thought, but it wouldn't accept "UAV" as the icon type, which according to the CfgMarkers wiki, is the name of an icon.

cold mica
pulsar pewter
#

Turns out you don't need setMarkerShape; I've got only createmarker/settype/settext.
And it also turns out it is classnames, but I had a small typo on the classname.

#

i hate it when its small mistakes like that lol

fair drum
#

I'm not sure why, but the "fortify" task is not completing. It seems to be only firing on one of the scriptedeventhandlers when it should fire on both. It's worth nothing, there are 3 current subscribers to the "US_Reinf" event handler (one creates a destroy task, which is working correctly, 2/3 subscribers are working).

#

first picture, comparison between fortify and defend task files, bottom is where the us_reinf handler is called

#

when called in the scripted event handler externally again in debug after, it does update the fortify task, so the code is working, just not firing both subscribers

#

it looks like scripted event handlers give an ID that is different than _thisScriptedEventHandler

16:47:32 "DEFEND SUBSCRIPTION ID: 0"
16:47:32 "FORTIFY SUBSCRIPTION ID: 1"
16:48:07 "DEFEND Task Completed"
16:48:07 "TaskCompleted Event Handler Called"
16:48:07 "Removing Scripted Handler | US_Reinf | ID: 1"

when the subscription id should actually be 0 from above

hmmm more interesting...

// Using _thisScriptedEventHandler for the ID

16:54:25 "DEFEND SUBSCRIPTION ID: 0"
16:54:25 "FORTIFY SUBSCRIPTION ID: 1"
16:55:03 "DESTROY SUBSCRIPTION ID: 2"
16:55:04 "DEFEND Task Completed"
16:55:04 "Removing Scripted Handler | US_Reinf | ID: 1"
16:55:04 "DESTROY Task Created"
16:55:04 "Removing Scripted Handler | US_Reinf | ID: 2"
// Using a stored variable ID from the return of the addScriptedEventHandler function

16:59:46 "DEFEND SUBSCRIPTION ID: 0"
16:59:46 "FORTIFY SUBSCRIPTION ID: 1"
17:00:20 "DESTROY SUBSCRIPTION ID: 2"
17:00:21 "DEFEND Task Completed"
17:00:21 "Removing Scripted Handler | US_Reinf | ID: 0"
17:00:21 "FORTIFY Task Completed"
17:00:21 "Removing Scripted Handler | US_Reinf | ID: 1"
17:00:21 "DESTROY Task Created"
17:00:21 "Removing Scripted Handler | US_Reinf | ID: 2"
ashen ridge
#

There is any event handler for player footsteps sounds?

#

I want to add some sound along with the player default footstep sounds by script.

#

I can think on some trick ways to do it, but, i hope there is a simple way.

warm hedge
#

I forgot if it does return footsteps but there is an EH to detect an unit's sound

ashen ridge
#

Sadlly, no foot steps sound id for SoundPlayed event handler.

warm hedge
#

Then maaaaybe use EntityCreated for footstep objects? I dunno, wild thought

gentle zenith
# granite sky You have a revive system that uses corpses? Unusual.

Yes it's a life server, the dead players inside the vehicles are a corpse - no mods running

When my cleanup script checks for dead vehicles, I try to eject the dead bodies before deleting the vehicle, they do however not eject. This means players that die in vehicle crashes can not be revived, I do remember in the past the bodies falling out once the vehicle cleans up, not now however.

granite sky
#

Test the vanilla behaviour maybe.

#

If they are being deleted on vehicle deletion then you probably can't fight that, and you'd need to move them out earlier.

edgy thunder
#

Hello Everyone quick question. Im not the best coder and im a bit stuck. I have a few units with prefixes. I want to have a script only effect certain units that have said prefix. What would be the most efficient way to do that?

granite sky
#

You mean like their editor variable name?

edgy thunder
gentle zenith
fair drum
# edgy thunder Yes sir

without knowing much else than what you've asked, for editor objects

private _units = allUnits select {"prefixCaseSensitive" in vehicleVarName _x};
[_units] execVM _myScript;
granite sky
gentle zenith
granite sky
#

@gentle zenith Well, I know it works shortly after. I don't know that it doesn't work later.

fair drum
tidal idol
#

Am I missing something here? Units aren't turning on their lasers but the hint is going (and I had previously tried an init EH).
Statement works fine in units init-line.

        class EventHandlers: EventHandlers{
            class B47_WZ_LaserOn_EH{
                suppressed = "(_this select 0) enableIRLasers true;hint 'ir turue'";
            };
        };```
fair drum
#
// unit's class
class EventHandlers: EventHandlers
{
  class init = "(_this select 0) spawn {sleep 2; _this enableGunLights 'ForceOn'}";
};
tidal idol
#

I've tried that init line, but it didn't work either. I'm wanting to use the IR Lasers one since then the AI should turn them on/off with the combat mode.
Current iteration

        class EventHandlers: EventHandlers{
            class B47_WZ_LaserOn_EH{
                init = "(_this select 0) spawn {sleep 2; _this enableIRLasers true;};";
            };
        };```
pulsar pewter
#

hey folks,
What might be the easiest way to get an array of all the drone classes? I'm looking for a generalized method so I can then (in a mod) assign a specific variable to each class.

--There's AFAIK no specific "Drone"/"UAV" class within CfgVehicles, but there must be a way to do it, I think, given that we do have commands such as allUnitsUAV, which selects all currently-existing UAVs in a mission. Unless it just checks all objects for "isUAV=1"
-- Is there any way to get all classes for whom the "isUAV" property has value of 1?

granite sky
#

"getNumber (_x >> 'isUAV') == 1" configClasses (configFile >> "CfgVehicles");

#

Well, if you want classnames then append apply { configName _x }

pulsar pewter
#

So, if I'd want to define the array, I would just:

_dronetypes = "getNumber (_x >> 'isUAV') == 1" configClasses (configFile >> "CfgVehicles") apply { configName _x }

?

#

and then work with that array? I've nevevr worked with configClasses before.

fair drum
#

I'd do a scope check too

pulsar pewter
#

whatdya mean?

granite sky
#

Depends what you're doing with the information but if you only care about classnames that can actually be spawned then you'd exclude scope 0.

pulsar pewter
#

basically, for my mod, I have 3 CBA_Settings for people to put in classnames of drones to divide them into three categories (RUF_Commercial/RUF_HighEnd/RUF_LowEnd). However, if they don't specify a category for a certain class, I want to automatically add it to a category, as a default.
Then, for my scripts, I'll check for a specific drone, what category it's in, to then apply a certain variable value and run my script.

RUF_DroneClasses = "getNumber (_x >> 'isUAV') == 1" configClasses (configFile >> "CfgVehicles") apply { configName _x };
{
    if (_x in RUF_Commercial or _x in RUF_HighEnd or _x in RUF_LowEnd) then {continue} else {_x pushback RUF_Commercial} 

}
forEach RUF_DroneClasses;
#

Does that make sense, though?

#

And cool, yeah, I'll add a scope check. Should just be 2, I think, as it's drones actually spawnable in editor/mission.

velvet merlin
#

for some reason this is not triggering when i would expect it to be:

ctrlAddEventHandler ["Draw",

on a RscMap control created via

cutRsc ["AAS_HudDisplay","PLAIN",0];

    class MiniMap: RscMapControl
    {
        idc = AAS_IDC_HUDMINIMAP;
        x = MINIMAP_X;
        y = MINIMAP_Y;
        w = "(20/100)    * SafeZoneW";
        h = "(20/100)    * SafeZoneH";
        colorBackground[] = {0.7,0.7,0.7,1};
        sizeExLabel = MAPTXTSIZE;
        sizeExGrid = MAPTXTSIZE;
        sizeExUnits = MAPTXTSIZE;
        sizeExNames = 0.05;//MAPTXTSIZE;
        sizeExInfo = MAPTXTSIZE;
        sizeExLevel = MAPTXTSIZE;
    };```
#

is this due to cutRsc use?

warm hedge
#

Is the map visible? Both fade and show

velvet merlin
#

yep (bottom right)

#

it does refresh, work, etc

#

just the draw control EH does not fire

#

it does initially when i am in respawn dialog but then stops when i get to player control

#
        _x spawn
        {
            _resource = _this select 0;
            _displayIdc = _this select 1;
diag_log ["AAS_MapResources",_this];

            while {true} do
            {

                waitUntil
                {
                    sleep 0.1;

                    (!(isNull ((uiNamespace getVariable _resource) displayCtrl _displayIdc)))
                };
diag_log ["AAS_MapResources - ctrlAddEventHandler",uiNamespace getVariable _resource,(uiNamespace getVariable _resource) displayCtrl _displayIdc];

                ((uiNamespace getVariable _resource) displayCtrl _displayIdc) ctrlAddEventHandler ["Draw",
                {
diag_log ["AAS_MapResources - Draw",_this];
                    [_this] call AAS_fnc_createMapMarker;
                }];

                waitUntil
                {
                    sleep 0.1;

                    (isNull ((uiNamespace getVariable _resource) displayCtrl _displayIdc))
                };
diag_log ["AAS_MapResources - isNull",(isNull ((uiNamespace getVariable _resource) displayCtrl _displayIdc)),uiNamespace getVariable _resource,(uiNamespace getVariable _resource) displayCtrl _displayIdc];
            };
        };
    } forEach AAS_MapResources;```
#

the system even has a re-add mechanic in case the control gets destroyed - but it doesnt

#

just draw doesnt get triggered any longer

#

on 2d map it all works

#

it does work on the hud element initially

 7:36:37 ["AAS_MapResources",["AAS_CurrentDisplay",55001]]
 7:36:37 ["AAS_MapResources - ctrlAddEventHandler",Display #1119006,Control #55001]
 7:36:37 ["AAS_MapResources - Draw",[Control #55001]]
 7:36:37 ["AAS_fnc_createMapMarker",[[Control #55001]],Control #55001]
...
 7:36:43 ["AAS_MapResources - Draw",[Control #55001]]
 7:36:43 ["AAS_fnc_createMapMarker",[[Control #55001]],Control #55001]
 7:36:43 ["AAS_fnc_createMapMarker - drawIcon",Control #55001,"\a3\ui_f\data\Map\VehicleIcons\iconManLeader_ca.paa","\a3\ui_f\data\Map\VehicleIcons\iconManLeader_ca.paa","\a3\ui_f\data\Map\VehicleIcons\iconManLeader_ca.paa",[4421.26,6476.64,56.5718],180.878,"AS (CM:5R,B:3A,SM:3F,UP:3M)"]
#

the only thing that would make sense to make the control/display/resources gets destroyed and recreated without the draw EH - but then above isNull should get logged ๐Ÿ™„

jade acorn
runic spoke
#
  1. 11:36:49 Error Foreign error: Unknown enum value: "IncomingMissile"

removeAllEventHandlers does not recognize IncomingMissle..?

still forum
kindred tide
#

attached laptops to radio tower platforms and added some actions to them. if i order a unit to use the action, he climbs up, does the thing, climbs down, no problem, and it's in A2. suddenly AI doesnt jump off the edges!

#

(the towers are generated by script)

winter rose
#

the point being? they jump in A2, in A3?

kindred tide
#

usually

winter rose
#

which is it, both?

kindred tide
#

i can confirm for A2 and someone just recently confirmed it here for A3

#

we were talking about helicopter boarding from roof

winter rose
#

how is that even remotely related?
boarding involves pathfinding around the vehicle, action requires "move โ†’ trigger action โ†’ done"

kindred tide
#

even when the door is facing in their direction and not on the opposite side?

#

like, when there's no need to actually go around

winter rose
#

yes

kindred tide
#

so, if that laptop was attached to the helicopter, and the helicopter was hovering near the edge of the roof, and i ordered the unit to use the action on that laptop, the unit would NOT jump off and do everything correctly?

#

because he's not path-planning around the vehicle (i guess)

winter rose
#

try and compare what is comparable

kindred tide
#

i mean, entering the vehicle is asking the unit to perform a "get in" action, the difference is that the action is on a moving vehicle object, and here it's on an unmovable laptop (that was placed where it is during the game, so it's not "static" like a house)

winter rose
#

don't try to use logic
use empirical evidence

hallow mortar
#

Units have specific entry points for vehicles and they will path (in quite rigid ways) to get to them.
User actions on objects don't have this and the unit will probably accept "close enough".

winter rose
#

hence the "let me walk 10m away from the car before boarding it"

kindred tide
#

does it mean that if i attach an invisible object to the helicopter, addAction a "board" action to it, that does moveInCargo to the unit who used it, it'll make them reliably board the helicopter and avoid jumping off the roof?

winter rose
#

if they don't have to move to trigger it, like this laptop addAction, yes

#

but you then cannot order AI to "board", you will have to order them to do an action

kindred tide
#

yeah and call it "get in (safely)"

hallow mortar
#

You can skip the action part. Order them to move to the helo's position, waitUntil they're close enough, then move them into it.

kindred tide
#

i'm doing that already with agents. they can't be ordered to get in

drowsy geyser
#

so im using this line to make sure that allUsers turn into players i.e meaning that they all fully loaded the scenario:
waitUntil {count allUsers isEqualTo count allPlayers};
but this takes alot of time, is there any faster way?

#

i found out that it is the "only really reliable"(for me atleast) way to make sure that all players fully loaded the scenario

cosmic lichen
#

but this takes alot of time, is there any faster way?
What do you mean by that? It would take as long as the slowest client needs to load in

drowsy geyser
#

yes i tried this but never managed to get it to work with getClientState

drowsy umbra
#

Trying to make a scouting mission, where the map marker for the enemy target (just a default OPFOR unit marker) doesn't show up on the player's map until the player lases the target. I made a trigger that fires when the player lases the target, but how can I sync that to the map icon appearing?

#

I'm not trying to spawn a custom map marker or anything, just hide the unit map marker until the laser designator hits the target, and then show the unit map marker.

hallow mortar
#

A quick way would be to have the marker start with its opacity set to 0, then use setMarkerAlpha to reveal it with the trigger

#

Starting with no marker and creating it from the trigger would also be pretty easy, but not as easy

drowsy umbra
hallow mortar
#

I'm not sure that you can

#

Those markers are generated automatically as part of the difficulty settings. You can turn off that difficulty setting, but that will affect everything.

fair drum
granite sky
#

I think those markers work from group knowledge, so forgetTarget spam might work to block the map marker for specific units.

#

Not tried it though.

runic spoke
#

Actually just vehicles

#

Had to double check

#

I'd probably get that if it was a static object, but it's only vehicles. I'll see if I can find exactly the vehicle causing it, spotted this one in a couple RPT files.

tropic parrot
#

hello, im still new to arma 3 scripting and im trying to make units get in vehicle in order, i dont know if this is the right place to ask for support, this is the code im using i placed a move waypoint with the script attached to it once they reach the way point i get error order ordergetin: type object, excepted array

`_vehicle = v1
_units = [s1, s2, s3, s4];

{
_unit = _x;
_unit orderGetIn true;
sleep 1;
_unit assignAsCargo _vehicle;
} forEach _units;`

ornate whale
#
_units = [s1, s2, s3, s4]; 

{
    _x assignAsCargo _vehicle;
} forEach _units;

s1 assignAsDriver _vehicle;

_units orderGetIn true;```
tropic parrot
#

well as i said im still new and this is my first try at scripting in the game, so if you mean by assign the vehicle the vehicle is named v1

ornate whale
#

_x assignAsCargo _vehicle means to give an order to a unit _x to take the vehicle in _vehicle as his mean of transport.

#

And orderGetIn means to make them all get in the vehicle they have assigned.

tropic parrot
#

ohh thx for the help but i think the order did not work as no one got into the driver seat

ornate whale
#

that is because you tell them AsCargo

tropic parrot
ornate whale
#

you would need one to be assignAsDriver

#

I will edit the example, see now.

tropic parrot
#

Thank you again! i was able to make it work with the assignAsDriver

_vehicle = v1;
_units = [s1, s2, s3, s4];

{
s1 assignAsDriver _vehicle;
_x assignAsCargo _vehicle;
} forEach _units;

_units orderGetIn true;

stable dune
south swan
#

(and once as cargo :D)

winter rose
#

also assing

fair drum
#
private _vehicle = v1;
private _units = [s1,s2,s3,s4];

for "_i" from 0 to (count _units - 1) do {
    private _unit = _units select _i;
    if (_i == 0) then {
        _unit assignAsDriver _vehicle;
        continue;
    };

    _unit assignAsCargo _vehicle;
};
tropic parrot
#

Thanks everyone for the help!!

tulip ridge
#

Can you get the name of a script that called a given function?

// someCode.sqf
call fn_whatsMyName;

// fn_whatsMyName.sqf
systemChat "Your name is: " + <someCode.sqf>
fair drum
tulip ridge
#

Just the filename itself, but does that work "out of the box" or do I have to specify a scriptName at the top of every single one of my functions?

#

Basically what I'm wanting is to pass the name of the file calling fn_whatsMyName, without having to specifically pass it every time

#

If the use-case seems a little odd, I wanted to make a logging function so I'm not just using systemChat everywhere, and I wanted to include what code is calling it.

// fn_someCode.sqf
"doing X" call TAG_fnc_devLog;
...
"doing Y" call TAG_fnc_devLog;
...
// etc.

Output (systemChat and diagLog):

[HH:MM:SS] [TAG_fnc_someCode] doing X
[HH:MM:SS] [TAG_fnc_someCode] doing Y
...
#

The full TAG_fnc_someCode is optional, it could just be someCode

hallow mortar
#

There doesn't seem to be anything that does this automatically. There's allegedly this magic variable: https://community.bistudio.com/wiki/Magic_Variables#fnc_scriptNameParent but it doesn't appear to be autogenerated.
You can try to use scriptName to do it, or you can write it in your message string manually every time, or you can do something like this for a set-once-per-file thing:

// at top of file
private _functionName = "TAG_fnc_someCode";
// log call
[_functionName, "doing X"] call TAG_fnc_devLog;
// in devlog
params ["_functionName","_string"];
private _text = format ["[%1] [%2] [%3]", _time, _functionName, _string];```
little raptor
tulip ridge
#

Yep _fnc_scriptNameParent did exactly what I wanted ๐Ÿ‘

ornate whale
#

I will add this event handler to every AI unit upon initialization. How can I create more variables of isRunning, so every AI has its own and at the same time it would be accessible in the eventHandler? I need it for the code to not be launched in less than 0.8 sec intervals. Should I make an array for it? Also can I pass additional arguments to the eventHandler?

isRunning = false;
group _unit addEventHandler ["KnowsAboutChanged", {
    params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"];
    if ((_targetUnit == player) && (isRunning == false)) then {
        isRunning = true;
        systemChat (str _targetUnit + "  detected by  " + str _group + "  at  " + str time);
        [_group] spawn {
            params ["_group"];
            sleep 0.8;
            _group forgetTarget player;
            isRunning = false;
        };
    };
}];```
granite sky
#

Set a variable on the group?

ornate whale
#

like private _isRunning in the group init for example?

granite sky
#

No, like _group setVariable ["isRunning", false]

#

Also usually you wanna toggle between true & nil to save having to initialize the vars.

#

In this case you're adding an EH to the group anyway so it doesn't make much difference.

ornate whale
# granite sky No, like `_group setVariable ["isRunning", false]`

Like this? setVariable and getVariable?

group _unit setVariable ["isRunning", false];
group _unit addEventHandler ["KnowsAboutChanged", {
    params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"];
    if ((_targetUnit isKindOf "Man") && ((_group getVariable "isRunning") == false)) then {
        _group setVariable ["isRunning",true];
        systemChat (str _targetUnit + "  detected by  " + str _group + "  at  " + str time);
        [_group] spawn {
            params ["_group"];
            sleep 0.8;
            _group forgetTarget player;
            _group setVariable ["isRunning",false];
        };
    };
}];```
granite sky
#

looks correct, yes

ornate whale
#

isNil

granite sky
#

Either that or use the getVariable version with the default

#

isNil { _group getVariable "isRunning" } or _group getVariable ["isRunning", false]

ornate whale
granite sky
#

You definitely shouldn't do that here, because you're using it strictly locally.

#

If you use the public parameter then that var on the group will just be published to every client.

#

It's still a var on the group though.

ornate whale
#

Hmm, if I made this multiplayer, would it be necessary to publish it or not? Event handler should happen on the server, so private I suppose.

granite sky
#

Normally event handlers run on the machine they're installed on.

#

Note that this stuff gets tricky if you want to support headless clients, especially mods that auto-balance.

#

but otherwise you're probably creating the units on the server, that's where they stay, and that's where their event handlers run.

exotic flame
#

I have a question. Why does Arma 3 freezes for few seconds when you use an call a DLL which takes times to execute in RemoteExec environment ? Is it specific to the editor or will it do the same on a dedicated server ? I mean RemoteExec is supposed to be asynchronous, so why does the game freezes like i was calling the DLL in synchronous environment ?

winter rose
#

remoteExec may be scheduled, but it will not be parallel

exotic flame
granite sky
#

lol

#

Just do your async on the extension side.

exotic flame
#

If i execute the code asynchronously on the extension sie, the dll execution will finish before my asynchronous process is finished. How will the game read the answer ?

granite sky
#

I guess it'd have to ask for it.

exotic flame
#

My DLL is meant fo dedicated servers, i'll gve it a try a server i'll create and i'll test the DLL. If the server doesn't lag it will be fine

kindred zephyr
#

can a display be used to generate video feed from a camera?

I understand the concept of procedural texture for pojection on surfaces, but its not clear to me whenever i can actually project to a display control.

exotic flame
kindred zephyr
#

how would that even be?

_Picturecontrol ctrlSetText (_Picturecontrol setObjectTexture[_data]);
```?
exotic flame
#

it's exactly the sme as if you wanted to display the camera video feed on the texture of an object, you need to get the rtt of the feed

#

Render To Texture

kindred zephyr
#

so the text can actually be fed directly?
That where I had doubts, i assumed it needed to "be set" as a texture too

exotic flame
kindred zephyr
#

thanks, i shall test then

exotic flame
drowsy umbra
# kindred zephyr can a display be used to generate video feed from a camera? I understand the co...

In this mission we look at Projecting A Camera Feed during a mission in game briefing area, to provide players with drone footage without giving them all UAV terminals as they would instantly take over the drone and crash it into the ground. Or without having to try and work with the nightmare that is getting the live feed models to work in mult...

โ–ถ Play video
oak island
#

Is there a simple respawn script useful for one-life operations where I want a backup way to respawn people who occasionally die to glitches, disconnect, etc?

jade acorn
#

so while playing a mission with dbo_horses I noticed that sometimes it can bug out in a way that camera is stuck to one entity while you still have control over the other. I tried different UAV-related functions and camCreate stuff but couldn't achieve this, any ideas how to replicate this bug? Ngl this opens a way for some Resident Evil-like stuff lol ๐Ÿ˜„

#

Super Miller Land does not use that while effect is pretty much the same but that would involve much more scripting than I would love to do.

distant egret
#

Also when you get shot (and unconscious) while riding you get bugged (only tried with ACE).

kindred tide
#

does "search and destroy" waypoint ever reach a finished state by itself or it requires skipping from script

still forum
# runic spoke vehicles/objects

Vehicle/Unit works fine for me.
It would be different if you run it on a projectile, in which case that would remove Ammo events.

limber thunder
#

Hello guys maybe someone can show me how to run a scirpt for a few seconds and then stop it.
I want to execute a script for a certain time and then I want it to stop again. I have already tried a bit with the terminate function but somehow the script still runs. How do I get the script to terminate after a few seconds?

This is in my trigger:
null = [] spawn {myHandle = [] execVM "script1.sqf"; sleep 4; terminate myHandle;};

and this is the sqf file:
playMusic ["RadioAmbient5", 1];
When i found out how to edit a small script i want to insert a bigger script instead of the playMusic. In the Arma wiki I have already seen that you can end the music simply with playMusic ""; but I want that really the script is ended.
I hope this is somewhat understandable what I mean ^^

warm hedge
#

Why stopping the music doesn't work? What do you mean by end the script?

fair drum
fair drum
kindred tide
# fair drum On it's own. It's just very thorough.

it says in biki that if the group is in a chopper, its search area will be bigger. but what if at the moment the waypoint became current, the group was in a chopper, but since then was unloaded from it, while the waypoint remained current

fair drum
#

Like the group is separate from the choppers pilots' group? Lands and gets out?

kindred tide
#

yes

fair drum
#

It should function as normal.

kindred tide
#

as if they were on foot?

fair drum
#

Had exact scenario multiple times last night. Yep as on foot.

willow hound
# limber thunder Hello guys maybe someone can show me how to run a scirpt for a few seconds and t...

What you are doing right now doesn't make sense. Using sleep and terminate like that would only make sense if script1.sqf contained code that can run for (more than) four seconds (e.g. waitUntil, another sleep or an endless loop).
As it stands, script1.sqf only contains playMusic, and that command is non-blocking: It instantly completes once it has started the music, it does not wait for the music to finish. Scripts terminate automatically once their last command has been executed, so by the time you reach terminate myHandle, the script that myHandle refers to has long been terminated automatically.

#

A proper solution would be running [] execVM "script1.sqf" in the trigger and moving sleep into the script:

playMusic ["RadioAmbient5", 1];
sleep 4;
playMusic "";
```That way, the music stops after four seconds. As explained above, the script terminates automatically once the last line has been executed.
limber thunder
warm hedge
#

One thing you misunderstood is, end of a script is when the script executes the last line of it

limber thunder
#

Okay that makes sense why the music doesn't stop when I exit the script. I found a script that marks players on the map. But this should only happen for a few seconds.
So I thought about terminating the script after par seconds. Is terminate the right command for this?

warm hedge
#

Actually, that would more and more knowledge and time to explain what to start

limber thunder
# warm hedge Actually, that would more and more knowledge and time to explain what to start

is there no easy way to stop and restart a script that runs in the background?
To mark the players I would have used the
Dynamic Player Markers Script
https://forums.bohemia.net/forums/topic/147033-dynamic-player-markers/

kindred zephyr
# limber thunder is there no easy way to stop and restart a script that runs in the background? T...

using waitUntil you can halt a script, but what you want has to be a bit more complex as POLPOX mentioned.

The stop will only prevent script progression/looping, you need a framework (function chain) that starts and shows whatever you want to do during your time period, and then halts/terminate and hide whatever you want to until required again.

You just have to make sure that there is an actual way to "turn on and turn off" what ever you are doing.

limber thunder
granite sky
tulip ridge
#

I have a custom "Pick Up" action to remove an object and put an item into a player's inventory, but I put in a check to make sure the player actually has space.

This is all working as intended, but when the player tries to pick up the object from the ground holder, the item is completely deleted.
If the player open the inventory of the ground holder and tries to move it to their inventory, the item seems to have completely different properties.

  1. The item does not stack with other items of the same type
  2. The item has a seemingly completely different mass
  • It can be fit into the inventory even though canAdd returns false and does not seem to increase the inventory slot's bar for "how full" it is
  1. The custom action I have tied to the item does not appear if the glitched item is present
  2. When doing backpackItems player, it returns an array of the four items, with the same class name
if (_unit canAdd _itemClass) then
{
    _unit addItem _itemClass;
}
else
{
    cutText ["Not enough space to pick up.", "PLAIN DOWN"];
    private _holder = "groundWeaponHolder" createVehicle [0, 0, 0];
    _holder setPosASL getPosASL _object;
    _holder setDir floor (random 360);

    _holder addWeaponCargoGlobal [_itemClass, 1];
};
deleteVehicle _object;
granite sky
#

Is this item actually a weapon then?

tulip ridge
#

It's a CBA_MiscItem

kindred zephyr
#

^ some items are locked to where they can actually go into your inventory, canAdd returns false if by config they cannot be put in specific inventories even if they can be fit in mass standards

tulip ridge
#

It's set to go any of the "normal" inventories
(Uniform, vest, backpack)

tulip ridge
kindred zephyr
#

regarding point 4, its a bit inconsistent in between commands and what type of classname you are trying to check if it returns the items as separated indeces in inventory arrays or if they stack in a subarray, this can be commonly see with mags and mags with count of 1, like granades

kindred zephyr
# tulip ridge It's set to go any of the "normal" inventories (Uniform, vest, backpack)

I might be wrong about this one, but canAdd check in numerical order of the inventory type and evaluates if you can add the item to the first found inventory when you use a unit as the object to check the space within. You might want to specify the containers in the player to which you are trying to check,
alternatively, you also have the canAdd version of the command for each inventory type in a unit

manic sigil
#

Thought experiment.

I'm tinkering with gathering data on the fuel economy of the vanilla vehicles, and have a script that handles it pretty satisfactorily. However, it's just in straight lines. As long as I'm going to be going down the entire list of every vehicle, I may as well collect all the useful information I can.

Is there a practical way of measuring a vehicles turning radius? Assuming a perfectly flat plane (the VR terrain).

My thought so far is a triggered script; you start the vehicle and get it into a consistent turn at the speed you want, no eccentricity. Then when you start the script, it places markers along your trail at regular intervals until you have a complete circle, then check their distance against each other sorting for the longest distance, and half that for the radius.

Hrn... easier still to just waitUntil direction is 90 and 180 from starting direction.

granite sky
#

...yes

tulip ridge
#

How do you open / what program do you need to open a .mdmp file?

sullen sigil
#

bi only tool

tulip ridge
#

As in like BI employees?
Seems odd because my game crashed when I was testing something and was going to loop at the rpt to see what happened, all it said was that it made a minidump

granite sky
#

yeah normal

#

You need the symbols to get much out of it, and only BI have those. Dedmen does like checking the minidumps sometimes.

sullen sigil
#

yes game crashes produce mdmp which bi use to diagnose the crash reason

tulip ridge
#

Yeah but I mean, why not have it in the tools?

granite sky
#

Uh, the tool is just windbg.

#

Commercial software never gives you the symbol files because it makes it too easy to reverse-engineer.

#

At minimum it tells you when each function starts and ends, and what they're called.

tulip ridge
#

Gotcha

granite sky
#

You can throw it at windbg yourself, but if the crash happened in Arma rather than a windows DLL it won't tell you much more than that.

#

Did you try addItemCargoGlobal btw?

tulip ridge
#

Yeah I was trying to test that now

#

Only other change I've made is putting my script into a cba progress bar
Realized I had a variable called _time, which I thought might have been causing the issue, but the crash still happens

#

The script works if I test it in the console, but not when running it normally (i.e. actually using the action)

granite sky
#

You have a replicable crash?

tulip ridge
tulip ridge
granite sky
#

how long is it?

tulip ridge
#

The progess bar or what?

granite sky
#

The minimum crash code :P

tulip ridge
granite sky
#

Nah, I mean the minimum SQF required to cause the crash.

tulip ridge
#

Not sure, I'd have to do some testing and removing bits at a time

#

This is the whole script though (minus some documentation I put at the top)

// Rough length of the "PutDown" animation
#define PUT_DOWN_ANIM_TIME 0.925
#define PROP(PATH, DEFVALUE, DATATYPE) [PATH, DEFVALUE, DATATYPE] call BNAKC_fnc_getConfigProperty
params ["_unit", "_object"];

if !(isText (configFile >> "CfgVehicles" >> typeOf _object >> "BNA_KC_Deployable_item")) exitWith
{
    format ["%1 is not set up properly for BNAKC deployables", _object] call BNAKC_fnc_devLog;
};

private _objectClass = typeOf _object;
private _name = PROP((configFile >> "CfgVehicles" >> _objectClass >> "displayName"), "item", "text");
private _itemClass = PROP((configFile >> "CfgVehicles" >> _objectClass >> "BNA_KC_Deployable_item"), "", "text");
private _pickupTime = PROP((configFile >> "CfgVehicles" >> _objectClass >> "BNA_KC_Deployable_placeTime"), PUT_DOWN_ANIM_TIME, "number");

[
    format ["Picking up %1...", _name],
    _pickupTime,
    {
        // Condition
        _this#0 params ["_unit", "_object", "_itemClass"];
        lifeState _unit != "INCAPACITATED" and // True if unit is uncon
        alive _unit and                        // True if unit is alive
        [_unit] call ace_common_fnc_isAwake    // True if unit is not dead and not unconcious
    },
    {
        // On Success
        _this#0 params ["_unit", "_object", "_itemClass"];
        _unit playAction "PutDown";

        // Check if the player has enough space to store the item, if not, drop it on the ground
        if (_unit canAdd _itemClass) then
        {
            _unit addItem _itemClass;
        }
        else
        {
            cutText ["Not enough space to pick up.", "PLAIN DOWN"];
            private _holder = "groundWeaponHolder" createVehicle [0, 0, 0];
            _holder setPosASL getPosASL _object;
            _holder setDir floor (random 360);

            _holder addItemCargoGlobal [_itemClass, 1];
        };
        deleteVehicle _object;
    },
    {
        // On Failure
    },
    [_unit, _object, _itemClass]
] call CBA_fnc_progressBar;
#

And this is the ACE Action on the object:

class PickUp
{
    displayName = "Pick up FX-7";
    icon = "\swlb_core\data\insignia\medical.paa";

    selection = "interaction_point";
    distance = 5;

    condition = "true";
    statement = "[_player, _target] call BNAKC_fnc_deployablePickup;";
};
granite sky
#

Does it crash when the progress bar starts or when it ends?

tulip ridge
#

Starts, as soon I let go of windows key to use the action, I CTD

tulip ridge
#

Reverted my changes, redid the Weapon to Item change, and removed an extra deleteVehicle, both of those worked fine.

tulip ridge
#

This is an example from the CBA Wiki (other than the comment and title change), and causes me to CTD

granite sky
#

You removed all the code before that?

#

The config lookups and the devLog call

tulip ridge
#

Yep

#

Just tried removing the arguments part from the progess bar as well, still CTD

#

It's just the params and progress bar

#
params ["_unit", "_object"];
[
    "Picking up",
    5,
    {
        // Condition
        true
    },
    {
        hint "completed"
    },
    {
        hint "aborted"
    }
] call CBA_fnc_progressBar;
#

An ACE progress bar works perfectly fine, no issue whatsoever

#
[5, [], {Hint "Finished!"}, {hint "Failure!"}, "My Title"] call ace_common_fnc_progressBar
tulip ridge
granite sky
#

CBA progress bar has a lot of horrible stuff intended for input blocking. Probably related.

hallow mortar
#

Does it crash if you use a key other than the Windows key? I'm pretty sure Windows doesn't like it when you try to block or otherwise hijack Winkey input

sullen sigil
#

is fn a required prefix for sqf files if you already state their file in the cfgfunctions declaration?

#

trying to make the vscode header extension i use autocomplete the function name in the example but fn vs fnc is causing me problems

granite sky
#

Nah, fn_ is just the prefix it adds if you don't specify a file path for that function.

sullen sigil
#

that is truly epic

#

now i just need to figure out how to make my macro extension work in .sqf files

#

doesnt help that i dont actually know which extension is doing macros

tulip ridge
sullen sigil
#

is anyone aware of a method of letting players that are not part of a unit's group to hear its voice lines over radio (without just adding the player to their group)

#

e.g if theres an opfor squad i want to be able to listen to that squads radio transmissions while still being blufor

fleet sand
vapid scarab
#

are you talking about the direction call outs that AI make or player voip?
if players, are you talking vanilla radio channels or acre/tfar?

sullen sigil
#

shouldve clarified ai in my message mb

vapid scarab
#

how would I got about getting all item class names from a single mod?

#

Im making a limited arsenal and I need a list of of kat medical items

fair drum
fair drum
#

"KAT_someitemhere"?

oak island
#

Iโ€™ll just try to work out something else

vapid scarab
fair drum
#

grab the unit, create the respawn, save the return, create a respawn event handler, delete the respawn in that handler, all locally

#

@oak island

fair drum
# vapid scarab KAT_...
private _items = toString {
    "KAT" in configName _x
    &&
    {(getNumber (_x >> "scope")) >= 2}
} configClasses (configFile >> "CfgWeapons");
_items = _items apply {configName _x};

something like this

#

may need additional filtering depending on other mods

untold copper
untold copper
vapid scarab
#

so all items are stored in CfgWeapons?

#

I got it working for the most part. Threw in a toLower for configName. Had to do some manual filtering, but it got me what I want.

#

thank you!

untold copper
vapid scarab
#

excepts exist then....

untold copper
#

Change CfgWeapons to CfgMagazines to return the magazine in KAT.
Edit: Should work... I don't want to start Arma this late in the day. ๐Ÿ™ˆ

vapid scarab
#

Thanks! dont worry about it.

agile pumice
#

Anyone make any ChatGPT hooks yet?

fair drum
#

or did you mean an extension for use inside of arma 3 lol

grizzled cliff
#

One of the largest systems in ACRE is getting around this limitation.

#

It ain't easy.

#

also SQF is fine for large projects if you know how to organize and manager your code.

#

as far as code execution goes

#

ACRE and ACE almost entirely run inbetween frames

#

again it just depends on what you are doing and how often you are doing things

jade acorn
#

is there a getter or any function to check if squad that has reached a waypoint is there in a formation? By default waypoint will continue once the squad leader is near it and he will not wait for any of his team members. I set a timed delay but this is either too long or too short depending on how AI decides to navigate during their movement. I thought of delaying the waypoint completion until whole squad is standing in a formation but I'm a bit stuck rn

kindred tide
manic sigil
#

Is there an easier way of detecting if Shift or Ctrl are being held down, other than setting up an OnKeyDown EH?

winter rose
#

afaik, no

manic sigil
#

Blast. I can probably get it to work as planned, but just feels messy xD

ornate whale
#

Can I use breakOut like here to jump out of a function?

fn_myFunc.sqf:
scopeName "fnc";
params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"];
_group setVariable ["isForgetRunning",true];
if (_newKnowsAbout < _oldKnowsAbout) then {breakOut "fnc"};
...```
granite haven
#
if (_newKnowsAbout < _oldKnowsAbout) exitWith {};
ornate whale
#

What is the correct way of storing some info about players (their in-game characters) in an array in MP? Should I use the player object as an index or some other identificator?

#

So I can find the corresponding value, whenever I have to deal with a player. And once the player dies or something, the corresponding value would loose its relevance. So then I would probably need to erase that specific column.

agile pumice
granite haven
#

and if you want to now give the player a new starting value just put under the last line in onPlayerRespawn:

_newUnit setVariable ["testVar", "Value"];
little raptor
ornate whale
grizzled cliff
#

In general they care more about their code than your end-user performance/FPS.

lol... well caring about the code getting what needs to be done done is kind of important

#

but most, i'd say 99% of SQF coders are fucking idiots.

#

and i say that in the most caring way possible

granite haven
#

you can change "Value" to [] and then you have an array value

grizzled cliff
#

seriously, the amount of times ive seen simple things like code being copied and pasted line after line instead of using a loop

#

or other incredibly simple inefficiences

ornate whale
# granite haven you can change "Value" to [] and then you have an array value

I have set up this code to test it out. It works, but I am not sure what to use instead of the "player" keyword for MP. The array will be stored on the AI's side, not the player's though.

...
private _findTargetUnit = (_group getVariable "myArray") findIf {(_x select 0) == _targetUnit};
systemChat (str _findTargetUnit);
...```
Maybe some network ID.
granite haven
#

so get uid and store with getPlayerUID and retrieve from the array with getUnitByUID

ornate whale
#

Thanks will try it out.

sullen sigil
#

is there any way of getting all holster proxies present on the player's model? meowsweats

#

purpose is using attachto to put pistol in holster proxy

little raptor
sullen sigil
#

i do believe so, thanks ๐Ÿ™‚ ["proxy:\a3\characters_f\proxies\binoculars.001","proxy:\a3\characters_f\proxies\pistol.001","proxy:\a3\characters_f\proxies\launcher.001","proxy:\a3\characters_f\proxies\weapon.001"]

little raptor
#

No those are weapon proxies

sullen sigil
#

oh, duh

#

was wondering what a binoculars holster proxy was ๐Ÿ™ƒ

little raptor
#

I think the proxy is on uniform?

#

Dunno where it's defined

sullen sigil
#

though, speaking of -- would i be able to attach with the same rotation as well? i cant think of any commands that'd let you get that rotation

#

holster proxy is on vest

south swan
#

inb4 holster proxies on the facewear

little raptor
sullen sigil
#

searching through vestcontainer doesnt help either

little raptor
#

Not the actual "vest"

sullen sigil
#

ya

little raptor
#

What does "getModelInfo" return on it?

sullen sigil
#

on the vestcontainer?

little raptor
#

Yes

sullen sigil
#

["dummyweapon.p3d","a3\weapons_f\dummyweapon.p3d",false,[0,0,-0.661233]]

#

so yeah just dummy

little raptor
#

Try creating the actual model

sullen sigil
#

invisible and no collisions

little raptor
#

And then

_vest selectionNames "memory" select {"proxies\pistol_holstered" in _x}
little raptor
#

What did you create?

sullen sigil
#

the dummy one

little raptor
#

I said create the actual model

sullen sigil
#

getmodelinfo vest player doesn't work meowsweats

little raptor
#

You get it from config

#

Not getModelInfo because it's a dummy

sullen sigil
#

oh ofc

#
private _info = getText (configFile >> "CfgWeapons" >> vest player >> "model");
private _vest = createSimpleObject [_info, getPosASL player, false];
_vest selectionNames "memory" select {"proxies\pistol_holsteredโ€ in _x}```right? ![meowsweats](https://cdn.discordapp.com/emojis/707626030613135390.webp?size=128 "meowsweats")
little raptor
#

I guess

sullen sigil
#

does nothing

little raptor
#

Does it create the vest?

sullen sigil
#

nope

little raptor
#

Then check the config manually

sullen sigil
#

but path is being returned

#

and is correct

little raptor
#

Is _vest null?

sullen sigil
#

removing last line makes it create

little raptor
#

That code has errors tho

#

Copy it again

sullen sigil
#

private _info = getText (configFile >> "CfgWeapons" >> vest player >> "model");
private _vest = createSimpleObject [_info, getPosASL player, false];
(_vest selectionNames "memory") select {"proxies\pistol_holsteredโ€in _x}

#

ffs

#

that quote mark

#

returns empty array btw

kindred tide
#

what if you put vest player in ()

#

(vest player)

sullen sigil
#

its creating the model just fine now

tough abyss
#

Guys im just downloaded 2035 russia mod now but i cant see anything in editor

sullen sigil
#

just returning empty array

tough abyss
#

HELP ME PLEASE

little raptor
tough abyss
#

Can you help

little raptor
#

Ask there

tough abyss
#

Ok

kindred tide
little raptor
sullen sigil
#

"proxy:\a3\characters_f\proxies\pistol_holstered.001", could be it?

little raptor
#

Binaries have different ones

sullen sigil
#

what if there's more than one proxy? meowsweats

little raptor
#

But why didn't what I said work?

#

Oh because of memory ofc

sullen sigil
#

does it just increase in .002, .003 etc

little raptor
sullen sigil
#

ive seen vests with multiple pistols when holstered tho

#

in part of the model cfg -- not scripted

south swan
#

but last time i've seen that - all the proxies showed copies of a single sidearm blobdoggoshruggoogly

sullen sigil
#

ya they did

#

i just want to add support for multiple for the sake of it

#

and/or not having it randomly break

little raptor
sullen sigil
#

epic thx

#

next question, how would i make it have the correct rotation when attached? meowsweats

little raptor
#

That could be tricky

#

AttachTo won't work

sullen sigil
#

ah

#

that isnt too great

little raptor
#

So what you could do is first find the offset of the proxy in vest model

#

Then apply the offset to the left leg bone of the player model maybe or right leg? Dunno

south swan
#

operation "rewrite parts of engine in SQF"

sullen sigil
#

I could just have the pistols swap so the one just "not in use" would go to the small of the back/wherever is configured rather than try bodge together a holster part

#

Feels like it'd probably be best (and look least shit, can just check holster scale for if it should appear or not)

kindred tide
#

to update the graphics in ofp

#

run a "thread" for each pixel in scheduled

south swan
#

and call it "scheiders"

sullen sigil
#

now i need to find where on earth webknight does his definitions for melee holsters so i can use those for melee weapons except he doesnt use cfgfunctions

#

lord have mercy

queen cargo
agile pumice
#

If somebody's written an intercept plugin with VS Code before, could you send me a DM, I'm getting a lot of declaration has no storage class or type specifier errors

kindred tide
queen cargo
#

Emulate? You mean running sqf outside of the game? ๐Ÿ˜

kindred tide
#

in game

#

engine inside the engine

south swan
#

inb4 SQF-VM-as-an-extension

queen cargo
kindred tide
#

does it replicate how the engine works or just sqf for sqf in isolation from the actual game

#

or arma's engine has an api that can be used externally

queen cargo
ornate whale
sullen sigil
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
sullen sigil
#

like that

queen cargo
#

```sqf
code
```

ornate whale
#
hint "Thank you!";
ornate whale
#

Can I pass additional arguments to an evenHandler?

sullen sigil
#

missioneventhandler, yes. regular eventhandler, no

still forum
#

regular eventhandler yes via detours

ornate whale
still forum
#

other eventhandlers usually have some object

#

and objects can have variables on them

sullen sigil
#

basically just setting variables in the namespace

#

e.g

private _mydata = [1,2,3,4,5,6,7,69];
_myUnit setVariable ["RC_EH_Data", _mydata, true];
//later on, inside EH
_unit getVariable ["RC_EH_Data",[]];```
ornate whale
#

How can I get to deeper levels of an array with set command, when the array has more dimensions?

_myArray set [[0,1], myValue]; //Like this?
still forum
#

(_myArray select 0) set [1, myValue]

ornate whale
#

OK, thanks.

ornate whale
still forum
#

show pseudo code example thing

#

don't know what u mean

#

how is a variable nested

ornate whale
#
_group setVariable ["targetArray", value] //at [indexVariable,1] index
still forum
#
_myArray  = _group getVariable "targetArray";
(_myArray select 0) set [1, myValue]
ornate whale
#

OK, thats easy, I thought that getVariable gets you only the value not the variable itself.

#

Thanks.

still forum
#

That's correct

#

It gets you the value, not the variable itself

#

and values are by reference.
The variable points to the value, and you can edit the value in-place with the set command

sullen sigil
#
private _mydata = [[1,2], [3,4], [5,6], [7,69]];
_myUnit setVariable ["RC_EH_Data", _mydata, true];
//later on, inside EH
private _thedata = _unit getVariable ["RC_EH_Data",[]]; //returns [[1,2], [3,4], [5,6], [7,69]]
_thedata#0; //[1,2]
_thedata#1; //[3,4]
#

going by my example from earlier

granite sky
#

That doesn't work as intended (probably) because you're publishing the variable.

#

oh wait

#

never mind

sullen sigil
#

using select instead of # should be a crime

granite sky
#

So yeah, if you need to publish the variable over the network for some reason then you need to use setVariable. Otherwise modifying the array is sufficient.

ornate whale
#

Like this?

(_targetArray#_targetUnitIndex) set [1, true];
ornate whale
granite sky
#

Then you have to use setVariable.

#
private _array = _myUnit getVariable "myArray";
_array set [1, true];
// array is now updated on this machine
_myUnit setVariable ["myArray", _array, true];
// array is now updated everywhere
ornate whale
#

Since my script is going to happen in the event hanler of an AI unit, I probably don't need to worry about distributing those vars, but I probably would if those, AIs were headless clients, I suppose.

granite sky
#

Nah, you have a lot more to worry about if you want to support headless clients.

#

spamming arrays over the network in case it might help for poorly-understood reasons is not the correct approach :P

ornate whale
granite sky
#

From an SQF perspective they are nearly the same as a client without a player or UI.

queen cargo
#

so no, select should be used over # where possible

sullen sigil
#

more letters

queen cargo
#

more readable

south swan
#

more better

ornate whale
#

I think that select is much more self-explanatory for newbies.

sullen sigil
#

_arr#0 is much quicker to write than _arr select 0

south swan
#

you write code once, you read it many times

queen cargo
#

leaving this here

#

a benefit now is not worth as a benefit long-term

#

sure, now you save a second here not writing select

#

tomorrow, when reading that code tho, you will have a harder time

south swan
#

extra 5 seconds spent understanding a written code are unlikely to be covered by 5 microsecond performance benefit unless the code is run more than a million times before getting changes once blobdoggoshruggoogly

little raptor
#

imo in terms of reading there's no difference between # and select, if you use syntax highlighting

#

so code maintenance is irrelevant

#

in fact I'd argue # makes things more readable in cases where you should chain stuff:

_arr#0#0

vs

_arr select 0 select 0
#

unless you want to be weird/inefficient and delcare a variable for each select

queen cargo
#

you already can see the issue in this very comparison

#

_arr#0123#41515#155#15151

#

how many selects do i have in here

#

vs

little raptor
#

syntax highlighting makes it readable

queen cargo
#

_arr select 0123 select 41515 select 155 select 15151

south swan
#

you have "your data organization is kinda stupid" many selects ๐Ÿ™ƒ

sullen sigil
#
_arr#0123#41515#155#15151
_arr select 0123 select 41515 select 155 select 15151

one takes up more horizontal space ๐Ÿคท

south swan
#

and nothing really prevents you from going _arr # 0123 # 41515 # 155 # 15151

queen cargo
#

your brain still has to cope for it
we are not made to read text like that
wchi is the rseoan you can raed tihs txet wohitut any pobrelms

sullen sigil
#

i can only read that with many problems

#

and i use minecraft font for vscode

south swan
#

yaay, holywar of a styling kind

sullen sigil
#

try read this ๐Ÿ™‚

#

i love indentation

#

i love macros

#

and i love incorrect linters

queen cargo
sullen sigil
#

worst part is that using it like this has meant ive written one mod in 10 hours most of which was spent trying to make it compatible with webknights stuff

#

as opposed to it taking me like 5 days

queen cargo
#

so you are more of a masochist? yeah, go use # then ๐Ÿ˜„
wtf is that minecraft font heresy

sullen sigil
#

it makes it easier to read for me for medical reasons

south swan
#

change that # to cobblestone textured square for better visibility blobcloseenjoy

sullen sigil
#

shit u right

#

its so much better than trying to read all this

#

trying to read that is just awful

kindred tide
sullen sigil
#

theres no such thing

#

(blame the cba waitandexecute)

kindred tide
#

i use exitWitha lot to prevent nesting at if s

sullen sigil
#

i need to use else for all of those ifs

queen cargo
#

adding a ton of sqf _fnc_fancy = {}; inbetween actual code is not really doing the trick, as visually everything looks the same

kindred tide
south swan
#

_secondSecondaryEquipped sounds dangerously close to breaking the 4th wall, tbh

sullen sigil
#

that only works if youre just eliminating one condition rather than having something run if one condition is true and other

sullen sigil
south swan
#

here's for questionable editor (and life) choices:

#

and i'm done shitposting for today

kindred tide
#

it's pretty surreal

#

like e.g a citizen is just a doll, his brain and identity are in the suitcase and the doll can respawn or change its form

sullen sigil
#

suitcases as logic objects but just being used as a namespace??

south swan
#

okay, you're actively tempting me. Make those Land_PortableLight_02_quad_base_Fs and store the data as animation phases. Let those lamps dance

kindred tide
sullen sigil
#

sometimes i arbitrarily flip primary secondary weapon and second secondary weapon because its funny

#

(i dont actually its only for saving cba loadouts)

kindred tide
#

e.g

sullen sigil
#

tag ABC

#

how... interesting

queen cargo
#
function global(scalar val = 0) {
    if (val > 10)
        return true;
    else if (val > 12) {
        return val < 50 ? false : true;
    }
}
final function fnc_myFunc(string msg) {
    diag_log(msg);
}``` we all do things to improve readability
sullen sigil
#

return commands are silly and sqf does it better

kindred tide
# sullen sigil tag ABC

that's the only thing that's global in my code. the ABC framework. everything else is stored in objects like in namespaces

kindred tide
#

or is it

queen cargo
#

that is sqc, which transpiles to sqf, yup

acoustic abyss
#

hey guys
sector control doesnt work after save/load
sector capturing process just broken after reloading
whats worng?

acoustic abyss
#

it seems like i need to reinit sector control module
but idk how

ornate whale
#

How do I call addUserActtionEventHandler from server in onPlayerConnected?

addMissionEventHandler ["PlayerConnected", {
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
addUserActionEventHandler ["KeyName", "Activate", {params ["_activated"];}];
}];```
acoustic abyss
#

you do not need to call it
its event handler
just place it in init.sqf

#

you should add it to new player

ornate whale
#

But how? ๐Ÿ˜„

acoustic abyss
#

just try while cycle
and add condition with count of players
like if count of players chanhed it will reput this handler on them all

#

do you know why sector control doesnt work afer reload saves in sp?

ornate whale
granite sky
#

You can but it's not necessarily a good idea.

ornate whale
#

onPlayerConnects gives me the exact player, so I would probably targeted his machine only.

granite sky
#

I don't think PlayerConnected would work as a trigger because it's fired before the player object is created.

#

OnUserSelectedPlayer would probably work.

ornate whale
#

OK, but how I deliver addUserActionEventHandler ["KeyName", "Activate", { params ["_activated"]; to the client?

#

This is locally executed so I have to somehow send a message to the client with this code.

granite sky
#

is there a good reason not to put this in initPlayerLocal or a postInit function?

ornate whale
#

I am not sure, probably not. ๐Ÿ˜„

ornate whale
#

When this code is executed on the client from an UserActionEventHandler, will it have the global effect, like that the AI's on the server would use the new value when spotting players? Or should I use remoteExec?

    if (stance player == "STAND") then {
        hint "Stand";
        player setUnitTrait ["camouflageCoef", (stanceCamouflageCoef select 0) * baseCamouflageCoef];
    };```
granite sky
#

It should do.

#

I would not personally trust it.

ornate whale
#

What would you do to make it trustworthy then? ๐Ÿ˜„

granite sky
#

I'd check it.

#

Trouble is it's a rare usage. The common traits are medic and engineer, and those are primarily used locally.

ornate whale
#

I have launched two instances of Arma, and made a local server, and it shows the "debug" hint on both. Maybe I should check the real values. LOL ๐Ÿ˜„

ornate whale
granite sky
#

Just make a DS with a batch file. Don't need many mods for this sort of testing.

queen cargo
#

in 3den at the top, there is options (name may be different) and multiplayer where you can make that available to nobody, everybody or logged in admin
could also be in another dialog in those

granite sky
#

I didn't have much luck getting two clients to connect to each other recently. It used to work.

ornate whale
#

So, it works, but its slow as hell to be any useful. There is like 5-10 secs delay between it gets executed and when I register the change in the value with the server player. I need to do it differently.

granite sky
#

That would be a risk.

#

Like we (and ACE) have to remoteExec spam setMass because it's too slow to avoid players murdering each other with carried crates.

#

You might find setUnitTrait is similar and works locally on non-local units.

#

Apparently remoteExecCall has much higher network priority than some of these commands.

ornate whale
#

So I would need if statement to check whether I am in SP or MP, and if MP then remote call

granite sky
#

shrugs

#

remoteExec works in SP too. It's just not necessary.

#

Only a theory anyway. setUnitTrait on non-local units might just do nothing.

ornate whale
#

What would I use then. ๐Ÿ˜„

#

Documentation says Local and Global execution

#

nothing about server

granite sky
#

There is not necessarily a solution.

#

setMass is also marked as local argument, global effect but it does change remote objects too until the network catches up. I suspect a lot of local-argument commands work like this.

ornate whale
#

Should I use schedule or unscheduled vesrion of remote?

granite sky
#

unscheduled

ornate whale
granite sky
#

what, it fixed the delay issue?

ornate whale
#

Yes.

granite sky
#

gross :P

ornate whale
granite sky
#

It's kinda dumb because it's probably sending 10x as much data over the network as a result, but Arma makes us do dumb things.

ornate whale
granite sky
#

(SQF is horribly inefficient on network data)

ornate whale
# granite sky (SQF is horribly inefficient on network data)

One last question, if you allow me, for this day. I am checking the stance when the onUserAction event is fired. But I am not sure, how to check the players stance correctly, because when I switch them quickly, it sometimes returns wrong stance, because standing up takes longer then going prone and so on. So I placed the artifical delay 1.3 secs, so I am sure he finished the change when I start to if his stance.

[] spawn {
    sleep 1.3;
    if (stance player == "STAND") then {
        hint "Stand";
        //player setUnitTrait ["camouflageCoef", (stanceCamouflageCoef select 0) * baseCamouflageCoef];
        [player, ["camouflageCoef", (stanceCamouflageCoef select 0) * baseCamouflageCoef]] remoteExec ["setUnitTrait"];
    };
    if (stance player == "CROUCH") then {
        hint "Crouch";
        [player, ["camouflageCoef", (stanceCamouflageCoef select 1) * baseCamouflageCoef]] remoteExec ["setUnitTrait"];
    };
    if (stance player == "PRONE") then {
        hint "Prone";
        [player, ["camouflageCoef", (stanceCamouflageCoef select 2) * baseCamouflageCoef]] remoteExec ["setUnitTrait"];
    };
};```
granite sky
#

You were hoping there was a better solution?

ornate whale