#arma3_scripting
1 messages · Page 221 of 1
can you DM me the model so I can check it?
is there a more reliable way of sleeping/waiting for the required amount of time for deleteVehicle to have cleaned up the local object before spawning again?
when you delete an object it only gets removed from the world. it only gets deleted in the next frame.
if you're sure that's the issue you can teleport it somewhere else before calling delete
I like that idea - I'll do this instead so as to not have to pass data to/from scheduled and unscheduled contexts
I'm working on a medical mod. No matter what I do, I keep getting this error. No images are displayed in game. Anyone know something?
How are you building the addon?
did you define a correct pbo prefix?
I'm using arma 3 tools
my pbo prefix is z\fmed\addons\circulation
but still same problem idk
actually nvm no need to send it. the code only returns the object in drop if it successfully preloads the model. if your model is too complex it won't get loaded immediately
so just use setParticleParams
THANKS! I'm about to lose my mind
Tested locally and working. Spawning also works on the dedicated server now which I suspect is primarily based on your advice regarding the ordering of things setVectorDirAndUp + setPosATL
Many thanks for your assistance
If you're using CBA's setup, you'd probably be better off using HEMTT to build
Yes I am. Thanks <3
Oh you just said you were using A3 tools earlier
Actually
I was working with hemtt and I don't really understand and I moved to a3 but
but rn I'll take a look
A3 tools UI is miserable unless you only have one PBO. You have to set the prefix manually in advanced there. And obviously you need a different prefix for each PBO.
A3 tools command line is workable once you have multiple PBOs, but then you need batch scripting to use it.
You only need to set the prefix if you want something other than the folder name
For the most basic setup you can just name your folder Prefix_whatever and not have to set anything manually
Is that what it uses by default? It's not documented anywhere as far as I know.
Yeah
Of course it'll have to be a unique folder name otherwise disasters will ensue.
I've used A3 Tools in the past but much preferred HEMTT. In fact, I preferred HEMTT so much that it's the reason I first became interested in the Rust programming language
HEMTT is probably just the easy option if you're using CBA-type specs.
But other things can work.
Hello! Is there a way to prevent a specific vehicle to get automated service from a service source? I thought it is allowService but I realized (after half a year) that this is only valid for service vehicles itself.
Probably no easy way.
If I wanted to do this, would a script that has players mount an invisible car seat and then assume team lead of a group involving them and the AI horse work for this? Would that allow them to give WASD controls to the horses?
Haven't dealt with the autoservice in a while, but could try
https://community.bistudio.com/wiki/setAmmoCargo
https://community.bistudio.com/wiki/setRepairCargo
https://community.bistudio.com/wiki/setFuelCargo
That's still on the service vehicle.
Best dumb idea I can think of is to use a hidden object between the vehicles to block the service actions.
might be difficult to implement without... consequences.
Hm. Maybe it's worth to open a FT for this. I probably can't be the only person who might needs something like this.
Ability to disable various vanilla actions is a routine request.
Pretty much everyone who ever modded A3 has asked for it at some point :P
Yep true. I've created a FT. Thanks!
@thin fox Sorry for ping, how do I implement IND side on your AAS?
I've been trying to make scripts to order a jet unit (A-164) to patrol and attack tanks and APCS for over 10 hours, and i'm stuck, the AI refuses to fire at targets, can anyone help me please?
this is my script:
https://pastebin.com/s9JNn42S
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
no luck with google, there are a few reports saying that they can't do the same thing, is it not possible to have jets provide ground support?
What kind of targets?
vehicles, e.g. BRT
If I'm within a function, and call another function on every element of an array using forEach, do those called functions get executed in-sequence, or are they simultaneous?
In other words, would it be appropriate to directly put a sleep command in the sub-function, or should I encase that within a spawn block?
You might need to make a script that forces the jet to target the things.
with doTarget? I tried that too, IT does accept it actually, but it just won't fire anything, no cannons, missiles etc
doFire or fireAtTarget
I tried DoFire too, it wildly shoots until the jet is out of ammo, have not tried the other one
is this even possible? can you have AI aircraft engage targets on ground?
It works for me, at least in my limited testing.
do you know which one is better, use of SAD waypoints or loiter?
Loiter makes the plane fly in a circle in the specified direction and distance. SAD lets the plane do what it wants.
If i use loiter, does it mean the plane will not have freedom to engage targets?
I think it will engage targets, but circling over the same place forever feels kind of weird.
and any ideas what combat mode and behavior i'm supposed to set it to?
I don't remember, but it shouldn't be hard 😬
Alright, thanks
if anyone else sees my message and can help me figure this out, i'd appreciate it
Combat and Open fire (don't keep formation)
IME the stock ground combat ability of AI jets is somewhere between useless and nearly useless.
you need some elaborate scripting to make them effective.
are there any mods that can help or have it already built?
Which event handler(s) should I use (if I even can) to detect when a missile has exploded/been deleted/no longer exists?
Fired EH gives you the missile and then you can either poll it with isNull/alive or use the projectile deleted EH.
Projectile deleted goes of with it explodes too?
Testing confirms.
I would assume so but feel free to check.
If not then you could hook Explode as well.
did i ever noted that writing OOS feels way better then SQF?
i think i did a few times
still trying to fix the AI not firing from an invisible car seat meant to replicate a saddle. They'll shoot from a newly placed car seat, but not one with any scripts acting on it. This is the current script for the trigger, the horse, and the car seat. Hoping someone can help me out
why are you using call?
it was just built into the original composition. i havent touched any of the scripts
besides the unneeded use of call, is this all the composition came with? notice that BROWNHORSE_1 is not the same as BROWNHORSE. setName does not set a variable name.
Composition is this one https://steamcommunity.com/sharedfiles/filedetails/?edit=true&id=2883709296 repeats for 3 horses
This strange call, appears on some of my older saves too. And im sure i didnt put them there
Yeah I'm just looking to optimize it and make it functional. It works fine but I feel like it can be streamlined a ton to make it work better
sorry for the jump in the past, did you manage to allow only side channel with SWT Marker?
I never tried to do side only, but limit side to people with long range radio only.
And that I managed, however broke single player, but should be simple enough fix I just never did
But if you want to allow side only, sounds to me like it's just gonna be one line added really
okay, not a big deal.
ya, for all, I was expecting the mod to check for disabled channels, but it does not.
No function found to disable channels in the mod.
So I am looking for "your line".
Failed to find any obvious settings, but did not browse entirely the code yet.
I'm not on PC right now
In Logic/sendMark.sqf there's a switch case that checks for channel. Just make it return if it isn't a side channel.
Oh you mean I have to repack the mod....
If I have to do so, I would take into account the disabled channels instead.
Well, you can just override the function with yours
true.
writing SQF is like unlearning C++
writing SQF is pretty much as annoying as writing assembly 😃
but its less entertaining
So iirc, "call can be used if you have no "sleep" in your script": and spawn is used if you do have "sleep" in your script
```sqf
[] spawn SFA_fnc_CacheHouse;
//or
[] call SFA_fnc_CacheHouse;
actually its the scheduled vs non-scheduled that determines if sleep can be used
spawn is always scheduled but call will continue in current "mode"
like could say that call doesnt change anything
call is "execute this code as if it is in-line with the current script". Doesn't matter if it's scheduled or not. Doesn't matter if sleep is used or not. The current thread will not continue until the called code is complete, and the result of the called code, if any, will be returned to the current thread when it's done.
spawn is "create a new scheduled thread". The current script will not wait for it, and the new thread will be scheduled. If you're currently in an unscheduled thread, and want to use sleep, you'll probably need to spawn a new scheduled thread where sleep is allowed, but if you're already in a scheduled thread, you don't necessarily need to. call may be appropriate if you want the current thread to wait for the other code.
Continuing on from my helicopter explosion woes from yesterday, even setting the position of the local vehicle wasn't enough to prevent explosions when testing locally (given I am the client and server, so the vehicle is "local" to both and thus colliding with the new object)
I've updated my code again to process all items in the build queue, fetching the position and vector dir/up and pushing those to an array, then marking the object for deletion. Since I'm using CBA anyway and the mission depends on it, I'm using CBA_fnc_execNextFrame to run a loop on the array of classnames and positional info before spawning the vehicles.
hello any idea
to hide a marker from blufor
for example i want to hide maker "alpha"
only for blufor side
nice @ NikkoJT: thx thats Awsome:
I'm using CBA_fnc_execNextFrame to run a loop on the array of classnames and positional info before spawning the vehicles.
If you're doing something like:
```sqf
{
[{...}, _x] call CBA_fnc_execNextFrame;
} forEach [...];
You're still spawning everything on the same frame, it's just all on the next frame
Which is fine in this case because all vehicles (created via createVehicleLocal should have been deleted by that point.
There are essentially two loops. One fetches all positional info and deletes the temporary objects first. The second loop, on the next frame, spawns new objects with the array of positional info
The code block would be the other way around to what you've posted. The loop within the delegate passed to execNextFrame
It just sounded like you were doing like how I had written it, so I was just letting you know that CBA's wait functions aren't blocking like scheduled stuff is in case you weren't aware
Yeah that was my main reason for invoking a subsequent loop in the next frame as I didn't want to spawn this script and then have to add more parameters to the script. I've actually gone a step further and have used execAfterNFrames to be doubly sure the objects no longer exist.
It'll be fine on a dedicated server even without this change whereas I test my changes in the Editor, where the issue remained
I am facing a weird issue about JIP: when people disconnect/reconnect, I have to teleport them to the spawn where they are supposed to be etc....
It works perfectly if I take a new slot. But if I take slot that I already taken... the processing goes crazy. Any idea or similar experience?
I am not using any variable set on the player for the teleport stuff... in all cases, variables are reset each time we connect right?
You've managed to write a lot of words without describing the problem.
The issue is the difference of processing if I take a new slot or not when I reconnect on the server. What can explain this? (there is no difference per class or whatever in the processing)
What's the difference though?
SetPos doesn't work
Diary record text content are doubled
Like it has been created before....
It is not a new unit.
Expected ?
I can't remember the setting but there is one what makes it such that AI takes over disconnecting player. So the old player object isn't deleted.
As for the double diary record that sounds like a global/local bug or too my JIP invocations on the queue.
code ran twice..
Okay, I have a lot of complex stuff, I replaced remoteExec by remoteExecCall for the TP and it works better
like there a lot of unscheduled stuff that slow down the processing
just forget.
tahnk you guys 😉
!quote 5
stop using 'setPos' for the love of god
Leopard20; Tuesday, 10 August 2021
lol ```sqf
//you can use
getPosATL or getPosASL or getPosASLW //and others too
Im scripting an aerial explosion but it seems the only solution is spawning a mine/explosive and setting its damage to 1.
While its cool and works pretty well, theres unintended ground effect appearing on the floor below even if its 5,000 meters in the air.
Are there any other methods of spawning an explosion besides creating a bunch of particles with a script?
Maybe try blowing up something that's expected to detonate in the air, like a SAM.
Ideally I wanted to spawn a rocket or something and make it blow up but I dont think I can set damage to projectile like that, so maybe I need to make a dummy object for the rocket to hit?
I tried SAM and cruise missile but they just kept flying away
triggerAmmo
Ah geeze thanks
Just wondering, what would be good to add to optimize this and fix it? Attachto works to a degree, but it's a bit clunky and I feel could be optimized further too
//you can use
bomb = "Bo_GBU12_LGB" createVehicle (getPosATL objectName);
@sly cape what: what's wrong with this
I don't see how it's relevant to what beluga was talking about.
replied to the wrong person
lol
oh shit
don't ping the other person, it wasn't really helpful for them either
You do "C" 😂
lol yeah lol 🙂
Anyone has experience with IFA3 tripods?
For example lafette tripod, when put on the ground, it converts into an object that can attach mg42.
Works fine in single player/self hosted.
Doesn't work on dedicated server.
I've tracked it down that Put/Take EHs dont get added to player, but function that adds them LIB_Weapons_Static_fnc_static_weapon_init is called.
Im trying to find out when its called to see if i can remedy this somehow.
Thanks I already got the code down, I just wanted to find alternative detonation methods. Which Im going to do later - just going to use a rocket instead of bomb/mine [things that spawn ground effect] and use the triggerAmmo for the airborn projectile instead
copy that m8
This is the code right now, its just a simple hit event and runs some code to "detonate payload" for a kamikze drone
I will change it to use the missile instead but you can see how I was doing it before
_drone addEventHandler ["Hit", {
params ["_drone", "_source", "_damage", "_instigator"];
if (_drone getVariable ["Detonated", false]) exitWith {};
_drone setVariable ["Detonated", true, true];
if (isObjectHidden _drone) exitWith {true};
[_drone, _instigator] spawn {
params ["_drone", "_instigator"];
private _ShahedPilot = (UAVControl _drone) select 0;
private _pos = getPosATL _drone;
private _alt = _pos # 2;
private _ammo = createVehicle [
"SatchelCharge_Remote_Ammo",
_pos,
[],
0,
"CAN_COLLIDE"
];
_ammo attachTo [_drone, [0, 0, 1]];
/* Delay explosion for cinematic effect if shot above 35 m - [unused atm]
if (_alt > 35) then {
sleep 3;
};
*/
_ammo setShotParents [_drone, _ShahedPilot];
_ammo setDamage 1;
{ deleteVehicle _x } forEach crew _drone;
deleteVehicle _drone;
};
true
}];
I think I will make it killed event instead. Any tips for better optimizing feel free to share
Originally this mod just only spawned a gbu bomb if it crashed below 5 meters which I felt needed to be changed since it led to a high fail rate
You can use sqf syntax highlighting in Discord, it'll look better
Don't think so
You could use createMarkerLocal and run in on every opfor player's machine
Is there a way to figure out which statement EH runs by its ID?
no
well, what's your setup actually :p
as in?
you have a number, and you want to know what EH type it is?
from the EH itself, there is _thisEventHandler magic variable
https://community.bistudio.com/wiki/Magic_Variables#thisEventHandler
from the outside, with just the number, you cannot do anything
i know what EH type it is, i either wanna know:
- From where it was added
- What it runs
So i can determine: - Is it safe to remove
ah
I don't think so
so god dang nam it
If it's yours then you can store the ID when you create it.
yeah its not mine, thanks anyway, dirty solution was deployed
uh oh
IFA3 would deserve some rewrite love tho
isnt is possible to have a marker at a certain height somehow?
why would you need a marker to have an altitude (because I don't think markers can) ?
because task system is broken;-( it only shows the 3d task icon over the whole map if a marker is used and i want to make a flight mission, where you have to pass checkpoints in the air. they are not visible in 3d out of 4km and so you cant navigate if you use objects for the task destination
i tried some task setting in description.ext with no luck, there you can change the drawDistance of the icons with no effect no more
afaik, you can set the destination using coordinates
so it's neither a marker or an object
np
don't know if it will override the 4km limit for 3d task icon tho
just checked, markers have a Z axis (height)
idk if it has any impact
nope had no impact
btw you can move a marker to any height you want: in the editor by: holding alt: and dragging it up or down: or by scripting as well i think
even under water
Is there a way to put extra parameters into an eventhandler? The circled params are part of HitPart by default - can I just tack these on to the end of the array?
I know those work, I'm reworking an old piece of code I had
you can't change the arguments that the event handler receives, but you can add a variable on the object and retrieve that once its called, e.g. ```sqf
_projectile setVariable ["MyTag_soundInfo", [_radius, _duration, _sound]];
// in the handler:
_projectile getVariable "MyTag_soundInfo" params ["_radius", "_duration", "_sound"];```
ugh that method again. Guess it'll have to do. At least it cleans up plenty
:)
@next kraken hay there's a chopper flight mission: in the Achievements missions part of Arma 3: maybe you can look in there to get some ideas: for what you need
where you must fly though way points like way up in the Air
they have thease markers up in the Air: looks cool: i forget the name of the mission
that is if i'm reading you right
What is the formula to calculate artillery elevation to reach a distance ?
Should be elevation = 0.5 * asin (9.807 * distance / (initSpeed * charge)^2)
For no drag (base game):
Theta 1 = low angle shot
Theta 2 = high angle shot
V = shot velocity
g = gravitational acceleration
X = horizontal distance
y = vertical difference
With drag (ACE mod), just use ACE's functions or their artillery table or https://github.com/balca-arma3ace/balca-arma3ace.github.io.
ah right, you can't get the high angle easily by reversing the elev -> range calc.
Another thing to note is that the base game artillery reticle says the elevation relative to your vehicle, not above the horizon.
Yes you can, if you run some code locally for each client, and do "alpha" setMarkerAlphaLocal 0 when the player side is blufor
what does charge stands for ?
How you calculate the initial shot velocity for artillery. initSpeed from the magazine * charge for the fire mode.
Usually the longest range fire mode has charge 1, but not always.
Oooooh i see now
ah I think for the high angle (proper one for mortars) you just do 0.5 * (180 - asin (9.807 * range / (initSpeed * charge)^2))
Indeed (assuming the first was correct)
works for 500m with the mk6 at least.
i'm not getting good results when i use thios formula with the M4 scorcher
i already tried this formula but it doesn't work in Arma 3
Sorry folks, I have the dreaded question regarding CBA events (PVEH, publicVariableClient/publicVariableServer/publicVariable) vs a custom pub-sub model that uses remoteExecCall to invoke a function which in turn executes each registered event handler for a given event (identical to how CBA does it, but with remoteExecCall instead of PVEH).
I have searched the Discord but many existing discussions (Discord search isn't great so the results have been limited, please feel free to point me at an existing discussion that answers this question if one exists) seem to focus around subjective preference.
Based on the implementation of both approaches, and assuming I'm not specifying code as a parameter, what would the performance benefit be around using remoteExecCall compared to PVEH + publicVariableServer/publicVariableClient?
- I doubt you will see a meaningful performance difference at all (in fact if you do subpar design based on multiple remoteExec where a single event would satisfy you might even be worse).
- RemoteExec has more control points to restrict or allow execution which may be of interest if you run on public servers that needs to protect against cheaters. With publicvariable all is routed through the same variable.
- Designwise, compared to events, running multiple remoteExec on commands in sequence may be less efficient, where-as in event based design you tend to naturally have more coarse handlers that take the minimal input to do multiple things. But if you invoke functions with remoteExec that difference disappears. (instead of remoteExec setPos and SetDir, you would usually only have a single event handler that does both)
- Not sure, but think CBA style events are less robust against bad handlers. Pretty sure they run in an unscheduled loop so a bad handler might take halt processing of remaining events for that frame.
Youd compare them to remoteExecCall. RemoteExec spawns scheduled
Very informative, thanks for that.
Regarding the points around remoteExecCall/remoteExec (it's actually the former that I'm using, good point by Marko).
remoteExecCall would be used solely to invoke the function (on a remote machine/server) that then loops around and invokes each handler for a given event. I think it'd be a single use of remoteExecCall since you can specify the targets for various operations such as server, remote or global. Local isn't necessary since any local events would simply invoke the handlers directly on the local machine. Emphasis on "think" because I can't imagine a scenario where I'd repeatedly call remoteExecCall unless I wrote the code with poor optimization.
Im trying to set up a scenario that once a trigger get activated, a couple of groups if enemies appear. Could I not just put “triggerActivated xx” under their presence condition?
Isn't "Condition of Presence" evaluated only at mission start?
No. But you can do completely without scripting.
Put down your units, uncheck "Show Model" and "Enable simulation" in their attributes (special states), plop down Show/Hide module, under its attributes select "Show".
Then place your trigger, and use "Sync" FROM show/hide TO each squad leaser and trigger
If you know how to use layers, you could put units in separate layer and Show/Hide that layer, instead of syncing to units
Idk im new to this.
Kill, thank you.
I was going to suggest using a trigger with "On Activated" but Marko's approach is much better
Word. Appreciate it gents.
How are you trying it?
forceWeaponFire doesnt seem to work with AIs. i tried ```
_thrower addMagazine "HandGrenade_stone";
_thrower forceWeaponFire ["HandGrenade_Stone","HandGrenade_Stone"];
The disclaimer applies to the version you have.
The version you have was built in 2025.
ooooo
What if you wait a few seconds after adding the magazine?
(3+)
that seem to work. i had same problem with player
grenade muzzles have a magazineReloadTime of 2.5 seconds in vanilla.
You add magazine, and then they have to load it.
Nothing obvious. There's no general instantaneous load-magazine-into-muzzle command as far as I know. You can do it with primary and secondary weapons with addPrimaryWeaponItem etc.
If you add a weapon to a unit then that normally forces an instant reload. Maybe that works with Throw...
similarly setUnitLoadout/getUnitLoadout combo.
ok maybe i can live with the delay because my script isnt supposed to be instant anyway
Comments on addWeaponItem suggest it might do it in 2.22
cool
I guess that means it doesn't work in 2.20 :P
Not in ARMA 2 it wasn't... Not sure its 3D Editor had any name other than 3D Editor 😉
Or I guess "The 'Hidden' 3D Editor"
The good old days. Now I'm feeling nostalgic enough to install Arma 2
There was a 3D editor in A2? What?
IIRC, it was available through a keybind on the main menu. It was experimental and very buggy
CTRL-E in the ARMA 2 main menu
Maybe im blind, but is there a command to interpolate one object to another? Bascially moving object a through the world smoothly to object b?
I'm using it like this ```fnc_calcFireAngle = {
params ["_x", "_y", "_v"];
private _g = 9.807;
if (_x <= 0) exitWith {[]};
private _v2 = _v * _v;
private _v4 = _v2 * _v2;
private _discriminant = _v4 - _g * (_g * _x * _x + 2 * _y * _v2);
// Pas de solution balistique
if (_discriminant < 0) exitWith {[]};
private _sqrt = sqrt _discriminant;
private _denom = _g * _x;
private _angleLow = (atan ((_v2 - _sqrt) / _denom)) / 2;
private _angleHigh = (atan ((_v2 + _sqrt) / _denom)) / 2;
[_angleLow, _angleHigh]
};```
_x is one of the magic variables and as such shouldn't be used for your own variables
Same with _y, at least within the context of the newer hashmaps
How are you testing if it´s the right angle? Or are you getting an error or nonsense answer?
well, i'm not getting an error, i'm getting a result but it doesn't match with the ballistic of the M4 Scorcher
What do you mean "doesn't match with the ballistic"?
I get in the gunner, turret, i shot and i look where the projectile falls
Is the Scorcher on perfectly level terrain (e.g. VR world)?
yes
Why is there a / 2 at the end of the script?
Where is the /2 ?
i don't see any /2 in your picture
exactly...
Why is it in the script then?
What? Look at my profile 😂
wrong channel sorry
Indeed the /2 is an error but even without it, the formula is still invalid
What answer does it give for 4000 meter distance, 10 meter elevation, and 200 m/s velocity?
[19.9063,25.1654]
When I plugged into the formula I sent, it said 50 degrees for high elevation, which is correct, IIRC.
Math commands should 100% work. Something must be wrong with your script.
yes but Arma 3 has wind affecting the bullet, there is airfriction and other parameters that doesn't exists in real life
A3 has no air resistance for artillery rounds and no wind at all.
I get 50.33 degress for high angle (though I didn't bother start Arma, but in Python)
Using Sticky Joes calculation (the same from wikipedia)
Your numbers were also halved
I didn't try with the mortar, it might work, but M4 scorcher needs a different formula
Fix (remove) the / 2 and it will work.
The shell falls too far, it will not work if i remove the /2 ...
Just remove that / 2. You might have the wrong velocity.
So my shell falls too far but you say with an angle twice bigger it will fall at the right location ?
If everything else is right, yes.
Well, it doesn't work
What parameters are you giving it and what is the result?
I already tried this formula in the past and i couldn't have it working in any case
try it by yourself you'll see
What parameters are you giving it and what is the result?
[4000,0,450*0.3] call fnc_calcFireAngle gives no result which is an aberration
That velocity is too slow to reach that far. You need around 200 m/s.
this is the velocity of the heat shell and the artillerycharge for semi (medium)
HEAT shell? I don't think it has one, and it's maximum velocity should be more than 450 m/s for the M4 Scorcher.
how do you get it btw?
The M4 Scorcher's initSpeed should be around 810.
I don't know, but I think medium's artilleryCharge is 0.3.
153.92m/s for scorcher in vanilla on semi (close) for normal HE
measured by
veh addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
systemChat format ["SPEED: %1", vectorMagnitude velocity _projectile];
}];
My bad semi (medium) is 243.101
Exactly, i don't know where i picked up this 450 in my mind but i just checked the config and indeed, the initSpeed of 155 mags is 810
I just made a test with this ```fnc_calcFireAngle = {
params ["_x", "_y", "_v"];
private _g = 9.807;
if (_x <= 0) exitWith {[]};
private _v2 = _v * _v;
private _v4 = _v2 * _v2;
private _discriminant = _v4 - _g * (_g * _x * _x + 2 * _y * _v2);
// Pas de solution balistique
if (_discriminant < 0) exitWith {[]};
private _sqrt = sqrt _discriminant;
private _denom = _g * _x;
private _angleLow = (atan ((_v2 - _sqrt) / _denom));
private _angleHigh = (atan ((_v2 + _sqrt) / _denom));
[_angleLow, _angleHigh]
};using[4000,0,810*0.3] call fnc_calcFireAngleand the result is[20.8155,69.1845]``` I made a shot and the shell falls at 4.2km which is not bad but a little imprecise
from some magic world i guess, it was a mistake ^^
Don't know if this matter but ACE has this note in their system: //DEFAULT_AIR_FRICTION == -0.00006. So maybe there is a small difference.
Also pretty sure Arma only simulates like 50 steps a second, so it takes a "linear-segmented" curve and not a perfect one.
Is there a limit on the amount of data (message size) that can be sent via remoteExec/remoteExecCall?
I had a function which was dispatching to the server via remoteExecCall in a loop, but figure it'll actually be better to batch everything up and send it in a single call instead
how can I find a string within an array of arrays? Basically I want to check if "@modname" is in the getLoadedModsInfo's results.
you could do recursive search function, which if it finds an array, it calls itself again to search within it
i think it would be troublesome since the mod might be either a workshop one or local, and some of the values within the array would change
tostring the whole deal then?
But waitgetLoadedModsInfo and you know the mod name or?
{
if ((_x # 0) == "modname") then ...
} foEach getLoadedModsInfo;
If you don't care where in getLoadedModsInfo the string is, you should be able to do "@modname" in flatten getLoadedModsInfo.
is there a way to force AI using lasers when NOT in combat mode but aware or safe?
Consider checking cfgPatches in that case?
I am using hitPart projectile EH and I cant seem to figure out how to check if _hitEntity is in a vehicle
_isOnFoot = isNull (objectParent _hitEntity)
I have seen ACRE send 16MB in one lump. There's probably no defined limit, as an array or hashmap can be... very large.
Is it possible to get their vehicle though? When I do vehicle _hitEntity nothing comes back
Like, if I shoot a tank.. the hitEntity is returning the person driving it
That's how it will look when you turn a vehicle into a string, try doing typeOf
[Kim Jong Trump's] Projectile hit: [B Alpha 1-3:2 (On foot.)([])(a3\data_f\penetration\armour_plate_80mm.bisurf)] at [[6389.9,7356.77,6.03933]]"
player addEventHandler ["FiredMan", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
private _weaponName = getText (configFile >> "CfgWeapons" >> _weapon >> "displayName");
[(format ["(Shot Logs 1) %1 fired a %2 (%3) from (%4)", name _unit, _weaponName, _ammo, position _unit])] remoteExec ["diag_log", 2];
if (!isNull _projectile) then {
_projectile addEventHandler ["HitPart", {
params ["_projectile", "_hitEntity", "_projectileOwner", "_pos", "_velocity", "_normal", "_components", "_radius", "_surfaceType", "_instigator"];
private _vehType = if (isPlayer _hitEntity) then {vehicle _hitEntity} else {"On foot."};
[(format ["(Shot Logs 2) - [%3's] Projectile hit: [%1 (%6)(%4)(%5)] at [%2]", _hitEntity, _pos, name _instigator, _components, _surfaceType, _vehType])] remoteExec ["diag_log", 2];
}];
};
}];``` messy rn cause Im building it but yeah
Yes, objectParent returns the vehicle or objNull
Well there's no chance I'll be reaching 16MB 😂
Out of interest, what tool did you use to observe the size of the ACRE request?
private _vehType = if (isPlayer _hitEntity) then {objectParent _hitEntity} else {"On foot."};
Like this? Its still only returning null and going to "on foot"
Returns the same
Dedmen's ArmaScriptProfiler. Don't remember what command line parameters we needed for the network transmissions though.
You're checking if the thing is a player
Just log the typeOf _hitEntity and see
Its returning the unit commanding it as the hitentity
ooo I see
We're not allowed to use it again because we took advantage of a hosting service exploit to sneak the parameters in there :D
@snow pecan & @timid zealot Either way works
I suppose having a log for every shot fired may have an impact on performance, right?
Granted it is only applied to players
Log to server or log to client?
to server
So I have some BOOLs that are defined via module attributes - this works fine when placed in 3DEN, however, since Zeus spawned modules don't seem to like setting up these attributes, I've implemented a default value that looks up what's in the config. I've done this method before on numbers, but this one's a bool, so I can't seem to figure out a good way to get the data, as there's only getText, getNumber, getArray, etc.
Normally, this debugging hint just says truefalse or falsetrue and works peroperly, but when spawned in Zeus, it doesn't seem to be able to convert them to strings. I've tried double quotes, but that broke syntax. For single-double quotes, I've tried both what's shown and the inversion, and it just doesn't replace the string with teh BOOL equivalent. There any other way I can get a BOOL out of the config and into this code?
yeah ik these are screenshots, jsut very tired
getText returns a string. You would need to manually convert it to a bool.
I guess call compile would work, if kinda daft.
getNumber (...) == 1
Don't use strings for a boolean
Actually real life artillery have 200m imprecision, that's what i get in game so its good. for better result, artillery computer is required
I'm trying to think of a decent-ish number of like easy-hard (relatively) ideas to teach people basic scripting stuff.
I've had a couple people ask me over time so I think it'd be nice to have things they can try to make and then have potential solutions. Maybe something akin to leetcode.
I've got a couple in mind for the harder ones, like maybe fired -> hitpart event handlers to do X thing when a person shoots, or maybe learning some basic networking. Has anyone got some relatively basic ish problems they can think of? Ideally something thing harder than just "Display a hint", probably around the 5-30 lines of code range
That'd be great I think! I would also definitely explain the fundamentals of how SQF works as a script language (like the unary-binary-ternary stuff as the backbone of the language etc. etc.) and in general, answering to "why" something works as it works every time you introduce a new thing/concept/feature to the reader.
Also strong recommendation to https://ghost.org as a platform. It's free to use, quick as lightning and you can add syntax highlighting for SQF too. It runs well on pretty much any cheap VPS. Although if you want to send newsletters to subscribers, I'd consider also their managed hosting since everything just works out of the box and there's no need to go through MailChimp configuration (heard it's quite painful process to get it working properly) or such things
Does sendAUMessage really serve any purpose?
Uhh, last time i messed with it, it didnt really work. But that was years ago. Also i recall wiki stating it was broken (might be wrong). But now it states no such thing
Looking at wiki history, it never said it was broken
But i dont see it used anywhere, probably for a reason
hello all: so im trying to get my chopper Helo2 to wait:
till all players within 300m are in the chopper
and i want the chopper to check if the players or player isOnFoot or in a Vehicle:
so the chopper waits for them
i'm not sure how to do this
cus when the player is in a vehicle the chopper takes off:
i want to be able to drive up to the chopper with any vehicle:
and jump out and get in the chopper
Smthing like ({alive _x} count allPlayers) == ({alive _x} count crew Helo2)
hmmmm looks good i'll try it
You might wanna use https://community.bistudio.com/wiki/BIS_fnc_listPlayers
Instead of allPlayers, since allPlayers include headless clients, curators etc
See wiki, it shows all that is returned.
copy that
Yes, hence alive check
https://community.bistudio.com/wiki/allPlayers returns more tho
((allPlayers - (entities "VirtualMan_F")) findIf {
(alive _x) and { (_x distance Helo2) < 300 } and { !(_x in Helo2) }
}) < 0
Thats how module attributes have to be configured though? I referenced BI modules when making mine
And it seems they have something special going on since I had to manually specify a data type of bool.
oh cool
holy cow @faint burrow that looks Awsome
woohoo works Awsome @faint burrow you da man: thx so much
Just use 0 and 1 and do the conversion in the scripts
But wouldnt that make the module attribute not work right otherwise? I dont want to make 3den-placed modules not work right just for this. Ill try that compile thing firat though after work
wow that would be Awsome m8
Will close Eden, go back to mainmenu, and relaunch Eden, and load the said scenario
Why the re-launch? Why not just reload the mission?
See Killzone kid's server switch script. That used some exploits to smuggle a script from a server mission, into the main menu.
That doesn't work anymore for multiplayer, but the same approach might still work for Eden, and get you the ability to exit from Eden, and execute scripts in main menu
Well, main blocker is about editing Eden itself. AKA diag_mergeConfigFile, sometimes my changes in Eden does not apply until I relaunch it
(And sometimes does apply even if I don't)
The HEMTT author is writing and using it on linux.
Yes afaik it also has syntax highlighting.
Yes but its complicated to say how much.
The allocators for variables can only handle 2 or 3gb. And that is per type.
That is alot of values, but not unlimited 😄
There is no safezone for ui textures.
You can always make your own safezone. Like leave 0.1 space at every edge.
That is such a niche usecase, and I have not heard of anyone else having attempted that.
I guess mine gets somewhat close to it, on mission save it does a git commit to a local repository (to keep history and backup of all mission changes)
If you need help with coding you could ask in #arma3_tools (That's where all the "real" programmers hang around :D)
Its a leftover from a hotfix that CBA mod used to apply.
It was a workaround for a Since Arma 2 engine bug, where your editor scripts could not have a return value.
That's also where the 0 = [] spawn {... came from.
I fixed that bug years ago, CBA removed their hackfix, but that left the visible call{} wrapper behind in old missions and compositions that were built while CBA mod was loaded.

remoteExec has the benefit that you get remoteExecutedOwner. Meaning you know who sent the message to you.
PVEH doesn't have that.
This also allows you to directly send a reply back.
You can send the sender ID in a PVEH too, it will be slightly less efficient (script value, vs engine native), and you loose the security guarantees because anyone could send whatever.
remoteExec has slightly higher overhead, because the server does safety checks before sending it onwards.
remoteExec will likely use more network traffic for you, mostly because your function name will be longer than a PVEH (where CBA uses "CBAs" as the variable name, very short). Which I don't think matters.
CBA global event does "publicVariable" which has a problem, it will be inserted into the server's JIP queue. Which you won't want for one-time executions. The *Server/*Client direct variants don't do that, but also don't allow you to send something to everyone.
You said pub/sub. So I assume you often want to send something to multiple recipients. There remoteExec would be better, because you can set a list of multiple recipients, and the engine will handle that in a single message.
Where for pubVar you'd need to send multiple messages
For your purposes, likely not.
I've sent megabytes through it with no issue (besides some game lag due to the encoding being on the main thread and freezing the game)
I don't remember if I actually optimized it..
Sending one long string should be much better, than sending many values. toJSON might be useful there, though the JSON conversion of course also has overhead, which might not be worth it
Mh the string encoding is already well optimized.
Maybe it was the network encryption, or splitting of network messages that was the problem. I don't remember.
I ended up implementing a secondary communications channel for large data via an extension to get around the problem.
Afaik network profiling currently doesn't work, and I have no plans to fix it because it'd take too much time (probably like a day)
Alternative is to add [] and use parseSimpleArray. Definitely safer than compile, not sure if faster.
That is a great comparison between both approaches, thank you. I thought the same with regards to JIP too as many of my events are one-time occurrences and don't need to be JIP'd
You're correct regarding the pub/sub, though I don't send to a specific list of recipients at this point. It's local (script executed directly), global or server dispatch. My implementation is very basic and designed to be identical to CBA's for the sake of backwards compatibility. I've implemented it purely out of curiosity to play around with some of the newer APIs since my last time with Arma
my_localEvent loops through the registered event handlers which are stored using the newer HashMaps. All other triggers (serverEvent, ownerEvent, targetEvent) simply [<event>, <params>] remoteExecCall["my_localEvent", <target>] to trigger the my_localEvent script.
For the sake of completion, this is the localEvent script https://github.com/ColinM9991/KP-Liberation/blob/event-system-remoteexec/Missionframework/events/fn_localEvent.sqf
And this is an example of how remoteExecCall is used https://github.com/ColinM9991/KP-Liberation/blob/event-system-remoteexec/Missionframework/events/fn_serverEvent.sqf
I'm sharing this just because I know when people hear remoteExec and events together, they think remoteExec is used to trigger each event. At least that's my assumption from previous messages I've read about the two approaches
Most people who want to script but cannot, are mission makers that want to do something that a simple trigger cannot accomplish.
Stuff like "If this thing explodes, complete a task". Usually solved by a trigger checking alive every 0.5 seconds. Really should be a eventhandler though.
Or a "When player picks up this item"
I think a "remoteExec send a request, and receive a reply back" is a thing that is commonly useful, but basically no-one does it. You need to handle networking and asynchronicity of the result.
Yeah the gap from this "small problem can easily be solved", to "this solution to a slightly more complex problem for some reason works in SP but breaks in MP" but actually requires rather deep knowldge of how the game works and JIP state is very tiny.
Its also very hard to teach.
Last mission our mission maker got very upset that his say3D was not audible globally, even though he tested it while playing on the server.
Yeah say3D has local effect, it was only audible on the player using the action.
But then playSound3D, which is basically the same thing, has global effect.
The mission before we had huge lag problems, because a thing was spawned on every players PC, globally, so it was duplicated many times.
You have addAction and holdAction, which only execute locally.
Then you have triggers, which sometimes execute globally.
You can't really teach this besides "read the wiki" for every command you use
Was writing up code for an April Fools and made the near same exact mistake- I learned that day that drinking and committing does not go hand in hand very well 😄
Was creating invisible global objects on every client 🥲 haha
One thing is knowing how the parts interact, local/global argument vs effect, triggers, initlines, JIP, setVariable with broadcast etc. The second problem then to use them you have to be do reason about distributed concurrent systems which is another hurdle for many.
Many people have no problem learning how to make configs: the config is declarative just tells what the engine has to make happen. But as you as the code you write runs the ground is shifting beneath them. So yeah, learning to use SQF is basically same as learn to program (networked applications).
Or more simply: you can tell someone new to SQF that init lines run for all machines and JIP players, and they might understand why they are having their problem. But the leap to truly understand the implications and then the solutions is a much greater hurdle for many,.
I need help with a scale vehicle representation issue. I'm spawning and scaling down vehicles, and I've configured all the synchronization - it works, but there's a problem:
In single-player, all vehicles scale relative to the bottom of the model:
Example: I spawn on the ground, and after scaling down, the vehicle still stands on the ground, just smaller.
However, in multiplayer, SOME vehicles scale relative to the model's center, which causes them to float in the air.
Example: A vehicle is 2 meters tall, I spawn it on the ground and scale it down, but it floats a meter above the ground.
For the game engine, it's positioned on the ground - all checks pass with height 0, but visually it's floating in the air and I don't know how to fix this.
- I cannot use simple objects because some vehicles contain visual effects that appear on vehicles with this type of spawn, and in my case this is critical.
"I cannot use simple objects"
Scaling is only supported for simple or attached objects
So yours are attached then? Attach afaik is always center of vehicle
Yes, I attach it to another object and reduce it, this works, the technique is reduced. But yes, I just noticed that only some mod techniques are scaled at the bottom, while vanilla techniques just float in the air. Is there any way to compensate for this, because for the engine it is still on the ground and returns a height of 0?
What specifically returns a height of 0?
getPosWorld? Surely not because that returns center of object
Calculate the height manually by yourself.
By getting center position, the land contact points via selectionPosition.
And calculating yourself where the bottom is.
If its floating, then apply it as offset to attachTo to move it down appropriately
Is it possible to disable certain visual effects on simple objects? One of the mod's techniques has shooting effects, and they are visible when you create a simple object.
The muzzle flash. Afaik no
isn't it hide selection "zasleh"?
Can you hide selections on a simple object tho?
Well animation is supported?
I believe so yes
holy shit that's some nice reading Awsome i love it
Is there supposed to be any better gui editor than the thing we have rn? not many controls on there... I wonder if there's any better way to import my design into the game without the hassle of aligning everything and such, activetext isn't even defined idk why
X39 once made a external GUI editor.
But I think it was never really finished
I'll take a look at that, thanks
https://github.com/ArmA-Studio/Arma.Studio/issues/75
No updates in 6 years. X39's website is also gone now.
It was probably not finished to the point of being actually usable
Gotcha, thanks
Is CT_SHORTCUTBUTTON coded in such a way that it won't count the transparent parts of the image as the button itself?
Imagine having a 200x200px button in a 1024x1024px image, all transparent except the proper 200px area of the button, I guess the area surrounding it wont be clickable right?
Thinking of that, it would make rounded buttons very hard to replicate
#arma3_gui would know more about gui
There is also https://github.com/kayler-renslow/arma-dialog-creator which was updated 5 months ago? But says its no longer maintained? but maybe?
I don't think I'll make my own native GUI's anymore.
I'll just do it all in html
HTML can make you a good code obfuscation too
The deal is, only way to send it back is EH I think so it's kinda pointless
HTML UIs are soo great but I am scared of scaling it up
ppeffect on UI elements would be really great, just saying!
Why tho. Doesn't matter to me
Click in native UI executes script.
Click in Web UI executes script. Whatever
Nah I was just saying because virtualized JS is a pain in the ass to analyze
Whats really great though is WASM
It may have benefits compared to SQF, like math, encryption algos and all that
you can get all the controls in UI editor, it just needs to be setup properly
like you type which control you have in the class field, like MyText : RscText
That's facts
Just tried it now, thanks
But I guess the game doesn't treat it like it were that control
No, looks like something wrong w/ 23:51:45 Error in expression < distance civ_shop_licences) < 3 ']);
wow that's way above my pay grade 🙂
your call is returning an invalid number
Hay everyone: i want to take the time to thank everyone who helped me in Scripting: to many to name: im having so much fun in Arma 3: its off the hook Woohoo: love you guys
i must be the happyest guy in the world 🙂 thanks again m8's
post the addaction
You don't actually need to change the config. getNumber will translate "TRUE" and "FALSE" to 1 and 0 for some reason.
@agile pumice
I guess this is the reason :P
And yeah, module attribute default values are required/expected to be expressions that return appropriate values, so you shouldn't change the config.
lol
who invented math anyway🤔
a math teacher
idk who but he shouldnt have made it so hard
i remember my math teacher she was so beautiful: i didn't learn anything: 🙂
EDIT: Error was a few lines above where the condition from a previous action had an error.
Whoever made it must be very intelligent
ya
Is scripting now banned or what?
Anyone could explain?
I have not touched the game for a year
I would like to get back to it
What are you talking about (genuine question)? I have no idea what you mean because scripting is how all (for the most part) missions and mods are made.
pub zeus
There are specific servers where you can place compositions that run scripts.
Scripting has been outlawed worldwide. Anybody caught scripting will be "dealt with"
so please, join the Resistance 😉
remoteExec [{playSound "Whisper1"; 0 cutRsc ["RscNoise", "PLAIN"]; sleep 5; 0 cutFadeOut 1;}, ALLFATHER];
Can anybody explain to me what exactly I am doing wrong here?
I am trying to make an overlay of noise appear on a specific players screen, their variable name set to "ALLFATHER". Whilst also playing a sound only they can hear.
just about everything, suggest you look at examples, and compare them to yours
https://community.bistudio.com/wiki/remoteExec
ahhh so
[{playSound "Whisper1";0 cutRsc ["RscNoise", "PLAIN"]; sleep 5; 0 cutFadeOut 2; }] remoteExec ["BIS_fnc_spawn", ALLFATHER, true];
BIS_fnc_spawn is obsolete and you can just use call instead there.
Not sure if you intend your server to be public but if so I wouldn't allow BIS_fnc_spawn, spawn, call or any other command/function that would allow someone to remotely execute arbitrary code. Obviously if you're intending to play with just friends with a password this is irrelevant but here is some more documentation if it interests you 
Yep - that's usually how it works with arma errors xD
Is there a way to change how an object is seen through thermals via script?
Not vehicles but specifically a building, rock, or something placed via editor that is really highlighted when looking through thermals
not sure what you mean but check out these commands https://community.bistudio.com/wiki/currentVisionMode https://community.bistudio.com/wiki/setOpticsMode https://community.bistudio.com/wiki/setCamUseTI
So you know how when objects are hot they "glow" / "radiate" when in thermal vision?
I am trying to remove this "glow" or "heat" so they blend in with the background
ok ic
Baiscally, trying to hide some of those trenches so objects they are not as easily detectable with thermals
maybe something can be done via config idk
Yea if it has to be done via config that'd be rough
true
i think the devs made some changes to thermals in profiler branch
Thats too unrealistic to be believable.
Just say its been outlawed in the US and people will actually go "woah really?"
No
Its based on the textures. You could change the texture I guess.. but that'd be visible.. unless you only do it when the user has thermals enabled.
And dealing with objects that may not let their textures be replaced..
Basically no
Damn, welp I tried :(
Off to options 2, fuck the pilots, they get no thermals xD
You could make the thermals shittier, if that helps
https://community.bistudio.com/wiki/setTIParameter
limit resolution, limit the range
I'll mess around with it, we do use A3TI so it makes it redundant but maybe I can get rid of it and do that.
THanks a lot, didn't know about this command
Correction, it is not.
Fixing for 2.22. But its unlikely to have an impact unless the strings you're sending are approaching a megabyte.
Both on the sending, and on the receiving side, it would scan over the whole string multiple times, just to get its length.
publicVariable and setVariable do the same tho
Does someone know about a way to force AI not to engage certain types? (like forcing it not to engage Air targets)
I tried using the EnemyDetected EVH and forgetTarget but they still fire at everything
yeah that could work.
is there an equivalent to onUserDisconnected/HandleDisconnect for local machines?
Wiki suggests this method but seems a bit exepensive just for the sake of checking if a player disconnects to perform actions on the machines
OH
wait i missunderstood, dont code while doing other stuff kids
What is the predicted impact marking system called?
Like when you use targeting cam with a bomb loaded, it shows you the predicted impact point
In real life it's CCIP (Continuously Calculated/Computed Impact Point). The game might call it the same thing.
I think it's part of the engine-controlled HUD and not scripted, though.
For bombs there's also CCRP (Continuously Calculated/Computed Release Point) which shows when you should drop the bomb to get it on target, but I don't remember if that's supported in Arma
It is
Yes this is what I am referring to exactly 👍
I am wondering if anyone has any ideas where this UI is set up or defined
This is kinda niche but im curious if anyone may know how to help. Im not too familiar with arma scripting but I am trying to find the class name for the FPV drones in the "FPV Drone Crocus" mod so I can add them to the list of jammable drones in the "Crows Electronic Warfare" mod. Ive tried adding values that I found in the classname editor but nothing seems to work. Is there a way I can find the specific class name for those drones?
Super easy
but you need to make sure you are listing them in an array format.
To get the classnames just plop them down in editor and right click and copy the classes
Post your code for the jammer here, or at least the list of drones to jam
"B_Crocus_AP","B_Crocus_AT","O_Crocus_AP","O_Crocus_AT","I_Crocus_AP","I_Crocus_AT"
UGV_01_base_F,UGV_02_Base_F,UAV_01_base_F,UAV_02_base_F,UAV_03_base_F,UAV_04_base_F,UAV_05_Base_F,UAV_06_base_F, Is what's in there by default, adding O_Crocus_AP, for example doesn't seem to work. I know for a fact default drones work.
Is it a script or a mod
Do not put a comma after the last one
Also post the full array, as you see it. If this is exactly whats there, you dont have quotes around any of your classes. So it will break the code
"drone","drone2","drone3"
And those are all UAV base classes, unless you are using "typeOf" youre never going to jam any drones because IIRC base classes arent ever used. You need to list the exact class of the specific drone you want jammed
Go into the editor, put down every drone you want to jam - and select them all by dragging your mouse over all of them and selecting them, then right click and press "log" and click "copy classes to clipboard"
Strangely enough thats how it came with the mod, I never edited anything like that but Ive had no problem with those drones being jammed
The only ones that wont work are the Crocus drones
Ah okay so its a mod with pause menu settings. I didnt know if you made a custom array for it yourself.
I will check it out real quick
Yeah my bad I probably should've mentioned that lol
Its fine. Makes your life easier
I see what you mean now
You have to restart the mission after you put the new drone in the list. Im sure you already tried that though
Clear your list and then copy and paste this one there
B_Crocus_AP,B_Crocus_AT,O_Crocus_AP,O_Crocus_AT,I_Crocus_AP,I_Crocus_AT,UGV_01_base_F,UGV_02_Base_F,UAV_01_base_F,UAV_02_base_F,UAV_03_base_F,UAV_04_base_F,UAV_05_Base_F,UAV_06_base_F
click ok, and then restart mission
Thank you so much It worked you are a magician! Out of curiosity how come adding the values at the beginning of the list worked but not at the end?
order doesnt matter, I just pasted them there. You likely just had a small typo
With arma 3 scripting, or scripting in general, one small mistake will make the whole thing not work. In this case, this "setting" is a continuation of a script in the mod, and it checks this "settings list" - therefor any typo would cause it to have no effect
Thats interesting, ive been trying to learn more about arma scripting because ive been playing it for half a decade and never once touched scripting
Thanks a lot for your help
It can become addicting once you learn lol. I have only been playing arma since 2021 and started learning scripting in late 2022
Just if you do decide to try and learn, dont use ChatGPT..
if you try to learn Arma 3 scripting just think you will never run out of stuff to Do 🙂
i love it 🙂
You will, because Arma will break your dreams at one point, because your whole idea will fail because of a simple missing command or bug 🫣 😆
my dreams have always worked out cuz of the guys that help me lots 🙂
in this channel
odd one and more curiosity - i have role selector set up so players dont need zeus to give out - is there a way to public display (in chat) when a player grabs a role and what role they grabbed ??
only ask for the example of a player not medically trained grabbing med perms etc
Anyone know how to make enemies spawn in instead of being a constant presence?
Say I want a group of enemies on a map to only be present when you have activated an objective for example
There's dynamic simulation, mods and scripts like ALIVE, spawning in units with scripts, etc.
Yeah ive used the dynamic simulation, what I want is to have enemies spawn in only once you have activated an objective or met certain conditions so they are not constantly present on the map
- Hide them and show them using hideObject (hideObjectGlobal)
- Create them using createUnit etc
I'd prefer first
Could you give me an example of how to do that? Just a sec
Like for these forest tanks. Do I create trigger volume they are inside and have a script?
I have the trigger volume set up to activate their waypoints for example already set up. Should I use that for their spawn in script?
{_x hideObjectGlobal false; _x enableSimulationGlobal true;} forEach units groupWhateverYouWantToUnhide```
What are you trying to do? If you're going to use the init, I think you should use the object init and use this instead of _x.
Right so I want the enemy tanks to only appear once the player unit enters the trigger volume.
I don't know why you removed forEach
I dont understand the script since ive never used it before
It enables simulation for every object in the array groupWhateverYouWantToUnhide.
So if I put this in the trigger thats activated by the player once they are inside, this script will then spawn in the tanks?
If you replace groupWhateverYouWantToUnhide with an array containing the things you want to enable simulation for.
Soooo that? If it would be better I can pop into creativity and stream lol might understand better that way.
Small correction. Updated
Condition is not where you put it, On Activation it is
What's TAKITANK1?
TAKITANK1 is the variable name of the tanks group
So I assume thats what I put in the script
Do the two corrections #arma3_scripting message if you haven't.
Alrighty
Hopefully thats right lol
I have 3 groups of tanks. So if I wanted to add all three to this script would it be {_x hideObjectGlobal false; _x enableSimulationGlobal true;} forEach units TAKITANK1, TAKITANK2, TAKITANK3;
forEach ((units TAKITANK1) + (units TAKITANK2) + (units TAKITANK3))
Okie dokie
Let me see if this works and ill get back to yee
Hmm still seem to be visible. Will check if I wrote anything wrong
Did you ever disable simulation?
Do I have to do that to the units?
Yes, in properties.
And dynamicsimulation?
I don't think you need that if you're disabling and enabling normal simulation.
If you want to hide them all, hide them all
Unless units returns the vehicles, I don't think they're ever being unhidden.
alright
{_x hideObjectGlobal false; _x enableSimulationGlobal true;} foreach ((units TAKITANK1) + (units TAKITANK2) + (units TAKITANK3));
That look alright to you?
If they are group variables, yes
Okie, and ive just disabled simulation on the Vehicles and their occupants
using EOS_1_98 or EOS 1.98 would help you see a nice way to learn: how to spawn in Enemy EOS = Enemy Occupation System: Down load here: https://forums.bohemia.net/forums/topic/144150-enemy-occupation-system-eos/ by BangaBob https://www.youtube.com/watch?v=diQ8wT1l8H4
http://forums.bistudio.com/showthread.php?153100-Enemy-occupation-system-(eos)
How to use my occupation script. Made for Arma 3
Thanks for watching please like and subscribe!
My twitter is...
https://twitter.com/#!/H8erMaker
Whats that?
And hide them too if you don't want to see them at first.
now what's wrong @sly cape
The hide option in properties you mean?
Okie
I've searched the internet for that and nothing came up.
really hmm i found it in 2 seconds
after i learned how to use the EOS system: i of course changed all to it fit my needs
it's really a good system and so user friendly: its a good starter system that just uses scripting: and it teaches you alot about spawning in enemy
Gonna give the script a go in a little test room to make this easier.
Noice the script works!
Thanksssss
This should help me optimise my levels a bit more
Because oh lordy lord does it need it haha
@sly cape link up there for you ok m8: to the DL: and to a video on how to use it
i feel this system can teach anyone a lot about spawning in enemy
so you don't need 1000 things on the map 🙂
but like i said i edited lots of the scripting: to fit my needs: i cut it way down to only the stuff i needed: for my missions 🙂
if anyone needs more help on how to use this system i can help with that too
BangaBob, is Awsome i think so anyway
I just wanted to have a means to control when my units are visible on the map.
Does anyone know how to use the custom text for the endscenario module? Not sure if im missing something to get it working.
The writing does not appear on the end scenario screen
endscenario module- is typically synced to a trigger
Oh yeah I know how to sync it etc, what im trying to get working is the Custom Type
Getting the text I wrote to actualy appear on the end scenario screen
Custom type is a class of CfgDebriefing iirc.
You can define that in the description.ext
Thats in the mission folder right?
Thanks
i use the Description.ext
// at the bottom of my Description.ext
class CfgDebriefing
{
class End1
{
title = "MISSION COMPLETE";
subtitle = "VC Camps Cleared";
description = "4 VC Flags Captured";
backgroundPicture = "";
picture = "";
pictureColor[] = {0,0,0,0};
};
class End2
{
title = "MISSION FAILURE";
subtitle = "USMC K.I.A";
description = "";
backgroundPicture = "";
picture = "";
pictureColor[] = {0,0,0,0};
};
};
and in a trigger with no Area: on the map somewhere: well i have 2 triggers really 1 for win and 1 for loose
in the Onactivation i put one of the following you will also need a condition in the triggers
//win mission
["End1"] remoteExec ["BIS_fnc_endMission"];
//fail mission
["End2", false] remoteExec ["BIS_fnc_endMission"];
to match End1 and End2
you can have as many End-inds as you want
in some of my missions i have 4 Diff End-ings End1 End2 End3 End4
OFP flashbacks ^^ gg still!
Its a big British Army mission ive made. Took quite some time lol
Seems like there no local argument version of Fired EH?
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Fired
What do you think about it? Why would you need it?
So it fires only where unit is local and I could add it everywhere in case of locality change. But I don't need it to fire on everywhere every time though
I guess I could add and remove it from locality changed EH
Hello, do anyone know the id's for displayctrl in inventory? I want to add eventhandler for clicking on a primary weapon but idk whats the id
Or just if(!local _unit) exitWith{}?
That's also an option
Nah unfortunately
That way you add eh globally and not care bout locality change
But also makes it potentially fire a lot of times for no reason. Albeit local check will cost very little
Give unit bolt action rifle 😄
// Futura ui
#define IDD_FUTURAGEAR 602
// FUTURA GEAR controls
#define IDC_FG_PRIMARY 610
#define IDC_FG_SECONDARY 611
#define IDC_FG_HANDGUN 612
// prefix 620 means slot items
//---
#define IDC_FG_MAP 6211
#define IDC_FG_COMPASS 6212
#define IDC_FG_WATCH 6213
#define IDC_FG_RADIO 6214
#define IDC_FG_GPS 6215
#define IDC_FG_GOGGLES 6216
#define IDC_FG_HMD 6217
#define IDC_FG_BINOC 6238
#define IDC_FG_BACKPACK2 6239
#define IDC_FG_HEADGEAR 6240
// prefix 630 means slot container items(uniform, vest, backpack)
#define IDC_FG_UNIFORM_SLOT 6301
#define IDC_FG_VEST_SLOT 6302
#define IDC_FG_BACKPACK_SLOT 6303
/// containers load
#define IDC_FG_UNIFORM_LOAD 6304
#define IDC_FG_VEST_LOAD 6305
#define IDC_FG_BACKPACK_LOAD 6306
#define IDC_FG_GROUND_LOAD 6307
#define IDC_FG_TOTAL_LOAD 6308
//---
#define IDC_FG_MAGAZINES 618
// primary
#define IDC_FG_PW_MUZZLE 620
#define IDC_FG_PW_OPTICS 621
#define IDC_FG_PW_FLASHLIGHT 622
#define IDC_FG_PW_MAGAZINE 623
// secondary
#define IDC_FG_SW_MUZZLE 624
#define IDC_FG_SW_OPTICS 625
#define IDC_FG_SW_FLASHLIGHT 626
#define IDC_FG_SW_MAGAZINE 627
// handgun
#define IDC_FG_HG_MUZZLE 628
#define IDC_FG_HG_OPTICS 629
#define IDC_FG_HG_FLASHLIGHT 630
#define IDC_FG_HG_MAGAZINE 631
#define IDC_FG_GROUND_ITEMS 632
#define IDC_FG_CHOSEN_CONTAINER 640
#define IDC_FG_PW_UNDERBARREL 641
#define IDC_FG_SW_UNDERBARREL 642
#define IDC_FG_HG_UNDERBARREL 643
#define IDC_FG_PW_MAGAZINE_GL 644
why is this not on the wiki 👀
How do I know? You're the one editing it

where should it go? asking for a friend
Dunno. Try to ask dedmen 
@still forum I was told by this person to ping you repeatedly until I obtain an answer! 
🤣 🤣 🤣
Did pete check 138?
nope, and he can't retire until he does
Poor pete
he left the company 50 years ago, we don't know where he is now
But still on payroll until he checks it?
hah! you don't know our finance department
he's most likely hunted down by our QSRF
IDK how can one organise these IDDs in a pretty way; one table per display I guess
Nah, just dump list and keep appending. Like it was done by developers
The file I've copied it from has over 3 thousand lines defines, so have fun adding it all on wiki 😅
I created that at least 😬 https://community.bistudio.com/wiki/Arma_3:_Inventory_IDC_List
Inventory itself could have been mentioned
And then you request the command to be added or bug to be fixed and you might get lucky 😢
Arma 3 its perfect: i'm not sure what he's talking about: i love Arma 3
i never had 1 thing go wrong with Arma 3 ever: its the best game in the world
but then i don't use any Mods
sep for terrains
my dreams have always worked out cuz of the guys that help me lots 🙂 in this channel
Shadow flag for spawned lights 
yup 🙂
only a few ai will go into rocks it almost never happends
there's lots of ai enemy in my missions so if a few have to die by death trigger its ok 🙂
if you use findSafePos its all good then 🙂
most of the time anyway
no other games allow AI in rocks so frequently
best game ever!
its ok i don't consider that to be bad thing its just a Arma thing 🙂
still the best game ever imho
other games have other things bad about the game more then Arma 3 🙂
and hello Lou: how are you mate
hi there, well it's Friday
woohoo hell yeah
my friends will be playing today in a night mission i made with no NVG and only flashlights : the moon will be out and showing bright 🙂
i get to be the chopper pilot for the mission: cuz my friends don't fly so much 🙂
but ofcorse there's always the Insertion\Extraction chopper can be used 🙂 also
super Awsome chopper command i made with the help of the Awsome guys here in discord 🙂
Chopper Command is run or by or is exec-ed by the CfgCommunicationMenu: woohoo
Does a Air drones have a additional type than "Air", I tried "UAV","Drone" etc. all non existent.
I want to specify and "Air" would be too generous
No there's no single base class for all UAVs
isUAV = 1; is all we have I believe
check with https://community.bistudio.com/wiki/BIS_fnc_configPath if you want
You can just filter by unitIsUAV _x && { _x isKindOf "Air" }
unitIsUAV will be faster since it doesn't use a config lookup (at least not from the script side)
~4ms for unitIsUAV vs ~13ms for config lookup (10k interations)
yes, I meant how the distinction is made
I could not find the command name though 😄
Thanks guys
private _nearbyUAVs = player nearEntities ["Air", 800] select {unitIsUAV _x};
private _nearbyUAVs = allUnitsUAV select { (_x distance player) < 800 };
Both around 0.0012 ms
first one may be faster, less air entities around player
ah well, basically the same really
Second may scale better, first will include all aircraft and parachutes. Probably will be more of those in 800m than UAVs total
Probably doesn't really matter that much though, so I wouldn't worry about it
depends on if there are 500 UAVs total or 500 flying things around the player 😄
The latter sounds like an average session with the group I play with. We're very disorganised
"where is he flying?"
"…a bit everywhere"
"…especially since that landmine"
Helped someone to get his Google Gemini made mod working, surprisingly not much errors (only two smaller ones that blocked him).
https://cdn.discordapp.com/attachments/1197226410209706155/1469356041702604914/image.png?ex=69875bf3&is=69860a73&hm=19792a9673b627eb12ca7f0b8e683066fd98bcb93bac6b231662ec76cb93324b&
If you have no clue you will still fail tho, since it will make some errors and if you don't know anything, you are screwed or you need to trial and error till it works 😆
If they have Hiddenselections, swap their material to a new rvmat. If theyre not vanilla/modded (so you can edit original files directly) itll make them look kinda bad up close since you probably wont be able to match all the file references but if the thermals is more important it might b worth jt
ASL - ATL if you want to ignore waves
The wiki article on position has a nice explanatory image
That includes waves doesnt it? But yea theres a few new ones, look at the picture to see what fits best.
@sly cape @warm hedge Just wanted to say thanks again for the help with that script. Found a lot of FPS, mission pacing, and stability tricks using it.
nope shouldn't include waves
Ah nice
hello all can someone show me the default cost: of all stuff like tanks and soldiers and stuff like that: i cant seem to find it
it keeps saying like 2.99 for a tank lol 🙂
thats not what i want to see lol
You mean zeus points cost?
For example abrams ~24.000.000 usd?
Imean i found this on wikipedia 😛
He means he looked up the real cost of an Abrams on wikipedia.
I have no idea what you're trying to do.
oh no no i mean like threat values or cost values i guess
no guessing is allowed
BE sure!
Then you need to resolve that :P
i guess i need the threat values
i was thinking cost was threat values:
but i mean threat values i need
What do you need this for?
ummm i want to try to change the threat value of the players
setUnitTrait has camo/audible coefficients but I don't think those have any effect except on spotting.
You can't really change it through scripting, it's part of the config.
As John said, you can affect detectability, but that's not exactly the same as threat.
Tiny mod time? :P
hmm. Not sure what effect that would actually have.
Usually they ignore tanks because they have don't a weapon to kill it with anyway.
well i bet the enemy would shoot RPGs at you that way
Err no.
That's determined by other factors, like the actual type of the target and the config properties of the ammo.
If thats your goal mod "LAMBS RPG" does that
But afaik it alters Ai fsm
Which is something you could do thru mission
Actually im not sure you can change danger fsm via script
must be not cuz every time i tryed it failed 🙂
i got the Ai to put the RPG on the shoulder but they did not fire it at me
Nono, you would need a custom fsm, but im not sure if you can overwrite the default fsm via script, only via config
see i don't want to do it the stupid way where people spawn a fake tank behind you like
must not be able to darn
lemme check
ok cool
OK no, youd have to modify aiAmmoUsageFlags of the muntion to be used against infantry. Otherwise AI will refuse to fire (on its own)
i remember way back in the OAdemo you could get Ai to fire RPGs at you it was Awsome
Scripted force fire would be too much?
i even removed all weapons from the Ai and they only have a RPG and they still did not fire at me
they wont, ammuniton config tells them, that this round is useless for infantry.
Same way they dont use rifles against tanks
yeah i see darn
oh well thats 1 dream gone 🙂
w8 isnt there RPG foot soldiers ammo
like the ammo they use on foot soldiers'
did you try fireAtTarget?
otherwise doWatch and forceWeaponFire that will work, abeit janky
right i see
darn
yeah i tryed eveything
i tryed like 50 time with all diff ways to get it to happen and nope it failed 🙂
i was thinking if i can get a chopper to fire unguilded rockets at me in a moving can maybe i could do this 🙂
the chopper part was easy 🙂
this however is not working
with the RPGs stuff
i guess i'll put it on the shelf for some day 🙂
What format is your given position in?
i wounder if i can get the fsm from OA-Demo 🙂
Why spawn a testing object if you already need a position to spawn it in?
ah haaa hmmmm 🙂
ASLtoATL and their variants
very very insteresting 🙂
If you already have an ASL just use ASLtoATL
And the diff in Z is the depth
No need to spawn any unitd
You used to have to if you wanted to take waves into account but not anymore
Detecting if a curator has looked at zeus ping alert using this has been extremely inconsistent. Any workarounds or solutions?
waitUntil {uiSleep 0.05; inputAction "curatorPingView" > 0};
Cant you create a Global Event for CuratorPinged via CBA ?
i think he wants the actual response (pressing space to the ping)
Thats when a player has pinged the curator - I am looking for the inverse (what Kharos has stated)
why do you have uisleep 0.05 there?
not really necessary, but also a more important question - how exactly is it inconsistent? is it just triggering sometimes or what?
yeah inputaction only returns properly if the said action was used during that frame
but it's a cheap check so you shouldn't worry about that for something like this really
It just does not work when pressing space even spamming it for few seconds
Even without the sleep delay, spamming space does not work either.
[] spawn {
waitUntil {inputAction "curatorPingView" > 0};
hintSilent "KEY DETECTED";
};
where exactly are you're running this code? given the nature of this im going to assume you're running a server, a zeus client, and a pinger client - is the code actually being executed on the zeus client?
also have you tried a per-frame-handler instead? might be scheduled being scheduled and just missing it
Yes
i'd just try unscheduled then and see what happens, beyond that im not sure 🤷 someone else might be able to help, the one time i used inputAction i didnt have any issues
private _handle = [{
params ["_args", "_handle"];
_args params ["_wasPressed"];
private _pressed = inputAction "curatorPingView" > 0;
if (_pressed && !_wasPressed) then {
hintSilent "KEY DETECTED";
[_handle] call CBA_fnc_removePerFrameHandler;
};
_args set [0, _pressed];
}, 0, [false]] call CBA_fnc_addPerFrameHandler;
running unscheduled - still no 
for '_x' from 0 to 1 step 0 do dafuq
How about "getTerrainHeightASL _testpos"?
does anybody here know how to put voice chat text in the middle of your screen? e.g alpha 1-1,Continue on mission advise over
I've noticed that 2.22 introduces promises. That is very nice
Just hope it works as designed, not many people testing it yet 
In case you don't know, https://community.bistudio.com/wiki/addUserActionEventHandler
step 0
O_O
Is there a script I can use that can make NPCs appear in a zone when a player is in the trigger volume, then disappear when out of the trigger?
Got a base with a lot of static ambient NPCS on it, and to save on performance I want them to stop being simulated and vanish when the player is not in the area.
I was thinking using that script I was shared before, reversing the logic for a trigger when the player is outside, and another trigger with the inverse logic for when inside the trigger
yeah, odd way to do "while {true}"
It hurts
Now I can make my NPCS disappear and reappear at will
This will save on performance plenty
Ill share an example of what I have figured out incase any of you wanna try it
Anybody know how to read out whether a unit has been given a stop order either via 1-6 or commandStop / doStop?
Bonus question: if stopped, how do I reset the unit to "ready" (i.e. currentCommand _unit isEqualTo "")?
If unit is leader then select him as leader using selectLeader, which for whatever reason removes the command. If not leader, then joinSilent him into his own group
Awesome. Many thanks.
What would cause a function that's called within another function to execute in multiplayer 3den but not when on a dedicated server?
One function is declared in XEH_PreInit using compileFinal preprocessFileLineNumbers as its own sqf.
The function it's being called within is declared in-line within a different .pbo's XEH_PreInit file itself.
Due to rpt logging, I can confirm that the former is firing from the editor but not from server
Maybe hasInterface or local player.
Nothing in any of the scripts has those; is including them the solution?
No.
I thought not
How do I obtain a unit's "number"? As in, e.g. my squad is "Alpha 1" and unit three is "Alpha 1-3". It will retain its designation even when e.g. one and two involuntarily leave the team by dying. Can't use the index in units group player here...
groupId unit
like given a unit designated as "Alpha 1-3", you want to retrieve 3 from that? i believe groupId is what you're looking for:
https://community.bistudio.com/wiki/groupId
Yes, very good. Thanks!
Are you sure the 2nd fnc exists at the time it's being called? Log its contents at that time and see.
I can call it manually through the exec function zeus module and it executes normally
yes, but that doesn't necessarily mean it exists at the time of being called in the 1st fnc
Is there a way to display an Icon in the same RscTitle as text?
@grave belfry excuse the ping. Tagging as I've seen your reaction here.
A "Promise" enables more efficient asynchronous programming. The BI wiki has a great example of this new functionality under the Script Handle page. https://community.bistudio.com/wiki/Script_Handle
Essentially, in the past you'd have to use waitUntil to progress with a script, that's running in the scheduled environment, once your condition is met.
Now with promises, you can return a script handle and chain a continuation to that to invoke your next piece of code once the script handle is terminated. No more waiting for arbitrary amounts of time and better performance.
Yeah, the ❓ was an ask for a bit of documentation. You interpreted it correctly. Many thanks!
No problem. I need to play around with it but I'm not expecting many surprises to be honest. It'll be identical to Task in C# or Promise in JavaScript.
At the very least, it'll be nice to get rid of the conditional waitUntil elements from scripts where it's no longer necessary
...and getting rid of waitUntils with uiSleep 0.1 crammed into them, too.
Yep, exactly. It was always a fine line between having a script that's reactive enough but that isn't too expensive in performance
Where to test it out, make similar events with wait until?
Doesn't seem like a common case. Usually if you're using waitUntil you're not waiting for a script to finish. I do have one system where I chain scheduled functions with waitUntil so that the whole thing doesn't fall over if one of them bugs out.
Okey
It's not so much that you're waiting for a script to finish. It's that you're waiting for a certain condition to be true before invoking more code. With the promise approach, you can do that by chaining your continuation to the handle returned by your spawned script
It nice feature. But like 99% mine is running unscheduled anyway. The only 1% left would be like the rare managing script, or when there isn't an event and I must run a check manually. But for the latter it is only if it is one-off, because otherwise I just emit events.
There'll be cases where waitUntil is still required but if an event type exists and you could hook into that then it's a good thing to substitute out
Arbitrary condition is still running some piece of script regularly though?
Ah, I guess you can also create arbitrary promise handles that you can terminate from an EH, for example.
Pretty much. If you have nothing to hook into them waitUntil is still a good bet.
If there's an event though, a promise will be more efficient. No need to block that script anymore
would have liked waitUntil [condition, timeout] more personally.
but that's really syntactic sugar
[condition, interval, timeout] I guess.
They also work for unscheduled use cases.
Its basically like a one-time-triggered eventhandler.
I think that was still on my todo, but got a bit lost there
Yes I understand, the continuation is unscheduled, it is just very rare I need/have scheduled at all
I assume the waiting scripts are placed completely on hold separate from scripts and does not even have check-readiness overhead?
"Empty handles" are not simulated
Say you have a call, that returns the result asynchronously. (For example extensions with callbacks)
You can do
[fnc_callback] call GoFetchSomething; // calls fnc_callback after the fetch is complete
or you can
_promise = call GoFetchSomething; // Returns a promise that completes with the fetch result;
_result = waitUntil _promise; // In scheduled script, can suspend until the result arrives
_promise continueWith { _result = _this }; // Trigger unscheduled "eventhandler" when the result arrives
It's more universal that way.
You can suspend in scheduled.
You can attach multiple continuations (or none).
You can regularly check "did I get the result yet?"
Yeah async callback from extension is a good use case. Though I would probably skip the scheduled environment and add the "rest of the script" as continueWith. We can do that right?
My last example just without the waitUntil? yeah
In that last example, shouldn't the continueWith come before the waitUntil to ensure the continuation is chained at the right point or does that not matter?
If you add a continue to a already completed promise, it executes immediately
Last example meant either waitUntil or continueWith, not both together
Ah, I see what you mean. That's good to know also regarding the execution detail
If you continueWith from unscheduled context what runs first? The original execution or the argument to continueWith?
(On an already completed promise)
The original continueWith runs when its completed
So.. that would happen first
Or what do you mean by original execution?
// In unscheduled context
//....
donePromise continueWith { systemChat "A"; };
systemChat "B";
What happens first?
Or does the rest never run? Like an exitWith?
Edit: installed dev version. The continueWith happens runs first.
Regarding the extensions with callbacks example, what would that look like specifically? Would it be assigning the continuation through the ExtensionCallback mission event handler?
What I would do is call a wrapper that creates an "Empty Promise" and stores that (say in a hashmap or sumfink). It then calls the extension with some unique ID, and returns the promise.
Then when the extension call back into sqf it also passes the ID. The "wrapper layer" then find the promise and resolve it with the value from the extension.
That's similar to what I was thinking around storing in global state, but I wouldn't say that's any more convenient than simply calling a function within the callback
Certainly not more powerful. But it slightly more flexible for the caller in how it is used, or when.
I'll admit I haven't used the newer extension callback event handler. It's been around a decade since I've done anything with extensions in fact.
Using a continuation within the callback seems like it'd be good for a more niche use case whereas I'd opt for function names with some good validation and error handling in case the function doesn't exist
The downside to that approach however is that you need to remember to update your function names in two places - CfgFunctions and C++
Not sure what you mean by if the function doesn't exist? The call to the extension doesn't change compared so synchronous call. In fact you can use the callback without ever making a normal extension call.
Not sure what you mean by if the function doesn't exist
More specifically, if I develop fat fingers when typing the function name in the function pointer on the C++ side which then performs the callback https://community.bistudio.com/wiki/Extensions#Callback
Ah, I see. To be clear they don't have to be "function" names in sqf. Not sure why the args are even named like that. Could just call it like callback("MyExt", "DB_RESULT", "[1234, \"DATA_HERE\"]") and then on the sqf side. Roughly made example:
addMissionEventHandler ["ExtensionCallback", {
params ["_name", "_function", "_data"];
if (_name isEqualTo "MyExt") then { [_function, _data] call MyExt_Callback;};
}];
MyExt_Callback = {
params ["_cmd", "_argsString"];
private _args = parseSimpleArray _argsString;
if (_cmd isEqualTo "DB_RESULT") then {
_args params ["_token", "_data"];
private _promise = MyExt_CallbackMap deleteAt _token;
_promise terminate _data;
};
//....
};
You only have to test the names once to be sure they are not wrong.
Light-bulb moment - I see what you mean now
Forgot this part: private _args = parseSimpleArray _argsString;.. But that is the general sketch.
And of course, we have fromJSONand to toJSON for any non-trivial string serialization.
I've created a WIP logging system for a server and I am wondering how easy it would be to integrate it into a database where it sends the log results to a separate file which compiles over time, i/e a total number of kills someone has over the span of a month.
Would this be relatively easy?
Depends really. If you want it going to something like a SQL database then you'd need a database extension. Otherwise you could have a simple file logger extension to pipe contents out to a log as a flat format
Server host has a free SQL database thing with it. But really I want to just send it to a specific file local to the server instead of setting up the SQL database etc
I just dont recall if arma has a log to file or anything like that
Diag log just goes into the RPT for example
The question I'd ask is what do you plan to use the information for? Will it serve a use etc
I don't think it does. KillzoneKid made an extension years ago that piped log info out to a file. There's also A3Log from 2016 which was developed by Arkensor who now works for Bohemia
Although, A3Log seems to pipe out to the RPT
Long term scoreboard type of thing. But also tracks other things like how many times they teamkill someone, and stuff like that. I dont need a pretty list that shows player name, game score data, etc.
But rather just one single log file which I can have logs sent to
yes I saw one of these while googling
No, seperate log files, but you can't compile over time
it can create logs files for days etc, so you could manually do it after each day.
or have some python script doing it automatically by reading from the daily logs.
Okay ^
I think I will just use my Discord API to log it to a discord channel
I was looking at some arma 3 server site and they compile total score of players over time using that game dig query feature and I wanted to have something similar but with more accurate info.
Not sure if anyone has ever seen it before
i wrote a server-side mod for this last week using just extDB3, it tracked kills with a mission event handler, other statistics like incaps/revives/playtime/score, and periodically submitted them to a mariadb instance with a stored procedure:
not exactly conducive to a real-time feed, but you could try that approach if you don't want to go the custom extension route
Nice and you track by UID too
Is this posted anywhere or you just using on your server for now
uhh it's not intended for public use, but i guess i could release the source code anyway
https://github.com/thegamecracks/420th-Stats-Tracker
it's not particularly complex, just a schema, some config files for extDB3, and a few postInit functions to initialize the extension and stats tracking
No worries, just wasnt sure if it was posted already or just built for your own use
And you are just using server side event handlers to track the kills and activity?
yup, EntityKilled can fire for global arguments so it doesn't need to be added on clients
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#EntityKilled
other stats like players transported are checked with... polling loops... cause i didn't want to go through the effort of broadcasting local EHs like GetIn/GetOut 🙃
Yeah sometimes its better to just do it that way
easier
lol
Well, not those exact, since those are global.
wait those fire with global args? i had just assumed they were local since i saw them used as such >.<
Not leaving the couch to verify, but BIKI list them as global. For non-local machines they have to be readded on respawn.
hmm good to know that, ill check in a bit
yup, worked on non-local vehicles and units for GetInMan equivalent
Does anyone know if ctrlDelete is broken? I got controls made with ctrlCreate, saved in an array, then when I run the script again I loop through that array using ctrlDelete to clean up the existing stuff before recreating... but it don't work
I tried both saving the controls themself in the array or their IDCs and then deleting them directly or through controlsGroupCtrl and none of them work.
Is there a way to reboot unit AI or something? 🤔
Still seeing some drivers straight up refusing to move to a waypoint
It's a group thing so rejoining/rebuilding the group would do that. I think there are multiple failure modes though. Moving the vehicle fractionally works sometimes.
Thanks, I'll try that
I am assuming that it's an easy waypoint. Otherwise there are other potential issues.
Yeah, nothing fancy, just a MOVE wp
I mean easy to navigate to. No bridges, no clutter etc.
Nvm fixed it. You need to ctrlEnable false and ctrlShow false first to get it to work apparently
As a replacement question: Is there a way to disable control(groups) by default in config?
I am trying to add a custom image to the screen of a Rugged Tablet, however when I put in the path it just appears entirely white. What's the deal? Does the picture need to be a specific size?
nvm, got it
yes, sizes in the power of two (e.g 256×512, 128×128 etc) and paa (preferred) or jpg
Is there a way to access the object contained in a CT_OBJECT in order to apply modifications ?
Like changing hiddenSelections textures etc...
Hey Guys, is "profielNamespace" remoteexecutable? My problem is: savedLoadout = profileNamespace getVariable ["TEST_Loadout", []]; <- this executed on Server is working; savedLoadout = [profileNamespace, ["TEST_Loadout", []]] remoteExec ["getVariable", 2]; <- this executed local isn´t. I AM on local MP though, but it should still work, shouldn´t it?
You can't remoteExec an assignment like that... You run this on a machine:
savedLoadout = [profileNamespace, ["TEST_Loadout", []]] remoteExec ["getVariable", 2];
Part right of = is [profileNamespace, ["TEST_Loadout", []]] remoteExec ["getVariable", 2]; which runs and remoteExecs on the server. But the result of the expression on the client is like "" since you do not use JIP parameters. So what actually happens is more like:
// Sending this "instruction" to server:
profileNamespace getVariable ["TEST_Loadout", []];
// Doing this on the local machine
savedLoadout = "";
Thank you very much. I guess i´ll have to go at this problem with another logic then.
You could remote execute function, which would read profile namespace and send returned variable back by another remote exec
- If it is for a mission use missionProfileNamespace instead.
- If the data never change (besides mission changed), then just put it in a file and load it directly on the clients.
- Okay it does change. Well, do all clients need it? Then
publicVariableit once, and on changes. - Only some clients or one client need that particular data? Well are you sure you need to store it on the server-side then? Store it locally in missionProfileNameSpace.
- Okay, you really do need to because the server is storing Life-money for the player or something: yeah do the bothersome request-response key-value retrieval.
ctrlShow false
sry, ctrlShow false from the dialogs / displays onLoad event
onLoad = "_dlgNaviPadDialog = _this select 0; {(_dlgNaviPadDialog displayCtrl _x) ctrlShow false} forEach [2, 9]; uiNamespace setVariable ['BWA3_dlgNaviPad', _dlgNaviPadDialog];";
Yeah I was hoping for an actual config. The scripting side i got is already connected to onload which works fine, it's just that there's a lot going on with elements. Probably gotta split it up between purely running the ctrlShow bits first instead of handling everything related to one control first.
Well it is for a campaign. I basically want to save the state of the destroyed POIs, Soldier loadouts defeated groups etc. The only way i found for that is the servers profilenamespace...
You could set the w,h to 0 and then back to their intended values instead of ctrlShow true
Ah yeah then that is your only choice. Or if you mean like a true campaign ™ , then there is saveVar, but I've never used that.
Okay. Thanks for the assistance. Much appreciated
Hmm yeah that's something I'll have to consider, might want to animate stuff anyway so should be easy to put in there
There should be no problem with ctrlShow false from the onLoad event though
Nah there isn't, I just gotta reorganize my functions a bit to make sure they get run in the proper order, so that's the first thing I do.
I got 2 panes basically and right now I'm running all the code for the left pane (Which is quite a lot) and then only after that the call to check whether right-side pane should be hidden. Means you get a tiny flash for a second which is annoying as fuck 😄
For some reason, ui scripting get's always messy when I try it. The navipad was/is horrible before I rewrote it
onLoad doesn't cause a flash. It's done in unscheduled environment
Actually might be right when it cocmes to that. For testing purposes I got a createDialog and the functions that show/hide in a seperate function now instead of using onLoad. onLoad doesn't actually show the dialog before it's functions are run right?
It's all unscheduled already though
onLoad is done in the same moment you do createDialog
Hello i have this problem 'B' encountered instead of '}' when i start the game
Config syntax error probably
My line code class CfgVehicleClasses {
class Transports Blindées {
displayName = "Transports Blindées";
};
class Blindées {
displayName = "Blindées";
};
class Aériens {
displayName = "Aériens";
};
};
Can't use space in class name
Can't use spaces in classnames
class Transports Blindées {
also that é
Replace it by an underscore and getrid of accent aigu
Better use english for classnames
ok thank
The one thing I always like with UI scripting is a mistake i pretty much always make when i add a curSel related thing somewhere.... the endless loop of calling itself 😄
i solve and it's works thank
yw
is there any reason that serverTime would get dramatically out of sync in the 5 minutes between scheduled syncs? is it something I should worry about or need to sync manually when planning around it?
Is the behaviour between Killed, MPKilled and EntityKilled a 1:1 in terms of feature parity? Adding a server-side EH for EntityKilled seems like a nice way to replace all of my individual Killed and MPKilled event handlers where they all call the same function
hey all, for my mission i want to put down a zone and not allow a players be able to leave that zone. is it possible to do that?
Short answer: No.
