#arma3_scripting

1 messages · Page 66 of 1

pulsar bluff
#

actually that "disable person 3pv for 30 seconds" is ultra cool idea. makes players be cautious with it like a finite resource. and also gives away their position

high vigil
#

when your avarage player gets 35-40 fps all u want is more global functions lol

#

deleteVehicle / createVehicle / setObjectTextureGlobal / hideObject

#

all that shit is global

#

GE

meager granite
#

hideObjects can be done on a remoteExecCall, no need to do it each frame

#

arrived from remote players

meager granite
#

Still trying to make drones and terminals useable with as less bullshit as possible

pulsar bluff
#

what sort of controls you putting in for drones?

#

forceful movement or using AI?

meager granite
#

Right now its stock engine UAV Terminal

#

I'd want to script my own, but remoteControl is bugged and barely usable

pulsar bluff
#

i had in mind to do something like using the Contact DLC "ray gun" things to hack into drone and watch its feed via gunner for ~10 sec

meager granite
#

I'm still unsure about disabled AI on drones, gonna think about it, have it configurable per server

pulsar bluff
#

so enemy drone could have camera hijack

meager granite
#

Not sure if its useful to hijack the camera, gonna make it disable AI and scramble drone controls somehow

pulsar bluff
#

yea .. i thought maybe being able to 'hack' the enemy drone to briefly show enemy positions on the map for a couple seconds

#

basically a hold action on the drone from a distance which shows some stationary icons/markers with fading alpha

meager granite
#

Speaking of 3rd person camera position, I know for sure that servers has positions of player cameras (not sure how often they're updated)

#

Makes me wonder if clients have it too

pulsar bluff
#

of remote cameras?

meager granite
#

Pretty much whatever positionCameraToWorld returns for each client

pulsar bluff
#

there might be a selection pos for something like that, but i dont think so

meager granite
#

Its used to determine how often and what kind of messages are sent from server to clients

#

So if client is far away from some entity, its position update and such is sent much less often

pulsar bluff
#

While for AI the origin for the view direction vector can be taken from eyePos unit, for human player the origin should be taken from player camera position positionCameraToWorld [0,0,0]

meager granite
#

Hm, I wonder if its calculated or uses something from the network

#

Can be told with some tests

pulsar bluff
#

it would be pretty fixed .. like getcameraviewdirection bob vectormultiply -0.1

meager granite
#

Oh its only a direction vector, not position

pulsar bluff
#

sort of extending the direction in the opposite direction 0.5 or something

#

direction vector but it would point straight to the camera

#

maybe not

#

could probably create some little algorithm to get the camera offset from eyepos+cameraviewdir when in 3rd person

#

you'd just need a public var for first/third toggle, which wouldnt be too bad

#

and then run the pink orbs locally

fleet sand
#

_this#0 drawLine [getPosWorldVisual player, _pos, [1,1,1,1]]; Last Question how to make in here offset on _pos So it dosent go directly from start to finish but to 80 % there.

sullen pulsar
#

Well it just dawned on me that your usage of getText is incorrect. >.> There is the problem.

pulsar bluff
#
_startPos = getPosWorldVisual player;
_direction = _pos vectorDiff _startPos;
_partialDirection = _direction vectorMultiply 0.8;
_newEndPoint = _startPos vectorAdd _partialDirection;

(_this # 0) drawLine [_startPos, _newEndPoint, [1, 1, 1, 1]];
#

prompted with ```(_this # 0) drawLine [getPosWorldVisual player, _pos, [1,1,1,1]];

How to make in here offset on _pos So it dosent go directly from start to finish but to 80 % there.```

fleet sand
pulsar bluff
#

do you use the same prompt above?

fleet sand
#

Yea

pulsar bluff
#

odd, dunno

#

3.5 or 4?

#

ive been using the same chat for a couple hours so it has some context of vectors, maybe helps

fleet sand
# pulsar bluff ive been using the same chat for a couple hours so it has some context of vector...

Tried again and it gave me this:

private _pos = [1000,1000,0]; // example position to draw line to
private _startPos = getPosWorldVisual player;
private _direction = _pos vectorDiff _startPos;
private _distance = _direction mag();
private _offsetDistance = _distance * 0.8; // 80% of the distance
private _offsetVector = _direction vectorMultiply (_offsetDistance / _distance);
private _offsetPos = _startPos vectorAdd _offsetVector;
(_this # 0) drawLine [_startPos, _offsetPos, [1,1,1,1]];
pulsar bluff
#

lol

tough abyss
#

Mr Tonic

#

how the devil are you :)

pulsar bluff
#

@meager granite are you working on that camera position solve?

fleet sand
pulsar bluff
meager granite
#

The only way would be have player constantly report it to the server

#

No way to access that already existing info about player's camera

#

Maybe getUserInfo should return it

jade abyss
#

getText looks okay. Add a "systemchat str _squad" to every line to make sure it loads the correct stuff ;)

indigo snow
#

even better would be _squad = switch ...

pulsar bluff
#

there should be some way to get it with trig

night shore
#

go on...

meager granite
#

If you have two clients add unit into same group at the same time (Like with remoteExecCall), it breaks a lot of stuff

#

allUnits doesn't return one of two units, they have the group listed as theirs, yet units group doesn't return that unit, plus they keep trying to join the group triggering UnitJoined over and over

#

Bet all these issues with players not being returned with playableUnits or allPlayers caused by this

#

Some mess with group joining that breaks them

#

The whole system seems to be very unreliable

sullen pulsar
#

sec, looking for the right way. Basically (as i'm looking) you are using getText on a parent, not an entry.

jade abyss
#

Oh, correct

sullen pulsar
#

The class structure for squads are like WEST >> Infantry >> BUS_InfSquad and then there are like Unit0 and Unit1 that contain what you are looking for.

#

init.sqf is ran for everyone including server

jade abyss
manic sigil
#

So im still tinkering with my Mike Force companion mod, and Im looking to make it a little more refined in how its used.

At present, its just... there. Loaded on the server, it starts running as soon as the game boots up. Which is fine if you play on the same map, less so when it starts adding units and looking for Mike Force specific variables.

How would I stop it from firing until 1) an actual scenario is loaded, and 2) that scenario is confirmed to be Mike Force?

keen nimbus
#

Hello folks, I'm making an MP mission and trying to optimise it. I was previously using setVariable on missionNamespace but found out that that would sync the var to clients and generate extra network traffic I don't need. I'm changing to stuff to use global variables where appropriate, but my question is how can I dynamically name/create a global variable like how I would with setVariable? I was previously doing something similar to:

 _costVar = format ["%1_Cost", _unitClassname];
 missionNamespace setVariable [_costVar, _unitCost];

Any suggestions? Thanks in advance 🙂

keen nimbus
winter rose
#

if you set the publicVar parameter to true then yes, it is synchronised to clients

keen nimbus
#

Huh. See, I thought that missionNamespace was public so it would sync over regardless. I was thinking it was akin to using a global variable and then publicVar'ing it every time!

#

I was under the impression that the last param for setVariable was just for JIP queing

winter rose
keen nimbus
#

Thank-you! You've saved me a massive headache 🙂

winter rose
#

no worries, that's the channel's purpose - don't hesitate!

manic sigil
keen nimbus
#

You could use the missionName command actually

#

Would probably return something with Mike Force in it

winter rose
#

a namespace lifespan page could be nice to have, too

acoustic yew
#

It’s good enough tho, ofc it needs a lot of work. The basic code it writes is pretty fine ngl

#

You really have to tell him details and it will write the code, if ur code doesn’t work just tell him and he’ll try his best to debug, it’s 50-50 chance it will work but ofc it can point u in right direction sometimes 8)

manic sigil
#

Ill look into missionNameSpace as an option, seems promising to what I had in mind.

sullen pulsar
#

@night shore This may be what you are looking for
`private ["_fn_fetchGroups","_groupArray","_squad"];
_fn_fetchGroups = {
private ["_children","_units"];
_children = _this call BIS_fnc_returnChildren;
_units = [];

{
	_units pushBack (getText(_x >> "vehicle"));
} foreach _children;
_units;

};

_groupArray = ["BUS_InfSquad","BUS_InfSquad_Weapons","BUS_InfTeam","SpecOps"] call BIS_fnc_selectRandom;
_squad = _groupArray call _fn_fetchGroups;

snow monolith
#

I think you have to use initPlayerLocal.sqf

sullen pulsar
#

LOL

#

JIP is like the ultimate challenge.

snow monolith
#

Try using initPlayerLocal.sqf instead of just init.sqf

astral bone
#

How is building collapse damage done? If it anything within the bounding box gets damaged or-?

snow monolith
#

rip

sullen pulsar
#

Quitter.

snow monolith
#

Is it a problem with people actually JIPing or just running scripts when JIPed?

pallid bronze
#

Boys, made a Ravage scenario to play with the boys but when i saved our progress and logged and later logged back in my friends character turned into AI i dont know if its a script thing but any solution u guys have?

jade abyss
#

init.sqf -> if(MyVar_GameStarted)exitWith{end missionbla};
After game started -> 30s alter the " MyVar_GameStarted " will be set to true.

tough abyss
#

just check if(time > 0)

sullen pulsar
#

All I remember from init.sqf is when a client Jips player is null for x amount of seconds, it's better to use initPlayerLocal because that is ran after all the important things are set.

jade abyss
#

Would be a problem, if Server is in autostart

sullen pulsar
#

Plus initPlayerLocal is better practice for multiplayer missions because you are telling only the client to run something and not the server.

#

init.sqf needs to be canned tbh

quiet gazelle
#

has anyone figured out the initialisation order in 3den or do i need to do that myself?

warm hedge
quiet gazelle
#

it seems like it's different in 3den

warm hedge
#

🤔 Really?

quiet gazelle
#

Expressions of Eden Editor entity attributes are called before CBAs XEH_preInit

#

which afaik is called with normal preinit

jade acorn
#

please check the page polpox linked

quiet gazelle
#

on the other hand intercepts preInit happens before both

jade acorn
#

it explicitly says what is initialized in which phase.

quiet gazelle
jade abyss
#

same for initServer

snow monolith
#

I learned that init.sqf is obsolete the hard way

jade acorn
#

yes, and CBA functions are functions that happen before eden editor.

#

2nd row

quiet gazelle
#

my rpt says otherwise

jade acorn
#

show the RPT then, we're short on magic 8balls

quiet gazelle
#
15:43:04 "beofre reload"
15:43:06 Intercept Invoker SQF handler initializing...
15:43:06 Intercept Invoker test result: EL_D148L0 == EL_D148L0
15:43:06 Intercept Invoker initialized.
15:43:06 Intercept Pre-Init...
15:43:06 Intercept Pre-Init Completed.
15:43:06 [[2023,4,7,15,43,6,496],"3den attribute expression"]
15:43:06 [CBA] (xeh) INFO: missionNamespace processed [false]
15:43:06 [CBA] (xeh) INFO: [8348,283.988,0] PreInit started. v3.15.8.220912
15:43:06 [[2023,4,7,15,43,6,827],"XEH_preinit"]
15:43:06 [CBA] (settings) INFO: Reading settings from settings file.
15:43:06 [CBA] (settings) INFO: Finished reading settings from settings file.
15:43:06 [CBA] (xeh) INFO: [8348,284.051,0] PreInit finished.
jade acorn
#

you can upload full file here or paste its content on pastebin

sullen pulsar
#

I think the only reason why init.sqf still exists is because of singleplayer.

quiet gazelle
#

after the first "before reload" i loaded a mission with one object that has this in its config attributes expression = "_this setVariable ['rank',_value]; _value call ELD_magicTriangle_scripts_fnc_discoverRank; systemChat 'rank attribute init called'; diag_log [systemTime, '3den attribute expression'];";

#

after the second i played the mission from editor

#

after the third i went back to the editor

jade abyss
#

Even there you can use initServer iirc

#

or initPlayerLocal

night shore
#

@sullen pulsar thanks

tough abyss
#

what about HCs? :D

quiet gazelle
#

also my XEH_preInit.sqf has this line ```sqf
diag_log [systemTime, 'XEH_preinit'];

jade abyss
#

initPlayerServer

quiet gazelle
#

and the function that gets called through the objects init EH has this line ```sqf
diag_log [systemTime, 'trench init script'];

tough abyss
#

they execute it too?

jade acorn
#

well according to your RPT preInit happens before the editor entity attributes, and that's what it says on wiki

#

cba preinit is not the same preinit

#

it might be possible that it is delayed because you have your xeh within a mission, not a mod

quiet gazelle
#

doesn't cba preinit get called from normal preinit?

jade abyss
#

Uh, wait.

#

ignore my comment

tough abyss
#

;D

split nebula
#

was about to say :)

quiet gazelle
meager granite
#

Sometimes I wish there was callX which would put left operand into _x instead of _this

#

So same function can be both binary command called with call inside loop as well as with callX outside of a loop

#

Having a wrapper that does _x = _this makes additional scopes and eats up muh microseconds

winter rose
#

inb4 forEachThis

#

or forEach_this

meager granite
#

countThis, findIfThis, applyThis, selectThis meowsweats

jade abyss
#

<-- have the cold and brain is like wobblewobblewobblemashedpotatoewobblewobble

snow monolith
#

I have no idea about anything HC

little raptor
meager granite
#

Meant to use that _x function the other way around, so you can do "test" callX _fnc

silk hill
#

pretty sure HC runs initPlayerLocal

jade abyss
#

Yes

sullen pulsar
#

Headless clients are basically clients just with no interface so they run initPlayerLocal

split nebula
#

as someone that still only uses init.sqf until i learn the hard way :) its (!isServer && !hasInterface) for me

jade abyss
#

Yep, running " if(!hasInterface) exitWith {}; "

faint scroll
#

Hey guys,
I'm trying to create a little mod and I encountered an issue with executing commands in multiplayer.
Locally I can execute the 'disableAI' function but when playing on a server, clients can't execute that same function,
How can I make the client send a request for the execution of a function? (How can I make the client execute a function server-side)?

winter rose
faint scroll
quiet gazelle
sullen pulsar
#

If you think multiplayer scripting is hard to master now you should of seen it before arma 3 ;)

quiet gazelle
silk hill
#

ugh

stable dune
jade acorn
#

preinit is triggered upon mission start, not editor start.

#

I'm not sure if I understand you at all now

jade abyss
#

Or setting up ExtDB2 properly giggle

jade acorn
#

preinit stuff has to be started from an external file, not from an attribute or any other field within editor

quiet gazelle
#

oh
i thougth preinit would also run at editor start

jade acorn
#

iirc editor has it's own parameter for that

#

or a custom eventhandler

sullen pulsar
#

Shaddup

quiet gazelle
#

then that's what i'm looking for

#

something that runs on editor start before attributes are initialised

jade acorn
#

preStart maybe?

jade abyss
#

XD

jade acorn
#

I haven't had a chance to mod editor yet, perhaps if you go through eden editor functions you could find something allowing you to parse code on editor start. Or check someone else's mod that alters editor, like 3den enhanced

quiet gazelle
quiet gazelle
#

just found that aswell

#

thanks for the help, imma have to mess around with this stuff now

silk hill
#

nice to see you back in the fray, Tonic

sullen pulsar
#

I almost left again

oblique spoke
#

^^ 👍

silk hill
#

lol

sullen pulsar
#

I tried to touch altis life and then wanted to cut myself deeply.

silk hill
#

no doubt

split nebula
#

just stay away from that and its all good

sullen pulsar
#

Hey guys I know, lets make a role playing mode where you roleplay a soldier :troll:

tough abyss
#

It can't be that bad.

sullen pulsar
#

Right now I am cringing at the thought of looking at VAS...

oblique spoke
#

lol

sullen pulsar
#

Probably won't even look at it and just redo it from scratch, so many things wrong with it.

split nebula
#

haha

jade abyss
#

Blame Yuka, he sucks!

#

( i just tell him every day :D)

sullen pulsar
#

^, the view distance thing wasn't so bad because I had it brought up-to-date with what I know and optimizations before I left so that was a breeze and rather fun doing the saving part.

#

Hatchet, I want your PhysX playground btw. I always wanted to be a hotwheel car going through loops in arma.

oblique spoke
#

hahaha, too bad the damn thing doesn't work!

sullen pulsar
jade abyss
#

been there, done that

sullen pulsar
#

You say it doesn't work, I say try it in arma 2 LOL

oblique spoke
#

ha, that is probably valid.

sullen pulsar
#

The PhysX ball I thought was interesting, I actually took my limited skills in modeling to make a sphere and put it in arma to make a mini-game.

jade abyss
#

Oh boy

oblique spoke
#

those actually could be fun in some regard. i did make a hillside thing with boulders out of that. should make a video of that.

sullen pulsar
#

My mini-game idea ended up becoming a game. Believe it's called Rocket Jump or something like that lol.

#

They ever address the issue with roadways and boats?

oblique spoke
#

no, but im sending them files today. so we'll see. the crying will begin soon either way. :D

sullen pulsar
#

Have you tried roadways with planes?

astral bone
#

I wanna check if something has physics, ie gravity or is a static object, but not sure how to check. What might I wanna check?

oblique spoke
#

yep all is fine except ShipX class.

digital hollow
#

CfgVehicles simulation, then compare to list of what simulation types are/n't static

digital hollow
#

X is physX so yes, but verify for yourself

astral bone
#

uh- Candle is static but it's thingx-

sullen pulsar
#

Time for actual halo jumping captain 😁

winter rose
#

maybe if you nudge it it falls

little raptor
#

maybe 0 mass

oblique spoke
#

i mean bar the obvious character issues.. although i haven't tried that movement script in a while..

jade abyss
#

Att with Movement?

sullen pulsar
#

I miss when you could look around while attached to an object, that being taken away in ARMA 3 killed all my hopes and dreams of halo jumping out of a plane since scripted variants would suck even more then they did in A2.

quiet gazelle
#

how would i simplify this code into a macro that takes 2 arguments which would replace trenchRankCounter and 0?

if (isNil QGVAR(trenchRankCounter)) then {
    GVAR(trenchRankCounter) = 0;
};
little raptor
#

would replace trenchRankCounter and 0
what does that mean? meowsweats

quiet gazelle
#

i imagine having a #define somewhere and instead of that code write INITGVAR(trenchRankCounter, 0)

little raptor
#

you mean those will become the macro args?

quiet gazelle
#

yes

oblique spoke
#

huh, i was not aware. :boo_sounds:

little raptor
#
#define DEFINE_VAR(var, default) if (isNil QGVAR(var)) then {GVAR(var) = default;};

DEFINE_VAR(trenchRankCounter, 0)
quiet gazelle
#

thank you!

sullen pulsar
#

In Arma 2 when attached to something you could still turn, in Arma 3 you can't. You can turn your head with Alt but not your entire body.

cobalt path
#

This is how I check if google item is equiped

goggles player in [""Google_item""]";

how do I check if that item is NOT equiped?

oblique spoke
#

ah ok. gotcha

quiet gazelle
#

!(goggles player in ['Google_item'])

oblique spoke
#

was there logic behind that?

sullen pulsar
#

?

oblique spoke
#

breaking the ability to do such, was it intentional, done for other things?

sullen pulsar
#

I think it was unintentional considering the effect in A2 was also unintentional I believe.

#

Might be something to do with the implementation of PhysX

cobalt path
#

soo like

player addEventHandler ["InventoryClosed",
{
    params ["_unit", "_container"];
    if
    (!(goggles player in ['MF_Division_Beacon_Orange_1_NVG','MF_Division_Beacon_Orange_2_NVG']))
    then
    {
        ["Marki_DutyFactor", 1] call ace_advanced_fatigue_fnc_addDutyFactor;
    };
}];
oblique spoke
#

haha, from their side of the fence it may be recorded as 'fixed' now.

sullen pulsar
#

LOL

quiet gazelle
#

that looks like it'd work

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
quiet gazelle
#

i have this in the attributes class of a cfgVehicles entry. do i need to escape the brackets in the defaultValue property somehow?
if i place the object in the editor and run get3DENAttribute "neighborRanks" on it i get [[]] back, however if i open its properties and press "ok" it returns ["[]"].

class Neighbors
{
    //--- Mandatory properties
    displayName = "Neighbor Rank List"; // Name assigned to UI control class Title
    tooltip = "Configure all the things!"; // Tooltip assigned to UI control class Title
    property = "neighborRanks"; // Unique config property name saved in SQM
    control = "Edit"; // UI control base class displayed in Edit Attributes window, points to Cfg3DEN >> Attributes

    expression = "_this setVariable ['%s',_value];";

    defaultValue = "[]";

    //--- Optional properties
    unique = 0; // When 1, only one entity of the type can have the value in the mission (used for example for variable names or player control)
    typeName = "STRING"; // Defines data type of saved value, can be STRING, NUMBER or BOOL. Used only when control is "Combo", "Edit" or their variants
};
quiet gazelle
#

thanks

cobalt path
#
[]spawn 
{
if (!isServer) exitWith {};
    while {true} do 
    {
        if (Alive Player) then 
        {
            profileNamespace setVariable ["stalker_mission_loadout_01", (getUnitLoadout player)];
            saveProfileNamespace;
        };
        Sleep 300;
    };
};

I am getting illegal number in expression error on line 3

oblique spoke
#

@jade abyss aye, that script. was a little funny last time i tried it. never really looked at the code behind it though. might have been updated since last year. /shrug

little raptor
#

unless you have an invis char somewhere

#

you do. in fact there are 3

oblique spoke
#

need something like that for the PhysX carrier also..

little raptor
#
[]spawn 
{
    if (!isServer) exitWith {};
    while {true} do 
    {
        if (Alive Player) then 
        {
            profileNamespace setVariable ["stalker_mission_loadout_01", (getUnitLoadout player)];
            saveProfileNamespace;
        };
        Sleep 300;
    };
};
#

fixed

cobalt path
#

how tf do you find invis characters????

little raptor
#

my mod shows them
Advanced Developer Tools

cobalt path
#

and thanks

little raptor
#

all you have to do is click on the error. then press the Delete key on your keyboard

cobalt path
#

what program is that? I use sublime

little raptor
#

it's an Arma mod meowsweats

cobalt path
#

ohhhhhh

jade abyss
#

uuhhh script?

#

AH!

#

Yeah, would be nice to see that ingame

still forum
#

Fixed, Thank you. Next time please tell me directly when you find issue 🫂
Actually all loops were broken, since continue and break commands were introduced. The other loop types are just less likely to crash but they will display invalid data while debugging

First debugger change for 14 months 🤣

quiet gazelle
#

do macros still activate inside strings?

little raptor
#

single quoted yes. double no

quiet gazelle
#

thanks

wanton tundra
#

hello guys! i am having some ideas for a task i need to solve in order to progress with my mod for better airports. I try to explain first what i could achieve and where i would be thankful for any feedback/ideas. What i achieved so far is that i am able to land planes at airports and allow them to taxioff to specific parking slots. Here is a video to better illustrate: https://youtu.be/xEZkxZt4TDA
The downside of the approach i used as shown in the video (i spawned and despawned customized dynamic airports) is that there can never be more than one aircraft at a time being operating on the airport.
I thought a lot of maybe trying to use attach the plane to an invisible vehicle or maybe try to use unit capture. But these methods also have their downsides. Unit capture has the downside of low tolerance against interference from players. Attaching to invisible vehicle will not look like the plane is behaving like an actual aircraft.
My new approach solves many if not all of the downsides that other methods have. I have one customized dynamic airport (lets call it MainAirport) that is used only to initiate the landing process and takeOff process. I use an eventhandler "LandedStopped". This will move the MainAirport along the landing axis far enough away from the airport location. Doing this allows me when i also in the same eventhandler spawn a dynamic airport (lets call it FollowAirport) and setdir and setspeed of the plane (setdir and setspeed acts like a respawn of the plane and therefore the plane tries to search for the nearest taxiIn waypoint it finds, which is my Followairport). The FollowAirport will be moved around like holding a carrot in front of a horse. The FollowAirport only needs TaxiIn waypoints. The FollowAirport should be small for this to work to not interfere with multiple other FollowAirports in it's near vicinity. In fact i made it as small as this: ilsTaxiIn[] = {-2,0,-1,0}; and it is working fine.

I am working on a mod that allows better Airtraffic control once the planes have landed on the Airport.

This clip demonstrates dynamically changed parking slots for different planes.

▶ Play video
#

When the plane exits the runway the Mainairport can be put back in it's orignial place. Even if you would not place it back in it's original place it would still be able to let planes takeoff. The planes do not care about where the Mainairport is located as long as it is on the landing/takeoff axis. This is made possible because the MainAirport has no taxiin waypoints specified. Therefore the plane will imiditealy target the ilsPosition waypoint and takeOff as soon as the plane reached it's takeOff speed.

So what i can achieve is:
Multiple planes operating on the airport each following their own "carrot".
Interference with players (like standing in the way) will lead the plane to stop because it tries to avoid collision. Player moves out of the way and plane will continue it's path.
Because the plane is still operating itself and is not attached to a vehicle the plane will act like an acutal aircraft

Further ideas in the future is to have a acurate towing option with precise movement of towing vehicles (i would like to specify a custom towing car as a plane therefore it would behave the same and follow my carrots)
In the end i want to set this mod up as a tool that mission builders can use. It should be adjustable and dynamically generated. Most of the things now are hardcoded.
Question1: What would be a good appraoch to move the "carrot"? Performancvise what is the best approach? Triggers checking every X seconds? Eventhandler check for collision (I could place an invisible wall on the FollowAirport)? Other approaches?

Question2: Critical view about the whole concept as explained. Do you see any more efficient way to do this without further downsides?

I am happy and thankful for any feedback guys.

sullen sigil
#

tl;dr plz

dreamy kestrel
#

agree github wiki perhaps?

quiet gazelle
#

at which times are functions registered through CBA PREP available?

#

and can i change when they are available?

#

i'm trying to run one in the init EH of a 3den object, but when the init is executed while the mission is loaded (into 3den), the function is undefined

tough abyss
#

id love for you to fix some issues tonic

#

yuka has made a mess :)

#

my houses are screwed sometimes they sync containers sometimes they dont

quiet gazelle
#

i've now seen i can pull the function from uiNamespace

little raptor
wanton tundra
jade abyss
#

Thats mostly because of Arma :P

#

SetVariable + Island Obejcts -> Meh, sometimes i don't wanna work

dreamy kestrel
jade abyss
#

just remembered

sullen pulsar
#

Altis life is a giant pile of junk mixed with old and new code, no fixing that. Sort of like VAS.

warm sentinel
#

chatGPT for the win lol

warm sentinel
#

@pulsar bluff
executed it like this

    execVM "scripts\timeManager.sqf";
};```

and made minor changes to the script
```// timeManager.sqf
0 spawn {
// Configuration
private _dayStartHour = 3; // The hour at which the day starts (6:00 AM)
private _nightStartHour = 21; // The hour at which the night starts (6:00 PM)
private _timeMultiplier = 5; // Time acceleration during daytime (5x speed)

while {true} do {
    private _currentHour = daytime;
    private _isDaytime = (_currentHour >= _dayStartHour) && (_currentHour < _nightStartHour);

    if (_isDaytime) then {
        // Accelerate time during daytime
        setTimeMultiplier _timeMultiplier;

        // Wait for next check
        sleep 60;
    } else {
        // Skip night time
        private _nightTimeLeft = ((_dayStartHour + 24) - _currentHour) % 24;
        "Skipping night time." remoteExec ["systemChat", 0];
        skipTime _nightTimeLeft;
        0 setFog 0;
        sleep 1;
            };
        };
    };```
#

Works perfect thanks to you and our impending AI overlord who undoubtedly plans to inslave the human race in order to meld us into a biomechanical flesh battery hive

pulsar bluff
pulsar bluff
#

ahh nice thanks

upper remnant
#

I'm trying to edit a public flak script to be used in vehicle config using an eventhandler init but can't seem to get it to work

#

it doesn't throw any errors when in game, just doesn't have the expected outcome on the vehicle

dreamy kestrel
#

Q: elementary, I hope... if I've got some MP slots ready, I can do playersNumber _side to see the count of those slots?

fleet sand
dreamy kestrel
#

ah ok thank you

meager granite
#

Nothing can compare with a pleasure of just writing a script and not trying to fight another engine bullshit

ivory lake
#

hmm cant say i've experienced this pleasure

meager granite
#

Usually doesn't last long as you stumble upon yet another issue, bug or undocumented behaviour

pulsar bluff
#

rare

#

the closer to engine limitations the more rare

manic sigil
#

.... spend all evening trying to get an isNil to check if a specific variable exists in the missionNameSpace or not, cant sort it out, give up.

Wake up

"variable" in allVariables missionnamespace

Smh my head

warm hedge
#
isNil {missionNamespace getVariable "variable"};```or```sqf
isNil "variable";```simply?
manic sigil
#

I tried that, in a lot of configurations, but it just wasnt working out :/

Either it reported a false negative (variable set to Nil/getVariable'd default input set to Nil, still returned false) or it threw a fit because the variable didnt exist in the first place.

#

Ill poke at it again, since im sure its way faster, but this was going to be a 'check 10 seconds into the mission' thing so unless its cripplingly slow to do, In would do the job.

meager granite
#
with missionNamespace do {
    isNil "globalVar"
};
```In case you want to hop namespaces
light berry
#

i thought someone was talking shit, nope is just tonic hateing things he made in the past <3

manic sigil
#

Duly noted; Im mainly using this to check if a specific mission has been loaded for a companion mod Im working on, since outside that specific scenario itd cause issues.

sullen pulsar
#

Nothing new there, it is only natural that I hate everything that I do.

light berry
#

i feel that way too, kinda sucks to be honest do all the work just for all the mestakes you made to haunt you for ever

pliant stream
#

anyone know of a nice way of determining whether your code is running in scheduled or unscheduled? nice as in not this: isUnscheduled = { private "_f"; _f = diag_frameno; sleep 0.001; _f == diag_frameno }; ;D

drowsy geyser
#

how would i set the condition of a addAction to check if no player is inside a trigger?

this addAction
[
    "title",    // title
    {
        params ["_target", "_caller", "_actionId", "_arguments"]; // script
    },
    nil,        // arguments
    1.5,        // priority
    true,        // showWindow
    true,        // hideOnUse
    "",            // shortcut
    "_trigger = getPosATL _target nearObjects ['EmptyDetector', 3];
    count (allPlayers select {alive _x && _x inArea _trigger}) < 1", // condition
    50,            // radius
    false,        // unconscious
    "",            // selection
    ""            // memoryPoint
];

the above gives me an error

proven charm
#

where did you get that code and which error? 🙂

drowsy geyser
#

the above is just an example from wiki
i just added the condition i want it to check

proven charm
#

ok well nearObjects gives you an array so you need to deal with that

drowsy geyser
#

error says:
error 1 elements provided, 5 expected

proven charm
#

i wrote this simple code for the condition: ```sqf
_triggers = player nearObjects ['EmptyDetector', 300]; // Change player to _target and set the distance

if(count _triggers == 0) exitWith {true};

count (allplayers inAreaArray (_triggers # 0)) == 0

#

its not perfect because it only check one trigger. oh and change player to _target

stable dune
drowsy geyser
#

perfect, thank you very much both of you! now it does work

brave jewel
#

Heya, does the description.ext get reloaded when in editor and clicking start ? or do I have to reopen the mission file?

quiet gazelle
#

should get automatically reloaded iirc

brave jewel
#

Thanks 🙂

quiet gazelle
#

is there any documentation on how 3den history works?

#

especially about how objects that have been deleted are initialised when you exit editor preview?

acoustic yew
#

can you send me the snippet you wrote to sync stuff and get value out of it? I cant find it

little raptor
#

did I write that?

acoustic yew
#

yeah

#

someone did.. not sure 😦

#

my mod does load up

#

and does things

#

but its giving me "a string expected object and shit"

little raptor
#

didn't I already tell you what to do?

acoustic yew
#

I tried finding it..

#

cant do

little raptor
#

remove is3den

acoustic yew
#

i did

little raptor
#

did you do the apply compile thing?

acoustic yew
#

apply compile thing?

little raptor
#

read what I said back then

acoustic yew
#

if i can find it 😂

little raptor
#

you literally just ping quoted me

acoustic yew
#

I dont know what u mean by "apply compile thing"

little raptor
#

it's literally 3 comments below what you quoted

#

here

acoustic yew
#

that :0

#

i did not..

#

um

#

is that gonna solve it?

little raptor
#

¯_(ツ)_/¯

#

how do I know what you do wrong?

#

but at least that converts your string

acoustic yew
#

:0

#

LEMME SEE THEN!

little raptor
#

you can also do it like this: missionNamespace getVariable [_var1, grpNull]
but if someone puts a space or something in there it won't work

acoustic yew
#

I dont do it using var anymore

#

I do ```sqf
//  Attribute values are saved in module's object space under their class names (Convoy Group).
convoyGroupString = _logic getVariable ["SDR_Convoy_Group", -1];//  (as per the previous example, but you can define your own).
sleep 5; convoyGroup = hintSilent format [ convoyGroupString ];//  will display the bomb yield, once the game is started.

//  Attribute values are saved in module's object space under their class names (Convoy Commander).
curatorNameString = _logic getVariable ["SDR_CuratorName", -1];//  (as per the previous example, but you can define your own).
sleep 5; curatorName = hintSilent format [ curatorNameString ];//  will display the bomb yield, once the game is started.```
little raptor
#

then how do you do it?

#

via sync?

acoustic yew
#

I wnana do it using sync

little raptor
acoustic yew
#

it did not gave me any error

#

¯_(ツ)_/¯

#

yes

#

it does the thing

#

its basic hint bruh

little raptor
#

module function is unschd afaik

acoustic yew
#

but it prints a string 😭

#

i dont understand the difference between those

sullen sigil
#

then read the wiki

acoustic yew
#

all I know is one is inside editor and other is using scripts

sullen sigil
#

no it isnt

acoustic yew
#

bruh xD

#

am I the only smooth brain one?

sullen sigil
#

read the wiki

#

all of this stuff is explained on there

acoustic yew
#

also, please can u tell me how it will look like for my new code?

little raptor
#

idk what you mean "I dont do it using var anymore"

acoustic yew
#

yk the old var code

#

var1 and var2 kind of

#
convoyGroupString = _logic getVariable ["SDR_Convoy_Group", -1];```
little raptor
#

well how's this thing any different?

#

you're just reading some string, as you did before

acoustic yew
#

yeah....

#

i guess?

#

ok

#

I just wanna know how I will transform the string in that code to something usable yk

little raptor
sullen sigil
#

call compile var

acoustic yew
#

oh

little raptor
acoustic yew
#

yeah...

#

ummm

#

lemme see

#

    //  Attribute values are saved in module's object space under their class names (Convoy Group).
    _convoyGroupString = _logic getVariable ["SDR_Convoy_Group", -1];//  (as per the previous example, but you can define your own).


_convoyGroup = [0] apply compile _convoyGroupString param [0, grpNull, [grpNull]];```
little raptor
#

yeah something like that

acoustic yew
#

bruh 😭

#

so

#

quick question

#

Im using sqf _convoyGroup right?

little raptor
#

yes

#

but I guess make it global

#

since you didn't handle the local one correctly

acoustic yew
#

yeah

#

I will

#

I am using not so common global name

#

so I shall be good

#

if not then I will change it to local

#

yo

#

quick question

#

the player that I'll use wont be "a group" so should I use objNull?

#
    //  Attribute values are saved in module's object space under their class names (Convoy Group).
    convoyGroupString = _logic getVariable ["SDR_Convoy_Group", -1];//  (as per the previous example, but you can define your own).
    convoyGroup = [0] apply compile convoyGroupString param [0, grpNull, [grpNull]];
    sleep 5; hintSilent format [ convoyGroup ];//  will display the bomb yield, once the game is started.



    //  Attribute values are saved in module's object space under their class names (Convoy Commander).
    curatorNameString = _logic getVariable ["SDR_CuratorName", -1];//  (as per the previous example, but you can define your own).
    curatorName = [0] apply compile curatorNameString param [0, grpNull, [grpNull]];
    sleep 5; hintSilent format [ curatorName ];//  will display the bomb yield, once the game is started.```

I hope it will look like this 8)
acoustic yew
#

PHEW

acoustic yew
#

bruh

#

what's the problem?

little raptor
#

the hint part

#

and the curator is still a group

#

and the XXXString don't need to be global

acoustic yew
#

uhh

#

xxxstring part..

acoustic yew
#

like the first one?

#

AH

#

_curatorNameString it should be like this?

#

_convoyGroupString like this?

#
    //  Attribute values are saved in module's object space under their class names (Convoy Group).
    _convoyGroupString = _logic getVariable ["SDR_Convoy_Group", -1];//  (as per the previous example, but you can define your own).
    convoyGroup = [0] apply compile _convoyGroupString param [0, grpNull, [grpNull]];
    sleep 5; hintSilent format [ convoyGroup ];//  will display the bomb yield, once the game is started.



    //  Attribute values are saved in module's object space under their class names (Convoy Commander).
    _curatorNameString = _logic getVariable ["SDR_CuratorName", -1];//  (as per the previous example, but you can define your own).
    curatorName = [0] apply compile _curatorNameString param [0, objNull, [objNull]];
    sleep 5; hintSilent format [ curatorName ];//  will display the bomb yield, once the game is started.```
#

like this?

little raptor
#

you didn't fix your hints

acoustic yew
#
    _convoyGroupString = _logic getVariable ["SDR_Convoy_Group", -1];//  (as per the previous example, but you can define your own).
    convoyGroup = [0] apply compile _convoyGroupString param [0, grpNull, [grpNull]];
    sleep 5; hintSilent format [ convoyGroup ];//  will display the bomb yield, once the game is started.



    //  Attribute values are saved in module's object space under their class names (Convoy Commander).
    _curatorNameString = _logic getVariable ["SDR_CuratorName", -1];//  (as per the previous example, but you can define your own).
    curatorName = [0] apply compile _curatorNameString param [0, objNull, [objNull]];
    sleep 5; hintSilent format [ curatorName ];//  will display the bomb yield, once the game is started.
#

I did

#

I guess I did

little raptor
#

no

grand stratus
#

Does anyone know where to find the data for the placeable unit compositions in the editor (Fire team, Recon patrol) within the config files?

acoustic yew
#

what did I do wrong..

little raptor
#

Read the page on format

acoustic yew
#

oh ye format

#

removed

acoustic yew
#

format

little raptor
#

Wdym?

acoustic yew
#
hintSilent [ curatorName ];```
#

F

little raptor
#

I said read the wiki not remove it

acoustic yew
#

:/ ok

#

I mean this will work right?

little raptor
#

¯_(ツ)_/¯

#

If you fix the format that part should work

acoustic yew
#

-_-

#

yeah its ok

#

removed it 8)

#

fixed it

#

Ummm

#

Doesnt work

sullen sigil
#

read the error

#

and the wiki

little raptor
# acoustic yew

hint str convoyGroup
hint format [_convoyGroupString]
hint format ["%1", convoyGroup]
hint _convoyGroupString
seriously how hard is it to read the wiki?!

acoustic yew
#

:0

#

very 😭

sullen sigil
#

what is the command for chopping off a certain number of decimals wiki search is not being helpful right now

little raptor
#

toFixed?

#

or do you mean round?

sullen sigil
#

ah toFixed works (probably) thanks -- was searching round, decimal etc

little raptor
#

well toFixed is for string representation

sullen sigil
#

round doesn't work as needs to be 0.6 etc
though suppose I could always *10 then divide by 10 thonk

little raptor
#

yeah

sullen sigil
#

Cheers, will return to creation now

#

just needed to rubber duck it and the doctor says i cant talk to myself or he'll diagnose me with schizophrenia

acoustic yew
#

OMG THANK YOU SO MUCH @little raptor & @sullen sigil

#

FINALLY AFTER DAYS

#

ITS

#

EVERYTHING IS WORKING

#

IM SO HAPPYYYY

#

😄

acoustic yew
#

I'll give u guys credit in my mod 🙂

acoustic yew
#

Leopard can you explain what this code does??

    convoyGroup = [0] apply compile _convoyGroupString param [0, grpNull, [grpNull]];```
#

I wanna learn 8)

#

Ofc if you have time 😄

grand stratus
#

is anyone familiar with https://community.bistudio.com/wiki/createGuardedPoint ?
It does not return an object for me to manage/delete at a later time. If I create a handful of these will groups with a 'Guard' waypoint always go to defend that position regardless of distance? The guard waypoint says it works in conjunction with this function/'Guarded By' triggers. When looking at 'createTrigger' documentation it says it's better to use a 'createGuardedPoint' - does createGuardedPoint create a trigger internally that I can delete?

Basically I want to be able to delete the guardedPoint to avoid rogue AI from going to defend irrelevant objectives when there is no closer guardedPoint.

acoustic yew
#

I think I saw a video on this

grand stratus
quiet gazelle
#

is there a way to set 3den attributes without that change being recorded in 3den history?

#

or alternatively a way to change 3den history?

#

or a way to group scripted parts of 3den history together with user input-made parts?

acoustic yew
#

It’s waypoint so you can use “waypoint type” or something (check wiki)

quiet gazelle
quiet gazelle
#

is it possible to add another button to the ui at the indicated position?

winter rose
#

yeah

quiet gazelle
#

how?

#

does that work through config or through script?

little raptor
quiet gazelle
#

can you give me some pointers on whichever you consider to be the easier method is?

acoustic yew
#

thanks tho

little raptor
little raptor
# acoustic yew aw, its ok

the key part is the compile part. it compiles a string into a code. a code is an "executable unit" in Arma, i.e. what you wrap in {}
why do I do that? because a string is just text. it's meaningless. when you compile it and execute it you get what that code would return

#

the apply thing is used in case the code doesn't return anything

#

in that case you magically get grpNull (well it's not magic, it's due to using param) and your code will still work without throwing errors

little raptor
acoustic yew
#

:0

little raptor
#

but if someone who doesn't know what they're doing puts something like this group1 = ImAnIdiotthat one will throw an error

acoustic yew
#

Well how do u know I am an idiot?

little raptor
acoustic yew
#

yeah ik

#

😄

#

Im gonna make a video on modules

#

gonna give u credit and gonna quote you lol

little raptor
#

plz don't 😬

hallow mortar
#

I don't think it's a good idea to make an informational video on something you barely know anything about

acoustic yew
#

aw why not?

acoustic yew
#

hmm

#

It wont be informational 😏

grizzled cliff
#

@tough abyss ACRE is already that modular.

#

Also SQF is fine, nothing stopping you from doing anything unless its just not something the engine is capable of.

slender beacon
#

Is there a way we can get the sound details of a #soundonvehicle or #dynamicsound?

grand stratus
#

So 'Guarded By' triggers are handled completely differently from other triggers it seems. If I set the variable name in the editor, the trigger will be defined until I change the 'type' to a 'Guarded By' trigger, at which point it doesn't appear in any entities/objects lists within the mission. using 'createTrigger' and manually setting the type to 'Guarded by' doesn't seem to have any effect on the behavior of the AI.

Has anyone found a workaround to be able to delete guarded by triggers after creation?

*Or have an idea of what variable/namespace might have hidden information I could edit manually to achieve the same effect?

grizzled cliff
#

the only thing missing from SQF in my opinion really is native hash implementations and possibly better exception handling

quiet gazelle
#

what do i do now?

#

do i just patch in my own section and button mimicking the config of the sections that are already there?

grizzled cliff
#

otherwise it is just as good as any other procedural language

#

(well i mean obviously that is an exageration)

little raptor
#

yeah

quiet gazelle
#

where do i find the config patching guidelines?

little raptor
quiet gazelle
#

already found that one, it doesn't say much about modifying existing classes

little raptor
#

it does

#

well it's not different anyway

little raptor
#

it is modifying an existing class

#

every other example can also be said to be modifying an existing class

quiet gazelle
#

this works for adding another seperator to the toolbar.
am i correct in my assumption that i have done everything correctly because it works?

class ctrlControlsGroupNoScrollbars;
class Display3DEN {
    class Controls {
        class Toolbar: ctrlControlsGroupNoScrollbars {
            class Controls {
                class Separator1;
                class Separator6: Separator1
                {
                    x="34 *     (    5 * (pixelW * pixelGrid *     0.50))";
                };
            };
        };
    };
};
#

how should i choose the IDCs for my controls?

tepid vigil
#

In the biki, it is said that player can be a remote object on the players PC. How can this happen? Possibly with selectPlayer?

quiet gazelle
quiet gazelle
#

probably something with selectplayer on a remote unit then, comment on the wiki says that if you selectplayer to a unit whose leader is a different player you get half control over it

#

i guess you'd have to experiment with that a bit if you wanna find out more than what the wiki says

granite sky
#

Pretty sure there are timing bugs with selectPlayer too, but they're hard to replicate.

little raptor
quiet gazelle
#

you need to register them? it just works for me without doing anything

#

or do you mean obtain reference for coding when you say register?

hasty gate
#

How does Arma 3 select weapon for vehicle ai crew member according to target type? Is there script or Fsm for it? I want to investigate how is it selected or is it random, in example what script is responsible for selecting mg for enemy infantry or heat vs enemy vehicle

pulsar bluff
#

so whats the go with "setTerrainHeight" JIP mode

#
// first update
setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 25], [1000, 1005, 25], [1005, 1005, 25]]];

// second update - this will update the JIP queue properly
setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 50], [1000, 1005, 25], [1005, 1005, 25]]];```
#

in second update there is a 50 instead of a 25

#

is that intentional?

quiet gazelle
#

yes

#

from how i understand it, if you give it the same batch of positions the second time you edit something from that batch, it will remove the old info about that batch from the jip queue

#

the good and the bad example visually have the same effect, just after the good example, the jip queue will look like this:

setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 50], [1000, 1005, 25], [1005, 1005, 25]]];
``` and after the bad example it will look like this 
```sqf
setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 25], [1000, 1005, 25], [1005, 1005, 25]]];
setTerrainHeight [[[1005, 1000, 50]]];
quiet gazelle
#

however that's all i can gather from the examples, there's a lot more i'd like to know about this

#

for example at what point the jip queue being filled becomes problematic

#

and if setting points to their original height along with neighboring points instead of not modifying them is a good or bad idea

#

and how big the difference in load on the jip queue is between setting two seperate points individually versus setting both in the same command

pliant stream
#

i dunno i'd sure love language oop support and references/pointers

#

also the interpreter implementation could probably be better

sharp light
#

does the code from an action added by addAction run locally?

warm hedge
#

Yes

sharp light
#

good to hear, thanks

stray flame
#

Hello, I have a few scripts that (together) respawns players with the loadout they died with. I was wondering if there is a way to adjust these to also check (on respawn) if the player has an item? and if they dont, to add it to their inventory.

initPlayerLocal.sqf:

player addEventHandler ["Respawn",{ 

    params ["_newObject","_oldObject"];
    deleteVehicle _oldObject; 

}];

player addEventHandler ["Respawn",{ 
player switchMove "UnconsciousFaceDown"; player playmove "UnconsciousOutProne"; 
}];

onPlayerKilled.sqf:

player setVariable ["Saved_Loadout",getUnitLoadout player];

onPlayerRespawn.sqf:

player setUnitLoadout (player getVariable ["Saved_Loadout",[]]);
#

Basically as a failsafe to players loosing their radios is what I intend.

proven charm
#
if(!("ItemRadio" in (assignedItems player))) then { hint "player has no radio!"; };
#

the radio may still be in inventory just not assigned to a slot

stray flame
#

onPlayerRespawn.sqf?

proven charm
wanton tundra
#

Hello!. I have a init.sqf inside my mod. I want it to postinit. To simply check if the init.sqf is executed i placed systemchat commands in the init.sqf:
systemChat "init.sqf started";

My init.sqf is not exectued. I put this in the config:
class CfgFunctions {
class DynamicAirportsPLUS {
class Init {
postInit = 1;
file = "DynamicAirportsPlus\init.sqf";
};
};
};

#

i launch the mission from the editor to test it if that has maybe influence?

sharp light
#

if I had a circle I wanted to shrink by 10% every minute, what would be a good way to do it? (it's in multiplayer)

winter rose
sharp light
#

10% of the diameter

#

but I'm more interested in the sync and timing part

winter rose
#

what do you have right now?

sharp light
#

I have the circle marker and I know which function to use to change the size

stray flame
#

since that would be more reliable since im using TFAR

dusk gust
dusk gust
# sharp light if I had a circle I wanted to shrink by 10% every minute, what would be a good w...

On server, you'd have a loop with a sleep that periodically makes the marker smaller. Using setMarkerSize, it has a global effect, meaning it will make change the marker size for every player on the server.

Ex.

[]spawn{
    private _marker = "yourMarkerName";
    private _decreaseSize = ((markerSize _marker) # 0) * 0.1;
    while {(markerSize _marker select 0) > 0} do {
        uiSleep 60;
        _markerSize = (markerSize _marker # 0) - _decreaseSize;
        _marker setMarkerSize [_markerSize,_markerSize];
    };
};
sharp light
dusk gust
sharp light
#

alright, cheers

stray flame
#

is there a way of making map markers dissapear and appear depending on zoom levels?

#

Like how it is on the map already with things like this

winter rose
pulsar bluff
#

@winter rose with "setVehicleRadar", would be good to have link to "isVehicleRadarOn"

#

on wiki

stray flame
#

hm, that seems complicated

tiny wadi
#

How can I take an array that is in a string and convert it back to a normal array?

#

eg: "['test','123']"

pulsar bluff
#

thanks!

#

@stray flame if it were me I'd do something like this

#
if (isNil 'TAG_myMarkers') then {
    TAG_myMarkers = [];
};
if (!isNil 'TAG_mapCtrl') then {
    ((findDisplay 12) displayCtrl 51) ctrlRemoveEventHandler ['Draw',TAG_mapCtrl];
};
TAG_mapCtrl = ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler [
    "Draw", 
    {
        params ["_control"];
        if ((ctrlMapScale _control) > 0.5) then {
            {
                if ((markerAlpha _x) > 0) then {
                    _x setMarkerAlphaLocal 0;
                };
            } forEach TAG_myMarkers;
        } else {
            {
                if ((markerAlpha _x) isEqualTo 0) then {
                    _x setMarkerAlphaLocal 0.5;
                };
            } forEach TAG_myMarkers;
        };
    }
];
#

add your markers to TAG_myMarkers list

#

that flow will hide the markers when you zoom out

winter rose
wind hedge
# pulsar bluff ```sqf if (isNil 'TAG_myMarkers') then { TAG_myMarkers = []; }; if (!isNil '...

here is my take: ```sqf
VAL_fn_mapMarkersEH = {
if !hasInterface exitWith {};
if (isNil 'TAG_myMarkers') then {TAG_myMarkers = [];};

    addMissionEventHandler ["Map", {
    params ["_mapIsOpened", "_mapIsForced"];
    
    if (cameraOn != player) exitWith {};
    if !(alive player) exitWith  {};
    if !("ItemMap" in (assignedItems player)) exitWith {systemChat "You don't have a map in your inventory";};
    if !(isNull findDisplay 160) exitWith {};
    
    if (_mapIsOpened) then {
        systemChat "MAP active";
        if (isNil "V_MAPOPEN") then {V_MAPOPEN = false;};
        [] spawn {
            if (V_MAPOPEN) exitWith {};
            V_MAPOPEN = true;
            
            while {V_MAPOPEN && alive player && "ItemMap" in (assignedItems player)} do {
                if ([0.001, 0.02] call BIS_fnc_isInZoom) then {
                    {
                        hint "Zoom level is in between 0.001 and 0.02";
                        if ((markerAlpha _x) > 0) then {
                            _x setMarkerAlphaLocal 0;
                        };
                    } forEach TAG_myMarkers;
                } else {
                    {
                        if ((markerAlpha _x) isEqualTo 0) then {
                            _x setMarkerAlphaLocal 0.5;
                        };
                    } forEach TAG_myMarkers;
                };
                sleep 1;
            };
            V_MAPOPEN = false;    
        };
    } else {
        V_MAPOPEN = false;
        systemChat "MAP inactive";
    };
}];

}; ```

#

☝️ Should be slightly less performance intensive...

meager granite
#

There is also GPS, Arty computer and UAV Terminal maps that aren't considered here

astral bone
#

Is there a way to have it so when a vehicle is spawned, it's marked as a different side then normal?
Like, spawn a NATO car, on the map it shows are blue. But instead, I'd want it so the car is considered CSAT unless otherwise known.

#

(The vehicles I wanna use are technically nato, but I want them to be used by CSAT, so- x3)

pliant stream
#

call and compile it?

proven charm
#

the last parameter is the side

astral bone
#

Hmm- it seems that the side might be refering to the crew spawned with it, not what that vehicle is shown as.

proven charm
#

you can only affect the crew side, not the vehicle side

astral bone
#

ah yea, that's what I was wondering

#

B/c you have a crewed vehicle in the distance you see for a split second, it'll be marked by what side normally operates said vehicle. Then as you get closer, it will change depending on what side the crew is actually on

meager granite
#

No way to change that without have a new vehicle in config with another side.

astral bone
#

Aww.

astral bone
#

No- I mean, to me atleast, it makes sense

#

You see it, but you can't see the crew, thus you'd assume it's on the normal side it'd be found on

digital hollow
#

You can try having it crewed by invisible uav ai of the desires side, certain elements disabled so it doesn't do undesired things like maybe shoot

astral bone
#

But anyway, I got halo assets. Players are insurgents, but they are actually on Nato, the the enemy is vice versa.It's not SUPER important, since it's only visual,
Just, I can see someone doing the "Seeing the vehicle for a split second, so it has normal side colors" then it gets attack/ignored and then- well- yeeea xD

proven charm
#

if you want something like this really badly you can always disable the vanilla markers (via disableMapIndicators) and draw your own markers

astral bone
#

eh

tiny wadi
#

Now its adding {} before/after it

wind hedge
#

Maybe the wiki needs to be updated because the command changed its syntax?

winter rose
#

fixed, thanks for the report

wind hedge
pliant stream
#
_myString = str _myArray;
_myOtherArray = call compile _myString;```
winter rose
#

thats wh— wait

tiny wadi
#

ahh I had to add call before the compile

#

Thanks :)

pliant stream
#

yeah i was thinking of the syntax, should have said compile and call

#

won't work in all cases though

#

for example _myArray = ['te"st']; _myString = str _myArray; _myOtherArray = call compile _myString;

cobalt path
#

I need a script to activate if these items are NOT equipment by the player, anyone got any idea whats wrong with this?

player addEventHandler ["InventoryClosed",
{
    params ["_unit", "_container"];
    if
    (!(goggles player in
    [
    'Mask_M40',
    'Mask_M40_OD',
    'Mask_M50',
    'G_AIrPurifyingRespirator_02_black_F',
    'G_AIrPurifyingRespirator_02_olive_F',
    'G_AIrPurifyingRespirator_02_sand_F',
    'G_AIrPurifyingRespirator_01_F',
    'G_RegularMask_F'
    ]))
    then
    {
        ["Marki_DutyFactor", 1] call ace_advanced_fatigue_fnc_addDutyFactor;
    };
}];
winter rose
little raptor
cobalt path
# winter rose `in` is case-sensitive, and you use `AIr` instead of `Air` perhaps

Doubt it, because this which checks if I got items equipped works great

player addEventHandler ["InventoryClosed",
{
    params ["_unit", "_container"];
    if
    (goggles player in
    [
    'Mask_M40',
    'Mask_M40_OD',
    'Mask_M50',
    'G_AIrPurifyingRespirator_02_black_F',
    'G_AIrPurifyingRespirator_02_olive_F',
    'G_AIrPurifyingRespirator_02_sand_F',
    'G_AIrPurifyingRespirator_01_F',
    'G_RegularMask_F'
    ])
    then
    {
        ["Marki_DutyFactor", 3] call ace_advanced_fatigue_fnc_addDutyFactor;
    };
}];
little raptor
#

how's that any different from the last code?

cobalt path
#

One is (code) other is (!()) code

winter rose
#
player addEventHandler ["InventoryClosed",
{
    params ["_unit", "_container"];
    if (_unit != player) exitWith {};
    if (goggles _unit in
    [
      'Mask_M40',
      'Mask_M40_OD',
      'Mask_M50',
      'G_AIrPurifyingRespirator_02_black_F',
      'G_AIrPurifyingRespirator_02_olive_F',
      'G_AIrPurifyingRespirator_02_sand_F',
      'G_AIrPurifyingRespirator_01_F',
      'G_RegularMask_F'
    ])
    then // I haz filters
    {
        ["Marki_DutyFactor", 3] call ace_advanced_fatigue_fnc_addDutyFactor;
    }
    else // I no haz filters
    {
        ["Marki_DutyFactor", 1] call ace_advanced_fatigue_fnc_addDutyFactor;
    };
    // kthxbai
}];
little raptor
#

I doubt that's the problem tho blobdoggoshruggoogly

fair drum
#

@little raptor using ADT, if I want to find config values that aren't empty strings, would I use ^(?!\s*$).+ for regex?

#

using search function

winter rose
#

^.+$

#

. is a character
+ is 1..infinity

little raptor
#

".+?"?

fair drum
#

yeah i haven't used regex before so I'm just sluffing through the read material atm

little raptor
#

no I meant I just str the config value iirc

#

let me check

#

yeah meowsweats

fair drum
#

lol i got a game crash for out of memory

#

2097152 KB reserved...

little raptor
#

yeah the hashmap eats a lot of space meowsweats

#

I recommend getting a config dump

#

the one in my mod doesn't work either 😅

little raptor
fair drum
#

CUP seems to use cfgMagazines, while vanilla I'm still searching for

little raptor
#

well you can compare the configs directly

#

just copy 2 config classes

#

(ctrl+shift+c)

#

then paste them in VSCode or something

#

then use diff

#

or if you want I can get you an AIO dump

#

(or get it yourself if you have the diag exe)

fair drum
#

I noticed they have them in different parents/siblings/childen. CUP uses the magazine class directly, vanilla doesn't seem to use any of the parents that I'm searching through, nor the class directly so that's where I'm trying to find the parent that doesn't have reloadMagazineSound[]={"",1,1}

#

all to help someone who asked a question on the subreddit lol

little raptor
#

well do you want a config dump?

fair drum
#

sure I could use one for future reference

#

I can make my own with diag_exportConfig right?

little raptor
#

yeah

#

if you have diag exe

little raptor
fair drum
cobalt path
molten tree
#

I'm trying to change the texture on Land_Boxloader_Fort_Helipad_Tarp via setObjectTextureGlobal and it's not working. It doesn't have hideSelection. Is there a way to create a fix for it by making a mod that replicates everything except the lack of hideSelection?

quiet gazelle
#

unless you make your own model that replaces the existing one i dont think so

molten tree
#

I was more thinking of making a new config file that includes the hideSelection so I can use setObjectTexture on it, overriding the default config.bin for the object.

quiet gazelle
#

for that to work a vertex group defining the hidden selection needs to be in the model

molten tree
#

Oof. That sucks. 😦

sullen sigil
tough abyss
#

^ this will not work when the array contains anything else than booleans, numbers or strings

#

Also call compile str triggers me

winter rose
#

yep, a case of crossposting

warm fossil
#

I'm trying to make a list _camp_grp that includes all the objects synced with an object called trapezoid1 for example. I have "trapezoid" coming from a string called _ao_trim and the 1 is a random int between 0 and 3 called _pick. The code I currently have is
_camp_grp = synchronizedObjects format[_ao_trim + str _pick];but it is throwing an error.

quiet gazelle
#

synchronizedobjects takes an object as an argument, not a string

#

i assume you're trying to select a random one of 4 objects

#

in that case try ```sqf
_camp_grp = synchronizedObjects (selectRandom [trapezoid0, trapezoid1, trapezoid2, trapezoid3])

#

you could probably also do ```sqf
_camp_grp = synchronizedObjects (call compile (format[_ao_trim + str _pick]));

south swan
#

or missionNamespace getVariable (_ao_trim + str _pick) for that matter. Still not recommended :3
why even use format when it does nothing?

quiet gazelle
#

what does No alive in 10000 ms, exceeded timeout of 10000 ms showing up in my rpt mean?

acoustic yew
#

Ello, sorry for interjecting but can I add some code to the init of any unit using script?

quiet gazelle
#

yes

acoustic yew
#

How 8)

quiet gazelle
#

just so i'm not misunderstanding you, you want to have a script running in the editor that writes things into units init fields?

acoustic yew
#

More or less, I want to add some code in the init of a specific unit using a script 8)

acoustic yew
#

:0

quiet gazelle
#

this is the command you're looking for

acoustic yew
#

Thank you so much!!

quiet gazelle
#

i think the init fields name is "init"

acoustic yew
#

Yeah

#

Hmm this affects a specific class

quiet gazelle
#

what do you mean?

acoustic yew
#

Don’t mind me xD

#

I’ll see what I can do 8) thanks

quiet gazelle
#

could be, i was tabbed out and looking at the rpt when it appeared

wind hedge
#

Does anyone has a good config for sqf drawLaser [ eyePos player vectorAdd [0, 0, 0.1], getCameraViewDirection player, [1000, 0, 0], // Bright red [], 5, 20, -1, false ];

#

so that it looks like a laser coming from the weapon but it is visible? The default values here are not realistic looking at all

meager granite
#

This is how this code looks

#

It doesn't follow the weapon though but your character's view direction

pulsar bluff
wind hedge
# meager granite

Anyway to make the laser come out of the weapon barrel? I tried: ```sqf
VAL_fn_drawLaser = {
if !(isNil "V_PLAYERLASEREHID") exitWith {removeMissionEventHandler ["Draw3D", V_PLAYERLASEREHID]; V_PLAYERLASEREHID = nil; systemChat "Weapon Laser Off";};

V_PLAYERLASEREHID = addMissionEventHandler ["Draw3D", {
    drawLaser [
        getPosWorld currentWeapon player vectorAdd [0, 0, 0.1],
        (player weaponDirection (currentWeapon player)),
        [1000, 0, 0], // Bright red
        [1000, 0, 0],
        1,
        1,
        100,
        false
    ];
}];
systemChat "Weapon Laser ON";

}; ```

#

But sqf getPosWorld currentWeapon player vectorAdd [0, 0, 0.1] Is giving me "type string, needed object" error

warm hedge
meager granite
#

yeah you'll need to get weapon muzzle selection with selectionPosition and selectionVectorDirAndUp

#

Its also complicated if you want exact end of the muzzle

wind hedge
#

Is there an equivalent to sqf eyePos player but like barrelPos currentWeapon player?

meager granite
#

I don't think so

#

I remember it involved something like spawning your weapon as simple model, finding its muzzle end offset and vectors, then deleting it and using the offsets

wind hedge
#

What about getting the physical location that the laser attachment is supposed to go? Maybe that?

warm hedge
#

I've used selectionPosition + createSimpleObject + selectionVectorDirAndUp to determine where is the pos

meager granite
#

Nothing is easy in Arma

warm hedge
#

My Mod Visible Laser does terrible workaround there

pulsar bluff
#

there is the "usti hlavne" selection, but i guess you cant do <weapon> selectionposition "usti hlavne"

warm hedge
#

Yeah a weapon on hand is not an object

#

Maybe if we have a command to get a proxy info

meager granite
#

It is an object actually, you can get it with cursorObject, I wonder if you can run selectionPosition against it? 🤔

warm hedge
#

🤔

meager granite
#

But there is nothing like primaryWeaponProxy player to return it normally

#

So even if you could, its useless

pulsar bluff
#

it comes up in selections as a proxy

#

theres no nice command to get proxy objects of player i dont think

warm hedge
#

selectionNames can get it, but kinda iffy

meager granite
#

Yeah, but you can't get an actual world object that is used as proxy, only positions and vectors where proxy is

warm hedge
#

At least we have a workaround

meager granite
#

cursorObject => NOID mx_f.p3d when you aim at a weapon in unit's hands

#

Yeah, simple objects is the way to go

warm hedge
#

Hmm if so maybe we can get it with nearEntities?

meager granite
#

[cursorObject, cursorObject selectionPosition "usti hlavne"]
=>
[NOID mx_f.p3d,[-0.32957,0.000438549,0.0830223]]

warm hedge
#

Gud to know

meager granite
wind hedge
#

This seems to work: sqf player selectionposition "weapon"

pulsar bluff
#

what about lineIntersectsSurfaces

#

that should return proxies

meager granite
pulsar bluff
#

my guess is we can actually get the muzzle pos, but that it will take some guess work to make up for lack of _objects = proxies player command

#

you'd have to do constant projecting lineintersectssurfaces to get the active proxy

#

and where to where, i guess "righthand" in a few directions

wind hedge
#

But when I try to use it with sqf player selectionPosition "weapon" which is a Position Relative it says "Type Array, expected Object"

#

So the wiki could be outdated or am I doing something wrong?

#

This is what I am trying to do: sqf (player selectionPosition "weapon") modelToWorldVisual [0,0,0];

honest pilot
#

hey people, I have an issue creating a custom unit

in my mission i want a plot caracter (AI that will help the player) for testing purposes i'll name it Bob but i got issues scripting the new class, and making in appear with this command bob = createUnit ["B_BOB_F", position player, [], 0, "NONE"];

here is as well my script for Bob

meager granite
meager granite
#

But you need to move your BOB_NATO_Unit inside CfgVehicles

#

The amount of comments makes this looks like ChatGPT output

wind hedge
#

Is there a way to transform a relative position in model space to ASL? For example: sqf _posASL = relativePosToASL (player selectionPosition "head");

meager granite
#

modelToWorld
modelToWorldVisual
modelToWorldVisualWorld
modelToWorldWorld

#

Second "World" here is ASL

#

Arma tier command naming

pulsar bluff
#

did u have a go at the lasers @meager granite ?

#

i got something working, but theres some imprecision in the weapon selection points

#

give this a go

#

should just work for paste & go in editor

#

of course only works for players gun

wind hedge
pulsar bluff
#

wont work for teammates in MP

#

toggle on/off with the light button, L or whatever

wind hedge
pulsar bluff
#

should still work

wind hedge
# pulsar bluff

Just tested your script, works perfectly! But I got basically the same results with just this:

#
VAL_fn_drawLaser = {  
    if !(isNil "V_PLAYERLASEREHID") exitWith {removeMissionEventHandler ["Draw3D", V_PLAYERLASEREHID]; V_PLAYERLASEREHID = nil; systemChat "Weapon Laser Off";};
    if (currentWeapon player isEqualTo secondaryWeapon player) exitWith {systemChat "Weapon Laser NOT AVAILABLE";};
      
    V_PLAYERLASEREHID = addMissionEventHandler ["Draw3D", {
        private _laserStart = AGLToASL (player modelToWorldVisual [0.23,1.13,1.4]);
        private _laserDir =  (player weaponDirection (currentWeapon player));
    
        call {
            if (stance player isEqualTo "STAND") exitWith {
                if (currentWeapon player isEqualTo primaryWeapon player) then {};
                if (currentWeapon player isEqualTo handgunWeapon player) then {_laserStart = AGLToASL (player modelToWorldVisual [0.17,1.1,1.4]);};
            };
            if (stance player isEqualTo "CROUCH") exitWith {            
                if (currentWeapon player isEqualTo primaryWeapon player) then {_laserStart = AGLToASL (player modelToWorldVisual [0.20,1.13,0.9]);};
                if (currentWeapon player isEqualTo handgunWeapon player) then {_laserStart = AGLToASL (player modelToWorldVisual [0.17,1.1,0.8]);};
            };
            if (stance player isEqualTo "PRONE") exitWith {            
                if (currentWeapon player isEqualTo primaryWeapon player) then {_laserStart = AGLToASL (player modelToWorldVisual [0.29,1.3,0.27]);};
                if (currentWeapon player isEqualTo handgunWeapon player) then {_laserStart = AGLToASL (player modelToWorldVisual [0.27,1.13,0.3]);};
            };
        };    
    
        drawLaser [
            _laserStart,
            _laserDir,
            [1000, 0, 0], // Bright red
            [1000, 0, 0],
            1,
            2,
            100,
            false
        ];
    }];
    systemChat "Weapon Laser ON";
}; ```
pulsar bluff
#

yea nice

wind hedge
#

The only improvement from your script that I could think of is using: sqf private _handPos = player modelToWorldWorld (player selectionPosition 'righthand'); instead of the sqf AGLToASL (player modelToWorldVisual [0.23,1.13,1.4]); that I use... And the benefit would be better laser when leaning

pulsar bluff
#

try switching weapons/etc

#

ill give yours a go

wind hedge
#

Then we will have the ultimate laser weapon that is not a resource hog

pulsar bluff
#

there is some weakness in both when looking straight up or straight down

#

i think thats just weapondirection sucking

wind hedge
wind hedge
#

And when you look down or up, the weapon model moves but not your model, and we are using the player model to measure the starting point

#

Too bad Arma is missing a way for getting the posASL of the weapon barrel

#

Anyway, we got pretty close without destroying our FPS or using mods

#

That is a win in my book

pulsar bluff
#

i tried to get the world pos of the weapon but didnt work... banged it out fast so i dont know, maybe is possible

wanton swallow
#

How to watch connect/disconnect UAV Terminal events?
When player connecting and disconnecting to UAV.

warm hedge
#

IIRC there is an Eventhandler for it

warm hedge
#

Oh yeah I misremembered

agile pumice
#

is it possible for a weapon to fire a projectile that doesnt have physical atttributes? aka just play a sound when fired?

meager granite
#

I just remembered that there is unitsBelowHeight

#

So you can do

_units inAreaArray _trigger unitsBelowHeight 10
```to get units inside the trigger and at certain height limit
#

Wish there was complimentary:

ENTITY isBelowHeight NUMBER
```for a single entity check
#

to use with single inArea

meager granite
mellow scaffold
#

I swear to god, trigger locality is ruining my brain 😕

winter rose
#

don't use triggers then

#
  • a trigger is local to the machine on which it is created
  • a trigger not made "server-only" is created on each and every machine
  • a trigger can run commands that have global effect

that's about all you should know

#

@mellow scaffold ↑

mellow scaffold
#

Well, I am creating a local trigger (createTrigger with false as third arg), but it wasn't firing anywhere when I tried yesterday, I'm about to do another dive on it with a fresh mind.

winter rose
#

roger roger!

mellow scaffold
#

Insight #1: it's thisList, not _thisList

#

Insight #2: if you're adding debug logging to a trigger, do it outside of {} foreach thisList; because you may have gotten #1 wrong.

#

It is a bit silly tho that getting #1 wrong in trigger code/foreach does not elicit an error (it's probably the semantics of {} foreach nil)

little raptor
#

I've already posted that script several times

winter rose
mellow scaffold
little raptor
#

@pulsar bluff @wind hedge

mellow scaffold
#

Anyhoo. Now I need to wait for my trusty community member that helps me with testing to see if I finally got triggers right. This thing almost always worked in local MP, but broke hilariously with just 2 players on a DS. And if I can't get it to work, I'll have to make my own shitty trigger implementation using area markers and inArea 😄

little raptor
#

You can test things yourself btw

winter rose
patent goblet
#

how can I check if a unit vest has a holster?
tried selectionNames but pistol_holstered.001 are in every vest so pls help
And getNumber (configfile >> "CfgWeapons" >> vest player >> "ItemInfo" >> "showHolsteredPistol") always 0

mellow scaffold
winter rose
sharp skiff
#

im curious did someone use ChatGPT to make an arma 3 script and it worked?

warm hedge
#

To make from zero, it makes nonsense. To tweak, slightly useable

little raptor
winter rose
#

given it's onEachFrame people should know it is test code 😄

mellow scaffold
#

What's the usual consensus for how big the float returned from checkVisibility has to be for "realistic" spotting of AI vs humans? (also, does it take the distance into account or do I have to scale the returned value?)

little raptor
#

Anything larger than 0

#

But AI doesn't use that exact command

#

Also no it doesn't take day/night/distance into account

#

fog too

mellow scaffold
#

I see. Thanks!

winter rose
#

would do?

mellow scaffold
#

I'll probably use visibility plus knowledge (knowsAbout) to get a vaguely consistent modeling of how humans would see

winter rose
molten yacht
#

Can anyone tell me how to assign certain units certain roles for cfgRoles and the purposes of respawning? I need certain units to have different loadouts from normal even though they're both ostensibly the rifleman unit.

pulsar bluff
sullen sigil
#

"fine"

pulsar bluff
#

i mean it can effectively answer most of the questions asked here for pre-2021 script commands

#

"setTerrainHeight" example is driving me nuts

#
// first update
setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 25], [1000, 1005, 25], [1005, 1005, 25]]];

// second update - this will update the JIP queue properly
setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 50], [1000, 1005, 25], [1005, 1005, 25]]];```
#

why is there a 50 in the second update

winter rose
#

it basically says "update the same batches otherwise the JIP queue does not overwrite and gets clogged"

pulsar bluff
#

hmm k

winter rose
#

I mean

pulsar bluff
#

so what if second update is identical to first update

#

IE 50 changed to 25

south swan
#

you still get only one batch in JIP queue. Because X/Y coordinates still match blobdoggoshruggoogly

wind hedge
#

@pulsar bluff Thanks to @little raptor got it working perfectly! If you want to update your mod @warm hedge : https://forums.bohemia.net/forums/topic/241891-release-visible-weapon-lasers-proof-of-concept/?do=findComment&comment=3473994

winter rose
#

sqfbin

wind hedge
winter rose
#

your code fits in sqfbin yes

wind hedge
winter rose
#

wrong criterion
(wall of code = no place here)

sullen sigil
#

wall of french related emojis however...

quiet gazelle
#

what?

wind hedge
#

But allright

winter rose
wind hedge
#

Guys, I am doing a script that adds weapon inspection. I am just lacking animations for primary and secondary weapons. Anyone knows ones that work?

sullen sigil
#

probably best asking in a different channel -- but i think you may be needing gestures not animations

wind hedge
sullen sigil
#

then you may need to make ur own

wind hedge
trim tree
#

hi guys, I would like to know how to detect if an artillery piece has fired its cannon. Im guessing one would use the Fired EH? But im not sure on how to use it in this case, since it doesnt give me a simple true/false return (afaik) which im after.
My code currently looks like this:

_salve = 0;

while { _salve < 4} do {
    private _randomartpos = [[art_area],[]] call BIS_fnc_randomPos;
    art doArtilleryFire [_randomartpos, "rhs_mag_155mm_m795_28", 1];
    private _readystate =  (weaponstate m109) select 5;
    waitUntil {_readystate == -1};
    sleep 1;
    _salve = _salve + 1;
    hint str _salve
};

I would like to swap the waitUntil condition to something that turns true if the artillery has fired, because right now the gun takes so long to adjust that _salve reaches 4 before the first shot has been fired.

meager granite
#

Maybe you won't need an event handler here at all

trim tree
#

damn, I tried that initially but checked if the gunner of the artillery was ready and that didnt work. Turns out you need to check if the vehicle is ready. So it works now, the only thing that bothers me a bit is that after each round, the gunner "resets" the gun, or rather wants to put it into the neutral position where as I would like it if he kept it aiming high. Would you know how to achieve that?

meager granite
#

doWatch in general direction of the target?

#

Not sure how it messes with unitReady though

trim tree
#

ill try quickly

meager granite
#

Making AI do what you want it a huge PITA

#

Maybe do something like ```
art doTarget objNull;
art doWatch objNull;
art doWatch <direction-to-target-position-here>;

#

Not sure if this resets after firing or messes up unitReady, I suck at AIs

willow hound
#

Your doArtilleryFire statement only fires one round at a time. Try setting it to four rounds: art doArtilleryFire [_randomartpos, "rhs_mag_155mm_m795_28", 4]

trim tree
#

ok, tried this:

while { _salve < 4} do {
    private _randomartpos = [[art_area],[]] call BIS_fnc_randomPos;
    art doArtilleryFire [_randomartpos, "rhs_mag_155mm_m795_28", 1];
    art dowatch _randomartpos;
    waitUntil {sleep 0.2; unitReady m109};
    _salve = _salve + 1;
    hint str _salve;
};

he only stays on the azimuth to target but not on elevation

trim tree
#

because i want to cover a larger area and doing it the way you propose i only get the natural spread of the gun which isnt enough

meager granite
trim tree
#

hmm

#

is there no way to retrieve the current elevation and azimuth of the turret? Arent there indicators for this on some of the vanilla vehicle turret optics? They somehow must obtain that info from somewhere right?

meager granite
willow hound
#

It might be a little smoother (in terms of animations) using the EH, but I don't know for sure:

ArtyRounds = 0;
art addEventHandler ["Fired", {
  if (ArtyRounds < 4) then {
    art doArtilleryFire [[[art_area],[]] call BIS_fnc_randomPos, "rhs_mag_155mm_m795_28", 1];
    ArtyRounds = ArtyRounds + 1;
  } else {
    art removeEventHandler [_thisEvent, _thisEventHandler];
  };
}];

art doArtilleryFire [[[art_area],[]] call BIS_fnc_randomPos, "rhs_mag_155mm_m795_28", 1];
ArtyRounds = ArtyRounds + 1;
trim tree
#

what is the lower portion of the code for?

willow hound
#

Using the EH may have drawbacks in multiplayer though, because the Fired EH essentially only works where the vehicle is local.

trim tree
#

couldnt you remoteExec it somehow?

#

😄

trim tree
willow hound
trim tree
#

ah ok

willow hound
trim tree
#

only thing that needed changing was that the eventhandler needed to be placed on the vehicle itself

#

lets say i wanted to use that script on a larger multiplayer mission and use it somewhat frequently, would i be better of making it a function?

willow hound
#

Of course 🙂

trim tree
#

and if i included more than one artillery piece, would there be a more "elegant" way of doing so or would i be fine if i took what i have here and simply copied the eventhandler onto the other pieces?

trim tree
willow hound
trim tree
#

eventhandlers couldnt acces local variables that got defined in the same script file right?

meager granite
willow hound
#

An easy way to adjust the code would be using art setVariable ["OB_ArtyRounds", _artyRounds] (plus getVariable to get the current value).

trim tree
#

hmm, couldnt you simply define the variable inside the EH and instead of it counting to 4 you count till 3?

sullen sigil
#

no because itd define as 0 every time

willow hound
#

No, because all local variables from the EH scope are destroyed when the EH code is done.

sullen sigil
#

as well as that

trim tree
#

dammit

trim tree
south swan
#

"any random thing that can be used to link the variable to" blobdoggoshruggoogly

quiet gazelle
#

is there any good way to identify which object in 3den is which object when playing the mission without assigning variable names or attributes?

#

the only thing i can think of is to log classes and positions to an external file and compare them on mission start

#

or is there a way to somehow get an objects 3den ID while the mission is running?

winter rose
#

the proper answer to this is: what do you want to do

willow hound
# trim tree why exactly use art as the object here? I dont understand the *varspace* paramet...

The problem when using the original script with multiple units is that all units would be sharing (i.e. reading from and writing to) the same ArtyRounds variable from the missionNamespace (see https://community.bistudio.com/wiki/Namespace to learn more).
You can't have multiple variables with the same name in the same namespace, but every object has its own varspace (i.e. mini namespace), and it is possible to have several different variables with the same name in different namespaces.
We can take advantage of that by using art setVariable ["OB_ArtyRounds", _artyRounds], because now we can store a different OB_ArtyRounds variable on every unit.

quiet gazelle
# winter rose the proper answer to this is: what do you want to do

i want to initialize trenches with data about them that i have already saved to an external file (created on 3den save). which trench in the file is which in the mission is what i need to identify. in 3den and 3den preview i can use 3den IDs for that, if the mission is loaded without 3den i can't use 3den IDs afaik.
i don't want to give them variable names or other attributes because that shows up in 3den undo history.

winter rose
#

then grab getPosWorld + vectorDir + vectorUp, while not impossible a conflict is quite unlikely

quiet gazelle
#

ok

#

thanks

sullen sigil
#

if you need global variables w/ no conflict just use random large number but thats not the greatest of ideas

#

uuid function would be better

trim tree
#

so that means if i have have two more vehicles called art2 and art3 i would simply write art2 setVariable ["OB_ArtyRounds", _artyRounds];? or art3....

willow hound
# trim tree so that means if i have have two more vehicles called art2 and art3 i would simp...

Make it a function, just like you suggested earlier, then it's much easier:

params ["_artillery"];

_artillery addEventHandler ["Fired", {
  params ["_artillery"];
  private _firedRounds = _artillery getVariable ["OB_firedRounds", 0];
  if (_firedRounds < 4) then {
    _artillery doArtilleryFire [[[art_area], []] call BIS_fnc_randomPos, "rhs_mag_155mm_m795_28", 1];
    _artillery setVariable ["OB_firedRounds", _firedRounds + 1];
  } else {
    _artillery removeEventHandler [_thisEvent, _thisEventHandler];
  };
}];

_artillery doArtilleryFire [[[art_area], []] call BIS_fnc_randomPos, "rhs_mag_155mm_m795_28", 1];
_artillery setVariable ["OB_firedRounds", 1];
```That way you can just use `[Art1] call OB_fnc_artilleryFire`, `[Art2] call OB_fnc_artilleryFire`, ...
digital hollow
meager granite
#

yeah, less commands to run

#

Binary getDir wasn't a thing when I wrote that piece of script (2012 in OA or something)

digital hollow
#

when you had to code uphill both ways!

little raptor
quiet gazelle
#

i have a function that doesn't work. it just doesn't execute when i call it. there's no errors in the rpt, nothing.
if i comment out everything but line 1, it executes, so the problem must be somewhere in the code.
what should i be looking for to find the problem?
https://sqfbin.com/kurunumozelitawubari

quiet gazelle
#

how do i figure out what causes it to fail?

little raptor
#

it's most likely one of the macros

quiet gazelle
#

imma mess with those and check if it works

little raptor
#

see what it returns

#

I'm gonna guess it's either {} or just nothing

quiet gazelle
#

nope

little raptor
#

then it should execute

quiet gazelle
#

well it doesn't

#

that's why im so confused

little raptor
#

how do you execute it?

quiet gazelle
#

from the OnMissionPreview EH aswell as directly with call

#

neither does anything

#

[[], [], [], []] call ELD_magicTriangle_scripts_fnc_3DENMissionPreview;

trim tree
# willow hound Make it a function, just like you suggested earlier, then it's much easier: ```s...

ok i tinkered a bit with it and it works nicely so far. How would i go about being able to choose how many times the artillery fires through the call? I tried this but it obviously didnt work 😄

params ["_artillery","_fireGroups"];

_artillery addEventHandler ["Fired", {
  params ["_artillery"];
  private _firedRounds = _artillery getVariable ["FEC_firedRounds", 0];
  if (_firedRounds < _fireGroups) then {
    _artillery doArtilleryFire [[[art_area], []] call BIS_fnc_randomPos, "32Rnd_155mm_Mo_shells", 1];
    _artillery setVariable ["FEC_firedRounds", _firedRounds + 1];
  } else {
    _artillery removeEventHandler [_thisEvent, _thisEventHandler];
  };
}];

_artillery setVariable ["FEC_firedRounds", 1];
_artillery doArtilleryFire [[[art_area], []] call BIS_fnc_randomPos, "32Rnd_155mm_Mo_shells", 1];

[art_v, 3] call FEC_fnc_artilleryFire; is how i call that function where 3 is what I hoped what would be picked up by _fireGroups

quiet gazelle
little raptor