#arma3_scripting

1 messages · Page 729 of 1

little raptor
#

can be done in SQF too

hollow thistle
#

FSM Editor can compile to standard SQF

pliant stream
#

ah right, with a different template, you're right

hollow thistle
#

then it does state machine on IFs/Switches or smth like that NotLikeThis

pliant stream
#

i could see it being useful to compile it to SQF if you wanted to have event based transitions instead of polling though

#

these days since A3 SQF has those associative containers you would probably use one of those for a transition table instead of if/switch

#

when processing event E for current state S, look up transition T for key (S, E) in the transition table. if the key exists perform the transition

loud python
#

can I not use createVehicle with "Logic"?

#

as in, "Logic" createVehicle position player

winter rose
little raptor
#

so createUnit

loud python
plush nova
#

i tried them, they don't seem to fire reliably :/

hallow mortar
#

You could try a distance check. If a vehicle is within 0.01 metres, and moving, and the person isn't in the vehicle, there has probably been a collision. Still some risk of false positives but probably less than the other method.

still forum
#

Not sure if it works like that, I guess it doesn't.
But I don't think I tried.

I know in my looting script (which I made this for) I just went for "looted a weapon" message, because I couldn't detect which body the weapon belonged to

little raptor
#

I thought you meant it was gonna work with that as well meowsweats

plush nova
#

is there a config flag in cfgAmmo that's responsible for whether it explodes when you setDamage 1 it?

pliant stream
#

I suspect that is controlled by the simulation type

plush nova
#

hmm broadly what explodes, grenades?

#

and then shells don't?

#

well i guess that's just a cfg crawl

#

thanks

rigid seal
#

In Wasteland, How do I add Backpacks to spawn on vehicles?

flint topaz
#

Hi, I'm trying to get a vehicle by a variable name, however I have the name as a string and don't want to hard code it how can I get an object/vehicle by it's name I've tried missionNamespace getVariable _name, but this didn't seem to work.

pine wind
#

Anyone know a script for like cinematic camera? I want to put a camera over a vehicle or object and have it pan for briefing.

copper raven
flint topaz
#

I assign it in editor

copper raven
#

yeah, so it should work fine, try checking if _name is the varname you want, e.g. systemChat str [_name]

flint topaz
#

alright

#

@copper raven Sorry for the @, so with some investigating I found out that getVariable is working fine. My issue is getting the name of the vehicle the player is currently in currently trying to do it via this```sqf
_vic = vehicle _player;
if(_vic != _player) then {
_name = (_vic call BIS_fnc_getName) + "_1";
};

#

It is replying just "_1"

copper raven
flint topaz
hushed tendon
hallow mortar
#
  • Units drop their weapons when they die; at the time of checking with the EH, the weapon may no longer be in the unit's possession, so the original problem remains - but this problem is eclipsed by:
  • Weapons aren't unique objects and don't really support things like setVariable; you'd have to setVariable on the container it resides in once dropped, but then the original problem remains.
hushed tendon
#

Maybe on a check damage eh check to see if the unit will die and if they do so delete the weapon and create another inside it’s own container

violet remnant
#

anyone using the github action arma-actions/sqfc@latest ?

torn wing
#

Is this the right channel to ask about my music scrip problems?

hushed tendon
torn wing
#

okeay

hallow mortar
#

That really depends on whether the problem is with the config, or with a script that simply references the configured music.

torn wing
#

Well i would assume its the script but my ARMA editing experience is mediocre at best so it could be anything.

#

well heres my problem, everytime i try getting this thing to work i get an error message telling me "Sound Russi not found". (please excuses these very childish names)
The "Pog" sounds so far is all good but it doesnt play when i try to activat it via addaction

my script goes as follows

{
sounds[] = {pog,music};
class 01
{
    name = "pog";
    sound[] = {"music\pog.ogg", db+10, 1.0};
    titles[] = {0,""};
};

class 02
{
    name = "russi";
    sound[] = {"music\russi.ogg", db+10, 1.0};
    titles[] = {0,""};
};


};```
#

The pog sound used to work before i tried to squeeze the russi sound in there.

winter rose
#

1/ that's not a script, that's a config 😉
2/ you are defining Musics (CfgMusic) so use playMusic
3/ the name to be set is class 02class Russi

#

see https://community.bistudio.com/wiki/Description.ext#CfgMusic

class CfgMusic
{
    tracks[] = {};
    class pog
    {
        name = "My Music - pog";
        sound[] = {"music\pog.ogg", db+10, 1.0};
    };

    class russi
    {
        name = "My Music - russi (this is only a display name";
        sound[] = { "music\russi.ogg", db+10, 1.0 };
    };
};

@torn wing

hallow mortar
#

As well as what Lou said, don't forget to restart the Editor after adding new sound/music files to a mission that you currently have open in the Editor.

torn wing
#

ayy thx, ill try it out

winter rose
torn wing
#

Unfortunately i still get the error and as expected it doesnt work

hallow mortar
#

What do you have as CfgMusic now, and what's the script you're using to call it?

torn wing
hallow mortar
#

Well say3D uses CfgSounds, not CfgMusic, so there's your problem

coarse marsh
#

nice

torn wing
#

lol

#

alright

coarse marsh
#

this where the script kiddies are?

hallow mortar
#

....Do you have a real question or are you just here to dispense random disparaging remarks?

torn wing
#

i would assume the later

#

Oke ive backtracked a little and i got it kinda working, it looks like this now. Last question how do i get the other sound in there as well, everytime I try it it spits out an error message.

{
 sounds[] = {};
 class russi
 {
  name = "russi";
  sound[] = {"\sounds\russi.ogg", 300, 1};
  titles[] = {0,""};
 };
};
hallow mortar
#

...What does the error message say?

torn wing
#

description.ext, line 16:'/CfgSounds.':{' encountered instead of '='

#

As i am hot garbage with this kind of stuff it looks like that

{
 sounds[] = {};
 class russi
 {
  name = "russi";
  sound[] = {"\sounds\russi.ogg", 300, 1};
  titles[] = {0,""};
 };

{
  name = "pog";
  sound[] = {"\sounds\pog.ogg", 300, 1};
  titles[] = {0,""};
 };
};```
hallow mortar
#

You're missing a class pog

lean cedar
#

So I'm sure this a question that's probably been asked to death but is there a way to disable random eyewear from appearing as a blanket thing across the board? Or is the only way to do so to make my own faction and then do it through that?

I read on the forums that there's a way to remove all glasses as units spawn in but I haven't been able to get it to work so I'm guessing that method doesn't work whatsoever

torn wing
#

Youre the best! Thx for the help guys!

willow hound
lean cedar
#

They're spawned through a script, I'm particularly trying to remove goggles in a Random Infantry Skirmish mission right now, but I am looking for solutions across the board so I can do this with all of the missions that I play

willow hound
#

How does the script create the units? Does it use BIS_fnc_spawnGroup or does it use createUnit directly?

wary python
#

So, I'm trying to figure out these Multiplayer Server Commands. I'm testing it with a friend on an MP mission (not dedicated server) by using chat only for now. Does anyone know why banning won't work?
https://community.bistudio.com/wiki/Multiplayer_Server_Commands

#kick name //works
#kick "name" //works
#exec kick name // does not work
#exec ban "name" //does not work
#exec ban name //does not work
#ban name //does not work
#ban "name" //does not work
willow hound
#

Does #exec ban UID work?

wary python
#

no

willow hound
#

Both #exec ban "123" and #exec ban 123?

wary python
#

yes

#

#restart and #shutdown won't work either for example

willow hound
#

Unfortunately the documentation for server configuration and administration is a bit lackluster and has not been maintained as much as other topics nootlikethis
Have you asked in #server_admins?

wary python
#

no

#

will do, thanks anyways :)

hallow mortar
#

Some of these commands probably don't work because it's not a DS

wary python
#

Possible, but i'd love to know which ones do

#

There seems to be nothing on the wiki about this

hallow mortar
#

I would posit that you can simply try all of them, and if it doesn't work, now you know

wary python
#

Maybe I'm doing something else wrong and i don't have access to a dedicated server as of now to rule that out

valid rock
#

So , I got a script for making a helicopter fly to you, pick you up and take you to a "base" on green smoke. It works perfectly well for me, but I gave it to someone and it's not working for them, even though they have put it all in correctly.

#

Does anyone know why this could be?

high vigil
#

Any one know the return of alive _object if its been deleted vs killed?

grave totem
willow hound
valid rock
# grave totem Many reasons, though without looking through the script its difficult to pinpoin...

this is the script

_shooter = _this Select 0; 
_ammotype = _this Select 4;

//hint format["%1",_ammotype];

sleep 2;
switch (_ammotype) do
{
  
    case "SmokeShellGreen":
    {
       Hint "Helicopter Inbound";
_wp0 = group Heli1 addWaypoint [ getpos player, 50]; 
_wp0 setWaypointType "MOVE";
_wp0 setWaypointStatements ["true", "Heli1 land 'land'"];

waituntil {{_x in Heli1}count units blue  == {alive _x} count units  blue};


_wp1 = group Heli1 addWaypoint [getpos base, 50];
_wp1 setWaypointType "MOVE";

_wp2 = group Heli1 addWaypoint [getpos base, 50];
_wp2 setWaypointType "TR UNLOAD";
_wp2 setWaypointStatements ["true", "Heli1 land 'land';"];

   };
   
      case "1Rnd_SmokeGreen_Grenade_shell":
    {
       Hint "Helicopter Inbound";
    };
    
        case "FlareGreen_F":
    {
       Hint "Helicopter Inbound";
    };
    
       case "3Rnd_SmokeGreen_Grenade_shell":
    {
       Hint "Helicopter Inbound";
    };
    
        case "UGL_FlareGreen_F":
    {
       Hint "Helicopter Inbound";
    };
    
      case "3Rnd_UGL_FlareGreen_F":
    {
       Hint "Helicopter Inbound";
    };
};
#

It's coming up at line 18 which is an issue for them

#

so the "waituntil {{_x in Heli1}count units blue == {alive _x} count units blue};"

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
little raptor
valid rock
#
//this addEventHandler ["fired",{_this execvm "detect_smoke.sqf"}]
_shooter = _this Select 0; 
_ammotype = _this Select 4;

//hint format["%1",_ammotype];

sleep 2;
switch (_ammotype) do
{
  
    case "SmokeShellGreen":
    {
       Hint "Helicopter Inbound";
_wp0 = group Heli1 addWaypoint [ getpos player, 50]; 
_wp0 setWaypointType "MOVE";
_wp0 setWaypointStatements ["true", "Heli1 land 'land'"];

waituntil {{_x in Heli1}count units blue  == {alive _x} count units  blue};


_wp1 = group Heli1 addWaypoint [getpos base, 50];
_wp1 setWaypointType "MOVE";

_wp2 = group Heli1 addWaypoint [getpos base, 50];
_wp2 setWaypointType "TR UNLOAD";
_wp2 setWaypointStatements ["true", "Heli1 land 'land';"];

   };
   
      case "1Rnd_SmokeGreen_Grenade_shell":
    {
       Hint "Helicopter Inbound";
    };
    
        case "FlareGreen_F":
    {
       Hint "Helicopter Inbound";
    };
    
       case "3Rnd_SmokeGreen_Grenade_shell":
    {
       Hint "Helicopter Inbound";
    };
    
        case "UGL_FlareGreen_F":
    {
       Hint "Helicopter Inbound";
    };
    
      case "3Rnd_UGL_FlareGreen_F":
    {
       Hint "Helicopter Inbound";
    };
}; ```
valid rock
little raptor
valid rock
#

Made a text document, renamed it and changed it to a .sqf and then pasted the code in

#

There's another section that needs to go in the players init box but the game was flagging the file as broken

little raptor
#

if so, tell them to enable file extensions in Explorer

valid rock
#

the script was found, the game was flagging line 18 as broken

little raptor
wicked roostBOT
#
Arma RPT

Arma generates a .rpt log file each time it's run, which contains a lot of information like the loaded mods, or any errors that appear, this log file can be very useful for troubleshooting problems.

To get to your RPT files press Windows+R and enter %localappdata%/Arma 3

Additionally see the wiki page for more info: https://community.bistudio.com/wiki/Crash_Files

To share an rpt log here, please use a website like https://sqfbin.com/ to upload the full log, that way the people helping you can take a look at it and try to figure out the problem you're having together with you.
Note: RPT logs can hold personal information relevant to your system, the game or others.

little raptor
#

@valid rock 👆

#

line 18 seems to be the line with waitUntil

grave totem
#

just curious since i havent seen it, is blue referencing blufor units?
or it a group variable name

little raptor
#

if so they didn't run the script scheduled

little raptor
#

it should be a group

#

waituntil {{_x in Heli1}count units blue == {alive _x} count units blue}
this is several times faster:

waituntil {units blue findIf {alive _x && !(_x in heli)} < 0}
valid rock
#

ok, I've asked them to get the RPT log

#

sorry for the wait

#

they're gonna have a look for it now

graceful kelp
#

trying to get the owner of laser targets

_laser = nearestObjects [vehicle player, ["laserTarget"], 2000, true];
_shotParents = getShotParents _laser;
hintsilent str _shotParents;

someone suggested getshotparents but that dosent seem to work

little raptor
#

_laser is an array

graceful kelp
#
_laser #0 = nearestObjects [vehicle player, ["laserTarget"], 2000, true];
_shotParents = getShotParents _laser;
hintsilent str _shotParents;
#

?

little raptor
#

still wrong

graceful kelp
#
_laser = nearestObjects [vehicle player, ["laserTarget"], 2000, true];
{
    _x params ["_laserV"];
    _shotParents = getShotParents _laserV;
    hintsilent str _shotParents;
} foreach _laser;
```?
#

still dosent work with lasers

little raptor
graceful kelp
#

[]

little raptor
#

¯_(ツ)_/¯

#

ask whoever suggested it to you

graceful kelp
#

That dosent seem to work any other suggestions?

#

so the laser has a name of

[17c2c9e6080# 285: lasertgt.p3d]
little raptor
#

Also I don't need the whole file

#

Just the error

#

Just search for error in the file

graceful kelp
#

the only thing i could think of is to check all units to see if they have a laser using lasertarget

valid rock
low birch
#

How hard to check player nickname by a list on joining and to kick player if he is a list? I meant nickname exactly. Not UID. I want to prohibit joining server for users with Windows default usernames like Admin, User of something like that...

fresh wyvern
#
if (_unit configFile isEqualTo (configfile >> "CfgVehicles" >> "B_Helipilot_F")) then {

How do I write this if statement which intend do compare the configFile of a unit against a preset unit class? (configfile >> "CfgVehicles" >> "B_Helipilot_F")

copper raven
#

typeOf _unit == "blablabla_classname_f"

fresh wyvern
meager epoch
#

How can I put those icon-like picture thingies in a hint?

meager epoch
#

however, here's a question i could not find the answer to on google (or idk how to)

#

how can i make text bold and add bulleting to it in a hintC?

willow oyster
#

does anyone know how to make a script execute every 15 seconds or so?

#

and if so would it be compatible with the EU 0A-0D and USA 02 zeus servers?

night sundial
#

USA 04 also has scripting enabled. And you would just have a scheduled process with sleep 15. Not sure if sleep is allowed on public zeus, you'd have to try it out

meager epoch
#

Another question... how can I get the zeroingIndex in currentZeroing?
According to the BIKI, this is what the command returns:

Array in format:
0: Number - Distance
1: Number - zeroingIndex
0 ≙ 50 m
1 ≙ 100 m
2 ≙ 150 m
...
However, I only get the Distance?

_wepZeroing = currentZeroing player;
//some irrelevant code
player setWeaponZeroing [(primaryWeapon player), (currentMuzzle player), _wepZeroing];

This sets the zeroing to 2400m when it's supposed to set it to 400m.

#
object setWeaponZeroing [weaponClass, muzzleClass, zeroingIndex];

And zeroingIndex over here, only wants the index, so when it gets a value of 400 over there I assume it sets the zeroing to the max possible value in game.

#

tl;dr - how do i get the index of the array and not the distance

night sundial
#

object currentZeroing [weaponclass, muzzleclass]

willow oyster
meager epoch
night sundial
#

i would say so, but currentZeroing object just seems pretty ambiguous

willow oyster
#

also im new to scripting, would this work for refilling a vehicles ammo every 15 seconds then?
sleep 15 _vehicle setVehicleAmmo 1;

meager epoch
willow oyster
#

how would one do that?

meager epoch
#
while {condition} do {
    sleep 15;
    _vehicle setVehicleAmmo 1;
};
#

i guess

willow oyster
#

thanks for the help

night sundial
#

make sure you execute it where the vehicle is local

#

lol i saw that bt, was wondering if parentheses were allowed now

meager epoch
#

yeah lol, i forgot arma wants them curly brackets there

night sundial
#

makes no sense that if get parentheses but not while

meager epoch
willow oyster
#

is it because i replaced _vehicle with the variable name of the vehicle?

meager epoch
#

shouldnt be

cerulean cloak
#

Where are you running it?

night sundial
#

did you execute it where the vehicle is local

meager epoch
#

u didnt straight up put condition where it says condition, right?

willow oyster
#

im putting it in the init of the vehicle and yes i did put condition there because i have no fucking idea what im doing

night sundial
#

init is unscheduled

meager epoch
#

as for the condition part

#

condition is for when u want the while to trigger

#

i suck at explaining

#

but in other words

willow oyster
#

im trying to make compositions for pub zeus

cerulean cloak
#
[] spawn {
    while {true} do {
        sleep 15;
        _vehicle setVehicleAmmo 1;
    };
};
willow oyster
#

i am dumbass

meager epoch
#
while {alive player} do {
    sleep 15;
    _vehicle setVehicleAmmo 1;
};

this will only go through the loop while the player is alive

#

the example above mine will trigger every time since the condition is always true

#

like i said, i suck at explaining

cerulean cloak
night sundial
#

you can also make the vehicle have infinite ammo using event handlers, which seems like what you are trying to do

meager epoch
#

yeah, was just making clear on what to put at the condition part cause he straight up put condition there

willow oyster
#

even if it would be funny as hell

night sundial
#

ok. the issue with the code above is locality

#

once another player gets in the vehicle, the code will no longer work, because the vehicle will be local to the player. Therefore setVehicleAmmo will need to be ran from the player's client. Im like 99% sure

#
[this] spawn {
    _vic = _this#0;
    while {!isNull _vic} do {
        sleep 15;
        [_vic,1] remoteExec ["setVehicleAmmo",_vic];
    };
};
#

try that

willow oyster
#

ok that works

night sundial
#

i just made a few corrections, but that code should be final

willow oyster
night sundial
willow oyster
#

oh shit time to add that to the favorites list

night sundial
#

so add that to your favorites as well

#

lol

willow oyster
#

finally, i have all the zeus script servers

#

but i will probably never use any of the EU ones except 0B

night sundial
#

for me it really just depends on player count. I dont care about ping so ill join any scripting server with people already in it. You see some interesting stuff

willow oyster
#

EU 0A is locked on recruit and EU 0C and EU 0D are locked on vet

night sundial
#

oh

willow oyster
#

also the EU ones are testing servers so dont be surprised if someone has a non-zeus mode running on it

#

unlawful if you wanna do some shit imma be on USA 02

night sundial
#

probably not tonight, pretty busy when im not checking discord. Youll probably see me around at some point though, my steam is the same is my discord

ornate quest
#

I know there's an event handler for respawn but does it also trigger "killed" if you do hit respawn?

night sundial
ornate quest
#

But if you hit respawn your unit dies

meager epoch
#

Since you apparently die when you do it or w.e

night sundial
#

Quirky arma mechanics

#

Yea i have no idea, would have to test

ornate quest
#

Yeah will do

#

Ah yeah it does

#

Thank you all

ornate quest
#

Do you know why a createdVehicle reference is different on a dedicated server? _unit = createVehicle ["ACE_Box_Ammo",[_xx,_y,_z]]; clearItemCargo _unit; clearMagazineCargo _unit; clearWeaponCargo _unit; works locally but on a dedicated server it doesn't. The box still has items inside.

night sundial
#

idk about clearItemCargo but clearMagazineCargo and clearWeaponCargo have local effect. Use the global variants instead. clearItemCargoGlobal clearMagazineCargoGlobal and clearWeaponCargoGlobal

ornate quest
#

Ahh shit

#

Thank you

little raptor
still forum
#

and the reason is probably to make something like do-while loop
The reason is that the condition needs to be checked more than once

little raptor
#

yes true

pliant stream
#

now what is the reason why while does not have its own grammar? 😛

still forum
#

waste of time

pliant stream
#

perhaps if you're not interested in making the language optimisable anyway

still forum
#

I don't understand that relation?

west grove
#

question. when nailing the player to an object like a tank via attachTo .. is there any way to preserve the ability to look around? currently my view is frozen to the front.

pliant stream
#

it's not precisely necessary for while to have its own grammar, but if you are going to build a control flow graph it's much easier if loops are a first class member of the language

pliant stream
west grove
#

nah, can't even look around with alt

warm hedge
#

Isn't that an “Engine Limitation”?

#

Like since A2

crude vigil
# west grove question. when nailing the player to an object like a tank via attachTo .. is th...

I doubt that, as attachedObjects simulation is somewhat converted to whatever they are attached to, which I believe is the result of limitation to camera(pretty much the same effect on disabled simulation). And I doubt it would be possible to preserve the ability at all unless attachTo itself gets an upgrade which I believe would be a dream at this point. I guess your only way would be setPos spamming in onEachFrame or shifting to some invisible player instance or usage of camera of "an object like a tank" if suitable.

hallow mortar
#

It would be cool if there was a placeable "turret" that was just an invisible FFV seat for attaching to things. That would open up a lot of possibilities without needing new mechanics. Sadly unlikely to happen though.

pliant stream
#

create an invisible vehicle with the seat and attach that to the visible vehicle

sly bough
#

Error Type Number,Not a Number, expected Number
anyone knows what that means?

#

happens in a mission on a dedicated server, for just one player

pliant stream
#

you have a NaN somewhere

sly bough
#

NaN! thanks

#

could it also be a false?

winter rose
#

no

#

NaN is e.g 1/0

sly bough
#

oh sorry misread wiki

#

ok thanks tho

pliant stream
#

1/0 is infinity

#

0/0 is NaN

sly bough
#

_unit setHitIndex [_hitPart select 1, _damage]>
12:06:49 Error position: <setHitIndex [_hitPart select 1, _damage]>
12:06:49 Error Type Number,Not a Number, expected Number
12:06:49 File mpmissions__cur_mp.Altis\AIS\Damage\fn_handleDamage.sqf..., line 187
12:06:49 Error in expression <};

_damage = _damage min 0.89;

#

is it _damage or _hitpart select 1?

#

im v rusty in arma sqf, wrote a lot in arma2 times , n only maybe thousand lines in arma3 but thats also like 5 years ago

#

hm can HandleDamage restun a NaN ?

#

not my mission, but i been told that the loaded mods of the affected player are the issue and not the mission, the error happens on the server tho, and we all have the same mods + hashes

#

imma go read line for line

winter rose
#

if _hitPart select 1 is not well defined, this is the issue
e.g _hitPart being an empty array 👀

#

maybe the mission could do a better script check

pliant stream
#

does indexing out of bounds not give zero divisor in A3?

sly bough
winter rose
sly bough
#

i just checked a few lines above it
it doesnt fail already at

_damage = (_hitPart select 2) + (_new_damage * AIS_DAMAGE_TOLLERANCE_FACTOR);

pliant stream
#

yes, select N does not give any error though

sly bough
#

lemme check license of direct action, maybe i can post the sqf

winter rose
sly bough
#

Please do not modify and / or re-upload this mission without permission in any form on Steam or elsewhere.

nah

#

how does arma3 behave with special case floating points in arithmatic

#

NaN +2 valid?
nan * 2 valid?

pliant stream
#

why not

sly bough
#

is there a IsNaN ?

#

or can i do if damage == NaN ?

winter rose
#

you said you couldn't modify the scripts?

sly bough
#

i can

#

i cant share cause of licensing

winter rose
#

the ideal way is to prevent a NaN value

crude vigil
sly bough
#

for now i would just check if damag is nan then set it to 1 at the end
and add logs to add which line in changes from a finite number to nan

velvet merlin
#

[pHolder_wp_grpCharlie_1,pHolder_wp_grpCharlie_2,pHolder_wp_grpCharlie_0]

#

why is ARRAY sort true leading 0 to be the last one here?

#

or is sorting of entities based on something else?

hollow thistle
#

wut? This looks an array of objects

#

it does not care about what is the var name of the objects when sorting them.

velvet merlin
#

so order of placement in editor/creation via sqf?

hollow thistle
#

might be, or netId

#

¯_(ツ)_/¯

pliant stream
#

or address

hollow thistle
#

I would not expect any sensible sort order when sorting array of objects.

winter rose
#

String, Number or Array - otherwise, use BIS_fnc_sortBy and sort by vehicleVarName 😉

velvet merlin
#

ty

digital hollow
#

is it possible to script set RTD states (like collective, rpm) by script while in standard flight model?

little raptor
#

no

digital hollow
#

Such is life

meager epoch
#

Does anyone know why the zeroing is not being set properly?

_wepZeroing = player currentZeroing [(primaryWeapon player), (currentMuzzle player)];
player removeWeapon (primaryWeapon player);

if (332350 in (getDLCs 1)) then {
  player addMagazine "10Rnd_338_Mag";
  player addWeapon "srifle_DMR_02_camo_F";
  player addWeaponItem ["srifle_DMR_02_camo_F", "optic_LRPS"];
  player addWeaponItem ["srifle_DMR_02_camo_F", "bipod_01_F_blk"];
  player addWeaponItem ["srifle_DMR_02_camo_F", "muzzle_snds_338_black"];
} else {
  player addMagazine "20Rnd_762x51_Mag";
  player addWeapon "srifle_EBR_F";
  player addWeaponItem ["srifle_EBR_F", "optic_LRPS"];
  player addWeaponItem ["srifle_EBR_F", "muzzle_snds_B"];
  player addWeaponItem ["srifle_EBR_F", "bipod_01_F_snd"];
};

player setWeaponZeroing [(primaryWeapon player), (currentMuzzle player), (_wepZeroing select 1)];
player selectWeapon (primaryWeapon player);
#

And by not being set properly, I mean not being set at all.

#

It works if I do it separately, but not in the example above.

little raptor
meager epoch
#

in the currentZeroing or the setWeaponZeroing

#

?

#

which one is the naughty one

little raptor
#

both are wrong

meager epoch
#

setWeaponZeroing requires it

little raptor
#

get the correct muzzle

little raptor
meager epoch
#

what does that give me

#

the one i have rn

#

which muzzle does it give me

little raptor
#

the current muzzle meowsweats

meager epoch
#

isnt the current muzle the one i need meowsweats

little raptor
#

no

meager epoch
#

oh

#

so which one do i need

little raptor
#

the muzzle you intend to set zeroing for

meager epoch
#

right

#

fixed it, thanks

meager epoch
#

Can I parseText inside a hintC? Cause I can't seem to get it working (works the same way on a hint).

little raptor
last rain
#

why it is not work? I run this command at dedicate server
InitServer.sqf

_name = "test";
serverCommand format ["#kick %1",_name];
last rain
#

kick player

open fractal
#

why are you doing it in initServer?

last rain
#

And where should I execute this command?

hallow mortar
#

If you execute it in initServer.sqf, it will be run immediately as soon as the mission gets past the slotting screen. If the player isn't connected at that time, it won't do anything. It also won't do anything if there isn't a player named "test".

#

You can use remoteExec to tell the server to do things, whether it's directly executing the command, or just running a script that contains the command.

low birch
#

And how about that?

if ( !isNil "A3UA_blacklisted_names" ) then {                    addMissionEventHandler [ "PlayerConnected",                         {                                                                   params [ "_id", "_uid", "_name", "_jip", "_owner", "_idstr" ];                                                         if ( _name in A3UA_blacklisted_names ) then 
                         hint format [ "Prohibited nickname %1!! Change your nickname and join again.", _name ];                                  serverCommand format [ "#kick %1",_name ];
                         diag_log format [ "Player %1 was kicked out of server. NickName %1 in Prohibited list.", _name ];
 };
 }];
 };

This script also doesn't kick the player but posted a diag message about player was kicked.

hallow mortar
#

Is that EH being added on the server? If it's only added on a client it won't work.
Have you tried using _idstr to kick? There could be something weird about the name that's breaking it.
Also try changing it to

serverCommand (format [ ... ])``` to ensure everything is done in the proper order.
low birch
#

Thanks, will try. This running only on a server side

low birch
#

No, doesn't works too...

warm swallow
#

@fair drum I don’t really know where to start. Like if I have a trigger set to activate when a player walks in, and for the script to know which player. I’ve also tried to do this with addAction, but don’t know what to do. :/ someone in the past told me to use _caller but that didn’t do anything

little raptor
#

Also try changing it to
serverCommand (format [ ... ])
they're both unary commands, and format executes first

little raptor
#

you should fetch it from addAction args

low birch
#

As I can see from logs and from the game - hint and serverCommand aren't works

warm swallow
little raptor
#

no. see the wiki

#
params ["_target", "_caller"];
warm swallow
#

I’ll take a look thank you 🙏

little raptor
#

in that order iirc

fair drum
#

He's particularly telling you look at what params does

#

I'm at work so I can't help until later.

warm swallow
#

Ok

#

@little raptor so in the sqf with the addaction I can use _caller if I define it in params of addaction?

little raptor
#

yes

warm swallow
#

Thanks!

flint topaz
#

Alright so I'm using this below to make peoples screens go black: ```sqf
titleText["","PLAIN",-1,true,true];

Note: I've only tested on my  own currently in player hosted MP
little raptor
#

how does this method know who's screen to make go black.
it affects whichever clients you execute this for

flint topaz
#

ohh so all clients run through the script if you do remoteExec

#

?

little raptor
#

wat?

meager epoch
#

Is it somehow possible to get rid of the bulleting/dots/whatever in hintC (alternative syntax)?

little raptor
#

maybe you should create your own GUI... meowsweats

meager epoch
#

thats way to much work for one hint

little raptor
#

actually it's very easy if you know what to do

#

instead of spending hours figuring out what to do when vanilla GUI doesn't behave

meager epoch
#

I've never done it so idk if ill know what to do

#

i'll give it a try i guess

#

Another question, can you have an advanced hint pop up in a scenario (not a campaign or whatever)?
If yes, where do I define it? The description.ext?

little raptor
#

what is an "advanced hint"? meowsweats

#

but I'm guessing the answer is yes

meager epoch
#

neat

hollow thistle
#

response to your question is included in the article you've linked.

little raptor
#

missionConfigFile is description.ext

meager epoch
#

yeah, i thought that's like a campaign thing or smth

#

just wanted to make sure

little raptor
meager epoch
#

i thought it means a hint for like the whole campaign or certain missions within it notlikemeow

willow hound
#

BIS_fnc_guiMessage is far superior to hintC.

modern ginkgo
#

How can i change position of chat by script?

meager epoch
#

why is the sound not playing? i play it via playSound, but nothing happens (btw, if it helps anything... the title shows up in triggers, though it cant be played from there as well)

class CfgSounds {
  sounds[] = {};
    
  class ss_paperTaking {
    name = "Taking Paper";
    sound[] = {"sounds\s_paper.ogg", 1, 1};
    titles[] = {};
  };
  class ss_laptopTyping {
    name = "Laptop Typing";
    sound[] = {"sounds\s_laptop.ogg", 1, 1};
    titles[] = {};
  };
};
#

also, the path is correct and so are the names and stuff

crude vigil
meager epoch
#

In the config or on my pc? meowsweats

#

Isnt the range 0-1 for the cfg?

cerulean cloak
#

What would the best way to detect when a player equips their binoculars? Is there an event handler I can use or would I need to use a loop checking the equiped weapon?
I've also got CBA running if that helps

meager epoch
crude vigil
# meager epoch i just set it to 10 in the cfg, nothing changed

Im just saying it cos there has been cases where people ask why it doesnt work and end up noticing their volume is too low. 😁 Also maybe because you didnt use something like db+10 etc, might be a reason why it is low, although I dont know if it causes it to be higher or lower as well.

meager epoch
#

the examples on the biki have no db and stuff, but ill give it a shot

crude vigil
#

You are saying you receive no error upon attempting to play the file, like "File not found" etc so only this case comes to my mind.

meager epoch
#

yeah, no error shows up

#

the title of the sound pops up in triggers

#

however playing it from there or via playSound does nothing

#

and the volume on my pc is set pretty high so i dont miss it by accident

#

i almost had a heart attack when i accidentally shot

crude vigil
#

yeah but arma settings is important too which was my point.
Apart from that, when you created the sound, are you sure you followed the requirements in creating the sound file?

cerulean cloak
#

Yeah

distant oyster
#

you could check if the key is pressed

meager epoch
#

but the path is correct

#

just to be sure, this is how u play a sound right
playSound "ss_laptop";

#

?

crude vigil
meager epoch
#

ss*

#

my bad

crude vigil
#

You need to use
ss_paperTaking or ss_laptopTyping

meager epoch
#

wait nvm im retarded

#

one sec

#

yeah, says NOID <no shape>

#

for playSound "ss_laptopTyping";

#

and the other one

crude vigil
#

When you created these sounds, did you follow the requirements indicated as in link?
#arma3_audio message

meager epoch
#

oh

#

i have no idea, prob not tho

#

didnt know those requirements exist

#

thanks, ill retry now

crude vigil
#

Although the return value shouldnt be affected by this

#

but I dont know what it is supposed to return in this case either.

meager epoch
crude vigil
#

If that doesnt solve, I can only suggest you to visit #arma3_audio unless there is something wrong in config, which I cannot really see(It wouldnt appear in trigger's sound list anyway if it had been wrong apart from file destination). And you are saying you do not receive file not found error (which should appear only on 1st attempt per mission, you are not missing it somehow by any chance, do you? meowsweats )

meager epoch
#

i dont think i am thonk

crude vigil
#

Did you try adding db+10 on it ? blobdoggoshruggoogly
Disclaimer: I cannot be held responsible for any sort of temporary or permanent ear damage or other sort of damages after test. meowtrash

meager epoch
#

ye, nothing

vast oxide
#

Could I have some help please

meager epoch
#

yes

vast oxide
#

Basically I’m trying to use unit capture to make a helicopter fly and I keep getting an error saying flying.sqf not found

crude vigil
vast oxide
#

It just says script flying.sqf not found

meager epoch
#

is ur path correct?

vast oxide
#

My path ?

meager epoch
#

ur path to the flying.sqf

vast oxide
#

Ye I’m pretty sure

meager epoch
#

how do u exec the flying.sqf

vast oxide
#

What should it be

meager epoch
#

you tell me meowsweats

vast oxide
#

Ye I’m pretty sure it’s right anyway

#

Any idea why it could not be working

crude vigil
meager epoch
#

yeah, i'll play with it

#

at the end of the day, ill just slap that to cfgMusic and be done with it blobdoggoshruggoogly

crude vigil
#

You would probably hit the same wall if that is the case.

meager epoch
#

i already have cfgmusic and its working

vast oxide
crude vigil
# vast oxide Do you know anything about my issue ?

It is not really welcomed to randomly ping people in here as people who knows anything will surely help you if they can.
No, I am afraid I have no idea how even unit capturing has any relation with a random flying.sqf file.

#

I just assume you use something non-vanilla and that is out of my bounds.

vast oxide
#

Ye

#

Alright thanks anyway

meager epoch
#

wdym non-vanilla

crude vigil
#

There is an advanced unit capture out there somewhere which people tend to use instead of vanilla unit capture.

meager epoch
#

oh, didnt know theres another way of doing that

crude vigil
#

Well, I would just write my own anyways if I ever needed such thing so yeah I never tend to look for such things either.

green idol
#

Hi everyone!

How can I add a Virtual Garage in a specific place (such a heli pad) by script? I'm trying to use BIS_fnc_garage but always spawn vehicles about me 😦

meager epoch
#

@crude vigil i defined them in cfgMusic and it now works blobdoggoshruggoogly

digital torrent
#

anyone know the issue with this piece of code?

        {

        _x addMagazineTurret ["8Rnd_82mm_Mo_guided", [0]];
        _x addMagazineTurret ["8Rnd_82mm_Mo_LG", [0]];
        _x addMagazineTurret ["8Rnd_82mm_Mo_LG", [0]];
        _x addWeaponTurret ["mortar_82mm",[0]];
    
        } forEach (entities "I_G_Mortar_01_F" select {_x weaponsturret [0] == []});

Error -> {_x weaponsturret [0] |#|== []}

distant oyster
vast oxide
#

Yes

distant oyster
#

can you paste the code that you are using?

bitter jewel
vast oxide
distant oyster
#

in the editor, the part with the execVM

vast oxide
#

Ok

digital torrent
bitter jewel
#

no

digital torrent
#

what is foo lol

bitter jewel
#

((entities "I_G_Mortar_01_F") select {_x weaponsturret [0] == []});

#

"metasyntatic variable" - regards, wikipedia

distant oyster
#

entities has higher precedence than select, so should be fine. try isEqualTo instead of ==

#

@digital torrent

vast oxide
distant oyster
vast oxide
#

I’ll try that

#

Nope still saying the same thing

#

Where is the sqf file supposed to be

distant oyster
#

next to your mission.sqm

digital torrent
boreal onyx
#

hello I have a problem on my server with the bags everyone can search them I would like to know if anyone has already had this problem?

little raptor
vast oxide
#

C:\Users\chbon\OneDrive\Documents\Arma 3\missions\UNIT%20CAPTURE%20TESTING.Altis

#

This is the route

distant oyster
#

yeah. if the mission.sqm is in that directory and your flying.sqf then execVM "flying.sqf" should work

vast oxide
#

No don’t know why it’s not working

#

Don’t understand why it is not finding it

distant oyster
#

you sure you have the right mission loaded in editor?

valid rock
distant oyster
#

can you run the following command and check the returns?

[fileExists "flying.sqf", fileExists "flying.sqf.txt"]
vast oxide
#

Where am I running that sorry ?

distant oyster
#

Debug Console

vast oxide
#

Where is that

#

Sorry I’m new to this coding stuff

distant oyster
distant oyster
vast oxide
#

😂

boreal onyx
bitter jewel
#

aaa

vast oxide
#

What do I press to get the result

#

Sorry about this mate I’m lacking in lots of knowledge

vast oxide
open fractal
# vast oxide What do I press to get the result

you get buttons to run it on local (your machine), server (the machine processing the mission), and global (everyone). If you're just testing on your computer by yourself local should do it

vast oxide
#

Ok thanks mate

open fractal
#

though if you're just checking if the file exists you would probably get a return no matter what

vast oxide
#

Well it’s says False false . I’m no genius but I’m pretty sure that means it’s not there

open fractal
#

yeah.

vast oxide
#

Or at least it’s not seeing it

open fractal
#

is it stored in the mission folder

vast oxide
#

Ye

open fractal
#

can you screenshot the contents of hte folder

vast oxide
#

2 seconds

#

how do i send it

fair drum
open fractal
#

oh you cant send a screenshot here

fresh wyvern
#

Hi, is there a way to get addMissionEventHandler "Map" to trigger when the map is closed instead of opened?

addMissionEventHandler ["Map", {
    params ["_mapIsOpened", "_mapIsForced"];
fair drum
valid rock
#

and paste the link here

fresh wyvern
fair drum
little raptor
vast oxide
#

Ye

vast oxide
#

I’m speaking to someone about it at the minute so I should be alright now thanks for all your help guys

warm swallow
# fair drum I'm home. figure it out?

I did for addaction but not for triggers? I’m basically trying to make a death area so if someone falls (I have ace) they will immediately die instead of getting knocked out

#

@fair drum

little raptor
valid rock
#

yes, as the variable for the helicopter

fair drum
#

oh you want to check if they go unconscious with ace first?

warm swallow
#

It’s multiplayer

#

So I can’t use player right?

fair drum
#

you can

warm swallow
#

Wait whaaaa

fair drum
#

because SERVER ONLY IS FALSE

#

so the trigger exists on every machine independently

little raptor
fair drum
#

well... evaluated independently

warm swallow
#

Ohhh

#

Also I figured out a checkpoint system that works in multiplayer it’s great

fair drum
#

so player exists on the machine, and the trigger is evaluated on said machine, so it will always grab the current player in that trigger area, independent of other players

warm swallow
#

I see

valid rock
warm swallow
#

@fair drum can I send you a dm of what I’m working on I think you’d like it

fair drum
#

i can check stuff if you want

fresh wyvern
fair drum
#

use the EH

warm swallow
#

What is the opposite of hideObject? If an object is already hidden and I try to unhide it?

fair drum
#

do you mean a getter?

warm swallow
fair drum
warm swallow
#

Ok

fresh wyvern
fair drum
fresh wyvern
#

Ah, I probably wrote it wrong. Thanx for the help 🙂

fair mountain
#

Hey friends, having an issue with cursorTarget and cursorObject, essentially when a player looks at an object it creates a moduled mission for all playable units. Both work locally testing in editor, but on the dedicated server won't trigger, I've tried revealing the targets also. I assume it's something to do with locality of the object and that of players, using autoinit on server so players are jip.

Any Ideas?

fair drum
#

post your code so far. sounds like a locality problem

fair mountain
#

Just using a trigger condition
cursorObject == Task_3F_Tower;

#

I can tell it's a locality issue just unsure how to resolve it I've never used "cursor" before

fair drum
#

is your trigger set to server only?

fair mountain
#

nah

fair drum
#

where is task_3f_tower defined. object attributes?

#

and also, let me see the activation code as well

fair mountain
#

Task_3F_Tower = (getPos this nearestObject 1715971);

#

game logic module

#

the activation is just the trigger condition, I assumed it would work locally for each client but only trigger once on the server

fair drum
#

is this tower something you placed down in the editor or something you spawned scripted in?

fair mountain
#

it's a map object by default, I just gave it a variable when making the mission

#

I do also have tasks that use units I have placed down with variables, same trigger condition different variables

fair drum
#

you should nearTerrainObjects if its an un-editable map terrain object. its hard to tell when I can't see your whole setup though. are you running a ton of mods in a way that would make it a pain to just send the mission to me?

#

also, on the dedicated server, can you verify that the object variable is being stored? both locally and on the server?

#

or is it returning objNull

crude vigil
fair drum
fair mountain
#

No real unit mods, just qol sound and movement mods, but the mission should open with just 3den enhanced
Not sure how to verify if it is being stored, I assumed if there was a problem it would show in rpt

fair drum
#

if its not dependent mods, send the whole mission file and ill take a look

cerulean cloak
#
this spawn {
    while {true} do {
            waituntil {(inputAction "defaultAction" > 0)&&(currentweapon _this == "Binocular")&&(cameraview == "GUNNER")};
            pphandle = ppEffectCreate ["ColorCorrections",1501];
            pphandle ppEffectEnable true;
            pphandle ppEffectAdjust [0.9,0.8,0,[0, 0, 0, 0],[1, 0.75, 1, 1], [0.299, 0.587, 0.114, 0],[-1, -1, 0, 0, 0, 0, 0]];
            pphandle ppEffectCommit 0;
            sleep 0.05;
            screenshot "";
            sleep 0.05;
            ppEffectDestroy pphandle;
    };
};

I've got this script and someone mentioned to me that it's very inefficient and it'd be better to do in a Framehandler. How would I go about doing that?

fair drum
#

a player? an AI?

dim coral
#

Good night, I'm starting this part of the script and I have a doubt that for you it will be silly, there is an animation in arma3 and I would like to put a shortcut key to use it, is it possible? thank you guys

cerulean cloak
fair drum
cerulean cloak
#

Yeah

fair drum
#

standby

fair drum
# cerulean cloak ```sqf this spawn { while {true} do { waituntil {(inputAction "d...

something like this:

private _function = {
    if (
        (inputAction "defaultAction" > 0)
        &&
        (currentWeapon player == "binocular")
        &&
        (cameraView == "GUNNER")
    ) then {
        private _pphandle = ppEffectCreate ["ColorCorrections",1501];
        _pphandle ppEffectEnable true;
        _pphandle ppEffectAdjust [0.9,0.8,0,[0, 0, 0, 0],[1, 0.75, 1, 1], [0.299, 0.587, 0.114, 0],[-1, -1, 0, 0, 0, 0, 0]];
        _pphandle ppEffectCommit 0;
        
        private _pic_destroy = {
            params ["_effect"];
            screenshot "";
            ppEffectDestroy _effect;
        };

        [_pic_destroy, _pphandle, 0.05] call CBA_fnc_waitAndExecute;
    };
};
BINOC_PIC = [_function, 0, []] call CBA_fnc_addPerFrameHandler
#

currently though, you have to be careful how long you hold the button down tho

#

as i have accidentally created a ton of screenshot in my docs folder haha

cerulean cloak
fair drum
#

put it in init.sqf

cerulean cloak
#

Takes a screenshot but the post processing isn't applied

#

When I was testing my old version I needed a wait after the screenshot before I disabled the post processing

fair drum
cerulean cloak
fair drum
#

ohhh

#

we sure that screenshots save PP?

cerulean cloak
#

Yup

warm hedge
#

inb4 you're capturing it with screenshot command?

fair drum
#

mk well let me stack another delay in there lol

cerulean cloak
warm hedge
#

Oh yeah, it's mentioned in the original post

dim coral
fair drum
#

i wonder. can you give an empty function to waitandexecute and just have the delay argument to stall? probably could

#

lets try it

cerulean cloak
#

I don't really know how CBA's stuff works

fair drum
#

let me get some food before the think tank

cerulean cloak
#

Seems like we should just be able to do waitfnc screenshot
and then waitfnc ppdestroy

fair drum
# cerulean cloak Seems like we should just be able to do waitfnc screenshot and then waitfnc ppde...

try this?

private _function = {
    if (
        (inputAction "defaultAction" > 0)
        &&
        (currentWeapon player == "binocular")
        &&
        (cameraView == "GUNNER")
    ) then {
        private _pphandle = ppEffectCreate ["ColorCorrections",1501];
        _pphandle ppEffectEnable true;
        _pphandle ppEffectAdjust [0.9,0.8,0,[0, 0, 0, 0],[1, 0.75, 1, 1], [0.299, 0.587, 0.114, 0],[-1, -1, 0, 0, 0, 0, 0]];
        _pphandle ppEffectCommit 0;

        [{screenshot ""}, nil, 0.05] call CBA_fnc_waitAndExecute;
        [{ppEffectDestroy _this}, _pphandle, 0.10] call CBA_fnc_waitAndExecute;
    };
};
BINOC_PIC = [_function, nil, nil] call CBA_fnc_addPerFrameHandler
cerulean cloak
#

No luck

#

Takes the screenshot but without pp

fair drum
#

it def seems iffy, its like 50% for me

#

i think our timing is way too fast cause i think the screen shot command is pretty slow

cerulean cloak
fair drum
#

I'd stick with keeping it scheduled for now with the loop

#

CBA is way better than vanilla eachFrame method though

#

and instead of using waituntil, just do loops. try not to use waituntils

cerulean cloak
#

I'll try turning the times way up and slowing bringing them back then

#
private _function = {
    if (
        (inputAction "defaultAction" > 0)
        &&
        (currentWeapon player == "binocular")
        &&
        (cameraView == "GUNNER")
    ) then {
        private _pphandle = ppEffectCreate ["ColorCorrections",1501];
        _pphandle ppEffectEnable true;
        _pphandle ppEffectAdjust [0.9,0.8,0,[0, 0, 0, 0],[1, 0.75, 1, 1], [0.299, 0.587, 0.114, 0],[-1, -1, 0, 0, 0, 0, 0]];
        _pphandle ppEffectCommit 0;

        [{screenshot ""}, nil, 5] call CBA_fnc_waitAndExecute;
        [{ppEffectDestroy _this}, _pphandle, 5] call CBA_fnc_waitAndExecute;
    };
};
BINOC_PIC = [_function, nil, nil] call CBA_fnc_addPerFrameHandler
#

I tried turning up the delay to 5s but it still wouldn't actually apply pp

#

It also did not wait 5s after taking the screenshot before the pp turned off

#

Nvm, seem to have it working now

#

It does like taking 2 screenshots though

#

@fair drum Thanks a bunch for all the help.

flint topaz
#

Anybody know why this: sqf systemChat (name (vehicle player));

#

It's replying the players name regardless of if they are in a vehicle or not

warm hedge
#

What are you expecting? A vehicle never has a human name

warm hedge
#

Yes?

#

More like I want the answer for the first part of my post

flint topaz
#

Well that line above is sending my players name not the name of the vehicle I am in

#

I'm expecting the vehicles name

warm hedge
#

That's not how. Use

getText (configFile >> "CfgVehicles" >> typeOf vehicle player >> "displayName")```
barren pewter
#

How to set a waypoint completion timer in script?

novel burrow
#

I am looking for help with writing a function that would querry the mass of all magazines in a plane and sum them up. It would then alters the plane's mass via setMass in a slow loop (ammunition is expended as a time goes). I guess I know what "fileConfig", "magazine", "getNumber" or "pushBack" do separately. I am lacking horribly to combine them together in one efficient function that does what I need it to do. Is here anyone willing to help with this?

pliant stream
#

how's the pay?

novel burrow
#

You can get A-1H flying more realistic, it's already released on SW for FREE and took me month to the shape it's currently at. I was hoped it's enough, no?

pliant stream
#

you might someone. software consulting isn't usually free though

winter rose
#

…this channel is for free Arma scripting assistance

novel burrow
#

Yes it does

#

I started with something like this and was wondering if it's the right direction:

_plane = _this select 0;

_magsArray = magazines _plane;
_wpnWeight = {getNumber (configFile >> "CfgMagazines" >> _x)} forEach _magsArray;
_total = 0;
_sumMass = {_total = _total + _x} forEach _wpnWeight;
winter rose
#

almost

#
_wpnWeight = {getNumber (configFile >> "CfgMagazines" >> _x)} forEach _magsArray;
// should be (IF the entry exists)
_wpnWeight = _magsArray apply { getNumber (configFile >> "CfgMagazines" >> _x >> "mass") };
#

but maybe vehicle ammo is not weighted, as there is no "storage" or endurance for vehicles

novel burrow
#

Hm, I just realized that pylons are probably connected with this command:

vehicle magazinesTurret [turretPath, includeEmpty]
#

OK, I refined the beginning of this script like this (made a change suggested by @winter rose too, thanks):

_plane = _this select 0;

_magsArray = _plane magazinesTurret [[-1],false];
_wpnWeight = _magsArray apply { getNumber (configFile >> "CfgMagazines" >> _x >> "mass") };
_total = 0;
_sumMass = {_total = _total + _x} forEach _wpnWeight;

How about that, now?

#

And, well, vehicle magazines are weighted. They have class "mass=xxx;" as it's checked against pylon's weight limits. It's a thing brought to us with Jets DLC's dynamic loadout, AFAIK.

novel burrow
#

OK, I checked in game, sitting in the plane loaded with weapons. I used this piece of code in console:

_plane = vehicle player; 
 
while {true} do 
{ 
 _magsArray = _plane magazinesTurret [[-1],false]; 
 _wpnWeight = _magsArray apply { getNumber (configFile >> "CfgMagazines" >> _x >> "mass") }; 
 _total = 0; 
 _sumMass = {_total = _total + _x} forEach _wpnWeight; 
 hint format ["WeaponMass, %1", _sumMass];  
};

Hint says "Weapon, <null>". Why?

winter rose
#

use _total, no?

novel burrow
#

Thanks, checking

#

It works now, thanks Lou!
Now the fun thing begins 🙂 How to check the fill of magazine that contains multiple munition, like Hydra pods that has 19 rockets and not all are shot at once? This function going to run in a slow loop, I don't need it to be fast or check the mass on every shot via EH. However, maybe it seems more feasible to use fire EH?

pliant stream
#

use the EH

#

track the total and subtract on fire

novel burrow
#

yeah, you are right. It might save some hastle indeed. I will try that, thanks.

wary python
#

Hello, I'm trying to automatically kick people with prohibited names, but when testing it nothing happens at all. Testing this on non dedicated server

addMissionEventHandler ["OnUserConnected", 
    {
        params ["_networkId", "_clientStateNumber", "_clientState"];
                _name = "BadWord";
        _userInfo = getUserInfo _networkID;
        if (_userInfo select 3 == _name) then 
        {
            serverCommand format ["#kick %1",_userInfo select 3];
        };
    }
];

I tried checking serverCommandExecutable but it returns false. Does serverCommand only work on dedicated server?

hint str serverCommandExecutable "kick"; 
still forum
#

serverCommand needs password

#

and uicontext if not running on server

wary python
still forum
#

eh.

#

The password variant is for dedicated server (not selfhosted), and doesn't need UI context
the passwordless variant you can run as logged in admin, but it needs UI context

winter rose
#

I wonder if a with uiNamespace would do 😀

still forum
#

no

winter rose
#

good, actually

wary python
#

Thanks!

tulip star
#

hello everyone, i am hosting game on ARGO(ARMA3 variant), can i bind a key for client player, eg F3 to Action Menu, so that if they don't need to bind the key themself, as Action menu is hidden by default in ARGO

I googled a bit, is this the right direction?
https://community.bistudio.com/wiki/Arma_3:_Modded_Keybinding

Thx so much.

tulip star
#

Action menu do exist it argo, but one needs to edit argoprofile file manually to bind to a key

umbral sentinel
#

I have a question, i want to disable the option to ”temporary zoom in” in the server, how do i do that?

pliant stream
#

holding right mouse?

fleet plaza
umbral sentinel
#

Yes

#

I want to remove that on my server

pliant stream
#

i suspect there is no good way to disable that

umbral sentinel
#

😦

fleet plaza
umbral sentinel
#

There is in ”veteran” difficulty you cant zoom in

#

But i have custom script

#

Where do i place that script?

fleet plaza
umbral sentinel
#

There is bunch of scripts haha

#

Is there veteran difficulty script?

fleet plaza
#

but idk how to use this lol

#

hint str difficulty; so this is how u get the difficulity

#

found it

#

check this

umbral sentinel
#

cant find the option to disable zoom in

hallow mortar
#

Does anyone have any intel on the locality of RopeAttach and RopeBreak event handlers? I'm guessing they fire where the object they're added to is local, but I'd rather that wasn't a guess

tender fossil
#

I asked some time ago but didn't get a reply, so asking again: is it correct that we don't have any working linters for SQF atm?

tender fossil
little raptor
#

do you want one?

#

or you want to make one? meowsweats

tender fossil
#

There's enough horror in coding SQF KEKW , so I definitely don't want to make one

#

I'd like to create something small (maybe), but I'd love to have a working linter for that

little raptor
#

I wanted to make one, but I neither know C# nor JS/TS so... meowsweats

pliant stream
#

are those the languages of linters?

tender fossil
#

Oh boy, if Arma supported C#... One can only wish 😄

little raptor
#

afaik it's only possible with those

tender fossil
#

Do you need both or just another one?

little raptor
#

I think VSCode extensions are mostly written in JS/TS (not sure which)

#

C# is possible too but you need another extension for that iirc

#

TS

tender fossil
little raptor
#

that's all I know meowsweats

proven charm
spark turret
#

what the correct way to take away a specific ammo from a plane? i want my CAS plane to only have rockets, no 30mm gun

little raptor
#

remove the weapon? meowsweats

spark turret
#

its a builtin spinal one

little raptor
spark turret
#

wait those work on vehicles too ? O.o

#

always assumed its only infantry inventory

proven charm
spark turret
#

uh im too dumb to spawn a cba target thats not just an empty vehicle.

#

if i use "createVehicle" it spawns an empty (yellow) target "vehicle", opposed to the editor blue-unit of the same type, if i use "createUnit" nothing spawns at all

little raptor
#

all vehicles are empty

spark turret
#

what crew do i use here?

little raptor
#

and createUnit is for infantry

#

CBA target is a tank (or maybe static weapon? thonk )

little raptor
spark turret
#

that makes sense, will try thanks

spark turret
#

hm the plane refuses to engage any of the ivisible targets, but atleast the hind attacks them

#

so a 50% win today 😛

dusky pier
#

Hello, is possible to modify ( code of ui event handlers on default arma inventory dialog )?

I mean - get code from event handler, which already exists?

low sierra
#

Crazy question? There is any way to draw lines in map and 3D screen in "bold" for better visualization? Sometimes the lines are really hard to see.

#

Just asking.

#

I tried that: draw many lines above each other with a small random offset. But this is super FPS heavy.

hallow mortar
#

If it's a straight line, you can use a long filled rectangle

low sierra
#

Thanks!

little raptor
sharp grotto
next vector
#

How difficult is it to script boats

little raptor
fair drum
#

we all float down here

next vector
barren pewter
#

I have made a script that gives a squad a random waypoint within a radius, but once they get there i want them to wait 3-5 min and then it gives the squad another random waypoint in the radius.

#

How would i script it to give them another one over and over infinitly?

manic sigil
#

Realized you asked for looping, and that kinda makes the other if !alive redundant, but w/e.

winter rose
fair drum
#

But what if it did? 🤔

manic sigil
#

Aw feck

#

Good thing thats redunant with the while do bool 💁‍♀️

willow oyster
#

how does one make a satchel charge attached to a zamak explode when someone gets in the zamak, i need to make a car bomb for non-IRA op reasons

#

it will be uh useful to have something like this

#

nvm

#

i found out that the blast radius can infact "destroy" the satchel charge

little raptor
#

If so, that's very easy. just look at waypoint commands, or doMove command

little raptor
little raptor
manic sigil
#

So it is; what I get for writing on a phone and not double checking >_<

#

Though, tbf, I make that mistake all the time even when I'm on the computer ._.

winter rose
pliant stream
#

imagine if bohemia had invented return

low sierra
#

Can i use that```sqf
#include "\a3\ui_f\hpp\definecommongrids.inc";

pliant stream
#

i suspect no. A3 has no command to preprocess strings either does it?

#

also get that semicolon out of there

low sierra
#

I get this in RPT 5:54:39 Error in expression <#include "\a3\ui_f\hpp\definecommongrids> 5:54:39 Error position: <#include "\a3\ui_f\hpp\definecommongrids> 5:54:39 Error Invalid Number in Expression

pliant stream
#

yeah, that's not valid SQF

low sierra
#

Thanks!

little raptor
#

but in the end I guess it wasn't seen as worth it

pliant stream
#

yes, but imagine if the original author of SQF had invented return, or even better the concept of using an existing script language

winter rose
#

like F#

little raptor
#

or F***

#

I call it F-triplerisk blobcloseenjoy

winter rose
#

I heard good things from Beef apparently, I should ask my ex-colleague again about it

little raptor
#

well I guess that's a new record
never thought I'd see anything worse than python 😅

pliant stream
#

you haven't met perl i suppose?

little raptor
#

no meowsweats

tender fossil
next vector
little raptor
manic sigil
next vector
#

Adding boats to game

little raptor
#

if you mean you want to create a new boat model

next vector
winter rose
manic sigil
#

I imagine itd start with a working model, then inheriting the configs for an existing boat and tweaking to fit, yeah?

pliant stream
#

can you control an AI's use of NVG?

little raptor
pliant stream
#

force them to use NVG during the day?

manic sigil
#

... why?

pliant stream
#

just curious

little raptor
pliant stream
#

what can you control?

little raptor
#

you can make them take it off at night

pliant stream
#

i see. fair enough

little raptor
#

I haven't actually tested it during the day tho

#

might be possible

little raptor
proven charm
#

can you select the default respawn position (option) for the respawn menu?

plush nova
#

Is there a way to run unscheduled code from a scheduled context?

plush nova
#

oh

#

that's very exciting

#

thanks

pliant stream
#

you know what's even better than an unscheduled section in a scheduled context? not entering a scheduled context at all 🙂

winter rose
#

this man is on a preaching mission 👀

pliant stream
#

scheduled is just a disaster

#
// scheduled
if (!isNull _object) then
{
};

do you know what this condition asks?

winter rose
#

absolutely no idea

pliant stream
#

it asks

was _object recently not null?

winter rose
#

it asks "is it right now not null"

#

just that this can change next line 😄

pliant stream
#

right. there is no observable difference

hollow thistle
#

And this is completly fine for most, basic mission making needs.

pliant stream
#

it's fine if you don't really care, yeah

#

it's sloppy though

#

sloppy design to make it so easy to create such incorrect code

hollow thistle
#

What's the alternative? Having only unscheduled and having mission makers murder performance as most of them are not programmers?

austere tusk
#

I probably killed the performance and I'm not a programmer and I´m not speak english, but would appreciate very much help to understand, where am i going wrong?
if (!alive obj1) then {["task1","SUCCEEDED"] call BIS_fnc_taskSetState}

winter rose
austere tusk
#

I created a sqf to "complete" tasks

#

okay... back to triggers in eden. thanks

hallow mortar
#

Can hashmap values contain other hashmaps?

digital rover
#

Unscheduled for mods, scheduled for missions

winter rose
digital rover
#

90% of my missions have a while {true} which is fine in the context of a mission

winter rose
manic sigil
#

Everything is {true}, isNil _permitted

leaden haven
#

Is this a fine way to call a function or is there a more elegant way?

_this call (missionNamespace getVariable 'KER_fnc_waypoints');

I am calling about 3 - 4 in initPlayerLocal.sqf

plush nova
#

I assume that mission event handlers don't at least, otherwise eachframe wouldn't work

plush nova
#

oh okay

#

that's actually not so bad

#

surprised that the init<blah> scripts are scheduled but basically "avoid spawn" seems to be the only thing

steel fox
#

yep

steel fox
manic sigil
#

welp I have a knack for hilariously cursed code apparently.

#

I was trying to set up a little dungeons and dragons table for a side room as a goof, and was toying with how to get the minifigs to stay mini.

Forgot what 'each frame' really means.

addmissioneventhandler ["EachFrame",{cursorobject setObjectScale .03;}];
fleet stirrup
steel fox
#

yeah, ik. Did I really sound that unsure? meowsweats

frail vault
#

i wanted to ask if there a way to make it so that
if (item in inventory)
allow action
kind of commands?

warm hedge
torpid quartz
#

Hey so i'm just doing some standard stuff with the spawn ai module and this seems to be the way to go and I've got it working.
https://forums.bohemia.net/forums/topic/221101-how-to-set-factions-for-the-bis-spawn-ai-module/?do=findComment&comment=3332303

However the way this is done makes me think maybe I could customize the units spawned instead of just picking from vanilla ones.
Like how CfgRespawnInventory works (https://community.bistudio.com/wiki/Description.ext).
on the wiki it has an example of referencing either an existing unit or making a loadout yourself.

So is it possible to instead of using vehicle I could replace that with some sort of loadout code? or still call the vehicle but then override it's loadout?

class unit0 {
                        vehicle = "rhsusf_army_ocp_squadleader";    //Class name of unit/vehicle
                        side = 1;                                   //index of unit side being [ east, west, independent, civilian ]
                        rank = "SERGEANT";                          //rank name from CfgRanks
                        position[] = { 0, 0, 0 };                   //offset position unit spawns from spawn point
                    };
frail vault
#
if([player, "UMI_Land_Portable_HDD_F"] call BIS_fnc_hasItem) then {
call{[data_1, "blue", "orange", "red"] call BIS_fnc_DataTerminalColor; 
 
[[this, ["Activate Terminal", "terminal\terminalOpen.sqf"]], "addAction", true] call BIS_fnc_MP;} 
} else {
};```
I was playing around with it, but I am sort stuck here
the Activate Terminal works when not used this way, when I tried to see if the item was correct, it was using a simple hint "works" trigger, now I just need it all together in a data terminal
any help?
still forum
still forum
still forum
pliant stream
still forum
#

Ah I read your message as inverse

leaden haven
#

Why can you not name an object "commander"?

distant egret
still forum
#

All your variables should have a unique prefix, otherwise your scripts may break at any time

little raptor
winter rose
#
  1. why an empty else
little raptor
#
  1. use ```sqf for syntax highlighting
frail vault
frail vault
frail vault
# little raptor 1. where are you running that? 2. don't use `BIS_fnc_MP` 3. why do you wrap that...
  1. data Terminal Init, because i wanted it for it to be
    Player Approaches Data terminal, if they have x object, they can interact with the data terminal.
    After they activate it, after a minute passes, it makes a noise and closes itself

  2. BIS_fnc_MP bad, got it, any reason as to why if i may ask?

  3. i am pretty sure there are easier ways to set the data terminal up, but I did the best I could do with my limited knowledge so its probably 80% jank

little raptor
#
  1. BIS_fnc_MP bad, got it, any reason as to why if i may ask?
    use remoteExec
#

BIS_fnc_MP is probably a wrapper for remoteExec rn, but there's no point in using it anymore

#

it's just there for backward compat

#

also if you're putting that in object init (or any other init field in Eden), there's no need for remoteExec at all

#

you'd be duplicating the action for everyone if you do that

frail vault
#
data_1, "blue", "orange", "red"] call BIS_fnc_DataTerminalColor; 
 
data_1 addAction ["Activate Terminal", "terminal\terminalOpen.sqf"];

works fine, but I am still not sure how i could make it so that it will only allow someone to interact with it if they have a certain item

worn elm
#

trying to use "soldierOne action ["Eject", vehicle soldierOne];" pulled frim here https://community.bistudio.com/wiki/Arma_3:_Actions#Ejectfrom but can't seem to get it working.

Players will walk into C130, I've set a trigger to set them as unconscious which is fine but I want to then kick them out at a given trigger have their parachute open. Any help appreciated.

winter rose
frail vault
winter rose
#

you don't "just place the code", see the doc

frail vault
# winter rose you don't "just place the code", see the doc
[data_1, "blue", "orange", "red"] call BIS_fnc_DataTerminalColor; 
 
data_1 addAction ["Activate Terminal", "terminal\terminalOpen.sqf", nill, 1.5, true, true, "", {[player, "UMI_Land_Portable_HDD_F"] call BIS_fnc_hasItem}, 50, false, "", ""];

am i missing anything?

winter rose
frail vault
#

ah!

winter rose
#

and you can drop the rest of the arguments after that - though you might want to set the action radius to something smaller than 50…?

frail vault
#

oh i am just testing it, to see if it works xD
I just took example 5, put everything in it to see if it works

frail vault
brave jungle
torpid mica
#

I know it´s of topic but i need some help. I´m trying to make a small script that changes the Weapon firing mode from a players weapon. therefore I want to use: player selectWeapon ["arifle_MX_GL_ACO_F", "arifle_MX_GL_ACO_F", "FullAuto"]; -> this is whats on BI wiki (https://community.bistudio.com/wiki/selectWeapon). But as soon as i try to use it I get an error that the function expects a string instead of an Array. Even if I copy the Bi example that error occurs.

Does someone know why i always get that error or even could help my how to solve that problem?

torpid mica
#

found that some minutes ago as well. that explains the error but is the a workarround besides the one from Killzone_Kid

torpid mica
#

got in the dev branche and found out that the feature i was going for with my code is natively supported with 2.07 so it´s not really relevant anymore, unless there are still bugs with reloading

#

thanks anyway for your help 🙂

hallow mortar
#

I have a hashmap where some of the values might contain the same data for multiple keys. Is there any way to reduce data duplication by having multiple keys refer to the same value, or having values redirect to another value?
An ideal example might be if a key consisting of an array ["key1","key2"] would be returned by both get "key1" and get "key2"

hallow mortar
#

That's unfortunate

little raptor
#

yes? thonk

little raptor
little raptor
#

do you want to map multiple keys to one data?

winter rose
#

unless I misunderstood

any way to reduce data duplication
having values redirect to another value
that's not possible (but for array data as they are pointers)

little raptor
hallow mortar
little raptor
#

different get inputs can return the same value
without me having to have a bunch of values that are identical but have different keys
you're confusing me thonk
those two are mutually exclusive

winter rose
#

key1 →
key2 → value
key3 →

little raptor
#

that's possible

hallow mortar
#

Like how switch cases can have multiple cases result in the same selection without duplicating stuff

#

If that's possible, I would love to know how

little raptor
fair drum
#

i think you might just need to reorganize the hashmap. there is probably a better way to structure it to get what you want so that it never contained duplicates in the first place

pliant stream
#

you want a: map<K, int> and b: array<V> and then b[a[k]]

little raptor
hallow mortar
#

My hashmap contains properties related to types of vehicles. Like this:

    [toLower "US85_M923c", // Main key
        (createHashmapFromArray [ // Value is another hashmap but that's not important here
            ["effectiveTowMass",5000],
            ["limitTowMass",10000],
            ["towHook",[0,-3.3,-1.2]],
            ["towPointFront1",[-0.4,4.4,-0.8]],
            ["towPointFront2",[0.42,4.4,-0.8]],
            ["towPointRear1",[0,-3.3,-1.2]],
            ["towPointRear2",[0,-3.3,-1.2]],
            ["typeLockOverride",false]
        ])
    ],```
As you can see, the key is the classname of the vehicle. These properties can be the same for several different classes of vehicle, e.g. they would be the same for both the Mediterranean and Pacific variants of a NATO vehicle, but I would still need to look them up by the classname. So I could simply have an element for every classname, and accept that many of them are going to contain the same value, but it would be more convenient if I could have e.g. `"US85_M923c"` and `"US85_M923o"` return the same value without that duplication.
little raptor
#

hashmaps are references

#
_hm = createHashmap;
_keyVal1 = ["key1", _hm];
_keyVal2 = ["key2", _hm];

_hm2 = createHashmapFromArray [_keyVal1, _keyVal2];
#
(_hm2 get "key1") set ["blabla", -1];
(_hm2 get "key2") get "blabla"; //gives -1
#

basically every value in SQF is a reference

hallow mortar
#

I mean, I am currently duplicating things, because at the moment I have 2 entries next to each other that both look like the example, except one has "US85_m923c" as the key and the other has "US85_M923o". So there is duplication in the file and that's what I'm talking about.
It seems like the solution might be to reorganise when the values are created. That might have implications for how easy it is to expand the hashmap (ideally, very easy) but I'll have to think about it.

little raptor
little raptor
#

and use it by multiple keys

#

so yeah, you need to organize your data

hallow mortar
#

Yes, that seems to be the solution to the duplication problem. The trouble is that it raises a user-friendliness problem. Ideally, an entry could be added to this hashmap by only adding the entry itself (a single block as in the example). Reorganising would mean you have to create the entry in one place (in the file), then go and put it into the hashmap in a separate place. I suppose solving the duplication outweighs that, but it is annoying in a different way.

little raptor
#

no, not necessarily

#
_hm = createHashmap;
_keyVal1 = ["key1", _hm];
_hm2 = createHashmapFromArray [_keyVal1];
_hm2 set ["key2", _hm2 get "key1"]; //reference to hm in key1
#

same result as before

#
(_hm2 get "key1") set ["blabla", -1];
(_hm2 get "key2") get "blabla"; //gives -1
hallow mortar
#

Okay, I think I got it figured out. Have to make sure nothing gets added to the hashmap before the value it's supposed to inherit from, but hopefully a big warning comment will prevent that

proven charm
#

is there no default respawn position select command?

little raptor
#

respawn positions are handled by functions, not commands

proven charm
copper raven
dusk gust
proven charm
#

yes

copper raven
proven charm
#

Ok I will search from there

torpid mica
#
_allplayers = allPlayers apply {[_x distance2D position thisTrigger,_x]};
_allplayers sort true;
hint format ['%1',_allplayers];
#

i have a problem with this code giving "scalar" instead of the distance. can somebody tell my whats wrong?

copper raven
#

thisTrigger is undefined i guess

keen folio
#

i need some help with some coding if anyone could lend me a hand

#

ive coded these doors i bult to open but when i put it on my server it wont open

#

i understand that i might have coded it to client and not server but i dont know how to do such

torpid mica
keen folio
#

call{this addAction ["Open Vehicle Doors", {trg419 = true; trg3 = true; gate1 hideObjectGlobal true; gate2 hideObjectGlobal true; gate3 hideObjectGlobal true; gate4 hideObjectGlobal true; gate5 hideObjectGlobal true; gate6 hideObjectGlobal true; gate7 hideObjectGlobal true; gate8 hideObjectGlobal true; gate9 hideObjectGlobal true; gate10 hideObjectGlobal true; gate11 hideObjectGlobal true; gate12 hideObjectGlobal true;}, [], 6, false, false, "", "", 6];};

call{this addAction ["Close Vehicle Doors", {trg4 = true; gate1 hideObjectGlobal false; gate2 hideObjectGlobal false; gate3 hideObjectGlobal false; gate4 hideObjectGlobal false; gate5 hideObjectGlobal false; gate6 hideObjectGlobal false; gate7 hideObjectGlobal false; gate8 hideObjectGlobal false; gate9 hideObjectGlobal false; gate10 hideObjectGlobal false; gate11 hideObjectGlobal false; gate12 hideObjectGlobal false;}, [], 6, false, false, "", "", 6];};

#

This is my code

#

That works in eden but not when I put it on my server

willow hound
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
willow hound
keen folio
#

Do what

willow hound
willow hound
torpid mica
torpid mica
steel fox
little raptor
little raptor
#

you need scalar

torpid mica
#

no but it wont sort by that number

little raptor
#

it does

torpid mica
#

and it shoub be a number uder 1000

little raptor
steel fox
#

thisTrigger is defined in the Condition field of a trigger

little raptor
#

I know

fiery gull
#

is there a way to set the texture of a 3d UI item (for instance a hatchback rendered as model on the UI)?

torpid mica
#

yeah but how 😦 this code all runs in an trigger and if i try to getPos or position it always returns an empty array

steel fox
#

I ran your exact code in the onCondition of a trigger and it works soooo

little raptor
#

or do you mean the code?

steel fox
#

I geuss the hint shows an empty array?

torpid mica
#

yeah

little raptor
#

where do you run that code?

torpid mica
#

i´m going to post the full code

#

the whole code can not be send.... don´t know why and i´m not able to upload the whole scrip could send via dm

steel fox