#arma3_scripting

1 messages ยท Page 627 of 1

torn juniper
#

@still forum If you are allowed to meowsweats
Where do I submit my requests?!

the setUnitLoadout issue was with a private dev tool and not actual mods, I think it was having an issue in how it emulated the debug console..

Only thing is the ammo issue with that command

Finally getting around to updating my mod DualArms PepePray thank you for the addWeaponsWithAttachmentsCargo - which also works for player backpacks! I didn't think about that but I added it to the wiki for both commands now. Thank you!!

Just need one for player primary/secondary/pistol now.. I made one that uses setUnitLoadout which is why I have been getting into it with that command

robust hollow
#

@weary osprey use getMissionPath "generator.ogg" to get the full mission path to the file

weary osprey
#

so {playSound3D [getMissionPath "generator.ogg", Generator, false, getPosASL player, 1, 1, 0]}, ?

robust hollow
#

yea

weary osprey
#

thank you, worked perfectly

#

the zombie horde that will descend on the players will be pleased

#

gotta get that immersion

gilded rover
winter rose
#

Description.ext I suppose?

exotic flax
#

config.cpp in mmods or description.ext in missions

gilded rover
#

hmm thanks , I love it that documentation has FINALLY been released , cannot wait for it to be updated and maybe include some of the sqf files like reset etc.

#

config.cpp in mmods or description.ext in missions
@exotic flax great , thanks !

peak mountain
#

ABC.exe โ€˜m hacker

exotic flax
#

hi I'm dad

#

and this is off-topic...

dapper path
#

Trying to script player turret, but only gunnerAction is working, gunnerInAction is not working

dapper path
#

Who ghost pinged me

warm hedge
#

setPlayerVoNVolume is a local command not global

#

So well... probably you're true. Don't know what's your goal though

#

If you just wanted to disable all voice communications, just enableChannel is better

#

So dead and spectate players can hear other spectators but no actual alive players?

#

So no need to do remoteExec. Just do setPlayerVoNVolume 0 for all players when he's in unconscious, and vice versa

#

Yes (I think. Never tried an actual implementation)

#

Should do

#

And don't forget to do setPlayerVoNVolume 1 when he gets up

#

Why? You just need to do 0 for one player, and the command is a local

#

Because that's not the point of the command

#

Also, I'm not an developer and this is how the command works

#

Why? I already said for 2 or 3 times that's a local

winter rose
#

@echo yew it is synchronised by the engine itself, all the command does is read the local value

#

so absolutely no worries using it ๐Ÿ˜‰

#

this command has no effect by itself

but yeah no problem

warm hedge
#

Local effect = it does it only in one's computer, no traffics
Global effect = it does it in everyone's computer, so there're traffics

winter rose
#

also, a connecting one will be able to talk to him ^^

#

let's call it "coma consciousness" and call it a day :p

#

you can mute per-player, that's a feature

#

for your use case yes ๐Ÿ™‚

#

Maybe other scripters want to mute according to distance, role, etc

#

a global setting could be nice too, I agree as well

#

would solve the late connection problem
but to choose between general setting and per-user, I prefer having more granularity ^^

gilded rover
#

Hey guys , so I made a firing drill with this in the description.ext among other things , yet after i have exported it to sp it still doesnt show in challangessqf class CfgMissions { // This will expose the drill in the SINGLEPLAYER > CHALLENGES > Firing Drills menu class Challenges { class Firing_Drills { class TF461_FiringDrill_1 // This class should correspond to the class in CfgFiringDrills above { directory = "C:\Users\AntiAlligat3r\Documents\Arma 3\missions\TF461_FiringDrill_1.VR"; // Full path to your drill's scenario folder briefingName = "CoF: My First Drill"; // Name of your drill (normally the same as defined in CfgFiringDrills) overviewText = "Can you beat my splendid drill?!"; // Overview text of your drill overviewPicture = ""; // Overview picture of your drill overviewScript = "\A3\Modules_F_Beta\FiringDrills\scripts\overviewScript.sqf"; // Standard system script to handle the pause menu properly - don't change author = "[TF461]Maj.AntiAlligat3r"; // You! }; }; }; };Can anyone let me know if the code is correct?

vestal hearth
#

I am an amateur when it comes to scripting, and I want to make a practice scenario where players have to move along a path with targets randomly popping up through windows etc. Is this something anyone of you have done, and how hard would it be to make it work?

gilded rover
#

I am an amateur when it comes to scripting, and I want to make a practice scenario where players have to move along a path with targets randomly popping up through windows etc. Is this something anyone of you have done, and how hard would it be to make it work?
@vestal hearth without a timer its not that hard actually

fair drum
#

anyone familiar with the intro/scenario/outro tab in the editor? how do you go between them in game?

dim terrace
#

@gilded rover this need to be in config.cpp. Meaning you have to create addon, not just a mission

winter rose
#

SP only, when you start/play/win/lose the mission @fair drum

gilded rover
#
{animate["terc", 0]} forEach (allMissionObjects "TargetP_Inf4_Acc1_F");
``` unrelated to firing drills , but almost the same , why does it want me to place a ; inbetween animate and ["terc",0]
#

@gilded rover this need to be in config.cpp. Meaning you have to create addon, not just a mission
@dim terrace ahhh , I guess the same goes for CfgFiringDrills , also part of a mod

unique sundial
#

@gilded rover check animate syntax, you are missing left argument entirely

gilded rover
#

I was afraid of that , would be nice if this forEach would work

unique sundial
#

should place _x in front of animate. check forEach syntax too, donโ€™t need to poke as blind man when all the info is available and explained on wiki

still forum
#

@torn juniper requests go to feedback tracker

#

@gilded rover FiringDrill support without mod config is WIP, check the wiki page

gilded rover
#

@gilded rover FiringDrill support without mod config is WIP, check the wiki page
@still forum Thanks , I saw so , still trying to crack it because I am very excited ๐Ÿ˜„ been waiting for years and you guys surprised me , Thank you ๐Ÿ™‚

finite sail
#

myvalue = {bool1 and bool2 and bool3} count myarray
can I use lazy eval here?
myvalue = {bool1 and {bool2 and bool3}} count myarray

little raptor
#

You can lazy eval anywhere

finite sail
#

ty ๐Ÿ™‚

little raptor
#

as long as the first expression is a bool

finite sail
#

my value = {bool1 and {bool2 and {bool3}}} count myarray
should I be doing this then? is that even better?

little raptor
#

Depends on how slow each expression is

finite sail
#

they are all getvariable

little raptor
#

getVars aren't slow enough to merit lazy evaluation

#

Only one is enough
The one that is the "primary" factor

finite sail
#

thanks

still forum
#

if you do exactly what you wrote above, bool1 being a global variable.
Your lazy eval will probably be slower than without lazy eval

#

also always think about what is the normal case

#

if you expect the first 2 variables to usually be true, it makes no sense to put lazy eval onto it

finite sail
#

they arent globals, i just wrote that for clarity, they are all getvar

still forum
#

every lazy eval adds overhead, and if you know that first value is probably always true, then you know the second value will probably always need to be checked, so lazy eval makes no sense

little raptor
#

if you expect the first 2 variables to usually be true, it makes no sense to put lazy eval onto it
What I meant by the "primary" factor (What varies the most)

still forum
#

getVar is also pretty chaepish

#

you can always just measure

finite sail
#

ok thanks

little raptor
#

@finite sail Lazy evaluation is pretty much the same as if/else:

if (true && {expression; true}) then {
}

is pretty much the same as:

if (true) then {
  expression;
  if (true) then {
  }
};

the only difference is that the private variables in the {expression; true} scope will not be accessible in the then {} scope.
Performance-wise they should be pretty much identical.

still forum
#

performance wise lazy eval will be faster cuz no "if" statement, only a "then"

little raptor
#

yeah by ~0.0002 ms at most

gilded rover
#
class MyFirstFiringDrill // This class should correspond to the class in CfgFiringDrills above
            {
                directory = "\Task_Force_461_Firing_Drills_ArmA3\MyFirstFiringDrill.VR"; // Full path to your drill's scenario folder
                briefingName = "CoF: My First Drill"; // Name of your drill (normally the same as defined in CfgFiringDrills)
                overviewText = "Training"; // Overview text of your drill (idem)
                overviewPicture = ""; // Overview picture of your drill (idem)
                overviewScript = "\A3\Modules_F_Beta\FiringDrills\scripts\overviewScript.sqf"; // Standard system script to handle the pause menu properly - don't change
                author = "Me"; // You!

            };```
so when i load my firing drill , It loads the scene for my main menu , any idea why?
distant oyster
finite sail
#

i turned it off, @distant oyster , couldnt make it work

#

prefer this

cosmic lichen
#

Same here. Never got it too work

little raptor
still forum
#

Load ArmaDebugEngine in game

#

in my example, I will have the "ArmaScript" folder open as workspace folder inside VSCode

#

so I link workspaceFolder to z\TC, my pboprefix

distant oyster
#

will this work with missions too?

still forum
#

if you get the prefix path correct, yes

#

getMissionPath ""
to get it ingame

distant oyster
#

When loading CBA, @Intercept Minimal Dev and @Arma Debug Engine this error occurs:
Script \z\armascriptprofiler\addons\main\dummycert not found

woven ether
#

hey guys, does anyone know of a good way of having an in-game video with positional sound? I am not sure if the way I am trying to do this is the best way or not...
Currently, I am using BIS_fnc_playVideo to play a video on an object, yet the audio of the video is not coming from the object. A workaround i thought was splitting the video and the audio so that i can play the video in the TV and then also use playSound3D to start the .ogg audio file as coming from the same object (yet, i cannot get playSound3D to work for some reason...)

little raptor
#

Using playSound3D during a mission requires the full path to the sound file.

woven ether
#

yeah, for playSound3D i was using getMissionPath "path to file in mission folder" but still didn't work. I am not in front of my pc right now so i'll try a couple more things later on

torn juniper
still forum
#

@distant oyster that error is normal

#

no

distant oyster
#

yeah installed your Arma Script Profiler, now it started without error. Maybe a dependency is needed :)

still forum
#

no

#

its not needed

#

that error is normal

#

you don't need the profiler

#

its just me being lazy

smoky verge
#

Has anyone ever used Alias snow storm script?
is there any way to turn it off?

little raptor
#

@smoky verge Read the script to see how it works.
My initial guess:

al_snowstorm_om = false

will turn it off

smoky verge
#

whats _om from?

little raptor
#

dunno

winter rose
#

OldMan?

#

not even a joke! ^^"

little raptor
#

Yeah. He predicted it way before it was released

winter rose
#

mayhaps :p

little raptor
#

@smoky verge Maybe a typo (maybe it was "on"), or maybe an abbreviation or maybe a word in their native language

smoky verge
#

yeah I mean where did you find that name?
I'm checking the sqf files of the script and I don't see it

little raptor
#

I deleted the file

#

something like "al_snow.sqf"

smoky verge
#

oh I see it
public variable

little raptor
#

you could've just used Notepad++ and searched in all files at once ๐Ÿคท

smoky verge
#

I am, you can ctrl+f along multiple files?

little raptor
#

Find in Files tab

#

then specify a filter

#

like *.sqf

smoky verge
#

oh cool

#

mhmm can I just run it through the console?

little raptor
#

run what?

#

al_snowstorm_om = false?
Yes

smoky verge
#

yeah that

#

mhmm didn't seem to do anything

little raptor
#

if you're in MP you should also publicVariable it

smoky verge
#

how do I publicVariable something?

little raptor
#
al_snowstorm_om = false;
publicVariable "al_snowstorm_om"
smoky verge
#

mhm didnt work

little raptor
#

well that gives you an idea how to do this.
what I wrote would disable "something" but I'm not sure what it was exactly (maybe fog only?)
check out other vars too
Just search in all files using regex to find all the global variables, then see what they do

smoky verge
#

yeah I'll try thanks

ripe sapphire
#

guys im learning eventhandlers, can you guys tell me which one is better for performance?

 waitUntil {
    if (player isFlashlightOn currentWeapon player) then {player action ["GunLightOff", player]; playsound "electric"};
    sleep 1.5; generatorOn};
hint "script continue";
playsound "electric";
player action ["GunLightOn", player];

or

addMissionEventHandler ["EachFrame", {
    if (player isFlashlightOn currentWeapon player) then {player action ["GunLightOff", player]; playsound "electric"};
}];
waitUntil{generatorOn};
removeMissionEventHandler ["EachFrame", 1];
hint "script continue";
playsound "electric";
player action ["GunLightOn", player];
distant oyster
#

the waituntil is only executed every 1.5 seconds so it takes less performance while the eachframe executes approx. 60 times per second. eventhandlers are supposed to be used to trigger on the desired action, eg if there was an eventhandler for "ToggleFlashlight" it would be more performant

#

especially eachframe eh have to be VERY performant since they are executed so often

#

on the other hand having a 1.5 second delay might miss the action of the player. eg he could turn on the flashlight every second and leave it off for 0.5 seconds and the script would never know

ripe sapphire
#

i see, my scripts dont need to be checked too often, and im fine with having 1 second delays for most of the loops, so in this case i should just stick with waitUntil yes?

#

on the other hand having a 1.5 second delay might miss the action of the player. eg he could turn on the flashlight every second and leave it off for 0.5 seconds and the script would never know
@distant oyster this is ok, my intention is just to prevent them from keeping them on

distant oyster
#

but for the beginning, yes your method suffices (probably)

jade abyss
#

@ripe sapphire Eventhandler have the advantage, that you don't have to constantly check (e.g. running a loop) for something. They only trigger, if the selected "option" triggers.
Yours work, yeah, but it isn't performance friendly (since you "spawned" a new Thread). The less, the better.
It's like having your car constantly draining its battery, to check if the key is in and turned.
Eventhandler would be triggered by turning the key.

winter rose
#

good analogy btw (and yes, I know, I said "anal")

jade abyss
#

(hihi)

little raptor
#

Let me contact the admins to ban this guy
oh shoot he's an admin

winter rose
#

description**.ext**?

ripe sapphire
#

@ripe sapphire Eventhandler have the advantage, that you don't have to constantly check (e.g. running a loop) for something. They only trigger, if the selected "option" triggers.
so would it be better to use waitUntil to check for things that are not defined as an EH? (like in my case the variable generatorOn)

Yours work, yeah, but it isn't performance friendly (since you "spawned" a new Thread). The less, the better.
I'm sorry, can you explain a little more about this? ๐Ÿ™

It's like having your car constantly draining its battery, to check if the key is in and turned.
by this, do you mean this happens when using EH or when not using EH?

thanks ๐Ÿ™‚

winter rose
#

the less threads (created by spawn) the better, so the game has less threads to process

ripe sapphire
#

can you tell me the definition of a thread? couldnt find it when i search the wiki xd

little raptor
#

by this, do you mean this happens when using EH or when not using EH?
He means using loops. Doesn't matter whether it's each frame or waitUntil

winter rose
#

a thread is kind of a "script instance"

still forum
#

A thread is a script that can be paused at any point, and continued later

#

i guess

winter rose
#
private _thread1 = [] spawn { while { alive player } do { hintSilent "alive!"; }; };
private _thread2 = [] spawn { waitUntil { not alive player }; hintSilent "dead!"; };
```these two threads will work in """parallel""" (actually, 3ms slice each)
little raptor
#

what's the deal with the second one?!

still forum
#

lou big typo

#

or not?

#

maybe

winter rose
#

๐Ÿฎ perhaps

little raptor
#

@winter rose @still forum do doesn't accept waitUntil

winter rose
#

what's the deal with the second one?!
nothing! carry on ๐Ÿ‘€

ripe sapphire
#

xD

little raptor
#

If you still haven't studied this, now is a good time:

ripe sapphire
#

so, in this case of my script (#arma3_scripting message)
which is the new thread that i spawned in the 2nd one compared to the first?

#

and yes leopard im studying it right now

little raptor
#

which is the new thread that i spawned in the 2nd one compared to the first?
this is only one thread. I'm not sure if these guys meant something else you wrote before?

#

I think what they meant is the second one:

addMissionEventHandler ["EachFrame", {
    if (player isFlashlightOn currentWeapon player) then {player action ["GunLightOff", player]; playsound "electric"};
  if !(generatorOn) exitWith {};
  removeMissionEventHandler ["EachFrame", _thisEventHandler]
  hint "script continue";
  playsound "electric";
  player action ["GunLightOn", player];
}];
ripe sapphire
#

im guessing, in the 2nd one i used oneachframe to execute the script, then used waitUntil too to check if the variable is true so i can remove the eachframe EH?

#

so i have 2 threads running each frame?

little raptor
#

eachFrame is not scheduled, so technically it's not a thread. (all event handlers run unscheduled)

#

But you had two loops running

ripe sapphire
#

ah right, thats why eachframe doesnt accept sleep yes

little raptor
#

yup

#

You can still have sleep

#

But not using sleep

ripe sapphire
#

But you had two loops running
i guess this is the case

little raptor
#
NextTime = time + 1;//sleep 1
onEachFrame {
  if (time > nextTime) then {//sleep 1
    nextTime = time + 1;
    //code
  }
}
ripe sapphire
#

ok thats a little too extreme ๐Ÿ˜‚

little raptor
#

This simulates sleep for unscheduled codes

ripe sapphire
#

but thanks that nice knowledge for me ๐Ÿ‘

#

ok im sorry for asking too much but my last question:

so would it be better to use waitUntil to check for things that are not defined as an EH? (like in my case the variable generatorOn)

little raptor
#

@still forum I know they aren't the same!

still forum
#

if you don't mind the time delay (waituntil might be a couple seconds later) yes.

#

because with waitUntil you can't cause as big problems as with EachFrame handler

little raptor
#

@ripe sapphire Yes. waitUntil and while are preferred

so would it be better to use waitUntil to check for things that are not defined as an EH?

ripe sapphire
#

(waituntil might be a couple seconds later)
๐Ÿ˜ฎ how?? i thought theyre executed mostly every frame??

still forum
#

at best, once per frame

little raptor
#

depends on the scheduler queue

still forum
#

depends on how much other stuff is going on

ripe sapphire
#

ok so if theres nothing else going on it should be instant yes?

little raptor
#

at least one frame delay (but technically you can call that instant)

still forum
#

script "threads" can only execute for 3 milliseconds every frame.
if too many other scripts are there, and they execute before your waituntil you will be delayed

ripe sapphire
#

at least one frame delay
@little raptor i can live with that xd

#

ok, but if i use EachFrame EH then it wont be delayed yes?

little raptor
#

yeah

ripe sapphire
#

in what cases would u recommend the eachframe EH?

little raptor
#

if what you're doing is fast enough (performance wise) and it requires to be checked literally every frame

winter rose
#

usually UI things

little raptor
#

@ripe sapphire try this to see how the waitUntil delay increases the more threads you have:

for "_i" from 1 to 100 do {
[] spawn {while {true} do {for "_i" from 0 to 1e9 do {1}}};
};
[] spawn {_lt = time; waitUntil {hintSilent str (time - _lt); _lt = time; false}}

It shows the delay since last frame

#

usually UI things
yeah for example when you want to draw an icon in the world, or move an object (as in full motion) using script

ripe sapphire
#

i see, and thanks i will try it out!

#

would a while loop's delay be even worse than waitUntil?

#

or faster but worse performance?

little raptor
#

while doesn't have a delay by design

still forum
#

while with sleep, is about same as waitUntil

#

waitUntil just has the sleep built in

little raptor
#

But anyway, what we said about delay applies to all scheduled scripts

#

waitUntil {code; condition} is almost the same as:

while {code; !condition} do {uiSleep 0.001}
still forum
#

why does everyone want uiSleep :U

smoky verge
#

they sleepy

little raptor
#

I don't

ripe sapphire
#

i see, so if i use sleep 1.5 with waitUntil, and the scheduler is full, delay will be a lot more seconds? meowsweats

little raptor
#

full is a relative term here

still forum
#

not alot

little raptor
#

depends on how slow each thread is

still forum
#

probably just a few

jade abyss
#

so would it be better to use waitUntil to check for things that are not defined as an EH? (like in my case the variable generatorOn)
No, the opposite. @ripe sapphire

It's like having your car constantly draining its battery, to check if the key is in and turned. <-- Loop
Eventhandler would be triggered by turning the key. <-- (as it says: Eventhandler)

#

oh boy... there were more messages below...

#

why does everyone want uiSleep :U
@still forum Because more reliable in MP?

still forum
#

huh?

#

no

jade abyss
#

Yes

still forum
#

no?

jade abyss
#

Yes

still forum
#

What? Why?

little raptor
#

it should be the same (in MP)

still forum
#

Sleep gets paused when ingame time is paused, uiSleep doesn't. In multiplayer ingame time cannot be paused

ripe sapphire
#

probably just a few
oh ok xd

jade abyss
#

Wasn't sleep related to ingame stuff?
uiSleep takes the other time thingy?

still forum
#

yes

#

as I wrote

jade abyss
#

As said: Just talking about MP

still forum
#

but why would that make any difference

#

yeah just talking about MP there is no difference

jade abyss
#

Frames low = sleep takes longer.
Noticed a couple times. No issues with uiSleep

still forum
#

huh

#

time is time. No matter what your FPS are

jade abyss
#

We had this topic a while ago, that sleep can delay like stupid. So sleep 1; != 1s, but +X Seconds

still forum
#

yeah

#

same for uiSleep

#

thats caused by the scheduler, not by the sleep command

jade abyss
#

afaik, uiSleep doesn't take the simulation time (or hoewever it was called), which can be slowed down. And uiSleep doesn't uses the other thingy.

#

https://community.bistudio.com/wiki/uiSleep

Description:
Suspend execution of script for given uitime. uiSleep is a sleep method to delay script execution where script time/simulation time is stopped. uiSleep is basically using the system time (uiTime more specifically) and not simulation time. So in the cases where sleep command would get stuck indefinitely, uiSleep can still be used to effectively delay script execution. For example in a mission briefing or an editor or when simulation is paused in general.

ripe sapphire
#

ok all my questions are answered for now, thanks a lot and good night gentlemen ๐Ÿ™‚

jade abyss
#

n8

still forum
#

yeah. That just repeats what I already told you Dscha

little raptor
#

np gn8

jade abyss
#

So?

little raptor
#

I gotta admit that time simulation is kind of weird. For example, if you use: setAccTime 0.01 time doesn't advance at all

jade abyss
#

As mentioned before: sleep can be delayed (in MP) and take way longer than the given sleep-time, e.g. when its SimuTime slowed down on the Server. While uiSleep is more accurate, from my experience.

still forum
#

you can slow down time in MP?

#

I thought that was SP only

little raptor
#

No in SP

#

I was just talking in general

still forum
#

But Dscha just said in MP

cunning crown
#

No SP only afaik, that would be odd to be able to slow down time in multiplayer

jade abyss
#

I mean, would be nice.

#

Oh btw:
Weekly reminder @still forum : Hashmap.

still forum
#

No

#

I first gotta investigate your bug that sleep is sometimes delayed in MP

jade abyss
#

That's known for years now, maybe even decades

still forum
#

that shouldn't be happening tho

little raptor
#

also can you see why time doesn't advance in my case?

still forum
#

time is a float, maybe less than min step

little raptor
#

hmm, yeah probably

jade abyss
#

Posted on October 18, 2014 - 21:24 (UTC)
AgentRevolution
For server scripts, if you are creating "while true" timers, it is best to use uiSleep instead, as the sleep from that command is not slowed down by simulation / server lag, so the timers will execute at intervals that are much closer to real time, even under heavy lag.

still forum
#

And you cannot set accTime on server, so its always 1 in MP

#

Glob.time is sleep. Glob.uiTime is uiSleep

#

they are right next to eachother. There in the screenshot you have the whole code that controls both timers

jade abyss
#

What's the difference between time and uiTime?

still forum
#

server lag would influence both the same amount.
only difference between them...

#

Look at the screenshot dude

#

first two lines at the top

#

thats the difference

finite sail
#

in Newcastle, they use WayEye Time

still forum
#

Actually you can set AccTime in MP. The script command isn't blocked. Maybe it just gets reset?

jade abyss
#

Was it changed, in the past?

still forum
#

can't check that now. And don't even wanna blame that file to the last 6 years

jade abyss
#

aye, fair.
Anyway, might have been fixed in the past years? idk. It's easily a couple years ago, that i ran into that issue the last time.

still forum
#

Huh.. throwing without catch in scheduled causes error spam.. Maybe that should be fixed ๐Ÿค”

jade abyss
#

yeaaahhhhhh, i guess so

little raptor
#

who uses throw anyway?!

still forum
#

can't find a ticket about uiSleep

#

And searching for sleep is too generic

winter rose
#

looking* for sleep ๐Ÿ›Œ

jade abyss
#

tbh, i can't remember, if i have ever seen one ๐Ÿค”

meager ember
#

damn, I just realized where I've seen "this select 0" and stuff like that before

#

TCL

winter rose
#

TCL?

meager ember
#

Tool Command Language

#

earlier extensively used to program IRC bots

#

together with Tk you had an easy and...well...slow UI

finite sail
#

isnt it a bit like "select 0 from"

#

SQL

smoky raptor
#

Hello, my gaming community runs Zeus based missions. To allows us to keep spawning units in Zeus, we used a script removed dead/empty groups. However since Arma3 2.0 the script no longer works. I am no scripter, so not sure why its broken. The script is

while {count allGroups > 5} do 
{
{
    if (count units _x==0) then {deleteGroup _x}
} forEach allGroups;
sleep 600;
};``` 

I found on the BI wiki the following, could this do the same job if adapated?

```if (local _group) then {
    _group deleteGroupWhenEmpty true;
} else {
    [_group, true] remoteExec ["deleteGroupWhenEmpty", groupOwner _group];
};```
robust hollow
#

yes it could

#

there is possibly a zeus event for when groups/units are created. you could use that to set the group to delete when empty and then you dont need to use a loop at all

#

a quick test suggests this might work for using deleteGroupWhenEmpty

zeus addeventhandler ["CuratorObjectPlaced",{
    params ["","_unit"];
    private _group = group _unit;
    
    if !(isGroupDeletedWhenEmpty  _group) then {
        _group deleteGroupWhenEmpty true;
    };
}];
smoky raptor
#

Thanks, so no loop required?

robust hollow
#

nope, just the event (added to the curator module)

smoky raptor
#

Thanks much appreciated - will test that out.

woven ether
#

hey everyone... So, I've been playing with a piece of audio i want to add to a mission, but somehow i cannot get the .ogg file to play in-game. Outside i can hear it just fine, and i've been trying to reproduce it through playSound3D, playSound and even say just to try different stuff.
The .ogg file is on my mission folder, for playSound3D I did: playSound3D [getMissionPath "filename", player] to no avail. And for playSound I first added my sound to the Description.ext file under CfgSounds but the thing complains that the sound cannot be found. Something else i tried was to do it through music, but when i add the class to CfgMusic the game still complains that it cannot find testMusic (the class name)

Any clues as to what I might be doing wrong or how i can troubleshoot this?

winter rose
#

1/ some wrong Description.ext
2/ wrong filepath for playSound3D maybe

queen cargo
#

this[0] much better (#sqc #notdocumented #onlywithsqfvm)

woven ether
#

@winter rose do you see anything odd here?
Description.ext

class CfgSounds
{
    sounds[] = {};

    class test1
    {
        name = "Test Music";
        sound[] = { "test_audio.ogg", 10, 1 };
        titles[] = {};
    };
}

and if i do getMissionPath "test_audio.ogg" i do get C:\Users\goltr\Documents\Arma 3 - Other Profiles\Goltred\missions\MedTraining.Altis\test_audio.ogg"

ripe sapphire
#

Maybe do { โ€œ\test_audio.oggโ€, 10, 1 };

woven ether
#

tried that and the only thing that changed is that i don't see the "cannot find test1" message anymore, yet there's still no audio output

exotic flax
#

Perhaps something very stupid (and I know, I once had the same issue); are the sound settings in-game set up to be audible?
Because we don't want you to debug an issue which is caused by something unrelated ๐Ÿ˜‰

ripe sapphire
#

Can u post the code u used to play the sound?

#

Try this on the description.ext { โ€œ\test_audio.oggโ€, db+10, 1 };

robust hollow
#

yea i'd try turning down the volume (db+10 might do it as shown โ˜๏ธ). the playSound3D command says the max volume (at least for that command) is 5, so maybe volume 10 in this is too high as well ๐Ÿคท

woven ether
#

@exotic flax Oh boy, you might be onto something... I assumed I would have audio since BIS_fnc_playVideo had audio for another video with the audio embedded... and i also have ambient and effect sounds. BUT, i do have music all the way down i believe o.O gonna check that now
@robust hollow @ripe sapphire i'll try the db for playSound, so far i just changed that from 1 to 5 to 10 on different tests, for playSound3D i just used playSound3D [getMissionPath "filename", player] on the debug console (the one appearing when pressing escape in-game)... i am not applying volume on the command instead but i did read that the max is 5 and nothing changed

still forum
#

@zenith totem you know if thats really still an issue?

cosmic lichen
#

@still forum I can repro that. Not funny. That lag ๐Ÿ˜„

compact maple
#

Hi,
I am facing a problem with the getUnitLoadout command.
If I execute this command on local getUnitLoadout player, it returns the actual gear of the player

but if I do the same server-side, it returns the gear that the unit spawn with and not the actual one, is it a known issue ?

exotic flax
#

player is always local, so if you run that on the server it doesn't get the actual player

compact maple
#

Yes I know I mean

#

to test I did

a = player;
publicVariable "a";

then I did on the server-side

b = getUnitLoadout a;
publicVariable "b";
#

and the two loadout are not the same

#

I spawned with 3 mags, I empty 2 of 3, and I have only 21 bullets left
in local, everything's ok, I have 21 bullets and 0 mags in getUnitLoadout
but server side I have 21 bullets plus 2 mags in getUnitLoadout

still forum
#

@cosmic lichen so you have repro on 2.00? Cuz i don't in internal dev :u

exotic flax
#

@compact maple according to the wiki on publicVariable

It is not possible (and illogical) to transfer a local entity reference, such as scripts, displays or local objects.
Also, note that Team Member is not supported.
Which could be the issue, where the player object (a 100% local variable) cannot be transferred.

still forum
#

player object is not a local object

exotic flax
#

what? if I use player it's always the local player, not a random client ๐Ÿค”

still forum
#

yes

#

it is

compact maple
#

Well, when my server starts, I spawn a "save thread", that will execute some queries with extdb3 every xx seconds to save the player state, including his gear. So in my script I am not transfering anything, I am just using the BIS_fnc_listPlayers function, and get the loadout in a forEach

still forum
#

doesn't change what i said. And I meant that no you're wrong, player is not local, and player can be transferred via pubvar just fine (if the variable has a valid name)

cosmic lichen
#

@still forum I will look at it later and send you a repro if I can.

still forum
#

I tried the one in ticket, but couldn't repro with that

hollow thistle
#

"player" is global object but it's locality is alwyas on a machine that controls that object.

exotic flax
#

Does someone have a minute to try to repro https://feedback.bistudio.com/T143685 for me?
I can't repro on 2.01, aka just one log message, not endless spam.
@still forum I ran the code on 2.00.146773 and it only logs the error once

hollow thistle
#

local object is something from createVehicleLocal, createSimpleObject with local flag etc.

compact maple
#

sure, the problem is that the server doesn't get the same loadout as the client does

#

and I do not understand why

exotic flax
#

@still forum hmm... if I run it in the debug console directly in the editor, it only logs the error once. If I run it (as the repro) in a mission, it spams the error as described

still forum
#

I also tried in mission, editor preview

exotic flax
#

added a note on the ticket

compact maple
#

should I open a ticket or something for my problem ?

little raptor
#

@compact maple It's not a bug.
You're supposed to remoteExec getUnitLoad on the machine where the unit is local.
You can't publicVariable the unit and use it on another machine (because the unit is not local to this machine)

compact maple
#

It was for debug purpose, to get the unit loadout, I am using the BIS_fnc_listPlayers function on the server

#

so with this function, I should be able to get the actual loadout of all players right?

little raptor
#

why? you have allPlayers

cosmic lichen
#

As long as you don't need all player right at mission start and don't have HCs connecting, don't use that function.

little raptor
#

and you should remote execute it (getUnitLoadout) on every player machine

winter rose
#

As long as you don't need all player right at mission start, don't use that function.
using it everywhere in CAAS actually

compact maple
#

Ok, I am trying this with allPlayers then

#

same problem, I will have to remoteExec it I guess

little raptor
#

Of course you should. We just said don't use that function

#

Never use functions when you have command alternatives

compact maple
#

But as my script is running server-side only, I can't return a value with a remoteExec

winter rose
#
private _headlessClients = entities "HeadlessClient_F";
private _humanPlayers = allPlayers - _headlessClients;
```if you don't have Headless Clients, use `allPlayers` yes
little raptor
#

You can, for example, use setVariable

#

or use a publicVariable

#

actually I had a question now

#

if I use pushBack on a public var, do I have to public var it again?

cosmic lichen
#

I guess so.

#

or maybe...

potent depot
#

Yes

#

Public var essentially just pushes the variable to everyone

compact maple
#

yes, I just tried it

little raptor
#

Public var essentially just pushes the variable to everyone
and pushBack modifies the original array.

potent depot
#

Of the local client, yes

little raptor
#

anyway, I guess we have the answer now

cosmic lichen
#

Yeah but it's not making that change global

little raptor
#

yeah, that's the part I wasn't sure of

cosmic lichen
#

Imagin having pushBack in a loop and every change would be pubished through the network

potent depot
#

Do be careful with large usage of publicvar as it is an extra message for the server to send to everyone. Use it only when you need to

winter rose
#

which should be never, btw ๐Ÿ˜

potent depot
#

But muh HC

compact maple
#

actually, the server get the actual gear of the player except the magazines, I think its a bug

potent depot
#

Server should be able to get the gear of a unit. Yeah

little raptor
#

@compact maple You can use this then:
on server:

LoadOut = [];
{
  [_x, {
    [getUnitLoadOut _this, {LoadOut pushback _this}] remoteExec ["call", 2]
  }] remoteExec ["call", _x];
} forEach allPlayers;
cosmic lichen
#

oO

potent depot
#

Is that a nested remotexec?

winter rose
#

๐Ÿคฎ

cosmic lichen
#

looks like a crime

potent depot
#

Dear god

little raptor
#

so you'd rather publicVariable that on every machine than do this?

winter rose
#

(but still, would work for debug purpose)

compact maple
#

I am not using publicVariable

#

it was for debug purpose

#

because the original script

#

doesn't work

#

as intended

potent depot
#

What are you trying to accomplish again?

compact maple
#

ok, sec, will copy/paste things

little raptor
#

Is that a nested remotexec?
yes

potent depot
#

You can message link if itโ€™s easier

still forum
#

pubVar especially bad on array, because everytime you send the complete array

little raptor
#

@still forum Is my method better then?

still forum
#

[LoadOut, getUnitLoadOut _this] remoteExec ["pushBack", 2] that won't work.

little raptor
#

that;s why I wrote it that way

#

oh right

#

I changed it

#

I'll correct it again

still forum
#

you are sending a copy of your array, then pushBack to it on the receiver, and then delete the copy

little raptor
#

Done

#

how about now?

compact maple
#
save_players.sqf
{
    [_x] call SRV_fnc_on_update_player;
} forEach allPlayers;

on_update_player.sqf
private _player = param [0, objNull, [objNull]];
private _player_id = _player getVariable ["client_player_id", 0];
private _player_gear     = format ["%1", getUnitLoadout _player]; //Here is the problem
[_player_id, _player_gear] call SRV_fnc_update_player;

So, the scripts above triggers every 60 seconds to save the player gear
if I have 3 magazines, and I empty 2 of them, the function getUnitLoadout on the server will ALWAYS include the 3 magazines, even if I drop them on the floor, etc.

potent depot
#

So the server needs to save the gear of all players on the timer?

compact maple
#

yea

cosmic lichen
potent depot
#

You sure that getloadout is doing that?

compact maple
#

Wdym ?

still forum
#

That should work i guess

potent depot
#

Can you try: โ€˜getUnitLoadout [unit, false]โ€™

compact maple
#

I did try

#

same results

potent depot
#

Even with false?

little raptor
#

what are you even talking about. problem is already solved. remoteExec that

#

Jeez

compact maple
#

I should not have to remoteExec something the server can access with a simple cmd

#

thats the point

potent depot
#

Odd that the server is having issue with it.

exotic flax
#

it's SQF we're talking about, nothing is simple ๐Ÿคฃ

compact maple
#

@potent depot yes even with false

potent depot
#

Would saving the load out to the userโ€™s profile be an option?

compact maple
#

Nope

#

I don't want the player to be able to modify it

potent depot
#

Are you checking the load out via the print or by using set load out onto another unit?

compact maple
#

just by quitting and reconnecting my server

#

when the player leave > I save it in database
when he connects > I load it

#

The weird thing is it works for any equipments but the magazines.

exotic flax
#

but why not simply send the output of getUnitLoadout to the server on disconnect? ๐Ÿค”

#

that solves all your problems

compact maple
#

yep I will have no options but to do that

exotic flax
#

like; I also get loadouts from a DB (server side), send that to the player and let the client handle the rest

#

works 100% of the time

compact maple
#

no problem with magz ?

#

when you save it I mean

exotic flax
#

I don't save the loadouts, since the use case is different (I only get loadouts at mission start, which are predefined)

compact maple
#

Alright

#

but Im not sure the client can send something to the server when dc

#

as its a mp EH ?

exotic flax
#

no idea if that allows getting the loadout though

compact maple
#

I am using HandleDisconnect server-side because PlayerDisconnected doesn't send the player object

exotic flax
#

well, in that case it might a problem that the unit send to that EH is not correct

compact maple
#

yup

#
addMissionEventHandler ["HandleDisconnect", {
    params ["_unit", "_id", "_uid", "_name"];
    [_unit] call SRV_fnc_on_update_player;
    [format["[fn_HandleDisconnect]: [%1] [%2] [%3] disconnected.", _uid, side _unit, _name]] call SRV_fnc_log_me;
    false;
}];
#

well

#

will work something out

#

but I really think there is something that is wrong with the getunitloadout cmd

exotic flax
#

never had any issues with it ๐Ÿค”

compact maple
#

if you have 3 minutes, test it
create a unit with a weapon, a bag, 3 magz in it, empty some
check your loadout client-side with the cmd and compare it with the same cmd but server-side

#

they are not the same

crude needle
#

Where'd you put the mags and is the unit editor placed?

Tested it on both dedicated and hosted several times a few minutes ago with the same results with getUnitLoadout between client and server every time.

exotic flax
#

client and server both return the same results

compact maple
#

Have you tried to empty some magazines ?

crude needle
#

I did.

exotic flax
#

repro:

  • place unit in editor
  • set unit variable to player1
  • start mission as MP
  • run getUnitLoadout player1; with LOCAL EXEC
  • run getUnitLoadout player1; with SERVER EXEC
    see: both results are the same
  • empty magazines
  • run getUnitLoadout player1; with LOCAL EXEC
  • run getUnitLoadout player1; with SERVER EXEC
    see: both results are the same
compact maple
#

uuh

#

I guess something must be wrong with my code

#

I have no idea what it could be

exotic flax
#

like I said; it could be that HandleDisconnect is not returning a correct version of the unit (like returning the unit from 3 minutes ago)

compact maple
#

yup, that could be it

compact maple
#

there, there is no EH or anything, just the command

#

and the return is not the same

#

my head's burning

exotic flax
#

and how many players are currently in that mission?

#

check count allPlayers

compact maple
#

Just me

#

1

#

Idk, I have only an empty bag and a weapon, still the server returns

[["arifle_AKM_F","","","",["30Rnd_762x39_Mag_F",28],[],""],[],[],[],[],["B_FieldPack_blk",[["30Rnd_762x39_Mag_F",2,30]]],"","",[],["","","","","",""]]
#

it includes magz in the bag that doesnt even exist

#

hm

#

I took another bag

#

and now it works

#

I have no idea how but it works now

exotic flax
#

just tested the exact same script, and it works perfectly fine for me ๐Ÿค”

compact maple
#

Idk man x), I did go in virtual arsenal, changed bag, and it worked

exotic flax
#

got a feeling you have some other scripts/mods in place which break stuff...

compact maple
#

I have no mods/scripts running in background:[

#

I am starting from scratch

stable wedge
#

How would one go about moving a game logic module via triggers?

#

More specifically, I want to have blufor units cross an area, setup via a trigger, and on activation the game logic module would move to a different location. I understand how to make it work with markers but not with game logic module

#
"mmfw_core_RESPAWN_BLUFOR" setMarkerPos getMarkerPos "spawn1";
hint "Friendly forces have moved up. New respwan point is at Surf Club (2133 , 1045)";
little raptor
#

If you want the area to move just move the trigger

#

mytrigger setPos newPosition

stable wedge
#

oh

#

I am doing

"mmfw_core_RESPAWN_BLUFOR" setPos getMarkerPos "spawn1";
hint "Friendly forces have moved up. New respwan point is at Surf Club (2133 , 1045)";
#

and I get Generic Error in expression

#

using getpos, same thing

#

And to be clear, I need the game logic module named mmfw etc to move

#

not the trigger

sly mortar
#

I have a problem with a forEach. I have two of them. The first one works. But when I try to run the second one it is failing silently with no errors. If I comment out the second forEach the function works. But when the second forEach is trying to run it just kills the function with no errors. Wondering if a different pair of eyes will see what is wrong because I must be missing something. The second one starts on line 149 here: https://gist.github.com/vigilvindex/38a75a74a038622ca8abe80e6f9139c9

winter rose
#

simplify it first, this should reveal the error

sly mortar
#

You are right, I will break up the parse and sort loops into their own functions so it is easier to try and track down what is happening.

timid niche
#

Im in need of some big brained people.
Trying to position controls depending on the number they are.
Using a foreach loop and simply making a int var with the number it is at.
So like this:

private _nmb = 0;
{
 _nmb = _nmb + 1;
} foreach ("true" configClasses (missionConfigFile >> "someConfig");

But the big brain problem is that I am trying to set the position of each control created in the foeach loop, in a circle.
And I am not sure how I would do that without manually making each individual ctrl and getting the position of it.
Might be a bit unclear so please ask any question that might help.

little raptor
#

@stable wedge Do you see any " in what I wrote?

#

you have to provide objects for the first argument, not strings

#

I need the game logic module named mmfw to move
Why? Didn't you want to move the area? Logics don't do anything by themselves. Their positions are typically ignored

#

@timid niche I don't understand. You want them arranged in a circle. Where's the center?

timid niche
#

Center is the middle of the screen

#

And trying to position each control around the middle of the screen more or less

little raptor
#

And what is the radius?

#

And how many controls?

timid niche
#

Well thats the thing, it depends on some conditions, so it could be between 4 and 15

little raptor
#
_controls = _someArray;
_angle = 360/count _controls;
_Xc = safeZoneX + safeZoneW/2;
_Yc = safeZoneY + safeZoneH/2;
//Actually I think you could just use [0.5,0.5]?
{
  _x ctrlSetPosition [_Xc + _radius * cos (_forEachIndex * _angle), _Yc + _radius * sin (_forEachIndex * _angle)];
  _x ctrlCommit 0;
} forEach _controls;
#

radius and controls are up to you

#

Also, remember that the screen ratio is not 1:1 (depends on aspect ratio of your display), so it is a little bit trickier than that
In other words, you need two radii, one for X and one for Y (you have to create an ellipse, so that when it's elongated by the display you would get a round shape)
Not 100% sure tho. It could just work as it is

timid niche
#

ill give it a try and come back

stable wedge
#

@little raptor , yea not sure why I typed it with quotations here but I didn't have them in my code
I need the game logic to move as it is tied in to a separate module through a mod I am using

#

The game logic defines respawn position

little raptor
#

Well, same thing with logic. You can move them using setPos too

stable wedge
#
mmfw_core_RESPAWN_BLUFOR setPos [getPos spawn1 select 0, getPos spawn1 select 1, getPos spawn1 select 2]; 
hint "Friendly forces have moved up. New respwan point is at Surf Club (2133 , 1045)";
little raptor
#

what is mmfw_core_RESPAWN_BLUFOR?

#
mmfw_core_RESPAWN_BLUFOR setPosASL getPosASL spawn1; 
hint "Friendly forces have moved up. New respwan point is at Surf Club (2133 , 1045)";
#

and what is spawn?

stable wedge
#

variable name of the game logic

#

spawn is an empty marker

little raptor
#

you can't use getPosXXX commands with markers

finite sail
#

a marker? getmarkerpos

little raptor
#
mmfw_core_RESPAWN_BLUFOR setPos getMarkerPos spawn1; 
hint "Friendly forces have moved up. New respwan point is at Surf Club (2133 , 1045)";
stable wedge
#

Should work based on documentation?

#

since getpos and getmarkerpos both yield arrays?

little raptor
#

getPos doesn't accept markers

#

markers are strings

stable wedge
#

Right

#

I thought I used markerpos and still gave me an error, let me try this

little raptor
#

Are you sure spawn1 is a marker? Isn't it the marker name? If so:

mmfw_core_RESPAWN_BLUFOR setPos getMarkerPos "spawn1"; 
hint "Friendly forces have moved up. New respwan point is at Surf Club (2133 , 1045)";
stable wedge
#

yep, empty marker with variable name spawn1

#

I tried the first one, no errors but it didn't move my game logic

little raptor
#

so it's the marker name

stable wedge
#

trying second

#

Ok

#

Second one worked

#

why is that? even though it's a variable name, getmarkerpos wants a string input?

#

of that variable name?

#

wild

finite sail
#

markers are named with strings

stable wedge
#

zzz fair enough. Thank you for your help @little raptor

little raptor
#

np

winter rose
#

ugh, disableCollisionWith does not work for disabling collisions between a car and Land_InvisibleWall_F

little raptor
#

@winter rose It doesn't work with PhysX objs afaik

#

If you want, you can use wall hideObject true

#

Since it's already invisible, I'm sure it won't have any "visible" side effects!

winter rose
#

hue hue hue heeey, don't steal my jokes job!

#

that's what I ended up doing, but I have to be "fast" in catching someone passing it, as if you get out of the vehicle (and unhide the walls)โ€ฆ "boom" describes it quite well

fading plover
#

is there any command like setDir but for an objects elevation?

delicate lagoon
#

Hello. I dunno if i'm in proper section but my briefing.sqf doesn't seem to work properly. My code is pretty much this

switch (side player) do {

case civilian:
{

player createDiaryRecord ["Story", ["Epizode 1 xx.xx.2020","
text text text "]]; 

player createDiaryRecord ["Communication", ["test," test test test test"]]; 
player createDiaryRecord ["Communication", ["SMS Sprรกva"," test test"]]

player createDiaryRecord ["Tasks", ["Placeholder","
1. Placeholder
2. Placeholder
3.Placeholder
"]]
};

I also have init.sqf and the following code

[] execVM "Briefing.sqf";
#

any suggestion on how to fix it?

winter rose
#

@fading plover ```sqf
myObject setPosATL (getPosATL myObject vectorAdd [0,0,3]);

#

@delicate lagoon you are not telling what the issue is

delicate lagoon
#

It's not showing up at all

#

basically it's not creating any of the following from the code above

fading plover
#

thank you lou

winter rose
#

console error: error missing ] @delicate lagoon

#

use the show script errors in the launcher, will help you finding issues
that and read your .rpt

#

you are lacking a ; after ["SMS Sprรกva"," test test"]]

delicate lagoon
#

ah. Will do.

#

Thanks

#

still doesn't work

#

am I retarded?

sly mortar
#

Is there a problem with doing this to set up some arrays? I can use _x magic variable to assign like this?

private ["_array1","_array2","_array3"];
{_x = []} forEach [_array1,_array2,_array3];
winter rose
#

@delicate lagoon any other error?

delicate lagoon
#

I don't even see any errors popping out tbf

winter rose
#

@sly mortar apply

delicate lagoon
#

I enabled the debug console

#

yet no errors

winter rose
#

the debug console is not what shows error ๐Ÿค”

delicate lagoon
#

I mean

#

the thing what you told me to use ๐Ÿ˜„

#

script errors

winter rose
#

@sly mortar rather, ```sqf
[[], [], []] params ["_arr1", "_arr2", "_arr3"];

#

or private _arr1 = []; etc

#
private _array1 = [];
private _array2 = [];
private _array3 = [];
delicate lagoon
#

Okay. No script errors yet it doesn't work

winter rose
#

code?

delicate lagoon
#

I can send it over DMs?

#

And i mean

#

the briefing doesn't show

#

nor load

winter rose
delicate lagoon
#

you've it in DMs

sly mortar
#

Is this legit?

[_arr1,_arr2,_arr3] apply {[]};
winter rose
#

@sly mortar no.

#

private ["_var1", "_var2"] is an obsolete syntax

exotic flax
#

Is this legit?

[_arr1,_arr2,_arr3] apply {[]};

@sly mortar legit yes, although it will just return [[],[],[]]

still forum
#

no you cannot assign/change using _x =, because all = does is redirect the variable to a new value, it doesn't change the value that was in the variable

exotic flax
sly mortar
winter rose
#

@delicate lagoon Diary entry must be "Diary"

delicate lagoon
#

where?

winter rose
#

first argument

#

@sly mortar set edits the array itself

exotic flax
#

The wiki is correct, it changes the arrays.
You try to create arrays out of thin air ๐Ÿคทโ€โ™‚๏ธ

winter rose
#

don't use private ["_var1"] (ever) again, really

#

only in very rare scope cases can it be needed

delicate lagoon
#

You know what's weird. When i do it over Eden

#

it works

winter rose
#

there is no diary editor in vanilla Eden

delicate lagoon
#

but, script doesn't work at all. And the "Dairy" argument is who knows where. I'm kind of slow brained

#

huh

winter rose
#
player createDiaryRecord ["Diary", ["title", "content"]];
delicate lagoon
#

But there is module to do so

winter rose
#

oh, the modules

delicate lagoon
#

Yeah

#

that's what i meant

exotic flax
delicate lagoon
#

I want to die rn

winter rose
#

not yet! you have so much to suffer for

exotic flax
#

although the Modules should work the same; it requires a category ("Diary"), a title and content

delicate lagoon
#

Yeah those work in SP and local server

#

however when i move it over to Virtual server and start arma

#

Briefing is gone

#

P much arma hates me

exotic flax
#

the module should be in the mission.sqm, so I can't think of a reason why it's not packed in the pbo or not running ๐Ÿค”

delicate lagoon
#

Simply said. Arma

#

Fuck it. I'm gonna do it over modules because obviously arma is telling me to sctop scripting

#

This brings another question

#

how to skip line?

exotic flax
#

skip line?

delicate lagoon
#

like

#

to add gap between text

#

when working w module

#

oh is it

#

<br></br> ?

exotic flax
#

just <br/> should be fine (it works when scripting it)

delicate lagoon
#

hehe

#

what is scripting

exotic flax
#

using SQF

delicate lagoon
#

I know

exotic flax
delicate lagoon
#

But yeah

#

<br></br> works

winter rose
#

โ€ฆ<br/>

delicate lagoon
#

?

winter rose
#

use <br/>

#

that's enough, no need to add useless characters

delicate lagoon
#

Gotchu chief. As you can see

#

I'm REALLY new to the scripting!

winter rose
#

np, beginners are welcome here

delicate lagoon
#

thank you!

#

And if i'm correct to use new picture i've to add folder called pictures add actual picture inside and then add path

winter rose
#

unfold by clicking "Show text" and see all the options, also examples

delicate lagoon
#

Oh

#

Thanks haha

#

is .png even supported?

robust hollow
#

no. jpg or paa

delicate lagoon
#

Ah! Thank you good sir

modern sand
#

Is there anyway to get the exact directory location of a loaded mod using it's CfgPatches classname? Exactly how the server addon signature check works in terms of getting the exact directory of a loaded pbo

little raptor
#

no

#

your only options are allAddonsInfo getLoadedModsInfo

vague geode
#

Is there a way to add the rank insignia of a player's unit next to the player's name that is displayed above the player's head to close by friendly players?

bold bane
#

Is there a way to execute a post-process effect individually to a client?

What I have at the moment is:

if (playerSide == east) then {

player addEventHandler ["Local", {
params ["_entity", "_isLocal"];

setAperture 1;

}];

};

But no dice.

winter rose
#

"Local" EH is not meant for that ๐Ÿ˜‰

#

@bold bane you could e.g remoteExec BIS_fnc_setPPeffectTemplate

trail smelt
little raptor
#

Are you sure the doors can be locked? If they can, something like:

 _door setVariable ["bis_disabled_Door_1",1];

should lock them (and make sure it matches the door number)

trail smelt
#

Land_BackAlley_01_l_gate_F Can be locked, we tried it through the Achilles module and they were locked.

little raptor
#

Then you're either using the script wrong or maybe it doesn't work at all

trail smelt
#

The vanilla of the building works, but not on separate objects like this door ๐Ÿ˜

little raptor
#

@trail smelt I took a brief look at the script.
First of all, it only applies to the "nearsetBuilding". So if you change that line to your object it'll be fixed (I recommend that you edit it and pass the object as a second parameter instead)

#

Second of all, this will only work on doors with config

#

Third of all, custom door names will not work with it

#

In the case of your object, it'll probably work fine

trail smelt
#

I'll try it thank you.

smoky verge
#

I've made this super super basic line to teleport a teamleader
TL setPos TZ
how can I also teleport to TZ all group members of TL?
I recall I should add something like
forEach units group TL but I'm not sure about the correct syntax

#
{TL setPos TZ} forEach units group TL;

like this pheraps?

#

don't think so

#

oh maybe

{_x setPos TZ} forEach units group TL;
little raptor
#

if you know, why do you ask?

smoky verge
#

oh so I was right?
I was guessing
and have no way to test it so I wanted to be sure since I have to use it in about 3 hours

little raptor
#

Yeah. The last one is correct

#

TL is a team member right?

smoky verge
#

is the group leader yeah

little raptor
#

I think even units TL works too

leaden haven
#

I am wanting to set a custom task 3D marker icon to be the square 3D markers like in Warlords, but I cannot find the path to that icon? Does anyone know what it is? Thanks.

frank ruin
#

I'm trying to check if the weapons of a player is in a list of alloweditems and if it's not to remove the weapon from him.

#
if(!(secondaryWeapon player in _allowlist)) then {player removeWeapon (SecondaryWeapon player);};
if(!(handgunWeapon player in _allowlist)) then {player removeWeapon (handgunWeapon player);};

Offurtuantly the above isn't deleting the not allowed weapons and I get errors in the rpt as such:

22:41:39 Error position: <.

22:41:39   Error Invalid number in expression
22:41:39 File core\functions\fn_lprice.sqf [life_fnc_lprice]..., line 854

Any of you have some experience with checking for allowed weapons and weapon attachments?
It's doing it fine for the vest, uniform and helmet but I'm stuck on the weapons and it's attachements part. ๐Ÿ˜

(And thanks for the guy posting the code tag. ๐Ÿ˜‰ )

winter rose
#

(```sqf can also highlight your code, see pinned messages ๐Ÿ˜‰)

frank ruin
#

mmm so too much ( on my part then?

winter rose
#

no, I just simplified your code - nothing seemed wrong

frank ruin
#

Omfg I think I put a random . in my script above it -,-

winter rose
#

happens ๐Ÿ˜„

frank ruin
#

Yes it was the random point, fml. ๐Ÿ˜„ cheers for the help anyway! hรฉhรฉ

frank ruin
#

{if(!(_x in _allowlist)) then {player unassignItem _x;player removeItem _x;};} forEach assignedItems player;
This not the way to check for laserdesignators in the binocular slot? As it's not removing it ๐Ÿ˜

winter rose
#

unlinkItem might be what you are after

frank ruin
#

I thought that only works for goggles?

winter rose
#

everything that is in a "linked" slot

#

though, a binocular is sometimes considered a "weapon"

#

so removeWeapon mayyybe

frank ruin
#

Lets try unlinked first then hรฉhรฉ ๐Ÿ˜„

#

Nope unlin did not work hehe (Weapon did though)

craggy lagoon
#

Would someone be willing to help me with a small issue please? I can set a single variable with will following line but I can't seem to figure out how to set two. How would this be written if I wanted both ABC and XYZ to be set to true at the same time? Thank you in advance!!
player setVariable ["ABC",true];

hollow thistle
#
player setVariable ["ABC", true];
player setVariable ["XYZ", true];

?

craggy lagoon
#

Can it be done in one line as I would like to add it to an addaction?

distant oyster
#
{player setVariable [_x, true]} forEach ["ABC", "XYZ"];
``` though addAction can handle multiple lines?
craggy lagoon
#

Ok thanks, I'll get that a shot.

#

That did it, thank you so much!!

distant oyster
#

np

hollow thistle
#

Yeah you can do it like this but it will be a bit slower.

tough abyss
#

Is there any way to disable the "disassemble mortar" action? I would like to restrict the mortar to a single location in my mission (more exactly, keep it attached to a vehicle).

tough abyss
#

Wow. The list of specific arma commands continues to amaze me. Thank you!

#

Just tested the command with multiple syntaxes in the mortar and player init:
enableWeaponDisassembly false;
this enableWeaponDisassembly false;
It seems to eliminate all user actions with the mortar (eg you can't get in as gunner, either). Seems like a bug. Anyone else know about this?

west grove
#

is there a way to switch to a different playable unit without opening the team switch window?

warm hedge
#

selectPlayer

grave stratus
#

is it possible to call image packed in terrain's pbo?
how is the path going to look like?

west grove
#

ah god damnit. everything is called "switchTeam" and whatever, but ofc this one is not

warm hedge
#

It's possible to load every files/images/models or whatever in every pbo/ebo. The path going to be like the path you'd expect

west grove
#

i guess selectPlayer should be added to the command list on the teamSwitch pages

warm hedge
#

Done

west grove
#

nice

#

you could also add it to enableTeamSwitch

#

that was my thought process at least

#

check if teamswitch can be enabled/disabled and then "how do i force a switch"

grave stratus
#

okay thanks

warm hedge
#

enableTeamSwitch also added

bronze jetty
#

Hello, please help me, why does lineIntersects not work?
Trying to make pick up items using drawIcon and inputAction

[format ["id_%1",floor random 999], "onEachFrame", {
    {
        if ((!(lineIntersects[eyePos player,(_x modelToWorldVisualWorld [0,0,0]), player]))) then {
        _pos = _x modelToWorldVisual[0, 0, 0];
        _text = "";
        _color = [1, 1, 1, 1];
        if (cursorTarget == _x && {player distance _x <= 4}) then {
            _text = "Take";
            _color = [1, 0, 0, 1];
        };

        drawIcon3D["A3\ui_f\data\igui\cfg\actions\take_ca.paa", _color, _pos, 1, 1, 0, _text, 1, 0.05, "TahomaB"];
        };
    }
    count [doki, doki_1, doki_2];
}] call BIS_fnc_addStackedEventHandler;
violet gull
#

Does disabling simulation on a simpleObject or superSimpleObject do anything? Or is it completely redundant?

little raptor
#

and what is _x @bronze jetty ?

#

nvm

#

line intersects is not reliable. use lineintersectssurfaces

bronze jetty
#

@little raptor [doki, doki_1, doki_2]

@violet gull no, simulation is enabled, not simple object

#

ok, thx

violet gull
#

I was asking a separate question in general ๐Ÿ˜›

little raptor
#

@violet gull It's almost pointless

violet gull
#

ALMOST?! That means I can get a nano FPS out of it! yay

little raptor
#

@bronze jetty Also, your count must return boolean. It could lead to errors otherwise

#

Use forEach instead

west grove
#

the hell is that username

violet gull
#

@little raptor I have, but didn't see any mention of simple/super simple objects with simulation disabled. Just shows simulated, disabled sim, simple, and super simple.

random loom
#

What do you guys think this code will print to chat?

_myFunc = {
    systemChat "0";
    case 1: {systemChat "1"};
    systemChat "2";
};

_myParameter = 1;

switch (_myParameter) do {
    _myParameter call _myFunc;
    case 1: {systemChat "4"};
    systemChat "3";
    default {systemChat "-1";};
};
winter rose
#

try and thy shalt see

random loom
#

I've already executed it, I'm just wondering what you guys think it should print

#

because to me it doesn't make sense

#

so just take a guess

violet gull
#

Doesn't seem to work. The myFunc isn't called correctly because systemChat doesn't return anything and you called the function late anyway.

winter rose
#

_myParameter is not used in the function, btw.

violet gull
#

switch([]call _myFunc) do { 
case 0:{systemChat "0"};
case 1:{systemChat "1"};
case 2:{systemChat "2"};
case 3:{systemChat "3"};
default{systemChat "-1"};
};```
#

^ Does what you seem to be trying to do

random loom
#

@violet gull Nah it works

#

It prints 0 3 1

#

which at least to me doesn't make any sense

winter rose
#

you can ask X39 for switch behaviour, he's had his share already

little raptor
#

if I had to guess I would say: 0 1 2 4 3
you're right. makes zero sense

tough abyss
#

Hello, is there a mutex implementation here? Not BIS_fnc_spawnOrdered, I only need to run the script 1 time

winter rose
#

no mutex afaik

#

but, well, you can create one (or order your code so it doesn't get called more than needed)

peak vapor
#

How would I go about learning make a spawning menu?

#

Any tutorials

light badge
#

Hi all, is it any way to add the current primary weapon items into a _holder?

#

I'm trying to do a Weapons Wall using holders with the player's used rifles, but it only takes the base without the accessories.

#

_pWeap = currentWeapon player;
_pWeapitems = weaponAccessories primaryweapon player;

 hide_tablet_weap_wall removeAction hide_weap_wall_01;   
     
 _holder = createVehicle ["WeaponHolderSimulated",[1,1,1], [], 0, "CAN_COLLIDE"];  
 _holder addWeaponcargo [_pWeap,1];    
 _holder addPrimaryWeaponItem "_pWeapitems";
   player removeWeapon _pWeap;
    
 _holder attachTo [gun_wall, [0,0,1]];
winter rose
#

try addWeaponWithAttachmentsCargo @light badge ๐Ÿ˜‰

cedar sundial
#

Hi,
Iยดm looking into restictions of either BIS or ACE arsenal. Iยดm able to get the whitelist/blacklist to workin both but I have one doubt. The plan is to use the arsenal for a zeus managed version of Antistasi, hence using the arsenal for resupply of avaliable equipment used by the partisants.

But when calling the the arsenal with a pre defined array of items it is still possible to refill ammunition of weapons looted during the mission and other consumables avaliable in the players inventory. I do not trust my players to respect the rules of the game, is there a way to restrict this further?

light badge
#

@winter rose where I've to use it?

#

How I've to change the code?

winter rose
#

replace addWeaponCargo

light badge
#

๐Ÿ‘

#

uff, it's not an easy thing

random loom
#

or similar

peak vapor
#

Cheers

copper raven
#

@random loom im guessing that the ___switch or whatever value has some sort of target code to execute that gets set by the :, and when the scope ends, that target code is executed

#

switch scope to be exact*

little raptor
#

so?

#

That's how switch works anyway

#

Doesn't explain the weird thing we saw

copper raven
#

when you call _myFunc, the : matches, and breaks out of it, but the switch scope keeps going

#

though, it sets the code to execute in the ___switch var

random loom
#
_myFunc = {
    systemChat "0";
    case 1: {systemChat "1"};
    systemChat "2";
};

_myParameter = 1;

switch (_myParameter) do {
    _myParameter call _myFunc;
    case 1: {systemChat "4"};
    systemChat "3";
    default {systemChat "-1";};
};
#

Why doesn't it print systemChat "2"; in that case?

copper raven
#

because ':' operator breaks out of that scope

#

as value 1 is matched

little raptor
#

@cedar sundial I recommend that you add an event handler to the display (either vanilla or ACE arsenal) to detect when it closes (you can use "Unload" or this one for ACE https://ace3mod.com/wiki/framework/arsenal-framework.html#6-eventhandlers)
When someone closes Arsenal, make sure they don't have more of some magazine than what you want (also, remember that they may have collected that during the mission, so don't take those away from them!)

#

because ':' operator breaks out of that scope
as value 1 is matched
That doesn't explain the 3.

#

Plus according to @random loom it goes: 0 3 1
Why is 3 shown before 1?

copper raven
#

i suppose then it doesn't break, if there is a match already

#

the way you'd normally expect it:

switch 1 do {
  case 0: {};
  case 1: {}; // executes the code, breaks out of switch
  case 2: {};
};
little raptor
#

why do you use switch anyway? Don't use it at all. It's garbage (at least in Arma, I don't remember seeing this madness in C)

copper raven
#
private _whatever = {
  systemChat "beginning of _whatever";
  case 1: { systemChat "1 outter"; }; // breaks out of _whatever, sets ___switch magic var target code to { systemChat "1 outter"; }
  systemChat "end of _whatever";
};
switch 1 do {
  call _whatever;
  case 0: { systemChat "0"; }; // doesn't match
  systemChat "past inner 0";
  case 1: { systemChat "1 inner"; }; // match, but the target code is already set, so does nothing?
  systemChat "past inner 1";
  case 2: { systemChat "2"; }; // doesn't match
  systemChat "past inner 2";
  //end of scope execute the target code ___switch var holds
}

and with the above you'd get
beginning of _whatever
past inner 0
past inner 1
past inner 2
1 outter

#

anyways that's just my opinion on this

#

I think in Arma it never breaks out of it (iirc)
it breaks the scope of where ':' appears to be executed assuming case operator matched, normally it's within the switch scope itself, so the switch would terminate, like the wiki says

little raptor
#

yeah, I just tested

copper raven
#

i think it's something like i described anyway

why do you use switch anyway? Don't use it at all. It's garbage (at least in Arma, I don't remember seeing this madness in C)
hell yeah, avoid switches ๐Ÿ˜„

little raptor
compact maple
#

Hi, is there an event handler when the player goes in 1st or 3rd view ?

compact maple
#

thank you !

tough abyss
#

If I apply it to a turret (eg mortar) I cannot interact with it at all.

winter rose
#

can you get in from the front of the mortar by any chance?

tough abyss
#

Ha. Yes, this is true. From a very particular angle, and very close up, the turret can now be entered. It seems to work as a kind of trigger(?), because once the action is active I can walk quite far away and around, and still enter the turret. How very weird.

winter rose
tough abyss
#

Guess I will be adding another bug report :D. Obviously not a priority. But this doesn't seem like a difficult fix.

winter rose
#

don't add one, add to that one

cedar sundial
#

@cedar sundial I recommend that you add an event handler to the display (either vanilla or ACE arsenal) to detect when it closes (you can use "Unload" or this one for ACE https://ace3mod.com/wiki/framework/arsenal-framework.html#6-eventhandlers)
When someone closes Arsenal, make sure they don't have more of some magazine than what you want (also, remember that they may have collected that during the mission, so don't take those away from them!)
@little raptor Well, I will try to script something then, thanks ๐Ÿ™‚

tough abyss
#

Have a more general question: what is the script command for setting an existing trigger's condition to TRUE?
There's commands to check this, commands to change the "form". But I just want any of my multiple eventhandlers to activate my one trigger. How would I do that?

winter rose
tough abyss
#

Alright, so just use a dummy activation parameter: eg have the event handlers change the trigger to check a box where I've preplaced a unit, so it will always activate. That could work.

#

OK, to clarify my intent:
Am building a stealth mission. Want an alarm to activate whenever an explosion occurs. Found a very CPU intensive solution (that I couldn't get to work) https://forums.bohemia.net/forums/topic/220539-detecting-any-explosion-in-a-defined-area/

My alternative was to create event handlers around most cases. So whenever enemy vehicles, mines, and grenades are destroyed, they trigger the alarm. Haven't figured out how to include this in a single event handler, so I made a few. They work fine. But I still need them all to activate a single alarm once. Hence the single trigger.

willow hound
#

M2_fnc_activateAlarm:

if (!isNil "MyAlarmFlag") exitWith {};

MyAlarmFlag = true;

//Code to be executed on alarm activation
//Optional: Code that removes the EHs
tough abyss
#

@willow hound Thank you for writing this up! I will test it!

shadow sapphire
#

Is it possible or practical to create triggers on a headless client? Would this relieve the server much or would it complicate things with no benefit?

drifting sky
#

Arma2OA: 1) Is it possible to order a unit to move to an arbitrary position (x,y,z) within a building? 2) is there a command which will return whether a unit is able to pathfind to a position?

winter rose
#

@shadow sapphire it is possible, and it would relieve only a bit the server if triggers are server-only
the HC interest is mostly about AI

also, what if the HC disconnectsโ€ฆ!

violet gull
#

@shadow sapphire Headless client can impact server/overall performance in a big way, primarily when handling AI. The main server should be left to handle the network traffic of players and global mission-placed objects, while the headless client could handle enemy AI, civilians, and stuff like that as an example. But like Lou said, code it to be dynamic to anticipate if the headless client disconnects for some reason so it can offload it's stuff back to the main server or another headless client.

#

Also a quick protip to make AI more responsive, disable their voices.
this setSpeaker"NoVoice" so they execute orders instantly, rather than after their commander finishes speaking the order.

shadow sapphire
#

@winter rose, @violet gull, my AI are already run by headless clients. I have a check so that if the HC disconnects, the AI will be able to spawn on the server.

My goal is to have a headless client run sectors for a large scale sector control mission, but I donโ€™t know where to even start. I donโ€™t know how to script triggers very well, much less ones to be used as sectors. Iโ€™ve got a lot going on in the mission, so whatever I can do to get stuff off of the server. Iโ€™ll be running three headless clients on the server, probably balancing combat AI between two of them and maybe have one dedicated to civilians and maybe scripts and sectors, if I can figure it out.

delicate lagoon
#

Hey! It's me again. So uhh

#

I'm trying to make this work but i've issues actually making it work

#
[
    getPos player, //Spawn at the players location
    5, //10 meters wide
    30, //30 seconds of lifetime
    0, //Spawn CS gas
    1.5, //Make the cloud 3m tall
    0.1 //Make the cloud sparse
] call CBRN_fnc_spawnMist;```
#

here is the code i use

violet gull
#

@shadow sapphire I haven't messed with headless clients handling triggers yet, but plan to soon, but I think you'll wanna createVehicleLocal the triggers on the desired HC. Such as:
_trig=_myDesiredTrigPos createVehicleLocal"EmptyDetector";

#

If you use createTrigger, the server parameter defaults to the actual main server if I'm not mistaken.

winter rose
#

@delicate lagoon not a vanilla function, right?

delicate lagoon
#

nope!

#

using uhh

#

this!

winter rose
#

Then check their doc, it is your best luck
we cannot know all the scripts ^^

#

@shadow sapphire if you can, avoid triggers. It looks like your mission is awfully, terribly huge to deserve 2-3 HCs ๐Ÿคจ

delicate lagoon
#

I mean

#

It literally says here the exact same code

#

but doesn't seem to init.

winter rose
#

๐Ÿคทโ€โ™‚๏ธ

shadow sapphire
#

@violet gull, thanks for the tip!

#

@winter rose, it is big. Iโ€™ve had some VERY odd things happen when testing on dedicated servers.

delicate lagoon
#

HM

violet gull
#

I use a mission that relies heavily on triggers and they work great, they are useless if global though. Never use global triggers.

#

Keep them local you'll be fine. You can also adjust triggerInterval now which is nice to optimize trigger loops.

#

Make sure the conditions to your triggers are simple too. If they're some over-complicated function, no bueno.

#

ALSO, you can experiment with disabling simulation/enabling simulation of triggers.

#

Disabled sim on a trigger will stop the trigger completely. I personally don't think it's necessary, but if you have hundreds, it can be handy.

shadow sapphire
#

The mission is basically a PVP scenario that has thirty two players per side, four of which per side are high commanders, each commanding roughly a hundred AI. Beyond that, we have to have the sectors, which cover the entire map, not to mention some civilian elements.

The reality is that I might be asking too much from Arma, but I havenโ€™t given up, yet. I think there is a way.

violet gull
#

I'm pretty sure AI controlled by players is actually handled by the player's machine.

shadow sapphire
#

What you were saying about the trigger intervals and disabling simulation are both key, I think. I may also need to implement some AI caching.

Also, what do you guys think about deleting and creating new AI vs caching them? Civilians, I mean.

#

These high command elements are run by a headless client. I specifically set them to be owned by headless clients when headless clients are connnected.

violet gull
#

As for civilians, DO NOT USE UNITS. It is pointless for them. Make them agents. If you have a system where they can revolt and attack, make those AI units, but anyone who doesn't target things should be an agent. This is what I do a project I'm working on.

#

Just disableAI "FSM" on agents and they can perform moveTo orders and stuff. Agents cannot use doMove.

#

Caching AI will help you a lot.

#

Or in the case of civilians, just spawn/despawn dynamically. No need to cache if it isn't absolutely necessary.

shadow sapphire
#

The plan is for civilians to be agents, but I donโ€™t know what the limitations are on that. I havenโ€™t even tried to implement any part of the civilian systems, yet. I want to get the mission playable first.

#

First need the mission units, sectors, logics, end states to be solved. Then can worry about civilians.

violet gull
#

It's very easy and creating your own FSMs are easier than you'd think. Once you find out their quirks. Agents just can't target or doMove. They're incapable of using weapons on stuff and have no targetKnowledge. They don't use groups or formations (Although their formation commands still work supposedly). MoveToCompleted || MoveToFailed can be handy but also completes prematurely sometimes. Converting all those civs to agents will save you FPS and CPU. Less civilian groups = more unit groups ๐Ÿ˜‰

#

An FSM is basically a flowchart

shadow sapphire
#

Does anyone have a script that removes all the wreckage, trash, and military objects from the vanilla map?

I was writing a script to do that, but it was beyond my skills at the time, so I just manually did cleanup with game logic modules and I think that is also destroying my serverโ€™s performance.

#

Thanks for the tips, but I doubt Iโ€™m touching civilian stuff anytime soon.

violet gull
#

I recommend using nearestTerrainObjects command on initServer.sqf or something to filter for those objects. You can't delete them but you can hideObjectGlobal them. Only execute on server.

shadow sapphire
#

Yeah, thatโ€™s how my gamelogics delete them, just hideobjectglobal. They are only running on the server, but it seems like it harms performance somehow.

#

Could anyone show me a template for a script that creates a sector control sector?

delicate lagoon
#

I was wondering

#

how can i actually set position of object

#

like getpos player is position of player

#

but i want to attach script to object

random loom
#

@delicate lagoon setPos?

delicate lagoon
#

uh

#

I dunno, I'm new to scripting

#

tbf

#

let's say i call my object as 'test'

#

so i use string setPos test ?

random loom
#

see example 3

#

and syntax

delicate lagoon
#

hmm. I see

#

i will try

#

thanks

copper needle
#

If I have an array with nested arrays like [[1, 2], [2, 3], [3, 4]] what can be used to return the position of the nested array with the highest value?

jade abyss
#

Of course only, if the order don't matter.

violet gull
#

Disregard, I'm gonna assume it's global like setDamage.

narrow harbor
#

Hey guys, I am building a replica cockpit of a UH-60. The server I play on uses the U-60 Pack Developmental mod, which is an awesome mod of the UH-60 with a mostly functional cockpit, but it seems to be unfinished. My question is this: Is it possible to add custom (user configured) input/keybinding for the switches, buttons, and levers that are activatable in the cockpit of the mod? I'd like to be able to map physical switches to the corresponding switches in-game. I'll also be running this mod (https://www.armaholic.com/page.php?id=22774) to get the mfd's to work, but i'll need the clickable buttons around the mfd's in the mod to have keybindings as well. Is any of this possible and/or would anyone be interested in taking it on?

brave jewel
#

Anyone got an Idea on how to make units react to dead units they see?

exotic flax
#

@narrow harbor If you use the H-60 Pack which uses the Hatchet Framework (by Yax), than it's possible to add custom controls through configs (see https://uh-60m.gitbook.io/workspace/)

narrow harbor
#

@exotic flax , I was looking at that, but I didn't see a place in the configs to apply a keybinding. And in the controls>config mods menu it only has custom keybindings available for FLIR

exotic flax
#

I believe you have to make your own keybinds in case you want to have those (using CBA Keybinds systems), but I haven't had a good look at the framework yet

narrow harbor
#

Could you point me in the right direction for documentation on how to create those keybindings?

narrow harbor
#

Awesome, thank you man! As soon as I get this figured out, I need to dive into Arduino tutorials for the collective lever I'm building ๐Ÿ˜›

#

Okay, this is a dumb question, but what is the best way to get the script into Arma, making a .pbo?

#

Sorry, I'm literally crash coursing it to get this to work lol

little raptor
#

@brave jewel you have to use a loop and findIf any of allDeadMen (within a limited range) can be seen by the unit.
It's a bit awkward and slow.

brave jewel
#

@little raptor I suppose with

you have to use a loop and **fineIf ** any of allDeadMen
you mean findIf?

little raptor
#

@drifting sky 1) yes
Use a while loop to get the buildingPos starting from index 0 until it doesn't give any positions anymore. You can then randomly select one of these positions.
2) no

#

@brave jewel Wasn't it obvious?!

brave jewel
#

fineIf could actually sound like a command haha, like "Unit is fineIf no dead mean are near"

narrow harbor
#

This has clearly become more involved than I was expecting lol So, youtubing tutorials for arma modding. I'll be back in a few days with more questions ๐Ÿ˜†

violet gull
#

Is the "Bandage" magazine not configured to work in Virtual Arsenal? I've tried manually adding it to the arsenal but it still isn't visible in the arsenal:

["Open",true]spawn BIS_fnc_arsenal;
[player,["Bandage"],false,true]call BIS_fnc_addVirtualMagazineCargo;
#

addVirtualItemCargo doesn't work either

young current
#

@narrow harbor what you want to do sounds quite complex. You would probably need to write an extension too as a go between the game and your hardware.

drifting sky
#

What I actually meant by arbitrary was any x,y,z, as opposed to the garrison positions built into the game.
@little raptor

young current
#

@drifting sky it is not possible. In buildings AI is constrained on the paths and buildingPos locations

winter rose
#

@violet gull "Bandage" is not vanilla so idk (also is it the proper classname?)

violet gull
#

Bandage actually is vanilla, I just double checked. No mods enabled. It's accessible via 3DEN editor under equipment>>inventory items.

#

I've tried both "Bandage" and "Item_Bandage" ("Item_Bandage" is the variant of it dropped on the ground, the other is in inventory)

timid niche
#

Not home to test myself rn but was thinking

#

Thatโ€™s fastest?
Adding an array to a class and the doing:
_someVar = getArray(location);
{} foreach (_someVar);

Or making each item in the array to an individual class and then doing:
{} foreach (โ€œtrueโ€ configClasses (location))

tough abyss
#

how do I script that I can add ai to my squad after I launched the game

winter rose
#

see pinned message, as you were told

tough abyss
#

They asked me to come here

winter rose
young current
#

Pinned messages are discord feature.

#

Where important messages can be stored per channel.

tough abyss
#

thanks

distant oyster
#

I suppose allowFunctionsRecompile does not affect uiNamespace functions, as in make them recompileable?

#

btw the biki says

This restriction does not apply in missions previewed from the editor.
with A3 v1.00 so before eden. So maybe changing it to
This restriction does not apply in missions previewed from Eden.
if it does

peak vapor
#

What do i need to learn to sc3ipt and cide

#

Code

#

For arma?

winter rose
#

see pinned message, SQF is the language @peak vapor ๐Ÿ˜‰

peak vapor
#

Ok

#

Cheers

still forum
#

@distant oyster afaik it should, if its set in config

distant oyster
#

oh okay then thats not going to work for me as the functions are compileFinaled into uiNamespace via script on game start (display functions)

little raptor
#

@timid niche you're writing two completely different things

narrow harbor
#

@young current ,do you think it's something I could figure out from tutorials, or do you think I need to find a programmer to help out?

young current
#

Well programmer probably could speed up the process but you could learn to do it yourself too.

There won't be exact tutorials for your specific case though.

timid niche
#

@timid niche you're writing two completely different things
@little raptor how do you mean different. Using classes vs strings in an array. Then just using the classes and class names as the string.

narrow harbor
#

@young current, sorry re-read your message. I was at a stop light when I read your message earlier lol I don't think I explained what I'm needing clearly enough. The coding for the switch panels that I'm building for my sim rig will be handled separately. I'll be using Arduino micro boards to code the switches, but once they've been flashed they'll function just as any other HID interface. No different than an off the shelf flight stick or mouse. So Arma should pick up their input without a problem. The issue I have is that the U-60 by Yax with the interactive cockpit doesn't have the control of the switches, throttles, etc mapped to key bindings. The only way to interact with the switches is to put the curser over them and scroll to activate. I know mods are able to map functions to custom key binding slots using the cba, so what I'm needing is a mod that adds the functionality of being able to have a key input toggle the switch without using the curser into the U-60 mod...

#

Now, the mfd's are a completely different issue. I'm begrudgingly fine with the basic output the Glass cockpit mod adds for external mfd's, (altitude, air speed, gimble, etc) but that would mean I'd need to use the curser in-game to press the buttons on the mfd, and lean forward to be able to see what's on them. It'd be nice to be able to see what's on the in-game mfd on my external mfd screen and map the buttons of the mfd to a mfd frame switch input.. For example, being able to see the flir, map, etc on my external mfd (and to be clear, the external mfd screen is just a screen that the pc treats as a monitor and HSXI would be handling that, it's just getting the glass mod to grab the I game mfd screen that's required) It's a tall ask for a game engine that wasn't designed to be a flight Sim, but if it's possible I'm more than willing to put in the time to figure it out. I'll likely need to find some people more adept at modding than myself to help out, but I think it'd be worth it to have that type of functionality available for us pilots with Sim rigs... But again, the mdfs are their own separate issue. The switches is just adding functionality to an existing mod. I know it's possible to have those switches mapped to keys, the mod developer just chose not to add them. Which I'm sure he wanted it to have the realistic feel of reaching for the switch in game which is great, but if I have a physical switch on my flight rig it'd be far more efficient and realistic than using the mouse.

winter rose
#

don't text and drive ๐Ÿ‘€

still forum
#

maybe hideObject? ๐Ÿ˜„

#

or just setObjectTexture without global

#

remoteExec

#

remoteExec

#

the global variant of that command is fixed on performance branch and will be fixed next game update

#

not aware

exotic flax
#

it's even written on the wiki

If executed from a vehicle's init field (going against the above note), execution may happen too early and fail to broadcast over the network and to be JIP compatible.

#

which I assume won't/can't be fixed unless some core stuff is rewritten

still forum
#

KK recently touched that, might have fixed it.
But probably not

little raptor
#

@timid niche one is accessing config classes, one is accessing entry value

shadow sapphire
#

I'm missing something. I'm trying to get this to be executed by a specific headless client, named with a global variable HC1, but it's running on the server, the headless, and me when testing.

Does the same thing fired with this;

RemoteExec ["ASG_FNC_GIP1", HC1];

or this:

RemoteExec ["ASG_FNC_GIP1"];
If !(player == HC1) exitwith {};

_RP = (getmarkerpos "Origin");
_Vic1 = "I_E_Truck_02_F" createVehicle _RP;
Sleep 1;

[
    _Vic1,
    ["EAF",1], 
    true
] call BIS_fnc_initVehicle;

clearItemCargoGlobal _Vic1;
clearMagazineCargoGlobal _Vic1;
clearWeaponCargoGlobal _Vic1;
clearBackpackCargoGlobal _Vic1;

Sleep 1;

_LIS1 = [_RP, INDEPENDENT, [
    "B_G_Soldier_SL_F",
    "B_G_Soldier_TL_F","B_G_Soldier_F","B_G_Soldier_GL_F","B_G_Soldier_AR_F",
    "B_G_Soldier_TL_F","B_G_Soldier_F","B_G_Soldier_GL_F","B_G_Soldier_AR_F",
    "B_G_Soldier_TL_F","B_G_Soldier_LAT_F","B_G_Soldier_LAT2_F","B_G_Soldier_lite_F"],
    [],[],[],[],[],0] call BIS_fnc_spawnGroup;
_LIS1 setGroupIDGlobal ["A 1 1"]; //Hint groupID group cursorTarget;

_LIS1 addVehicle _Vic1;

    {
        {
            _equip = _x execvm "Functions\Gear\IFGear.sqf";
            waituntil {scriptDone _equip};
        } foreach units _x;
        GM hcsetgroup [_x,""];
    } foreach [_LIS1];
willow hound
#

Try using

if (!isServer && !hasInterface) exitWith {};

instead of player == HC1 together with remoteExec ["ASG_fnc_GIP1", 0];.

little raptor
#

!(player == HC1)
!= ?!

winter rose
#

!= is overrated ๐Ÿ˜„

shadow sapphire
#

@willow hound, still got the same thing somehow.

Also, I need to specify HC1, because I have other headless clients.

#

Thank you for the help, though! It gave me something to try!

little raptor
#

named with a global variable HC1
Doesn't mean it's accessible on each machine

shadow sapphire
#

Interesting. How do I make it accessible?

little raptor
#

How did you define it?

shadow sapphire
#

I put down a headless client and named it HC1 in the variable name slot.

little raptor
#

Ok it works that way

#

@winter rose or does it?!

#

because setVehicleVarName has local effect

winter rose
#

setVehicleVarName is not setting a variable

#

it's just useful for serialisation / stringification

little raptor
#

you sure?

#

I'm almost sure you can still use it as a regular variable

winter rose
#

nope

player setVehicleVarName "joe";
joe setDamage 1; // won't work
little raptor
#

Anyway,

I put down a headless client and named it HC1 in the variable name slot.
what about this case?

winter rose
#

this works, like every "variable name" field for other objects

little raptor
#

Even remotely?

winter rose
#

yes, defined in mission.sqm

little raptor
#

@shadow sapphire

still got the same thing somehow.
If it's actually a "headless" client, it shouldn't have been the same. hasInterface blocks it

#

How come I missed this part?!

When a vehicle is created and named in the editor, the name becomes both the variable containing the vehicle object and the string representation of the vehicle object. vehicleVarName on the other hand is only string representation of the object.

winter rose
#

if isServer or hasInterface, if it is for headless client only

shadow sapphire
#

OH, shit. Dang, I'm dumb.

#

Actually nothing is working.

Even this ran the script three times (Server, client, dediclient).

If (isServer or hasInterface) exitWith {};

winter rose
#

did you recompile the mission?

willow hound
#

Oops

#

I provided code that does the opposite

winter rose
#

to be sure, try adding a hint @shadow sapphire

willow hound
#

Well well well

#

systemChat > hint

winter rose
#

ooor systemChat

willow hound
#

Also, remoteExec it because... other machines...

shadow sapphire
#

I thought I recompiled it. I shut down the server, the HC, went to editor, made changes, exported the changes, relaunched the mission.

willow hound
#

Did you relaunch the correct version?

shadow sapphire
#

It over writes the old mission file, I think. But maybe not.

little raptor
#

Who else knew you could use , instead of ;?!

_a=1,_b=2,_c=3, //works
shadow sapphire
#

News to me.
That's stellar, haha.

still forum
#

Commy knows, and he can't stop mentioning it

little raptor
#

I actually discovered it by accident. I was going through one of my codes when I noticed I had a , at the end of a line, but I wasn't getting any errors.

winter rose
#

yupโ€ฆ added the ( ) to prevent making a new generation of coders using ,

slim oyster
#

oh god

#

pls

#
private ["_a"], a=_this#0,
#

is this what you want

still forum
#

AH

little raptor
#

Nothing can prevent people from writing it like that! Not even ;!

winter rose
#

I can ๐Ÿ”จ

timid niche
#

@little raptor not sure if you remember, but you helped me with making controls go in a circle around the center of the screen

little raptor
#

I do

timid niche
#

Wanted to add some white lines to separeta and it works fine on some even control amounts like 4 and 6 but on uneven like 5 and 7 it just goes all uneven.

#

I have done the lines by creating same amount of lines as controls and then used ctrlSetAngle

#

The lines are always correct angle wise but the text controls are uneven on well uneven control numbers.

#

I can make a scetch if you dont understand