#arma3_scripting

1 messages Β· Page 589 of 1

winter rose
#

I am afraid I don't have experience about muzzles
don't worry, I would have answered if I knew

lone zenith
#

😦

#

I just don't get it- it makes no sense, why is there no way to fetch the value?

winter rose
#
currentMuzzle; // this command
private _muzzles = getArray (configFile >> "cfgWeapons" >> _type >> "muzzles");

and Fired, FiredMan, FiredNear, Reloaded Event Handlers

That's all I know @lone zenith

lone zenith
#

Hmmm right... Perhaps you could help in a more general sense- I'm trying to throw a grenade irregardless of current animation- the action UseWeapon does the trick the most reliably. Any other suggestions?

#

forceWeaponFire doesn't work as far as I remember

winter rose
#

if you want regardless of the current animation, you can use switchMove "" before doing the throw
@lone zenith

lone zenith
#

Ah no but I want to mix the throw gesture with the anim

#

I'll check out the useMagazine, but I think I tried that one

slow pollen
#

Heya i want to use the Gunbag from ace but it seems i cannot put the sniper i use in there is there any way i can use a script or anything to 'increase' the space in the gunbag

still forum
#

gunbag has no space or weight limit

#

seems like machine guns cant fit into gunbag though

modern adder
#

Oh, by the way

#

Would it be more efficient to pass in instigator from a hit eventhandler, or just run findneareastenemy on the player?

#

Because that duplicate code was there for that reason

still forum
#

i guess instigator can be null/nil

modern adder
#

how? if they crash into something?

still forum
#

findNearestEnemy doesn't really mean that that enemy also hit the player

winter rose
#

if you damage yourself e.g from a height

modern adder
#

Hmm

#

I do see that actually a lot of that code wasn't needed, even if I keep it as it was

#

But generally, would it hurt to run findNearestEnemy even if I already have instigator?

winter rose
#

Q: do you want to know who fired at the unit?
A:

  • yes: use the Hit/Killed EHs
  • no: yaba-daba-doo
modern adder
#

Okay

#

Thank you

winter rose
#

a nearest enemy behind a wall wouldn't hurt you πŸ˜‰

modern adder
#

But they may also not be aware of your presence

winter rose
#

(a marksman 800m away with line of sight, yes)

modern adder
#

Mmm

winter rose
#

what do you want, the closest enemy or who shot you?

modern adder
#

Doesn't matter, I think I've got it now

winter rose
#

oookido!

still forum
#

But generally, would it hurt to run findNearestEnemy even if I already have instigator?
Would it hurt to run code that you don't need at all? yes. Thats just a waste of cpu time

modern adder
#

Ok, that's more sort of the answer I wanted

#

Although I wasn't very clear

#

But thank you

narrow pollen
#

If I want to complete 'fadeMusic' before starting another track, do I need 'sleep'?

winter rose
#

yes

narrow pollen
#

That sleep would be the same timeout as the time param in fadeMusic then?

winter rose
#
0 fadeMusic 0;
5 fadeMusic 1;
playMusic "mySong";
sleep (_songDuration - 5);
5 fadeMusic 0;
sleep 5;
5 fadeMusic 1;
playMusic "otherSong";
// etc
#

@narrow pollen ↑

narrow pollen
#

Thanks for your answer, however I am not sure how to use the Jukebox function

#

Does it fade music automatically or?

winter rose
#

I think so yes

narrow pollen
#

Also, I currently have states defined for the vanilla tracks in config.cpp>CfgMusic>class vanillatrackname>statesarray[] = {example, example2}.
How would I go about retrieving all tracks that contain a certain state, and letting Jukebox randomly select a track out of that list/array?

#

I am not sure how to access the info inside a class (CfgMusic) inside another class(trackname), in config.cpp

vague geode
#

Is it possible to use the High Command module in a way to enable a player to assume command mid mission and release it (also mid mission) aswell if they don't feel like commanding anymore making it possible for another player to assume command?

winter rose
#

@narrow pollen configFile >> "CfgMusic" >> etc

narrow pollen
#

Would there be any conflicts by me using the vanilla track classnames and defining their state?

#

In cfgmusic inside a mod's config.cpp

#

Since that classname would already be defined in Arma itself?

winter rose
#

that's mod overriding, I think that would be fine but don't take my word - ask in #arma3_config to be sure

vapid wadi
#

Hi, I was wondering if there was a way to execute code on a schedule that isn't in-game uptime or anything of the sort, more like real-time a week or so in-between? I have made a "election" script of sorts, and we were planning on doing one once a month. Would this be possible with the help of a dll like real time?

winter rose
#
uiSleep 7 * 24 * 60 * 60;
```πŸ˜„
#

but with an extension yes, you can do everything you want

vapid wadi
#

That would be quite a long server uptime haha. Alright ill look into KK's blog with real_date

still forum
#

like real-time a week or so in-between
Arma server won't be up for a week πŸ™ƒ

spiral fractal
#

in editor, I set this DBG = []; in Attributes > General > Init.
and add this code to B_Heli_Transport_03_F Init:

this addEventHandler ["HandleDamage", {
  params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
  systemChat (format["HD: %1", str _this]);
  DBG pushBack (format["HD: %1", str _this]);
}];

when I try to lift off my heli explodes πŸ˜„ why/how is it happens?

#

it seems that it has something to do with str command

winter rose
#

I don't think that's the issue
if you remove this DBG code, your helicopter would explode anyway

spiral fractal
#

why?

winter rose
#

your issue is either that pushBack doesn't return anything where "HandleDamage" might need a value, or is something completely unrelated

still forum
#

wrong-ish.

#

pushBack returns index of inserted element..

#

if handledamage returns 1 or more, helicopter boom

winter rose
#

aaah, I mixed it with append

still forum
#

more than one element in the array, insta boom

winter rose
#

yep πŸ˜„

spiral fractal
#

oh, but I thought EH should only respond to events not create new ones (unless I explicitly tell it to)

winter rose
#

just add _damage; as the last line of the EH

#

and EH trigger on events, they don't create one - indeed

spiral fractal
winter rose
#

it's in the name\β„’

#

@spiral fractal working nao?

spiral fractal
#

ah I think I am starting to understand... so when heli get any hit it will call this event before it gets any damage and this event will set the damage it should receive according to the parameters?

winter rose
#

selection damage and yes πŸ™‚

spiral fractal
#

and when I dont register it, it has default event?

winter rose
#
player addEventHandler ["HandleDamage", { 0 }]; // invincible
player addEventHandler ["HandleDamage", { 1 }]; // Mr Glass
#

if nothing set, the game has the default damage system yes

#

this EH happens before the normal damage is applied

simple notch
#

What do I need to know to make my own framework?

winter rose
#

SQF

warm hedge
#

And anything

simple notch
#

How long does this usually take for beginners?

spiral fractal
#

I understand, Thank you!

simple notch
#

from start to finish

spiral fractal
#

beginner should use existing framework not build one

winter rose
#

How long does this usually take for beginners?
a framework that does nothing, 00h00m00s
a framework that does everything, +infinity

a framework that does ?, ? time

simple notch
#

Okay maybe I should be more specific

winter rose
#

maybe yes πŸ˜ƒ

simple notch
#

lol, not really sure to specify what im asking

#

but any tips where I can go to learn sqf?

winter rose
#

sure thing

simple notch
#

I usually just learn langauages with trial and error

winter rose
#

See the pinned messages πŸ˜‰

#

(first link has plenty of other links, etc)

simple notch
#

kk thanks

modern adder
#

Does owner work on a client machine?

winter rose
#

@modern adder wiki πŸ‘€

spiral fractal
#

clientOwner

modern adder
#

So that's a no

modern adder
#

Okay, is there any other way of executing a function on everyone in the group without executing it on the local machine?

#

Already have, just wanted to check

winter rose
#

Already have, just wanted to check
the green sE means Server Exec, that's it ^^"

is there any other way of executing a function on everyone in the group without executing it on the local machine?
remoteExec?

modern adder
#

Yes, I'm already doing that

#

But I'm doing it for everyone in the group

winter rose
#

yeah…?

modern adder
#

I need to exclude the local machine

winter rose
#

is the local machine in the group?

modern adder
#

Yes

winter rose
#

remoteExec with (units _group - [player]) then

modern adder
#

Oh, thank you

#

Wow it's really that simple lol

winter rose
#

sometimes… your worst enemy is your own brain yes πŸ˜„

modern adder
#

Well, I wouldn't have come up with that tbh, still learning sqf πŸ˜›

mortal crypt
#

Is there any way to find the size of a gameLogic? For example I placed a "ModuleSector_F" with a size of [30,30,0] and need the size in script.

winter rose
#

aaand Google brought me the answer:

sectorModuleVar getVariable ["objectArea", [50, 50]];
``` @mortal crypt πŸ‘€
exotic flax
#

setVariable instead? πŸ˜‰

mortal crypt
#

Thank you!

winter rose
#

@celest plume edit your message to either use sqf tags, or post in sqfbin and link here, thanks

celest plume
#

Apologies. Thank you! I will figure out how to do that.

winter rose
#

np - a pinned message explains how to (the sqf tags)

celest plume
#

OK, I have a simple problem, but it has been wrecking my head for days. I am using SQF and I am trying to make a multiplayer sandbox-type thing and I need a faction-system.

What I am trying to do is grab some sort of identification from the object controlled by the player that I can add to a serverside array. I am have tried this:

//This is in the InitServer

[Swagger,["Join Swagger","FactionJoiners\SwaggerJoin.sqf",[],5,true,true,"","true",3,false,"",""]] remoteExec ["addAction", 0, true];

// And that calls this script

params ["_target", "_caller", "_actionId", "_arguments"];
    _objNetId = _caller call BIS_fnc_netId; // "0:2"
    _obj = _objNetID call BIS_fnc_objectFromNetId;
    _Owner = str (owner _Caller); 

if ((side _caller == WEST) && !(_Owner in InFaction)) then {
    swaggerfolk pushback _Owner;  //Adds the player to the Swaggerfolk variable
    InFaction = InFaction pushBack _Owner; //Adds the player to the InFaction Variable

    publicVariableServer "SwaggerFolk"; //Sends the information to the server
    publicVariableServer "InFaction"; // Ditto

    private _message = "";
    _message = format ["Welcome to Swaggers folk!"];              
    _recipient = allPlayers select {(alive _x) && !(_x getvariable ["FW_DEAD",false]) && ((_x distance _target) <= 10)};
    {                      
    _message remoteExec ["systemChat", _x];                  
    } foreach _recipient;
  };
#

I have tried calling BIS_fnc_netId on _caller, and call BIS_fnc_objectFromNetId on the NetID, but neither of them will get pushed into the Swaggerfolk Array or the InFaction (defined in the Taskmanager). Is there any way I can modify this script to get me the information I need? The Arrays (Swaggerfolk and InFaction) will need to be called upon and checked in other remotely executed addAction/remoteexec scripts.

I can put it this way, none of the information gets transferred the serverside array. It works perfectly fine in singleplayer (of course), but that is an entirely different story of course.

Quick explanation: I need to grab some information from the _caller that remains persistent and can be checked again, in a later script.

simple notch
#

I've been scrolling through snippets of the nopixel framework trying to understand it.

#

Can anyone help me understand what this means in detail?

#

_item = _this select 1;

#

I don't understand"_this select 1"

#

Im assuming _item is a variable

narrow pollen
#

_this usually contains variables (parameters) passed from

#

a function

fossil coyote
#

@patent estuary _obj allowDamage false;//Damage disabled ---------- So, whereabouts is this meant to belong and how do i get to affect objects on my map. Not a fan of scripting so knowledge is limited

simple notch
#

can you elaborate on that @narrow pollen

#

if you can

patent estuary
#

put it in their initialisation field this allowDamage false;
if you plan on editing missions then you will need to learn how to script, there is no easy way around that πŸ˜‰

narrow pollen
#

@simple notch Using https://community.bistudio.com/wiki/call
to call a function with arguments (params) would pass them into the _this magic variable for said function. Then you can retrieve the passed arguments by using _variable = _this select 0 for the first argument passed, 1 for the second, ..

fossil coyote
#

My issue is that certain objects on my terrain builder map - My own terrain with objects on - Has objects that do a 90 degree flip that are part of the map, not placed via 3DEN when a player or something hits it/collides with it.

#

Is there any way to prevent that happening

winter rose
#
[1, 2, 3] call {
  _this; // equals [1, 2, 3]
  _this select 0; // 1
  _this select 1; // 2
  _this select 2; // 3
};
``` @simple notch 
see also: https://community.bistudio.com/wiki/select
patent estuary
#

if they are vanilla BI objects then no you cant, if they are your own objects put damage = no in the named properties of the geometry lod. - this is for baking into a terrain.

fossil coyote
#

They are indeed vanilla objects

#

Not the smartest idea to make objects flip themselves 90 degrees in the air when damaged by default

#

But whatever

#

Thanks Uro

patent estuary
#

np

narrow pollen
#

When passing arguments with 'call' to call a function, do I need to define the params with params [] inside my function?

#

Or can I just select them from the _this variable either way

winter rose
#

ideally

#

_this select x is so Arma 2…

#

also, params privates your variables @narrow pollen

narrow pollen
#
    private _ximgroup = _this select 0;
    private _ximcombat = _this select 1;```
winter rose
#

remove the last two lines

narrow pollen
#

That's what I wanted to ask

simple notch
#

Thats confusing lol

narrow pollen
#

How do I use the params in my function then?

#

by their name defined in params?

winter rose
#

yes

#

params does a private _name = value

narrow pollen
#

So simply if (_ximcombat) {}; is correct, yeah that should be good

#

It's basically a quick tool to get rid of the old _this select stuff?

cunning crown
#
  • you have type checking and default values
winter rose
#

yep,
and to check variables as Heyoxe said (advanced syntax),
and to auto-private vars

#

don't forget then

#

if (x) then { y };

narrow pollen
#

yeah I just typed that quickly, my bad

#

In my code it's right πŸ˜„

winter rose
#

this channel is sensitive to SQF errors :p

spiral fractal
#

then is the worst, I forget it all the time 😐

narrow pollen
#

yeah isn't it a bit redundant, or is there a reason it exists?

winter rose
#

the worst thing is I tend to write it while coding at work πŸ˜„

spiral fractal
#

πŸ˜„

winter rose
#

the reason is SQF

#

operators-based

narrow pollen
#

gotcha

winter rose
#

if (something) = IF TYPE
then = operator, IF TYPE then CODE

narrow pollen
#

alright

still forum
#

&& = operator condition && CODE
something && {}

πŸ˜„

spiral fractal
#

every other language works without it somehow...

simple notch
#

I love how there is close to nothing about SQF learning online lol

#

becides bistudio

cunning crown
#

Because the wiki has everything that you need πŸ™‚

simple notch
#

Maybe im missing something then

spiral fractal
#

do you know programming? any other langauge?

simple notch
#

Very minor c++ and I did like 2 years of java in high school

winter rose
#

I love how there is close to nothing about SQF learning online lol

SQF was made by Bohemia Interactive for Bohemia Interactive, so there is that yeah πŸ™‚

cunning crown
#

SQF was made by Bohemia Interactive for Bohemia Interactive
That sounds like an ad πŸ˜„

narrow pollen
#

I come from mainly php and it's okay for me, just learning how the engine works but the basic 'code workflow' is there

simple notch
#

Shoot feels like a whole new world to me lol

#

xd

#

Yeah it's just understanding what does what is difficult for me

#

I've been scrolling through the wiki reading everything about it and i feel like ive made 0 progress lol

narrow pollen
#

Don't read

#

Write

spiral fractal
#

learn from source code

winter rose
#

gain through pain! ✊

simple notch
#

Well, I found the nopixel framework on github and ive just been analyzing the code from it

cunning crown
#

Do not start with that kind of thing. Look at more basic things, try to do a simple mission that includes some sqf, etc.

narrow pollen
#

configProperties [configFile >> "CfgMusic" >> "intense"]; Does this return an array with the classnames that have "intense" in the musictype array inside a music-track class?

cunning crown
#

No

narrow pollen
#

How would I go about doing that then?

cunning crown
narrow pollen
#

Right, sorry I messed up the syntax

#

configProperties [configFile >> "CfgMusic","intense"];

cunning crown
#

Nop

narrow pollen
#

Would I need to loop through it?

cunning crown
#

it needs to be code. The code will have a magic variable _x that refers to the current config being tested. So you'd have to do getText (something) and isEqualTo something

autumn swift
#

If I create a dialog, and on one of the controls, I add a UI event handler with ctrlAddEventHandler do I still have to manually delete that event handler later on when I close the dialog again with closeDialog or will it be automatically cleaned up once the control it's attached to no longer exists?

narrow pollen
#

configProperties [configFile >> "CfgMusic",getText(_Musictypes) is EqualTo "intense"]; Eh this doesn't seem right

winter rose
#

indeed, it doesn't

cunning crown
#

The condition needs to be a string that has code inside for example "(configName _x) isEqualTo 'something'"

digital hollow
#

If a vehicle model has multiple points in the pos cargo selection, is it possible to get the positions of all of them instead of just one?

narrow pollen
#

_someArray= configProperties [configFile >> "CfgMusic","'intense' in _MusicTypes"]; Would this return all config entries that have 'intense' in the '_MusicTypes' array inside a config entry (e.g. class MusicTrack01) ?

viral basin
#

Is there an efficient way to detect the state of the landing gear of a helicopter without checking each individual animation phase?

winter rose
#

check the animation source?

viral basin
#

I searched the AnimationSources of the Mohawk but couldn't find any reference to the landing gear :/

winter rose
#

have you tried using animationNames on it?

viral basin
#

yes but then then you get different animationNames for every helicopter, e.g. on the mohawk i could check for frontgear but on the huron its gear_up πŸ˜…

winter rose
#

spawn a landed one, a flying one, compare what's what and you're done! I don't see what's so difficult about it πŸ˜›

#

but afaik, there is no "isGearOut" command

#

@viral basin ↑

spiral fractal
#

but its only for planes

winter rose
#

oh, indeed.

#

then I suppose "you're screwed" applies here

viral basin
#

😭 okay then i guess i have to lookup every helicopter πŸ˜…

spiral fractal
#

its 3rd* version of the game but there still stuff like this...

#

they dont do team meetings at BI?

winter rose
#

they may prioritise things

#

like FFV, ViV, sling loading, etc etc etc 😁

spiral fractal
#

maybe they hire freelancers and dont bother setting coding "standards" (forgot the name)

modern adder
#

Another question, will sqf player findNearestEnemy player knowsAbout player;work on a client? As it says on the biki that the 'who' unit (player findNearestEnemy player) must be local

#

I don't know if the enemy will be local or not

winter rose
#

if the enemy is not local to the client, it won't

#

as simple as that Β―_(ツ)_/Β―

modern adder
#

How do I know if they are?

#

In what situation would they be local?

winter rose
#
private _enemy = player findNearestEnemy player;
if (local _enemy) then {
  private _var = _enemy knowsAbout player;
};
#

In what situation would they be local?
@modern adder in the case of a player-hosted mission, for example

modern adder
#

So, enemy units are local to the server yes?

#

And only the server (or client in non-dedicated)

winter rose
#

AI units are local to the server or to the headless client, if any

modern adder
#

Thank you

winter rose
#

an enemy can be a player in PvP πŸ˜„

modern adder
#

Yep, thanks

winter rose
narrow pollen
#
          musicVolume == 0;
        };
``` This will return true when musicVolume will be 0 right?
winter rose
#

yeah…?

narrow pollen
#

mhm strange

#

How would I execute code when that waitUntil is true?

#

ah wait it needs to be in a scheduled environment only

#

that's probably why it's not working currently

winter rose
#

@unborn drum no crossposting: #rules

fair drum
#

still learning syntaxes... for a test I want to test to see if my variable object _helitest is set to damageAllowed true or false so I can see if a trigger is working.

this is what I have in my debug console

if (isDamageAllowed _helitest) then (hint "true")

logically should this statement basically say: if true then hint "true"? - saying damageAllowed was true

so if I did

If (not isDamageAllowed _helitest) then (hint "false")

this would work in a similar manner if damageAllowed was true?

exotic tinsel
#

@fair drum no, do this instead

If !(isDamageAllowed _helitest) then (hint "false")
robust hollow
#

then {hint "false"}*

#

{} != ()

exotic tinsel
fair drum
#

so if I wanted to combine these I would do:

If (isDamageAllowed _helitest) then {hint "true"} else {hint "false"}?

robust hollow
#

simplified:

hint str(isDamageAllowed _helitest)```
winter rose
#
hint str isDamageAllowed _helitest;```
robust hollow
#

ayee

winter rose
#

stahp ninja'ing me!!1! πŸ‘€ πŸ˜„

fair drum
#

but theory wise, which is what I need to be grasping here, my line would function? just yours is less characters?

robust hollow
#

yours would work, yes

fair drum
#

okay I see. still learning to be efficient. I'm trying to learn python too which would be my first programming language and I do the same thing.

exotic tinsel
#

So im pulling my hair out trying to figure out a clean way to detect input actions so i can replace their results. Im using displayAddEventHandler on KeyDown and MouseButtonDown to detect the action for opening the map so i can show my gui instead. Problems are MouseButtonDown doesn't have a return true option to prevent the map from opening so both map and gui open. Also once my gui is open if the player hits the same key bound to opening the map my displayAddEventHandler for display 46 doesn't fire so i cant close my gui. I really want to understand how all this key binding/inputs stuff works. If you know of a good tutorial/guide or are willing to do one on one to help me set this up so it runs clean, please let me know. I dont want to use the popular method of using whiles or loops.

fair drum
#

hmmm it appears that my end goal trigger is not working. for reference, my heli is now set to _heliTest

I have _heliTest deselected on the "Enable Damage" under special states to prevent it from exploding at mission start. I then have a trigger set to:

Condition: true
On Activation: _heliTest allowDamage true;
Trigger: Timer Countdown [10,10,10]

My trigger is not reenabling damage on the heli however if I go into Zeus, I can click on the heli and type _this allowDamage true and it works... is this just due to a problem of running it in a multiplayer server?

winter rose
#

@fair drum triggers can't use private variables

exotic tinsel
fair drum
#

hmmm I guess I got confused cause I'm currently working through Focker's Arma Scripting guide and he uses almost all private variables. guess I'll retry with global

molten roost
#

should i use initplayerlocal or initplayerserver to handle teleporting players?

#

currently i have it as remotexec in initplayerserver to make sure JIPs get teleported

exotic tinsel
#

initplayerlocal fires when player connects

sage flume
#

are you still working Lou?

#

🍴

#

?

#

So I've scripted an object to randomly spawn on PKL which has the rice paddies. I want this object to be able spawn anywhere except in a rice paddy. What command could I use to say 'never spawn on any water surface no matter how shallow. The problem I have is that I think the Editor get confused because the I say...

#

_fe = _pos isFlatEmpty [10,200,0.3,15,0,false,objNull];

#

so [0] in the array says "not on water" but the terrian gets tricky with the berms around the rice paddies

#

would -1 work?,.....oops, I see -1 = ignore, Ok

ashen warren
#

hello all, im trying to get fog % to be detected in a part of a script. I thought i had it but apparently not. I have it set so when 30% volume of fog is present, it should kick into the fog tracks but it looks like it refuses to switch. it will only stay in the safeTracks section

#
            {
                
                if(fog >= 0.3) then
                {
                    //playing fog music
                    _selecter = floor(random count _fogTracks);
                    playMusic (_fogTracks select _selecter);
                    duration = (_fogDurations select _selecter);
                    currentTrack = (_fogTracks select _selecter);
               
                    if(debugging == 1) then
                    {
                        hint format ["Changed music to Fog Music Trackname: %1", (_fogtracks select _selecter)];
                    };
               
                }
            else
                {
                    //turn off fog music
                    _selecter = floor(random count _safeTracks);
                    playMusic (_safeTracks select _selecter);
                    duration = (_safeDurations select _selecter);
                    currentTrack = (_safeTracks select _selecter);
                
                    if(debugging == 1) then
                    {
                        hint format ["Changed music to NormalMusic Trackname: %1", (_safeTracks select _selecter)];
                    };
                };

            };```
#

any suggestions?

spiral fractal
#

in addMissionEventHandler there is: PlayerDisconnected and HandleDisconnect, HandleDisconnect will fire before PlayerDisconnected? and it will happen before the player character gets "killed" and disappear?

winter rose
#

@sage flume it was about 2am when you sent this message, so no πŸ˜„

#

also, I am not the only one able to help here - many talented scripters are here too πŸ˜‰

mortal crypt
#

Its me again (hopefully something that is not googled in 5 seconds(I tried)).
When I try to run follwing code sqf ["TSC_addACEActionUnflip", { params["_vehicle"]; private _action = ["TSC_unflip","Flip Tank", "Modules\TankFlip.paa",{ private _vehicle = _target; _vehicle setVectorUp surfaceNormal position _vehicle; _vehicle setPos (getPos _vehicle vectorAdd [0,0,5]); },{alive _target && (vectorUp _target select 2) < 0.5}] call ace_interact_menu_fnc_createAction; [_vehicle, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject; }] call CBA_fnc_addEventHandler;
I get an reserved variable in expression error. Problem is, I dont know which it is. And the error only appears on a dedicated server when the vehicle respawnes.

["Tank_F","init",{
    params["_vehicle"];
    ["TSC_addACEActionUnflip",_vehicle] call CBA_fnc_globalEventJip;
},true,[],true] call CBA_fnc_addClassEventHandler;```
spiral fractal
#

maybe you need () in surfaceNormal line

mortal crypt
#

will try and report back.

#

Sadly no.

winter rose
#

also, you are defining _vehicle twice, and _target doesn't exist
it's an action.
you still need to use ```sqf
params ["_target", "_caller", "_actionId", "_arguments"];

mortal crypt
#

so instead of sqf private _vehicle = _target;

#
params ["_target", "_caller", "_actionId", "_arguments"];```
and just use ```_target```?
#

and that also in the condition

spiral fractal
#

he can use ace_interact_menu_fnc_addActionToClass instead of all this no?

mortal crypt
#

There is a bit more code then shown. Just shortend the init code for readability. (only the init eh)
Problem is still the same, but it seems that the error accurs somewhere else.
Seems to be that the init eventhandler is called mulible times or something will do more testing and report back.

spiral fractal
#

as far as I know, you dont need CBA events etc to use ACE interactions. if you run ace_interact_menu_fnc_addActionToObject on client it should work for JIP too

mortal crypt
#

That I have to try. Added a locality check in the init eH which fixed that bug.

#

@spiral fractal will test the jip and report back.

spiral fractal
#

try to take the code you have in CBA_fnc_addEventHandler and move it to player init it should work, or you can switch to ace_interact_menu_fnc_addActionToClass that way you can add this menu to every tank and maybe it is possible to add it to all vehicles

mortal crypt
#

Will do that, Thanks for the input!
atm the changes I made bugged out the action but thats something I can fix alone :D

narrow pollen
#

If I use a function with [] call, does waituntil work inside that function (inline function)? Or is it non-scheduled?

winter rose
#

call has the same scheduler setting as its parent

narrow pollen
#

The call is inside an eventhandlers, so I assume that's unscheduled then

winter rose
#

basically: won't change the schedule yep

narrow pollen
#

I need a delay in my function that is called from the eventhandler, but I am unsure how to do it without it being an scheduled environment

queen cargo
#

spawn

narrow pollen
#

I guess I will use that yeah

winter rose
#

waiting = scheduled

spawn from the very beginning, you will remain in the same scope

narrow pollen
quartz pebble
#

CfgDisabledCommands is "disable what has to be restricted". Is there some way to "disable all and allow only what needed" ?

spiral fractal
#

in remoteExec on server I do: _player setVariable ["my_role", _roleId, true]; _player is player that passed from client side, but when I check with allVariables player dont have this variable, why (I tired with and without public param)?

#

it seems to work if I pass owner _player as public (3rd) think_turtle

quartz pebble
#

why run _player setVariable ["my_role", _roleId, true]; through remoteExec? The 3rd arg true means the command will pass-through network.

spiral fractal
#

I have array with available role spots, and it should probably exists on server, when player select role, server has to set player owner to the role spots array and notify other players etc

quartz pebble
#

mb you go with publishing the updated array from server to clients?

#

if a client wants to take a role, it remoteExec's the server some takeRole func, the func on the server does its job, updates the roles array and publicVariableClient's it to clients?

#

and clients are notified through their addPublicVariableEventHandler EH?

narrow pollen
#
"initialize": [stealthMusics, combatMusics, safeMusics, volume, transition, radius, executionRate, noRepeat]
stealthMusics: Array of Strings
combatMusics: Array of Strings
safeMusics: Array of Strings
volume: Number```
https://community.bistudio.com/wiki/BIS_fnc_jukebox

Does anyone know what the other parameters in that array do? They are not documented.
winter rose
#

array of string = music names

narrow pollen
#

Yeah, that I know

#

I am asking what 'transition','radius', 'executionRate','noRepeat' mean

#

I mean I can guess what they do for some of them

#

But I am unsure what values they take

#

I suppose transition is fadein/out in seconds?

spiral fractal
#

it works as you said but because I use setUnitTrait it should already notify all players, and the variable that I set on player is mostly for use in ACE menu

quartz pebble
#

Do CfgDisabledCommands affect singleplayer?

winter rose
#

I would say… Perhaps
try and report, so I can update the wiki

quartz pebble
#

Tried. It definitely does.

winter rose
#

ok! Thanks, will update

quartz pebble
#

The trick was.. I added

class CfgDisabledCommands
{
  class PUBLICVARIABLE
  {
    targets[] = {1, 0, 1};
  };
  class PUBLICVARIABLECLIENT
  {
    targets[] = {1, 0, 1};
  };
  class PUBLICVARIABLESERVER
  {
    targets[] = {1, 0, 1};
  };
};

(In short: it disables publicVariable stuff on clients.)

I ensured all works as intended on a dedicated server. But when I got back to singleplayer, I figured out everything blows up.πŸ™‚

winter rose
#

why? in SP, client is server…

quartz pebble
#

isServer returns true in SP

#

but it is also a client, and on client the things were disabled -> logicπŸ™‚

winter rose
#

instead of doing client-check first

if isClient exitWith { /* only client stuff */ };
if isServer exitWith { /* only server stuff */ };
```the logical way would have been to check server first:```sqf
if isServer exitWith { /* only server stuff */ };
if isClient exitWith { /* only client stuff */ };
quartz pebble
#

Who knows which way arma applies the CfgDisabledCommands settings.

winter rose
#

devs, hopefully!

quartz pebble
#

Interesting, can I disable all commands and then allow only those I use?

winter rose
#

and from it,

It is a powerful tool and can make or break your game, since some of the default in-game mechanics also uses scripting. The use of CfgDisabledCommands feature requires advanced knowledge of scripting and should not be attempted unless the mission maker is confident in his abilities and is aware of potential dangers.

quartz pebble
#

default in-game mechanics also uses scripting
Good point. I guess not so many people can definitely answer which mechanics uses which scripting

winter rose
#

mostly, BIS_fnc

quartz pebble
#

Ok. Another question. If I disable publicVariable stuff. Would it affect network missionNamespace setVariable ?

still forum
#

no

#

different commands are different commands

#

block one, you kinda obviously don't automatically block the other

#

It disables commands, not functionality

quartz pebble
#

So, even with publicVariable disabled a malicious person may try to poison a server variable through missionNamespace setVariable ?

still forum
#

yes

quartz pebble
#

And can it be blocked somehow?

still forum
#

You can block setVariable

#

you can use battleye variable restrictions

winter rose
#

if you talk about in-memory functions, use CfgFunctions

quartz pebble
#

if you talk about in-memory functions, use CfgFunctions
But except functions there are also variables.

winter rose
#

yep, my sentence is conditional

quartz pebble
#

in-memory functions
Can it be a "non-in-memory" function?

winter rose
#

it could be an execVM

but basically preloaded function

quartz pebble
#

preloaded function
Is that a function loaded through CfgFunctions?

winter rose
#

not especially, it can be a compile(final) preprocessFileLineNumbers

quartz pebble
#

so as far as I understand, the technical difference between compile and compileFinal is - compileFinal somehow internally marks its output as "final"; and if that output is assigned somewhere, then the assignment will last forever and won't be updated anyhow.

winter rose
#

the wiki is here to help

quartz pebble
#

The wiki gives no details - it describes just the effect of compileFinal

winter rose
#

what you said is what is written on the wiki basically

quartz pebble
#

The wiki says: "Compile expression and makes it final, preventing it from..."

My initial understanding was:

<variable> = compileFinal <expression>; And I couldn't understand what is the purpose of making "expression" final;

And my current understanding says, than "final" becomes not the "expression" but the "variable"; Kind`a difference.

still forum
#

Yes

#

a flag is set on the variable once you store the compileFinal result into it, with that flag set the variable cannot be overwritten anymore

quartz pebble
#

And does the flag travel with that variable?

var2 = finalVar1;
var2 = 'some-new-value`;
systemChat str var2; //what's the output here?
winter rose
#

try and see to be sure, but I think var2 can be overridden

narrow pollen
#

configClasses (configFile >> "CfgMusic") apply {configName _x} call BIS_fnc_arrayShuffle Can I use the array shuffle like this or should I create a new variable?

winter rose
#

for readability, don't chain stuff
make temp variables

#

lessens issues amount, too

warm hedge
#
("true" configClasses (configFile >> "CfgMusic") apply {configName _x}) call BIS_fnc_arrayShuffle```You missed the condition
#

It worked though

narrow pollen
#

I have a condition, I just thought it wasn't relevant to my question πŸ˜„

winter rose
#

always post at least the full line!

narrow pollen
#

aCalmMusicClassnames = "'calm' in getArray (_x >> 'moods') " configClasses (configFile >> "CfgMusic") apply {configName _x} call BIS_fnc_arrayShuffle; this is what I have

winter rose
#

Oo can't read that. and neither will you when you come back to it in a month

warm hedge
#

Maybe brackets are missed, and might not so readable but works I guess

narrow pollen
#

Basically adds all config classnames to an array that have 'calm' in the moods array inside a config-entry

#

Also, where do I need brackets you say?

warm hedge
#

Never mind, it worked without them

narrow pollen
#

alright, great

autumn swift
#

For manipulating camera, you have functions like camSetTarget camSetRelPos camCommit
But these fucntions also have variants called camPrepareTarget camPrepareRelPos camPrepareComit
What exactly is the difference? From what I can see, they both have the same effect.

winter rose
#

the latter "prepares" (preloads) the destination

#

from what I could guess

narrow pollen
#

Is there a way to get the currently playing music?

winter rose
narrow pollen
#

Right, thanks

#

That's exactly what I need

exotic tinsel
#

can someone drop a link that would help me get started with putting gps map on vehicle screens.

warm hedge
#

Ctrl+M?

winter rose
#

I believe he meant "on vehicle screens" πŸ˜„

narrow pollen
#

He probably wants to see it physicalized

exotic tinsel
#

yes sorry

spiral fractal
#

I just checked on Chinook and Gear EH works it returns false when gear is up, who asked about gear state yesterday? I think Wiki page need edit after additional testing

winter rose
#

@viral basin

viral basin
#

I just checked on Chinook and Gear EH works it returns false when gear is up, who asked about gear state yesterday? I think Wiki page need edit after additional testing
@spiral fractal i managed to find every animation name, luckily i just had to lookup 3 helicopters πŸ˜‚ but thank you anyways

spiral fractal
#

RAH-66 Comanche only return when gear is down... also works, gear takes more time

winter rose
#

do all vanilla helicopters trigger it properly?

spiral fractal
#

I checked: UH-80, RAH-66, CH-471 for now, with this code in Init:

this addEventHandler ["Gear", { 
 params ["_vehicle", "_gearState"]; 
 systemChat str _this;
}];

it works, littlebird dont

winter rose
#

if you can test all vanilla A3 helicopters that would be great, so I can update the wiki

spiral fractal
#

its seems that every heli with gear up option fire this event, even the MQ-12 UAV

#

another thing that I was testing is when heli "land" on water and drowns, it dont fire HandleDamage EH, but Dammaged and Engine EH work, then when it touch the ocean floor it becomes wreck

winter rose
#

w00t!! Thanks for testing

I suppose it was correct in OFP/ArmA, and maybe Arma 2

spiral fractal
#

and the respawn system not work for it

#

btw CH-47 Chinook floats on water 😐

#

and can land and take off on water, but I guess A3 wont allow it πŸ˜„

warm hedge
#

There's no CH-47 in vanilla Arma 3 so...

spiral fractal
#

what is there then?

warm hedge
#

CH-67 or?

spiral fractal
#

I forgot to mention that I have ACE and CBA installed 😐 @winter rose

#

maybe that is why the Gear EH works?

warm hedge
#

I don't think so

spiral fractal
#

but that is a made up name for CH-47

warm hedge
#

Ah well...

spiral fractal
#

you can even see by its shape that it can float

warm hedge
#

Yeah, ACE renames some vanilla things so that's why

spiral fractal
#

yes

warm hedge
#

You know, stealthy and maybe bit sci-fi-ish CH-47 is CH-67 Huron in vanilla

spiral fractal
#

and Comanche was a prototype that was cancelled so I dont think it cant exist in 2035 πŸ˜„ unless the program was relaunched later in Arma world

warm hedge
#

Latter in Armaverse, as mentioned in somewhere... but it's offtopic so I'm not going to discuss about this here anymore! πŸ˜„

modern adder
#

Hi, I'm a wee bit confused about how to do this waitUntil

#

So, I'm trying to make it wait until the returned value from sqf scriptDone XIM_hEvaluateCombat is true

surreal peak
#

show what u wrote in the wait until

#

full script

modern adder
#
waitUntil {scriptDone XIM_hEvaluateCombat} then```
#

XIM_hEvaluateCombat is a handler for a spawn

winter rose
#

no then needed

#
waitUntil { condition };
modern adder
#

I know that it takes a condition

#

I'll get rid of the then

#

Is that the only issue?

winter rose
#

well yeah

modern adder
#

Okay, thanks

winter rose
#

unless you are in an unscheduled environment ofc

modern adder
#

Don't worry, I already found that out the hard way πŸ˜…

slim verge
winter rose
#

you would have to test, and eventually report so we can update the page

#

if I had to guess, I would say "effect local" as channel id varies (and radioChannelCreate is local iirc?)
@slim verge

#

Ah no, glob/glob

slim verge
#

channelcreate is servereside, so... thus far have sent created channel id's to clients via pv setvariable

#

am now in the stage of If condition add player in a client environment, just wondering if every other player needs to be told this or it just happens

#

atm testing mp is difficult as no plaqyers about in community to test

#

ok thx Lou

crude needle
#

What command or function prints out to the (dedicated) server console?

winter rose
#

Maybe debug_log?

crude needle
#

No joy.

winter rose
#

do you know it is doable?

crude needle
#

Seeing another mod (CUP Terrains I believe) print out. Could just be something during initialization I guess. Oh well.

ionic anchor
#

Wonder if anyone can help me please, im calling spectator through a button, it works fine until i exit spectator and it doesn't return control to the player and is frozen, not sure how to fix it

waitUntil  {!isNull (findDisplay 60492)};
private _display = findDisplay 60492;

_text = _display ctrlCreate ["RscText",-1];
_text ctrlSetPosition [ 0.850625 * safezoneW + safezoneX , 0.016 * safezoneH + safezoneY, 0.144375 * safezoneW, 0.033 * safezoneH ];
_text ctrlCommit 0;
_text ctrlSetText "Spectator Menu";

_list = _display ctrlCreate ["RscListBox",-1];
_list ctrlSetPosition [0.845469 * safezoneW + safezoneX, 0.126 * safezoneH + safezoneY, 0.134062 * safezoneW, 0.858 * safezoneH];
_list ctrlSetBackgroundColor [0.28,0.28,0.28,1];
_list ctrlCommit 0;
_list ctrlAddEventHandler ["LBDblClick",{["Terminate"] call BIS_fnc_EGSpectator}];

_list lbadd "Exit Spectator";
_list lbSetData [(lbSize _list)-1,"Exit"];
_list lbadd "";
slim verge
#

there will be a disableinput true line somewhere

#

you need to set it to false

#

on exit

#

or you may need to set dialog 0

ionic anchor
#

found it player enableSimulation false;, totally missed it πŸ˜‚ cheers @slim verge

spiral fractal
#

what modules replace ALICE and SILVIE in A3? lol

surreal peak
#

@spiral fractal can you be more specific? Whats the problem? Eden or Zeus?

spiral fractal
#

I want to add civs and civ vehicles, I know there is "Civilian Presence" module, but its not like ALICE (as far as I understand) because ALICE added civs everywhere the play go and current module has radius and I have to set waypoints, also how can I add vehicle traffic with that module?

#

about Gear EH idk if this line is correct: "Also triggered for helicopters in landing mode, regardless if they have retractable gear or not.",
in my tests, EH worked only on helis with retractable gear, all CSAT helis dont fire this EH

waxen cosmos
#

Hey guys, am I being stupid? I am not able to get this to work...

addMissionEventHandler ["Draw3D", {
drawIcon3D ["", [1,1,1,1], ASLToAGL getPosASL _Captive, 1, 1, 1, "Target", 1, 0.05, "PuristaMedium","","",true];
}];

winter rose
#

about Gear EH idk if this line is correct: "Also triggered for helicopters in landing mode, regardless if they have retractable gear or not.",
in my tests, EH worked only on helis with retractable gear, all CSAT helis dont fire this EH
@spiral fractal
I may remove that line if you confirm it doesn't trigger for AI

#

@waxen cosmos an event handler is a new (unscheduled) script and doesn't know about your _captive variable - otherwise, the rest seems fine

spiral fractal
#

I think it would be better if someone more "trust worthy" would test Gear EH... but I think I saw couple messages when playable AI took off on its own

waxen cosmos
#

@waxen cosmos an event handler is a new (unscheduled) script and doesn't know about your _captive variable - otherwise, the rest seems fine
@winter rose - I've just tested various ways to try and run this script. What would be your suggestion in running this from start-up as I'm running out of ideas.

winter rose
#

make this captive a public variable, like L1D_captive
@waxen cosmos

slim verge
#

struggling with an antistasi variant on our server. Issue being when players respawn, they end up back in slotting up screen having to reselect their unit. Never seen this in any of our missions before.
There are no respawn templates in use, nothing set in the editor gui, and the only entries i can see for respawn are all in the description.ext, that being respawn delay and respawn type being "BASE".... havent a clue what string to mass search for,
any ideas ?

agile pumice
#

Maybe their getting a missionEnd on the client side?

slim verge
#

looked at the Killed EH nothing there

slim verge
#

nothing dead player related to endmission, any other ideas

spiral fractal
#

maybe it has something to do with Petros AI? he is the lose condition there, I think

austere hawk
#

has anyone made some good/bad experiences with how addForce / addTorque commands behave in MP if executing per Frame ? Are there glitches of sorts (more than usuel) or anything like that?

steel fox
#

How do you properly spawn a tripwire mine with SQF? When I spawn my custom tripwire mines in the editor and load the senario they work perfectly fine by going off as soon as something touches them. But, when I spawn them in game with either createVehicle of createMine, I have to passthrough the wire a few times for it to actually go off and sometimes they just never activate.

winter rose
#

createMine, and wait
the mine is not immediately active to give you time to get away

#

@steel fox ↑

steel fox
#

Them red triangles that popup indicate the mine is active right?

#

Using recruit diffuculty for testing

#

@winter rose

winter rose
#

It indicates that your side spotted a mine

drowsy axle
#

Is there anyway to use BIS_fnc_countdown without having the mission end? Or even easier the Countdown module in eden.

exotic flax
#

bis_fnc_countdown only does an actual countdown and doesn't trigger anything.
The Countdown module only uses bis_fnc_countdown and does trigger a mission end.

astral dawn
#

arma doesn't report wrong local variable names in unscheduled code. Why and can I enable it somehow?

robust hollow
#

it expects you to be perfect is why

astral dawn
#

And spawned code is for kids and it doesn't expect kids to be perfect or what?

robust hollow
#

sounds right to me

astral dawn
#

It is obviously broken 🀷

#

sounds right to me :/

modern adder
#

Anybody know why this line throws generic error in expression? I'm running it in an execVM btw

#
waitUntil {sleep 0.5; scriptDone XIM_hEvaluateCombat};```
#

XIM_hEvaluateCombat does in fact exist

robust hollow
#

is it a script handle?

modern adder
#

Yes

#

I have this at the start of my code to make it true the first time the engine reaches the waitUntilsqf XIM_hEvaluateCombat = [] spawn {}; //sets the waituntil for XIM_fncEvaluateCombat to be true the first time it is run

robust hollow
#

paste the error from ur rpt

modern adder
#

sure

#

Oh, it says suspending not allowed in this context?

#

that doesn't make any sense...

#

It's within execVM

#

Does it have to be within spawn?

robust hollow
#

no, execvm should do it.

#

though, it evidently is in an unscheduled environment so...

modern adder
#

Doesn't make much sense really.

#

The script containing it is called within XEH_PreInit.sqf like this:sqf if (hasInterface) then // runs on all player clients, including host (if there is one) { execVM "\XIM_Core\scripts\multiplayer\client.sqf"; // executes client.sqf }

robust hollow
#

sure it isnt also being called from somewhere else?

modern adder
#

100%

#

Only place it is mentioned

robust hollow
#

πŸ€·β€β™‚οΈ

modern adder
#

I have my answer

#

Event handlers are unscheduled

#

Oh no, actually that code is before my event handler 🀨

robust hollow
#

it also wouldnt matter if you were doing an execvm from an event handler... it should still be scheduled.

#

unless that waituntil is inside an eventhandler directly?

#

some context around it might be helpful. the line itself is fine.

modern adder
#

no, waituntil is outside all eventhandlers

#

It is however within a while do loop

#

But I don't see how that could create a problem

robust hollow
#

can u post the file? or at least surrounding lines

modern adder
#

Sure, one sec

#

It's 100 lines or so

robust hollow
#

share a link to it

modern adder
#

What I'm trying to do is prevent an eventhandler calling XIM_fncEvaluateCombat until the function itself has finished running

#

Same with XIM_fncToggleCombat too

robust hollow
#

you have it in two event handlers...

modern adder
#

No

robust hollow
#

L70 and 85

modern adder
#

Forgot about those ones haha

robust hollow
#

the error tells u the line..

modern adder
#

Are you sure?

robust hollow
#

they usually do

modern adder
#

I don't see the line no in the rpt

#

Ingame maybe?

#

Hmm, no not there either

#

Anyway, thank you very much for your help

robust hollow
#

ehh, probably not actually, because the event code doesnt know what file it came from

modern adder
#

Ohh, different thread right?

robust hollow
#

yea. new scope stack.

modern adder
#

got it

#

cheers

#

Does defining loadingTexts[] within CfgWorlds add to other text that can appear there, or does it replace all other loadingTexts[]?

#

As in, if I define a loadingTexts[] within my config.cpp, and it only has one entry, will only that one show up?

#

Even if there are other mods loaded with their own loadingTexts[]

robust hollow
#

replaces. you should be able to add to it with

loadingTexts[]+={};
#

ill double check that + position

modern adder
#

Cheers

#

Yeah thanks

robust hollow
#

yea that should be correct.

modern adder
#

kk

ashen warren
#

Can someone help me understand what the definition of the ! And || operations happening in this? @ me if you know the answer

#

if(currentMusicState != "nonCombat" || isMusicCurrentlyPlaying == 0) then

winter rose
#

@ashen warren ↑
|| is or
&& is and
! is not
!= is "not equal"

ashen warren
#

I thought so but I wasn’t completely sure. Thanks

winter rose
ashen warren
#

Ok interesting, I’m working on something and it doesn’t like to detect a section called isfog on my script that is using that if then statement. But it skips over it.

#

My line number and notes of what is going on on the top of the document if someone could explain to me if something I did is incorrect

warm hedge
#

What is isFog?

ashen warren
#

It is a detection for fog in a different sqf that runs fog >= 0.3 in a do loop I believe. It also has the day detection in the same loop

#

For more information on what I mean

warm hedge
#

But it skips over it.
For sure?

ashen warren
#

I know it’s weird but it does.

#

It will not switch to it. When fog is over 0.3

#

I have gotten it to switch if I removed the noncombat part of the if statement

warm hedge
#

Doubt _fogTracks exists?

winter rose
#

check your variable(s) before the if

warm hedge
#

...If doesn't exist, should return error tho

ashen warren
#

Yes it’s at the way way top of the sqf.

#

I didn’t paste it into the thing which I should have

#

If I remove the battlestate = noncombat related stuff. It will use fogtracks and just change every second

ashen warren
#

It still doesn’t make any sense how it wouldn’t detect that isfog section when I add in the noncombat items it will ignore it?

narrow pollen
#

Does anyone know how to alter Ace variables from the server on selected clients? remoteExec in combination with setVariable doesn't seem to do the trick. I want to change ace_hearing_disableVolumeUpdate

winter rose
#

is it a global variable?

narrow pollen
#

I am not entirely sure, I can set it locally just fine by doing ace_hearing_disableVolumeUpdate = true;

crude needle
narrow pollen
#

I have, to no avail

#

I am not sure what I should use for the namespace param

#

player, right?

#

Since I would be executing it on every client selected with remoteExec

crude needle
#

Assuming it's a missionNamespace variable:

missionNameSpace setVariable ["ace_hearing_disableVolumeUpdate",true,true];

Though this makes it a publicVariable. You can use owner IDs (such as with remoteExec) to set it on specific machines.

narrow pollen
#

So, how would I approach setting it on a group?

crude needle
#

If you don't expect duplicates (having AI in the group) something like:

private _groupOwnerIDs = [];
(units myGroup) apply {_groupOwnerIDs pushBackUnique (owner _x)};
missionNameSpace setVariable ["ace_hearing_disableVolumeUpdate",true,_groupOwnerIDs];
#

That would need to be executed on the server.

#

Actually my mistake, select doesn't have that syntax. Fixed it.

spiral fractal
#

what command should I use to play sound and make it attached to the object it is playing "from" so if the object moves sound will move too?

#

I use playSound3d but it stays in the position it was added to

narrow pollen
#

@crude needle Thank you very much, I will try that

crude needle
#

@spiral fractal I do believe say3d has that functionality. Though it is not global.

spiral fractal
#

it maybe ok if its not global, but I think its impossible to pass file path, I have to declare it in description.ext and I dont want that

winter rose
#

why not

The other solution would be to create a sound source I think

narrow pollen
#

I figured it out πŸ˜„

#

It works just like that

viral rivet
#

hey. if i make a teleport script. can i use one pole to teleport to different places? would i just put a second teleport script under the first?

#

i wanna be able to make a hub of sorts on my training map

winter rose
#

…yes?

#

at least, no laws prevent you from doing so πŸ˜„

viral rivet
#

haha

winter rose
quartz pebble
winter rose
#

What do you mean?

quartz pebble
#

I call

[
  _taskId,
  group player,
  taskDescription _realTask,
  taskDestination _realTask,
  _state,
  0,
  true,
  false,// DON'T run globally!!!
  taskType _realTask,
  false
] call BIS_fnc_setTask;

but inside BIS_fnc_setTask there is:

...
//line 267; isGlobal not respected
[_x,nil,nil,nil,_state,nil,false] call bis_fnc_setTask;
...
//line 298; isGlobal again not respected
[[_parent,"",_parentChildren],_owners] call bis_fnc_setTask;
//
#

And that breaks the mission scripts

winter rose
#

ah well. I don't have access to my computer right now but if you think this is an issue, please create a ticket (if it doesn't exist already)

modern adder
#

Hi, I was wondering if there's a way to return a variable within an if statement without making it a global variable?

#

For example:```sqf
if (true) then
{
private _number = 5
};

if (_number == 5) then
{
...
}```

#

I'd like to be able to access the _number variable outside of the scope of the if

winter rose
#

yes, define it outside of the if

#

private _ number = 0

modern adder
#

Is that all I can do?

winter rose
#

It's a logic issue here
What if you don't go through your if? What should the last part do?

modern adder
#

try instead I suppose

#

Poor example, I know

#

But thanks, I'll try defining it outside the scope :)

winter rose
#

define it in the scope you want to use it, and change its value wherever you like (in same-or-lower scopes ofc)

modern adder
#

Yep, cheers

winter rose
modern adder
#

Thanks

tough abyss
#

Me and a friend are trying to combine 2 SQM lines from different maps, so far we've gotten both maps too work individually and certain aspects too work but the rest wont, we're closeish too what we want currently but we keep getting a random error.

"mpmissions\main%20combination%20.altis\mission.sqm line 18219: .Mission: Member already defined"

The code at the line 18219 is

            class Item31
            {
                linkID=31;
                item0=88;
                item1=87;
                class CustomData
                {
                    type="Sync";
                };
            };
        };
    };
};``` 

No clue what language ARMA works in personally so we're both stumped here, any advice would be appreciated.
robust hollow
#

why dont u just copy the editor items from one sqm into the other... in the editor?

#

or merge one sqm into the other if you want everything (again, in the editor)

tough abyss
#

Because we're tryna take some stuff from a map we like too use and put it onto our own map (Not for publishing, just private use) and it all runs on weird scripts, if what you just said would work still in this case how would we go about doing this?

young current
#

map =/= mission

#

map = terrain, mission = scenario

tough abyss
#

Psure they're both missions but i am not entirely sure on the inner workings of ARMA stuff so

#

Most of it's all the same for me

young current
#

yes but helping you might be easier if you talk about right things

#

and connor said it might be simples to copy the stuff in editor

#

since you might quite easily miss stuff by copying them in the sqm file

robust hollow
#

the editor is literally there so you dont have to mess up the sqm directly.

tough abyss
#

Yeah, MB they're both missions , one of them has the usual stuff we want too just mess about and we're tryna pull in god mode and such from another mission, but that error keeps re-occuring, when we go about doing what the error comes up with it differing stuff

#

Yeah, we'll try that now

robust hollow
#

imagine writing mission sqms by hand 😩

young current
#

if there are some complicated features build in they might not even be copyable that easily.

tough abyss
#

Alright, how would we go about doing the whole thing through the editor like Connor suggested

robust hollow
#

click on the objects you want. ctrl c. open the sqm u want to paste then in. right click, paste on original position (if that matters), otherwise ctrl v will do

#

or there is a button (under file i think) to merge one sqm into the other

tough abyss
#

Alright thanks very much for the help ❀️

spiral fractal
#

is it possible to detect variable change somehow? I have CBA, player setVariable["var1", 100]; I want to get "notification" when var1 is lower than 50 for example

still forum
#

@modern adder

Hi, I was wondering if there's a way to return a variable within an if statement without making it a global variable?
Uh. you mean like

if (true) then {
5
}

? πŸ˜„

#

The last value left over in a scope, will be returned from it

modern adder
#

That's exactly what I was looking for, thanks mate

scenic pollen
#

Is there a Discord server for Intercept?

#

I have a quick question and not sure where to direct it

warm hedge
#

This topic should fit if is script-related

scenic pollen
#

Oh ok, cool πŸ™‚

I'm building an Intercept-based mod which has been working well so far. However, I'm having trouble with mission event handlers not firing. Here's my code;

void on_entity_respawn(types::object new_entity, types::object old_entity) {
  logger("Respawn EH called");
}

void intercept::post_init() {
  client::addMissionEventHandler<client::eventhandlers_mission::EntityRespawned>(on_entity_respawn);
}

However, the log message doesn't appear when an entity (eg player) respawns. Recreating the above in SQF works. What am I doing wrong?

warm hedge
#

Uh, sorry I've no experience with extensions πŸ™ƒ

scenic pollen
#

No worries! I'm hoping Dedmen might see this πŸ‘€

#

(not sure what the etiquette is here on @ing people)

still forum
#

No intercept discord, I have my intercept projects discord, and main intercept uses-ish slack.
Quite sure you need to store the return value from addMissionEventHandler.
The return is a reference counted handle, when you let it go away it will automatically remove the eventhandler

#

@scenic pollen

#

Yep, it returns EHIdentifierHandle when that handle destructs, it calls removeMissionEventHandler

scenic pollen
#

Ahh I see, that makes sense. Thanks! Would your intercept projects discord be the right place for me to ask any more questions in the future?

astral dawn
#

@scenic pollen what is your mod about? I'm interested in Intercept usage applications intercept πŸ‘€

still forum
#

Well its mainly me there, and as I'm basically the only intercept support, I guess that would work πŸ˜„

scenic pollen
#

@astral dawn Will DM you πŸ‘

warm hedge
#

Speaking of extension, what's the best tutorial/reference to code Arma Extension?

robust hollow
#

there is a wiki page with the bare minimum required in some languages

scenic pollen
robust hollow
#

copy pasta and you're an elite extension developer

warm hedge
#

πŸ˜„ If I'd start to make an extension from scratch without any experience, what's the best language you'd recommend?

still forum
#

The language that you already know πŸ˜„

robust hollow
#

depends what language you know. i do C#

warm hedge
#

...sqf πŸ™ƒ

robust hollow
#

its pretty hard to mess up

warm hedge
#

I've kinda bruh at any of coding, I only have sqf and bit of Lua experience

winter rose
#

C# is so strict it has a dedicated 50 shades book you can't really make language mistakes

robust hollow
#

tis k. i only knew sqf when i started doing extensions

winter rose
#

Use Visual Studio of course

#

@warm hedge we can help (maybe not here, but we can)

still forum
#

use SQF-VM and write a wrapper so you can write extensions in SQF

robust hollow
#

wouldnt that mean you can only use sqf commands though? the only benefit being it executes faster?

still forum
#

yeah :D
Not really faster I think

robust hollow
#

😐 .... then whats the benefit of using it?

still forum
#

its crazy and thus funny

warm hedge
#

Aight boys, I think I'll go with C# (maybe later). Cheers!

...oh wait one more question, is that Discord server Dedmen posted better place to discuss extensions?

still forum
#

no

#

thats just my discord for my few projects.
Extension talk here is usually #arma3_tools just because all the real programmers are down there

warm hedge
#

Understood, thanks!

quartz pebble
#

Which command do I use to change view distance for the missile picture in picture view?

winter rose
#

PiP quality in video settings, that's it @quartz pebble

quartz pebble
#

so no explicit way to tell it "show 12km"?

winter rose
#

Nope

#

Also, consider some players have it disabled @quartz pebble

quartz pebble
#

I know. The players who have it enabled were asking how to make it show further.

winter rose
#

"higher quality option" is the only way.

quartz pebble
#

tx

obsidian violet
#

hey guys!
Currently making a mission where players need to travel around with some assaultboats, where there will be alot of embarking and disembarking.
During my first testrun I realised that the players took damage from the boat during the disembark, this could easely be solved by drivers do better training on handling the boat itself.
But lets just assume the problem goes on. xD

So I wanted to make use of the eventhandler for "getout" to simply disable the damage the first 3 seconds and then turn it back on again.
Clearly it didnΒ΄t work out as I hoped and now im asking you what may be wrong.

SecureEject.sqf (runned from initplayerlocal.sqf)

player addEventHandler ["GetOut", {
    params ["_vehicle", "_role", "_unit", "_turret"];


if ((typeOf _vehicle == "sfp_strb90_rws")) then {
    player allowDamage false; 
    hint "damage off";
    Sleep 3;
    hint "damage on";
    player allowDamage true;
};

}];

a quick guess could be, eventhandlers are unscheduled and cannot handle sleep?

robust hollow
#

you cant sleep directly in an event handler. iit isnt scheduled

#

try this, but it may not be fast enough on all occasions.

player addEventHandler ["GetOut", {
    params ["_vehicle", "_role", "_unit", "_turret"];

    if (typeOf _vehicle == "sfp_strb90_rws") then {
        [] spawn {
            player allowDamage false; 
            hint "damage off";
            sleep 3;
            hint "damage on";
            player allowDamage true;
        };
    };
}];
winter rose
#

_this* allowDamage

robust hollow
#

_this is the vehicle?

queen cargo
#
player addEventHandler ["GetOut", {
    params ["_vehicle", "_role", "_unit", "_turret"];
    if (typeOf _vehicle == "sfp_strb90_rws") then {
        player allowDamage false; 
        hint "damage off";
        [] spawn {
            sleep 3;
            hint "damage on";
            player allowDamage true;
        };
    };
}];
``` use this instead
#

always try to stay in unscheduled for as long as you can

robust hollow
#

i was just about to get to something like that^, though that specifically would leave them in godmode if they didnt get out of that boat...

#

nope. params outside the if

queen cargo
#

*fixed

robust hollow
#

_vehicle isnt defined for the condition like that

queen cargo
#

gah ... common
ma brain today

robust hollow
#

πŸ‘Œ

obsidian violet
#

sorry for late reply, had some visitors coming over, thanks guys, I give this a try πŸ™‚

#

hmm, something is definetly weird.
I didnΒ΄t get the one @queen cargo suggested.

So I started from scratch:

player addEventHandler ["GetOut", {
    params ["_vehicle", "_role", "_unit", "_turret"];
   hint "Test";
}];

And the hint doesnΒ΄t show at all...
If I leave this as it is it should trigger everytime eject or getout action is done?

#

From wiki

"
Triggers when a unit gets out from a vehicle. It can be assigned to a remote vehicle but will only fire on the PC where the actual addEventHandler command was executed. This EH is triggered by moveOut, "GetOut" & "Eject" actions, if an alive crew member disconnects or is deleted, but not upon a seat change within the same vehicle.

this addEventHandler ["GetOut", {
params ["_vehicle", "_role", "_unit", "_turret"];
}];
vehicle: Object - Vehicle the event handler is assigned to
role: String - Can be either "driver", "gunner" or "cargo"
unit: Object - Unit that left the vehicle

"

robust hollow
#

oh πŸ€¦β€β™‚οΈ GetOut is supposed to be added to the vehicle im pretty sure. try getoutman

#

Vehicle the event handler is assigned to yea

obsidian violet
#

OOOOOOOH

#

That did it!
Thanks! ❀️

sage flume
#

I trying to randomly spawn camp sites on PKL but they sometimes wind up in a rice paddy. I want to avoid that. I have this...

#

_fe = _pos isFlatEmpty [15,-1,0.2,15,0,false,objNull];

#

but also added this to try to accomplish the restriction..

#

if not (((count (_pos nearRoads 60)) > 0) or ((count _fe) < 1) or {(((ATLtoASL _pos) select 2) < 0)}) then

#

they still spawn on rice paddy

#

how can I script a more strick command?

#

I need something to say avoid any and all water

#

been reading but .....

#

_pos = _fe;
_pos set [2,0];
_camps pushBack _pos;

exotic flax
#

you could try surfaceIsWater, although I'm not 100% sure if Arma knows it is water.

#

so I guess your best bet is using surfaceType and figure out which surface has been used on the rice paddies

sage flume
#

Not sure but I think they are just sculpted by the terrain maker

echo cloud
#

Alrighty, I am a noob at scripting stuff, but here goes. I am trying to create Zeus modules to change the view distance of a player. I have the setViewDistance down and I can make a custom module, but I cannot figure out how to target a player and change their view distance only

sage flume
#

I wonder if the rice plant has a classname??

#

thanks @exotic flax

#

you gave me an idea

exotic flax
#

well, the surface also defines the clutter, which should be the rice plants (because I don't think Blud manually placed each plant)

sage flume
#

very true,

thorn wraith
#

Question: is there a required light level for detecting mines, and is there a way to manipulate it?

winter rose
#

Maybe, and mods

thorn wraith
#

that's, uh, limiting

winter rose
#

Β―\_(ツ)_/Β―

modern adder
#

Is there a way to set a publicVariable to nil?

#

Because from my understanding, if I were to create a variable in the same name, set it to nil and try to broadcast it, I would cause an undefined error

still forum
#

I would cause an undefined error
no

#

it wouldn't

winter rose
#

@modern adder in Arma 2, yes
in Arma 3, no
It is explained on the wiki

modern adder
#

Yeah thanks, I figured it out

#

I can do it with sqf player setVariable ["varname", nil];

spiral fractal
#

how triggers work? I mean the code for triggers

winter rose
#

it runs the condition unscheduled every 0.5s (by default, changeable)

slate fulcrum
naive needle
#

How can I deactivate the slow walk of ais when they are damaged

#

ForceWalk etc. not working when they are 0.7 damaged

winter rose
#

@naive needle set their leg damage to < 0.5 I believe

winter rose
#

@slate fulcrum have you tried it?

slate fulcrum
#

@winter rose I have, but without the optional Contact dlc loaded.

winter rose
#

and…?

fair drum
#

there a link to a page that can help me with the usage and syntax of

_x```
winter rose
#

@fair drum see the wiki with "Magic Variables", but mostly the forEach page

fair drum
#

kk thx

winter rose
#

_x only means "current element of the array"

slate fulcrum
#

@winter rose and it didn't work, that's why I asked if it's a Contact only thing

winter rose
#

Well, unless you did something wrong I believe you figured it out ^^

But strangely enough, it is not mentioned on the page πŸ€”

#

I would need to test (tomorrow) ; I don't know

slate fulcrum
#

The page does mention something about "material", and the example code uses the string "alien" for it, but it's weird that they would make the code work only with the organic alien network stuff.

winter rose
#

Would you want to see "soldier's meat"? πŸ˜„

#

I will test tomorrow and update the page if needed. Want me to ping you then?

#

@slate fulcrum?

slate fulcrum
#

Ah, yes, that'd be great

winter rose
#

okido

slate fulcrum
#

thanks mate

remote rose
#

Anyone know if there's some kind of FOB generating script where you define a marker area and it procedurally builds a fob, that would be pretty cool sort of like a furniture script

fair drum
#

so when the command says:

{ _x setDamage 1 } forEach units group player;

am I only to select one of the units/group/player?

for example:

{ _x setDamage 1 } forEach deadGroup1;
still forum
#

you want a single unit in the group?

#

which unit?

fair drum
#

all units in the group

still forum
#

but the first one has all units in the group

#

for, each, units in group of player

fair drum
#

the first one is just the wiki example im trying to learn off

winter rose
#

"do this action" "forEach units of this group"

_x is the item of the current "loop" - the code will be applied on each list item

still forum
#

I don't know what you want to know or ask

fair drum
#

yes so I want "set to dead" forEach "units in the group deadGroup1"

#

so would i have to do:

{ _x setDamage 1 } forEach units deadGroup1;
#

yes that works. i guess i just got confused since the wiki has 3 parameters in the example so i was wondering which ones to include

spiral fractal
#

forEach gets array, in this example to get the array that will be passed to the foreach you call units on group of the player.
everything that happen inside the { } will be applied to every element in the array, so in this example , every soldier in the group.
_x will be available inside the { } as a way to access the current element that foreach selected from the array.

#

when I use BIS_fnc_spawnEnemy is there way to customize gear, outfit etc of the spawning units?

exotic flax
#

you could either create configs for units with custom gear and spawn those, or you could spawn units with BIS_fnc_spawnEnemy, get the return array (containing the units), loop over them and give them modified loadouts

spiral fractal
#

if I choose the first option its means that I will have to use different function?

exotic flax
#

no, simply set the 4th parameter with the classes you want

#

and you can even use the 7th parameter to run code on each spawned unit πŸ˜‰

spiral fractal
#

in Wiki example 4th param is ["O_Soldier_F"] will it be possible spawn O_Soldier_F but with M200 sniper rifle for example, using only 4th param?
code in 7th param executed when? before/after unit appears? I dont want to spawn unit, its gear then replace gear

exotic flax
#

like I said; either make a custom config with the unit you want to spawn (including custom gear), or use a script which is executed after the unit has been spawned

#

configs requires to make a mod though, since it can't be down in missions

spiral fractal
#

ok, Thank you!

#

too bad this info not appear in wiki page... also no info on performance, MP support etc.

exotic flax
#

the wiki explains which parameters are used, what they should contain and what they do... enough to connect the dots IMHO πŸ˜‰

#

if every possible combination of usage has to be written down than every function/method would need its own wiki

spiral fractal
#

I am new to scripting and after reading this page I have left with unanswered questions 😦

fair drum
#

need a syntax check to see if I'm putting this together right.

({alive _x} count units [d1,d2,d3,d4,d5]) == 0

this should check if d1 through d5 groups have anyone alive, and if none are alive, it should give a true value correct?

robust hollow
#

thats not how units works

#
private _index = [d1,d2,d3,d4,d5] findIf {
    (units _x findIf {alive _x}) > -1
};
private _allAreDead = _index == -1;
_allAreDead 

i think this might do it

fair drum
#

well

count units [d1,d2,d3,d4,d5]

should give me the number of units in that array of groups right?

robust hollow
#

no, thats not how units works

fair drum
#

and the example from that page is:

_myUnitCount = count units group player;

it only has an added variable to store that number.

robust hollow
#

yea... so?

#

units takes a group or object as the parameter, you gave it an array.

fair drum
#

so it can really only handle one group at a time the way I'm writing it such as

count units d1
robust hollow
#

yes

#

so for an array of groups you would need to loop through it to check each group individually

#

but using count to do that would keep checking the units and groups, even if it already found someone alive.

#

it would work so isnt technically wrong, but findIf exists on the first alive unit it finds so its a little faster

fair drum
#

so reversing your script you are doing...
creating a local variable named _index which checks if Y is > -1.
and then Y checks to find any alive unit and return how many there are?
using Y as a placeholder

robust hollow
#

not exactly

#

the first findIf loops through the groups array.
the nested findif loops through each unit of the current group.

if the nested findif finds an alive player, it exits and returns the index it was on for units _x.
> -1 is to say if findIf returned any valid index at all. so if it did, someone was alive.
same goes for _index == -1. It checks if the first findIf returned an index for a group with a unit alive. If it didnt, everyone is dead.

You dont need to assign the first findIf to a variable like _index, i did for readability, same as _allAreDead.

fair drum
#

alright I'm going to stew over this for a little bit and see if it sinks in. I hope you guys don't mind me asking probably basic questions for you. I've been reading all the wikis and watching as many videos as I can to learn this stuff and I don't like taking other people's scripts cause then I actually never learn anything

robust hollow
#

i wouldnt trust videos. Things should start to make sense easier if you understand the format of how sqf is written. I suggest you read this page
https://community.bistudio.com/wiki/SQF_syntax
and then read individual command pages as you need them.

opaque snow
#

Is it posible to place a mission script in fx "Arma3\Scripts" and then load it from a mission?

slim oyster
#

The edit terrain module's door locking var does not set globally, and is only executed on the server? Are there workaround for this in the editor or what do people do for workarounds for this functionality from the module settings?

#

I am trying to workaround it by searching for the existing vars in a format loop and then resetting them as public, there must be a better way... ```sqf
[
hanger1,
hanger2,
hanger3,
hanger4,
hanger5,
hanger6
] apply {
private _building = _x;
for "_id" from 1 to 20 step 1 do {
private name = format ["bis_disabled_door%1", _id];
private _doorVar = _building getVariable [_name, nil];
if (_doorVar isEqualType 0) then {
_building setVariable [_name, _doorVar, true];
};
};
};

fossil yew
#

Hi. Does anyone know how to display Old Man style mission title?

warm hedge
#

What title? Intro screen?

fossil yew
#

@warm hedge - i'll send you on PM a picture since it's not allowed here as far as I can remember.

warm hedge
#

No

opaque snow
#

Hi guys, i want to call a script from outside the mission folder, but it cannot find it. is this even possible? ive set the path like this: "C:\Arma3_server\Scripts\Rang\Rang.sqf";

fossil yew
#

No what?

warm hedge
#

So you don't want the answer?

#
_title = "Thing you want to show";
[parseText format ["<t font='PuristaBold' size='1.0' color='#f2a832'>%3</t><br /><t font='PuristaMedium' size='1.25'>%1</t><br /><t font='PuristaMedium' size='0.85'>%2</t>",_title, Localize "STR_A3_OM_System_Intel_DiaryUpdateNotification", Localize "STR_A3_OM_System_Intel_DiaryUpdateTitle"], true, nil, 7, 0.7, 0] spawn BIS_fnc_textTiles;
playSound "Beep_Target";``` in `a3\missions_f_oldman\systems\scripts\intel.sqf` @fossil yew
fossil yew
#

Thank you. Sorry for tagging you several times, I don't know a better way here.

warm hedge
#

Just use external services. This is just for anti-spam

#

You know what things to change the words New Intel and Diary was updated, change things in format

fossil yew
#

Yeah, I do.

modern adder
#

Hi, is it possible to detect all bullets which land within a 50m radius of the player and find the unit who shot them?

warm hedge
#

I don't think so. There's no EH to detect a bullet has landed nor landed near

modern adder
#

Is it possible to detect bullets at all?

#

Are they even an object?

warm hedge
#

They are indeed, but it's not possible to detect to land in performance-friendly way IMO

#

Since if a bullet has landed somewhere, it's objNull anymore and you can't detect with nearestObject or such commands

modern adder
#

What about when they're passing through the air?

#

findNearestObject?

warm hedge
#

Maybe

modern adder
#

Would probably kill performance to run it so often though haha

warm hedge
#

Indeed

modern adder
#

No

warm hedge
#

Oh

modern adder
#

But that could help?

#

I'm trying to make a dynamic music mod actually

#

Based on combat

warm hedge
#

Maybe? I don't think I've ever tried the thing

modern adder
#

Has laxemann got a github?

warm hedge
#

IDK. Maybe?

modern adder
#

would I be violating anything if I debinarised his source and took a look?

warm hedge
#

I do believe looking itself won't, but if you're in doubt, confirm before take a shot

modern adder
#

Ok, cheers

viral basin
#

Hey there, is it possible to delete the "customMark"-Marker with a command? We're currently working on a custom map and unfortunately it's not possible to delete it by using "DEL"...

winter rose
#

You… can?

viral basin
#

i tried, i can't πŸ˜‚ or do you mean the command?

winter rose
#

@viral basin what exactly do you mean;
Delete a hand-drawn marker with deleteMarker, delete a marker with the del key, something else?

viral basin
#

Yeah but the custom marker, the one you set with (LShift + LMB), is not deletable with deleteMarker

warm hedge
#

It's impossible AFAIK

sudden breach
#

you mean the personal waypoint? if you don't want that you can turn it of in the settings

#

your own you can delete with delete on the map not remotely afaik

viral basin
#

hmm okay, i guess i have to do a workaround then πŸ˜…

sinful axle
#

Hey, I have a really noob question. I'm trying to use the countSide function to count units in a trigger area. Following the exact example on the wiki yields an error. Just for reference I used _numunits = west countSide list _trigger1;

#

Where trigger1 is the variable name of the trigger

#

Am I doing something wrong?

#

I put a 3 second sleep beforehand to make sure the trigger has enough time to initialise

winter rose
#

trigger1, not _trigger1 @sinful axle

sinful axle
#

Oh, so it needs to be global... I'm an idiot.

#

Thanks.

winter rose
#

it doesn't need to be global, but if you named your trigger trigger1, that is the name you should use

spice vigil
#

What's the best way to execute another sqf within a sqf (let's say to start a sound loop sqf while the main sqf script continues to run). Is it just: ** exec "example.sqf"** ? (just making sure I do the right one).

winter rose
#

if you use it once, yes

#

if multiple times, the ideal way is to make it a Function (see CfgFunctions)

spice vigil
#

I'll only be calling it once but because this is going to be a sand alone mod I don't want it to kill peoples servers when it just plays a sound on loop, haha.

#

Thanks for the answer. πŸ˜„

sinful axle
#

Thank you Lou, that explains it.

slim verge
#

@spice vigil the call is dependant on whether you want to function/script you are calling to run parallel to the function/script it is been called from
For example it is being called

Myscript
Line 1
Line 2
[] call MyTag_myscript;
[] execVM "myscript";
[] spawn{some code eg [] execVM...}:
Line 3

In the call and execVM which runs in line, eg in the same thread, Line 3 will only run after the called function or ExecVM script has finished,
whereas the spawned code will run seperately (In parallel)on a different thread

#

in your example, i would say spawned is the best way forward

spice vigil
#

Hold on, I'm very rusty so I need to process this. So in your example that would execute another sqf script and they would run alongside each other? (with the spawn command)

slim verge
#

well it depoends if you call, execvm or spawn

#

spawn runs parallel yes

#

spawn = start another thread and run code in that thread

#

whereas execVM and call = wait until i have finished these scripts, functions before you continue with the script I am running at the moment....

spice vigil
#

Okay, cool. Once thing I am a little confused on (more wanting to double check) is the fnc you are calling. Do you ExecVM the FnC you make in the CfgFunctions* or do you just call the file name (wherever it may be)?

slim verge
#

hopefully that explained it correctly

#

ok your thinking about cfgfunctions

spice vigil
#

wait I copy pasted wrong cfg I mean CfgFunctions (edited above)

slim verge
#

so cfgfunctions is a way of defining a script as a function, there are other ways
Example

TXU_MyFunction = compileFinal preprocessfilelinenumbers "fn_MyFunction.sqf";
compared to [] execvm "fn_MyFunction.sqf";

The difference is
You define (compile) a functionion normally before you need to use it (E.g call it). This function is then stored in memory and when you call it you are calling it direct from memory meaning it runs faster, so if you intend calling a any code more than once, its better practice to compile it as a function.

ExecVM on the other hand is compiled and run at the same time EVERYy time you call it

calm bloom
#

Hello, gentlemen! Does anyone know if the addPublicVariableEventHandler is JIP syncronized or not? Should i add it for client every init?

#

To be more specific, should i place it in initplayerlocal.sqf or may be i can use it in init.sqf and rejoined client would still track PublicVariable EventHandler

robust hollow
#

effect local says the wiki, so you need to execute it on every client

#

putting it in either file would work.

calm bloom
#

thanks, ill give it a try. Frankly, i forgot to google it beforehand

spice vigil
#

To be honest Terox, my head hurts, haha. I think I understand the spawn command now though. You mind if I PM you with some questions if this doesn't work? (clog up the chat less).

slim verge
#

@spice vigil everyone in here is learning any questions / answers benefit all m8

winter rose
spice vigil
#

No worries, I'm always scared I'm asking too many questions, haha.

#

I've decided I want to spawn a fnc from my CfgFunctions in my config.

slim verge
#

I would say there are 4 main areas you need to learn really well in order to improve your scripting.

  1. Understand the syntax and information in the comref which details the parameters used in each command and their scope, as in where they need to be run and what effect that has on other connected machines
  2. Understand Variables, _local, Global and Public Global which Lou just linked you to
  3. Know how to debug your code so that you can return the variables you are using to either the rpt file or system, side global chat or hint.
    This may help you with that https://forums.bohemia.net/forums/topic/166233-zeu-debugging-tutorial-foundation-template/

and
4) How to ask a question in here thaty is likely to get an answer

To expand on 4
How do I write a script tto do ABCDEFGHI
will likely get you nothing

whereas asking a more specific question like you did earlier and in some cases displaying your efforts to debug
will likely get you a decent answer.

Taking that into consideration there are some answers I have seen in here that display a lack of understanding from the person answering the question as to how little understanding the person asking the question has.... Typical arrogance of someone who assumes everyone is a professional coder . (I am a gas fitter, i have just learnt what I have over many years of working with BIS scripts)

#

if you take a look at the thread I linked you to, it shows a debug of linear code being called within linear code

eg

"------ PARAMS ------ fprocess_params ------> START : @ 4439.84"
"------ PARAMS ------ fset_params ------> START : @ 4439.84"
"------ PARAMS ------ fset_params ------> END : @ 4439.84"
"------ PARAMS ------ fprocess_params ------> END : @ 4439.84"

so frocess_params was called
While it was running, it called fset_params internally
fset_params runs then ends
fprocess_params then continues to run to its end
this was like

fprocess_params...
line 1..
[] call fset_params
//// fset_params finishes
line 2
///fprocess_params finishes

spice vigil
#

Thanks for all the help and info (I'll get into when I have time). I'm a historian in real life, I don't even like scripting. I've only learnt what I have for this one sqf in my mod pack, haha.

slim verge
#

its just another skill to add, all skills are worth that

spice vigil
#

I really do appreciate the help.

slim verge
#

np πŸ™‚ we have all been here

#

i swtill get stuck

spice vigil
#

Yeah, I'm a complete idiot. My script was fine, I just didn't put [] in front of the spawn command. I apologise.

winter rose
#

yeah, call doesn't need them, spawn does
(but that does not make you an idiot)

spice vigil
#

Again big thanks. My mod is almost ready after all this time, haha.

oblique arrow
#

mod pack 9Apeek ?

sinful axle
#

Again with the beginner questions. If I have a while loop contained within []spawn will I need to make all variables outside of it global if I intend to use them in the while loop, even if they're in the same script?

winter rose
#

what @oblique arrow means is that it is forbidden to pack multiple mods (you don't own/make) into one, @spice vigil

#

@sinful axle yes, see above link (variable scope)

#

(or pass them as reference)

spice vigil
#

Sorry, I mean "Mod" as in my mod. all contents 100% made and owned by me.

oblique arrow
#

Note that you arent allowed to upload anything you dont own to the steam workshop although having your own repository is usually considered as fine

#

ah oki

sinful axle
#

Thank you!

spice vigil
#

Reading through the wiki on global variables I've noticed the publicVariableServer and publicVariable. I might be reading it wrong but do I need to add publicVariableServer to my sqf script if my mod is going to be used in multiplayer? Or are they only used if you want the server to have a different variable to everyone else?

still forum
#

do I need to add publicVariableServer to my sqf script if my mod is going to be used in multiplayer
no
Or are they only used if you want the server to have a different variable to everyone else?
no

#

its used for when you want to distribute the value of a variable to other players/machines

spice vigil
#

Okay, I totally just misunderstood it then. Thanks.

quaint ivy
#

is there a way to find the nearest player to an object/position in multiplayer

digital hollow
#

find the nearest units and then check if they are players

winter rose
#

the other way around, take allPlayers and check the distance?

#

more "performance-friendly" I would say πŸ™‚

digital hollow
#

Is near_____ just checking distances of all objects?

winter rose
#

yep

digital hollow
#

ouch.

winter rose
#

you cannot filter by player/playable status - you would "get all" then filter with select

quaint ivy
#

@winter rose Ah yea, I didn't think of that, thanks. I'll just check the 2d distance to each player and return the one with the lowest value.

still forum
#

Is near_____ just checking distances of all objects?
no

rough dagger
#

Hello fellows. I am using the vanilla vehicle respawn module in my mp mission, and I often find the vehicle does not actually respawn on destruction. I am running a script from the expression field (that sets the vehicleName and a few other things linked to that particular vehicle). Are there things to avoid when using this module? I don’t even know if using an expression has any impact, but that’s all I can think of. It’s an intermittent issue :/

#

Anecdotally I have heard people say they prefer homemade solutions .. but I’ve never been clear why. Cheers

fair drum
#

which modules are you running? just vehicle respawn or vehicle respawn sync'd respawn tied to that vehicle respawn?

rough dagger
#

Nothing complicated .. the main offender is non vanilla mh6.. and is the only vehicle linked to the module.

#

I guess I could do my own check (if the heli does not exist, then spawn it in, and check that every 30 seconds or something).. but I would have thought the vanilla modules are more robust πŸ™‚

#

Which is why I am wondering if it’s somehow a problem if my own making

fair drum
#

without the expression field I find they work fine for the basic level I'm using them for (maybe try them stock?). maybe someone else more experienced can help you further.

rough dagger
#

Yeah I think I had better results when they just respawned something ... I think I only started seeing issues after using the expression field. But maybe it’s nothing to do with that πŸ€”

spiral fractal
#

BIS_fnc_spawnEnemy returns array? how to add it to addToRemainsCollector?think_turtle

winter rose
#

addToRemainsCollector takes… an array @spiral fractal

digital hollow
#

Is near_ just checking distances of all objects?

no

Is there a point where eg with 80 players allPlayers would be worse than a radius 5 near__?

still forum
#

probably

spiral fractal
#

when I do: addToRemainsCollector [player, player, opfor, ["O_Soldier_F"], 16, 1, {}] spawn BIS_fnc_spawnEnemy; enemies dont spawn

still forum
#

yep

#

you need to pass parameters to BIS_fnc_spawnEnemy, you are passing nil

spiral fractal
drowsy axle
#

Is there a command to check if someone has Zeus access?

#

Doesn't seem to have anything here ^

spiral fractal
#

how to make it work then?

#

where is the array? when I check the value of the result I get BIS_fnc_spawnEnemy inside

winter rose
#

you need to call the function

#

also, you should use ( ) around it

#

or use a temp variable

spiral fractal
#

I have global var DBG in init, I store the result there

#

if I call spawnEnemy my game crash

winter rose
#

actually, this function does not return anything

spiral fractal
#

😐

#

I thought so

winter rose
#

from the sqf:

Returns:
ARRAY - list of all spawned crows
I guess it's a bad copy-paste

there is a while-true in it, and there is absolutely no spawn or return value anywhere

spiral fractal
#

you have sqf of this function?

winter rose
#

in the game yeah

#

under the Debug Console, "Function Viewer"

spiral fractal
#

oh, I didn't knew about it blobcloseenjoy

#

Thank you!

#

I will try to find it there

winter rose
spiral fractal
#

Thank you!

#

it seems that this function has no end condition...

raven harbor
#

So it's possible to remove turrets from vehicles through the use of function scripts, but is it possible to add a different turret to a vehicle? Say I wanted to add the bardelas turret to the Rhino MGS and make a wheeled SPAA, would that be possible?

winter rose
#

physically, no
weapons fired, yes

raven harbor
#

Ah okay

spiral fractal
#

can devs fix functions when they release patch?

winter rose
#

yes, but which function?

spiral fractal
#

most of them probably... spawnEnemy has undefined variable for example, also no end condition

winter rose
#

no end condition is not an "error" per se
the undefined variable has been reported and is already fixed in the next patch

spiral fractal
#

I think there should be end condition...

winter rose
#

I agree, but that's not an error in itself

also, if they fix this… everyone that used this function should edit their mission

#

retrocompatibility is the main priority. poor design sure, but not broken function

#

you can still make your own with spawnUnit and stalk!

spiral fractal
#

well... πŸ˜”

exotic tinsel
#

i have a custom ui with a map control in it, but we cant click on tasks to see description. how can i fix that?

waxen cosmos
#

Theory crafting away from pc- I think this should work: if ({player distance _spawnpoint>5} count all players <1) then (_spawnpoint deleteAt floor random {count _spawnpoint})

_spawnpoint is an array of random locations a player can spawn in but only if there are no other players spawning there, it's selected by select random

winter rose
#

```sqf please
also, player distance _spawnpoint will always use the same unit, player - use _x

waxen cosmos
#

_spawnpoint = [respawn_0, respawn_1, respawn_8, respawn_9] call BIS_fnc_selectRandom;

if ({ _x distance _spawnpoint >5} count allPlayers <1 ) then (_spawnpoint deleteAt floor random {count _spawnpoint});

player setPos (getPos _spawnpoint);

On further thought count _spawnpoint may fail as it isn't returning a number is it..meowhuh

winter rose
#

```sqf, and break your code in smaller pieces

also, then {}, not ()

winter rose
#

@waxen cosmos basically, what do you want to do?

spiral fractal
#

linkItem is 100% AG EG?

winter rose
#

…79% actually

spiral fractal
#

I run function on server, and pass player to it, inside the function I do _player linkItem "B_UAVTerminal"; and its not working

#

this line works _player setVariable ["nc_role", _roleId, _playerID] in that function

#

ah wait I think I have other error that cause it 😳

winter rose
#

always script with the -showScriptErrors flag!

spiral fractal
#

I forgot to change switch cases when I refactored my code 😐

#

seems to work now (SP)

slate fulcrum
#

@winter rose I'm testing again today and it seems like you can probe units (soldier meat) and the script does seem to work on them, but I haven't been able to make it work on objects