#arma3_scripting
1 messages Β· Page 153 of 1
That's not a good idea. When you have everything in code, it's not clear how the mission works.
Its tricky but doable, my entire Viper Blue scenario is a handful of placed objects, one unit with a waypoint, everything else handled by scripted function.
Sometimes its easier to work in a single medium; I know which file this or that objective is in and where the trigger I spawn for it is written in, I dont recall where I placed that trigger in Eden :p
Yes, when you open Eden, you will immediately see the trigger and the units synchronized with it. When you open the trigger settings, you will see its statements, which will make it clear how it works.
Of course, not everything should be placed in Eden, otherwise your mission will be static, but something that, for example, rarely changes, can be placed in Eden.
No
This part:
_x addEventHandler ["Killed", {
params ["aliveTerrorists1", "", "", ""];
does not work because:
a) in an event handler, the _this special variable, which is what params is interpreting, contains only the special information generated by the EH (in this case, the killed unit, the killer, etc). You can't pass custom arguments to an EH like this, it only receives the auto-generated arguments.
b) params generates local variables. A local variable is prefixed with _. A variable name without a _ at the start is a global variable. You are trying to get params to create a global variable - this doesn't work.
aliveTerrorists1 is a global variable, so it's already available in the EH scope, without any need for params. In another piece of code, one where you can pass custom arguments, you might pass a global variable and use params to assign it to a local variable within that scope - but you don't have to. That's what a global variable is, a variable that's available in any scope.
Maybe just send the introduction to scripting already? 
OK, my possible trigger based solution:
_trigger = createTrigger ["EmptyDetector", [0, 0], false];
_trigger synchronizeObjectsAdd [
terrorist1,
terrorist2,
terrorist3,
terrorist4,
terrorist5,
terrorist6,
terrorist7,
terrorist8,
terrorist9
];
_trigger setTriggerActivation ["NONE", "PRESENT", true];
_trigger setTriggerStatements ([
{
_aliveTerrorists = (synchronizedObjects thisTrigger) select { alive _x };
_aliveTerroristsPrev = thisTrigger getVariable ["aliveTerrorists", []];
_aliveTerroristsChanged = _aliveTerrorists isNotEqualTo _aliveTerroristsPrev;
if (_aliveTerroristsChanged) then {
thisTrigger setVariable ["aliveTerrorists", _aliveTerrorists];
};
_aliveTerroristsChanged
},
{
_aliveTerrorists = thisTrigger getVariable "aliveTerrorists";
if ((count _aliveTerrorists) > 0) then {
["eliminate1", [_aliveTerrorists select 0, true]] call BIS_fnc_taskSetDestination;
} else {
["eliminate1", "SUCCEEDED"] call BIS_fnc_taskSetState;
};
},
{ }
] apply { toString _x });
aliveTerrorists needs a tag
What a tag?
An identifier unique to you, the mod, or the mission.
So ace's tag is ace. All of their global variables, class names, and variables saved to objects start with ace. It's to prevent conflicts with other scripts and mods
I think the tag will be redundant (although it can be used), because the trigger is local, and aliveTerrorists is also local.
Just because it's not synced across machines doesn't mean that other scripts couldn't conflict with it.
It's bad practice if nothing else
Usually best practices apply to global vars, private vars you can name whatever you want.
No, @hallow mortar , it's local var.
setVariable is local to the machine, not to the function.
I deleted that message specifically because I read it again, understood that, and wanted to retract it. But thanks for the ping.
setVariable is also not private. Only the private keyword (and param(s)) makes private variables
However, the setVariable / getVariable one is a global variable, although it is only in the trigger's namespace and so probably won't have any conflicts (it's pretty unlikely anyone else will be setting variables on this trigger you've just created)
Yes, I wrote the wrong word, I should have written local.
setVariable doesn't make local (scope) variables. It does make local (network) variables, but that's not what tag-based conflict protection is about. setVariable variables are object-namespace-specific but still global scope.
If i needed to make a variable global (and public) I would write it like this:
thisTrigger setVariable ["aliveTerrorists", _aliveTerrorists, true];
That will make the variable network global. It is already global scope. setVariable variables are not local scope. They can be accessed from any scope.
Yes, it's the default value: https://community.bistudio.com/wiki/getVariable
Agree.
The default value is the value that getVariable will assume, if the variable you told it to get hasn't been defined. In this case the default value is [], an empty array.
Which means that it should have a prefix, because it is global.
It's the trigger that executes the code.
Whether it is synced or not
OK, I don't mind.
When the trigger activates, it executes an instance of its activation code. thisTrigger refers to whichever trigger was activated and created the instance currently being executed. It's a way of referring to the activated trigger without needing to give it a specific variable name.
To be absolutely clear, thisTrigger is only available in the activation code of a trigger.
* well the condition and deactivation code too, but you get the point - only in contexts belonging to a specific trigger.
Learn and practice, then you will be able to write code without checking in the game, as I wrote mine, which worked on the first try.
findemptyposition is already in there. it finds a empty pos the problem is that it sticks to it in every cylcle and ignores new spawned obsticles. bis fnc_findsafepos does not work for small areas ... haha yeah params.... i usuali use them if i want to make something optional but yes u r right. looks better
if i delete the lines with the dummy vehicle all groups spawn in one another although the script should find a empty position
And I didn't use params because I was to lazy to look up the syntax :P
can I apply a wreckage texture to a vehicle without having to write a separate config and making it a different vehicle? To my understanding all the damaged textures exist only as rvmats
Yes, through setObjectTexture/setObjectMaterial if they are there and cover the whole vehicle
Just material might be enough, not sure, I remember playing around with it
ah I'll look into it then, thanks
Damage -> mat
Just setObjectMaterial here
You can make it look even more damaged with setObjectTexture if needed
and does anyone have a working solution for a condition in an EH killed? i want it only to fire if all units of a group are dead. the EH got attached to all units of the group
i hat if({!alive _x] foreach units my_group) then { do stuff}
the problem with this is it sometimes fired prematurely ^^
Is there a way to make this line of code apply only to player controlled AI?
//Self revive EXAMPLE
player addAction ["All units self-revive", {
(allUnits select {lifeState _x == "INCAPACITATED"}) apply {
_x remoteExec ["DREAD_fnc_unitSelfRevive", _x];
};
}, nil, 10, false, true];
Good day.
I've noticed that when using addBackpackCargo command not only the backpack itself is added, but also some items may be put in it along the way.
Example:
cursorObject addItemCargo ["B_AssaultPack_mcamo_AA",1];
Expectation: Just an empty backpack added
Reality: Backpack added with two Titan missles in it
Is there any way to prevent this from happening?
Yes, replace allUnits with array of units controlled by player.
Yes, use either basic backpack class name or https://community.bistudio.com/wiki/BIS_fnc_basicBackpack.
Thank you, this seems to be working
I did not quite understand.
replace with the list of units you want to revive 
Issue Is that the units are units that are spawned In game. I am not sure how you would give It a var name once a player buys a unit In warlords.
params ["", "_caller"];
((units _caller) select { (lifeState _x) == "INCAPACITATED" }) apply {
_x remoteExec ["DREAD_fnc_unitSelfRevive", _x];
};
Depends how you identify "player controlled AI", really.
Is that everyone in a squad with a player in it? Everyone on a specific side? Everyone in a squad linked to high command?
how do i use macros with 2 arguments?
I write in comfig:
#define MSG(TEXT, TYPE) [TEXT, TYPE] call EMM_fnc_message;
And then try to use it in code:
MSG("test", 0);
But it shows error that ";" missing
#define shouldnt have a semicolon at the end
@delicate hedge Text is a command: https://community.bistudio.com/wiki/text maybe thats the problem not sure how macros deal with that
It doesn't matter
Actually since it's in config you can't have 2 ;s yeah
No the problem is having 2 semicolons in config
ok
Either that or the config is not correct at all
What?
#define MSG(text,type) "[##text##, ##type##] call EMM_fnc_message"
class something {
someCode = MSG(something,something);
};
Its just for player squads on Opfor and Bluefor.
Unfortunately no.
If I wanted to get a list of all the possible options that can be put in a units identityTypes[] array in SQF where are these stored? Example:
identityTypes[] = {"Head_Euro","LanguagePER_F","G_IRAN_default"};
description.ext unless you have a mod
example what is LanguagePER_F and where is it stored by default?
in the array
...
oh nvm i thought you were defining that array
Let me reword this
I want to provide a utility that can provide all the possible options that could be defined in identityTypes[], this is for a faction creator mod. So I want to create an array of all the possible options, so the players can pick ones they want, what I provided was just an example of the output of my mod
Lets say I want to know all the possible options that are valid for what you CAN put in the array identityTypes. How would I get this list of potential options?
Just AI bought and controlled by players In warlords.
didnt get whats that something class
Just an example of using it
The macro I sent on it's own won't work (typed it kinda quick). There's probably a way to "one-line" it, but a better way would be to use multiple macros:
#define QUOTE(var1) #var1
#define ARR_2(var1,var2) var1, var2
#define MSG(text,type) QUOTE([ARR_2(text,type)] call EMM_fnc_message)
Which probably looks like a bunch of macro nonsense though
Oh nevermind, you didn't need it quoted in your original message, so you could make that simpler
are you putting the macro in one file and use it in another file?
I am trying to make this line of code so that rather forcing the script on the listed men In the array, It will target all player controlled AI (Non high commander view).
[me, man, man_1, man_2, man_3] apply {
_x call DREAD_fnc_addRevive;
};
//sleep 0.5;
[man, man_1, man_2] apply { _x setDamage 0.99; [_x,[0,0,-8]] remoteExec ["setVelocityModelSpace", _x]; };
{
_x call DREAD_fnc_addRevive;
} forEach [me, man, man_1, man_2, man_3]
sleep 0.5;
{
_x setDamage 0.99;
[_x,[0,0,-8]] remoteExec ["setVelocityModelSpace", _x];
} forEach [me, man, man_1, man_2, man_3]
Or all in one forEach if you don want sleep
8 hours since units player was mentioned
Learning this slowly. Just place It like this?
units player apply {
_x call DREAD_fnc_addRevive;
};
//sleep 0.5;
[man, man_1, man_2] apply { _x setDamage 0.99; [_x,[0,0,-8]] remoteExec ["setVelocityModelSpace", _x]; };
The man variables are undefined
Also why are you using apply, you're not modifying the array, which is what apply is for.
Use forEach if you just want to do X thing with each element
I plan to remove the man variables and replace It with some action that will only call for players and players AI.
What are the "player's AI", are they in the same group as the player?
Yes sir
In warlords game match, the players are allowed to buy AI that will follow them.
Alright thank you.
I have everything working but the Issue I have ran Into Is that new AI that spawns does not have the code working for them. All units assigned to the player In eden editor works though.
Is there a way to get the script to check for new units In the players group and make the code work?
[] spawn {
while {true} do {
if (lifeState player == "INCAPACITATED") then {
//sleep 0.01;
[man_3, player] call DREAD_fnc_unitReviveBody;
man_3 removeAction (man_3 getVariable (str player));
};
sleep 1;
};
};
is there any other way to get result from spawned function except global variables?
Passing variable by reference.
how? i tried but didnt work
_array = [0];
_scriptHandle = _array spawn {
sleep 5;
_this set [0, 1];
};
waitUntil { scriptDone _scriptHandle };
hint (str (_array select 0));
Is there an easy way how to check if an animation move exists, before executing the animation?
isClass
Thanks. I guess this is not practicall, if I want to allow all available animations, given that the paths are different.
Hm, paths as in? What's your goal then?
I am writing a function for ambient animations, and I wanted to find a way how to revert all previous actions if the animation does not exist or is not played correctly.
Maybe you want to wait until 2.18 and use updated switchMove
I'm just learning how to use hashmapObject, it is very useful, I found out how to get data from "Methods", but is there any way to send data into these "Methods"? As arguments of course

Don: http://foxhound.international/arma-3-sqf-cheat-sheet.html is good for being lazy
what ya gonna use it for? I'd say most of us don't use hashmapObjects.
Hey everyone! I've been doing a lot of research into this and haven't found any solutions outside of the "screenshot" command.
Is there any way for a mod or scripting to access the image data of in-game cameras? Or even player perspective?
Hi so this is the first time I will be doing this, so this script I think.
How do I apply it in a way where my in game map looks like this
https://community.bistudio.com/wiki/Procedural_Textures#Render_To_Texture
Picture in picture can do this
https://community.bistudio.com/wiki/Camera_Tutorial#Picture-in-Picture
Bit of extra tutorial here
I was reading into pip and rtt but couldn't see a way to actually store the raw image data anywhere? Or access it?
No, that's the screenshot command does
But there's no way to run "screenshot" on an RTT output right?
Without taking over the players perspective
I'd like to hear your actual goal before proceed my answer
Ingame "head cams" displayed through a website
Website?!
Yeah
You may want to write a DLL. This is not even a scope of SQF
Yeah that's the plan
I just haven't found anything remotely close to allowing me to access image data in any documentation I've read
Doesn't seem that pip or rtt exposes the texture data in a way that would be useful
My only workaround which isn't ideal is limiting the "head cams" to real players by running the screenshot command on an interval with the DLL mod uploading it to the backend
The channel right here, is about SQF, not DLL, which is not something I can provide any info. Try your luck in #arma3_tools
The map_borders.cam_lao_nam folder is just a mission file you can refer I guess. Try that mission
I mean is it even a thing in ARMA where you can have map borders like that?
...Why you ask that when you have a proof of concept already
Alright thanks
Good day. I noticed that for dead units getUnitLoadout ,getWeaponCargo or primaryWeapon won't get its primary weapon (accessible when looting the corpse). Is there any way to get it with code?
2.18 π’
2.18 is not so far away AFAIK
<annoying kid voice>
But I donwanna 2.18, I wanit noooow
</annoying kid voice>
Seriously though? Any known workaround?
Maybe checking nearObjects to detect near weapon holders?
I'll give it a try, Thanks
haha yeah i now the cheat sheet.
@grizzled cliff well you could just have used your own Detour function and memory search function... Then you would have had linux compat right in the beginning ^^
I'm working on a dynamic mission where I have some objects (objectives, companies and platoons) that have a lot of variables, also, the Methods come really useful in this case.
Getting, setting variables and making things happen with methods make the code cleaner and I find it more usable imo
Hi guys, a quick question pls.
If I wanna let an Ai group respawn after another group got eliminated. How will the scrip be?
To break it down;
Youre looking for a setup that will 1) check for any remaining living units in an existing group, then 2) create a group of units once 1. has been triggered.
For the first part, you have some options. The most simple would be interrogating the list of units in the group to find if any are alive.
units groupNameHere findIf {alive _x} == -1
This structure returns the value in the array of units in the group that first return true for 'alive unit'. If none of the units are alive, it returns -1; this is what we want as the condition, since it means none are alive.
For creating a group, I recommend https://community.bistudio.com/wiki/BIS_fnc_spawnGroup . Its a fairly straightforward and flexible function, just needs the relevant inputs for whatever faction, side, location, and optionally types of units you want.
If youre using the editor, the findIf function goes in the Conditions for a Trigger, and the spawnGroup code in the onAct section. If youre using a called function, youll need to create the trigger yourself. If youre using a spawned section of code, you can use a waitUntil to keep checking until all the units are dead in the first group.
group "Empty" (or maybe "Deleted") EH may work as well for the elimination detection part https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Empty
Server: Object 0:0 not found (message Type_185) How can I read the log file?
0:0 is invalid. Probably sent some local-only object to the server
A fireplace? Probably have a local-only fireplace, and someone turned it on
@still forum This is not the only error. Where can I see these errors in detail?
nowhere
@still forum https://pastebin.com/65em6Q9T Can you help me find errors?
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.
Its all the same error though
Is the problem with the fireplace?
the problem is the locality transference for certain objects, unless you are manually sending them there is not a whole lot you can do for those errors
atleast for the object x:x not found issues
If you mean your error of an object not found, maybe.
But you should start 1st from your script errors that you have alot in your log file.
I bet object not found is your littlest issue there.
Yes. You have a local-only fireplace.
And someone is trying to turn it on. Which tells everyone else in the server to also turn it on. But its local-only, the others don't even know that it exists
You shouldn't local-only objects, that are being interacted with and need to be synced
So, what is the error that causes the altis map to be corrupted because it cannot enter the server?
π€·
o7 folks, here with another issue with sqf. I'm trying to make a HEMTT work with MIM-145 Defender. Here's the code:
this addAction ['Deploy SAM', {
if (isNil {_this select 0 getVariable 'defenderDeployed'}) then {
_defender = createVehicle ['B_SAM_System_03_F', getPos (_this select 0), [], 0, 'CAN_COLLIDE'];
_defender attachTo [_this select 0, [0.03, -7.3, 2]];
_this select 0 setVariable ['defenderDeployed', _defender, true];
_this select 0 lockCargo true;
_this select 0 lockDriver true;
};
}, nil, 1.5, true, true, "", "_target distance _this < 5 && isNull objectParent player"];
this addAction ['Undeploy SAM', {
if (!isNil {_this select 0 getVariable 'defenderDeployed'}) then {
_defender = _this select 0 getVariable ['defenderDeployed', objNull];
if (!isNull _defender) then {
detach _defender;
deleteVehicle _defender;
_this select 0 setVariable ['defenderDeployed', nil, true];
_this select 0 lockCargo false;
_this select 0 lockDriver false;
};
};
}, nil, 1.5, true, true, "", "_target distance _this < 5 && isNull objectParent player"];
"Deploy SAM" - Creates the Defender, attaches it behind HEMTT at given coordinates and disables all seats in HEMTT.
"Undeploy SAM" - Deletes/removes the Defender and unlocks HEMTT seats.
The code works like this flawlessly, but there's an issue. You deploy it, shoot 2 out of 4 missiles and undeploy it. Drive off to a different location, deploy it again, voila 4 rockets. This is a problem and not the behavior I'm looking for.
I understand that deleting a vehicle that fired rockets and creating a new one is one of the issues here. Creating a new vehicle resets the ammo count, simply put. But what if there was a way to save the ammo count and use it for when I create a new vehicle and alter the magazine count?
when i spawn (scheduled env.) code and call (unscheduled env.) some func in it and then call there next funcs and next.... will all this calls be as a part of spawned block? so all they will be halted by engine if they dont complete under 3 ms on frame?
can probably be fixed by only creating the defender if it doesn't exist yet and hideObjectGlobal-ing it if it does exist. No new launcher, no new rockets 
yes, all calls inside scheduled code get executed inside the same scheduler task/thread/whatever it's properly called. And they can't exceed scheduler limits.
call isn't unscheduled. It just runs the code in the current context, whatever it is.
If you actually wanted to run unscheduled code from within scheduled code then there is isNil { your code here }
sometimes useful
Question:
Does this Switch behave as I want it to?:
switch (bool) do {
case true :{}; //True
case false :{}; //False
};
since:
switch (playerSide) do
{
case west: { hint "You are BLUFOR"; };
case east: { hint "You are OPFOR"; };
case guer: { hint "added for completion"; };
};
Works fine.
I want it as a way to avoid an "if statement".
[true, (...)] call fnc_someFunction So that the true case does something and the false case does something else.
You can add default to switch.
and in if has
if (true) then {
//do stuff if tru
} else {
//do stuff if false
}
Yes, I just donΒ΄t want to use an If statement this time.
default would be "do nothing" probably.
I want to know if I can use a True / False switch and if it does what I think it does
thanks @manic sigil
Yes you can switch over a bool
switch (true) do {
case (1 + 1 == 2): {...};
};
okay thx!
I have a PIP script I want to toggle on and off, would the best course be have a model cfg animation that hides the selection, have an animationSource config, then use animateSource to toggle it?
Why do you want to avoid an if statement?
There is also the ternary select syntax
Might be a setup like this with several conditions
Their original question seemed pretty clear that they just wanted to pass a plain bool to a function and have different results based on whether it's true or not, which is pretty much the textbook use case for an if/else.
Didn't even see that last part of their message
What does your requiredAddons look like?
How to make the hint only for one player?
hint will be executed only on the computer where it is executed. AKA, it is not executed globally
but on the server I want only one player to see the message, not everyone. Is there another option?
As I said, hint can happen only on one player. If you want to troubleshoot your code, post it
in 3den Enhanced, in the hold down button action tab, I want to give the player information about the cause of death.
like this '"killed by a shot in the back" remoteExec ["hint", _caller]'?
yeah _caller is the client where the remExec is sent
thanks
Is there a solution to check If Players stay in direct sunlight? I want to simulate sun radiation as deadly enviroment by time If a Player stays too Long in direct sunlight.
https://community.bistudio.com/wiki/getLighting
Maybe this, my comment
the Shadow of the Player itself is excluded from this?
Dunno, try it
It's just a getter for light settings. Won't account for player being inside a building, below a tree, inside a car etc.
Need to combine it with other checks then it could work ^^
so then its Not what i searching for, badly
As I said, check my comment below
My plan is let Check every second if player stays in sunlight, as Long as he stays there, he will get the ACE chromatic abberation effect and get smooth damage by time until he gets into a shadow
``sqf
// Position of the player
_playerPos = getPosATL player;
// Direction to the sun
_sunDir = sunOrMoon; // returns the direction to the sun
_sunPos = _playerPos vectorAdd (_sunDir vectorMultiply 10000);
// Check if the sun directly illuminates the player's position
_isInShadow = lineIntersectsSurfaces [_playerPos, _sunPos, player, objNull, true, 1, "VIEW", "NONE"];
// Output the result
if (_isInShadow) then {
hint "You are in the shade.";
} else {
hint "You are in the sunlight.";
};
`
does this make sense?
_playerInShadow = ([player,"VIEW"] checkVisibility [eyePos player,eyePos player vectorDiff ((getLighting#2) vectorMultiply 200)] == 0);
lineIntersectsSurfaces cannot detect a line between two points that more than 1000m away too
Even recognizes the shadow of the car, nice one.
whatever you're writing it looks like a cool piece of code
does anyone know how the elevator script works in cytech?
is it a module you can place or baked into an object
If have seen this an rpt recently - i would like to use that myself - anyone know if this is like an inbuilt feature or is this some custom script using BIS_fnc_log?
specifically, the [postInit], fnc, (exec time?) is really curious to me.
2024/08/14, 11:06:53 "armahosts/BIS_fnc_log: [postInit] CBA_fnc_postInit (1037.11 ms)"
2024/08/14, 11:06:53 "armahosts/BIS_fnc_log: [postInit] storm_fnc_postInit (0 ms)"
2024/08/14, 11:06:53 "armahosts/BIS_fnc_log: [postInit] storm_fnc_cba_settings_initialized (0 ms)"
2024/08/14, 11:06:53 "armahosts/BIS_fnc_log: [postInit] tsp_animate_fnc_init (4.88281 ms)"
damm it, that excludes the sun entity on the skybox
_sunDir = sunOrMoon; // returns the direction to the sun
ChatGPT? :P
can anyone tell me what is wrong with: vehicle setConvoySeparation 20;
It keeps telling me: Init: Missing ;
Vehicle is a command name, use a variable name.
Question, maybe like a week ago there was a mod/composition on the workshop called Vehicle Markings smth smth. Anyway, I think it was removed because I cant find it.
However what it had was a Text display object where you can type in text and display it like a graffiti. U could select front and size and text by editing the script. Because it was a composition, I assume it was scripted and base game. Composition was on an object called Test Display or smth.
Anyone got any idea how to do it?
Sounds like UI-to-texture
Does anyone know a way to convert from dik code to standard key names?
or could be https://community.bistudio.com/wiki/Procedural_Textures slapped on the user texture 1x1 object
I think it's in the base game
you mean a script to do so or do you need a cheat sheet?
script
Using this include #include "\a3\ui_f\hpp\definedikcodes.inc" I can check for a keys usage in keydown instead of its dik code. But I'm trying to populate an rscText with a key to press based on the users control scheme, so I need it to do it by itself without an eh
Thanks, looks like actionKeysNames also does it. I looked at the wiki for it awhile ago but misunderstood it
Cant make heads or tails out of it. In that composition "Military Markings" (Found it, it was indeed removed). You would literally spawn an object called in that composition called Test Display or smth.
Compositions must contain an object, you can't have script-only compositions. So that composition would contain one object (it must be a vanilla object since compositions can't add new object types, but you can name the composition anything) acting as a carrier for code, in its init field.
And that code would use procedural textures, either directly on the vehicle or on script-created user texture objects, to create the markings.
I've been messing with the task framework for some MP missions, but sometimes the tasks that are set as completed reset to unassigned (Most often after about 30 minutes). I was creating them using call BIS_fnc_taskCreate through an init.sqf
init.sqf runs on all machines when they start the mission - including JIP machines when they arrive. So a new player connecting...after about 30 minutes, let's say...would create the task again.
BIS_fnc_taskCreate is global argument/global effect, so it only needs to be run on one machine. I'd suggest moving it to initServer.sqf, or using an if isServer check in init.sqf.
No ye, it contained an object. Said object and an init which would attach it to nearest vehicle (which I do not need, I can do it/script it myself) and at the bottom it had a place to input texture. And it would display in Eden
There seems to be an issue where if (on a dedicated server) a SAM site switches locality to a client player, the locality change is not immediately fully propagated. If the player attempts to fire out of the SAM site while it is propagating, no missile comes out of it.
Is this a known bug?
does anyone know how to fix this. it wont let me connect to my server anymore it happend as of yesterday. it wasnt always an issue but only effects a few players like 1 out of 10
BattlEye Client: Server computed GUID: ba97b5bb157d83376eGfd7f915baa7e4
looks like this
That's an information message, not an error message. It's just telling you the server knows about you and has generated a unique ID for you. It will also happen on successful connections.
why is it not letting me connect then?
Ah nevermind I found the issue: https://feedback.bistudio.com/T182587
I don't know, there's a huge number of possible reasons why connections can fail.
Also, this isn't a scripting problem. Try #arma3_troubleshooting , #server_admins , or #arma_battleye (if there is a message clearly showing that it's BattlEye stopping you connecting)
Will try to, thanks
is there a way to broadcast a variable in an objects namespace over network?
Yes, the public flag of setVariable works exactly the same in any namespace (unless it's the namespace of a local-only object, of course)
thank you
so to broadcast the value of a variable from the server to all clients i'd basically do this, right?
_object setVariable ["myVariableName", _object getVariable "myVariableName", true];
does someone know a good solution to not let an object slide a bit of his position when using setpos commands ?
maybe it has something to do that the object might not have an landcontact memory point ?
_object setPos (getpos _object);
_object setVectorUp (surfacenormal (getPosASL _object));
alrdy doing it
_object setPosWorld (getPosWorld _object); is the only one that's close to maintaining position, IIRC
I don't use it with units though. Wouldn't know what it does there.
!quote 5
stop using 'setPos' for the love of god
Leopard20; Tuesday, 10 August 2021
setPosATL and setPosASL also don't work for this.
yea exactly
I used setposatl and the beartrap ended up being under the ground after 3 days xd
nods
how do can I make a unit's side change?
I've tried using: gunh(name of the unit I want to change) joinSilent createGroup EAST;
but it's giving me errors
Well whatβs the error?
I believe I fixed it, it required more than one unit
[unit1,unit2]
instead of just one unit
No. join commands work for one unit too. It just requires an array
Trying to get this line of code running.
Ran Into some type of Issue./
this addAction ["Set Tactical Nuke Coordinates!",
{
params ["_target", "_caller", "_actionId", "_arguments"];
[true] remoteExec ["openMap", _caller];
_caller onMapSingleClick {
blast setPosASL (AGLToASL [_pos #0, _pos #1, 0]);
_str = (format["%1%2%3%4%5%6%7", "<t color='#ffffff' size='3'>", "RED ALERT!!! We detected actors setting tactical nuclear bomb coordinates to: [",round (_pos #0), ",", round (_pos #1), "]", "</t>"]);
titleText [_str, "PLAIN DOWN", 0.25, true, true];
[false] remoteExec ["openMap", _this];
{[getPos blast, 500, true, true, 2,160000] execVM "freestyleNuke\iniNuke.sqf";NukeActivated = false;}, [], 0, true, true,"","NukeActivated",3.1600];
};
}, nil, 1, true, true, "", "(str(side _this) == 'WEST')", 5];
What issue
In where
The line starting with {[getPos blast, I guess. Not sure what the intention was there.
- You don't need to remoteExec
openMapin any of these cases. It's already being executed where the caller is local, because that's where action code is executed. - It's strongly recommended to use the mission event handler "MapSingleClick" instead of
onMapSingleClick, becauseonMapSingleClickis not stackable - whenever you use it, it wipes out whatever it was previously set to. Not very cross-compatible. - That
formatseems excessively complicated. You don't need to make every single piece of it a separate argument. Simplified (more readable) version below. - As John said, the line starting with
{[getPos blastis almost certainly wrong. The execVM part is probably OK, as long as those are valid arguments foriniNuke.sqf, but then it's wrapped in a random set of{}and there's the back end of another array stuck to it (minus an opening[). It just doesn't make any sense, grammatically or logically.
format ["<t color='#ffffff' size='3'>RED ALERT!!! We detected actors setting tactical nuclear bomb coordinates to: [%1, %2]</t>", round (_pos#0), round (_pos#1)];```
oh, and you should probably remove your onMapSingleClick or "mapSingleClick" EH after they've clicked, otherwise they can just keep doing it. That might be bad for the environment.
greeting, following issue:
params [
["_player", objNull, [objNull]],
["_endType", objNull,[objNull]]
];
End3 = _endType;
_uid = getPlayerUID _player;
if !(_uid in ADALIB_whitelisted_opfor) then {
//disableUserInput true; //lets NOT do this
hint "this Side is restricted";
sleep 1;
["End3"] remoteExec ["endMission", _player];
// failMission "End3";
} else {
hint Format ["Welcome Comrade %1", name player];
};
Does not display the correct End3 defined in the description.ext
class CfgDebriefing
{
class End3
{
title = "You are not whitelisted";
subtitle = "Please choose a slot on Greenfor";
description = "";
pictureBackground = "";
picture = "";
pictureColor[] = {0.6,0.1,0.2,1};
};
};
the function is called the following way:
params [
["_player", objNull, [objNull]],
["_jip", false, [false]]
];
//switch for LOCAL Player stuff and function calls
switch (playerSide) do
{
case west: { hint "You are BLUFOR"; [_player,"End3"] remoteExec ["ADALIB_fnc_whitelistBlue", _player];}; //maybe remove the hint
case east: { hint "You are OPFOR"; [_player,"End3"] remoteExec ["ADALIB_fnc_whitelistOpfor", _player];};
};
How would I go about it using the correct "End3" ?
I got to leave for sleep here soon, so feel free to @ ping me so I can look at the answers later. Thx in Advance!
(If i miss the answers i might repost this question)
@quicksilver says the guys who uses while {true} do loops everywhere
@still forum thats what im doing now, Detours was just the fastest way to do it at the start for hooking. Also I had my own memory searcher, but really the only way to do memory searching is with OS specific functions. I don't even need a memory searcher now.
I just need to do three pointer arithmetic operations and im good to go.
@grizzled cliff when are you planning to get intercept whitelisted by BE? or is it already done ?
plan to yes, but the dll is changing so often right now that whitelisting it would be pointless
Thank you. I noticed there was quite a bit that can be moved out but I was afraid to cause anymore damage.
Trying to get the sleep mode to work for one time use. Saying I have the bracket messed up.
this addAction ["Activate Nuke!",
{
params ["_target", "_caller", "_actionId", "_arguments"];
[true] remoteExec ["openMap", _caller];
_caller onMapSingleClick {
[(AGLToASL [_pos #0, _pos #1, 0]), 500, true, true, 2,160000] execVM "freestyleNuke\iniNuke.sqf";
_str = (format["%1%2%3%4%5%6%7", "<t color='#ffffff' size='3'>", "Tactical Nuke Has been called In on: [",round (_pos #0), ",", round (_pos #1), "]", "</t>"]);
titleText [_str, "PLAIN DOWN", 0.25, true, true];
[false] remoteExec ["openMap", _this];
};
}, nil, 1, true, true NukeActivated = false;}, [], 0, true, true,"","[NukeActivated",3.1600];
somewhere at the bottom
Trying to figure out how to get the script to be used only once so that the player cannot call for It again.
this addAction ["Title", {
params ["_target", "_caller", "_actionID", "_arguments"];
_target removeAction _actionID;
}];
Sorry I am back. How would I put that Into the code that was up there?
And thank you for the pointers by the way.
Well, look at it
You want to remove the action after it's used, removeAction does exactly that. So then you run that in your action's statement.
Are you memory searching from an external application O.o i dont use any OS function for mem search... char* data = 0x1234556; memcmp(data,"\0x54");
I have tried this but with no luck.
this addAction ["Activate Nuke!",
{
params ["_target", "_caller", "_actionId", "_arguments"];
[true] remoteExec ["openMap", _caller];
_caller onMapSingleClick {
[(AGLToASL [_pos #0, _pos #1, 0]), 500, true, true, 2,160000] execVM "freestyleNuke\iniNuke.sqf";
_str = (format["%1%2%3%4%5%6%7", "<t color='#ffffff' size='3'>", "Tactical Nuke Has been called In on: [",round (_pos #0), ",", round (_pos #1), "]", "</t>"]);
titleText [_str, "PLAIN DOWN", 0.25, true, true];
[false] remoteExec ["openMap", _this]; _target removeAction _actionID;
};
}, nil, 1, true, true ];
sorry to intrude but anyone reckon they could help with a basic effect script? trying to get the effect to occur mid air but it will always spawn the vehicle on the ground and occur there.
if`` (!isServer) exitWith {};
_orb = "Sign_Sphere10cm_F" createVehicle getPosASL b1;
_exp = "#particlesource" createVehicleLocal getPosASL _orb;
_exp setParticleCircle [0,[0,0,0]];
_exp setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal.p3d",16,0,16,1], "", "Billboard", 1, 0.3, [0,0,0], [0,0,0],5,10,7,0.1, [100,80], [[1,1,1,1],[1,1,1,0]], [1], 1, 0, "", "",_orb, 0, false];
_exp setDropInterval 0.1;
_exp2 = "#particlesource" createVehicleLocal getPosASL _orb;
_exp2 setParticleCircle [0, [0, 0, 0]];
_exp2 setParticleRandom [0, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_exp2 setParticleParams [["\A3\data_f\cl_basic", 1, 0, 1], "", "Billboard", 1,0.5,[0,0,0],[0,0,3],0,10,7.9, 0, [10,200], [[1, 1, 1, 1], [1, 1, 1, 1]], [0.08], 0, 0, "", "", _orb, 0, false];
_exp2 setDropInterval 500;
sleep 0.3;
deleteVehicle _orb;'
You're using getPosASL but createVehicle type commands require ATL/AGL positions. Using two different height formats causes problems.
Try using ASLtoAGL on the position before creating the object, or using setPosASL on the object after creating it.
Use setPosASL to orb and effects
To make it sure and not to confuse position format, I always take this way
why can CfgSFX and CfgEnvSounds only be played by triggers? which genius came up with this idea? anyone know of a workaround?
ah thanks ill give it a shot
arma has like 7 different functions for playing sounds and they're all shit
Create a local trigger on the player and activate it to play the sound.
i'm already doing that, it's just annoying
i just wish we had a decent set of audio functions...pause, rewind, fast forward, EQ, filtering, compression, reverb, etc
I apologize. i understand what you both are saying but i am having trouble turning it into script as i am pretty new to this.
It sounds like it should be as simple changing getpos to
_orb = "Sign_Sphere10cm_F" createVehicle setPosASL b1;
_exp = "#particlesource" createVehicleLocal setPosASL _orb;
_exp setParticleCircle [0,[0,0,0]];
_exp setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal.p3d",16,0,16,1], "", "Billboard", 1, 0.3, [0,0,0], [0,0,0],5,10,7,0.1, [100,80], [[1,1,1,1],[1,1,1,0]], [1], 1, 0, "", "",_orb, 0, false];
_exp setDropInterval 0.1;
_exp2 = "#particlesource" createVehicleLocal setPosASL _orb;
_exp2 setParticleCircle [0, [0, 0, 0]];
_exp2 setParticleRandom [0, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_exp2 setParticleParams [["\A3\data_f\cl_basic", 1, 0, 1], "", "Billboard", 1,0.5,[0,0,0],[0,0,3],0,10,7.9, 0, [10,200], [[1, 1, 1, 1], [1, 1, 1, 1]], [0.08], 0, 0, "", "", _orb, 0, false];
_exp2 setDropInterval 500;
sleep 0.3;
deleteVehicle _orb;'
or adding something like
if`` (!isServer) exitWith {};
_pos1 = ASLToAGL getPosASL b1;
_orb = "Sign_Sphere10cm_F" createVehicle getPos _pos1;
_exp = "#particlesource" createVehicleLocal getPos _orb;
_exp setParticleCircle [0,[0,0,0]];
_exp setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal.p3d",16,0,16,1], "", "Billboard", 1, 0.3, [0,0,0], [0,0,0],5,10,7,0.1, [100,80], [[1,1,1,1],[1,1,1,0]], [1], 1, 0, "", "",_orb, 0, false];
_exp setDropInterval 0.1;
_exp2 = "#particlesource" createVehicleLocal getPosASL _orb;
_exp2 setParticleCircle [0, [0, 0, 0]];
_exp2 setParticleRandom [0, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_exp2 setParticleParams [["\A3\data_f\cl_basic", 1, 0, 1], "", "Billboard", 1,0.5,[0,0,0],[0,0,3],0,10,7.9, 0, [10,200], [[1, 1, 1, 1], [1, 1, 1, 1]], [0.08], 0, 0, "", "", _orb, 0, false];
_exp2 setDropInterval 500;
sleep 0.3;
deleteVehicle _orb;'
but neither seem to work for me.
change setPosASL to getPosASL for the createVehicle
or getPosATL would probably be the best
example
private _obj = "classname" createVehicle [0,0,0];
_obj setPosASL _someASLposition;
// or
_obj setPosASL getPosASL _someOtherObject;```
that is bloody perfect mate, thank you for cracking the code
_orb setPosASL getPosASL b1; is what fixed it
π
Idk if this belongs in here or #arma3_ai , but im trying to get units from another faction to have the Vietcong ambient voices coming from them, the sort of echoey sounding ones u can hear in the distance and in combat
for that you probably need to play with the https://community.bistudio.com/wiki/setIdentity command
is there a simple field that can be accessed to determine whether or not a unit is currently firing a weapon?
there is event handlers for that https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Fired or https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#FiredMan
Ty! I was hoping there was a state variable that I could check against a unit, but that will have to suffice!
Is there a way to temporarily change the time (or time of day) for each player individually in an MP mission? I would like to make it very dark for players who enter a cave via the trigger area, for example, so that flashlights are needed there. But for all players outside the cave it should remain light.
No, not possible. You can darken the screen artificially through post processing, but the flashlight will be very dark then as well and nvg's wont work either
sad. whats with that?: https://community.bistudio.com/wiki/setAperture
found it maybe this could be a solution? It should be only affect when they are in the Trigger area, when they leave it should reset. So maybe it does not affect Indoor/Outdoor lighting outside of the cave?
Anyone happen to have an example Survivable helo crash script? Want it so when any vehicle or really ariel vehicle goes past a trigger it will destory their engine and force them to crash but everyone survives... Anyone got an example script that does this? I saw one in a search, but the example isn't available for download... so yeah... help?
https://steamcommunity.com/sharedfiles/filedetails/?id=3275777200
This composition uses a script that does exactly that
That is the ppeffect I was referring to. It will darken your whole screen, so if you dont have any lights in the cave, or flashlights, or nvg's, then it will work well. If you have any of the previously mentioned things then it will look incorrect
so there is no solution for my plans currently.
No
maybe some onEachFrame setDate, and that would be awful yet somehow work
and would lead into performance issues
well, it's not gonna be fine, or clean
can this be expanded to work with vehicles too?
i tested the setaperture in eden. looks good enough for my mission. Now i have a problem, where is my logic and thinking problem?
Trigger:
Repeatable: yes
Condition:
this && {player in thisList}
onAct:
[player] execVM "dark.sqf";
onDeact:
[player] execVM "light.sqf";
dark.sqf:
player setAperture 15;
light.sqf:
player setAperture -1;
I got a scripterror when the trigger triggers there is missing ;
Im not the best scripter, Thanks for helping
how I have to rewrite it?
rather see setApertureNew
setApertureNew seems looks similar with that. just more fine tuning options.
if (hasInterface) then {
setAperture 15;
};
curious, why can't I iterate through commands when using forEach?
{ 0 _x 0 } forEach [fadeEnvironment, fadeSound, fadeMusic, fadeRadio, fadeSpeech]; am I stupid or does the game block it due to trying to be stupid-proof
I made myself a macro to write them line after line but was wondering if I can just do anything else
Iterate through functions.
elaborate please
{
[0, 0] call _x;
} forEach [
{ (_this select 0) fadeEnvironment (_this select 1); },
{ (_this select 0) fadeSound (_this select 1); },
{ (_this select 0) fadeMusic (_this select 1); },
{ (_this select 0) fadeRadio (_this select 1); },
{ (_this select 0) fadeSpeech (_this select 1); }
];
Another option:
{
call (compile (format ["0 %1 0;", _x]));
} forEach ["fadeEnvironment", "fadeSound", "fadeMusic", "fadeRadio", "fadeSpeech"];
But, AFAIK, this option clutters up memory.
ok I couldn't really visualise it myself, thanks
IMO:
You shouldn't use a macro to write this code, as it abstracts what the code is when you or someone else goes to debug
And trying to use a forEach to call each function with the same parameters is a terrible way of calling all those commands.
The simplest option is best. Just write out each line. If you are only using that block of code 2 or 3 times, then you don't need a function or macro, just copy paste it. If you are using it more than that, then consider writing it as a function. Macro is a valid option too, but I am of the opinion that macros are only for constant numbers and variable strings (for set/get variable).
by macro I meant a VSC macro to insert those commands one by one
Are you really writing those so much that you need a key macro to save time?
yup
Wow. Cools!
sounds like its time for you to create a framework for yourself and make it a function
one of the most π things I've read here
I think I'll pass for now lol
I am happy, in singleplayer environment, in my lane, flourishing
never said I was proud of this one
Not sure because I forgot how it really works. But I think it should
tried out set speaker, but would set identity do?
Does anyone know why this isnt setting the ctrl's text?
_bottomText = format["<t color='#ffffff' size='3'> 'Ctrl C/V' to copy paste objects. 'L' to activate light, '-/+' to decrease or increase brightness. '%1' to activate night vision.</t>", _key];
((findDisplay 1900) displayCtrl 1951) ctrlSetStructuredText parseText _bottomText;
I can use ctrlSetText to update it, but then it includes the <t color stuff which I obviously dont want
ah, the control isnt a structured text control, its just a standard rscText one
gday. Got a question regarding the drawlaser function.
I am trying to create a laser for a laser gun.
addMissionEventHandler ["Draw3D", {
drawLaser [
getPosASL object_1,
getPosASLVisual object_1 vectorFromTo [getPosASLVisual object_2 select 0, (getPosASLVisual object_2 select 1), (getPosASLVisual object_2 select 2) + 1], // This only to get the laser beam to hit the object in the middle, not on ground level
[1000000, 30000, 0],
[],
400,
400,
5000,
false
];
}];
This creates a real nice orange laser between 2 pre defined objects but thre problems are that i dont know how to delete the laser after and that the laser only goes for 1, maybe 2 km, even with -1 as the range. how would i increase how far it draws for a multiplayer mission?
The laser isn't actually a persistent thing. It's being drawn anew every single frame by the Draw3D EH running drawLaser again. To stop it, you just need to remove that Draw3D EH. Save the return from the EH when you add it (_laserEH = addMissionEventHandler ...) and use it with removeMissionEventHandler when it's time to remove it.
About the length: as the wiki says, there is a maximum length and it's controlled by CfgIRLaserSettings. -1 length is "maximum allowed", not "infinite". I don't know what the config maximum is off the top of my head, but you should be able to find out fairly easily.
Also, I'm not 100% certain whether it'll render if the source is outside view distance.
hey whats up guys, i have no experience in coding arma but im trying to figure out a way to force helicopters to deploy countermeasures when they enter a trigger but there's very few resources online on how to do this
i understand the variable names and stuff like that but im using RHS UH60 helicopters so the classnames might be different
Countermeasures are a weapon; you need to force them to fire it. See forceWeaponFire and related commands.
Classnames are the easy part, you can just look up the vehicle's config in the Editor config viewer (e.g. place vehicle -> right-click -> find in config viewer) and see exactly what weapons it comes with, including the name of its countermeasures launcher.
these are the weapons?
"weapons[] = {"rhsusf_weap_ANALQ144"};"?
and i notice it also says "weaponslots=0"
Don't worry about that
just to clear it up heres a pic of the config piece in question
AN/ALQ-144 is an IRCM system. It's possible the RHS UH-60 comes with this as its anti-MANPADS defense rather than flares (I'm just launching the game to check now)
Alright
If that is the case, then you can simply add the vanilla flare launcher and a magazine for it, then force fire that.
Alright I was about to ask
Because I didn't even check if this thing had flares to begin with π
Yeah looks like it has invisible countermeasures with this infrared system
How would I go about adding the vanilla flare launcher?
addWeapon and addMagazine
The vanilla flare launcher is CMFlareLauncher and its magazines are 60rnd_CMFlareMagazine or 60rnd_CMFlare_Chaff_Magazine (+ 120rnd, 240rnd).
Add the magazine first so it gets instantly loaded into the weapon when the weapon is loaded
forgive my ignorance but is this what my init section in the heli would look like?
actually i will switch the places of magazine and weapon like you said
You need quotes around the "classnames", not around the whole thing
You also need to specify which vehicle you want to add the things to - addWeapon and addMagazine take both left and right arguments, e.g.
this addWeapon "CMFlareLauncher";```
How's this?
Exactly, but don't forget to switch the rows to add the magazine first
Sorry, I was doing some science. It doesn't seem to be possible to get the AI to use the weapon's burst-fire modes - they'll only fire single flares even if you specify the burst mode in forceWeaponFire π€
Alright thats fine, how do I get them to fire single flares?
Well, the other thing I found is that - even though it should work for this and I've previously used it just fine - addWeapon isn't exactly what you need for this.
this addMagazineTurret ["60rnd_CMFlareMagazine",[-1]];
this addWeaponTurret ["CMFlareLauncher",[-1]];```
Now to actually fire is pretty simple:
```sqf
driver heli8 forceWeaponFire ["CMFlareLauncher","Single"];```
allMapMarkers - is there a way to identify which icon the marker is using?
@hallow mortar the flares seem to work just fine but i get this error message, any idea what this could mean?
heli6 is the variable name of an AI group. You should use the variable name of the helicopter object itself.
also another question, since the AI can't fire them in burst mode, is it possible for them to simply repeat the command 2 or 3 times to achieve a similar effect?
Never mind, getMarkerType !
Oh I must've missed that
Yes:
0 spawn {
for "_i" from 1 to 3 do {
driver heli8 forceWeaponFire ["CMFlareLauncher","Single"];
sleep 0.3;
};
};```
the code in question:
if (!alive _patienta) then {
if (isNull _patients) then {
_patients = createGroup [west, false];
};
_selectedUnit = selectRandom _soldierClasses;
hint _selectedUnit;
_patienta = _patients createUnit [_selectedUnit, [2608.584,2823.699,0.970], [], 0, "CAN_COLLIDE"];
if (_patienta isEqualTo objNull) then {
hint "Failed to create Patient A!";
} else {
[_patienta] call _fnc_randomizeDamage;
};
} else {
How can I work around this? I've tried numerous things to be able to check if a unit is created or existant before firing the partof the script that creates the unit if they dont exist already, but i just keep getting floored by "undefined variable in expression"
okay so just
if (isNil _patienta) then { ...code... };
should do?
and ill do so, sorry about that
Have you read the article?
Im reading it now and asking questions to confirm comprehension
OK, according to the 1st syntax, you should provide variable name.
i see, in quotes
Secondly, it's up to you to decide where to use negation or not:
if (isNil "_patienta") then {
// _patienta is not defined
} else {
// _patienta is defined
};
if (!(isNil "_patienta")) then {
// _patienta is defined
} else {
// _patienta is not defined
};
sure, is pretty apparent - i was asking mainly about the syntax format being correct
does it have to be encapsulated in parentheses to do accurate negation?
(!(isNil "patienta")) vs (!isNil "patienta")
No, I added extra parentheses just for readability.
ah okay, thanks - i wouldnt have doubted it, given the arma 3 scripting language experiences ive had so far lol
Struggling now with the group of the createUnit portion of the code... I had placed _patients = createGroup [west, false]; in init.sqf for the mission. this code that is running is an addAction that adds another separate script file as the code to run for the action - am i having problems with scope? I would've thought that something like groups would be global
But I keep getting told that _patients is again an undefined variable
_patienta = _patients createUnit [_selectedUnit, [2608.584,2823.699,0.970], [], 0, "CAN_COLLIDE"];
Groups are global, variables can be local, as in your case.
Okay so maybe I am not understanding something about referencing the group properly?
Maybe.
init.sqf:
_patients = createGroup [west, false];
if (!isNil "_patients") then {
hint "Created _patients group!";
};
This hint fires on startup
spawnpatient.sqf snippet:
_selectedUnit = selectRandom _soldierClasses;
hint _selectedUnit;
_patienta = _patients createUnit [_selectedUnit, [2608.584,2823.699,0.970], [], 0, "CAN_COLLIDE"];
It is throwing an error about an undefined variable in expression, referring to _patients
Yes, _patients is undefined in spawnpatient.sqf.
yeah i see where im going wrong, from misunderstanding something rather basic
I thought _ was for global scope, not for local
i feel stupid
in an addon, is there a reason initServer.sqf is running on the main menu and on mission load?
setIdentity does same as setSpeaker and more
does anyone know how to get man head position that works even if he is in vehicle? cant use eyePos because it becomes turret position or something in vehicle
Selection "head"?
why would a light source produce this
while other lightsoruces set up the same way produce a normal orb
is it just a case of too bright for the colour or something else?
_light4 = "#lightpoint" createVehicleLocal getPosATL object_1;
_light4 setLightIntensity 2;
_light4 setLightBrightness 5;
_light4 setLightDayLight true;
_light4 setLightFlareSize 10;
_light4 setLightFlareMaxDistance 2000;
_light4 setLightAmbient [1,0.3,0];
_light4 setLightColor[1,0.3,0];
thx i tried that but when I goto tank it still gives position above the tank and not inside...
nvm was a laser fucking our apologies
"pilot"?
same thing position is above tank
Anybody know how I can find the addon that a weapon class belongs to for my config.cpp's required addons?
Looking for the SPE_LMG_303_Mk2, but wondering if there is a usual way to figure this out.
Advanced Developer Tools will show what addon(s) defines a given class
https://steamcommunity.com/sharedfiles/filedetails/?id=2369477168
Thanks guys π
is it possible to get full config tree from group classname? like this
getConfigTree "BUS_InfSquad" -> (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfSquad")
is it possible to render a camera view or r2t on the players HUD / screenspace?
wow awsome ArmA 3 WooHoo
is there a way to calculate what would be the results of screenToWorldDirection in 2.16? nevermind i'm switching to dev branch
using screentoworld and taking the vector from the camera to that position only works below the horizon
_configTree = configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfSquad";
but what if i dont know this elements: "CfgGroups" >> "West" >> "BLU_F" >> "Infantry"
i only have group classname as parameter
is it possible to get other elements of tree with command?
By recursive search.
btw would this work ? _light4 = "#lightpoint" createVehicleLocal getPosATL object_1;
ooop
_light4 = "#lightpoint" createVehicleLocal getPosASL object_1;
there lol
ASL,<-------- ?
Are you really waiting for someone to run the game and check if it works?
no im checking now
its for my Deep Diver mission
Waiting is the hardest part he he
WooHoo ArmA 3
Not by the class alone.
There could be the same class name in different root classes, e.g.
class SomeRootClass {
class aClass { ... };
};
class SomeOtherRootClass {
class aClass { ... };
};
How would the engine know which aClass you want?
What is your use case that you need the config path?
Is it possible that diffing two arrays of positions can fail?
[ [1,2,3.0050], [0,0,0] ] - [ [0,0,0] ] (like this)
What do you mean?
As a workaround, you can use https://community.bistudio.com/wiki/deleteAt.
i wonder how reliable == on two floats is in general 
Not doing the set difference operation. The resulting set consisting of the initial number of elements.
is it a question in general or have you encountered it? Or have some bug that you suspect is caused by it?
I have encountered it.
nvm
Could you provide some code?
wiki example:
floating point is fun
so yeah, getting the example of your code would be nice
(tower call BIS_fnc_buildingPositions) - [[12191,12597.2,9.66031],[12195.9,12600.1,9.64397],[12193.8,12599.2,9.65215],[12191.8,12599.6,9.64397],[12197.7,12597.5,9.64397],[12195.8,12592.4,9.649],[12199.4,12601.8,9.65215],[12190.2,12605.7,9.64397],[12195.4,12596.4,13.2141],[12189.6,12597.6,13.2186],[12191.4,12602.3,13.2141],[12196.6,12600.1,13.2141]]
That's definitely going to be rounding errors
It works when I do it directly with two arrrays, but not as a result of fnc.
Yes, rounding errors. The function is not returning precisely the same positions (because they're dynamically calculated every time). It could be off by 0.0001 and that would be enough to not count as a match.
make a function that counts distance to the positions, to check if its the "same" position. then do whatever you want with that info
If you're gonna write that much out then better to make a whitelist tbh. Not like building positions change.
doesnt building rotation effect, or are those relative positions?
Can anyone give me a hint. Trying to turn off vehicles insignia in CSLA this way:
CSLA_fnc_tacNum = {};
CSLA_fnc_randomNumbers = {};
CSLA_fnc_texturaVehiculi = {};
Numbers successfully turned off, but national emblem - not. As I understand 'CSLA_fnc_texturaVehiculi' is responsible for this. Is there a way to shut down this function?
If a function is final you can't change it using scripts (use isFinal to check)
The only way is overriding it with a config patch
What causes jitter when using unitCapture? I'm recording it at 100 FPS with the trigger, but sometimes the unit is really stuttery on playback
might be because you're playing the data far from thhe 0,0 point of the map and calculations have bigger error.
lowering the framerate or choosing an area closer to the lower left corner of the map might help
seen Kydoimos on the forums writing that playing the data on game logic with attached vehicle helps, but you won't get any animations.
Thank you! I'll give these a shot
btw _light4 = "#lightpoint" createVehicleLocal getPosATL object_1; Works Awsome WooHoo ArmA 3
or btw _light4 = "#lightpoint" createVehicleLocal getPosASL object_1; Works Awsome WooHoo ArmA 3
hell yeah
freekin Awsome
Anyone know what I might do to reproduce a somewhat passable smoke trail for a missile? I noticed the vanilla SAM LR sites, and most other missiles for that matter, don't really leave behind any sort of trail besides a barely visible area where the air has been heated. The first obvious solution was attaching a SmokeShell_Infinite to the missile, which doesn't dispense often enough. not sure what other options I have, I don't normally do effects stuff
for science, I did try attaching 15 smoke shells instead of 1; no real improvement, but I might play with it more
It's possible to create particle effects using scripts. ParticleArray, it maybe is confusing at first anyways
ah nice, this looks to be exactly what im looking for. create a particle source, attach it to the missile and move on with your day. To confirm, all of the actual effects are stored in "\A3\data_f\ParticleEffects\Universal\Universal", and you can select individual frames of the "image" to cycle through?
~~I'm trying to make a ticket system by detecting AI vehicles, and adding killed event handlers so if a player kills an enemy vehicle, tickets are gained. The problem is the killed event handler is weird if a vehicle is the killer. The wiki mentions this but it doesn't say how to get around that. So i'm trying to detect if a player is in the vehicle that killed the enemy, but it's not working.
if (((isPlayer _killer)||(player in _killer))&&(side group _unit == resistance)) then {
foobar
};```~~
Fixed this
in isn't the correct command, see: https://forums.bohemia.net/forums/topic/186677-checking-if-a-player-is-in-a-vehicle/
I did see that thread. If i did !(isNull objectParent player), wouldn't that make it so that if any vehicle gets destroyed by anyone, and the player is in any vehicle at the same time, then it would count anyways? May also be worth saying that this is for a multiplayer game
All that check does is return true if player is in a vehicle
You can also probably just use _instigator, which is the unit who "pulled the trigger"
Just check if the players object parent is equal to the vehicle that did the killing instead of checking if its null
You'd have to do some extra checks as well for that, since most times it's the effectiveCommander of the vehicle
So I'm playing around with ALiVE, trying to set up a QRF.
I've got a combat support helicopter (chinook) That calls an sqf file in it's init:
// loadTroopsToHeli.sqf
// Parameters
_helicopter = _this select 0;
_troopGroup = createGroup west;
_units = [
"B_Soldier_SL_F",
"B_Soldier_F",
"B_soldier_LAT_F",
"B_soldier_M_F",
"B_Soldier_TL_F",
"B_soldier_AR_F",
"B_Soldier_A_F",
"B_medic_F"
];
{
_unit = _troopGroup createUnit [_x, getPos _helicopter, [], 0, "FORM"];
_unit moveInCargo _helicopter;
} forEach _units;```
That loads infantry into the helicopter at spawn.
The problem is, when I select "INSERT" or "LAND" from the alive menu, the QRF doesn't get out.
Or something like that, been a bit since I've used a killed eh
I thought I could get the helicopter's (group's) waypoints with waypoints group this; and run a script to rappel them, but it just returns an empty string.
Ideally, I can search through any waypoints the helicopter has, and once I figure out the waypoint type ALiVE is using for the insertion, add AR_Rappel_All_Cargo to it.
If you use ace they have a fastrope waypoint
Unless alive dynamically makes them
Never used it
ALiVE doesn't use a fast rope wp, no, it just makes the helo hover. ALiVE seems to assume there will be a human on board since that's what it's meant for, but I want to have an on-call AI QRF.
π€ The other problem is, that init runs at unit spawn, not when I call for them, so that method won't really work anyway.
Anyone know how to get the player/unit that fires a lasertarget from the target object?
shotParent or any kind of shot/weaponn state info don't seem to work
no luck with either, they just wont use the ambient Vietnamese voices, idk if its the "vie" speaker on a unit that causes that ambient audio
You could try objectParent. That's just a guess though, no idea if it'll actually work.
Another way would be to check every player and see if their laserTarget is extremely close to the one you're looking at. Technically it would be possible for 2 people to put theirs right on top of each other, but it's pretty unlikely.
If objectParent doesn't work, it might be worth putting in a FT ticket for a laserTargetOwner command; it's a bit of an oversight that there isn't one (if objectParent doesn't work)
Why did I say to compare positions with the players' laserTarget? Just check if it's the same object
You need to add stuff to it yourself with setVariable on fire moment
It doesn't trigger Fired or FiredMan so you'll need to do OEF check with laserTarget command on units and vehicles
Hah. That was exactly what I ended up doing.
On a loop:
{
private _laserTarget = laserTarget _x;
private _ownerPlayer = (_x getVariable ["BIS_WL_ownerAsset", "123"]) call BIS_fnc_getUnitByUID;
_laserTarget setVariable ["BIS_WL_laserPlayer", _ownerPlayer, true];
} forEach allPlayers;
{
private _vehicle = _x;
private _ownerPlayer = (_vehicle getVariable ["BIS_WL_ownerAsset", "123"]) call BIS_fnc_getUnitByUID;
{
private _laserTarget = _vehicle laserTarget _x;
_laserTarget setVariable ["BIS_WL_laserPlayer", _ownerPlayer, true];
} forEach (allTurrets _vehicle);
} forEach vehicles;
I also found a feedback request for them to add hit/fire EHs on laser, but not much movement on those for a couple years so I'm not gonna hold my breath for that.
is there any native a3 function to dump a cfg class with all its contents (aka including subclasses of any level) recreated as the original config definition?
there a custom functions like this. just wondering if a3 itself has that or not
then i dunno. maybe someone else does
Don't think so.
ive gone deep into the Bohemia Interactive forums and asked here and the S.O.G discord but cant find anything
it may be a lost cause π₯²
I assume you only do this on server side
Actually I realized there was a better way. Instead of having a loop, I put it on the client's event handler on entity created, check if entity is LaserTarget and then run that.
But you'll have laser target, not whoever fired it
What do you mean?
Let me test it multiplayer
it shouldnt be harder than unit1 setSpeaker "Male02GRE"; (plus remExec) can you post the code you have?
Ah I see what you mean. Yes, I need to move the code server-side.
ive tried out this setspeaker "vie" and this setspeaker "male01vie" the first one seems to work, in that they speak Vietnamese for orders ( aka no audio cuz the Vietnamese faction has no voice lines ) but i now think this is separate from what creates the ambient voices u can hear from them in the jungle
and you test that via editor?
yes
well maybe you should try one of the vanilla voices like "Male01GRE" - greek . to see if those work
VIE is the only available additional voices. And no, it does not have any voice lines actually
yeah but im looking for the ambient voices that the Vietcong/PAVN factions have and how to apply them to other units in mission
Okay, fixed the laser code and tested to work in MP.
// server event handler
addMissionEventHandler ["EntityCreated", {
params ["_entity"];
scopeName "MainEntityCreated";
if (_entity isKindOf "LaserTarget") then {
{
private _laserTarget = laserTarget _x;
if (_laserTarget isEqualTo _entity) then {
private _ownerPlayer = (_x getVariable ["BIS_WL_ownerAsset", "123"]) call BIS_fnc_getUnitByUID;
_laserTarget setVariable ["BIS_WL_laserPlayer", _ownerPlayer, true];
breakTo "MainEntityCreated";
};
} forEach allPlayers;
{
private _vehicle = _x;
{
private _laserTarget = _vehicle laserTarget _x;
if (_laserTarget isEqualTo _entity) then {
private _ownerPlayer = (_x getVariable ["BIS_WL_ownerAsset", "123"]) call BIS_fnc_getUnitByUID;
_laserTarget setVariable ["BIS_WL_laserPlayer", _ownerPlayer, true];
breakTo "MainEntityCreated";
};
} forEach (allTurrets _vehicle);
} forEach vehicles;
};
}];
And then on the client side, on each frame, get all entities of LaserTarget type, draw icon 3d, draw icon on map etc. Seems to work for me.
I'm just setting the variable for each laser target as it's created on the server. My guess is since you can't easily run laserTarget for a remote player, this is the approach that generally uses the least amount of server network traffic possible.
mandatory "you can use ``if !(_entity isKindOf "LaserTarget") exitWith {};` to have one fewer indentation level through the rest of the function"
Have a look at the unit's config and see if it has any interesting event handlers, and look in the Functions Viewer at the SOGPF functions. It's very likely this is a scripted system and not using the unit's engine voice stuff.
almost certainly its a scripted system and not radio protocol. so setSpeaker/identity wont help here
yeah, did some looking in functions and config and didnt find much but im a bit of a novice with this stuff so i might have missed obvious stuff in it
Is there a way to apply a rotational velocity to a vehicle? Like for example applying a rotation to the side and causing the vehicle to do a barrel roll
Or is the only way to just launch a heavy object at it and hope it doesnβt arma itself?
can i somehow rewrite/replace addon function by declaring same function missionconfig?
Very unlikely, since it's compileFinal'ized.
https://community.bistudio.com/wiki/BIS_fnc_recompile
can this help?
no. Final is, well, final
oh thx @faint burrow @south swan I was thinking velocity so I was only typing that when searching
is there a command that allows you to execute code string that has comments in it? right now I think we just have file compile commands
how to disable players ability to control drone, not disconnecting but when player press buttons they wont do anything?
Is it possible to keep music playing after the death of a player in SP when he can still switch units?
These commands don't work?
i want to compile string not a file
Provide a string.
what?
Look at the last example (3.), maybe you can find it useful.
https://community.bistudio.com/wiki/toString
https://community.bistudio.com/wiki/compile accepts a code string, not path.
but can it deal with comments?
Don't know.
think you bit misunderstood , its the comments in string that are difficult to handle
Since it compiles code files with comments, I think so.
i get "invalid number is expression" when trying to compile code with comment
i wonder how debug console handles comments
You can use preProcessFile, but it is for files only. But if you make a code block variable that you preprocess and then convert into a string, you can compile the string then, but there is probably no use for that.
yeah trying to avoid files..
The example I provided above works for me:
0 spawn {
private _compilableString = toString {
hint "it works!";
//My comment here...
};
hint _compilableString; // hints ' hint "it works!" '
sleep 2;
call compile _compilableString; // hints ' it works! '
}
oh nice..
But I am not sure why you need it as a string with comments inside.
That seems like an unusual case to me.
I know sounds weird, im actually working on some code debug stuff
ok i think I see whats happening in that sample.. the arma compiler processes the code block {} leaving comments out
but I already have a string so dont know if that helps me
In that case, you would need to write your own parser, probably. Not sure if that is even possible just with commands.
yah, too lazy
I found the code how debug console deals with comments . its in RscDebugConsole.sqf not sure if its ok to post code that isnt mine in here?
The preprocessor strips away comments.
Anything that is preprocessed (which is every .sqf file, in general) will not contain comments.
But you cannot run that from a non-file.
I didn't know that Debug Console handles comments? If it does then it does badly, everytime I paste something with comments its not working right.
Is it possible to do Transparency with #RRGGBBAA?
I am trying to do procedural texture, and I want to have floating text apparently
#(rgb,512,256,3)text(1,1,"TahomaB",0.1,#00000000,#ffffff,"Test Hello World")
That doesnt work
literally the #(rgb,512,512,3)text(0,0,"Caveat",0.3,"#0000ff7f","#ff0000","Hallo\nWelt")example form wiki, though https://community.bistudio.com/wiki/Procedural_Textures#Text
or with litrally your version
pls help how can i block player or ai ability to control vehicle (drone) so it will move by intertia
or just make the ai drone not to autohover
Hey, what object did you use? Because apparently the reason it doesnt work for me is that Banner objects cant be transparent or smth I think
When I send one variable via publicVariable into the JIP queue multiple times with different values, will it send the latest one to the JIP client or all its versions in the exact order, resulting in multiple changes? Thx.
UserTexture10m_F
is there an event that could be used reliably on units / entities for when their position / state changes?
only line comments // it seems
Kk implemented it stripping line comments but not block comments.
This was done before regEx was added so maybe this could be added as well?
IIRC JIP clients only get the one, but live clients get multiple, even if you publish the same var multiple times in a frame.
when I want transform this:
15 fadeMusic 0;
into this, whats the issue?
["sgmusic_1"] remoteExec [15, "fadeMusic", 0]
Wrong syntax, read BIKI.
We also have pinned messages here that explain how remoteExec works
for playmusic this here works:
["sgmusic_1"] remoteExec ["playMusic", 0]
But how I transform fademusic?
Have you read docs?
yeah read it, but did not explain how I integrate the first parameter of fademusic into a remoteExec command.
You just put the parameters in the left hand side array
[5, 0] remoteExec ["fadeMusic"] is 5 fadeMusic 0
See this
fadeMusic doesnt take a string, so "sgmusic_1" isnt relevent
so fadeMusic stops all music at once? not a specific one?
Read the description of the wiki...
https://community.bistudio.com/wiki/fadeMusic
There's only 1 music at any given time
In the description.ext would it be possible to add preprocessing commands or access a variable from any scope.
I want it, so depending on a specific variable joinUnassigned will be 0 or 1
thanks I'll see what I can do
okay that worked perfectly, but before I go about this approach. Is there any way to have a mod modify all description.ext's that get loaded with similar ideas of preprocessing?
like I expect you to say no, but worth investigating before I proceed
Basically I have a mod that I want to control this variable (joinUnassigned) for all missions as it's required for the tech to work of the mod
You can't modify a mission config from a mod config
sadge the way I've got it will work well enough
I just wanted roles to be autoassigned in certain situations
Would be a nice feature to have tho 
Does anybody know why task completion notifications are delayed in multiplayer when invoked via a trigger?
how can I upload my mission in steam to let people try it
Press Steam Workshop icon in Eden
...... seriously? no seriously?
-_- impossible to end loops clogging the scheduler aren't 0.0000th of a second but fucking seconds after 30 mins
are you fucking serious
we're missing a facepalm emote here.
well, for example triggers stopping to work completely because the scheduler cannot handle them in a timely fashion ?
let's not forget that you also fuck everyone else's exec time because you don't and can't end those loops without ending them all.
@tough abyss i think the problem in your scripts is that you write a lot of crap in it that is not needed that they run so long
I got that issue with around 60 sqf/s scripts running at once
Your Soilder Tracker
Well you can read the value from the mod instead of the mission
Or use a combination of both
Like if mission config has something set then apply the mod config. Or make a mod function that's called by the mission function.
There are many ideas for this. It depends what you want to do
I don't know why you're using a misison config for this tho
If you're trying to make a read only var you can use compileFinal
Is there any good way to make it so that I trigger end1 if the player dies? Tried a trigger like this but can't seem to get it to work
Reason being, I've got a campaign and I need end1 to trigger the next mission and move ahead and this mission only ends when you die
i guess the mission ends before the trigger is activated. but this code should do the same thing: ```sqf
player addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
endMission "END1";
}];
!(alive player) should work then, idk what the problem with exclamation marks was there but brackets usually help
doesnt work for me
well, BI vehicle respawn module is broken as fuck π
with the end #1 type?
yeah
what if type's None and you put endmission in the activation field?
the vehicles will respawn but if there's wrecks above the spawn point it'll be a loop of exploding vehicles.
meh, I could just use a PFH or use EHs.
hi all!
Is there a way to store the mission source file in a way that is digestible for GIT so that we could meaningfully resolve merge conflicts? By default the mission save file format is not human readable.
under the editor Attributes -> General -> Misc there is "binarize the scennarion file". untick that to make it human readable
amazing, thank you!
a PFH that evaluates every minute isn't a big perf hog
PFH?
PerFrameHandler
BI call this onEachFrame
CBA PFH runs inside a stacked onEachFrame EH
or on a DrawEH
except i don't think even unbinarized mission.sqm is very git-merge-friendly
if stacked onEachFrame EH not exist
with its lists explicitly stating their length, list members being explicitly namednumbered, etc.
Let's add mission.sqm to .gitignore!
whoo needs it anyways 
I hope BI finally expand on stacked EHs, they started in 1.54
Now if I could add nested events in my description.ext that would be noice
Hi guys. Im trying to createa new module for the editor/zeus which will add addAction to synced/selected object. Any ideas how could i achieve that?
addAction is suppose to launch a GUI
check the mod called ares, it already has that feature
source code should be on github
I'm quite sure someone made a merge-able mission.sqm format
I wanted to do it once, but then didn't because someone else did it.
Basically converts mission.sqm, into a different file that has the same data but in a merge-friendly way.
And then a thing that converts it back. But that was years ago
Well it would be merge friendly if we hadn't have the issues with number precision.
is there a simple way to access all tasks currently active in a mission?
Nope
Afaik there is no "allTasks" function
Sorry....typo
hahaha, all good
Do you create the tasks yourself?
No, unfortunately. Hoping to synchronise active tasks to another interface
I guess you need to loop through all namespaces and look for task ids
There is this: https://community.bistudio.com/wiki/BIS_fnc_tasksUnit
If you only care about tasks that the local player has available, it may be good enough for you
Same, All the time. Im always looking at the right place, just the wrong part
Hahaha, yeah
Thank you @hallow mortar !
FYI - A3A has "A3A_activeTasks" var
Handy
Is there something more reliable than "roleDescription" to determine if team leader, rifleman, etc?
Is it possible to prevent vehicle's wheels clipping through terrain on sloped surfaces when using setDir? I also tried setVectorUp, setPos, setPosATL, it still gets under the surface sometimes.
you can do something like this, and then use the _classRole if you want to match with those variables above, like using in switch.
switch (_classRole) do {case PIG_officer : {hint "I am an officer"}}```
@thin fox thank you! If I have to go down this way, I will. Unfortunate! I was hoping something was exposed to do this without the manual mapping π¦
Why would you make those all global variables
Unless it's being used for something else as well
of course, I was using those for arsenal whitelisting, mostly to check if it's working on debug
Its complicated if you want it perfect, it might not be possible to have all 4 wheels touching ground for example due to terrain geometry
You could try using the unit's icon. Most mods use relevant ones, like iconManLeader for squad leads, but it's obviously not perfect
@tulip ridge thats exactly what im trying to pull based on role
is there a function that returns that for a unit?
No, just do a config lookup. getText (configOf _unit >> "icon")
Ahhhh, right
Thank you!
I completely forgot config lookups were a thing
its been awhile
nice idea
That was exactly what I was chasing Dart, thank you
No. But I have written my own.
#define ICON_MAN '\a3\ui_f\data\map\vehicleicons\iconMan_ca.paa'
#define ICON_MAN_AT '\A3\ui_f\data\map\vehicleicons\iconManAT_ca.paa'
#define ICON_MAN_ENG '\A3\ui_f\data\map\vehicleicons\iconManEngineer_ca.paa'
#define ICON_MAN_MG '\A3\ui_f\data\map\vehicleicons\iconManMG_ca.paa'
#define ICON_MAN_DEMO '\A3\ui_f\data\map\vehicleicons\iconManExplosive_ca.paa'
#define ICON_MAN_MED '\A3\ui_f\data\map\vehicleicons\iconManMedic_ca.paa'
#define ICON_MAN_LEAD '\A3\ui_f\data\map\vehicleicons\iconManLeader_ca.paa'
#define ICON_MAN_DEAD '\a3\ui_f\data\igui\cfg\revive\overlayicons\f100_ca.paa'
#define ICON_MAN_UNCON '\a3\ui_f\data\igui\cfg\revive\overlayicons\u75_ca.paa'
params ["_unit"];
if ((leader _unit) isEqualTo _unit) exitWith {
// return
ICON_MAN_LEAD;
};
if ((_unit getVariable ["ace_medical_medicclass",0]) > 0) exitWith {
// return
ICON_MAN_MED;
};
if ((_unit getVariable ["ACE_isEngineer",0]) > 0) exitWith {
// return
ICON_MAN_ENG;
};
_loadout = getUnitLoadout _unit;
_primaryWeaponClass = _loadout select 0 select 0; // might be nil if no primary
if !(isNil "_primaryWeaponClass") then {
if (([_primaryWeaponClass] call BIS_fnc_itemType) isEqualTo ["Weapon","MachineGun"]) exitWith {
// return
ICON_MAN_MG;
};
};
_launcherWeaponClass = _loadout select 0 select 0; // might be nil if no primary
if !(isNil "_launcherWeaponClass") then {
if (([_launcherWeaponClass] call BIS_fnc_itemType) in [["Weapon","MissileLauncher"],["Weapon","RocketLauncher"]]) exitWith {
// return
ICON_MAN_AT;
};
};
// Default return
ICON_MAN;
Just be aware that icon can either be a class in CfgVehicleIcons or a filepath directly
If you're using ace, there's ace_common_fnc_getVehicleIcon which will always return the file path
If i'm just fetching the units role / icon that is found on the ingame map, what youve provided me will be consistently accurate, i would assume?
Yes
Perfect, thank you
Sorry @tulip ridge , last question re: this for a bit hopefully. Is there a way to fetch the iconPath as well? I assume theres another function like getText ?
// fnc_getVehicleIcon
// ["SomeClassName"] call ...fnc_getVehicleIcon;
// [_someObject] call ...fnc_getVehicleIcon;
params [
["_vehicle", "", [objNull, ""]]
];
// If object is passed, get class name
if (_vehicle isEqualType objNull) then {
_vehicle = typeOf _vehicle;
};
private _icon = getText (configFile >> "CfgVehicles" >> _vehicle >> "icon");
if !("\" in _icon) then {
// If icon is not file path, check CfgVehicleIcons
_icon = getText (configFile >> "CfgVehicleIcons" >> _icon);
};
_icon;
You would need to do another config lookup if the icon is not a file path
Amazing! Thank you @tulip ridge !
getText (configFile >> "CfgVehicleIcons" >> (getText (configOf _unit >> "icon")))
Does the trick
Is there a performance concern with a call like that?
How often will you be doing it?
If the unit's icon config property is already a filepath that will return ""
current implementation is every 200ms
for all units present in a mission
noted, thank you
Then you will definitely want to use a hashmap to store class names and their icons, so that it's faster for repeated classes
just use _Unit setVariable ["Icon",getText (configFile >> "CfgVehicleIcons" >> (getText (configOf _unit >> "icon")))];
That's still running once for each unit, not class
@tulip ridge awesome, thank you, I'll definitely do that
Just make a function that does this, and create a hashmap called YOURTAG_vehicleIcons on mission start (for all machines, so something like init.sqf is fine)
params [
["_vehicle", "", [objNull, ""]]
];
if (_vehicle isEqualType objNull) then {
_vehicle = typeOf _vehicle;
};
private _icon = YOURTAG_vehicleIcons getOrDefault [_vehicle, ""];
if (_icon == "") then {
_icon = getText (configFile >> "CfgVehicles" >> _vehicle >> "icon");
if !("\" in _icon) then {
_icon = getText (configFile >> "CfgVehicleIcons" >> _icon);
};
YOURTAG_vehicleIcons set [_vehicle, _icon];
};
_icon;
This is what ace_common_fnc_getVehicleIcon does
Ahhh, cool, that's awesome, thank you
ah its based on vehicle class , yea hashmap is the way
You use vehicle class so that there's only one config lookup for x of the same unit.
If there's 100 units of the same class, you're only looking at the config once.
π
if (_x isKindOf "CSLA_Tank_F") then {
[_x, "CSLA_misc\signs\empty_ca.paa", 5, 6] spawn CSLA_fnc_texturaVehiculi;
};
How can I make it work every time new vehicle spawns on map? Check every new vehicle
["AllVehicles", "Init", {
...
}, true, [], true] call CBA_fnc_addClassEventHandler;
Or if there is a more specific class, you can use that instead of AllVehicles
@tulip ridge Thanks
Okay. I tried to write smth, based on the information i gathered. Thanks for the Ares mention - really helpful.
Is there a way to script random assignment of role slots? I'm creating a 6v6 TDM style game and would like to make it so players are randomly assigned a slot. Using the built-in "auto assign" seems to assign every player to the same slot always
the lobby scripting is quite limited / difficult. id be surprised if there was a command for that. what are trying to achieve?
I just don't want the players to end up on the same side every match
Ideally I'd like to set up a system where the first round they get randomly assigned across the two teams, then the second round they switch sides, but I suspect that's asking too much from a game like Arma
Do you think, if this function will work?
// Argument 0 is module logic.
_logic = param [0,objNull,[objNull]];
// Argument 1 is list of affected units (affected by value selected in the 'class Units' argument))
_units = param [1,[],[[]]];
// True when the module was activated, false when it's deactivated (i.e., synced triggers are no longer active)
_activated = param [2,true,[true]];
// Module specific behavior. Function can extract arguments from logic and use them.
if (_activated) then
{
_x addAction ["<t color='#d58200'>BWI: Armory</t>", "createDialog 'BWIArmory';"];
} forEach _units;
};
make them all civilian side, then reassign them to a new group of a different side on match start
OH that might work
not might, will work π
Does arma support text to speech through sideradio or other commands? Natively ideally?
I've usually used the usual sounds through sideradio that goes something like "Requesting airstrike at designated location".
But I wanted to implement a 9-liner, for example:
Reaper 6, Stalker 2-1, as fragged, 270 offset north, 11, 100 feet, tank, grid 0109234, target marked with laser code 123, 700 meters southwest, pilot discretion
Does arma allow that?
No
Your name sounds familiar, did you write that all in one command mod?
will work for that particular problem, but may not work with other mechanics I have π
You mean Advanced Developer Tools?
If so, yes, and arma modding is better because of it
He meant ai command menu.
"All-In-One Command Menu" - mod ,
Yes.
He did that too
Yep
Waypoints are for groups, not units, so I'm not sure exactly what you're asking.
you can use https://community.bistudio.com/wiki/setCurrentWaypoint to set their waypoint to the first one.
You can also remove existing waypoints and add new ones.
Hello, im doing a script for a heli that take off when a person is in a trigger and then it goes to a holding position and waits for a laser marker to appear and shoots in the laser, but there is a problem with the line that detects the laser that i cant correct
while { triggerActivated _operationAreaTrigger } do {
private _laserTargets = (_helicopter targetsVisual) select { _x isKindOf "LaserTargetW" };
// If there is a laser-marked target, fire a missile
if (count _laserTargets > 0) then {
private _laserTarget = _laserTargets select 0;
_helicopter doTarget _laserTarget;
_helicopter fireAtTarget [_laserTarget, "missiles_DAR"];
hint "Missile fired at the laser-marked target.";
sleep 10; // Wait before looking for another target
};
sleep 1; // Check every second
};
// When the player leaves the operation area, return to base
hint "Player has left the operation area. Returning to base.";
_helicopter flyInHeight 100;
_helicopter doMove _basePoint;
There is no targetsVisual command, but there is https://community.bistudio.com/wiki/nearTargets.
private _laserTargets = _helicopter nearTargets ["LaserTargetW", 1000];
hint format ["Detected %1 laser targets.", count _laserTargets];
// If there is a laser-marked target, fire a missile
if (count _laserTargets > 0) then {
private _laserTarget = _laserTargets select 0;
_helicopter doTarget _laserTarget;
_helicopter fireAtTarget [_laserTarget, "missiles_DAR"];
hint "Missile fired at the laser-marked target.";
sleep 10; // Wait before looking for another target
} else {
hint "No laser targets detected."; // Debug hint when no targets are detected
};
sleep 1; // Check every second
};
Im using this and nothing happens, no laser detection
Neartargets syntax is
unit nearTargets range
So you need
_helicopter neartargets 1000 select {typeOf _x == "LaserTargetW"};
Or isKindOf
okay let me work with that and let me see, thank you
Are there any methods outside of flyinheight for making an aircraft fly at its assigned altitude no matter what?
Thank you, though I can't get it to work with this one either. The aircraft always bobs pretty violently to avoid terrain
Try using it with flyInHeight.
leader panther11 limitSpeed 150; panther11 setvelocity [-50,50,0]; panther11 flyinheightASL [199, 199, 199]; panther11 flyinheight [200, true] Something like this?
Could just give a player action dependent on them owning a laser, avoid the scheduler thread to look for laser targets
I remember doing that once to do the Halo Reach "designate an artillery" gun for an optre unit
Not sure. Since height ASL is constant, it should be higher than height ATL. And flyInHeight shouldn't be forced.
Unless it's over water, in which case it's lower
Hmm, that does dampen the oscillations, but it still seems to be responding to terrain
Even if I set it to something wild, like 5 meters, it won't ever hit anything
I don't know if you can make AI override their instinct to not slam into things
I meant that for a helicopter to fly at a constant height, the height ASL must be higher, no matter what surface it is over.
probably
asl is constant anyway
I guess to make a helicopter fly at a constant height, the height ASL should be calculated as follows:
_heightAsl = ATLToASL _worldHeightAtlMax;
_heightAsl set [2, (_heightAsl select 2) + 100];
Sorry, I'm still really bad with this scripting stuff, is "100" supposed to be my target altitude?
Yes.
Does this need to be part of a larger script? It's not working in my init
Yes, my code snippet is just a part of a larger script.
I greatly appreciate ya'lls help, I'll see if I can get away with combining both flyinheights before I burn my last two braincells out on scripting lmao
Good luck!
A little hint: for the first version you can not write the code to determine _worldHeightAtlMax, but determine it yourself by finding the highest point on a map.
Anyone knows a way to download all the Mikero's Tools? Or I have to download them one by one?
There is a installer, but I think you have to pay for it
Greetings:
Since
_Number = blufor countSide allPlayers;
Is a number, I am wondering if there is a command that would instead give me all Players from Blufor in an Array.
Similar to the inAreaArray command.
Like the following syntax I am using for a safezone:
_safePlayers = allPlayers inAreaArray _safe;
As this sadly is not transferable to allPlayers inAreaArray blufor.
not in command form, iterate through your list and check which side is each player
private _bluPlayers = allPlayers select {(side group _x == west) && alive _x};```
Oh. I was hoping to have it neat and compact like the other. But thx
Thx, one question tho: WhatΒ΄s the group for? (side group _x == west) = blufor but I donΒ΄t understand the group command there
Oh wait..... it checks for the side of the group the Player (_X) is in......
units' side becomes Civilian when they are unconscious or dead, but their Group's side remains correct
thx! I kinda always forget that that happens!
It depends what you want, but yeah. Another weirdness is that if you create blufor units in a redfor group they'll shoot at each other, because they compare their (unit) side to the group side of their targets. I'm not sure whether there's any practical use for this or why it exists.
I want a list of all Players in a given team "not in the safezone".
_notSafePlayers = ((allPlayers select {(side group _x == west) && alive _x}) - (allPlayers inAreaArray _safe));
Seems to work fine for now
You can condense that a little more:
private _notSafePlayers = allPlayers select {!(_x inArea _safe) && {(side group _x == west) && alive _x}};```
While it doesn't look too much shorter as such, it should be faster because you're not running allPlayers twice
sadly there's no direct not-in-area array command but select is much faster on perf/profile and hopefully will be on stable eventually.
On stable, the inAreaArray subtraction might well be quicker.
understood and ty guys alot!
is there a way to send a message or hint to a specific player? I tried hints but I need to run the script globally so I cannot do this
this: https://community.bistudio.com/wiki/remoteExec to send hint message to specific player, see example 2
I am running a script that goes through every player in a forEach loop, could I use _x as the target or would that not work?
_x should work
thank you β€οΈ
I wouldn't invoke remoteExec from loops.
You could build an array of targets and use that with a single remoteExec, although I'm not sure there's much difference in performance.
Unless you're using it on an array with like 5 billion elements (so not an all-players array), forEach is a loop with a definite exit condition and a relatively small number of iterations. Using remoteExec in that loop is perfectly valid.
Using remoteExec in a loop that runs very frequently would be bad because of network spam, but there's nothing inherently wrong using using remoteExec in all loops
Despite this, I would avoid that.
For any actual reason or just because you like telling people they're wrong?
You can just use a cba target event instead
less network traffic, easily targeted with a single event
You mean if you figure out the message on the client side?
Register your hint event on mission start in an init.sqf, then just do a target event with the hint string and an array of guys go target
Events >>>> remoteexec in pretty much all cases
Uh, you know CBA events use remoteExec, right
This literally just sounds like remoteExec with extra steps
this is still taking up network traffic, its not like I'm sending an entire script to the user, there really shouldn't be much difference? I could be wrong though I'm new to arma scripting
It also teaches you how to do more complex things, such as executing functions local to particular units or offloading stuff locally
Also cba uses publicVariable
I'll definitely look into events but honestly I don't think its worth it for what I'm doing rn
Test and see
I doubt they're meaningfully different unless you're in a use case where lazy eval saves you time
If you want to target specific people like this, you are going to have to send a number of remoteExecs at once. It doesn't really matter if it's inside or outside the forEach.
Again, this is about a forEach loop, not an uncontrolled while true or eachFrame. It's going to run once, checking each of the array elements once. That's a brief, one-time spike in network messages, and really shouldn't be any worse than one remoteExec with target 0 (which is something that happens all the time).
Thx. Looks like its the same speed for my case, but Switch is more readable imo
I don't know how remoteExec works behind the scenes. We only have this article and logic, so I would avoid invoking the command in loops.
actually with what I'm doing it's a lot better than this, my script is using the remoteexec to inform people when they meet a criteria, and only sends a remoteexec if their meeting of the criteria changes. so really its only being used infrequently
What's your criteria? You may even be able to do this locally if you wanna offload to players
I should probably do it locally, but its running on a fairly good server and its not checking too much so I'm not worried for now
There isn't a secret switch inside remoteExec that detects if it's being used in a loop and magically makes it 300% worse
The thing to watch out for is what the actual (and most importantly, sustained) frequency is, not blindly going "LOOP BAD"
Anyway,
_args remoteExec ["func", _receivers];
is better than
{
_args remoteExec ["func", _x];
} forEach _receivers;
For just showing a hint, it probably won't cause problems if you don't do best practices
We shouldn't just ignore them when teaching people though
"Target collection could be optimised" is a different message to "never put remoteExec in a loop"
I mean you should also never put it in a loop if you can possibly avoid it
I would like to excuse myself from this conversation so I can go and stare at a wall for several hours
yeah it convinced me to go rewrite the artillery support instead.
You are an event!
I'm the MAIN event, Dedmen
sorry ill save you from her
party don't stop til Jenna leaves because Jenna leaves well before the party has even started
I sure do love calculus
you like Calculus omg i don,t omg
i like Calculator lol
he he
but as a machinst i used the other funny one
From a client, is there a way to delete a local vehicle (as in deleteVehicle) without the command being broadcast to server and all other clients? What I'm looking for is something that would act like a deleteVehicleLocal.
deleteVehicle already accepts global arg, so you don't need to broadcast anything.
There isn't a way to delete a non local vehicle only locally, iirc
... Which is incredibly niche and making me curious about what your plan is
In case of deleting a local object (created using createVehicleLocal), I don't think anything will be broadcasted.
That's the problem though, I'm creating and deleting a bunch of tracers ect with createVehicleLocal to create a "virtual firefight". Like ambiance. I've got this running clientside, to save on performance I thought. But it seems that each client essentially DDOS'es the server with the deleteVehicle causing it to spam server-RPT with about 50 Error: Object(15 : 597) not found per second. Server frames completely dying, player FPS dropping to single digits.
That would be an Arma bug.
local objects be like that sometimes
Alright, thanks. Back to the drawing board I guess...
Maybe try a serverside version? Seems like an awful amount of traffic though... Might not be much better.
Possible cause: #server_admins message
Yeah, that'd make sense... But without a local version of deleteVehicle or workaround it seems impossible to fix in this case.
we should get dedmen to fix it in prof
I also found this on the feedback tracker, which seems somewhat related... https://feedback.bistudio.com/T82940
Trying to get this line of code to work but found that when It runs on a dedicated server It will not. Any pointers.
if (isNil "ROS_AllUnitsArray") then {ROS_AllUnitsArray = []};
addMissionEventHandler ["EntityKilled",{
params ["_unit"];
if !(_unit isKindOf "CAManBase") exitWith {};
if (!(isPlayer _unit) && !(_unit in ROS_AllUnitsArray)) then {
[_unit] spawn {
params ["_unit"];
sleep 3;
deletevehicle _unit;
};
};
}];
Love that mod, massive quality of life improvement. I was looking at some of the code for clearing buildings actually, I compared it a bit to the code in the platoon commander mod, but they work very differently.
I still struggle to have AI effectively clear buildings though.
For example, if a building was previously pre-populated with enemy units, and then I use the clear building command on your mod, sometimes the units refuse to move in.
BUT, if I delete all those enemy units, and use the clear building command, the units will clear the building.
This happens even if my units are not aware of the enemy. Have you encountered this issue before?
I have a script that spawns enemy convois and jet patrols, but i a want to add a live marker on them so people can see their live posiotion on the map. Any ideas?
I'd suggest what ace does, on each client create a marker for each object you want, then after X seconds, delete all the markers and recreate them at the vehicles' new positions
For reference: https://github.com/acemod/ACE3/blob/master/addons/map/functions/fnc_blueForceTrackingUpdate.sqf
That's a vanilla path finding issue
AI can't move to a house position that is already occupied by another AI (and they don't care if it's enemy either)
AI can only move to predefined points, while walking along predefined paths. So it's obvious why the devs added that limitation
Anyone have experiance getting sound to work with the BIS_fnc_fireSupportVirtual
i can get the rounds to drop and everything works there but the sound doesnt play thats defined
["TAG_artilleryCenter", "Sh_105mm_HEAT_MP", 100, 1, nil, {false}, nil, 250, 100, ["arty"]] spawn BIS_fnc_fireSupportVirtual;
and yes the "arty" sound is setup in description.ext
Anyone have knowledge/idea how to possibly make a single AI have increased health with ACE enabled?
With handleDamage.
#arma3_scripting message
And you may need to use ace damage events to be sure that the unit doesn't die to bleeding etc.
You can always ask from ace own discord if they have already done / have event for this.
basicly you would have to do something like this to add live marker and track their position.
This code is not tested its a proof of concept how would you go about it.
myUnitsToTrack = [unit1,unit2,unit3];
0 spawn {
//create a dot marker on each of the tracked units
{
private _markerName = "Unit" + (str (_forEachIndex + 1));
private _marker = createMarker [_markerName, getposASL _x];
_marker setMarkerType "hd_dot";
private _markerText = format ["%1",name _x];
_marker setMarkerText _markerText;
}foreach myUnitsToTrack;
//a loop that will work until everytracked unit is dead
//and update marker depended on the position.
while {{alive _x} count myUnitsToTrack != 0} do {
{
private _markerName = "Unit" + (str (_forEachIndex + 1));
private _pos = getPosASL _x;
_markerName setMarkerPos _pos;
}foreach myUnitsToTrack;
sleep 2;
};
};
I wonder how quicker createHashMapFromArray was if it allowed flat arrays with keys and values instead of two dimentional one?
createHashMapFromArray [key1, val1, key2, val2, ..., keyN, valN]
vs current
createHashMapFromArray [[key1, val1], [key2, val2], ..., [keyN, valN]]
But the command already supports both syntaxes: https://community.bistudio.com/wiki/createHashMapFromArray
But not flat array
the command itself probably wouldn't be any faster.
Just your own array creation, before you call the command, might be faster
Yeah, but you need keys and values in different arrays
Oh yeah, faster in a sense of creating less arrays before feeding to command to, of course
Well you can easily benchmark that
binary version vs unary?
Just no version
just benchmark
[key1, val1, key2, val2, ..., keyN, valN]
and the same in two arrays
Understood, you want something like hash set.
Did you try this:
[key1, key2, ..., keyN] createHashMapFromArray [];
?
Missed values will be nils.
Oh, without the command itself, makes sense
No, primary syntax
OK.
[
diag_codePerformance [{[1,2,3,4,5,6,7,8,9,10]}]
,diag_codePerformance [{[[1,2],[3,4],[5,6],[7,8],[9,10]]}]
]
```=>`[[0.000607438,100000],[0.000957758,100000]]`
So, the difference is noticeable
Do I really need another way to create hashmaps? No. But its interesting to think about it.
0.0003ms
noticable.
Yeah noticable when looking at the numbers maybe
Yeah, I realized its a drop in an ocean really compared to the rest of the script
HandleDamage will cause issues with ace medical
Yeah, I bet so too, that's why I assume the best place to ask is ace discord or someone who has done/ knows how to do correctly .
I have seen a couple different solutions here but didn't find those (or maybe those were in ace discord )
Change the unit's damage threshold
unit setVariable ["ace_medical_damageThreshold", X];
You can look at your ai damage threshold setting to see what value it'd already be.
Alternatively you could also just grab the setting directly and add whatever value to it
awesome, thanks!
This. Thanks. π π
Got it I see π€
Thank you
Now I'm trying to figure out ways to have AI clear houses effectively, should I make it such that not all positions are occupied then?
If a house has 10 positions only have less than half occupied?
How do you usually detect if a house position is occupied? I could make it such that we get an array of house positions then filter out occupied positions and have the units go through the unoccupied ones, hoping they'll come across the enemy units enough to shoot them
There is a lot of scripts for room/building clearing with AI you could always take them apart and learn how they are made here is one from johnnyboy https://forums.bohemia.net/forums/topic/222844-jboy-ai-cqb-movement-scripts/
Also Lambs has its custom room clearing if you are using Lambs
JBOY AI Scripted Path - Beta Release 12/2/19. This script moves AI quickly through a path of positions while fighting. In this video we see a stack of 4 units clear a house, breach doors, and dynamically fight. Also this script can be used to create moving AI on static structures that have no AI ...
This won't stop them from bleeding out, by the way, just how hard they are to kill outright
It's just more total health essentially
Yeah
I don't know if anyone could help me out. As usual I hardly know where to start.
In multiplayer, I want to do an area denial trigger, such that if you enter the area, and you stay for too long, the player in the area (excluding aircraft) eventually blows up, Battlefield style. This is intended to force players to stay in the area of the map I want them in because "land mines" or whatever.
But while I could put an actual minefield, 1) performance 2) the little gremlins will try to remove the mines and bypass the location anyway
I know I need a trigger to detect players.
You could make a trigger that when activated starts a timer (you could use CBA_fnc_waitAndExecute) for X seconds, and then if the player is in the area, blow them up (createVehicle an explosive and detonate it)
Ooh, that'd work.

