#arma3_scripting
1 messages Β· Page 228 of 1
what's the correct way to write the ampersand without the code freaking out?
I just want to have it inside a displayname: "" and it cuts the text.
I've tried "&&", "&" and "\x26" as suggested by some AIs but I can't get it right. This shouldnt be so difficult...
IDK what I'm doing. I'm trying to stitch together some sort of script but I'm not a scripter. I use AI, but dont trust it.
Anyways,
Objective: To create a script that pushes a boat on a dedicated server that does not rely on boat size or if its in the water or not. You should be able to push it if its 1000m on a mountain or on sealevel. This is what AI has come up with.
I add these odd requirements because publicly available mods make dependent if its in the water or if its too heavy you cant push. None satisfy all of these requirements
fn_pushBoat.sqf
Author: Community Script / Adapted for Dedicated
Description: Pushes a boat in the direction the player is looking.
*/
params ["_boat", "_player"];
// Ensure this runs on the server
if (!isServer) exitWith {
[_this, "fn_pushBoat.sqf"] remoteExec ["execVM", 2];
};
// --- Configuration ---
private _force = 10; // How hard to push
private _lift = 2; // Slight upward lift to prevent getting stuck
// ---------------------
if (isNull _boat || !alive _boat) exitWith {};
// Calculate direction from player to boat
private _dir = [_player, _boat] call BIS_fnc_dirTo;
// Apply force
_boat setVelocity [
(sin _dir) * _force,
(cos _dir) * _force,
_lift
];
// Optional: Say something
// _boat say3D "push_sound"; ```
initPlayerLocal.sqf
```// Add action to all boats for all players
if (hasInterface) then {
player addAction [
"<t color='#00FF00'>Push Boat</t>",
{
params ["_target", "_caller", "_actionId", "_arguments"];
[_target, _caller] execVM "scripts\fn_pushBoat.sqf";
},
[],
1.5,
false,
true,
"",
"objectParent _target == objNull && _target distance _caller < 5" // Only when close and not in boat
];
};```
thats AI code? maybe use https://community.bistudio.com/wiki/addForce instead
the problem is is that it doesn't show up in-game
and I am too ignorant to troubleshoot this so I come to the experts
its ai code?
yeah from ai. I dont know where it got the code. it didn't source anythign relevant
Many issues. The technically broken ones
- The action is added to player. This is not inherently wrong, but nowhere is the boat captured, say via cursorObject or cursorTarget.
- The action runs on the player, but the script only operates on server.
ai codes typically dont work π
usually I look at the links the ai gets me to confirm if it interpreted correctly according to the original author but idk who i t is
it did once, lol. I figured it sourced it from someone
Then you probably also want:
- Ensure the boat is not occupied (at least in the "driver" seat) (if not you need locality-run it correctly), or already moving when pushing.
- Maybe a push cooldown
well the one area I can isolate it to is initplayerlocal.sqf as the add action option doesn't even show up. Therefore idk if the rest of the script is trash
I think actions are also not preserved across respawn.
objectParent _target == objNull
^^ will never be true
that's why you don't see it.
oh should I modify this line or delete entirely?
objectparent can be null
but == objNull isnt the right way ofc, should be isNull
to confirm. I'm going to edit this line to:
object _target isNull ?
isNull objectParent _target
if (hasInterface) then {
player addAction [
"<t color='#00FF00'>Push Boat</t>",
{
params ["_target", "_caller", "_actionId", "_arguments"];
private _boat = cursorTarget;
private _bump = vectorNormalized (getPos _boat vectorDiff getPos _target) vectorMultiply 10;
_bump set [2, 2];
[_boat, _bump] remoteExecCall ["setVelocity", _boat];
},
[],
1.5,
false,
true,
"",
"_target distance cursorTarget < 5 && cursorTarget isKindOf 'Boat_F'"
];
};
Should get you started.
dude how do you learn this code? Its proprietary
its not like they publishing books about it. I'm impressed with you all
there's a wiki 
so technically yes a book is published lol
it's not really based on anything so it's technically Properietary in that sense, also it's a scripting language so cant really be compared to a complete programming language, tho that's also why it's much easier to learn, easier than python even, since all you gotta worry about is syntax and game commands
probably the only way sqf is comparable to python is in its performance (i havent measured but it probably peforms better than python tho π )
how to disable EndMission respawn template? want to prevent end of mission when respawn tickets reach 0
respawnTemplates[] = { "MenuPosition", "Tickets", "Spectator" };
do you know how to fix it so it reappears on the respawn?
AddAction_PushBoat = {
params ["_unit"];
_unit addAction [
"<t color='#00FF00'>Push Boat</t>",
{
params ["_target", "_caller", "_actionId", "_arguments"];
private _boat = cursorTarget;
private _bump = vectorNormalized (getPos _boat vectorDiff getPos _target) vectorMultiply 10;
_bump set [2, 2];
[_boat, _bump] remoteExecCall ["setVelocity", _boat];
},
[],
1.5,
false,
true,
"",
"_target distance cursorTarget < 5 && cursorTarget isKindOf 'Boat_F'"
];
};
if (hasInterface) then {
// Add Now
[player] call AddAction_PushBoat;
// Add again on respawn.
player addEventHandler ["Respawn", {
params ["_unit"];
[_unit] call AddAction_PushBoat;
};
};
I want to again thank you all. Once I test muzzleflash's fix I think all issues will be good. I should publish this on the workshop and give you all credit. Thanks again
Add it to the boat, not to player.
That is more proper. Though, I assume "complex scenarios" where it might not be known how and where boats will be spawned.
probably still more performant to keep it on the player, idk how expensive the internal engine distance checks are for addAction, but close to a dozen or more boats it's probably cheaper to just run the distance and type check on the targeted object
iirc that's how the "Unload incapacitated" action works (which might be from CBA but i cant recall)
Not sure.
Plus, according to BIKI, the action's condition will only get evaluated if the player is closer than 50m to the object and is looking at it.
It's vanilla action.
... For what it's worth, I'm like 90% sure Ace already has a push boat thing
that's the check i meant actually π there still has to be something internally that runs which determines if closer than 50 metres before enabling the condition check
that distance check would probably get more expensive with many many actions compared to just one check for whatever youre observing
Maybe.
Anyway, I think the game engine does it much faster and more efficiently than the scripted condition.
fair
I'm just trying to have a displayname = "K & H Assault Rifle"
However, since the & gets interpreted as a function or something, in-game it breaks and stops at K. How can I write the & without this happening?
Its either on config or an sqf, it doesn't matter. Not at the PC right now give me a few
this is the important line, but I'll paste the whole code below too:
displayName = "AR-12 K&H assault rifle";
it gets cut on K
I could be totally mistaken since been a while since I've had the issue but maybe you just need to escape the & if you're localizing or something?
You mean doing &&?
Ah okay found it
https://community.bistudio.com/wiki/Structured_Text#Hyperlink
Should be & if you're using structured text
without the semicolon?
I have tried it with the semicolon and it just literally wrote &
With semi colon sorry
would this be the correct way supposedly?
displayName = "AR-12 K&H assault rifle";
it works
so, the problem was that before, I was checking on the arsenal
it's better if you use a stringtable still
apparently the arsenal and the in-game display behave differently
I was checking here
but it doesnt matter really
all I care is how it looks ingame after all
how would that be?
If you intend to publish it in the workshop, stringtable is neat as you can localize the name to other languages :)
see https://community.bistudio.com/wiki/Stringtable.xml
it would turn out as displayName = "$STR_My_Translation_Key";
A stringtable is a table...of strings...associated with a key, e.g. $MY_LOCALISATION_KEY. Instead of writing plain text in your config, you write the key. Then when the game is looking at the config, it finds the key, and looks it up in the stringtable. From there, it can pull out the string associated with that key and with the currently-selected language, and substitute in that string wherever the key is used.
You can use plain text if you're really not going to provide alternate languages, but if you do want to, then a stringtable is the way to do it.
Ahhh okay. So it keeps the content of the text separately and easily modifiable or localizable
Would also help make my scripts look less bloated
We don't often use a string table in our mission since we require use of English to understand and abide by our rules, but if you plan to publish on workshop I'd recommend it. Kinda wish the gamemode we hosted was more inclusive in that way.
* a side benefit is that if you're using the same text in multiple places, you can just use the same stringtable key, then if you want to change the text you only have to change it once
I mean this is mostly a personal project I started doing purely for my own enjoyment. But this is good to know. I like the idea if only just to keep things more organized and flexible
Thanks for the help!
How can I find the path of the sound for playSound3D command? π€
Like, I have sound name that works with playSound but not with playSound3D
To find the path, you can look in it's CfgSounds which can be found in it's associated config: missionConfigFile, configFile, etc in the config viewer. That will give you an idea of what PBO to look into if you're trying to find the actual file.
Yeah, thanks, I was able to find it in CfgSounds with sound[] = attribute having path to file (without '.wss' extension though)
If someone else will search that question on discord:
Better check https://community.bistudio.com/wiki/Arma_3:_Sound_Files page, it has it all
addonFiles is also your friend
Can vehicles be scripted to move in reverse between certain waypoints?
By default AI reverses only if destination is close enough
what move command is responsible for flying ? π€ how jets fly actually ?
PS: I see ... vector array
Aircraft respond to the same movement commands and waypoints as any other vehicle.
If you want to control altitude, you can try flyInHeight and flyInHeightASL.
Note that the basic AI movement behaviour is done by the game engine, not by commands.
obviously I want to manipulate flying vector π
id like to know too - itd be super helpful for for my tank script...
trying to work something out with the LCC inside the LPD. LCC fits much better with the bow in, as far as entering, getting out of, and loading, etc. but then I want to try and script it to work as a taxi or support delivery ship. I think I can figure out the scripting of the support stuff, but it seems like it needs to start with the LCC moving out of the well deck in reverse.
I just recently started trying to really learn scripting and it's awesome! so much better than using the editor imo.
so probably trial and error to figure out the AI behavior?
You can try sendSimpleCommand, but it's not as easy as "go to this position in reverse"
what fun would it be if it was as simple as "do what I want you to do" π
thank you, I'll check out that command!
I've said it before but man- every time I read anything here related to AI, sounds like black magic
I'm encountering a VERY strange and disturbing bug. If anyone can help me figure out what's going on I would be very appreciative.
I'm making a battle royale where players parachute out of a plane. The Blackfish (largest plane) can only hold 32 players, but the game must accommodate 70 or more. Since I dont want to use multiple planes, I'm giving each player a local plane, and all of these local planes follow the same path. I'm temporarily hiding the players from each other while they are in the plane so they don't see each other de-syncing through the sky.
Basically, I'm creating the illusion that all players are in one plane.
Here's the unexpected issue: when players are parachuting down, something weird happens. When they get close to the ground, or right before they touch the ground, or apparently sometimes right after they pull their parachute, they go FLYING IN A RANDOM DIRECTION AND DIE.
I have no idea why this is happening, but it started after I implemented the plane code, which is otherwise working perfectly. Heres a video of it happening: https://youtu.be/QaaOeklvZDU
I've never seen something like that before so I am guessing it would be some sort of script issue. Do you happen to use some sort of loop with isTouchingGround? I know that command can be kinda hit or miss- had issues when I was making a jetpack. Do you have code examples you're able to share?
heres the script: https://pastebin.com/AT9R7kDC
the script is remote executed from the server:
[_planeStartPos, _planeEndPos, _pathMarkers] remoteExec ["TRI_fnc_doLocalPlane", 0];
I don't have anything happening with isTouchingGround
I could be totally waffling as I am purely guessing- but have you checked to see if player action ["eject", _plane]; is being ran while the player is in the air and in their parachute causing unintended behavior?
Or maybe one of the deleteVehicle commands? Looks like you're doing that on the plane so I wouldn't expect those to be it but only thing I can really see off a glance atm
I think it's related to creating a local plane and moving a global object into it
I think the server doesn't know about your plane when you do eject, so it will eject you from the parachute
so this will likely fix it?
if (vehicle player == _plane) then {
player action ["eject", _plane];
};
no
call all actions related to a local plane locally
does it work correctly if the plane is global?
(I mean not created using createVehicleLocal)
I confirmed that its this with a systemchat
the systemchat fires the instant the player gets "ejected" from their parachute
this entire script is being remotely executed for each client
better safe than sorry
yeah this fixed it
thanks, that was way simpler than I thought it would be
Hey, I'm having an issue with setObjectScale on a dedicated server. The script works fine in locally hosted MP but fails on dedicated. I've tried remoteExec with 0 and 2, neither work on dedicated. Putting it in the object init field doesn't work either on dedicated. The script is called from init.sqf. Anyone know how to get it to work?
Script:
[atc, 0.50] remoteExec ["setObjectScale", 2];
setObjectScale only works on attached and simple objects.
wait huh, wtf. thats interesting... what do you mean by attached btw?
I mean attached using attachTo
ah i see, yeah that makes sense. Alright lemme just quickly look into it then.
also your remoteExec is wrong. it should be local arg not server:
Okay that is a different ballpark entirely. Not quite sure what you mean by Local arg. I clicked the LA one, and tried to have a look, but it doesnt really make much sense.
I mean it should be executed where the object is local: [atc, 0.50] remoteExec ["setObjectScale", atc];
This page also has a lot of really good info regarding locality π
https://community.bistudio.com/wiki/Multiplayer_Scripting#Locality
Local vehicles can and do have destructive effects on global objects. It's a common issue when you're making vehicle-placing UIs.
Hm okay. I put in your version of it instead. found an asset with Simple Object, ticked it, but didnt do anything. Still works fine when hosted on my own machine SP and MP.
I'm not really sure how to phrase this question, but I'm making a toxic gas-esque smoke grenade. Here I found some code from a WIP ace feature that checks if a unit is in smoke, but I want to be able what kind of smoke / particle is in the player's face.
Is that kind of thing possible? I'd really like to be able to check the type of smoke directly rather than just "If within X meters of smoke grenade -> damage player"
Theoretically, this is entirely possible, as you can really get at least the scale, velocity, position of a dropped particle as an object. But definitely not ideally
If the toxic gas is made from one particular particlesource, I would drop multiple dummy particle drops and track the dropped particle to get where it did go
Haven't really messed with particles all that much, so I'm not really sure what you mean. Currently I just have a smoke grenade with a custom CfgCloudlets class
Which I meant was like, scripted particles either with setParticleParams or drop, but for CfgCloudlets thingy, ain't really sure
Might be good info here- I had a similar thing of needing to know where my particles were ending #arma3_scripting message
I'm not entirely against scripting the smoke effect and just giving the grenade a dummy effect if it means I can then check if the player is in it
I just did a similar thing the basic way by having a set radius
its not perfect but the particles I used werent affected much by wind
and tbh relying entirely on the particles might lead to some oddities
ie. the grenade being set off in a building affecting the floors above/below/through rooms etc
does kinda make me wish the 'fire' particle stuff could be opened up for scripting instead of just being completely engine driven damage
Yeah I was trying to think of a way to hook into that maybe, but the ways I thought of would also mess with ace since I don't think there'd be a way to tell between them
you might be able to do some funky stuff like
use a set radius (but much larger than the 'expected' size of the cloud)
and checkvisbility to see if they're inside the cloud
but I dont think that'd be 100% accurate as other stuff might mess with the visibility
ah thats what the isInSmoke fnc does
I hadnt looked at it till now
My idea would be // psuedo code globalValue = []; private _dummy = drop []; // drop one along with your visible particle _dummy spawn { while {alive _this} do { globalValue pushBack [getPosWorld _this,getObjectScale _this]; sleep 1; }; };and refer globalValue as the effective range of the toxism
Looking for a script to prevent the AI from dismounting immobilized vehicles when the gun still works. Used to have one years ago but took break from the game and dont have it anymore
Thank you.
you can use allObjects to get all cloudlets, but it's slow to iterate over them in scripts since there can be thousands of them
I once wanted to add an object filter command with many parameters (side, type, etc.). maybe if I add that it can help 
Hm, maybe. I imagine I'd have to fill out a decent number of the drop params so that stuff like how much it moves with the wind would match?
Ja. It wouldn't be so hard to do so, since there is a dedicated parameter to see how the wind (ultimately the air itself) can slow down/accelarate the drop
Yeah, rubbing iirc
My main thing is that I'm going to be tweaking the visuals some more and it'd be kind of a pain to keep editing it in two spots
Could read it from config but kinda annoying to cache it
That'd be great, Kerc also mentioned potentially opening up the damageType to script (which currently only has "Fire" as an option) could also work
Something like: damageType = "tag_fnc_particleHurt"; which gives the _unit that was hurt and then the _cloudlet (class) causing the damage? Could do the object too since that seems to be a thing with your allObjects message
!purgeban 934386452685529100 1d crypto scam spam
*fires them railguns at @iron swallow* Γ_Γ
Whats a script I can make or use to make sure a Vehicles waypoint only activates once a specific individual is placed in it? Like a Helicopter.
specificUnit in (objectParent this)
There is any built-in way to constrain waypoints with arbitrary conditions. So normally you'd need a monitor script that created waypoints, or toggled lockWP.
Waypoints do have script conditions that can prevent them from completing. Rather than preventing the target waypoint from activating, you'd have a waypoint before it that is prevented from completing until the condition is met. (https://community.bistudio.com/wiki/setWaypointStatements)
oh huh, I forgot setWaypointStatements had a condition.
I only ever used the statement bit.
Has anyone ever come up with or come across a script for getting ai to swap or equip gear that is in their inventory?
Iβm looking into it for undercover squads as well as scuba teams, so they could be wearing just plain clothes in the undercover case and wetsuits + rebreathers in the scuba case.
Then perhaps via a radio trigger or something I could get them to equip or swap their vest slot to swap rebreathers for plate carriers for example? Not sure if Iβm explaining it very well.
The way to do that would be:
- save a list of everything that was stored in their vest
- add the new vest (this deletes the old one and everything in it)
- restore the contents of the vest from the saved list
Commands to start off with:vestItems,addVest
Or another way would be to use getUnitLoadout, modify the resulting array, and then setUnitLoadout with the new loadout
im no great coder but can you guys find a way to make this better
{ unassignVehicle _x; _x action ["Eject", vehicle _x]; } forEach (assignedCargo vehicle this);
its basically supposed to eject passengers from a vehicle and it works to a extent but has issues
- helicopter does some kind of wierd landing and takes off again while dropping off paratroopers
- somewhat inconsistent
- usually needs flat ground to work correctly
hmm for one thing change action eject to https://community.bistudio.com/wiki/moveOut not sure about the landing issue
Generally if a unit wants to leave a helicopter then it'll force the crew to land.
maybe [_man] allowGetin false; too
moveOut does avoid that, I think.
Probably want to do moveOut before any unassigning, to avoid them requesting a landing.
oh and unassignVehicle takes local argument https://community.bistudio.com/wiki/unassignVehicle
private _crew = crew _vehicle;
{ unassignVehicle _x } forEach _crew;
_crew allowGetIn false;
so i could do this but with assignedCargo instead of crew
and moveOut
so like
private _assignedCargo = assignedCargo _vehicle;
{ unassignVehicle _x } forEach _assignedCargo;
_assignedCargo moveout true;
this is the function I use, use it if you wish ```sqf
manLeaveVehicle =
{
params ["_man"];
_man remoteExec ["unassignVehicle",_man];
[_man] allowGetin false;
moveOut _man;
};
!sqf
```sqf
// your code here
hint "good!";
```
β turns into β
// your code here
hint "good!";
Great thank you, certainly a starting point I can use, Iβll probably be back when Iβve figured out a bit more
Hi friends! I was thinking about creating a Mod that would contain a UI with some tools. Before I start though, I've been wondering what's the best way of spawning that UI without causing a compatibility issue between other mods? Obviously plan to use my own variable prefixes and stuff but not sure really how to approach adding a control or key to open the menu without potentially causing conflict with another mod someone may download.
Use #arma3_scripting message to make it format nicely in Discord.
so you can do { _x call manLeaveVehicle } foreach (assignedCargo _vehicle);
You can't outright prevent a possible clash of keybinds; there's only so many keys on the keyboard and some mod will be using just about any one of them by default.
What you can do is register your key as a proper keybind, so people can easily change it and will be warned about possible conflicts (at least if the other mod has also made proper keybinds...)
https://community.bistudio.com/wiki/Arma_3:_Modded_Keybinding
@Milo its not too difficult just use unique dialog Ids and class name
Gotcha, that was my worry with keybinds; especially assigning it to a specific key. What you posted there would just give the ability for the mod to have custom keybinds in the default keybinds menu?
Yes
That's awesome and sounds like exactly what I'm looking for- thank you for the help!
is it specific to normal arma helicopters because im using the blackfish vtol from apex and/or does it still work on waypoints
because i assigned a move waypoint and changed it to scripted as well but it doesnt work
im pretty sure im doing something wrong on my end though
should work with any aircraft, the script just throws the men out
make sure your _vehicle or whatever is vehicle variable is correct
run the manLeaveVehicle function declaration code in init.sqf for example
I have issues on performance branch with VTOL ai behavior. If you're on perf try swapping and see if it helps
im not on performance but it just seems that the vtol generally has wierder behavior which im assuming because it was a wide turning radius compared to a normal helicopter
buts its just a guess
maybe too small waypoint radius? π€
The AI don't really know how to fly VTOLs properly, but it shouldn't make any difference to moving units in/out
that is a good point ill try to make a bigger one
well i have to go, good luck with the script!
alr thanks
Still actual:
#arma3_ai message
do i have the wrong formatting or am i going about this wrong?
i have 3 tasks that once all are completed, a 4th task is supposed to show up
i have
taskCompleted task1 and taskCompleted task2 and taskCompleted task3;
on the final task trigger, but the 4th task is showing up at the start of the mission
and is valid (it's exactly the same as &&) and the end ; won't break it
thought triggers specifically need ampersands rather than a word
No. It's just a command. Triggers don't do commands any differently than any other part of the game.
how much is dedmen's backlog? shall I ping? π
is there a way to prevent the command menu from coming up when players press a key like F3?
(the command scroll menu that pops up in the upper left)
Can't reference our code base since on my phone but could probably just check to see if the key for it is pressed by using actionKeys on it's associated userAction in a key event handler. Not sure what the userAction is off the top of my head but could probably be found here π
I was browsing the wiki today and I noticed that there are event scripts, onFlare.sqs and init3DEN.sqf
I understand what they do, the documentation is clear, but I wonder if anyone has any interesting examples of how they can be used? I also wonder if onFlare works with ACE3/mod flares
then what's wrong π
Ah okay back on my PC now- this may be what you're looking for:
(findDisplay 46) displayAddEventHandler ["KeyDown",{
params ["_displayOrControl", "_key", "_shift", "_ctrl", "_alt"];
if (_key in (
actionKeys "CommandingMenu1"
+ actionKeys "CommandingMenu2"
+ actionKeys "CommandingMenu3"
+ actionKeys "CommandingMenu4"
+ actionKeys "CommandingMenu5"
+ actionKeys "CommandingMenu6"
+ actionKeys "CommandingMenu7"
+ actionKeys "CommandingMenu8"
+ actionKeys "CommandingMenu9"
+ actionKeys "NavigateMenu"
)) exitWith {true};
false
}];
this is what I already have, which isnt working
if (_key == 61) exitWith {
private _playerItems = missionNamespace getVariable ["playerItems", createHashmap];
private _uid = getPlayerUID player;
private _items = _playerItems getOrDefault [_uid, [0, 0, 0, 0, 0], true];
private _redgullAmount = _items select 0;
if (_redgullAmount == 0) exitWith { true };
_items set [0, _redgullAmount - 1];
[[-1, 0, 0, 0, 0]] remoteExec ["TRI_fnc_updateItem", player];
[player, getPlayerUID player, 0, 180] call TRI_fnc_handleBuffs;
true
};
I would try what I tossed above, that should work
Keep in mind, if they rebind any of the commanding menus to say a double key, or mouse buttons, this will NOT work for it.
I've found that just using something similar to showCommandingMenu "" with an onEachFrame event is the only way to ensure that it never opens, or if it does, it will close immediately.
I believe a new-ish command can do something that you're wanting though, which is
https://community.bistudio.com/wiki/actionKeysEx
technically speaking
could the procedural textures, which come from the UI rendering, be used in rvmats in other maps?
new-ish
2022-08-23 :p (I know, it's quite recent in Arma time :D)
as in, I want to have a dynamic normal map in my model,and while I am able to put it on the object as a texture no problem, the rvmat is refusing to render it
oh nevermind, it worked
Yeah it should, oh nevermind, you figured
just need to find how to use different shaders
I wanted to take a look at the refract shader, any idea how that's built and what the rvmat params are for it?
Clarify, why you need to? A shader itself is never meant to modify
so Im trying to make a glass material with some refraction on it, I made an rvmat with pixel & vertex refract shaders and passed my nohq map to it but my first problem is that it's animated, and it seems to be splitting the r & g channels, I was curious if there's a way to control this behaviour with a parameter/texture
also side fun fact, this sort of glass is possible if you write your rvmat wrong enough
here's the refract shader in question without any normal map passed to it
Unless someone knows if there's a way I can find an rvmat using this shader without having to go through each basegame pbo
"P:\a3\data_f\ParticleEffects\Universal\Refract.p3d" uses it. Probably that's not the shader you wished for though
its possible to find .rvmat using this script if you modify it to find rvmats: https://gist.github.com/HallyG/fa7a6cda10abcb630b1dc325f0523553 HTH
Gotcha, I'll take a look, Maybe I'll learn something from it
Otherwise im gonna have to stick to a transparent super shader with a normal map for some illusion
How can I get a trigger that is synced to a sector via a script? The sector is synced to an area logic which is then synced to a trigger. For instance: Sectorβ>Areaβ>Trigger.
Let me know because I also wanted to do this but ppeffects seem to be fullscreen
And I wanted to make a cool glassy HUD
well I found this
there are more stages and it's explained what they are, although little info on how to actually work with them
i see that changing the refraction depth (Stage 11 in the shader) makes a lot of difference to how it works
Wiki seems to indicate this only pulls logic and ai entities. Would that ignore triggers then?
one value gives blue and yellow, another gives a water shader, not sure what's the limit here tho
First of all you probably want this command instead: https://community.bistudio.com/wiki/synchronizedObjects
Secondly, half the point of syncing is to work with triggers. The commands work with triggers.
Im an idiot, the wiki notes it includes triggers. Reading is hard
I take it back, I have no idea whats going on with this damned shader
this feels more like a question to the BI devs if they could peek under the hood and check what's even going there and how we're supposed to set it up
I ended up making a bug report
I need some assistance, not sure if im being stupid, I was under the impression config lookup was expensive, no matter what way i test it a config look up is quicker on its own, than to have a system which on first instance sticks it in a variable then calls the variable every time, has config lookup been optimised
Post your code.
Would anyone know of a script for getting the turret number of a vehicle? Trying to block off certain seats in a chinook but thereβs so many seats Iβm having trouble actually finding what number turret it corresponds too to stop ai from loading into that position, figured there would be a way get the position if Iβm in said position
Who told you it was expensive? Though still surprised a variable isn't faster. Something does sound wrong.
params ["_heli","_configPathArray", "_type"];
//Test variable for enviroment
_heli = vehicle player;
_configPathArray = ["CfgVehicles", "fza_ah64d_b1", "components", "SensorsManagerComponent", "Components", "ActiveRadarSensorComponent", "AirTarget", "maxRange"];
_type = "number";
private _configHash = _heli getVariable ["fza_ah64_configHash", createHashMap];
private _cacheKey = str _configPathArray;
private _configValue = _configHash get _cacheKey;
_configValue;
if (isNil "_configValue") then {
private _entry = configFile;
{ _entry = _entry >> _x; } forEach _configPathArray;
_configValue = switch (toLower _type) do {
case "number": { getNumber _entry };
case "string": { getText _entry };
case "array": { getArray _entry };
default { nil };
};
if (!isNil "_configValue") then {
_configHash set [_cacheKey, _configValue];
_heli setVariable ["fza_ah64_configHash", _configHash];
};
};
if (isNil "_configValue") exitWith {-1};
_configValue;
the get variable on its own is quicker, however the moment I add more code to build the system around it, it ends up slower and the difference from a getvariable to a configfile is 0.0004 vs 0.0008, its so negligeble, its almost not worth thinking about
This looks really over engineered.
im accounting for any config path as an input, checking if its in the hash first then getting it and setting the hash
get into the seat yourself and then run cameraOn unitTurret player
Well how often do you need to look up the values that the difference matters? Compared to read-only config data, stringifying arrays and hashtable lookups is not really free either.
So the caller knows the entire config path and the desired result type. I don't see why it would not be simpler and more performant for the caller to do:
private _heliConfig = configFile >> "CfgVehicles" >> "fza_ah64d_b1";
private _activeRadar = _heliConfig >> "components" >> "SensorsManagerComponent" >> "Components" >> "ActiveRadarSensorComponent";
// get actual values
private _maxRange = getNumber (_activeRadar >> "AirTarget" >> "maxRange");
private _minRange = getNumber (_activeRadar >> "AirTarget" >> "minRange");
// etc...
Compared to:
[_someHeli, ["CfgVehicles", "fza_ah64d_b1", "components", "SensorsManagerComponent", "Components", "ActiveRadarSensorComponent", "AirTarget", "maxRange"], "number"] call WhateverYourFunctionIsNamed;
And why store it on the helicopter. You just means multiple helicopters each pay the "cost" (that is not really that expensive) that you are trying to avoid in the first place.
there is a fair amount of varying config lookup through the mod, I was attempting to build a universal call function that would check the requested path and store it for better future lookups
however if the config lookup is only 2-3x the performance hit of a getvariable, it may be a moot point, I was under the impression it was significanty more expensive to perform
Always measure first. And as my example demonstrate you can store intermediate config nodes in variables (or other things).
Perfect thank you
Unless im mistaken I having looked into it believe config lookups were made more performant by dedmen last year
From my understanding config has always been expensive. Caching config data in a hashmap should about always result in faster look up time.
I believe hashmaps were made significantly quicker though in recent years.
Comparing these two on my machine:
private _heliConfig = configFile >> "CfgVehicles" >> "B_Heli_Attack_01_dynamicLoadout_F";
private _activeRadar = _heliConfig >> "components" >> "SensorsManagerComponent" >> "Components" >> "ActiveRadarSensorComponent";
private _maxRange = getNumber (_activeRadar >> "AirTarget" >> "maxRange");
Takes 0.00174 vs:
private _arg = ["CfgVehicles", "B_Heli_Attack_01_dynamicLoadout_F", "components", "SensorsManagerComponent", "Components", "ActiveRadarSensorComponent", "AirTarget", "maxRange"];
private _key = str _arg;
private _result = cacheConfig get _key;
Which only takes 0.00141, but without handling the actual lookup part, only the happy pre-cached path.
The reproduction above was done utilizing configs we had in our missionConfigFile so it's renamed but I've always found that there is a significant performance advantage
Doing the raw config (without even getNumber) takes 0.00160s (which you have to at least once for the caching case too) of that 0.00174s
Are you "caching" the entire config tree?? Why would you nest it the hash map like that otherwise ?
In the example that I had, that's what I was doing. It was really just for the sake of messing around and testing config performance. The majority of our configs though we will cache individual data in hashmaps based off of a key. For example:
someMap getOrDefault ["className", ""]
Which for the sake of on frame code or event handlers that we intend to run quick, I've found storing config data in a hashmap is always worth it
I guess I live in a different world. I can't imagine why I would run config lookups per frame.
Well I mean we don't so we are probably living in the same one π
A config lookup is costing me 0.0008 vs a getvariable of 0.0004, not including all the other code to sort the input, output, hash
a config lookup is looking cheaper, from the looks of it dedmen has hashed config on the latter end of last year
Not a super common occurrence we have to even use hashmap look ups in our on frame event handlers, but for drawIcon3D we do have some stuff that makes it sorta necessary.
My results I had here #arma3_scripting message were produced December of last year, but no idea if I was on perf or stable at the time. Wish I'd written that down. Maybe there has been some changes since then.
Seem to cost about 0.000166875 per >> for me.
considering the tests are running x 10k, I cant see why I wouldn't stick with a config lookup now, unless I am seriously misunderstanding something here
Lol / is like tiny bit slower than >>.
If it shows faster and you're on stable definitely use config. What I tested December of last year showed me the exact opposite but maybe something changed. If you're on perf though maybe that's the reason why. Honestly not sure.
I remember seeing that on the code performance wiki, not sure why, but interesting haha
Guessing it is something about the overload of / for division
Wouldn't have thought about that, but you're probably right
Probably similar to why # is faster than select, less syntax and usage elsewhere
Also interestingly looks like config paths stored in variables save performance. Makes sense, but not sure I've really quite thought about it tbh.
https://community.bistudio.com/wiki/Code_Optimisation#Config_path_delimiter
To be clear I am not saying suggesting caching is always dumb. Just have to be wary of how it is done. If it takes work to construct the key you are already chance of losing:
Like:
private _arg = ["CfgVehicles", "B_Heli_Attack_01_dynamicLoadout_F", "components", "SensorsManagerComponent", "Components", "ActiveRadarSensorComponent", "AirTarget", "maxRange"];
private _key = str _arg;
Takes 0.00104 out of the 0.00140 to finalize the lookup:
private _result = cacheConfig get _key;
And thus we can also reason that a get "b" get "c" get "d" is not "free" either e.g. 0.00040 which is about 2.5 >> ops.
I was on perf however same performance on stable, it looks no more expensive then any other operation in sqf really
So just be mindful that being 3 times as fast in your lookup doesn't help if the caller ends up taking 5 times as long to make the key.
my whole script ended up being slower than straight config lookup
config was 1.12X faster than my script function to check a hash first
I understand and get that. Kinda just depends on whether the trade off is worth it. For us, we create those maps on players initialization while they're awaiting player data that is queried from a database, so it's not really making any kind of actual impact as they wouldn't be ready to play anyway.
Especially in the case of frequent look-ups, makes the trade-off worth it for us. You guys seem to be producing different results from what I had from December and before though, so perhaps something has changed too.
No, you are not wrong, the raw hash map lookups are fast, even for nested hash maps (Disclaimer: at least when they are small, these only have a single entry):
cacheConfig get "a" get "b" get "c"
only takes 0.00048s.
Just have to compared against entry construction (which matters litte for you at startup), and actual computing the keys themselves.
Gooood morning Arma nerds π
Im currently writing a vehicle load function. Really not a big deal, but somehow Im not able to write it
to the end.
The plan is to call
[_this] remoteExec ["EBER_fnc_loadChinhook", 2]
via the EventHandler. My problem is that tthe first addAction gets correctly crreated, but not the sesconnd.
Code:
https://pastebin.com/rdRcw9zY
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.
To get a little easier into this:
I expect the issue to be somewhere in the params of the inner addAction (green line)
Can someone analyse my screenshot and tell me if its even possible, what I try there
I never saw something similar before
I'm not saying it's not broken, or it is, but why you can tell something is wrong? What do you expect and what you got?
Good questions! Ill annwser them all
_selectloadingtarget params ["_selectloadingtarget "]; detach _selectloadingtarget
The script is ment to run on chinook helicopters to create a while clock that checks
if selcted vehicles are in range. If so, the player should become able to load one vehicle
into the helicopter via attach to,
I expect the outer addAction to remove itself on activation. The outer addAction should create
the inner addAction .
The inner one should contain the unload interaction and the ability to rerun the script on the helicopter
so the scanner runs again and the player stays able to load up the vehicle
What am I seeing? Is it the red line?
What does it change and how does it work?
I see its the second syntax of https://community.bistudio.com/wiki/params
Can you ttell a little about its benefits and usage?
...And what do you got? What is wrong with your result?
You ment like tthis?
I gues it ensures a safer variable forewarding (?)
The car is able to be loaded. But the inner addAction (green marked "unload" actionn)
So you saying the outer is done its job right, then you can select inner, but it's not doing its job?
80% correct understood
The car gets loaded in -> LoadIn action removes -> No unload action shows off
Thats the matching stringtable.xml in cases anything is wrong with the title
<?xml version="1.0" encoding="UTF-8"?>
<Project name="AttachTo">
<Package name="AttachTo">
<Key ID="STR_LOADINTOCHINHOOK">
<English>
Load %1 into Chinhook
</English>
<German>
Lade %1 in den Chinhook
</German>
</Key>
<KEY ID="STR_UNLOADINTOCHINHOOK">
<English>
Unload %1 from Chinhook
</English>
<German>
Entlade %1 aus dem Chinhook
</German>
</KEY>
</Package>
</Project>
So it is about inner addAction doesn't show it?
Yes exactly π
Who is trying to activate the action? From where?
And where is the player to activate it?
Is it in the car? Or heli? Or somewhere else?
Im currenntly runninng the funnctionn inn the innit of the helicopter (_ttarget)
I also checked if its onn a diffrennt car or at the loaded vehic, cant find it
(Definitly not at a wrong vehicle)
Then you might want to assign the inner action to the car not the heli
Thats a good thing I actually just noticed atm.
The unload interaction needs to lay at the Chinook helicopter same as the driver and the pilot
But one by one. Why isnt it currently available for people who look at the helicopter?
TThats tthe updated sscript that is currently ussed. If you would like tto research the scripts logics
https://pastebin.com/xbzQUK7p
The screenshot is taken from line 78 and below
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.
I also had a theory that the script ends before it launches tthe inner addAction.
That would be a simple scheduling issue. Is that possible if you think about?
A code will not terminate itself without an order to do so
Okay, so we can throw my theorry
What else is a possible issue?
I already told one, you are assigning the action to the heli, not the car, and you might not actually looking at the heli engine assumes so
(Bad screennshot sry)
That one is pointing at the chinooks hull. It is not available on the helicopter
Then you want to make sure that the action is actually added or not. Check the actionID of the inner one
That is my current main expectionn that doesent happen
Thats a great Idea. Maybe its not visible -> Stringtable/ Text
The easiest way I do see is to add a public var to the addAction commands and publicVar
Do you agree? Or am I wrong with my debug?
Thats it.
why _this params ["_target", "_caller", "_actionId", "_selectloadingtarget "]; and not params ["_target", "_caller", "_actionId", "_selectloadingtarget "]; i dont knw if _this will work
It will
So I need to modify my code into "select 2" somewhere in the inner addAction scope
Then chances are your text is invisible or you are simply not seeing the action
Is it because the removeAction is (maybe) synchrone with the addAction? Im also confused that the _actionID == 2
Its also odd because _this should contain the current actionID inside its scope...
I gues its time to look around to mayybe find somethinng else what could the causer
|| No hint... ||
KEY != Key
I puke
Piece in my soul.
Now I can continue. The next steps will be some logic polishishing. I already saw something else
but at first the more important thing:
A huge thanks to @warm hedge who investigated in and looked about the scheduling, wich always takes time& ennergy β€οΈ
And also probs to @harsh vine who showed me the alternate syntax and faced me with my scope problems I always have haha
Thats a win:
https://youtu.be/rev-I4L16g8
(Ive pasted the script in the video description its fully OpenSource)
OpenSource [EBER] Script: https://pastebin.com/ZP7s7w8g
Hell yeah! Congrats on getting it there. And thanks for sharing the script
of course my first thing to do is testing it with tanks and strykers π
if anybody has time and some experience with BIS_fnc_showSubtitle; I Would like to know how to get voice lines to work with it, I do know about the subtitles but not the voice lines
BIS_fnc_showSubtitle doesn't have the ability to play sounds. It only does subtitles. If you want to play sounds while the subtitles are on screen, you'll have to do that yourself, using e.g. playSound, say3D, etc.
ya i actually tried that but couldnt get that to work
would it be something like this? ```// 1. Play the sound globally (everyone hears it)
[player, "MyVoiceLine"] remoteExec ["say3D"];
// 2. Show the subtitle
["Unit Name", "This is the subtitle text that matches the voice line."] spawn BIS_fnc_showSubtitle;```
ya i got it, That code did work, But thanks for the help bro
This is just one part (and currently really only part) of an addon I am making to make complex command arguments easier. When I'm done I'll probably toss it up as a repo open source. Not sure if anyone is interested but just a little hobby project I started I figuerd I'd share FWIW :)
Oh that is absolutely fantastic, please do release that when you're wrapped up lol
trying to create a tp script and it keeps giving me a error this addAction ["Teleport to Helipads", {player setPosASL (getPosASL Pads)}];
You didnβt say what the error was
Well, did you read the error?
There's no object called helipad1
there is a empty map marker with a varible name as helipad1
Use a game logic if you need a truly dummy object
A marker isn't an object
And also that'd give a different error, since getPosASL doesn't accept a string
so how do i fix the get posasl thing?
Place a game Logic object where you want to teleport the player to and give it the name helipad1
You'll also need to remove the variable name from the marker you have
ok thank you
Alternatively getMarkerPos "YourMarker" if you prefer marker
Okay here is feature number 2.
If I am being quite honest, as much as it works well, I am honestly not too proud of how it is written behind the scenes. I used AI in the production of the UI (which I don't really have shame for) since having made large UIs, it's a tedious sucky process I'd rather avoid and AI actually does it pretty well.
What I am not proud of is that I've been using it to write the SQF. Although it's been effective in completing the tasks I've been giving it, I've had to do a ton of refactoring. Even then there are just fundamental icks with how it made it (excessive uiNamespace variables, gross returns from files which could've been avoided, etc).
Anyway, wanted to be transparent about that, as I'll probably still plan to release it as I do see people finding it super enjoyable and helpful. Just not very happy with myself for the way I did it.
That left part of the UI could perfectly fit into Display3DENEditAttributes.
Like this for example https://community.bistudio.com/wiki/Spearhead_1944_Single_Player_Mission_Parameters
On another note. Give the colour sliders the actual colour e.g. Red, green, blue
The marker type drop-down should show the marker icon
Ahhh okay I got you now. Sorry I was typing and stopped. I was unfamiliar with that class but just ran a (findDisplay 46) createDisplay "Display3DENEditAttributes"- and along with the wiki you sent, I think I kinda see the vision of what you're going for!
The drop down list for marker shape can also be triangle etc. Fyi
Also I totally agree with you on it showing the marker icon. Initially I tried to make that a controls group with the actual icons for buttons but had a hell of a time so reverted it back to a combo for the sake of testing.
Not quite sure what I was doing wrong there, but I have a feeling it was with the way I was creating the actual buttons.
Either way totally a great idea I'll plan to give another go before I merge that feature into my main branch π
Myb switch to a HTML style for UI then you can create stuff like this much faster IMO.
#arma3_gui message
I beleave dedman has a repo on his github on how to make UI with HTML.
Isn't what you linked not HTML but regular Arma UI just done really well?
The web browser implement rocks, but wouldn't I experience some worse trade-offs in this instance of not being able to interface with the game as much like with map / camera?
Presumably you can just draw the map to one side, or draw it on top of the browser.
Why does this show Generic error in expression? I'm new to scripting:
publicVariable "RCP_CACHES_PLACED";
if (side Player == west) then {
deleteMarkerLocal "cache0marker";
deleteMarkerLocal "cache1marker";
deleteMarkerLocal "cache2marker";
deleteMarkerLocal "cache3marker";
deleteMarkerLocal "cache4marker";
};```
a = true;
waitUntil{ a };
-> Instant go
a = false;
[] spawn {sleep 5; a = true;};
waitUntil{ a };
-> 5s pause -> Then go
I hope you get it π
so first I make a _cacheplaced = RCP_CACHES_PLACED = true;
then I use that _cacheplaced to check if the condition is true?
Oh no
That won't work
π
has it ever happen to anyone that player is not player (isPlayer) in initPlayerServer.sqf?
could be null maybe?
No
single = is to set the value of a variable. You can't logically have more than one of those in a single statement.
double == is used to compare two values. It's a command that returns a boolean. You can not compare two booleans though, because they hate us.
must be those one in a million glitches then, or me just breaking stuff which is more common π
does anyone know how to make vehicle stay in formation? im pretty sure this is possible but i forgot how
now the vehicles just takeoff leaving infantry behind
If RCP_CACHES_PLACED is a boolean, then you can simply write waitUntil {RCP_CACHES_PLACED}, because the return value of the script (what is inside the curl brackets) is expected to be a boolean.
oh, ok!
If RCP_CACHES_PLACED is not guaranteed to be defined you write: waitUntil {missionNamespace getVariable ["RCP_CACHES_PLACED", false]};
Note the quote marks
does ropeCreate only work for vehicles? I tried to create one on a building (Nimitz), but the ropeCreate does return nothing.
@coarse needle You should probably change the variable name of "RCP_CACHES_PLACED" to lower or camel case, because all caps is usually used for static values or macros.
I think the first object of ropeCreate has to be a helicopter (including quadrocopter drones), while the second one has to be movable
But adding a ?? would be a language feature, not a command feature.
And if modifying the language already, anything could be done.
It would not be. ?? doesn't take code block, it wouldn't execute it
Thank you @little eagle and @jade abyss ! I got it working now!
Been trying to cut down a tree with a hammer here for the past day. Don't have any experience in actually creating code, so I'm just hacking away at code somebody else made and trying to understand how things work.-
Hello. No don't ping
use getOrDefaultCall.
That gets rid of your if, then, isNil. That might make up the difference.
I enabled hashed lookups in all config classes with many entries. That would make at least the early lookups faster. But a hashmap should still win.
That is because / is multiple commands.
It needs to decide which to call based on the types you pass to it. Number or config/string.
It basically has a internal loop over all variants, with type checks for each to find the first matching one
I made type checks much faster though
You would make the right half as webbrowser and the left half as normal UI.
But if you already have working thing anyway, not worth the effort
Just to be clear, the ?? idea I was responding to there was "an equivalent to && that can do lazy evaluation without needing {}". My point was that {} isn't needed because someone arbitrarily decided the && command should do that, it's because that's the only way to tell the game not to evaluate that code right now. Changing the way the game processes code so that {} wouldn't be needed is on a fundamentally different level to just adding a new command, and while it may be technically possible, I have to assume it's such a massive logistical issue (not to mention back compat) that it's not worth considering.
{} is because && is a command-level feature, not a language-level feature.
Changing the way the game processes code so that {} wouldn't be needed is on a fundamentally different level
That is the level I was talking about though.
String interpolation and hashmap syntax are also language level features
I can't tell [genuine] whether this is a semantic thing about the difference between the terms "command-level" and "language-level", or whether you're saying it actually wouldn't be that hard to make {} not needed for lazy eval
Without language level changes you cannot make {} not needed. Lazy eval is done by inside && command itself. In fact you can argue it is not even lazy, but eager, since I guess the reference to the code object itself is actually resolved even when the code is not run in a && {..}.
I'm guessing even if-then works like that then (pun).
Both?
On language level, making {} not needed is possible, somewhat easily.
We'd need a jump instruction to jump over the code in case it should not be evaluated.
Which I already implemented in SimpleVM. That actually inlines the code, and jumps over it. Getting rid of the "call" between
I was speaking about GenCoders syntax here when he was suggesting lazy eval- #arma3_scripting message looks like I forgot an &
Yeah still, it wouldn't execute the code block if you give it one, that'd be a syntax error because it needs to get a boolean
Ah okay. My thought was a syntax like GenCoder was suggesting would be possible and that the evaluated code would return the bool required. I imagine there's some sort of order of precedence issue that I must not be understanding of why it wouldn't be possible
Ah okay read a bit more- this I am guessing #arma3_scripting message
I wouldn't be sad if only && was changed to return right hand side if left side is false or nil (or perhaps even isNull).
E.g.:
nil && 42 -> 42
nil && {42} -> 42
true && {42} -> true
11 && 42 -> 11
nil && nil && 11 -> 11
// if is null-handling also
player && SomeObj -> player (on non-dedicated), SomeObj (on isDedicated)
player && {SomeObj} -> player (on non-dedicated), SomeObj (on isDedicated)
Instead of only being bool-compatible.
I think I kinda misunderstood the syntax initially, that's what I thought it'd be and why I said it would be great for select earlier on. Which tbf thinking about more now, at that point why not use param I guess for the example I gave.
I wanna say players logging in as seagulls was a somewhat reoccurring issue we had a long time ago. No idea when during initialization it happened though but from my understanding it was an Arma issue. I think that should long be patched now though as I haven't heard of it happening in years but maybe something like that maybe? Lol.
only "weird" thing ive encounter is player being null in mission start on client, maybe this was similar
Now I think of it the instance above I mentioned probably wouldn't be a cause since isPlayer probably checks to see if the object is being controlled by a player; not the object they are? 
isPlayer could return false on objNull as well
It was if you enabled the "Stay on position" flag and the fix was disabling it in MP iirc
thanks, commy2
Hey people, is there a scripting command to execute some existing input action? E.g. in this case I'd like to fire script that among other things would use the gunElevAuto input action to automatically lase range to current target.
try finding out the input script name and call that
maybe there is file you can run or function to call
There is setWeaponZeroing but it doesn't work for vehicle turret, even though currentZeroing does =(
For a lot of other actions you can use the action command https://community.bistudio.com/wiki/Arma_3:_Actions
Yeah, I've combed through the list and nothing there seems to be about gun elevation/ranging.
Setting in manually via setWeaponZeroing is not really a solution as that command requires you to set the correct range. You'd have to get the correct range from somewhere first. Rather frustrating as in my use case you'd be staring through a range finder. Thanks anyway.
I mean getting the range is doable
Can you elaborate?
You can lineIntersectsSurfaces down the center of the screen to the first thing and then calculate the distance
I don't follow. There is a key action gunElevAuto that you can use to detect when player uses that action, but I've yet to find if you can induce that command via scripting.
Oh yea true, I've used that elsewhere. But it seems rather inefficient and complex for a script that would only ever be called when using a rangefinder.
i thought you might find the source code for the script that does what you want
Do you guys think the bug of vehicles flying and glitching due to desync and other factors (including, probably, physx) can be fixed? why hasn't it been fixed? I tested some Leopard20 mods but multiplayer still sends vehicles flying
usually vehicles fly when they are spawned inside other objects such as rocks
It's not one specific bug. There's lots of different factors that can cause physics problems - network lag, server performance, bad frame rate, ...
It's fairly fundamental to physX. Large overlap => unstable behaviour. A3 running vehicle sim at multiple localities is not really suited to it.
What I wonder is, if a vehicle is inside another object / vehicle "colision" zone, isn't it clear that it's really a bug? In which scenario would a vehicle go through another object's collision or a vehicle?
Oh also Arma's pre-spawn collision checking is absolute garbage.
Seems pretty doable to me that the vehicle could be pushed outwards, from an engine perspective, to do the proper calculations. I do not know if that's the most important factor though, I just got told the game thinks vehicle is inside something and it sends it flying
PhysX only acts sensibly when there's a small overlap.
some vanilla arma free space finding scripts are not very reliable in my experience. i have written my own for this
Arma generates large overlaps.
Yeah I wrote an alternative to findEmptyPosition that's much less suicidal, but you don't have great tools in SQF for it.
Mane I think it could be fixed idontknow
Me too and it wasn't exactly easy
Still doesn't handle the case where a building has columns.
I'm just talking about driving a vehicle and flying to space due to a collision. I cannot think of ANY possible way that a vehicle should go thru another vehicle or building like it were some noclip
That one's typically caused by vehicles being simulated at different localities the network prediction being off.
So it's pretty hard to replicate on localhost but very easy with a couple of players in different vehicles.
Oh right, server isnt the one doing the thing right?
Damn
Each player's client is authoritative about where the driver's vehicle really is in Arma. Everywhere else is guesswork.
could limit max force generated from collisions? stuff would deform or disintegrate instead
I use objetcs radiuses by default, which is faster, but less accurate. As option you can enable intersecs, which can place vehicle inside of other object radious, but can be much much slower
Arma 3 server could just take into account the two vehicles, un-overlap them, and calculate an average of the two "testimonies"
Best to do both. Radius checks work better for small objects, intersects work better for large ones.
There needs to be a lot of intersects though. Some hut in SOG stands on some little sticks
Hard to hit them
It only knows they've overlapped because PhysX says so, and PhysX is what generates the crazy velocities.
I don't know if A3's implementation of PhysX would allow them to intercede between the detection & response.
I remember seeing in wiki some mention of vehicles being like simple objects
There was smth that said that on collision you had to set teture manually and all of that, idk where but I remember
yeah that's the column problem.
But you can still do waaaay better than findEmptyPos without it being too expensive.
https://github.com/NVIDIA-Omniverse/PhysX it supposedly got open sourced like a year ago!!
Most fun thing about findEmptyPos is, that it can find empty position inside of other object, like in rock lol
Oh, I wonder what Arma really feeds it and what not
Example of findEmptyPosition doing its work:
That's not even enough space
seems to be really empty
I'm fairly sure it's actually bugged :P
Like there's "find an empty position badly" and then there's whatever the fuck findEmptyPosition is doing.
It doesn't seem to be taking too much notice of the bounding box of the object, which is odd given that you pass in the classname.
Like it finds a position that a unit could fit in, regardless of what you pass.
Is there a way to get size of object based on class?
I think it does but doesnt take into account gravity and such
Nah, you have to pre-spawn. The engine could get it if it wanted to.
The code probably has //TODO: get actual bounding radius
Maybe it just uses papercar
How do I tell if a connected uav feed is from the driver or the gunner?
I'm having an issue with my onKeyDown EH returning true to override the default action. All SystemChats are firing correctly, but the command scroll menu still comes up when I press F3. Same with the escape menu.
(findDisplay 46) displayAddEventHandler ["KeyDown", {
params ["", "_key", "_shift"];
if (inputAction "ingamePause" > 0 && player getVariable "processing") exitWith {
player setVariable ["processing", false];
SystemChat "RETURNING TRUE"; //FIRES
true
};
if (_key == 61) exitWith {
private _playerItems = missionNamespace getVariable ["playerItems", createHashmap];
private _uid = getPlayerUID player;
private _items = _playerItems getOrDefault [_uid, [0, 0, 0, 0, 0], true];
private _redgullAmount = _items select 0;
if (_redgullAmount == 0) exitWith {
SystemChat "RETURNING TRUE"; //FIRES
true
};
_items set [0, _redgullAmount - 1];
[[-1, 0, 0, 0, 0]] remoteExec ["TRI_fnc_updateItem", player];
[player, getPlayerUID player, 0, 180] call TRI_fnc_handleBuffs;
SystemChat "RETURNING TRUE"; //FIRES
true
};
}];
sorry for the late reply. this code isnt working for me either. here is what I tried:
(findDisplay 46) displayAddEventHandler ["KeyDown", {
params ["", "_key", "_shift"];
SystemChat "EH FIRED"; //FIRES
if (_key in (
actionKeys "CommandingMenu1"
+ actionKeys "CommandingMenu2"
+ actionKeys "CommandingMenu3"
+ actionKeys "CommandingMenu4"
+ actionKeys "CommandingMenu5"
+ actionKeys "CommandingMenu6"
+ actionKeys "CommandingMenu7"
+ actionKeys "CommandingMenu8"
+ actionKeys "CommandingMenu9"
+ actionKeys "NavigateMenu"
)) exitWith {
SystemChat "RETURNING TRUE"; //DOES NOT FIRE
true
};
false
}];
The first SystemChat is firing correctly, but the boolean seems to be false for keys F3, F4, F5, etc
F keys are for unit selection. They don't do anything to command menu
Maybe besides opening it when first unit get selected
im talking about this
maybe my controls are weird... I guess I shouldnt be disabling this with the F keys, but instead with the actionKeys
And that gets operated by mumbers. The line of line numbers bellow F keys
hmm
Might be as @dusk gust said then here #arma3_scripting message
ah
I guess I'll just do what he said, showCommandingMenu ""
but im still having the same problem with the escape menu. can i prevent it from coming up when a player presses ESC?
if (inputAction "ingamePause" > 0 && player getVariable "processing") exitWith {
player setVariable ["processing", false];
SystemChat "RETURNING TRUE"; //FIRES
true
};
You could potentially disableUserInput if they aren't supposed to be doing anything during that period but that's a little dangerous. Could also probably just have something on frame to close the escape display too and that would probably be better, but I don't have a solution at the current moment since on my phone. I know a wiki page with default idds exist though
not sure but probably:
private _ai = getConnectedUAVUnit player;
private _isGunner = _ai == gunner vehicle _ai;
oo fancy 2.08
unfortunately it returns null unless i'm assuming direct control
Is there even more than just the gunner view?
Right, for now I'm assuming if there is no gunner then it must be driver.
But if that isn't the desired behaviour I can make a ticket xD
Threatening Leopard20 with a good time I see π
what do the other commands return, like UAVControl or getConnectedUAV?
I included in the screenshot that the non-unit returns the uav vehicle when just connected and not taking control
ah right I see now. but what about UAVControl?
Can check in a few :)
nvm I think I got my answer based on this example:
Leopard wow you work at arma
Why would you make a mod to fix the flying glitch instead of fixing it from engine itself?
They didn't work at bohemia then
exitWith dont work within Eventhandler, https://community.bistudio.com/wiki/exitWith look at KKs comment from 2016
At least, he is trying π
with missiles is it possible to have a submunition when deployed be locked onto watever the initial parent munition was?
Oh aight
Leopard you have a chance to do something great here!!
I used their mod for the flying fix
And you can use a car to βpushβ other which is great
Really really great
But only works on local
Interesting. My friend made a complete, fully working and non-trivial feature with three prompts with Claude Code. He instructed the AI to use only BIKI as the source of information/reference which probably contributed to the successful end result quite a lot. The actual code is a bit verbose and just a tiny bit confusing in some places (to me at least), but it's definitely readable still
He could add RAG to Claude
Claude + RAG will read from a documents folder where you can have the whole wiki scraped / a lot of code / your codebase
Claude is too expensive tho, if friend uses a lot of credits monthly, tell him to consider using openlimits.app which is Claude but without ratelimits and unlimited credits
The AI gets automatic move order to player's waypoint upon spawn if the feature is turned on via hotkey. If the waypoint is lacking, too close to player (< 25 m) or the feature is turned off, AI will start following player normally
NOTE: Arma 2: CO! I'm having issues with canMove command. It doesn't detect disabled tracks on tanks or disabled tyres on wheeled vehicles. The vehicle must be close to being completely destroyed before it returns false. Is there alternative for it or am I doing something wrong?
sorry what? I don't have such mod 
perhaps a modded vehicle?
Nope, fully vanilla. It's weird
Tested with several tracked and wheeled vehicles
that's⦠definitely weird. Maybe you can get hit point values then?
Tried to find the config references but apparently some of the parts are in Czech only and couldn't find an exhaustive list, hmm
The lovely legacy π
this might have most: https://community.bistudio.com/wiki/ArmA:_Armed_Assault:_Selection_Translations
Thanks! π Just discovered the track selection names, still missing wheel related ones though
kolo
What about pneu? It seems to equal to tyre
at least what ive seen in selection names kolo is more common
Alright, I'll test π Thanks!
while {alive _tracked && !(isNull _tracked)} do {
sleep _refreshRate;
_markerName setMarkerPosLocal (getPos _tracked);
_tracksDisabled = false;
_wheelsDisabled = false;
if (_tracked isKindOf "Tank") then {
_tracksDisabled = if (((_tracked getHit "pasL") > 0.3) || ((_tracked getHit "pasP") > 0.3)) then {true} else {false};
};
if (_tracked isKindOf "Car") then {
_wheelsDisabled = if (((_tracked getHit "kolo") > 0.3) || ((_tracked getHit "podkoloL") > 0.3) || ((_tracked getHit "podkoloP") > 0.3)) then {true} else {false};
};
if ((_wheelsDisabled || _tracksDisabled) && alive _tracked) then { // Line 49
_markerName setMarkerTextLocal " X";
} else {
_markerName setMarkerTextLocal _markerText;
};
};
``` Next question: Why on earth I get the following error of undefined variable π:
```if ((_wheelsDisabled || _tracksDisabled) && a>
Error position: <_wheelsDisabled || _tracksDisabled) && a>
Error Undefined variable in expression: _wheelsdisabled
File mpmissions\__CUR_MP.chernarus\Common\Common_MarkerUpdate.sqf, line 49
Error in expression <.3)) then {true} else {false};
};
I think I figured it out actually: getHit returns Nothing when there's an invalid selection
That could cause if to return nothing, sounds legit
Btw, you don't need if, when you just want to return true or false. You can just use whatever condition returns directly: _bool = condition. There is no need for entireif condition...
Yeah, I added them when trying to figure out why the variable was nil. Will do π
Every selection returns nil π
diag_log (_tracked getHit "pasL");
diag_log (_tracked getHit "pasP");
diag_log (_tracked getHit "podkoloL");
diag_log (_tracked getHit "podkoloP");
diag_log (_tracked getHit "kolo");
``` prints nothing 
You need to set the areaRadius correctly.
The vehicle type is only used to determine where the vehicle can be. A boat won't be on land, a car won't be on water.
It then builds the AI pathfinding grid, based on the vehicle type.
And uses the pathfinding grid to find squares that could accomodate it
You could grab the UI and read the text in the control, does it not display different text at top for driver vs gunner view?
getHit doesn't return nil, unless _tracked is nil
getHit always returns a number
It's Arma 2: CO, apparently getHit can return nil then. According to BIKI returning a number in all cases applies to Arma 3, but not A2
Ah possible
you can use⦠the HitPart event handler to get selection names?
https://community.bistudio.com/wiki/Arma_2:_Event_Handlers#HitPart
(or HandleDamage, or Dammaged(sic))
I was about to suggest getAllHitPointsDamage, but that's new in Arma 3 apparently π
Thanks for the tip! Gotta go now but I'll try it later today when I'm back home π
other suggestion would be to do a config dump and look at class hitpoints
I didn't figure this out cuz I'm terrible with gui. But I did find this
_allUAVcams = allCameras select {_x # 1 # 0 # 0 == "uavpipsingleview"};
//[[1780505: <no shape> Camera,[["uavpipsingleview","Internal","Normal",0]],false]]
Then I can get the camera position and compare to uav memory points positions
Mr dedmen now that physx is open source can we try to unbug it?
Oh right, apparently I didn't read findEmptyPosition's description for four years and it used to say that the first parameter was the minimum search radius.
The PhysX we use has been open source for a very long time.
And I don't understand how that is related to UAV camera..
Oh yeah I wanted to reply to the bounding box thing which derived from a PhysX conversation
Because I was wondering whether the vehicle overlap and all that could be fixed on the engine and why it hadn't been done yet
Did you know that you can choose to turn off the ping when you reply to someone
Yeah, took a bit to figure out last I was messing with it. Fwiw, in my testing sizeOf typeOf vehicle _unit was equivalent to (0 boundingBoxReal (vehicle _unit)) select 2 so we use the former in our fast travel position search.
Yes but it's not muscle memory
Hold shift when you reply and it doesn't ping
do we have a way to set a created ammo/shell a side? so that AI will react to it? maybe add a separate createAmmo instead of using createVehicle? or maybe an additional arguement to triggerAmmo to determine the side?
Is there a script that would force off all lights for an aircraft? Thereβs a bug with the dev version of simplex that lots of aircraft get their collision lights forced on which obviously isnβt great when a helo or plane are doing a strafing run with blinking red and green lights.
Iβve tired β_vehicle setCollisionLight false;β which has worked for some aircraft but not all of them so was curious if thereβs a blanket solution? Or if I need to find out if modded aircraft have extra light settings or something that wouldnt then be covered by setcollisionlight
In theory setShotParents is how you'd do it, but it's got some serious limitations.
see also: https://feedback.bistudio.com/T180763
Hi folks. Was wondering if anyone had some suggestions for settings to use with setAperture for a night op? I've got a group of folks I'm running a D-Day parajump op for and the default Arma darkness is too much for them to function in without night vision.
"Default arma darkness"???
IME, unless map config broken or something, night visibility is governed by moon phase, from pitch black to NVG nice, but mostly unnecessary unless attacking from wrong direction in hilly terrain.
And varies by cloud cover of course
D-Day was done at full moon
Trust me I think it's ridiculous too, it's just a complaint I hear a lot
most of us probably just change the date time to match a more full moon kind of night
Right on. My group was insistent that the aperture should be adjusted so I figured π€·ββοΈ
unless you are doing some building intersection checks, you're gonna toast everyone's eyes when they enter a lighted building with setAperature
@lone glade VS Code is absolutely great apart from this one big problem - http://i.imgur.com/CiG8ZCd.png - the highlight on closing brackets is barely visible and i can't figure out how to change it
can import textmate themes and hack seemingly the whole UI of VS Code just using html/css/js but change the highlight of closing brackets? nope
https://community.bistudio.com/wiki/enableVehicleSensor
This command is GA LE, being LE... does that mean this needs to be remoteExec 2 for it to take effect for all people?
If its run just on the computer where the vehicle is local could other people still see it as active and be locked by that vehicle? haha
https://community.bistudio.com/wiki/Multiplayer_Scripting#Locality
do you still think the same thing after re-reading this?
I don't think it makes sense for it to actually be LE?
Unless I'm misunderstanding the relation between sensors and radar. Which I probably am.
I agree, I feel it should be LE GA at best, trying to test in a dedi server with people now
Maybe sensors are just for UI logic and AI spotting checks and therefore they could be local, while active radar state is separate and global.
I think you might be right there. I couldn't test because I couldnt get the other players RWR to pick up I was locking it even fired a missile, I'll test mor when I have a guy free
So what's the scam on this? Clicking the picture?
If I was to guess the intent is to bait people to going to the website in the first picture then from there either phishing or session token cloning to steal an account
hi
just to be sure, the script
[myObject, true] remoteExec ["hideObjectGlobal", 2];
will show myObject ?
my bad, after re-reading it, the "true" at the start means it will hide it
I was confused by the "2"
2 is the locality target. It's part of remoteExec, not hideObjectGlobal. It means the command will be sent only to the machine with that network ID; 2 is always the server. That's correct for use with hideObjectGlobal because it only works when executed on the server.
and if you run the hideObjectGlobal on server you dont need remoteExec
any scripted way to add external target camera to object ? π€
The trigger's "On act." code can also be launched on client and/or server sides.
what is the "20Rnd_12Gauge_AA40_Pellets_Snake_lxWS" mag round classname ? π€
Look for the magazine in config
getText (configFile >> "CfgMagazines" >> "20Rnd_12Gauge_AA40_Pellets_Snake_lxWS" >> "ammo")
@hushed turtle nice idea, found it -> "B_12gauge_Pellets_Cartridge_lxWS"
I am trying to make "antidrone" rounds for AK-12 but no luck for now, any suggestions? 
player addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
deleteVehicle _projectile;
private _newProjectile = createVehicle ["B_12gauge_Pellets_Cartridge_lxWS", getPos _projectile, [], 0, "CAN_COLLIDE"];
_newProjectile setVelocity (velocity _projectile);
_newProjectile setPos (getPos _projectile);
}];
I just want to shoot AA12 rounds, because I don't want to avoid using a mod that enables two primary weapons
I have the feeling it just adds one pellet lol
Well you're deleting _projectile and then trying to do getPos etc. on it. You might consider doing it in the opposite order.
Also, use getPosASL/setPosASL or getPosATL/setPosATL instead of getPos/setPos. It's faster and more reliable.
@hallow mortar I tried wihtout deleting it, its the same story, just the old round is flying (or the normal round plus one pellet )
I didn't say "without deleting it", I said delete it after you get its position and velocity instead of before
I tried
player addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
private _newProjectile = createVehicle ["B_12gauge_Pellets_Cartridge_lxWS", getPosATL _projectile, [], 0, "CAN_COLLIDE"];
_newProjectile setVelocity (velocity _projectile);
_newProjectile setPos (getPosATL _projectile);
deleteVehicle _projectile;
}];
but no joy, the only thing is it deletes the old projectile, or pellet is too small to see it ...
Use setPosATL instead of setPos
I swear it worked for the first round then nothing ...
player addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
private _newProjectile = createVehicle ["B_12gauge_Pellets_Cartridge_lxWS", getPosATL _projectile, [], 0, "CAN_COLLIDE"];
_newProjectile setVelocity (velocity _projectile);
_newProjectile setPosATL (getPosATL _projectile);
deleteVehicle _projectile;
}];
I am shooting blancs ...
π
Adapt this script:
player addEventHandler [
"Fired",
{
params ["_unit", "", "", "", "_ammo"];
if (!(_ammo isKindOf ["BulletBase", configFile >> "CfgAmmo"])) exitWith { };
_bullet = nearestObject [_unit, _ammo];
_bulletPosition = getPosVisual _bullet;
_bulletVectorDirection = vectorDir _bullet;
_bulletVectorUp = vectorUp _bullet;
_bulletVelocity = velocity _bullet;
deleteVehicle _bullet;
_rocket = "R_PG7_F" createVehicle _bulletPosition;
_rocket setVectorDirAndUp [_bulletVectorDirection, _bulletVectorUp];
_rocket setVelocity _bulletVelocity;
}
];
It seems to be because of that ammo specifically, I tried with a .50 round and it works fine
Probably because of how it works with submunitions I guess
Maybe it needs triggerAmmo?
Tried that with no effect
If you're up for making a mod at all, you can make a mod that adds shotgun shell magazines to the AK-12 - no need for separate weapons.
If it has to be scripted without mods then it seems like there's going to be an issue.
@faint burrow holy moly its working ! π₯³ thanks to all
π€
here it is the working version if somebody want to have some chance against drones
player addEventHandler
[
"Fired",
{
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
if (!(_ammo isKindOf ["BulletBase", configFile >> "CfgAmmo"])) exitWith {};
_bullet = nearestObject [_unit, _ammo];
_bulletPosition = getPosVisual _bullet;
_bulletVectorDirection = vectorDir _bullet;
_bulletVectorUp = vectorUp _bullet;
_bulletVelocity = velocity _bullet;
deleteVehicle _bullet;
_pellet = "B_12gauge_Pellets_Cartridge_lxWS" createVehicle _bulletPosition;
_pellet setVectorDirAndUp [_bulletVectorDirection, _bulletVectorUp];
_pellet setVelocity _bulletVelocity;
}
];
... Just use submunitions?
_bullet = nearestObject [_unit, _ammo]; ```
So why are we doing this instead of using the provided `_projectile` reference?
And what's different about this script that makes _that specific ammo_ work, but not the other way?
Presumably because they are trying to do this without a mod.
*with a mod you wouldn't even have to use submunitions beyond what the shotgun round already does, just let the gun fire the shotgun rounds
that'll do it
I should make a salt shot round
hit = 0.01
good question π
I still want to figure out what the hell is different between these two methods.
With the original method, a normal .50 bullet is created and correctly replaces the original round, but a shotgun shell does nothing.
With Schatten's method, a shotgun shell works. What causes this difference? The difference in positioning logic shouldn't matter; it was working out fine for the .50 round. Is it the other createVehicle syntax?
It's the setVectorDirAndUp
Normally direction doesn't matter for bullets, but for this one it does because of course that's used for submunitions
_bullet = nearestObject [_unit, _ammo]; ```
This part is still pointless though. Just use `_projectile`, it's provided by the EH so it's faster than doing `nearestObject`.
There is a chance you could catch differnet projectile with nearestObject π
yeah, if players fires RPG with this evenhandler on
but this prevent it, right ?
if (!(_ammo isKindOf ["BulletBase", configFile >> "CfgAmmo"])) exitWith {};
but i can easily filter it with "_weapon" param anyway
this will make it work with only one type of magazine
if ((typeOf _weapon != "arifle_AK12_GL_lush_F")) exitWith {};
if ((typeOf _magazine != "30rnd_762x39_AK12_Lush_Mag_Tracer_F")) exitWith {};
etc ...
typeOf is not needed, _weapon and _magazine are already classname strings
That isKindOf is used to check whether the projectile being fired is a bullet. The point of that is to exclude other types of weapons like rocket launchers, hand grenades, etc. If you have a more specific check against the weapon or magazine, you don't need it.
That isKindOf does not prevent against possible misidentification with nearestObject. In theory (though it's a pretty small chance), another projectile of the same type could be passing closer to the player than the fired ammo is, which would cause nearestObject to target that other projectile instead of the one you just fired.
That's part of why you should just use the provided _projectile reference instead of doing the whole nearestObject thing.
@hallow mortar actually the chance is very big because all team members will use AK-12 and they will be shooting close to each other
player addEventHandler
[
"Fired",
{
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
if (_magazine != "75rnd_762x39_AK12_Lush_Mag_F") exitWith {}; //makes this mag "antidrone mag" :)
_bulletPosition = getPosVisual _projectile;
_bulletVectorDirection = vectorDir _projectile;
_bulletVectorUp = vectorUp _projectile;
_bulletVelocity = velocity _projectile;
deleteVehicle _projectile;
_pellet = "B_12gauge_Pellets_Cartridge_lxWS" createVehicle _bulletPosition;
_pellet setVectorDirAndUp [_bulletVectorDirection, _bulletVectorUp];
_pellet setVelocity _bulletVelocity;
}
];
sript is working fine with "_projectile" param as you suggested π
You should still have your checks for weapon and magazine, so this EH isn't firing for other weapons they might have. I said typeOf wasn't needed, not that the entire check wasn't needed.
@hallow mortar just added it π
If you have a specific magazine check, you don't need the isKindOf bulletBase check, because you know that magazine only contains bullets
seems like a theme issue
vs code is a piece of shit when it comes to defining your own lang
its even more PITA then arma dialogs
Is there a way to set the zoom of turrets with continuous zoom optics (as oppose to discrete optics modes) like the rcws ugv?
https://steamcommunity.com/sharedfiles/filedetails/?id=3704064685
https://github.com/milorules1012/SQF-Lab
And for anyone else who will find it useful π
Haven't added a CONTRIBUTING.md but if anyone wants to add anything or whatever, feel free!
-# Very early stages, but I was eager to create a release :P
no matter what language or theme, the closing bracket highlight is barely visible on my machine. i know it's off-topic but if anyone knows a solution i'm all ears
checked on this further and you are correct. It just disables the component for that person not the vehicle. I dont think there is a way to hard turn off and keep off a radar unless you do that command with remoteExec 0
is flyInHeight broken because i can make heli go down to 40m but not below. the wiki says 20m is the min
Did you try the alt syntax?
yes
and getPosATL returns > 20?
yeah
Idk then
Trying to have a hint display after a countdown, but I am getting an invalid number error. Any help greatly appreciated:
with uiNamespace do {
[
[
["TESTING...", "align = 'left' shadow = '1' size = '0.7' font='PuristaBold'"]
],
0.256
] spawn BIS_fnc_typeText2;
playSound ["zoomIn", true];
uiSleep 0.3;
playSound ["assemble_target", true];
uiSleep 0.5;
playSound ["surrender_fall", true];
[10] call BIS_fnc_countdown;
call BIS_fnc_showMissionStatus;
waitUntil {
(missionNamespace getVariable ["BIS_fnc_countdown_time", 1]) <= 0
};
hint "Done";
sleep 5;
hintSilent "";
};
is 0.256 valid there? pls post the error msg
0.256 is valid, that number has to do with the scrolling text. The invalid number, it says, is at the hint
tried only having hint "Done";, which works, but the hint won't display after the countdown
Is there maybe a better way to have code be initialized after a countdown?
What is initialisation of code why after countdown?
pls post the error msg
wierd... error isn't popping up anymore with the exact same code... hint still won't display tho
Because I want a hint to be displayed after the countdown ends
waitUntil { !([true] call BIS_fnc_countdown) };
holy hell, that worked, thank you ^^
if you have an object above that height they won't go lower iirc
ah wait 20m. right. yeah between 10 and 20m doesn't work. lower than 10 does work. idk why
just verified that. weird
flyInHeight command needs fixing scotty
the command it self is buggy
in game
see our convo above with leo
Heyo, quick question.
Is sending large hasmaps over network a bad thing?
Context:
I am storing values on the server from each client once per second.
Then I am sending those values to the Zeus client(s)
If there are 30 players, that's 30 messages from the server to a Zeus (because the values are stored on the player object).
So I'm wondering if instead using a hashmap containing player objects and their values being sent once per second to the Zeus is better than 30 messages per second of singular values.
the main concern here is how big/many the values are - if they're numbers or small strings it's fine (as long as you're sure theres no other way of doing it, like measuring whatever you're measuring through zeus instead of the server to avoid networking etc)
the hashmap should in theory be less expensive because it's less individual calls
The format would be [UID, [data_1, data_2, data_3, data_4]]
Where the player UID is the key, and the data is just numbers iirc
I see. Well, i dont know the exact use case but it boils down to only sending them when theyre needed or updated instead of per second, or measuring locally instead of through server (if possible) - other than that if you need the data then you need the data, just gotta find ways to make it optimized, tho honestly given the example its not a big deal
The use case is for the FPS monitor mod that's on the workshop, so chances are it will be updated every second π
Gotcha - youre fine then, far as im aware numbers are cheapest besides bools in network anyway, plus youd be surprised how much data mods send over network that is at larger scale than this and you dont notice a thing
the only thing i'd optimize in your case then is avoid sending if the fps monitor is turned off - and maybe add margin of error (i.e if fps is within 3 frames of the previous networked framerate you discard it, etc)
Noted, thanks again.
Why bother with a hashmap?
Why not just setVariable ["CalculatedMeanFPS", _fps, true] locally on each player machine and let the zeus clients read it ?
Because that's worse? :P
more command calls and more network queue
The intended goal is to debug performance issues for clients? The entire cost is dominated by how data is analyzed and emitted not how often it is sent.
well his question was explicitly about network traffic
Before 2.20 I'd have said the vast majority of the cost there would be the network traffic. Even from a server CPU perspective.
the hashmap method would in theory be less network traffic so it's ideal to go for that (i could very well be wrong based on my assumptions but π€·)
How are hashmap's less traffic by nature of being hashmap?`
Surely the benefit here is you only forward from server to zeus clients.
and heck even CPU time - calling setVariable once per player is gonna take longer than sending one single variable in mission namespace that contains a hashmap with all players
It's not. It's because it's N times fewer packets sent.
Are you saying arma does not compact messages into fewer packets?
It does, but it's not very good at doing that very quickly.
Consider that it's also N times as many JIP queue entries to handle.
And that one used to be the limiting factor.
tbf ideally you wouldnt use the JIP queue anyway and should just send directly to the zeus client ID instead
setVariable true is JIP
^ yeah true.
With the bulk array/hashmap then you could skip JIP entirely (and you should).
True JIP affect was stupid of me. But JIP issue is completely orthogonal here and has nothing do with hashmap.
Hashmap or array is irrelevant, but there isn't any other way to send bulk data that I can think of.
Oh, I guess you can make it into a string.
Might actually be cheaper but whatever :P
Anyway, without knowing the intended usage of the data, I still suspect it does no way require 1s resolution.
Would be nice if we had way to send unreliable communication in Arma.
That never "existed" in customer version as the note says.
And of course requires proper network setup for both, but especially receiver, port forwarding etc.
yeah, but i imagine it means the game at least has the sqf integration for it and whatever underlying system is needed
or at least parts of it π€·
good thing extensions exist, just make your own 
I am not going to ask people to run an extension unless it is truly necessary for something serious.
Already surprised data extraction/ransom attacks haven't happened already in certain arma communities
well the extension page does make it very clear on multiple occassions that they're dangerous - plus your game wont even launch it if you have battleeye and it hasn't been whitelisted, so i'd say there's enough measures in place already to prevent that
That is not the level users operate at. Some server runners use extension, people complain they can't join, they tell people disable BattlEye and join. The typical user does not even know they are running "arbitratry code".
fair
I never really messed with hashmaps over network because it sends all of it. Say I have a 100 element hashmap, or in my main use, hashmap objects, and I only want to change a couple of things at various times. Do we have any metrics on that kind of scenario?
maybe there should be a warning if you start the game with battleye disabled and mods enabled, something along the lines of "If you've been asked to disable battleye for a mod, beware that this might be used for malicious purposes"...
a popup with a dont ask me again but then at least the users would be warned
The goal is for a mod that displays the client's FPS live to the Zeus when he's Zeusing. ALlowing you to notice if your player's FPS is dropping in anyway.
So if there is a heavy 15s drop, but no zeus was around to see, did it matter or not ?
i'd imagine it's intended to be used with zeus only lol
If there is a 2s heavy drop, the zeus saw, but it went away did it matter.
there's always a zeus in some groups
Aren't strings the WORST thing to send over network? >_>
Nah, depends on the data.
I mean don't get me wrong. Your Arma will probably work fine almost all the time without issue if 100 players, send each second to 4 zeus.
But that one guy with bad connection is gonna slow down other traffic(message processing) when his "reliable" messages drop and must be resent
From my experience Zeusing it does matter. It specially helps if the drop remains until you start cleaning or handling it.
tbf that's a risk that exists even without that mod, setvariables over network are everywhere in arma, but also are we sure arma doesn't work around that? i've never had a slow-network client impact other clients
I mean in all honesty? The original mod who I've heard people complain about its code never caused issues for me
the original mod just used lots of lazy scheduling iirc, also didnt display the fps smoothly
and for ~30 players it sends near 1000 network messages between them overall, (each player receives ~30, and sends ~30.
Well can only speak to my own experience. But my traffic 98% originate because some events that must be synchronized (reliably acknowledged) anyway. I can't of the top of my mind think of a case where I wanted regular interval-based time traffic.
Yea but I've had people complain about the number of messages sent, mainly on the theory it is bad, but in practice I've used the mod without any noticeable impact with heavy performance scenarios.
None the less I'm trying to spend the time to improve it where I can
Which is why my original question came up
Does anyone here have a resource about network trafic in Arma 3? Or is it a black box?
mm... if you use tons of other mods though and not just your own, you can be sure plenty do a setvariable frequently
Yeah, and they need a really good reason or they are bad...
Sturgeon's law et cetera
true
That's the thing. You can get away with one mod doing lazy shit with one variable, but it adds up.
I am impressed with the things people "get away" with network wise in Arma 3, but that might be shaded by my old Arma 2 experience of how wrong it can go.
well also people today have generally good enough internet to brute force through it
which isnt ideal, but its true π
Acre sending 16MB lumps on init was pretty funny
Another kind of related question, is there any benefit of just sending an array of arrays instead of a hashmap?
I think what you find on the BIKI is the most documented. From Arma perspective all you really know that it is: Reliable ordered traffic: (so on dropped packets the sender must resend, and receiver does not process certain remote execs, publicvariables, certain events until the missing dropped ones have been properly received) .
Any specific BIKI entries?
Not sure in your array of arrays example. But by sending only an array with specific position containing certain values, you save on sending the "keys" part.
No, most is covered here and in the specific commands https://community.bistudio.com/wiki/Multiplayer_Scripting
Well the arrays would contain the "keys" in any way since the keys are player UIDs
Chheers
Unless hashmaps have a higher cost then I'd just go with them, since look-up is faster on the Zeus side iirc
Unless you have a lot of constant keys I don't think the difference will matter. Since you pretty much only has one I doubt you measure any difference.
Best you could maybe do is maintain an ordered list of players separately, because that would change much less frequently than the frame rates.
probably not worth it though, assuming that you're only sending to zeuses.
Yea, chances are hashmaps will be just fine, hopefully
It's a lot of extra complexity for not a lot of saving.
I would just do more collation on client side. Like gather 10s of data into min fps, max, median, average, 95 percentike, 25% percentile and send only every 10s instead.
And zeus clients could keep the data, so visualize data for a player over longer periods.
Though you can do that with per-second fps too of course.
Then it wouldn't be accurate / you'd assume whatever you're seeing is 10 seconds old on the Zeus side.
What I can also do if I got the time is make it so instead of just a hardcoded every 1 second, make it a CBA setting, that each server can set.
I guess I just don't understand the problem to be solved is?
So Zeus spawns something, and monitors player whether FPS drops?
Suppose it do for 3s but then get back up what now ?
having used an fps monitor before, partly yes it's about knowing whether the thing or things you just spawned are causing issues, but also generally just gauging performance - if your players are at 20 fps and nobody is saying anything, but they're stil suffering, you'll be more inclined to start deleting things or disabling stuff etc
The mod it self is already on the workshop, I am more or less trying to optimize it.
How you use the data of a player's FPS dropping is up to you.
Personally I use it to tell if only a certain player is having FPS issues, or if everyone suffered from a certain spawn, or certain event, or effect happening.
This was my understanding as well.
Sure, but how is it a problem with 10s old data?
in theory it isnt, 10s should be fine, but you can apply that same logic to a lot of things - 1s is already optimized enough, you're sending like... a couple hundred bytes if you're at like 20-30 players per second?
Not about bandwidth, but packet reliability
The issue with sending a packet every 10 seconds of the last 10 seconds of data is that I need to rewrite that part of code to do it
i guess... but even then, it's once per second, lots of mods already do a lot of traffic on a sub-1-second interval and there are no issues π€· arma seems to gracefully handle it
Put plainly, I am only willing to put so much time and effort to solve a problem that in my experience does not exist.
I am more or less doing it so others stop complaining about it because the code looks bad.
Like Kharos said, chances are other mods do A LOT more than this mod does, but ey what can you do,.
I can fix and improve systems. I can't fix people.
that's why i recommended something like an fps error margin (<5 fps difference since last networked message is ignored), and not sending data if zeus doesnt have the monitor active, etc
Yep that is actually a real neat idea
The base for that already exists, right now it does not send it if the FPS is the same, but let's be honest, how often is FPS the same over an entire second?
So adding a margin of 3 or 5 or so one would be a great way to handle it.
this is also a "do as i say, not as i do" since for my fps monitor i didnt bother with that π
Could even make it a CBA setting as well, so that people can configure the mod to their liking
i mean fps is average, if you're frequently jumping 5-10 frames average delta per second then you've got a problem π
Glance more or less at the ground/sky ?
Welp, thank you all for the help so far
true, tho wouldnt happen often - granted this solution would maybe reduce the traffic by 10-20% becuase.. yeah, as you said, looking in different directions, but we are trying to optimize π
This cleared up a lot, and helped solidify my understandings a bit more so I can do it.
We've done a lot of network optimizations over the years, the largest thing that was hurting us was JIP queue. Although we also had tens of thousands of messages.
If you're broadcasting data on a regular interval, and you're only broadcasting it to server; I don't think you'll really have any network issues. Packet loss would be more your concern as Muzzle Flash mentioned but obviously there's ways you can case for that.
My advice would be not to set the data public though and instead just send to server.
yeah i think even the original mod is essentially just sending to server, which then sends only to zeus
nothing is being public-ed to all clients
granted you could optimize further by sending directly from each client to zeus (yes the game does send traffic through server anyway but it's technically one less step) - just public the current zeus' client ID and have the sending happen that way
Well the current version I am working on is setting public
Oh no
So it's each client updating the variables for EVERY OTHER client
Ignoring the collection details and visualization, this is basically how I would do it:
// Player side Send every X second (_toTime - _fromTime) basically.
private _data = [player, [_avgFps, _maxFps, _minFps, _medianFps, _fromTime, _toTime]];
_data remoteExecCall ["FPS_Monitor_Ingest", G_ZeusClients];
// Zeus side: Receive (FPS_Monitor_Ingest):
params ["_owner", "_data"];
_owner setVariable ["FPS_Monitor_Latest", _data];
// Add to like 30 minute history buffer that Zeus could also access. Maybe a graph in GUI?
[_owner, _data] call FPS_Monitor_AddData;
Yeah focus on fixing that
incredibly wasteful
Huh having the data to be accessed later would be interesting
That'd be a down the line thing though but it's a real nice idea to visualize things as well
That was just optional. The data over time part is more important. Then you could even compare if a drop short while ago happened for all or just some.
Jokes aside yeah its good MP diagnostics to measure through a mission lifetime, never thought of that
I think also one thing that wouldn't hurt if not discussed already is only having it listen if a Zeuse client is actually awaiting results. No point in sending updates unless the Zeuse client toggles the feature maybe
Also having control over which clients the Zeuse client wants to monitor, then it doesn't have to inherently be everyone if diagnostics is only needed for one person
Kinda just thinking about if I was going to do it, ultimately constraints of how you wanna make the project is up to you; but FWIW :)
If still want history, one could do hybrid by coalescing, say 10 updates, when not actively monitored to ensure history is transmitted around (so it would not have to be done in one large bulk later), but upon active monitoring set the update rate back to the default.
Hence the "down the line" a.k.a.when I got the will and energy xD
So my plan is add the Zeus UID to a list on the server whenever the Zeus interface is open
and remove him whenever it is closed
Technically doable so no updates are being sent unless also the UI for the mod is activated
But that's a can of worms I don't wanna get into sincce it is not my mod
That's true. Validate the fps by camera angle and face-to-wall-ness, maybe by distance to nearest thing in center of screen from cursorObjectParams
At that point I wonder if you're using more resources than you're saving xD
No network* resources though ;)
Issue with that is most objects arent occluders so fps isnt affected by looking at a wall
Valid xD
setName syntax 2 allows you to set a first and last name for a unit, as well as the "all-in-one" name set by syntax 1.
What command allows you to get the first and last name?
BIS_fnc_getName?
That just does name internally
Hmm, name does return the name, like Nicolai Dvostok or something though. So that, split returned string for first and last. I use a roaming AI script that does a name on the leader of an AI group and it sends a radio message with that AI's name...
name returns the "all-in-one" name, which for default names probably includes both first and last names. But if you've done setName syntax 2 with some different name, it does not return the separate first and last names.
Oh, Sounds like a job for feedback tracker...
Source: did _unit setName ["test", "aaa", "bbb"] and name _unit returned "test"
Is that because it would be expecting sqf player setName ["Ben Kerry","Ben","Kerry"];like in the third example and yours should be sqf player setName ["aaa bbb","aaa","bbb"];?
Though I have no idea what the addition of the last two parameters is used by...π€·
That seems like it would be a little bit pointless
Thus my last comment π€£ Maybe it was used... but doesn't really make sense since that syntax was added in ARMA 3 1.02?
The game has some kind of capacity to distinguish because it makes the distinction in e.g the commanding HUD
Maybe the last name to clearly identify it for this: Only last name will appear in command bar i.e. this setName _myNameArray will display _myNameArray select 2. If setName is used with a string e.g this setName "blah", nothing occurs in the command bar and the default randomized name is displayed? But just guessing
Like if you had a character named John W Ick?
It could be more useful if there was a way to actually get it :U
Hopefully Dedmen will pop in...
is there a way to limit max free camera distance from player for BIS_fnc_EGSpectator (vanilla spectator)
*zoom
I don't think that answers the question.
He was looking for max free camera distance, not being locked into one view
Yeah but its not free camera anymore
Anyway the way to do it would be to take the spectator camera object, define max distance, and then perframe compare the distance from player to that camera object and when its exceeded you clamp the camera position using the _cameraPosition vectorFromTo _playerPosition to get the "backward" direction, vector multiplied by absolute of _currentDistance - _maxDistance, and set the new camera position based on that returned vector being vectorAdded to current position
(pseudo-mathing this, busy currently but that's the idea i can think of)
that'd be in the free camera
i guess? i dont use spectator often, all i know is he wants to limit how far the camera can go
all you need for that is to have the camera object and the anchor object
Why do you think this isn't about EGSpectator?
Free camera just means a camera that can be moved freely rather than being attached to something. Zeus has a free camera, the old spectator has a free camera, and the Endgame spectator system (EGSpectator) has a free camera.
is there any way to get whether the player is aiming down sights or not?
hm.... can probably make that work, thanks
(thats if it remains empty if not aiming down sights π€·)
cameraView will return "GUNNER" when ADS
Oh, great!
i'm trying to figure out a checker to detect if player is moving. animationState works for mostly everything but I can't find anything that would let me check if the player is "freelooking" around. Any ideas?
inputMouse is only for pressing buttons, I'd need something to detect mouse movement I guess
I removed the annoying marker dot from AH-9 with
heli setObjectTextureGlobal [1,""];
but I wonder can I load some other targeting dot? are there any texture like this in the game already - dot, crosshair, etc ? 
Update: I ended making one pixel red dot as reticle, it does the job but it could be much better looking ...
inputAction "AimLeft" or Right or Up or Down
Gives you a number, based on what exact metric im not sure, but not 0 will be movement input
why did google not show me this π
Is there anywhere to find how the vanilla Arma 3 rearm functions behave in terms of scripting it?
Trying to make it so AI vehicles can rearm like players can when near an ammo sources through some scripts or a mod.
https://community.bistudio.com/wiki/Arma_3:_Actions#Rearm
Repair / refuel are just below that as well
thank you
is that only me who is facing this problem while searching on forum ? or search feature is turned off by website itself
It's pretty well indexed by google at this point, could do a site specific search for what you want there
Hello :D
Quick question, what's the easiest to detect when Zeus was opened / entered into Zeus mod?
Uhhhh if it works do pass it please
I am mainly looking for something like an eventHandler rather than a constant check with a waitUntil
You could use a user action event handler to detect when the Zeus button is pressed, then check for the Zeus UI to figure out whether it was opened or closed
How would I got about doing that? Also would that account for say a user being forced into Zeus UI?
The only reliable way I've found so far is using a waitUntil but I'm not fan of a constant check that'd run until a Zeus interface is open
It would not account for being forced.
How you would [begin to] do it is https://community.bistudio.com/wiki/addUserActionEventHandler
Unfortunately BI doesn't really offer a lot of EHs for Zeus
There is the curatorUnitAssigned scripted EH (https://community.bistudio.com/wiki/Arma_3:_Scripted_Event_Handlers#Module_Game_Master_(Zeus)) which might be helpful
In theory you could insert an EH into the Zeus interface UI somewhere. Might need a mod for that though, not sure if mission description.ext UI stuff can modify existing UI like that
I'm a little surprised CBA doesn't seem to offer any Zeus UI events
I'm doing it for a mod anyways so technically possible.
Honestly the waitUntil and findDisplay combo might be the most reliable here whether I like it or not
It does, but only through a displayLoad eh
It has some "feature camera" stuff to catch special uis like arsenal, zeus, eden, splendid camera, etc. but needs some extra logic since if you go from not in zeus -> editing a unit you get three values. "" -> "zeus" (might be curator) -> "arsenal". Then exiting arsenal gives "zeus"
What I've done is hook into it and then just check if zeus display exists
I assume you mean CBA?
Yes
["featureCamera", {
private _inZeus = !isNull findDisplay 312;
// ...
}] call CBA_fnc_addPlayerEventHandler;
Oh nice, thanks.
["featureCamera", {
private _inZeus = !isNull findDisplay 312;
if (_inZeus) then {systemChat "something happened!"};
if (!_inZeus) then {systemChat "something ELSE happened!"};
}] call CBA_fnc_addPlayerEventHandler;
Just a quick example, I think this works perfectly
Can just use if/else but yeah
Yep yep
Lack of sleep moment
Thanks again!
Yea this should work for now :D
Thanks though
Yoo, what a nice day to ask a question :D
Im trying to paint my systemChat that I load in with localize "STR_STRINGTABLE" inside of an addAction scope...
I feel like beeing close to a solution but also dont know if its really possible
Thats my execute:
_SPrice_Normal = 10;
_APrice_Normal = 10;
//StandartFleck
_mausradBundeswehrStandartFleck addAction
[
format [localize "STR_MR_BW_TRUPPFUEHRER_FLECK", _SPrice_Normal, _APrice_Normal],
{
execVM "EBER\MausradLoadouts\Bundeswehr\StandartFleck\Truppfuehrer.sqf";
if ((!isNil "KP_liberation_supplies") && (!isNil "KP_liberation_ammo")
) then
{
_Price_Text = format [localize "STR_MR_COST_INFO", (_this select 3 select 0), (_this select 3 select 1)];
[_Price_Text] remoteExec ["systemChat", _this select 1];
KP_liberation_supplies = KP_liberation_supplies - (_this select 3 select 0);
publicVariable "KP_liberation_supplies";
KP_liberation_ammo = KP_liberation_ammo - (_this select 3 select 1);
publicVariable "KP_liberation_ammo";
};
},
[_SPrice_Normal, _APrice_Normal],
1.5,
true,
true,
"",
"true",
3,
false,
"",
""
];
Thats my stringtable.xml snippit
<Key ID="STR_MR_COST_INFO">
<Original>Your loadout outlay <t size='0.8' color='#BD0000'> Supplies: %1 <t size='0.8' color='#00BD06'> Ammunition%2</Original>
<German>Deine AusrΓΌstung kostete dich <t size='0.8' color='#BD0000'> Nachschub: %1 <t size='0.8' color='#00BD06'> Munition%2</German>
</Key>
The problem appears in the chat. The message fires a little to direct and doesent get structured.
Does anyone know how to do it, because I could bet its possible..
I read about structuredText but doesent know if the enviroment fits
I wanna say it may be because of your remoteExec usage with it although I don't remember why so maybe I'm mistaken
Yeah Im not sure if thee KP supplies are lowered right, Im writing a function for that to get rid of that
[_Price_Text, { systemChat (parseText _this); }] remoteExec ["call", _this select 1];
ouuu
https://community.bistudio.com/wiki/parseText is my solution.
I just didnt cared anymore because other things are displayed the same way
**But this is good to know. I really try to keep it in mind π **
So uh, anybody know whats up with SQF in -1 * 0 returning -0. Rather bizarre to have that popping up in the UI for a return.π΅βπ«
abs -1 * 0 π
Well yeah, but annoying to have to change the formula to account for it since I want negatives otherwise. What a weird notation.
isn't -0 == 0 ?
Yeah, checks true. This is just an UI annoyance for me.
It is not an SQF specific thing. That is just how floating point numbers are in the almost universal spec IEEE 754, so you get the same in Python, JS, et cetera.
Hi ! I've been looking at playSound3D to play a voice line on a AI, but the weird thing is when I set the distance I need to set it to like 100 to be able to hear it. If I set it to 10 or 5, I don't here the audio file. Even if I breath down the neck of the AI.
The distance is the absolute maximum range. The volume will fade out until it reaches zero at that distance, and because of the shape of the volume:distance curve, it can be pretty quiet in the outer half of the radius.
Consider how quiet someone would have to be talking in order to be completely inaudible past 10 metres.
You can try increasing the volume of the sound, either with the parameter in playSound3D or in the file itself, but 5-10 metres is still going to be a very close limit. It's not very far in real life and it's less than you think in Arma.
Ok thank you very much ^^
Whats the script for importing an object?
What do you mean by importing an object?
Trying to get an object from Blender to arma 3
Ask in #arma3_model.
There isn't one
It's a whole process. In a nutshell, you have to export your model to a .p3d with LODs (Arma Toolbox for Blender is good for this), then make a config.cpp for the mod, and then pack that mod into a .pbo to be loaded into arma.
There's Clock's Tools to export as a p3d, but there's no script to export it
I've gotten to the export part but don't know how to import
You're gonna need to make it into a mod in order to be able to see/use it in-game basically. Now that you have your .p3d model file, you need to make a config.cpp and define that model in a way Arma 3 knows what to do with it.
How would i do that?
There are youtube tutorials, google for arma 3 weapon import tutorial and youll find a few
Asking for each step here would take ages
Also wrong channel
Not sure whwre to ask this, but its kinda scriot related.
Advanced Repelling mod gets kinda broken by WMO (walkable moving objects) mod. Because I assume WMO recognises ropes as objects u can walk on.
WMO has CBA option to blacklist some objects from being walkable.
Does anyone know "rope" objects item class names for this purpose?
check if IsKindOf "Rope"
it's literally just Rope π
that's the base class that ideally the rope used by that mod should be inheriting from
When I try to use the command to force vehicles to stay on road they get really jittery is that normal?
Anyone know offhand of a reliable and performative method to get the class of house that a player/ai is located in? Would it just be an insideBuilding and lineIntersects combo?
typeOf nearestBuilding player
That can be unreliable in large buildings, since the position calculation is based on the building model's centre...
alternative getEnvSoundController, look for "houses"
Though for my particular usage case (cooking in houses at stoves and fireplaces generating smoke from the chimney) it might be okay... (only problem could be barracks next to sheds)
(Also wish all Enoch houses had the fireplace output memory point rather than just some of them, sad sigh)
Thats how id do it tbh, reliable, as long as you use insidebuilding to avoid unnecessary intersects
Just intersect from aglToAsl unitAimPosition downwards to the posASL - 0.1 on Z
nearestObjects also works, ordered by proximity
Yeah, just need to ignore the occassional rug spawn π
Not for large buildings it wont, could give you the neighbouring building thats technically closer
If you're looking for "completely reliable" then I'd say no.
With a few rays you could probably get 99.9999% though :P
there's also the boundingbox method that would require vector math and may or may not be cheaper/more expensive than line intersects (never tested myself) - just check if bounds of unit intersect/are inside the bounds of the building using vector math magic π
but also unreliable with unevenly shaped buildings
Bounding box extends outside the building so I'm not sure how useful it is.
yeah
unless
you do bounding box checks against each individual component (geo or fire geo) in which case you'd have more reliablity, but im 90% sure that'd be more expensive than a single line intersect
unless you do it in C as part of an extension or something
scope creep
Other issue with ground raycasts is that sometimes the terrain sticks through the floor.
eh terrain returns objNull so you can just filter objNulls from the intersection and extend it downwards a bit for safety
since im pretty sure the line will still go under terrain if you ask it to
ah, if you let it do multiple hits, yeah
Yeah, looks like a downward lineIntersects is probably gonna be the best (avoids most furniture). The position of the stoves/fireplaces should avoid terrain intersect problems. But also will modify per last couple of messages. Ah, the joys of implementing a proper cooking system with visual clues for other players π
man i really wish we had an optimized way of detecting collision or "nearest collidable face"
plenty of ways around it ofc as we just discussed, still π
Would be nice if insideBuilding had an alternative syntax that returned the building type
that'd help here yeah, eliminates the need for any other checks
If the building must have a chimney do the intersection towards the chimney positions
can somebody share a function, that will find random empty position for spawning unit ( soldier or vehicle ) that I can use multiple times for n-numbers of units to spawn, and avoiding spawning units in rocks or positions already with spawned units ( e.g. not spawning vehicles on vehicles )
findEmptyPosition, BIS_fnc_findSafePos
Do you want to spawn them together, or spread out?
Easier if together, just find one larger area, and manually spawn inside.
spread out, my usecase is to spawn multiple units/groups in marker, goal is to spread them out, avoiding spawning them on one place, or spawning vehicles on vehicles
or spawning vehicles on already spawned units
In that case, I don't think there is much better solution than findEmptyPosition with extra check after to see if actually clear.
You could try selectBestPlaces, but I don't recall the filtering being suitable for this.
Most of the chimneys on Enoch buildings are not placed above the fireplace π Some weird smoke physics must exist in the ARMAverse
I'm a big fan of ray along camera direction, at least for logic/mechanics
Downward directly works best for my use case, because the only furniture that would intersect would be a rug, which I can ignore. Any other direction could be a variety of furniture
Yeah true. I'm thinking like "look at stove and action to start cooking" >
"That's not a stove you donut" or
"Now cooking at this stove"
Basically that's sort of how it's gonna work. Wood stoves, Land_dkamna_uhlis are placed automagically as appropriate and I have another small "wood pile" object (not the vanilla one) in fireplaces... For the smoke I use the fireplace output memory point if it exists in the model, and a config that has the offset for the smoke point per building model if not
