#arma3_scripting

1 messages · Page 438 of 1

meager heart
#

If you completly loose connection then they are ofcause not executed.
Aka when the server shows you as disconnected.
i understand that, question was only about laggy clients, Dedmen

fossil yew
#

@unborn ether I thought createVehicle by default doesn't spawn on occupied area (collision NONE)?

#

position: Position - Desired placement position. If the exact position is occupied, nearest empty position is used.

unborn ether
#

@fossil yew Well createVehicle tries to find a safe position, but if another vehicle is created before the first one gets its time to init - booom.

fossil yew
#

I see

unborn ether
#

depends on your VM business mostly

fossil yew
#

maybe a simple sleep would help

unborn ether
#

so 0.5 might be too small for your case

#

or

fossil yew
#

ok, I'll try with bigger value

unborn ether
#

Maybe something might be in the way, for example a platform they are created on. You can try adding ~0.25 to your last Z coord.

fossil yew
#

ok, thanks

warm gorge
#

How performance intensive are global remoteExec/call executions? Would I benefit much from passing arrays of only nearby players to a required call compared to running it globally? For example, lets say I wanted to play a switchMove animation on a player. Would I benefit much from remoteExec'ing it to only nearby players?

still forum
#

Between 0 and infinite.

#

Yes ofcause it would benefit. The server having to send less messages out. Means the server has to send less messages out.

#

Less messages == less traffic == good.
But in most cases I'd say that doesn't matter. Atleast not before you approach a 50+ playercount

warm gorge
#

Alright thank you

pseudo cypress
#

@still forum i tried it now with your code and it works so just specific player can open the paint menu BUT the function to paint wont work anymore

meager heart
#

How performance intensive are global remoteExec/call executions?
like this (ツ)_/¯ 😄

still forum
#

@pseudo cypress Is the function to paint also in there? Just remove it. If they can't open the menu they can't paint anyway right?

pseudo cypress
#

this is how the script looks ingame

#

a specific player can open this menu but cant press the change mode to texture button and it shows no colors there

still forum
#

¯_(ツ)_/¯

tough abyss
#

@pseudo cypress assuming that is exile, you need to make an edit in model box show

#

I’m not on pc but that is where they modify all the camera stuff

#

is there a way to quickly see execution time and possibly load a script is having on the server?

winter rose
#

load a script on the server..? execVM?

tough abyss
#

No I’m talking about how resource intensive a script is

winter rose
#

oh, load on the server, my bad.
execution time yes, load no afaik

#

you could log at the beginning and the end of this script and check the time difference in the server logs
load check would require only the script to run, and you monitoring the CPU difference at the same time

still forum
#

resource intensive == runtime.
Except if you spawn vehicles or markers or other stuff. In that case. No. No way.

#

execution time in scheduled scripts is useless too

pseudo cypress
#

@tough abyss the problem isnt the view on the obejct the problem is that i cant change the colors

ornate pawn
#

i have this code

#

sound[] = {"BEW_Music\sound\music\BEW_Song_01.ogg", db2, 1, 50};

#

which number do i need to change to increase the volume?

still forum
#

I have no idea what that's supposed to be

ornate pawn
#

i'm trying to add music to my mod haha

still forum
#

it's an array of arbitrary values so...

#

¯_(ツ)_/¯

ornate pawn
#

but i need to increase the volume

#

db2?

still forum
#

You could tell me what that is. Then I might be able to google for you

ornate pawn
#

i did google it and i couldn't find anything usefull

#

i need to increase the volume of that song

#

db2, 1, 50};

still forum
#

Dude..

#

Tell me what that is

#

CfgSounds or CfgMusic or CfgBollocks?

ornate pawn
#

iis a config.cpp that i made to play a song in my mod

#

//sound effects

class CfgSounds {
sounds[] = {};

class BEW_Song_01 
 {
name = "BEW_Song_01";
sound[] = {"BEW_Music\sound\music\BEW_Song_01.ogg", db2, 1, 50};
titles[] = {};
 };
still forum
#

Mh.. When I google I find stuff.

#

Weird.

#

And it even tells me what the volume is.. Weird.. Very weird.

#

My computer must be magical and I probably have access to a special type of internet where google returns magic results

ornate pawn
#

// filename, volume, pitch, distance
sound[] = {"fx\wolf1.ogg", 1, 1, 100}; i'm guessing te distance is 100

#

and the volume is 1 but theres another 1 haha

still forum
#

🤦

ornate pawn
#

make fun of me all you want buddy

#

thanks for your help

winter rose
#

Filename
Volume
PITCH
Distance

modern sand
#

Pretty sure it's CfgSounds, however @ornate pawn I suggest you ask in #arma3_config

ornate pawn
#

thanks dude

#

i got it working

#

i just figure that out thanks for not being an a hole

winter rose
#

Keep Description.ext in your favourites, you can use it frequently

ornate pawn
#

i know that but i'm actually putting the songs in a config.cpp for my own mod

modern sand
#

Yes, it's the exact same concept. Just the wiki shows you it in a description.ext file. You use it / set it up the exact same way in your config.cpp file.

still forum
#

@winter rose Btw Description.ext page doesn't show what the CfgMusic parameters do 😉

#

Well. I just googled Arma CfgSounds

#

And it gave me that.

modern sand
#

Google is amazing, once you obtain a brain cell that knows how to use it. 😋

ornate pawn
#

this mute option is amazing!

#

i mean the block

modern sand
#

lol

ornate pawn
#

yeah dude, people learn something and they feel like god i know how it feels when i was in the U.S Army and learn something i felt special i know that feeling..

astral tendon
#

The MPHit event handle causedBy is not returning the weapon that damaged the unit but the unit that cause the damage, any fix for that or is already know issue?

modern sand
#

Not entirely sure, never worked with it. But can't you just simply get the weapon by doing this SQF _killersWeapon = currentWeapon _causedBy;?

still forum
#

If only people would learn how to google :u and then feel like god about it.

#

@astral tendon It was never supposed to return a weapon. So there won't be a fix. And it's not an issue.

modern sand
#

Dedmen my solution would work correct? Seeming currentWeapon returns as a string?

still forum
#

yeah

astral tendon
#

So, why have the causedBy and instigator if they do the same thing?

still forum
#

unless the causer changes the weapon before the bullet impacts

modern sand
#

Which is a slight chance of that happening.

still forum
#

Says it right there

modern sand
#

Unless you shoot from a far distance

still forum
#

But with rockets?

modern sand
#

oh true.

still forum
#

Or in case of collision damage there is no weapon at all

modern sand
#

Well in that case, you could just put filters in before hand to check.

#

Simply check if _killersWeapon is either nil or "", make _killersWeapon equal to "Unknown" or something

still forum
#

What if he has a weapon. But didn't kill you with it

modern sand
#

That's true

#

I've seen it done in the past, just idk how xD

astral tendon
#

That is a problem to detect a granade

modern sand
#

I'm reading up on the remoteExec command, and tried playing around with ending a mission (via the server, but executed by the client) so I'm using this but doesn't seem to work SQF ["END1"] remoteExec ["endMission", 2]; That should work, seeming executing this via the client works fine SQF [5] remoteExec ["skipTime", 2]; Anyone know if there is a certain type of syntax needed when using endMission and remoteExec together?

still forum
#

endMission doesn't take array. It takes string @modern sand

modern sand
#

was just thinking that

#

and about to test

#

xD

astral tendon
#

I used this on my missions
```["end_unsafe",true,true,false] remoteExec ["BIS_fnc_endMission"]; ````

modern sand
#

Cheers, just Dedmen is right. Remove "END1" from an array and should work fine.

#

Thanks, both of you 😃

astral tendon
#

😛

still forum
#

Detecting grenades via MPHit is.... Well.. A challenge

#

If I remember corrently that's hard and over my level. Commy might know

modern sand
#

Ahh, removing it from an array doesn't seem to work either.

still forum
#

What do you expect to happen?

#

You are executing it on the server...

#

And it has local effects

#

so.. If at all it will end the mission on the server... I'd say undefined behaviour

modern sand
#

Ahh, I guess I should have checked before hand. idk why but I just assumed if it is executed via the server it ends it completely.

#

Waiting for your classic google one liner Dedmen 😛

still forum
#

Well if the mission ends on the server.. I would also expect that all clients are kicked out of the mission.. ¯_(ツ)_/¯

modern sand
#

That's what I expected as well.

winter rose
#

@still forum ok, ok, I'll update the Description.ext#CfgMusic ... get the whip away plz 😄

#

CfgRadio as well

errant jasper
#

And if you call BIS_fnc_endMissionServer the server does not stop still 😃

modern sand
#

lol, well I'm just using this now ```SQF
"END1" remoteExec ["endMission", 0];

errant jasper
#

Yeah, I send an event from the server to all (including the server), and then handle it locally on each machine. But I also have to handle, two sides, and both win/lose endings, for a total of 4 different possible endings to display.

edgy dune
#

that moment when you try to make a gun shoot the ace3 banana

#

ace 3

winter rose
#

@still forum done, btw

fossil yew
#

just in case someone wants to create vehicle on exact spot (like doing some persistent mission), don't use type createVehicle pos. Use private _vehicle = createVehicle [_vehicleType, _vehiclePosition, [], 0, "CAN_COLLIDE"]; instead. First default call likes to move vehicle to new position when Arma thinks something might get in the way even when it results in complete explosion.

meager heart
#

@modern sand try this ["End1",false] remoteExec ["BIS_fnc_endMission"]; 😀

errant jasper
#

Tom, I always just do an explicit setPos* after

meager heart
#

afaik endMission < deprecated

orchid saffron
#

I do too @errant jasper

errant jasper
#

AFAIK endMission is not deprecated. I you to end the mission without the visual effects it is one of the few ways to do it.

orchid saffron
#

i create it on [0,0,0] and setpos after

errant jasper
#

Yup. But it is, as @fossil yew says, because I don't trust the created position, and even if I did, I can't ever remember what the position is posAGL, posATL, posASWL, or posWTF

meager heart
#

endMission is it still working, Muzzleflash ?

errant jasper
#

Yeah. I use it on the dedicated server since BIS_fnc_endMission* does not terminate the server

orchid saffron
#

@errant jasper It´s the same, just my way is better optimized

meager heart
#

hmm

errant jasper
#

For a dedicated server I force it to end the mission by running the command.

meager heart
#

lol

#

never had that kind of troubles

fossil yew
#

BIS_fnc_endMissionServer?

subtle ore
#

^ I was about to say

fossil yew
#

it ends on client and server

meager heart
#

wut

#

i have it in like... 20+ missions

#

no troubles

#

same with BIS_fnc_endMission

fossil yew
#

maybe problem is that

"SideScore" - show "YOUR SIDE WON" to side with largest score

and since no players are online, it might be 0-0?

#

not sure, just guessing

subtle ore
#

no problems here either

orchid saffron
#

Do the "ropeBreak" eventhandler execute when a rope is shot?

errant jasper
#

For SideScore what side is dedi on?

#

Maybe endMissionServer is only broken for SideScore then. I just took him on this word that for his instance the server did not terminate, which lead me to consider this another untrustworthy BIS function.

meager heart
#

"endings" defined in CfgDebriefing ?

#

that " SideScore" is default one

subtle ore
#

Sections defines the variables used for score i would imagine?

errant jasper
#

BIS_fnc_endMissionServer just delegates to fnc_endMission. For SideScore case it does:
[["SideLost",false,nil,nil,true],"bis_fnc_endMission",_sides - _winners] call bis_fnc_mp;
[["SideWon",true,nil,nil,true],"bis_fnc_endMission",_winners] call bis_fnc_mp;
[["",true,nil,nil,true],"bis_fnc_endMission",allcurators] call bis_fnc_mp;

#

The 3rd argument to bis_fnc_mp is target where for a type side it: Side - function will be executed only on clients where the player is on the specified side

meager heart
#

well i use RE 🤷

errant jasper
#

allCurators return a list of objects, and then bis_fnc_mp only run where those are local. So it does look like SideScore is broken for dedi servrs.

#

Well if you use endMissionServer then you also use bis_fnc_mp.

orchid saffron
#

@orchid saffron Never mind it does

peak plover
#

How does the engine run at the same speed at any framerate?

#

Or does it?

#

Does a player with 60 fps run faster than 10 fps

#

Like in-game run 100 meters

errant jasper
#

It looks like, SideTickets, GroupScore and PlayerScore end mission types have the same issue.

orchid saffron
#

@peak plover ["id", "onEachFrame", {comment "your code"}] call BIS_fnc_addStackedEventHandler; ?

errant jasper
#

^^ Now he just needs to ruin his fps to test 😃

peak plover
#

shift minus [fps]

#

can toggle to 60/40/20/unlocked

#

I mean like engine side

#

How does the engine make it so the character always moves

#

At a certain speed

#

Even if fps is high

#

@still forum maybe knows

still forum
#

Awoooo

#

Engine uses deltaT

#

time doesn't change depending on FPS

#

time is always time

errant jasper
#

Anyone know, rather than continuously update variables used for CfgDebriefingSections, can I just listen for "Ended" mission event handler and compose it then?

peak plover
#

so delta time

errant jasper
#

It at least works in SP Eden, just curious if anyone has more experience with it.

peak plover
#

Does it mean

errant jasper
#

Why is: nil call _code treated special compared to _anyThingElseThanNil call _code ?
Also, what is preferred alternative? 0 , [] , or ???

shadow sapphire
#

Is there a simple way to set a mission or server where map markings will only be shared if players are very close?

winter rose
#

@errant jasper call BIS_fnc_endMission

errant jasper
#

? I am no longer talking about BIS_fnc_endMission.. Just general calling. If the argument is nil the code inside behaves differently.

winter rose
#

you can use call directly, no need for parameters
that's what I meant

errant jasper
#

That work too. But since the code will be customizable I would prefer not to, since calling without argument leaks those from higher above.

winter rose
#

I... am not sure I understood that

still forum
#

@errant jasper Nil is treated as special because.. It is special. No real reason I guess. It was just coded that way

errant jasper
#

Typical BIS. It ruins dynamic scoping

still forum
#

just always pass array?

#

You should use params anyway

#

and 0 or [0] is the same for params

errant jasper
#

Yup, that's my workaround so far, to pass []. Just wondering whether it was the best value to pass (in microoptimisation land).

still forum
#

[] is cheaper than nil

#

but 0 might be a bit cheaper again

#

but you are in nanosecond area here.

winter rose
#

@errant jasper I still don't get it, nevermind.
so calling with nil or directly call won't use params properly?

lone glade
#

wat

#

.... why the hell would you expect params to work in that situation

#

and no, params works as intended there

errant jasper
#

Yes params works as intended. It is calling that does not.

#

@lone glade How do you call a function without passing arguments?

lone glade
#

eeeeeeerm

#

call myfnc ?

errant jasper
#

That passes the arguments of the "parent" function.

lone glade
#

no it doesn't

#

I have no idea where you got this idea from

errant jasper
#

Run my example shown above. I call _unknownCode like you say, yet it receives outer arguments.

lone glade
#

where is it?

errant jasper
lone glade
#

it's an inline func

#

different case there

#

the args aren't passed, the args already exist within that scope

errant jasper
#

Then let me rephrase how do you call an inline function with no arguments?

lone glade
#

you don't

#

if you used params or private the local vars that used them will be defined there

#

you're not passing _this, _this already exists in that scope

#

so either pass your args like you would normally do or don't use params inside that inline func

errant jasper
#

So SQF is terrible with regards to compositionality

winter rose
#

oooh... using call _fnc is indeed _this call _fnc? brain just clicked

lone glade
#

that's not the issue lou

#

params default to using _this as left arg

#

_this already exist in the parent scope

#

thus it's also present in the inline func in that case

winter rose
#

isn't it like _x in forEach, the innermost is used?

lone glade
#

yes

#

but he called it without passing args

#

so it's not redefined

#

think of privated local vars, it's the exact same

errant jasper
#

And the only way to undefined it for the call is to call it with 'nil' except that somehow breaks dynamic scoping completely.

lone glade
#

or []

#

ooooor

#

use something else for params left arg

errant jasper
#

Yeah. I think I am going to stick with [] since it worked for me since way back. And fortunately, nowadays, almost all are passing array even for single arguments.

winter rose
#

oh ok, thanks

orchid saffron
#

Mmm i´ve checked the performance in the console and passing nil as an arguments is more optimized

lone glade
#

you can't rely on the console for that kind of testing

orchid saffron
#

So what you recommend

lone glade
#

dedmen's perf profiler*

orchid saffron
#

I´ll try that

#

Thank you sir

lone glade
#

hey @still forum did you implement what we talked about a while ago?

still forum
#

Probably not

#

considering I don't remember

lone glade
#

😦

still forum
#

and I can't dev at home

lone glade
#

it was about swapping the perf profiler for brofiler instead

still forum
#

@orchid saffron Mmm i´ve checked the performance in the console and passing nil as an arguments is more optimized Yes. Ofcause. Because the call will silently fail and never execute

#

Ah yeah that's on my todo

lone glade
#

OF COURSE

#

NOT OFCAUSE

still forum
#

So yes. Not calling at all is faster than calling

orchid saffron
#

@still forum touché

lone glade
#

// is faster than comment huehuehuehuehuehue

still forum
#

breaks his neck

subtle ore
#

inbound X39

winter rose
#

who uses comment really?

lone glade
#

stupid people

still forum
#

Hah.. Wanna bet

lone glade
#

the same people who write 5K lines long funcs

#

with 30 lines that are private array

still forum
#

I actually didn't know. But yes.. I bet on it too.

subtle ore
#

Wow so bulli dedmen

lone glade
#

comment "my comment;"
is worse than
"my comment";

#

just think about this for a second

errant jasper
#

Damn. Didn't know code could have "Director's Comments"

lone glade
#

and both are worse than // or /* */

drowsy axle
#

Just looking through a few vanilla missions. Is it hard, without any mods, to assign spawned AI to a HC?

lone glade
#

yes

#

unless you spawn them directly on the HC

still forum
#

Well define mods...

#

HC mods are just scripts

#

you might aswell place them in your mission

drowsy axle
#

True. @still forum

#

is a function in mission namespace?

still forum
#

Maybe

#

Is could be

errant jasper
#

Any way to measure text width, in horizontal space, not number of characters?

#

@still forum If I add a TFAR event handler to a player, will still work on respawn?

drowsy axle
#

How would I waituntil a file has been "read" to then continue with script?

winter rose
#

context?

meager heart
#

scriptDone ?

drowsy axle
#

thanks @meager heart

#

Do this make sense? ArmA keeps throwing errors: sqf b_mrap_01_f = [b_mrap_f,b_mrap_f_1,b_mrap_f_2]; o_mrap_02_f = [o_mrap_f,o_mrap_f_1,o_mrap_f_2]; The variables in the array are markers, which are the same name, and in the variable box.

#

Is this possible to do: ```sqf
{
#include "fn_aiCreateVehicle.sqf";
} foreach b_mrap_01_f;

{
#include "fn_aiCreateVehicle.sqf";
} foreach o_mrap_02_f;``` Having two or more #include statements of the same file?

lusty canyon
#

i want to know that as well, plus can sqf inject a hpp / cpp / cfg as well in #include?

cedar kindle
#

you can include any file extension

#

and a theoretical infinite amount

lusty canyon
#

@cuel so say i have the grumpy loadout script on my server (has multiple hpp cpp and sqf files)
can i remoteexec it to another connected player that doesnt have the script?

still forum
#

@errant jasper No TFAR EH doesn't work after respawn

#

In TFAR 1.0 you can just use the unitless CBA eventhandler. That will always work

#

@lusty canyon If you send the script along yes.

errant jasper
#

@still forum Okay. I'll add a respawn handler for now, still on 0.9.12

astral tendon
#

Do you guys know a way to remove all doors from a Building?

velvet merlin
#

is it possible to assign a property to a specific magazine?
the only way i can think of is to cache the amount and if that changes, take it as new magazine/magazine change

still forum
#

"property" ?

#

If you want to identify a unique magazine you can use special ammocount or magazineID

#

magazineDetail script commands

velvet merlin
#

thanks

unborn ether
#

@drowsy axle Marker names are strings, not variables. So it's "b_mrap_f" not b_mrap_f

astral tendon
#
                sleep 2;
                (_this select 0) setUnconscious false;````
#

some times the unit do not come out from the unconscius animation, even when the life state changed, is there a fix for it?

winter rose
#

try a playMove maybe? or playAction, something along the lines

#

@astral tendon playAction (or playActionNow) "PlayerProne" could do the trick I think

astral tendon
#

i use the swichmove "" to cancel that.

#

though i though that could be a better way to do it.

winter rose
#

I just had the problem on the player unit, and I solved it by selecting a weapon.

drowsy axle
#

thanks @unborn ether

#

I got it sorted.

lone glade
#

no it's a variable

#

and an undefined one

drowsy axle
#

I forgot to change the ingame variables to suit. NVM it all works...

winter rose
#

Demellin's answer, quotes quotes quotes yes

peak plover
#

Hey

#

How do I delete map objects?

tough abyss
#

There is a module under Environment that does just that. Not sure how that would work in game via script, though maybe you could tie it to a trigger?

#

@peak plover ^

#

I have a probably silly question about a simple caching script I'm using. Basically the idea is to get rid of everything outside of 1000m radius to the player, just to save some performance.

#

I have an _excludedVehicles param

#

So I can add named vehicles to it, like arty and transport choppers, so they can operate properly.

#

But...I want to spawn in jets for CAS, and I can't figure out how to name them upon spawning them, OR how to simply exclude any/all air vehicles from the caching.

#

Any assistance would be appreciated. I'll paste code segments if anyone wants to see em, but I don't wanna spam unprompted. XD

wary vine
#
diag_log format ["%1 %2 %3",_listerUID, (typeName _listerUID), _listerUID == (getplayerUID player)];
"76561198132926159" STRING false
``` any idea's guys ? it doesn't seem to comparing the string correctly
peak plover
#

@tough abyss _obj isKindOf 'air'

tough abyss
#

Ah interesting @peak plover thank you. So where would that go in this:


_excludedVehicles = [PBR1, PBR2, PBR3, Mortar1, Mortar2, Mortar3, Howitzer1, Howitzer2, Howitzer3, Howitzer4];
_checkDistanceSqr = (1000 * 1000);
_toCheck = (allunits - allplayers - _excludedVehicles);
while {true} do {

{
_dist = getposatl player distanceSqr getposatl _x;
if (_dist < _checkDistanceSqr) then {_x enablesimulation true;_x hideobject false;_x enableAI "FSM";};
if (_dist >= _checkDistanceSqr) then {_x enablesimulation false;_x hideobject true;_x disableAI "FSM";}
} foreach _toCheck;

sleep 0.1};
};```
#

Within the excludedVehicles array maybe?

peak plover
#

Is this for multiplayer?

unborn ether
#

How do I delete map objects? no way, you can't delete map objects. You can use hideObject or hideObjectGlobal @peak plover

peak plover
#

ok

#

but does

#

Simple objects can be deleted?

unborn ether
#

None of the assets coming from a map can be deleted

peak plover
#

simple objects i create myself, can I delete those?

unborn ether
#

Anything from mission.sqm and createVehicle (or similar) can be deleted.

#

Is there any scripted command to detect if you are a FFV gunner at the moment?

strange urchin
#

Try using assignedVehicleRole in combination with gunner and commander

tough abyss
#

@peak plover Sorry just saw this, no singleplayer

meager heart
#

@unborn ether you can tryfullCrew

unborn ether
#

@meager heart Found the way, its assignedVehicleRole + cameraView. Obviously if you are "cargo" and "GUNNER" means that you are able to shoot from a passenger seat.

#

oh and its better to check !isNull (objectParent player), since assignedVehicleRole is buggy.

meager heart
#
//--- return player in FFV seat/turret
systemchat str (fullCrew [vehicle player, "", false] select {_x select 4} apply {_x select 0});
``` possible need some corrections ^
#

@unborn ether

lone glade
#

assignedVehicleRole isn't buggy

#

it's just that a unit can have a role assigned but still be outside the vehicle

meager heart
#

^

unborn ether
#

isn't assigned role to the vehicle you are not in a bug ? 😃

lone glade
#

nope

#

assign vehicle role -> tell them to get in

#

or, better, move them in said position instead of using what is pretty much a bunch of deprecated commands

meager heart
#

also assignedVehicleRole will return role after unit will be not in a vehicle, or there are no vehicle any more

lone glade
#

role is still assigned

unborn ether
#

and to which of 10 vehicles ive entered it stays actual?

meager heart
#

and if unit will switch seats... role will be autoassigned to new one

lone glade
#

just don't use deprecated commands

#

and you'll be gucchi

fossil yew
#

What is the difference between accessing inventory of a vehicle compared to accessing the inventory of a crate in terms of scripting commands used?

wary vine
#

?

#

im pretty sure it uses the same evh if thats what you mean

lone glade
#

the exact same

#

both are containers

fossil yew
#

Can we use same commands to access vehicle inventory

wary vine
#

InventoryOpened

lone glade
#

containers are containers

fossil yew
#

Ok thats what I need

wary vine
#

o.O

#

Wait ? your trying to open the display ?

fossil yew
#

Everything is an container. I want to save the contents of it for the next battle... Persistent mission

wary vine
#

So you want to save the contents ?

fossil yew
#

I made crates saved but not vehicles yet

wary vine
#

You would probably just want to write a save script, using InventoryClosed.

#

the event handler.

fossil yew
#

Already done

wary vine
#

so what are you asking then ?

#

if it works the same for containers as it does for vehicles ?

fossil yew
#

Yes.

#

Thanks again for helping.

wary vine
#

findDisplay or uiNamespace var ? which ones better , in your guys opinions.

tardy ingot
#

Am looking for someone to help me test some network code, any volunteers?

wary vine
#

what is it ?

tardy ingot
#

Testing my VTOL, need to check it syncs over the network currently am quite sure it does but can't confirm it. https://i.imgur.com/GPVvoLq.png <- this thing

wary vine
#

dqfuq

tardy ingot
#

Wanna help? 😛

wary vine
#

im messing with dialogs rn 😉

tardy ingot
#

Awesome! Also to answer your question, I love findDisplay.

wary vine
#

best way of converting parts of an existing dialog, into a controls group without messing up the positions ?

tardy ingot
#

Oh boy am I the dude to talk too

#

I'll PM you, I love arma UI

astral tendon
#
addEventHandler ["FiredNear", "
if((_this select 6) == 'Sub_F_Signal_Green' AND (_this select 1) cursorobject == (_this select 0)) then {hint 'ok'};
"]
#

Why is that considering AND a object?

strange urchin
#

_this select 1 is an object

astral tendon
#

why is not reading cursorobject ?

unborn ether
#

seems like people will never learn to script UI more than "arma level"

strange urchin
#

Why is _this select 1 even there?

astral tendon
#

Maybe people get into it because of arma only?

#

is for the vehicle

strange urchin
#

I know what the EH does

#

But OBJECT cursorObject == OBJECT is not valid

unborn ether
#

@astral tendon because of arma means let it be always the same ugly forver?

strange urchin
#

So why is it there?

unborn ether
#

@astral tendon and you missed the Object argument before your addEventHandler

strange urchin
#

Uh, he probably just omitted it

unborn ether
strange urchin
#

Dude

astral tendon
#

I see, it was wrong

unborn ether
#

@strange urchin Well

_this select 1 \\ vehicle: Object - Object which fires a weapon near the unit
strange urchin
#

I know

wary vine
#

@unborn ether I working on prettying up my dialogs xD

strange urchin
#

But that’s not relevant

unborn ether
#

oh you mean logic behind that?

#

well i get you know, ye.

strange urchin
#

Because cursorObject doesn’t take any parameters

#

Which was his issue

astral tendon
#

So, any other way to know if a unit is aiming at another one?

unborn ether
#

Most likely its a Generic error in expression here
AND (_this select 1) /#/ cursorobject == (_this select 0))

#

object object == object?

strange urchin
#

that’s what I said

#

Perhaps you could try assignedTarget (_this select 1) == (_this select 0)

#

Assuming it’s an AI

unborn ether
#

@wary vine @wary vine Scripted UI is the key in that.

astral tendon
#

Its a player

strange urchin
#

No, an AI that is firing

wary vine
#

@unborn ether Im just so used to GuiEditor 😛

strange urchin
#

GUI editor is limiting

unborn ether
#

You better use 🇵 🇦 🇷 🇦 🇲 🇸 instead of _this select

strange urchin
#

Good for visualization some times

unborn ether
#

to understand what are you looking at

astral tendon
#

I M L A Z Y

#

Plus, i dont have notepad ++ in this computer

wary vine
#

the amount of controls I have in my market system, I would have probably gone crazy getting the layout right with scripted controls

strange urchin
#

Demellion, you sound like someone that uses apply

unborn ether
#

@wary vine Well it doesn't really give you a power of scripted management. Just for the case you can't use ctrlDelete on config UI elements, what gives a huge difference on flexibility.

astral tendon
#
this addEventHandler ["FiredNear", "
if((_this select 6) == 'Sub_F_Signal_Green' AND cursorobject == (_this select 0)) then {hint 'ok'};
"]

Well, that works, but i imagine that i will have trouble if ported to a MP coop right?

strange urchin
#

I made a sonar without using GUI editor, it’s pretty overrated for anything but visualization

unborn ether
#

@strange urchin No I just sound like a dude who likes params

strange urchin
#

Yes, you might have trouble in MP

astral tendon
#

Any other option?

strange urchin
#

Don’t @ me.
Friggin’ nerd

#

I guess you could do raycasting or something like that

unborn ether
#

@strange urchin Ok, im gonna give you an example. I have a dynamic list (not RscListBox) for N-amount of elements inside a RscControlsGroup. Once the changes come, i just delete the whole group and regenerate it the same way it was before. Yes, I just use one ctrlDelete instead of hiding and showing stuff or changing their content. Oops, can't ctrlDelete config controls..

strange urchin
#

I know

astral tendon
#

All that its because the flare revolver does not count Hit

strange urchin
#

I made a Sonar system

#

CtrlCreate helped me about infinity percent

unborn ether
#

And yeah, @ is usually used to turn to people in discord, so you can undestand im talking to you

#

😄

strange urchin
#

You don’t need the @ every time

#

When I’m like, right here

unborn ether
#

Well sorry if that bothers you, I was just talking to a different people at once.

strange urchin
#

doubt it.

unborn ether
#

🤔 👍

wary vine
peak plover
#

Anyone use simple objects?

#

It says they don't get damaged?

#

Does that mean

#

Simple objects have less impact than map objects?

unborn ether
#

@peak plover Yes, as said they are simple. They only do send packets about positioning, dir and up, and ofc "im existing!". So no damage, no namespaces and etc attached.

#

@peak plover You cannot set any EVH or setVariable on them.

peak plover
#

Lmao

#

ok thx

still forum
#

@unborn ether So no damage, no namespaces and etc attached. Wrong.
They have namespaces and what does "etc" mean?

astral tendon
#

How do i seach and select somthing in a array? like
["stuff","morestuff","anotherstuff"]
i want to select anotherstuff but i cant use numbers like select 2

still forum
#

So you want to find elements?

#

How about... find

astral tendon
#

it returns a number, that is the select number?

still forum
#

yes

astral tendon
#

Thanks.

quasi rover
#

What does this means?
a = [""AAA"", ""BBB"", ""CCC""];

still forum
#

What?

#

You mean "What does this mean?" ?

#

It's a syntax error.

#

So.. One could say that it means nothing

quasi rover
#

But that was the result of diag_log format [a];

still forum
#

format [a] Wtf? 😄

#

That means a is a string containing a = [""AAA"", ""BBB"", ""CCC""];

quasi rover
#

I'm sorry I mean [""AAA"", ""BBB"", ""CCC""]

still forum
#

I think the format might escape the quotes

#

meaning a is ["AAA","BBB","CCC"]

quasi rover
#

thx, I'll give that a try.

peak plover
#

@still forum do eh work? damage?

still forum
#

wwut?

tough girder
#

<@&105622502444711936> The screenshot sqf command fails for me with E_FAIL when creating a D3D11 device, according to reference on MSDN that means a device with debug flag is being created when no debug layer is installed, what gives?

still forum
#

Can you reproduce? Can other people reproduce that?

tough girder
#

Right now It's actually on my friend's machine and on my machine it doesn't happen, but he is able to reproduce 100%

still forum
#

latest graphics drivers?

tough girder
#

No, but I don't think it's the drivers

#

the rpt writes:

DX11 error : Saving of screenshot to file failed:  : E_FAIL
still forum
#

Where does that say "when creating a D3D11 device"

#

And you really think a graphics error is not connected in any way to the graphics drivers?

tough girder
#

At directx level? Maybe, maybe not, will try

still forum
#

E_FAIL literally means "FAIL"

#

Nothing at all to do with creating a D3DDevice or any debug flag or whatever.

lone glade
#

looks like a generic error, like usual

still forum
#

You shouldn't try to interpret something into something that's just not existent

#

It says fail. Because it failed. That's it.

tough girder
#

When I see an error code that looks like it's associated with related MS API and MS specifically defines what it means in that context, I would assume things, yes

still forum
#

And that guy even answers what solved his problem.
Man.. That internet seems to be a really great place. You just try to search for something. And you find something about it. Pure magic (∩`-´)⊃━☆゚.*・。゚
More people should use this stuff.

tough girder
#

Don't know what's with hostility, I just asked a question

still forum
#

I answered you. By googling for you which you could've done yourself

#

I don't see any hostility?

tough girder
#

The profiles= cmdline param is not being used, checking HDR in a moment

subtle ore
#

Dedmen is just a bulli

still forum
#

Maybe people just think I'm hostile because I show them their weak points

subtle ore
#

Weak points? I don't think their "weak points" apply across the board. But I guess you could say that

#

It's more of the mentality of most that gives them these weak points. "Hold my hand and tell me everything to do"

still forum
#

Cutting off hands is fun I think

#

setDamage 0.3 :3

#

It's a float insider 😉

lone glade
#

you guys are pansies, you wouldn't believe how much shit commy can send at you huehuehue

subtle ore
#

@lone glade Gib medical rewrite

lone glade
#

am not on it

subtle ore
#

Is there a PR for it?

lone glade
#

if you wanted to yell at me you should've said gib fixed arsenal camera (I seriously have 0 drive to fix it) and do the arsenal stats documentation

#

yes ^

#

multiple ones

subtle ore
#

GIB Fixed arsenal camera :-)

tough girder
#

The HDR setting was the solution. Thanks for the assist

still forum
#

You needed 1 hour to solve that by asking in here.. Just googling for the error would've given you just that one result with the solution inside it.

#

So I hope you understand now why I complain about people who cannot just do a simple google search before asking here

tough girder
#

I did the search, I did not stumble on that particular ticket

#

If you don't mind sharing your query

still forum
#

"DX11 error : Saving of screenshot to file failed: : E_FAIL" <--
Exactly your error message with quotes around it

tough girder
#

Thanks

astral tendon
#
[
    cursorObject,                                                                           
    "test",                                                                       
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",                      
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",                      
    "_this distance _target < 10",                                                        
    "_caller distance _target < 10",                                                     
    {},                                                                                  
    {},                                                                                  
    {hint "hi?"},                                                
    {},                                                                             
    [],                                                                                
    0,                                                                                
    0,                                                                                  
    true,                                                                             
    false                                                                           
] remoteExec ["BIS_fnc_holdActionAdd", 0, true];
#

removeCompleted is set to true but that action still there for the other player

#

Any way to fix that?

meager heart
#

BIS_fnc_holdActionRemove < this

torn juniper
#

can you have two private statements in a sqf file?

ex:

private ["_myvar1","_myvar2];

//later in code

private ["_myvar3","_myvar4"];

winter rose
#

Yes. Also, beware of the missing quote!

torn juniper
#

🤦

#

thanks 😃

#

just typed that up as an example, I am not that bad I promise! 😄

astral tendon
#

That action still there for the other player, also, how do i give a ID to my hold actions?

tame portal
#

(X) DOUBT

torn juniper
#

press F to pay respects

gentle island
#

Hi All. I am looking for a script to teleport from Perhaps a Flagpole into a Vehicle.

still forum
#

player moveInCargo <YourVehicleHere>

subtle ore
#
_flag addAction["To Vehicle",
{
   player moveInCargo vehicle_1;
}];

etc etc

gentle island
#

hrmm. Re-logging gonna try. ty

subtle ore
#

player is local, any vars above need to he defined.

#

vehicle_1 as well, you can pass any created vehicle to addAction as an array right after given code

#
private _veh = "BlahVehicleClass" createVehicle [0,0,0];
_flag addAction["Bleh",
{
   params["","","","_pass"];
   player setPosATL (getPosATL (_pass select 0));
},[_veh]];
still forum
#

getPosATL _pass#0 😄

subtle ore
#

:/

#

Wait a sec, you can't pull that card yet. Still dev branch :p

still forum
#

I'll make sure to hide that card under a dustry rag once it becomes usable

subtle ore
#

You're going to need to clean it off here in a few weeks.

vapid drift
#

I'm getting a "Generic Error in Expression at the sleep 5; line. Is there something I'm missing?

    if (_color == "blue") then {
        hint "It's blue";
        _helipad = createVehicle ["Land_HelipadEmpty_F", _tagPos, [], 0, "CAN_COLLIDE"];
        sleep 5;
        deleteVehicle _helipad;
        deleteVehicle _tagObject;
    } ;
#

when it was just this it worked fine:

    if (_color == "blue") then {
        hint "It's blue";
        _helipad = createVehicle ["Land_HelipadEmpty_F", _tagPos, [], 0, "CAN_COLLIDE"];
    } ;
subtle ore
#

@vapid drift you cannot suspend a script in a unscheduled environment

vapid drift
#

so should I just create a function to pass the tag and helipad objects to that will handle the deleting after a set time?

subtle ore
#

you can use spawn or use a event script that is scheduled.

_this spawn
{
   params[["_color","",[""]]];
   if(_color == "blue") then
   {
         //your code here
   };
};
#

You can use canSuspend to check if the scope you are in is scheduled

#

or rather

#

that suspension can occur

vapid drift
#

ok, thank you

little oxide
#

there really is a big difference between animate and animatesource in MP ?
Speaking about optimization mainly

young current
#

using source is better

#

it can triggre multiple simultaneous parts to move at the same time

#

afaik

little oxide
#

Wanted to know if it's really more optimized for MP, or i can stay with animate

young current
#

source should be lighter on network too

#

use it if possible

fleet wind
#

this will be returning one due to it being in the array ["Apples","Oranges","Pears"] find "Oranges" but what if i want to look for "Oranges" in this array ["Apples mums","OrangesAnd some weird things","Pears are good"] in this array i want to check if anywhere there is the work "Oranges" i want that string to be able to have other thins in it aswell. Hope that makes sense

still forum
#

_yourArray findIf {_x find "Oranges" != -1}
Using new current dev-branch findIf command

#

you basically iterate through every element manually. And use find on each string

fleet wind
#

But thats not in the current build?

still forum
#

true

#

you can use forEach and if then exitWith and _forEachIndex to build something similar

#

Don't have time right now to write that out

fleet wind
#

No worries thanks for the help as allways.

tough abyss
#

o so basically findIf is select but breaks the loop upon returning true

queen cargo
#

Better Name would be selectFirst

meager heart
#

🤔

queen cargo
#

@hasty violet execvm parses a file and compiles it then Acts more or less like spawn

#

The latter Block will not compile as you expect because preprocessor is not parsed in strings with "

#

Ohh.. Variable

#

Still... You compile final it

#

Meaning you got Code in there

#

Use ifs...

tough abyss
#

Hey guys, noobie question here. Trying to simulate the need for a radio operator in a single-player scenario. Player can add or dismiss static units (not spawned in). "T02" is the RTO. Using the Unsung mod and ideally I'd like it so that the support provider only becomes available when you are interacting with your RTO's radio, but I'll settle for it, for now, just becoming active once you have added the RTO to your squad. I've seen scripts that have like if in thisgroup stuff but I don't have the first idea how to implement such a variable. I tried syncing the support providers to the AI and then adding him to group but it didn't work. Any ideas?

astral tendon
#

were i can find about class RenderTargets? the config viewer is empty about it

#

Like here configfile >> "CfgVehicles" >> "B_UAV_02_F" >> "RenderTargets"

meager heart
#

if you are about the positions and directions for the camera, check UAV model config, you are looking for this things

uavCameraDriverPos = "PiP0_pos";
uavCameraDriverDir = "PiP0_dir";
uavCameraGunnerPos = "laserstart";
uavCameraGunnerDir = "commanderview";
#

@astral tendon

tough abyss
#

Also what is the procedure for changing an AI's name in the sqaud AI in the bottom left of the HUD? Is there a simple init command I can do?

astral tendon
#

@meager heart were i find that? i tried it and did not worked

meager heart
#

which drone you are using ? 😀

astral tendon
#

B_Static_Designator_01_F

meager heart
#
uavCameraGunnerPos = "eye";
uavCameraGunnerDir = "look";
astral tendon
#

Now the camera is moving and my notepad decide to fart, thanks for the help, but were did you find that?

meager heart
#
sldt1ck - Today at 08:24
if you are about the positions and directions for the camera, check UAV model config
#

@astral tendon

astral tendon
#

how?

meager heart
#

afaik was using my eyes... back then

dry owl
#

Hello Im trying to keep people from opening a bar gate but this code is not working

#

((nearestobjects [this, ["Land_BarGate_F"], 5]) select 0) setVariable ['bis_disabled_Door_1',1,true];

lol

astral tendon
#

oh you mean
configfile >> "CfgVehicles" >> "B_UAV_01_F" >> "uavCameraGunnerPos"

meager heart
#

@astral tendon

astral tendon
#

i just find it here in the config view

meager heart
#

up2u

still forum
#

@queen cargo Better Name would be selectFirst What? No. That would be a completly different thing.

#

@hasty violet curious what the functional difference is between using description.ext preInit to spawn a scheduled thread vs. execVMing something in init.sqf
preInit doesn't spawn a thread. Init.sqf runs later, after preInit and maybe potentially but maybe also not before or after or inbetween or above or below postInit.
also execVM doesn't store the script in a variable while CfgFunctions does. Assuming you mean CfgFunctions when you say "description.ext" because "description.ext preInit" is pure non-existent bullshit.

#

@hasty violet Probably just being unable to compileFinal structured text in general Uh.. yeah.. compileFinal takes string. Not Structured text. So who would've expected that, that would work at any point in any timeline of any parallel or orthogonal universe?

warm gorge
#

If I wanted to add some event handlers to a vehicle, but maintain those event handlers through locality changes such as from the owning player logging out, what would be the best way of doing this? Should I just add the event handlers to every player that logs in after? Or is there a better way to do this

still forum
#

You mean always have the eventhandler on the unit that owns the vehicle?

warm gorge
#

Yeah

still forum
#

There is a locality changed eventhandler

#

you can use that to detect locality change. And then just remoteExec to the new owner

#

to re-add the EH

#

If someone disconnects the object is usually transferred to the server

warm gorge
#

Perfect, that should do the trick. Thank you 😃 One more question though, on the topic of persisting vehicle related stuff. I also want to maintain added actions to vehicles too. I assume theres not really any other better way than to just initially globally remoteExecute the script which adds the actions, and then run the script on JIP players for all vehicles?

still forum
#

I can't think of a better way

#

You could store the action parameters in a public variable on the vehicle

#

on JIP everyone will get the variable. And then on postInit you read it and add actions dynamically based on that variable

warm gorge
#

Alright cool, I might do it that way. Thanks again for the help.

torn juniper
#

How would I be able to bind a key action to a custom key # ? Such as fire a script when a user presses Use Action 16 in custom controls?

#

Is there a dik_code I am missing for those keys or does it have to be done another way

winter rose
torn juniper
#

I know how I would add it - I just don't know how to add it to a custom control

#

like adding a bind to 9 I would use the keycode 0x0A but no clue on custom controls

winter rose
#

custom controls would be "commands" and not directly "keys"

#

commands are bound (binded?) to keys, but you want to get the command activation

vestal quarry
#

Hello, beginner problem here: itemCargo doesnt return the full cargo, it always stops at the AK-74 Mags

testFn = { 
 _container = _this select 1;
  
  hint str itemCargo _container; 
}; 
 
player addEventHandler ["Take",{ 
  _this call testFn; 
}];

https://i.imgur.com/IZ9P067.jpg

still forum
#

Yes. itemCargo returns items

#

As the wiki page of that command says

#

same as magazineCargo returns magazines. And weaponCargo returns weapons

vestal quarry
#

ah, didn't realize magazines are not items

#

is there an allCargo or something similar?

subtle ore
#

well you have magazineCargo, weaponCargo, ItemCargo.

still forum
#

no there isn't

vestal quarry
#

thanks

torn juniper
#

figured out my thing @winter rose

if (_keyCode in (actionKeys "User2")) exitWith
{
    code to run when actionKey is pressed
};
#

👍

winter rose
#

noice!

subtle ore
#

@torn juniper
#include "\a3\editor_f\Data\Scripts\dikCodes.h"
if(DIK_yourKey in (actionKeys "User2"))

#

Makes everything more readable

torn juniper
#

was running it on a keyUp EH thats why I had the code above

subtle ore
#

Same thing applies, to the UI EVH and your action key returns.

ornate pawn
#

ace is pissing me off with its view distance limiter i can't disable it.. someone knows how ?

still forum
#

how what?

#

Disable it?
Uhm.. Just like.. Disable it.
Change the view distance limiter setting from enabled to disabled.

ornate pawn
#

i did and nothing happens

still forum
#

Well

subtle ore
#

Why not you know, restart your mission and have everything reload?

still forum
ornate pawn
#

i've disable that thing and restarted the game

still forum
#

You disable it. And it will be disabled.

ornate pawn
#

i even check my description.ext

subtle ore
#

If you're on a dedicated then it's set view distance may be lower than you want

ornate pawn
#

and i even try the game without ace and no view distance limited

#

so is ace

still forum
#

Yes.

#

It is ace.

ornate pawn
#

i'm hosting

still forum
#

You can disable it with the ace setting

ornate pawn
#

with steam

still forum
#

You can run arma without steam?

ornate pawn
#

I'm hosting the mission

still forum
#

Well I don't know why it doesn't work for you

#

but it can be disabled with the setting.

subtle ore
#

Probably something intercept does in a superior way

ornate pawn
#

If i press Esc i don't get the ace option. i have to go to configure >

#

i disable it and it doesn't work

#

..

still forum
#

yes. CBA options are ace options

subtle ore
#

ACE options are CBA options and CBA options are ACE options

ornate pawn
#

so i gotta disable it in CBA too?

still forum
#

No

#

There is only CBA

#

ACE Modules and ACE Settings are now CBA Settings

ornate pawn
#

so is a CBA setting

#

that i need to add in the mission

#

to disable it

#

i had to restart the game 4 fucking times to disable that thing

#

horrible

#

along with the NVG effect

#

not even close to the real one. i have an script that makes nvg look more realistic. if ace wants the script i can give it to them

wary vine
#

having an issue with ctrlDelete here

Lega_editListingOpen = true;

_1 = _display ctrlCreate ["Lega_Market_EditingListing_Title", 9999991];
_2 = _display ctrlCreate ["Lega_Market_EditingListing_Background", 9999992];
_3 = _display ctrlCreate ["Lega_Market_Listing_CreateListing_Button", 9999993];
_4 = _display ctrlCreate ["Lega_Market_EditingListing_ListingName", 9999994];
_5 = _display ctrlCreate ["Lega_Market_EditingListing_Description", 9999995];
_6 = _display ctrlCreate ["Lega_Market_EditingListing_Price", 9999996];
_7 = _display ctrlCreate ["Lega_Market_EditingListing_ListingExit", 9999997];
_8 = _display ctrlCreate ["Lega_Market_EditingListing_ExitBtn", 9999998];
_8 ctrlAddEventHandler ["buttonClick", "[_this] call Lega_CloseEditListing"];

Lega_editListingControls = [9999991,9999992,9999993,9999994,9999995,9999996,9999997,9999998];
``` creating the controls.

```sqf
Lega_CloseEditListing = {
  diag_log "OHFUCK";
  {
    ctrlDelete ((uiNamespace getVariable ["Lega_Market",displayNull]) displayCtrl _x);
  }forEach Lega_editListingControls;

  Lega_editListingOpen = false;
};

``` deleting the controls... and its just crashing arma xD probably something im just being retarded about.
#

Have also tried putting the actual controls into the array and (ctrlDelete _x) getting the same crashes.

pseudo cypress
#

have someone a short time for me to help me with 2 overrides that must be merged ? pls

ornate pawn
#

Ace is over writing my Earplug script my script

#

how can it prevent that ?

#

VAR_PICTURE = "<img image='scripts\BEW\Ear_plugs\Earplugs.paa' align='left' size='2.5'/>"; //--- add your picture
VAR_TEXT = "";
CTRL_TEXT = parseText (VAR_PICTURE + VAR_TEXT);
 
waitUntil { !isNull(findDisplay 46) };
(findDisplay 46) displayAddEventHandler ["KeyDown", {
    if (_this select 1 == 0x3B) then
    {
        _earplugsctrl = (_this select 0) displayCtrl 9001;
        if (isNull _earplugsctrl) then
        {
            _earplugsctrl = (_this select 0) ctrlCreate ["RscStructuredText", 9001];
            _earplugsctrl ctrlSetPosition [SafeZoneXAbs, SafeZoneY + (SafeZoneH - 0.03) / 2, 0.5, 0.2];
            _earplugsctrl ctrlSetFontHeight 1;
            _earplugsctrl ctrlSetStructuredText CTRL_TEXT;
            _earplugsctrl ctrlShow false;
            _earplugsctrl ctrlCommit 0;
        };
        [_earplugsctrl] spawn {
            _ctrl = _this select 0;
            playSound "EarplugsOn";
            _shown = ctrlShown _ctrl;
            1 fadeSound (if (_shown) then {1} else {0.2});
            _ctrl ctrlShow !_shown;
        };
    };
}];

half hornet
#

is it possible to attach an eventhandler to a weapon?

#

So if the weapon is fired, a script is executed

astral tendon
#

https://community.bistudio.com/wiki/checkVisibility
I think it worth put a note on it about that this page leads to understand that it only works with unit x unit but also works with other objects by using the getPosASL or eyePos on the object in that case sounds weird use eyePos on a rock for exemple and getPosASL maybe put the position below the ground, Also, smoke grenades seems to give a high number than 1 but they are bellow 0.1 and higher than 0.

young current
#

@half hornet no not to a weapon, the weapon is not separate object. you add fired eventhandler to the user of the weapon

peak plover
#

Can I save stuff into code blocks and call/compile in php like in sqf?

unborn ether
#

@ud9d-1#6325 because this

_8 ctrlAddEventHandler ["buttonClick", "[_this] call Lega_CloseEditListing"];

is destroying the control from its EVH.
For that type of actions you need to

_8 ctrlAddEventHandler ["buttonClick", "[_this] spawn Lega_CloseEditListing"];
#

You cannot just call the script which destroys the very same control.

#

And tbh that UI structure is done really badly. Just my opinion.

pseudo cypress
#

can someone help me with a file merge ? i dont get it please

fossil yew
#

Open destination mission. Select merge from menu. Select mission you want to copy objects from. Click merge. Save.

obsidian chasm
#

How hard would it be to add a sound effect to a moving object via a trigger?. I currently have it fine for static objects such as speakers but would love to have Wehrmacht propaganda trucks driving around.

fossil yew
#

try say3d

obsidian chasm
#

@fossil yew that would have the sound follow the object?

little oxide
#

yes @obsidian chasm

obsidian chasm
#

Ye I have no idea how to do it, honestly

fossil yew
#

in trigger execution field just type

name_of_your_truck_object say3d soundName;

#

you obviously need to name your truck

#

do you know how to import sounds into the mission via description.ext?

lone glade
#

@ornate pawn remove the hearing module in ace

obsidian chasm
#

@fossil yew yes I have them working for static objects

#

I mean that would suffice but i was wondering how hard it'd be to activate it via a trigger spawned AI vehicle

fossil yew
#

it's easy, like I said. Name the truck and use the line written above. It just works.

#

for example:

_truck = "truckType" createVehicle somePos;
_truck say3d "YourSound";
#

truckType being the exact class name of the truck you want to create and YourSound name of the sound from description.ext

obsidian chasm
#

ye it doesnt seem to want to work

#

sorry man

#

its fine

wary vine
#

@unborn ether I ended up doing it like ```sqf
_1 = _display ctrlCreate ["Lega_Market_EditingListing_Title", 9999991];
_2 = _display ctrlCreate ["Lega_Market_EditingListing_Background", 9999992];
_3 = _display ctrlCreate ["Lega_Market_Listing_CreateListing_Button", 9999993];
_4 = _display ctrlCreate ["Lega_Market_EditingListing_ListingName", 9999994];
_5 = _display ctrlCreate ["Lega_Market_EditingListing_Description", 9999995];
_6 = _display ctrlCreate ["Lega_Market_EditingListing_Price", 9999996];
_7 = _display ctrlCreate ["Lega_Market_EditingListing_ListingExit", 9999997];
_8 = _display ctrlCreate ["Lega_Market_EditingListing_ExitBtn", 9999998];
_8 ctrlAddEventHandler ["buttonClick", "Lega_editListingOpen = false"];

_arr = [_1,_2,_3,_4,_5,_6,_7,_8];

[_arr] spawn {
disableSerialization;
params ["_arr"];
waitUntil{!Lega_editListingOpen};
{
ctrlDelete _x;
} forEach _arr;
};

#

var names are being changed now its working.

unborn ether
#

@wary vine Mate you should really learn what's RscControlsGroup. It will make your life easier

unborn ether
#

just to say you can ctrlDelete the whole group with all related controls.

wary vine
#

it broke it xD

#

Yeah, next dialog, ill be using controls group

#

like it did with an old project, ill just be finishing / remaking it

#

gimmie a sec , ill get a gif

#

that was a bitch to make

unborn ether
#

I hope thats a controls groups 😄

wary vine
#

controls group inside controls groups xD

#

even made a replacement for the pop up thing.

still forum
#

@wary vine That ctrlDelete issue. spawn the deletes instead of doing it directly in the EH.
@half hornet is it possible to attach an eventhandler to a weapon? No. But you can add a FiredEH to the unit that holds the weapon

wary vine
#

thats what I did in the end, I did a spawn, then waitUntil !var, then delete

#

works perfect

errant jasper
#

Nigel, We do not speak of the language-which-must-not-be-named.

still forum
#

Yeah. Sorry I wrote before I was done reading.
Actually accidentally hit enter :u

#

@errant jasper U mean SQS?

wary vine
#

@still forum Wrong xD

#

create a weapon as a vehicle ?

#

then cant you put event handlers to it 😛

still forum
#

What?

errant jasper
#

@still forum Lol, suppose SQS would be a runner up

still forum
#

A weapon is not a vehicle

#

You can't spawn a weapon as a vehicle

#

Well.. Static weapons? Do they fire the Fired EH? never tried that

wary vine
#

thats one to be tested xD

young current
#

static weapons (turrets) are "vehicles" like any other. Only the hand held weapons cant be accessed with scripts. Even on ground they are in ground weapon holder object

hearty plover
#

So, I can't rember why this happens, I know it's a scope issue but.

this addAction ["action", {this someFunc}];

#

in the init field of a unit or object

#

and this is a undefined variable.

#

Does it not have the scope of the location the code was compiled, in this case the init on the unit? Is it even compiled then?

#

Just trying to clear this up for myself.

errant jasper
#

You want _this instead

still forum
#

Does it not have the scope of the location the code was compiled
That's not how scopes work.
in this case the init on the unit That's not how compiling works.
Is it even compiled then? No. Not at all.

errant jasper
#

@hearty plover having the scope of where "it was compiled" is known as lexical scoping. Must language have that. But SQF has something close to dynamic scoping.

still forum
#

For one scopes don't work from where it was compiled.
Second it isn't even compiled there.
addAction stores the code as string and recompiles at every execution. Just like eventhandlers -.-

wary vine
#

hmm, having a little issue with

//Pushing back all the needed controls for the actual script.
private _neededControls = [
  _editListingTitleControl,
  _editListingDescControl,
  _editListingPriceControl
];
``` and 
```sqf
_editListingBtn ctrlAddEventHandler ["buttonClick", format ["[ %1 , %2 ] call Lega_fnc_editListingClient",_info,_neededControls]];
still forum
#

Yeah.

wary vine
#

if I push back the idcs it doesn't error , but doesn't let me doing ctrlText

still forum
#

You can't stringfy controls

#

and then magically get them back

wary vine
#

nope,

#

its does'nt even work xD

#
14:53:04 Error in expression < Title","Listing Description","12313"],[Control #9999994,Control #9999995,Contro>
14:53:04   Error position: <Control #9999994,Control #9999995,Contro>
14:53:04   Error Generic error in expression
still forum
#

Yeah. As I said

#

you can't

wary vine
#

but with the IDc then on the otherside displayCtrl and ctrlText it doesnt pick up the text

still forum
#

Why not use a global variable?

#

Or store the variable on the control itself

#

and then getVariable inside the eventhandler to get it back?

wary vine
#

good point.

unborn ether
#

(findDisplay 46)\_thisDisplayVariable setVariable ['yourCtrlsArray',_arrayOfCtrls];

#

easy accessible, no need in utilizing if this is display is unloaded

wary vine
#

That's what I did ;)

velvet merlin
#

looking for some coding design input:

i am in the process of converting a SP campaign to MP COOP - thus most code should just run on the server and RE only relevant code on the clients
as such i am considering to turning triggers made with the 2d editor into scripted code

  1. necessary/good idea, or not?
  2. would you keep the triggers to define the areas? or replace with markers or just script the area detection altogther?
  3. any other ideas or thoughts?
wary vine
#

Make a complete new campaign :)

still forum
#
  1. not necessary.
  2. if script then I'd probably use markers. Replacing triggers with triggers+scripts wouldn't make much sense.
  3. keep it simple.
#

If triggers work for you. I'd say keep triggers

velvet merlin
#

so just add isServer check to condition?

still forum
#

There is a checkbox to make triggers only run on server

velvet merlin
#

in 2d editor?

still forum
#

What does 3D mean? pre Eden? Why that old?

#

Not sure if that has it

velvet merlin
#

2d = old editor; i see no point converting to 3d/Eden

still forum
#

If it has no checkbox you could try to look at what config entry Eden uses for that in mission.sqm and add that entry manually

velvet merlin
#

one other main consideration to make it scripted, is to have all code in script files. sqm/2d editor is messy to interact with

still forum
#

Well. Replace trigger condition and action by _this call X

#

scripts are most likely worse for performance if you don't do a spawn with 0.5s sleep

velvet merlin
#

yeah did this for the mission logic already essentially

#

true; on the flipside scripted allows customized condition check frequency

hearty plover
#

@still forum so I should NOT put addActions in init fields, got it.

still forum
#

Didn't say that at all

#

I don't see why you shouldn't

hearty plover
#

Just wondering what kinda hit would happen if I have 10-20 guys running around re-compiling addAction code.

still forum
#

Nothing

hearty plover
#

Does it do that even if you pass it a script right?

still forum
#

because that's not possible

#

Only you run your addActions code

#

And init field or not doesn't change anything on it

hearty plover
#

So the compile hits only affect the client

still forum
#

You could just re-read what I wrote
addAction stores the code as string and recompiles at every execution.

hearty plover
#

and the global effects of anything come back to the rest of the stuff right?

still forum
#

Converts the code to string and stores that

#

what global effects?

hearty plover
#

Like, if I have something like setFlagTexture

still forum
#

Scripts will run like any other script

hearty plover
#

Wat?

#

Okay, so. addAction stores the code as a string, and compiles that every time the addAction is called.

#

Correct?

still forum
#

yeah

#

same as addEventhandler/addMissionEventhandler and so on

hearty plover
#

This is why the this scope isn't shared with the stored code.
But, what happens to stuff I define in cfgFunctions

still forum
#

No

#

not at all

hearty plover
#

That gets compiled at mission start once.

#

Right?

still forum
#

As I said

#

compilation is 100% unrelated to scope

hearty plover
#

I know, hold on.

#

slow down.

#

I am asking.

still forum
#

But, what happens to stuff I define in cfgFunctions None different with addAction. Because as I said 3 times already. it converts to string. no matter if you pass a variable.

hearty plover
#

Why are you being so rude man?

still forum
#

What?

hearty plover
#

You have been like this for days now.

still forum
#

I am not

#

Just because I repeat stuff that I said before because you ask the same question again means I'm rude?

hearty plover
#

Nevermind Dedmen, I am not going to argue with you.

tough abyss
#

If I’m going to use the fired event handler and do something when a bullet lands (nearestEntities) will I regret the performance cost?

rotund cypress
#

No

winter rose
#

depends on what you do with the bullet hit! 😄

rotund cypress
#

It should be fine. @tough abyss

#

Think of it like this, there won't be anything noticeable regardless of having an eventhandler being called or not. However, it does matter what you do in that eventhandler of course.

vague hull
tough abyss
#

@rotund cypress yep thank you

lone glade
#

nope, not fine at all

#

@tough abyss the fired EH is one of the most expensive ones, using nearestEntities on top of it is a very bad idea

#

be very careful

tough abyss
#

Only checking 20 meters for a player being close

lone glade
#

depending on how many entities you add it to it could get messy

tough abyss
#

Just one

astral tendon
#

from the handledamage is select 4 (projectile) supouse to fire 5 times in one shoot?

weary pivot
#

how do i make a gun have infnite ammo?

tough abyss
#

@weary pivot fired eventhandler and just use smth like setVehicleAmmo 1

fossil yew
#

@wary vine what kind of mod/mission are you making there? (with money and stuff)

peak plover
#

Campaign?

wary vine
#

@fossil yew Im making a heavily modified altis life 😃

fossil yew
#

cool

wary vine
#

It uses a lot of outdated functions now, and some parts are being improved upon, and loads of stuff being added.

sacred fox
#

can someone help me with this, what am i doing wrong?
im trying to convert strings in an array and then remove decimals for each of them

_test = ["1.200","2.345","3.654"];
_cut = { parseNumber _x; } forEach _test Call BIS_fnc_cutDecimals;

winter rose
#

do you want [1,2,3] as a result?

sacred fox
#

exactly

#

im trying to make a script which will round the position of an object and compare the position against an array.

still forum
#
_cut = _test apply { [parseNumber _x,0] call BIS_fnc_cutDecimals };
sacred fox
#

@Dedmen thanks!

still forum
#

Btw no need to cross post across multiple discords.

scarlet spoke
#

Assume I have a declared macro like this:

#define MY_MACRO(arg) some stuff with arg

If I want to use said macro I can do it like that:

MY_MACRO(someArg)

My question is: Can I also use the macro like this?

MY_MACRO (someArg)

(Note the whitespace before the bracket)

astral tendon
#
_this addMPEventHandler ["mpkilled", {
_Unit = (_this select 0);
_killer = (_this select 1);
_this remoteExec [ "RemoveAllActions", 0, true ];
if (Side _Unit == civilian) then {
HINT "Civilian Killed!";
  };
if (Side _killer == west AND captive _Unit) then {
HINT "ROE violated";
  };
}]; 

Why is it firing saying its a civilian being from the side east?

still forum
#

What? That doesn't say what side the civilian is

astral tendon
#

the hint "Civilian Killed!" is firing

still forum
#

Yeah.

astral tendon
#

So?

still forum
#

What if you hint format ["civilian killed %1", side _unit] ?

#

Does it show civilian too?

astral tendon
#

yes, it says CIV

#

thoug, i am using (side cursorObject == civilian) on the console and returns false

still forum
#

try cursorTarget

#

Oh

astral tendon
#

same

still forum
#

could be that they become civilian after death

astral tendon
#

oh

#

yeah, i remember that

still forum
#

Just only add the eventhandler to civilians

#

then you don't need to check anymore

#

because _unit will always be the same unit as _this of the addMPEventhandler

astral tendon
#

the civilian one works now but i am having a problem with this one

_this addMPEventHandler ["mpkilled", {
_Unit = (_this select 0);
_killer = (_this select 1);
_this remoteExec [ "RemoveAllActions", 0, true ];
if (Side _killer == west AND captive _Unit) then {hint "ROE violated"};

systemChat "this apears";
 }]; 
#

The unit is captive and the killer is from the west side, but the hint does not shows, and the systemChat apears

still forum
#

It's completly normal that the systemChat appears

astral tendon
#

systemChat is to make sure the EH is firing

still forum
#

try adding the side _killer and captive _unit to the systemChat to really make sure that it is how you think it is

astral tendon
#

the captive is returning false, its seens like it also turns false when the unit dies

still forum
#

Why don't you just try normal non-mp Killed EH?

#

That might work better

astral tendon
#
_this addEventHandler ["Killed",{
_Unit = (_this select 0);
_killer = (_this select 1);
_this remoteExec [ "RemoveAllActions", 0, true ];
if (Side _killer == west AND captive _Unit) then {hint "ROE violated"};
systemChat format ["Unit is %1", _Unit];
systemChat format ["killer is %1", _killer];
systemChat format ["captive? is %1", captive _unit];
systemChat format ["killer is %1", side _killer];
 }];
#

same problem

still forum
#

You could store the captive state in a variable instead of trying to retrieve it after death. But that's ugly

astral tendon
#

In some points the unit may have to turn out from the captive... I may forget about that in some point and cause trouble

still forum
#

exactly that is the "ugly"ness

torn juniper
#

Anyone know of any creative antidupe methods - the game doesn’t update fast enough with my scripts. I have a button that removes a weapon from inv but if you remove your weapon with rightclick arma doesn’t recognize you lose the weapon and removes it twice thus duping it

#

I have a check to see if a player has no primary but it passes that check because arma isn’t fast enough.. i think ill have to just change from call -> spawn and add a uisleep

still forum
#

removing something twice.. Would dupe it?
But.. Removing twice results in -1 in my brain. Not 2.

#

Execute your script in unscheduled

#

In scheduled it might suspend right after your check. Player drops his weapon. Script resumes and removes weapon again although player doesn't have one anymore.

torn juniper
#

It removes it then adds it to somewhere else so, removes it twice then script adds back

astral tendon
#

i had the same problem with a drop weapon script i made, i fix by adding a randon delay for the while loop

torn juniper
#

So you end up with one on the ground one on the back

still forum
#

Yeah. unscheduled.

#

Add it back only if player has a weapon currently.
Then remove players current weapon

#

The game freezes while you do that. So the player cannot drop his weapon in the meantime

torn juniper
#

Hmm

#

So add before remove you think?

still forum
#

Doesn't really matter

torn juniper
#

Calling a script is nonscheduled correct?

still forum
#

no

#

If you call from unscheduled yes. If you call from scheduled then no

torn juniper
#

It calls from a button action

still forum
#

Eventhandlers are unscheduled

torn juniper
#

Ugh

#

Yea, it calls from that, two checks to see if they have no weapon

#

Both pass saying yes, weapon is there then it removes it

still forum
#

Well the game freezes while that script executes. Meaning the player has no way to remove it

torn juniper
#

But they remove it just before not while

still forum
#

That means your check if player has weapon should fail

torn juniper
#

Exactly

astral tendon
#

Dedmen, I fixed it by cheking if had a weapon

_this addEventHandler ["Killed",{
_Unit = (_this select 0);
_killer = (_this select 1);
_this remoteExec [ "RemoveAllActions", 0, true ];
if (Side _killer == west AND (currentWeapon _Unit isEqualTo "")) then {hint "ROE violated"} else {systemChat "Suspect had a weapown"};
 }];
torn juniper
astral tendon
#

Thanks for the help.

torn juniper
#

If someone right clicks their gun to drop it then clicks that button to swap it

#

In a really fast manner you can get it to drop and add one to your back at the same time

#

Thus duping it

still forum
#

Can you show me your script? Where you check the current weapon?

#

"really fast manner" isn't possible. As I said. If the script really is unscheduled the game freezes. No one can click two buttons in less than a millisecond while the game is frozen.

torn juniper
#

Yea let me get to my computer

#

One sec

still forum
#

what does "fast manner" mean? How fast?

peak plover
#

U can check if he duped it and setdamage 1

still forum
#

Could you maybe just close the inventory dialog?

torn juniper
#
//calling
action = "(primaryWeapon player) call SecondaryWeapons_events_addSecondaryWeapon;";

//compiled code
_weapon = _this;
if(_weapon == "") exitWith {};

if(_weapon == primaryWeapon player) then
{
    if((primaryWeapon player) == "") exitWith {_error = true;};
    player removeWeapon _weapon;
};
if(_error) exitWith {};
still forum
#

you can check canSuspend to really make sure that it actually is unscheduled

torn juniper
#

last try I got it

still forum
#

Ah... I see

#

you probably don't have CBA right? ^^

torn juniper
#

nope

#

got some magic juice in there that would help me or something?

#

😛

still forum
#

you can also do that with a spawn+uiSleep+isNil

#

or just call on CBA function 😄

#

So yeah.. I would go for the uiSleep route then.

#

you could also use the Drop eventhandler to catch when the player dropped something that he shouldn't have anymore

torn juniper
#

I do that.. kinda

#
_className = _this select 2;
if((_className isKindOf ["Rifle", configFile >> "CfgWeapons"])) then
{
    disableSerialization;
    
    _dialog = uiNameSpace getVariable ["RscDisplayInventory", displayNull];
    if (!(_dialog isEqualTo displayNull)) then
    {
        SecondaryWeaponsDupe = true;
        _buttonDown = _dialog displayCtrl 1337;
        _buttonDown ctrlEnable false;
        _buttonDown ctrlCommit 0;
    };
};
if(SecondaryWeaponsDupe) then 
{
    Systemchat "No duping please";
};
#

that catches it actually

#

most of the time

#

but thats still an issue because I know I could get the game to delete it

#

in regular play thats not a good solution

still forum
#

Could probably solve most Arma dupe bugs if BI would fix that.
Apparently it schedules the item for dropping.
Then creates the ground weapon holder. And one or more frames later actually drops the item. But ignores if the item is still in inventory at that point.

tough abyss
#

Item ids on items

still forum
#

Sounds like a easy to fix issue

#

Where Item ID's won't help in any way I could imagine

torn juniper
#

i tried getting somewhere with item ids but

#

no luck

tough abyss
#

Well if something just happens to be created (duped) you just check against the array of real ids

torn juniper
#

probably just uisleep

#

best option

tough abyss
#

what do you mean by just uiSleep?

still forum
#

Just delay the weapon swap

tough abyss
#

oh

#

yeah i guess

torn juniper
#

I just need a delay before the swap

#

to wait until it gets caught up to register

still forum
#

If the player tries a dupe. The weapon will already be gone after the uiSleep is done. And the script will detect non-existent weapon.
I just don't understand why BI made the engine side weapon swap asynchronous :u

tough abyss
#

i might be wrong, but isnt there a drag EH? Couldn't you find the inventory LB and register something on it and do something when it leaves a certain margin?

#

or is it too late at that point

still forum
#

The right click is the problem right?

torn juniper
#

yup

still forum
#

I don't see how to detect a right click with a drag eh

tough abyss
#

well i thought you can drag items out inv?

torn juniper
#

thats too slow

#

by the time you get back to the button game has caught up

tough abyss
#

hmm maybe we can just come up with a custom UI for inventory and close the one arma makes

still forum
#

No we can't

#

Also that is a bit out of scope for this tiny issue

torn juniper
#

systemChat str canSuspend;

#

false

#

btw^

sacred fox
#

is there an easy way to getPosATL and then remove the decimals or round the numbers?

tough abyss
#

yes

still forum
#

Basically the same script as what I sent you before

#

just remove the parseNumber

sacred fox
#

ah ok

torn juniper
#

@still forum thanks for muddling through it with me - uiSleep 1; after the first check and before the second works it seems