#arma3_scripting

1 messages · Page 637 of 1

hallow mortar
#

the first time I did this it was for a much more complex system, where the searchlights would track with the gunner of the vehicle I attached them to, and you could turn them on and off. It took a bit of work but it was working perfectly. Now I take that functioning system and make it much simpler and it doesn't work :U

willow hound
#

Have you tried with doTarget?

drifting sky
#

execVM is only compiled the first time a sqf is called right? Things like #include only happen once, when it is first compiled, correct?

hallow mortar
winter rose
#

doWatch/doTarget/glanceAt, but yep

robust hollow
hallow mortar
#

oh, damn it. I remember now. I need to add a fake weapon. This was the problem last time and I forgot about it because it wasn't in the main script.

winter rose
#

true, I remember nao!

hallow mortar
#

I wish they'd just make everyone's lives easier and add the fake weapon to searchlights by default

#

Okay, with that in place it will now track the dummy cube. But the advanced target selector seems to have some trouble.

#
_lightTarget = [allPlayers,_light] call BIS_fnc_nearestPosition;

with this in place rather than the cube target, it kind of freaks out a bit, snapping instantly between dead-centered and a slightly different angle (but clearly not the right angle) every time the loop runs.

drifting sky
#

Arma2OA. I'm loading an array from hpp file, using #include. I make modifications to the array, and want to save those changes so that they can be used later in the mission. However, when trying to access the same array later, I only get its configuration as it existed in the hpp file. Any ideas for a workaround?

#

Not talking about saving to disk

little raptor
#

you didn't use the updated code

#

copy it again

robust hollow
little raptor
#

then update it

sharp skiff
#

im pretty sure i dit let me check

drifting sky
#

Hmm, can I scan the contents of the hpp file to deterimine what it contains?

#

it might contain multiple arrays

little raptor
little raptor
#

you're inserting the same variable over and over again

#

back to square 1

#

save it to a global variable when you first load it and modify that
this

#

in other words, call compile the script and save the result

#

before that script

drifting sky
#

Let me detail why I'm trying to do. First, I'm no longer using execVM, but instead i've included all the functions in the init file, and I'm "call"ing them now. And you can explain why it's not working. I compose a string as a combination of multiple sub strings. I then missionNamespace getVariable that_string. If the string !isNil, then I read the contents of the array in that variable. I make some changes to the array, and safe it using missionNamespace setVariable [that_string,new_value].

#

However, when using getVariable again on the same variable name, only the original value of the array is returned

little raptor
#

If the string !isNil
you mean the variable isNil ?

hallow mortar
drifting sky
#

I mean if the variable is not isNil

drifting sky
#
    _positions = missionNamespace getVariable _positions_name;

    _positions_name = (str text NEAR_HOUSE_TYPE) + "_positions";
    missionNamespace setVariable [_positions_name,_positions];
#

There's the code I'm using to try to get and set the variable

sharp skiff
#

@little raptor i had still echos

#

but with playsound3D Narg 😑

#

just replace the 3 line with _dummy say3d ["acdc",100,1,false,0]; right?

little raptor
#

yes

little raptor
sharp skiff
#

noe

#

wait

little raptor
#

you just read it, then save it!

drifting sky
#

Sorry, yes I am. I cut out stuff in the middle.

sharp skiff
#
params ["_target", "", "_actionId"];
_dummy = "#particlesource" createVehicleLocal ASLToAGL getPosASL _target;
_dummy say3d ["acdc",100,1,false,0];
_target removeAction _actionID;
_target addAction ["AC/DC", {
  params ["_target", "", "_actionId", "_dummy"];
  deleteVehicle _dummy;
  _target removeAction _actionID;
  _target addAction ["AC/DC", "acdc.sqf"];
}, _dummy];
``` @little raptor  thats the full code right now
little raptor
#

looks good

sharp skiff
#

some how still the same issue

#

is deleteVehiclelocal a thing?

little raptor
#

no

sharp skiff
#

cause it got that feeling that the dummy isnt deleted

little raptor
#

and even if it was what's the point

sharp skiff
#

it doesn´t create new (or more) addactions in the menü/objekt but still plays the same song while starting a new one!

little raptor
#

you don't get any errors right?

sharp skiff
#

no

#

that makes it so weird

#

if there would be no dummy i should get an error cant find dummy right?

little raptor
#
params ["_target", "", "_actionId"];
_dummy = "#particlesource" createVehicleLocal ASLToAGL getPosASL _target;
_dummy say3d ["acdc",100,1,false,0];
_target removeAction _actionID;
_target addAction ["AC/DC", {
  params ["_target", "", "_actionId", "_dummy"];
  deleteVehicle _dummy;
  _target removeAction _actionID;
  _target addAction ["AC/DC", "acdc.sqf"];
}, _dummy];
#

try this

#

tell me what it prints in the chat

sharp skiff
#

sec

#

1780217:<noshape>

#

but

#

uhm

#

now the music stops

#

if u start it again the number increases around a few numbers

#

but it works ass intended just with the message

little raptor
#

so there wasn't a problem in the first place

#

I removed that bit again

#

so no messages anymore

sharp skiff
#

and it works

#

what it that witchcraft?

little raptor
#

I didn't change anything

sharp skiff
#

yeah

#

i see that if i go back in notepad++

drifting sky
#

OK, it is working now. I am able to reset the variables. It might have been that I was forgetting to actually save them.

little raptor
#

you were doing it wrong

sharp skiff
#

in what regard

little raptor
#

dunno

sharp skiff
#

each change i went fully back to the editor and reloaded the mission with play mp

#

or restated the mission

#

so to say

little raptor
#

probably never saved the file

sharp skiff
#

did otherwise notpad would give me a red icon telling me that is has been changed but not saved!

hallow mortar
#

Searchlight update.
The light's janky movement was caused by being attached to the building. This is apparently unnecessary and only screws up its tick rate.
The target position doesn't seem to update even though the script is looping. It looks at where I was at the start, but doesn't follow if I move.
Current code:

params ["_light"];

[_light,["SEARCHLIGHT", [0]]] remoteExec ["addWeaponTurret",_light];

[(gunner _light),["SearchlightOn",_light]] remoteExec ["action",(gunner _light)];

while {true} do {

    _possibleTargets = (vehicles select {typeOf _x == "C_Hatchback_01_sport_F"});
    
    _lightTarget = [_possibleTargets,_light] call BIS_fnc_nearestPosition;
    
    [(gunner _light),_lightTarget] remoteExec ["doWatch",(gunner _light)];
    [(gunner _light),_lightTarget] remoteExec ["lookAt",(gunner _light)];

    sleep 0.01
};```
note: switched to tracking the car as it seemed to be having trouble with the idea of players being inside vehicles.
little raptor
sharp skiff
#

i hope so XD Thanks again

#

im still baffled

winter rose
#

hi baffled, I'm dad!

little raptor
#

it never gets old does it?!

sharp skiff
#

😄

cold mica
#

I am trying to play a bunch of sounds 10 times around a trigger called kriek_trig. This is my attempt:

_whistles = ["\krieker\coug_whistle_00.ogg","\krieker\coug_whistle_01.ogg","\krieker\coug_whistle_02.ogg"];

for "_i" from 1 to 10 do {

    playSound3D [
        getMissionPath selectRandom _whistles,
        null,
        false,
        AGLToASL (kriek_trig modelToWorld [
            <placeholder_x>, 
            <placeholder_y>, 
            0]) ]
    sleep 2
    
    }

However, the issue is within the 4th parameter of playSound3D. I want to play the sound at a random RADIUS from kriek_trig, not X,Y,Z position. I want sounds to play at random directions around kriek_trig 200 meters away. How could I do this?

winter rose
#

maths!

cold mica
#

Dear god, no.

winter rose
#

b-but they are gud sometimes!

#
obj getPos [200, random 360];
cold mica
#

Aha, you almost tricked me into doing math.

#

Should I need to convert the getPos into ASL since playSound3D uses ASL format?

winter rose
#

😄
or

private _randomDir = random 360;
getPosASL _object params ["_posX", "_posY", "_posZ"];
private _finalPos = [
  _posX + 200 * sin _randomDir,
  _posY + 200 * cos _randomDir,
  0
];
#

quickmaffs

cold mica
#

I'll try the previous first and see if it works as intended.

winter rose
#

if not, ATL to ASL I believe

cold mica
#

lmao, it crashed

winter rose
#

dang

#

stahp breking ze arma!

cold mica
#

But that's probably my own fault. I'm still testing if this works

#

For some reason, it crashes on index 1. This is my full code.

kriek_trig Trigger
Condition: Any Player
On Activation:

[] execvm "krieker\kriek.sqf";

\krieker\kriek.sqf

_whistles = ["\krieker\coug_whistle_00.ogg","\krieker\coug_whistle_01.ogg","\krieker\coug_whistle_02.ogg"]

for "_i" from 1 to 10 do {
    hint str _i;
    playSound3D [
        getMissionPath selectRandom _whistles,
        null,
        false,
        kriek_trig getPos [200, random 360]
    ];

    sleep 100;

    }

I am not entirely sure what is causing it. RPT just states it to be an "Unknown Module" Fault Address error.

winter rose
#

no log message? cause it… shouldn't crash?

cold mica
#

I am not following, sorry.

robust hollow
#

what is null?

cold mica
#

null takes place for soundSource

winter rose
#

soundSource param, which is ignored if position is provided

cold mica
#

I'm gonna run a test with playSound exclusively to see if it is a logic error somehow.

winter rose
robust hollow
#

ok, but specifically null is looking for a global variable, so it would most likely be nil. shouldnt you be using objNull?

winter rose
#

good catch xD too much JS on my side

cold mica
#

there is no null in SQF?

robust hollow
#

not as null

cold mica
#

that makes sense

winter rose
#

on the contrary, there are plenty of nulls

spark turret
#

theres nill

winter rose
#

objNull, grpNull, taskNull, etc

spark turret
#

and a null type for every data type

cold mica
#

Let's see if objNull could help with the crashing

spark turret
#

explai?

cold mica
#

Unfortunately, it still crashes.

#

I will explain, give me a second.

spark turret
#

🥚 🇳🇱

#

eggs plain

cold mica
#

kriek_trig Trigger
Condition: Any Player
On Activation:

[] execvm "krieker\kriek.sqf";

\krieker\kriek.sqf

_whistles = ["\krieker\coug_whistle_00.ogg","\krieker\coug_whistle_01.ogg","\krieker\coug_whistle_02.ogg"]

playSound3D [
    getMissionPath selectRandom _whistles,
    objNull,
    false,
    kriek_trig getPos [200, random 360]
];
#

Can .ogg files crash arma 3?

#

cause I made the .ogg files myself in Audacity

spark turret
#

hm i dont think oggs are a problem.

#

made some myself and it worked fine

#

you dont need getMissionPath

robust hollow
#

the wiki says you do

spark turret
#

instead you need to register them in a config iirc

robust hollow
#

    playSound3D [getMissionPath "mySound.ogg", player]; // to play a mission directory sound
spark turret
#

ah alright then

robust hollow
#

example 3

cold mica
#

Can playSound3D play sound classes in CfgSounds?

spark turret
#

the object for playsound3d is ignored if you give a valid position in param 3

cold mica
#

yes, thus I just put objNull for it to be ignored

hallow mortar
robust hollow
#

my best guess would be it doesnt like the ogg files. it would only error if there was an issue with the command usage.

winter rose
#

try with only one sound in the array?

hallow mortar
#

.ogg is a perfectly normal file type to use with Arma 3. Use 'em all the time.

cold mica
#

I am going to try using default arma 3 sounds

robust hollow
spark turret
#

have you tried playing it from the debug console?

cold mica
#

Something simple like

_whisles = ["A3\Sounds_F\sfx\blip1.wav"];
playSound3D [
    getMissionPath selectRandom _whistles,
    objNull,
    false,
    kriek_trig getPos [200, random 360]
];

Should work 🤞🏿

spark turret
#

your array has a spelling error

#

_whisles

cold mica
cold mica
spark turret
#

arma uses a special hz thing (audacity settings), otherwise it might change the pitch or sth?

cold mica
#

omg, it crashes when I run the previous code block in debug!

spark turret
#

your complete arma crashes?

cold mica
#

yep, Status Access Violations

spark turret
#

lol rip

cold mica
#

I'm going to try trimming the code down until I find the culprit. I'll just play the sound at sound source now.

#
_whistles = ["A3\Sounds_F\sfx\blip1.wav"];
playSound3D [
    getMissionPath selectRandom _whistles,
    kriek_trig
    //false,
    //kriek_trig getPos [200, random 360]
];
#

Even this crashed. That could only mean it has nothing to do with the script but with the mods that I have running. I'll just look for another way to achieve my idea. Thank you fellows for your help nonetheless!

winter rose
#

try without mods maybe? in Eden, VR world?

cold mica
#

Perhaps next week. I made the mistake of doing this before the start of my op and I only have 30 minutes left 🙈

robust hollow
cold mica
#

woops, youre right

#
_whistles = ["A3\Sounds_F\sfx\blip1.wav"];
playSound3D [
    selectRandom _whistles,
    kriek_trig
    //false,
    //kriek_trig getPos [200, random 360]
];
#

one last test

#

Hey, it doesn't crash!

winter rose
#

lul ^^

#

but it shouldn't crash, just return ""

#

Dedmeeen?

robust hollow
#

this is why i think it was something to do with the ogg files. was your path correct?

cold mica
#

All of my sounds and script are located in the "krieker" folder within my mission directory.

#

It only seems to crash when I use getMissionpath in the 1st parameter

robust hollow
#

put the blip sound in your mission and test it

cold mica
#

Indeed I did, I put it in in debug console, it didn't crash but I didn't hear a sound either.

robust hollow
#

you testing in editor?

cold mica
#

Yes

robust hollow
#

perhaps it doesnt like absolute file paths (C:\...)

cold mica
#

I will attempt a test but without the \krieker\ path, just the filename only.

#

Something simple as below still crashes

playSound3D [
    getMissionPath "coug_growl_00.ogg",
    kriek_trig,
];

So you must be right, the ogg files are badly encoded or in the wrong Hz. I don't have time to fix them today so I will delay this idea to next week for my unit.

robust hollow
#

when you try again you should test without using getMissionPath in editor. just use the paths like you had in the array and see if that works.

cold mica
#

it was a mistake in the copy paste. I did remove it during the testing.

winter rose
#

okido 🙂

drifting sky
#

ARMA2 is there a built-in command to return all objects of a type within a marker area?

winter rose
#

nearestObjects, allMissionObjects ?

drifting sky
#

Well, I used nearestObjects, and then forEach of those, I transformed their position into marker space and checked if they were within the height and width of the marker.

exotic flax
#

The following should give a list of all objects with type "Object" or "Type" within the marker "markerName". Only works with a round marker though.

_objects = nearestObjects [getMarkerPos "markerName", ["Object", "Type"], getMarkerSize "markerName" select 0];

In Arma 3 there's inArea, but obviously won't work in Arma 2

astral tendon
#

were the hell is the gui editor saved? it never founds my config path

drifting sky
#

arma2OA. During a mission, I'm not able to create units of a faction, unless at least 1 unit of that faction is placed in the mission editor (even at 0 probability of presence). Is there any way around that?

robust hollow
#

does a group for that side need to exist first? iirc there is something old in a3 files about initialising sides.

drifting sky
#

That allows me to create units for a faction. However, when creating east units, they are not enemy to west.

#

nevermind, just saw the entry in the wiki

drifting sky
#

what "type" do wall objects belong to?

robust hollow
#

"Wall_F" maybe

#

probably not _f in a2

drifting sky
#

I tried Wall and Wall_F. Neither worked

#

Is there a function to return an object's type?

#

not class

little raptor
little raptor
astral tendon
#

But that alone is worthless and give error for undefined

astral tendon
#

not at all

cosmic lichen
#

Explain your issue then.

little raptor
#

you should define the base classes

#

if you're on dev, use import

cosmic lichen
#

I guess I should update the user interface page with an example

little raptor
#

yeah

#

what was that function you once mentioned?
the one that exported the basic classes from the config

astral tendon
#

1: the format saved with ctrl+shift+s is worthless and no example is given for proper use of it
2: we can save it in that editor but its seems it just goes to the shadow realm

cosmic lichen
#

It's saved to UI namespace, thus restarting the game will wipe that data IIRC

#

Shift + CTRL + S, copies the gui in config format to the clipboard

little raptor
#

@cosmic lichen

what was that function you once mentioned?
the one that exported the basic classes from the config
?

cosmic lichen
#

BIS_fnc_exportGUIBaseClasses IIRC

little raptor
cosmic lichen
#

You don't need that functions. One can also press CTRL + S and select Base Classes.

viral tangle
#

Hello is there any way to find out who put things in the weapon holder? And then sort them by owners

robust hollow
#

unless you add ur own tracking of who put what where, i dont believe so.

viral tangle
#

Thx

wary hill
#

What class name should I use instead of "CAManBase" in order to return closest BLUFOR unit to the player? (player is OPFOR)

_cntClosestEnemies = nearestObject [player, "CAManBase"];
hint str _cntClosestEnemies;
little raptor
#

There is no such class.
You can try B_soldier_F, but note that not all BLUFOR units come from that class.

astral tendon
#

you can filter side

little raptor
#

The best thing to do is to filter through a list of units by side

wary hill
#

Ok, and how do I do so?

little raptor
#

nearestObjects and select

#

Or findIf if you need just one unit

#

There is also allUnits, which could be faster (not sure)
But you'd have to sort it too

wary hill
#

I'm looking at the wiki now and I still cant find a way through filtering via "nearestObjects and select". General idea is that I'm trying to return distance to the closest enemy and execute a code when it'll be < 700m. I was planning to do so via nearestObject and then distance2d, but I can find a way to return closest enemy. Could you explain little bit more about "nearestObjects and select" please?

finite jackal
#

private _nearestManUnder700 = (nearestObjects [player, [“CAManBase”], 700, true]) select {side _x isEqualTo WEST} select 0

queen cargo
#

nearestObjects [...] select { side _x == West }

real tartan
#

how can I filter Ghillie Suits from uniforms ? is there some config I can check, or do I need to create an array of uniforms ?

private _uniforms = ["U_B_GhillieSuit", "U_O_GhillieSuit", "U_I_GhillieSuit"];
if (uniform _unit in _uniforms) then { ... };

I want to support also mods, so I don't need to define array for every mod

winter rose
#

well, there is not really a config entry in uniforms stating hasBranchesAndLeaves = 1 sooo maybe you could use find in the uniform's name to see if it contains ghillie?

real tartan
#

yeah, some modded ghillies have different name classes

cosmic lichen
#

is there some kind of camouflage coef defined in config?

real tartan
#

^ my question, tho

winter rose
#

it might also be a skimpy catsuit that has an excellent night time coefficient 😄

cosmic lichen
#

😄

real tartan
#

maybe configfile >> "CfgWeapons" >> "U_B_GhillieSuit" >> "ItemInfo" >> "uniformClass"

#

uniformClass = "B_sniper_F";

real tartan
#

idea to get all ghillie suits (with modded)

private _all = "getnumber (_x >> 'itemInfo' >> 'type') isEqualTo 801 && getNumber (_x >> 'scope') > 1" configClasses (configfile >> "CfgWeapons") apply { configName _x };
private _list = _all select 
{
    private _config = toLower _x; 
    ["ghillie", "sniper"] findIf { [_x, _config] call BIS_fnc_inString } != -1 
}; 
copyToClipboard str _list;
spark turret
#

If you know the mods, an array is eaiser. 10 mintues looking through ace arsenal. There isnt terribly many ghillies usually

zinc rapids
#

I'm having an issue (please at me as I have the server muted) but for some reason, my code isn't working properly... and I don't know what to think about this

#
if {false} then {
    hint "I Ran";

};

is returning as Error if: Type Code, expected bool

finite sail
#
    hint "I Ran";

};```
#

wrong bracket type

#

@zinc rapids

zinc rapids
#

Whoops, I copied it wrong

#

Wait, no that should work for SQF

#

right?

finite sail
#

you cant have curly brackets surrounding the outer test of an 'if'

#

must be round brackets

zinc rapids
#

I swear I am remembering this wrong then

finite sail
#

yep

zinc rapids
#

Is it the while loops?

#

yup

finite sail
#

yes, and waitUntil

zinc rapids
#

I swear this language hurts my insides more and more

finite sail
#

if it hurts, you know its doing you good, as my granny used to say

#

she's dead, obv

real tartan
spark turret
#

yeah, dynamic finding is better if you have a variable mod setup. but its also prone to missing a ghillie that has an effed up config.

real tartan
#

well, also if modder decide to rename classname, f*** me right ? 😄

spark turret
#

Yeah or it looks like a ghillie but has no camo value or sth

#

There is no protection against poopy mods

neat sage
#

am not sure if this falls under scripting, but is there any way to modify the behaviour of the EG Spectator cam/mode?

#

like changing the distance at which unit name is displayed instead of squad name, placement of tags, editing name/tag layout etc.

#

can't find anything in the wiki

sharp skiff
#

i got a issue if i host a server via arma client i got a addaction to change the daytime as init on a object ```sqf
this addAction ["day",{setDate[2035,6,24,12,00],hint "Es werde Licht!"}]; this addAction ["night",{setDate[2035,6,24,22,00],hint "Bravo six going dark!"}] ;

#

but it only works if the Host presses it not the clients

#

and ideas

#

(self hosted via client btw.)

still forum
#

Clients' local date is automatically and periodically synchronised with the server date
you are changing the local date, that means the server will reset it

sharp skiff
#

arh second line im blind

#

so basicly remoteExec infront?

still forum
#

I think so yeah

#

like shown on the wiki page

sharp skiff
#

its confusing for me so i should besqf [[2035,6,24,12,00]] remoteExec ["setDate"];; instead of ```sqf
setDate[2035,6,24,12,00];

grim coyote
#

Yes, but you still need to define the target

sharp skiff
#

global so all player! how do i do that?

grim coyote
crude needle
#

Are DLC checks tied to just models?

Wanted to include DLC exclusion in a mission and a command like getAssetDLCInfo returns Apex for the AK-12s added in Contact for instance.

still forum
#

"DLC exclusion" ?

crude needle
#

Spawning items at random and want the option to exclude classes from the list if they are part of a certain DLC.

still forum
#

not just models, but models too

crude needle
#

Thanks

sharp skiff
#
this addAction ["Tag",{[[2001,6,22,12,0]] remoteExec ["setDate"];,hint "Es werde Licht!"}];

#

gives me invalid number in expression

#

this addAction ["Tag",{[[2001,6,22,12,0]] remoteExec [setDate];,hint "Es werde Licht!"}]; missing [

still forum
#

;, 🤔

grim coyote
#
[2001,6,22,12,0] remoteExec ["setDate",0];```
little raptor
#

it should be correct

sharp skiff
#

sec

little raptor
#

remote exec doesn't need a target

still forum
#

@grim coyote the example on wiki shows [[2001,6,22,12,0]] remoteExec ["setDate"];

grim coyote
#

ah, okay

sharp skiff
#

but that gives me an error

#

im testing it now let se what happens

jade abyss
#

"];,hin
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

little raptor
#

shouldn't ;, be correct tho?

jade abyss
#

No, since it's inside the {}

little raptor
#

I don't understand. everything you type is eventually in a { }

jade abyss
#

["Tag", {[[2001,6,22,12,0]] remoteExec ["setDate"];,hint "Es werde Licht!"} ];

little raptor
#

I mean every code

sharp skiff
#
this addAction ["Tag",{[2001,6,22,12,0] remoteExec ["setDate",0];hint "Es werde Licht!"}];
``` didn't work no error but not working !
#

@jade abyss invalid number in expression

little raptor
jade abyss
#

?

little raptor
#

, is another line expression separator like ;

sharp skiff
#

u are one step further then me at least i dont even get the diferrence between {} and[]

little raptor
jade abyss
#

Try executing it

sharp skiff
#

liek u wrote?

little raptor
#

also, you might want to learn some sqf first

sharp skiff
#

might be an idea but then its just for 1 mission im planing to do

#

the rest is nearl zeus only

little raptor
#

I said "some"

jade abyss
sharp skiff
#

some pointers?

#

checking

jade abyss
#

No, not you @sharp skiff

sharp skiff
#

ah ok XD

little raptor
#

I'm not in the game rn, but I'm assuming you're right!

#

but I just don't understand why

#

in case you didn't read that

sharp skiff
#

@jade abyss invalid number in expression no matter were

#

no i didnt thx

little raptor
#

you should understand the "terms" part before any scripting

jade abyss
little raptor
#

but this isn't

hint "a";; hint "b";

and I don't understand why!

sharp skiff
#

but doenst change the outcome

jade abyss
#

It's the same as:

call {hint "a";, hint "b";}
little raptor
#

do you have comments in your code?

jade abyss
#

Will also error out

#

Okay, back to that addAction thingy

little raptor
#

yeah, I'll investigate that later!

jade abyss
#

Does it even add the action to your scrollmenu?

sharp skiff
#

yes

#

the addaction option is not a problem but the execution of the set time

jade abyss
#

Are you trying it in MP?

#

Or Editor/singeplayer?

#

iirc, setDate needs to be set on the Server, if MP

sharp skiff
#

MP editor

little raptor
sharp skiff
#

yes for the set date

#

the addaction works fine but executing it (aka the set time) gives me invalid...

jade abyss
#
this addAction ["Tag",{[2001,6,22,12,0] remoteExec ["setDate",2];}];
#

hm, one sec 🤔

sharp skiff
#

yeah well nope

still forum
#

[2001,6,22,12,0] remoteExec ["setDate",0]; Ignore what Razer told you, use what you used before

jade abyss
#
this addAction ["Tag",{[[2001,6,22,12,0]] remoteExec ["setDate",2];}];

That works for me ☝️ *

still forum
#

this addAction ["Tag",{[[2001,6,22,12,0]] remoteExec [setDate];,hint "Es werde Licht!"}];
This you had, the comma was wrong, remove the comma
this addAction ["Tag",{[[2001,6,22,12,0]] remoteExec [setDate];hint "Es werde Licht!"}];

jade abyss
#

Too slow, already got that.

sharp skiff
#

error missin [ on this addAction ["Tag",{[[2001,6,22,12,0]] remoteExec [setDate];hint "Es werde Licht!"}];

still forum
#

ah

#

oops

#

this addAction ["Tag",{[[2001,6,22,12,0]] remoteExec ["setDate"];hint "Es werde Licht!"}];

#

you give remoteExec the NAME of the command, that means in quotes

still forum
jade abyss
#

Prolly, but it execs anyway. 0 works too, sure. He is just spamming it to everyone, and i assume the Server will send the update anyway later?

sharp skiff
#

this addAction ["Tag",{[[2001,6,22,12,0]] remoteExec ["setDate"];hint "Es werde Licht!"}]; that did work

#

full code right now im testing it with a friend now! ```Sqf
this addAction ["Tag",{[[2001,6,22,12,0]] remoteExec ["setDate",2];hint "Es werde Licht!"}];this addAction ["Nacht",{[[2001,6,22,22,0]] remoteExec ["setDate",2];hint "Bravo six going Dark!"}];

winter rose
jade abyss
sharp skiff
#

leo already gave that to me im on it

jade abyss
#

I know, i quoted him, just to remind you

sharp skiff
plain creek
#

Hello everyone! I need help making so that a players init stays the same even after it respawns. Does anyone now how to do this?

winter rose
#

1/ init fields are baaad
2/ use respawn EHs 😉

little raptor
#

and it threw an error

winter rose
#

SQF

plain creek
#

I used:
this addMPEventHandler ["MPRespawn", {#20 lines of pasted here}];
and it did not work.

winter rose
#
if (local this) then { this addEventHandler ["Respawned", { /* some stuff that might be global or local IDK your code */ }] };
plain creek
#

So is should just put that code into the units init?

winter rose
#

yes, but it also depends on what is the code you put in there

plain creek
#

Just an Addaction that worked locally, before said unit respawned.

winter rose
#

then this should work, if you also add that action in the then block too

finite sail
#

guys, do we know if allowdamage false works on buildings?

winter rose
#

yes, it works!

#

(locally!)

finite sail
#

thanks

plain creek
#

Thanks Lou this seems to be working!

sharp skiff
#

so remoteExec should also work with say3D right?

trail wedge
#

is there a way to get the nearest wheel to an object. lets say a device that shreds a tire on a vehicle to it when activated.

#

cursorobject setHitPointDamage["HitLFWheel",1]; would hit the left front tire, for example, but how to i get HitLFWheel as a nearest object?

winter rose
#

selectionPosition or something like that

spark turret
#

so apparently i can use the startparameter filepatching allowed. what exactly does that do? allow me mess with files during runtime?

#

when do they get reloaded?
i wanna work on a small editor module

#

i feel like thats very basic stuff for developers sorry

willow hound
queen cargo
#

Filepatching mostly allows to use the old style of Configuring a moe

#

Mod

spark turret
#

do i need additional stuff? the CMA:developementsetup mentions an arma 3 p:drive and stuff

little raptor
#

no

trail wedge
little raptor
#

@trail wedge

how to i get HitLFWheel as a nearest object?
it's not an object. It's a selection.
You have to search among the object's selections to get the wheels, then sort them by distance to get the nearest one

trail wedge
little raptor
#

if you don't know how, read:
https://community.bistudio.com/wiki/selectionNames
https://community.bistudio.com/wiki/select (for filtering)
https://community.bistudio.com/wiki/selectionPosition
https://community.bistudio.com/wiki/modelToWorld
for sorting:
https://community.bistudio.com/wiki/apply
https://community.bistudio.com/wiki/sort
(or use the BIS fnc)

will attempt again, however they seem to have different names from selection that their hitpointdamage name.
you can probably get the selection from the hit points config

tiny wadi
#

For a refueling script how often is too often to update the fuel? It's a global command so obviously I would assume thats a ton of unnecessary network traffic if you do it multiple times a second. Should I just calculate the time it'd take to fill and then just fill it once the time is over

spark turret
#

how do i get the array out of a string like this:
"[""A3\Sounds_F\weapons\Explosion\expl_big_1.wss"",""A3\Sounds_F\weapons\Explosion\expl_big_2.wss"",""A3\Sounds_F\weapons\Explosion\expl_big_3.wss""]";
or: how do i directly pass an array from an editor module input box?

little raptor
#

in other cases, you can call compile the string

spark turret
#

thanks that looks just like what i need

#

great, it works. glad that theres a function for it.

cosmic lichen
#

*command 😛

tribal onyx
#

Okay, I've been trying to find a good way to turn a string into an object reference, for an forEach loop.

winter rose
#

ouch in advance

tribal onyx
winter rose
#

what are you trying to do, why are you trying that?

tribal onyx
#

Basically, I've got a bunch of locations where something could be and got tasks and everything set up accordingly, and want to delete a bunch of those "empty" locations once they're not needed anymore

#
    [format["%1_tsk1",_x]] BIS_fnc_deleteTask;
    deleteVehicle [format["%1_sector",_x]];
} forEach _leftover_array;```
#

but deleteVehicle requires an object reference, not a string

winter rose
#

as stated by Dedmen in that very link you provided, use getVariable

tribal onyx
#

but how?

#

so _leftover_array is a bunch of objects btw

winter rose
#

…then WHY using format if these are already objects??

tribal onyx
#

...............

#

.........

winter rose
#
deleteVehicle _x;
```?
tribal onyx
#

oh wait no

winter rose
#
private _obj = missionNamespace getVariable [format ["%1_sector", _x], objNull];
deleteVehicle _obj;
tribal onyx
#

I remember those are not actually the objects I want deleted. So I'm using invisible helper objects as "locations". On those objects I spawn sector modules. Those sector modules is what I want deleted. And they're named x_sector.

winter rose
#

so 0_sector, 1_sector, etc?

tribal onyx
#

so I have an empty helper object named something like location_hills_frini_5 and ontop of that later on, I spawn a sector module, which is kept track of by adding "_sector", so like location_hills_frini_5_sector

#

aaah okay I think I understand what you posted

#

so missionNamespace contains every single object as a variable?

winter rose
#

missionNamespace is the (uhuh) mission's namespace, where theGuysHealth = 1 variables go

#
OneVar = player;
// same as
missionNamespace setVariable ["OneVar", player];
tribal onyx
#

So, missionNamespace getVariable [format ["%1_sector", _x], objNull]; is looking at the mission, and in it for a variable labelled location_hills_frini_5_sector that is an object (with objNull like a stand-in representing like the "concept" of objects)

#

Is that......... sorta correct way to look at that?

crude prism
#

Hello
Hope someone can help a person new to scripting with seeing what is wrong with this piece.
I am trying to get an addAction to work on a mp server. Have gotten it to work in local test, but when running on mpserver i get:
'[ray1] |#|remoteExec "AL_gravity\gravity_generator..' Error remoteexec: Type String, expected Array

this addaction ["Run latest test phase",{[ray1] remoteExec "AL_gravity\gravity_generator.sqf";},[], 1.5, true, true, "", "true", 9, false, "", ""];

winter rose
#

remoteExec takes an array to its right @crude prism

#

@tribal onyx objNull here being a fallback value in case the provided variable name doesn't exist

tribal onyx
crude prism
sharp skiff
#

how can i run that "on activation" in a trigger : ```sqf
[radio, ["acdc", 100, 1, false, 0]] remoteExec ["say3d"];

#

nevermind i forgot an ;

#

i need a ruber ducky :-I

sharp grotto
#

iam a total math noob. what kind of numbers are numbers like this here. 😬
lightnings = 1.02838e-036;

thats what i get when i check certain weather parameters on the client side

warm hedge
#

Ever heard of scientific notation? That number means “too small value”

warm hedge
#

How small it is? In the 1.02838e-036 case, 0.00000000000000000000000000000000000102838

sharp grotto
#

Thanks alot 👌 😅

modern sand
#

I highly doubt this is possible, but does anyone know of a way to get the players current weapon OBJECT, in order to for example get it's position, or to change it's texture using hiddenSelectionsTextures?

#

If not, does anyone know how the game actually creates the weapon object. Like how it attaches to the players hand etc?

modern sand
#

darn

little raptor
#

you can do it in the next version

#

with an improved attachTo

modern sand
#

next version?

warm hedge
#

Proxies are basically handled by Engine so

little raptor
#

next build (v2.02)

modern sand
#

O.o

#

where can I read the documentation about it?

little raptor
#

it's not even in Dev build yet

warm hedge
#

Somewhere in this Discord, Dedmen's posts. He teases some sweeties around here

#

But not really a document

little raptor
#

check out dedmen's twitter

warm hedge
#

That too

#

(Not sure that attachTo helps in this case though)

little raptor
modern sand
#

Thank you

#

🙂

little raptor
#

without an each frame loop

modern sand
#

Yeah well I could make my weapon just a static object, and attach it to the players hand. However the current attachTo command doesn't support rotation, so hopefully the new update isn't long 🙂

little raptor
#

I think it is! 😐

#

It'll be in the dev build tho so you can give it a test when it comes out

modern sand
#

I'll check if it is

little raptor
#
  • will be. not out yet (as of now)
modern sand
#

oh I missread that

#

my bad

exotic flax
#

in short; don't expect it to drop in the game, unless it actually drops 🤷‍♂️

#

we all know that game devs like to show off stuff which will never end up in-game 🤣

ember path
#

currently i have my undercover agent set to captive, even after the players "rescue" him, to avoid some frustration of the ai shooting the undercover agent, so theres still risk of them getting shot, without any real danger, unless there is a stray bullet or a nade

#

but this is now creating a problem for me

#

if im in a car, and tell the ai to get in they wont

#

i have to get out, and get back in

#

is there maybe a smarter way to go about fixing this

#

or should i just ignore it

hallow mortar
#

The way I would do it (not necessarily the best)

  • addAction on the player
  • displays when you are in a car and the AI is nearby
  • uses moveInCargo to put the AI in your car
ember path
#

hm..that is a good way

#

ill try that

exotic flax
#

yeah... problem with AI is that they don't like to be in the same vehicle as other factions (even when civilian, which you are when captive).
So either have them get in first, or force them in like Nikko mentions

ember path
#

oh also, this is unrelated to scripting so i might have to this somewhere else: but for some reason when i play in MP (even in editor) the systemchat..sidechat.. like its just gone, i cant see it

#

which is going to be difficult because i have friendly ai send some messages there

little raptor
winter rose
#

@ember path I would bet more on a locality issue

proper sail
#

pretty sure sidechat doesnt work when you are the only one online

#

atleast its that way in a2

#

or it will not broadcast atleast

winter rose
#

*chat have always been local effects commands

little raptor
#

pretty sure sidechat doesnt work when you are the only one online
you can side chat to yourself

little raptor
winter rose
#

that, I can't know. 🤷‍♂️ nor mods or anything.

wary hill
#

Hi, I need help with waitUntil in second while {true} loop. With current syntax code doesn't passes through (no error message), I was trying to use waitUntil { musicBoolean == false }; it gave error: Undifined behavior: waitUntil returned nil. True or false expected. I couldn't find solution in the wiki. What am I doing wrong?

_enemyCheckLoop = [] spawn
{
    while {true} do 
    {    
        musicBoolean = false;
        if (distanceToClosestEnemy < 700 && ClosestEnemy knowsAbout player > 3) then { musicBoolean = true; } else { musicBoolean = false; }; 
        hint str musicBoolean;
        sleep 1;
    };
};

while {true} do 
{
  waitUntil { missionNamespace getVariable ["musicBoolean", false] }; 
  if (dayTime < 22) then { playMusic _randomDay; } else { playMusic _randomNight; };
};
#

First loop work fine, I tested it multiple times, hint str musicBoolean; always returns desired true/false value

modern sand
#

waitUntil requires to be spawned

winter rose
#

@wary hill ```sqf pwease

modern sand
#

As well as, assuming _randomDay and _randomNight is defined.

wary hill
#
_actionAmbient = ["action1", "action2", "action3", "action4", "action5", "action6", "action7"];
_dayAmbient = ["day1", "day2", "day3", "day4", "day5", "day6", "day7", "day8"];
_nightAmbient = ["night1", "night2", "night3", "night4", "night5"];

ClosestEnemy = (nearestObjects [player, ["CAManBase"], 700, true]) select {side _x isEqualTo WEST} select 0;
distanceToClosestEnemy = player distance2D ClosestEnemy;
//hint str distanceToClosestEnemy;

_enemyCheckLoop = [] spawn
{
    while {true} do 
    {    
        musicBoolean = false;
        if (distanceToClosestEnemy < 700 && ClosestEnemy knowsAbout player > 3) then { musicBoolean = true; } else { musicBoolean = false; }; 
        hint str musicBoolean;
        sleep 1;
    };
};

while {true} do 
{
_randomDay = selectRandom _dayAmbient;
_randomNight = selectRandom _nightAmbient;
_randomAction = selectRandom _actionAmbient;

waitUntil { musicBoolean == false };

if (dayTime < 22) then { playMusic _randomDay; } else { playMusic _randomNight; };

//if (distanceToClosestEnemy < 700 && ClosestEnemy knowsAbout player > 3) then { playMusic _randomAction; } else { playMusic _randomDay; };

sleep 10;

};
winter rose
#

```sqf 👀

wary hill
winter rose
#

see pinned messages; your code will be highlighted

#
hint "hello world";```and not```
hint "hello world";```
rancid mulch
#

if you use waitUntil { missionNamespace getVariable ["musicBoolean", false] }; instead of waitUntil { musicBoolean == false }; the error you described does not come up

wary hill
rancid mulch
#

or you just set musicBoolean = false; at the start

wary hill
rancid mulch
rancid mulch
little raptor
#

so it never becomes true

rancid mulch
#

yeah. that too

#
private _actionAmbient = ["action1", "action2", "action3", "action4", "action5", "action6", "action7"];
private _dayAmbient = ["day1", "day2", "day3", "day4", "day5", "day6", "day7", "day8"];
private _nightAmbient = ["night1", "night2", "night3", "night4", "night5"];
MusicBoolean = false;
_enemyCheckLoop = [] spawn
{
  private ["_closesEnemy", "_distanceToClosestEnemy"];
    while {true} do 
    {
        _closestEnemy = (nearestObjects [player, ["CAManBase"], 700, true]) select {side _x isEqualTo WEST} select 0;
        _distanceToClosestEnemy = player distance2D _closestEnemy;
        if (_distanceToClosestEnemy < 700 && _closestEnemy knowsAbout player > 3) then { MusicBoolean = true; } else { MusicBoolean = false; }; 
        hint str MusicBoolean;
        sleep 1;
    };
};

while {true} do 
{
waitUntil { MusicBoolean };
private _randomMusic = if (dayTime < 22) then { selectRandom _dayAmbient } else { selectRandom _nightAmbient };
playMusic _randomMusic;
sleep 10;
};```
wary hill
little raptor
#

_closestEnemy = (nearestObjects [player, ["CAManBase"], 700, true]) select {side _x isEqualTo WEST} select 0;
findIf

#

or forEach + exitWith

rancid mulch
#

waitUntil { missionNamespace getVariable ["musicBoolean", false] };
and
waitUntil { musicBoolean == false };
do opposite things. One does fire on musicBoolean beeing false, the other on true

little raptor
#

also, no provision for the array being empty

#

it'll throw an error if there's no enemy nearby

#

musicBoolean == false
wat?!
!musicBoolean

wary hill
rancid mulch
#

And why two loops? Is one part of the code running on another machine?

little raptor
#

so it will never play the music

rancid mulch
little raptor
#

right
terrible code structure

rancid mulch
#

yes 😄

little raptor
#

if (_distanceToClosestEnemy < 700 && _closestEnemy knowsAbout player > 3) then { MusicBoolean = true; } else { MusicBoolean = false; };
MusicBoolean = (_distanceToClosestEnemy < 700 && _closestEnemy knowsAbout player > 3);

wary hill
rancid mulch
#

I bet, it doesn't

#

let's start all over: What is the goal of your script? Are you coding a MP mission?

wary hill
# rancid mulch let's start all over: What is the goal of your script? Are you coding a MP missi...

Okay, I double checked

//waitUntil { missionNamespace getVariable ["musicBoolean", false] };
if (dayTime < 22) then { playMusic _randomDay; } else { playMusic _randomNight; }; //fires and music is played
waitUntil { missionNamespace getVariable ["musicBoolean", false] };
if (dayTime < 22) then { playMusic _randomDay; } else { playMusic _randomNight; }; //doesn't fire and music isn't played

however in 2nd case if there is no any enemy at the whole map music starts playing. Works same way as code you send earlier

winter rose
#

English only, bon sang :p

plain creek
#

How can one make a script with a variable that is determined when the script is called?

winter rose
#
// in the script
myVar = "value";
```?
plain creek
#

I mean like my script has the variable a. I don't say what a is in the script but when i run the script (execVM "mysript.sqf" ["value i want the a variable to be"]) a is what i put into the between [].

#

I think they called parameters in English.

winter rose
#

a situation like this?```sqf
private _a = objNull;
[_a] execVM "myScript.sqf"; // _a = player
hint str (_a == player); // true

plain creek
#

Okay so the question in is how to make arguments for scripts.

plain creek
#

So instead of a script I need to create a function and put that into the description.ext?

cosmic lichen
#

a script can also take arguements. The way you add them is the same.

plain creek
#

Okay, thanks a lot!

north cloud
#

So I got this script: player setVariable ["copLevel",1,true]; And I am trying to get it so that it works for everyone in bluefor anyone got any ideas

wary hill
#

I found a problem with waitUntil, thank you @little raptor, @rancid mulch for your help!

winter rose
#

@north cloud yes, forEach and select allUnits where side is blufor

north cloud
#

@winter rose Could you explain it more I am very new to scripting and just trying to get some doors working for a mod I am using

ember path
#

sometimes it even stops showing up mid mission, idk what could be causing this, unless im pressing a key combination that turns it off

tough abyss
ember path
#

oh reading a thing, it must be the stream friendly ui thing

#

(i run obs while playing arma to capture clips)

loud zenith
#

hi im looking for help with scripting an AI unit to drop intel next to its body when the AI is killed so the player can pick it up

little raptor
#

copy paste example:

this addEventHandler ["Killed", {
    params ["_unit"];
        _weaponHolder = createVehicle ["WeaponHolderSimulated_Scripted", ASLtoAGL getPosASL _unit, [], 0, "CAN_COLLIDE"]; 
_weaponHolder addItemCargoGlobal ["DocumentsSecret", 1]; 
}];
loud zenith
#

I have the headle and the intel codes just cant get the intel to spawn at his feet

winter rose
#

see Leopard20's last code snippet: it creates an object holder that is then filled with land_document

exotic flax
#

the 2nd script by Leopard20 is doing exactly that

little raptor
#

The item I'm using there won't work tho!

still forum
cosmic lichen
#

Every modder / dev is guilty of that I believe 😄

winter rose
#

nah, I rarely release any info until I am 101% sure it will make it 😄

wary hill
#

Do you guys have an idea of how to make a more efficient dynamic enemy count in an area with the player in the center each x seconds than this?

_tempTrg = createTrigger ["EmptyDetector", getPos player];
_tempTrg setTriggerArea [100, 100, 0, false];
_tempTrg setTriggerActivation  ["WEST", "PRESENT", false];
_tempTrg attachTo [player, [0,0,0]]; 
sleep 1;
while {true} do {
    _enemyCount = player countEnemy list _tempTrg;
    hint str _enemyCount; 
    sleep 1;
};
spark turret
#

you could shift it to eventhandler based. if more than x eneimies had their killed EH fired, spawn new ones

#

i get that you want to spawn new enemies but stay under a certain level?

willow hound
#

You could also try using nearEntities instead of a trigger.

wary hill
spark turret
#

If you only call it every couple seconds it shouldnt be to bad

languid oyster
#

I would like to have a 'fuel low' event instead of the 'fuel empty' event. I presume, I am not able to do it without having a loop?

winter rose
#

bingo (fuel)

willow hound
#

Woooow

languid oyster
#

bingo 😆 ? Where do I find corresponding event?

willow hound
#

swoosh

exotic flax
#

usually at retirement homes 🤣

languid oyster
#

😅

exotic flax
#

but afaik is there no other way to get "low fuel" unless you have a loop to check the current amount in the tank

languid oyster
#

Yes, already thought so. Although there must be some internal check -> bingo

willow hound
#

Well of course there is, the game engine handles the fuel after all...

exotic flax
#

which is simply updating an internal variable, which can be access through fuel, nothing more, nothing less

#

So could there be an EH for fuel changed? yes. Question is though, how far do you go?
Trigger every 25%, every 10%, every 1%, every tick?

I guess a simple loop and a switch can do magic as well.

winter rose
#

even if you check every 15s,it's still "accurate"

wary hill
#

I have a couple of waitUntil which don't work as intended in subscope, pls help

actionAmbient = ["action1", "action2", "action3", "action4", "action5", "action6", "action7"];
dayAmbient = ["day1", "day2", "day3", "day4", "day5", "day6", "day7", "day8"];
nightAmbient = ["night1", "night2", "night3", "night4", "night5"];
detectionBoolean = false;
musicBooleanStop = false;
addMusicEventHandler ["MusicStop", {musicBooleanStop = true}];
#
[] spawn {
while {true} do {
    detectionBoolean = true;
    _closestEnemy = player findNearestEnemy player;
    _distanceToClosestEnemy = player distance2D _closestEnemy;
    _enemyAwareness = west knowsAbout player;
    if (_enemyAwareness > 3.95 and _distanceToClosestEnemy < 450) then {detectionBoolean = true;} else {detectionBoolean = false;};
    hint str detectionBoolean;
    //sleep 1;
    //hint str _enemyAwareness;
    sleep 2;
    
};
};
#
[] spawn {
scopeName "ambientLoop";
    while {true} do {
        player SideChat "break point in ambient loop";
        _randomDay = selectRandom dayAmbient;
        _randomNight = selectRandom nightAmbient;
        _randomAction = selectRandom actionAmbient;
        player SideChat "randomization is passed";
            //hint str detectionBoolean;
            /*
                waitUntil { missionNamespace getVariable ["detectionBoolean", false] };
                player SideChat "waitUntil is passed";
            */
        if (dayTime < 22) then { playMusic _randomDay; } else { playMusic _randomNight; };
        waitUntil { missionNamespace getVariable ["detectionBoolean", true] or missionNamespace getVariable ["musicBooleanStop", true]}; // WORKS AS INTENDED
        if (missionNamespace getVariable ["detectionBoolean", true]) then {
            scopeName "ActionLoop";
            while {true} do {
                playMusic _randomAction;
                player SideChat "_randomAction is playing";
                sleep 4;
                waitUntil { missionNamespace getVariable ["detectionBoolean", false] or missionNamespace getVariable ["musicBooleanStop", true]}; //PROBLEM: this passes despite "detectionBoolean" is actually true and "musicBooleanStop" is false
                player SideChat "waitUntil in ActionLoop has been passed!";
                if (missionNamespace getVariable ["detectionBoolean", false]) then {breakOut "ActionLoop"}; //PROBLEM: this passes despite "detectionBoolean" is actually true
                sleep 1;
            };
            sleep 1;
        };
        sleep 1;
    };
};
winter rose
#

more code please!

little raptor
#

not more, but moarrr

exotic flax
#
waitUntil { missionNamespace getVariable ["detectionBoolean", false] or missionNamespace getVariable ["musicBooleanStop", true]}; //PROBLEM: this passes despite "detectionBoolean" is actually true and "musicBooleanStop" is false

that is correct, if TRUE or FALSE (equals TRUE) continue

if (missionNamespace getVariable ["detectionBoolean", false]) then {breakOut "ActionLoop"}; //PROBLEM: this passes despite "detectionBoolean" is actually true

that is correct, the value which is returned by missionNamespace getVariable ["detectionBoolean", false] is being checked, so if detectionBoolean = true, than the IF statement will continue

#

because I have the feeling you misunderstood that

wary hill
drifting sky
#

Arma2OA: Are variables and event handlers attached to an object automatically removed from memory when the object is deleted?

wary hill
little raptor
little raptor
drifting sky
#

how accurate is lineintersects? Can I use it to move spawned units upward when they are intersecting another object's geometry?

winter rose
#

yes

drifting sky
#

Well, it appears to be accurate enough for my purposes. Seems odd that there is no point intersect though.

winter rose
#

there is, with another command

little raptor
#

use lineIntersectsSurfaces not in A2

drifting sky
#

View lod seems pretty good. What lod is better?

#

wait, is view lod based on the current actual view lod??

little raptor
#

ROADWAY or GEOM for what you ask

drifting sky
#

or is it max view lod?

little raptor
#

which is not accessible btw

drifting sky
#

so view lod does not vary according to distance

viral spire
#

is there a script (not the ALIAS one) for utilizing the levitation techniques of Contact Campaign? More specifically, one that functions properly for multiplayer?

little raptor
#

no

drifting sky
#

I think view lod is sufficient for my needs.

little raptor
drifting sky
#

wait, so it wont work for areas far away from players?

little raptor
#

no

#

unless it's within the view distance

drifting sky
#

hmm... what's the alternative for A2OA?

little raptor
drifting sky
#

not sure how that pertains

#

For the intersect functions in Arma2, the wiki makes no mention of LOD or problems that could result from that

little raptor
# drifting sky not sure how that pertains

if you set the position of the object to like [_x,_y,1e4] (ASL or ATL), then try the getPos _unit select 2, it returns the height to the next roadWay surface.
combine that with some trial and error and you can place your unit somewhere "safe"

drifting sky
#

what does 1e4 stand for?

little raptor
#

10^4

drifting sky
#

so when you set the z to a really great height, it moves the unit down until it touches the first surface?

#

or do you mean wait for it to fall?

little raptor
#

it returns the height to the uppermost surface. so yeah you can put the unit there

little raptor
#

if it's unscheduled, the unit won't even notice it

drifting sky
#

well, there's the problem

little raptor
#

I'm not sure if the isNil trick works in A2, but if it doesn't, you can use a test object

drifting sky
#

I only want this to happen if the unit's initial position is intersecting an object already

little raptor
drifting sky
#

for objects that start inside of buildings, it won't work at all, will it?

little raptor
#

why shouldn't it?

drifting sky
#

because they'll end up on the roof, wont they?

little raptor
#

yes, like I said, use trial and error

#

example

#
_pos = getPosASL _unit vectorAdd [0,0,1];
_unit setPosASL _pos;
_unit setPosASL (_pos vectorDiff [0, 0, getPos _unit select 2]);

this will place the unit on top of the next surface within a 1 meter height

#

so not enough to put it on a roof or even the next floor

#

it will only move if it's stuck

#

you can do something like that in a loop to find the best position

#

because I'm not sure how it'll work if, e.g. you're stuck in a rock that is 3 meters high

drifting sky
#

Um. I'm not following the logic of that code. On the third line it appears to be getting the difference between _pos and _pos, which is zero, right?

little raptor
#

no

#

as I said, getPos is in AGLS format. height above surface

drifting sky
#

Alright, I think i'm starting to get it

little raptor
#

if you move a position 2 meters higher, but you were already on a surface, you get a 2 meter diff, so you're back at your initial pos

astral tendon
#

does allMapMarkers return markers in specific order? like alphabetical or by how old it is?

little raptor
#

but if you were stuck, diff < 2, and you move higher

drifting sky
#

is this sound? if getPos == getPos + 1, then unit is NOT stuck?

#

I mean height component, obviously

#

Wait, no that isn't sound

little raptor
#

yeah, kinda

#

but you still need to move the object

drifting sky
#

because it could be inside something tall

little raptor
#

doesn't matter

#

what you said was nearly correct

drifting sky
#

Ok, here's a question

little raptor
#

there might be a slight error

drifting sky
#

if the unit is inside, let's say a terrace, and moving it up 1 meter leaves it still inside the terrace, because it might be tall. Won't unit setPos getPos +1z, set the unit on the ground??

#

and not on top of the terrace, which is what I want

little raptor
#

so you want the unit to be placed on the ground?

#

but not stuck?

drifting sky
#

If it is intersecting with a terrace, for example, it should be put on top of the terrace.

#

But if inside of a building, it should not be moved

little raptor
#

which is what it does right now

drifting sky
#

not just terrace, but walls and rocks and things like that

little raptor
#

hopefully

#

you can try it

#

walls
this is trickier

drifting sky
#

does it have to be a unit as in a man, or can it be any object?

little raptor
#

any object

drifting sky
#

I'll try it, but I doubt this will work

little raptor
#

for walls you also need to check horizontal intersect

little raptor
#

because I've used it before

drifting sky
#

As long as the center of the unit is not inside of a wall, i think it'll be alright

drifting sky
#

exitwith can terminate a script and return to the calling script, correct?

robust hollow
#

yes

little raptor
drifting sky
#

func = { if(condition) exitWith { do_thing;}; }; exists func, correct?

#

and returns to whatever called func

little raptor
#

yes

drifting sky
#

is there any problem returning nil from a functoin>?

robust hollow
#

not unless the calling script expects a return value

drifting sky
#

if I do a test for nil is it fine?

#
if(!isnil "_a")
robust hollow
#

yea. in general if the function has a chance of returning a value then it always should, but if it never returns a value then you dont need to check for it.

#

so say you have a function that returns a number, but has early exit conditions, you might use -1 as default to say the script exited early. that way the calling script still gets a return value, and can know the script didnt complete

drifting sky
#

what I'm looking for is when returning an object or array, or array of objects, a value to indicate when object or array is not found

robust hollow
#

objNull or empty array would be my suggestion

#

probs objNull because then you can do isNull _a

drifting sky
#

what about this example:```
if ("1Rnd_SMOKE_GP25" in _magazines) exitWith { [GP25Muzzle,1Rnd_SMOKE_GP25]; };
nil;

#

returning an array in the first case, and nil otherwise

#

anything wrong with just testing isnil?

robust hollow
#

you can do it however you want, both are valid.

drifting sky
#
func_C = { }
func_B = { call func C; }
func_A = {
    private [ "_A" ];
    call func_B;
}```
#

func_C and func_B have access to _A, correct?

robust hollow
#

they should do

drifting sky
#

and if there's another _A in a scope above func_A, func_c and func_B will definitely refer to func_A's _A, when accessing it, correct?

robust hollow
#

yes, as long as you dont private _a in the lower scopes

#

local variables look from the current scope up until it finds a scope with the variable defined.
eg

call {
    private _a = 1;
    
    call {
        private _a = 2;
        
        call {
            _a // 2
        };
        
        _a // 2
    };
    
    _a // 1
}
drifting sky
#

thanks

astral tendon
exotic flax
#

channel: Number - (Optional) The marker channel for MP. since Arma 3 v2.01.146752
creator: Object - (Optional) The marker creator for MP. since Arma 3 v2.01.146752

#

you're using v2.00 😉

#

unless you're on the dev version

astral tendon
#

🙄 great, so I just need to assume that does not work if I just see "since"

exotic flax
#

yeah... wiki is always as clear as it could/should be

robust hollow
#

so I just need to assume that does not work if I just see "since"
i wouldnt say that. because not all "since" comments are for the current dev version

fair drum
#

can you play full screen videos like how the campaign does it's news casts?

robust hollow
#

i imagine so. make a full screen video ctrl

#

or there might be a function or it

sacred dirge
#

Hey, question for anyone. How would I go about all AI and players being paused at the beginning of a multiplayer mission. (Unable to move and all AI frozen) until I run a script or trigger or however to unfreezing them and "Start" the mission. I want it so I can get Everyone to load in and be ready then unpause it to all start at the same time.

still forum
oblique arrow
#

Did Dedmen switch to the CIA or whats going on here heh ?

#

(/s)

still forum
#

Arma Cell: Double Agent

oblique arrow
#

👀

#

Sounds nifty, would play

languid oyster
#

Yes me too. But only with a silenced Walther PPK.

thorn saffron
#

I'm trying to make a module with a function that is supposed the get the reference to the module object. I copied this from vanilla module, but it does not work for me:

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

I get Error Type String, expected Object at that line and I have no idea how to fix that.

robust hollow
#

stop giving it a string as the first argument 🤷

still forum
#

just diag_log _this and see what you get

#

you obviously aren't getting what you're expecting, so check what you have and go from there

thorn saffron
#

no, I dont want some other object. I want to get the module itself, a reference to it. Kinda like the game logic object

little raptor
#

are you sure the error is from that line?

thorn saffron
#

yes

#

checked in RTP

#
_logic = _this param [0,objNull,[objNull]];

if (_logic>
11:52:01   Error position: <param [0,objNull,[objNull]];

if (_logic>
11:52:01   Error Type String, expected Object```
tough abyss
still forum
little raptor
#

you're passing default data type

thorn saffron
#

ok, I think I got it wrong

little raptor
#

so if it doesn't match, it'll use the default param

thorn saffron
#

the garbage data causes problems later it turns out

tough abyss
#

💀

thorn saffron
#

I need to do some fixing and see what comes up then

little raptor
thorn saffron
#
12:18:32   Error position: <param [0,objNull,[objNull]];
>
12:18:32   Error Type String, expected Object

_logic = _this param [0,objNull,[objNull]]; is literally the only line in the function and it still gives me the error.

spark turret
#

Taro i figured that out 2 days ago. This select 1 select 0 is a string telling yiu how the module got executed: in editor on a oaram change or on missionstart ("init")

winter rose
#

@thorn saffron sqf systemChat str _this; // to see what is what? also, use params 😛

thorn saffron
#

I literally copied that line from the module config on the wiki

spark turret
#

Any other input parameters need to be defined in the config under Attributes. Their classname will be saved as an variable into the logic object.
Get the parans through
_logic getVariable ["myVariableClassName",defaultValue]

thorn saffron
#

yeah I get that

spark turret
#

They are not saved into the _this namespace

thorn saffron
#

from Heli DLC AI spawning module:

private["_emitter","_activated","_initialized"];

_emitter     = _this param [0,objNull,[objNull]];
_activated     = _this param [2,true,[true]];

_initialized     = _emitter getVariable ["initialized",false];

//make sure the emitter is initialized only once
if (_initialized) exitWith {_emitter setVariable ["activated",_activated];};

_emitter setVariable ["initialized",true];
_emitter setVariable ["activated",_activated];```
And somehow that works...
still forum
still forum
#

I thought params still throws error when you pass wrong parameter type

spark turret
#

I used that line too, stolen from a vanilla module but it didnt work

still forum
#

Since Arma 3 v1.53.132691, onscreen errors are displayed for when the input is of the wrong type or size.
Sounds to me like it will error when you pass wrong type.
But it probably just continues executing with the default value then.

spark turret
#

_logic objecr is this select 1 select 0 iirc

still forum
#

Also keep in mind there are two kinds of modules

spark turret
#

Editor run and mission run?

still forum
#

No

#

3DEN module and normal CfgVehicles module

thorn saffron
#

I never dealt with modules before so I just copied stuff from the wiki and the vanilla modules. If that does not work, well I have no idea what to do

still forum
#

I already told you to just diag_log _this, check what you have, and then write your code according to that

#

And Lou also repeated that again

#

but you seem to just be ignoring what people tell you and instead try to find your own route which keeps failing

spark turret
#

Yeah, diag_log ["hello im a module with these params:",_this] gives a good idea

thorn saffron
#

ok. I see what popped up

little raptor
#

I think the real question here is how that function is executed.
If it's actually a module function, it will always have the module object passed to it

#

so maybe your config is wrong

still forum
#

It has the module object passed to it, just not as first param

#

I think is3DEN = 1; makes a difference to the parameters passed to it

spark turret
little raptor
#

but for now a systemChat str _this is the best idea

thorn saffron
#

["init",[L Alpha 1-2:1,true,false]]

#

that what's get passed from _this

spark turret
#

See, i told you its _this select 1 select 0

#

The l alpha 121 is the logic object

thorn saffron
#

I was just blindsided by the fact wiki stuff and vanilla stuff does not work.

spark turret
#

Yeah module wiki is awful

#

I just reverse reverse engineered the smoke module in the end

thorn saffron
#

and I looked at Heli DLC AI spawning module, with has the same setup, so yeah...

still forum
#

Shall I just repeat that "is3DEN = 1" makes a difference because 3DEN modules work differently?

#

OH...

#

Dang reading really is benefitial huh?

#

The Modules page is not wrong, its all written there, you just need to look

thorn saffron
#

facepalm

#

just a quick question: are module functions called? Meaning you can't have sleep in them and instead I need to have an inbetween function that spawns the proper function?

spark turret
#

Nah, the modules page is still poop.

#

It does not state what parts in the config are important etc

#

Its confusing and it didnt help me at all

still forum
spark turret
#

Well it would be nice to have an explanation on "how to make a barebone module and add up from there"
Yeah i tried using that config in slight variation but it didnt work and the attributes thing didnt at all

#

I had to change it to arguments to be displayed

thorn saffron
#

For what it's worth the config actually did work for me. I just glossed over the eden init bit with caused issues for me, but that's on me

spark turret
#

Well all i can say is: my customer experience with this documentation was awful and frustrating.

thorn saffron
#

well, at least there is some, try taking a shot at editing lighting configs 😄

#

or dealing with physx

still forum
#

Atleast you can help to fix it if you want to ¯_(ツ)_/¯

vague geode
#

Is there any way to sort groups by callsign in the High Command menu without removing and re-adding all groups?

spark turret
still forum
dire topaz
#

how do i use allowdamage with a group? I've tried 'a1 allowdamage false;' but didnt work. a1 being the group variable?

oblique arrow
#

That command only takes one object, so you'd have to do something like use forEach on the group @dire topaz

dire topaz
#

cheers

oblique arrow
#

There's an example on the wikipage that you can use as a starting point

dire topaz
#

right, im stumped, '{ this allowdamage false } forEach [1, 2, 3, 4, 5] a1;' i honestly cant wrap my head around this, anyone able to help?

jade abyss
#

Did you even read the examples?

#

Because the answer to your question is literally in there.

dire topaz
#

yeah ive looked

#

i dont understand it

jade abyss
#

Example 1

#

the very first. What does it do?

dire topaz
#

thats not what i want

jade abyss
#

It is, but okay.

thorn saffron
#

@dire topaz allowdamage only works on units, so you need to go through every unit in the group and set it individually. You use forEach to go though every unit

dire topaz
#

ahh okay

jade abyss
#

(of course you have to alter the used command in there...)

dire topaz
#

so i literally put unit, group player

robust hollow
#

you literally put units group player. no ,

jade abyss
#

a1 is the group? or a player?

dire topaz
#

group

jade abyss
#

then forEach a1;

dire topaz
#

okay ty

thorn saffron
#

@jade abyss shouldn't it be forEach (units a1)?

winter rose
#

yep

#

forgive him, he neu here

jade abyss
#

Ah, yeah @thorn saffron

jade abyss
thorn saffron
#

@dire topaz { _x allowdamage false } forEach (units a1);

jade abyss
#

(will give you the translation via DM carlos if needed )

dire topaz
#

cheers

winter rose
jade abyss
#

If you don't spell the letters as "single letters", then it fits

random loom
#

Is there a way to work around holdactions fading if they are longer than ~15 seconds?

cosmic lichen
#

don't think so freddo. Seems like a design flaw

random loom
#

guess I should create a ticket

hushed tendon
#

I'm trying to get a flare to spawn randomly in a 150 radius around the object "bob". I'm not sure how to implement this flare script into scripts that randomly spawn stuff in a radius. Anyone able to help?
The flare script:
flrObj = "F_40mm_white" createvehicle ((bob) ModelToWorld [0, 100, 150]); flrObj setVelocity [0,0,-20];

winter rose
#

The flare script
😱

worn forge
#

use the createVehicle array method instead

hushed tendon
#

Is it bad? @winter rose

worn forge
#
flrObj = createVehicle ["F_40mm_white", bob ModelToWorld [0, 100, 150], [], 150, "NONE"];
flrObj setVelocity [0,0,-20];
winter rose
#

nono (well, a bit) it's a reference to someone that joined this Discord, asked for "the car script" as if everybody should know it, then left 😄

#
private _spawnPos = bob getPos [150, random 360] vectorAdd [0, 0, 100];
#

(if you want a 2D 150m distance at a random 360° angle)

#

@hushed tendon ↑

hushed tendon
#

Alright

hushed tendon
#

I know I've done this before but I can't remember or find out how to launch the code in a sqf from a trigger. Isn't it something like execVM "test.sqf"; in the activation?

spark turret
#

Yeah that will execute the test.sqf script once the trigger activates

hushed tendon
#

Hmm. I'm using the flare script in the sqf and the trigger is being activated so I don't get why it isn't working

#

is it possible that the sqf doesn't know the information on where "bob" is?

winter rose
#

nope
bob is a global variable (on the machine)

sharp skiff
#

i can use a task state as trigger activation right? (eg obj. 1 complete = Trigger activation) im not ingame right now ,just a theory!

winter rose
#

yes

#

(not great, but yes)

sharp skiff
#

thx

#

its just to run a sqf that plays a global song!

#

sort of outro

winter rose
#

it would be better to remoteExec playMusic then?

sharp skiff
#

as trigger= on activation? yes

winter rose
#

on task success (instead of checking its state?)

sharp skiff
#

that works 2? didnt think about that Thx!

#

or rememberd*

winter rose
#

it's just that having a trigger checking every 0.5s if a task is completed is not great; on the contrary, if you simply play the music when you decide to "validate" the task, then nothing is "waiting" for anything 😉

sharp skiff
#

well yeah thats much better 🤣 just had this thoug while listening to AC/DC - Demon Fire i though hey that would be nice if that would play if the ac-130 levels the town and the infantry watches XD

hushed tendon
#

@winter rose Is it possible that part of the code simply does not work with sqf files such as you can only use sleep in sqfs

worn forge
#

sleep only works in a suspended context, so you might have to spawn your code; using execVM will also suspend, if you're doing it that way

#
myCode = { sleep 1; hint "Hello Dolly!"; };
call myCode; // results in an error
[] spawn myCode; // results in hint
hushed tendon
#

I have the execVM called in a trigger and as far as I know that is the only way to call an sqf

#

but if I understand you correctly sleep will work ingame as long as you call it like you have shown?

winter rose
#

in a spawned code (execVM, spawn, etc)
not from a trigger/init field

hushed tendon
#

so an sqf called by an execVM would work but not if started by a trigger?

winter rose
#

an sqf (file) can only be called by an execVM or a Function compile
sqf code cannot sleep in a trigger field no

#

it should throw an error if you have the -showScriptErrors flag enabled in the launcher

worn forge
#

Sounds like his trigger execVM's an sqf file

#

So that'd be fine

hushed tendon
#

Yes Ryko

winter rose
#

then no problem at all

hushed tendon
#

Sorry if I didn't make that clearer

winter rose
#

you have no concern about sleep then, because execVM creates a new script 😉

worn forge
#

Let me guess:

  1. player enters trigger
  2. slight delay
  3. execVM flare script, flare gets created and launched
hushed tendon
#

Maybe the whole picture might clear this up

#

I'm trying to make flares spawn at random and repeating (prob between 5-30 seconds) in a random direction while in a 75m radius from the SL.

worn forge
#

Well your script will have to have a loop in it, because the trigger will only spawn one time.

hushed tendon
#

Yeah but right now I'm trying to do it in steps and I need to make sure the sqf will even spawn a flare

worn forge
#

so what's the problem?

hushed tendon
#

Well the process right now is
1)Trigger is activated
2)execVM calls sqf
3)sqf run flare script

flrObj setVelocity [0,0,-20];```
#

Yet the flare doesn't spawn

#

Is it possible that it is spawning but just under the map?

worn forge
#

first things first you should be having an error somewhere, are you displaying script errors with the -showScriptErrors flag?

hushed tendon
#

Is that the black box that shows on the screen?

worn forge
#

yup

hushed tendon
#

Yeah I'm getting one. Says something about line 1

worn forge
#

if you're going to be doing any scripting, get to know your report (.rpt) file, it's located somewhere like C:\Users\YOU\AppData\Local\Arma 3\..... .rpt, everything will be saved there in the most recent file

#

And that script error will also be there in case you miss what the black box reports, and will allow you to track down the error

hushed tendon
#

The error is from the sqf on line 1

worn forge
#

Fab. Now what does the error actually say

hushed tendon
#

flrObj = createVehicle ["F_40mm_white", bob ModelToWorld [0, 100, 150], [], 150, "NONE"];

worn forge
#

It'll give you the position

#

My guess is that it doesn't like bob ModelToWorld [0, 100, 150] as a position array

#

Maybe replace that with player for the time being and then you can finesse it

#

You could add a line after it's created:

flrObj setPosATL (getPosATL flrObj vectorAdd [0, 0, 100]);
hushed tendon
#

So just flrObj = createVehicle ["F_40mm_white", player, [], 150, "NONE"];

worn forge
#
flrObj = createVehicle ["F_40mm_white", player, [], 150, "NONE"];
flrObj setPosATL (getPosATL flrObj vectorAdd [0, 0, 100]);
flrObj setVelocity [0,0,-20];
hushed tendon
#

yeah with those it still gives an error on line 1

worn forge
#

pastebin the entire script

hushed tendon
#

I'm only using that currently

#

I'm going to implement the other bits of code after

spark turret
#

-20 m/s ist 60 km/h

#

Thats very fast lol

hushed tendon
#

It moves slow(ish)

winter rose
spark turret
#

60kmh isnt quite "slowish" but alright :D

hushed tendon
#

It is ingame

#

for some reason

spark turret
#

It should take 5 seconds to reach the ground

hushed tendon
#

takes like 15

worn forge
#

I've tested my code locally, it works without errors, so I'm not sure what your problem is

winter rose
#

don't forget friction 🙃

spark turret
#

Hmmmm if you put your flare at .z == 100 and it moves -20m/s on z

#

How can it take 15 seconds

hushed tendon
#

Arma has no bugs. Only features

spark turret
#

Either you messed up your code or flares have their own scripted physics that dont allow fast movement

#

My bet is on the second

winter rose
#

the flare may slow down by itself

worn forge
#

Also, -20 definitely plummets those flares into the ground, -0.5 makes it a reasonable descent

worn forge
sharp skiff
#

@winter rose is "this" wrong to play the music globall? ```sqf
this ;[["acdc",0]] remoteExec ["playMusic"];;

hushed tendon
#

I don't get why this isn't working 😩
If I'm getting an error from the sqf that means everything but the code inside the sqf is working, but the code in the sqf is fine

sharp skiff
#

(acdc is defined in description.ext)

sharp skiff
#

well it triggers but wont play so i need to get rid of this somehow

winter rose
#
["acdc"] remoteExec ["playMusic"]
```should do
sharp skiff
#

error missin ; hmm

spark turret
winter rose
worn forge
spark turret
#

Alsp the code obviously isnt fine if it throws an error :D

hushed tendon
#

I'm calling the sqf from an execVM that is in a trigger

worn forge
#

Yes, show me that statement

hushed tendon
#

I was told execVM "flare.sqf"; works

#

in the activation*

worn forge
#

omg

#

what does it take

#

I'm asking you to do something and you're not doing it

sharp skiff
#

@winter rose yes it works with another add action code i use for a radio but what do i need to replace "this" with

#

or extend with what

little raptor
hushed tendon
#

I don't know what you mean by statement. Are you talking about the code in the sqf? @worn forge

sharp skiff
#

magic? as far as i know it makes arguments visible and accessible to the script

worn forge
#

@hushed tendon SOMEWHERE, you are calling the execVM statement. Either:

  1. In a trigger in the eden editor.
  2. In a script.
  3. In an INIT field of a unit.
    What I want/need/am desperate to know is where that is happening, because how you are calling it could be problematic.
little raptor
spark turret
sharp skiff
#

ah ok

little raptor
#

which you don't need for playMusic

sharp skiff
#

so i need to get rid of this and/or tell it to play it on the whole server or each client?

#

ok

little raptor
#

playMusic is probably local

#

yes

#

so you have to remote exec it for everyone

sharp skiff
#

so i have to somehow define "everyone"?

little raptor
#

you already do

#

with remoteExec target flags

#

params remoteExec [functionName, targets, JIP]

sharp skiff
#

which i left out on error

#

ok

#

sec

little raptor
#

if you leave out the targets, it uses 0 by default

#

ie everyone