#arma3_scripting
1 messages Β· Page 64 of 1
side _x sometimes is not equal to side group _x btw
ah that was the reason!
[
count units civilian
,count (allunits select {side _x == civilian})
,count (allunits select {side group _x == civilian})
]
``` => `[2,1,2]` in my mission
the civs come from civ pres module. idk what side they are π
could be agents
hello - im trying to find some help with a small project ive done in arma
i made a script to modify the CH-47F from the CUP addons (i think thats its source, at least) - its just some modifications to the compartments and addding a camera to make being a crew chief on chinooks in my milsim unit less of a hassle... my admins want me to package it as a standalone mod in order for them to put it live on the servers, which im not sure how to do, and ensure that when its running (ideally server side mod only), it continues to overwrite and modify the existing CH-47F as I've written (total mod is just two new SQF files, a C++ header file, and a few lines to add in initPlayerLocal.sqf)
i was hoping someone who understands that a bit could give me some advice
Getting UAV Terminal is a bit tricky
findDisplay 160 displayCtrl 51
It creates and deletes all the time
Might as well check for it each frame, wait until its deleted, then check again
Getting arty computer display is even trickier
private _ctrl_arty = {
private _map = _x displayCtrl 500;
if(!isNull _map) exitWith {_map};
} forEach allDisplays;
It doesn't have IDD, you need to go through each display
private _ctrl_arty = uiNamespace getVariable ["arty_map", controlNull];
if(shownArtilleryComputer && isNull _ctrl_arty) then {
private _ctrl_arty = {
private _map = _x displayCtrl 500;
if(!isNull _map) exitWith {_map};
} forEach allDisplays;
uiNamespace setVariable ["arty_map", _ctrl_arty];
_ctrl_arty call client_func_mapDraw_initMapControl;
};
```What I'm doing each frame to get arty computer
yep you were right
client_func_mapDraw_initMapControl is a function that adds "Draw" EH
civ presence module does that
If its just scripts, it can be done server-side only. If its config changes then everyone has to have the mod
the agents are not kind of "man" ?
(isKindOf)
Logic can be agents
@meager granite its just scripts, but my admins dont want to have to add some lines to every mission initplayerlocal.sqf file they want to run - they just want to have a mod file on the server that changes it globally
@meager granite which is all im looking to get some pointers on how to accomplish - i know its basic, but arma modding is arcane af to me
A substitute for initPlayerLocal.sqf would be a remoteExec done on the server
Your addon will need to have a CfgFunctions that makes server do remoteExec to all clients with your script in there
Read about script executions order: https://community.bistudio.com/wiki/Initialization_Order
Read about CfgFunctions: https://community.bistudio.com/wiki/Arma_3:_Functions_Library
postInit executes at similar time as initPlayerLocal.sqf so your CfgFunctions function will need to point be executed as postInit, there is info about it in Functions Library article
Read about remote execution: https://community.bistudio.com/wiki/remoteExec
oh boy
Your function will pretty much be something like:
{
// Whatever you had in your "initPlayerLocal.sqf" goes here
} remoteExec ["spawn", [0, -2] select isDedicated, true];
[0, -2] select isDedicated makes it execute only if server is player hosted and not dedicated (there is info about it in the article)
these are dedicated servers
Its not that hard.
- Have simple addon with just
CfgFunctionsdefinition to point to your script inside that same addon. - Have that script contain that
remoteExecsnippet I showed above.
For starters don't add anything complex but something simple as
diag_log "SHIT WORKS!";
And check RPT for the message
Then build on top of that
How addons are configured: https://community.bistudio.com/wiki/CfgPatches
Pretty much
class CfgPatches {
class CfgMyAddonWithACoolName {
units[] = {};
weapons[] = {};
requiredVersion = 0.1;
requiredAddons[] = {};
};
};
class CfgFunctions {...
How addons are structured: https://community.bistudio.com/wiki/Arma_3:_Creating_an_Addon
Prefixes and file paths inside addons can be a bit tricky at first, your CfgFunctions will have to point to correct file
Addon Builder page: https://community.bistudio.com/wiki/Addon_Builder
Welcome to Arma modding

yeah its a different beast to most modding architectures
Your addon pretty much only needs to files: config.cpp and your .sqf script in correct directory how CfgFunctions requires it
Then you pack the addon and test it with -mod=@mycoolnewaddon
whats the current arma 3 version? 1.034?
ok ty
so because my mod changes the behavior of a vehicle in CUP Vehicles from arma 2 (i think - i deleted the extracted game data some time back, im scared to extract it all again, so big lol) - do i need to list it as a required addon?
or, is there a way to make it extract the game data somewhere thats not my C: drive?
Since you don't modify CUP configs, there is no need
How to show/hide group bar GUI using SQF (which is showing units in your current group)?
https://community.bistudio.com/wiki/showHUD alt syntax, group argument
what could be a reason if its not showing when I'm not party leader
The group info bar is only shown to the group leader. This is intentional, it's how the game always works.
does the RegisteredToWorld3DEN eventhandler fire on initial placement of an object (the config of which it is defined in) when i drag it out of the asset browser?
https://community.bistudio.com/wiki/Arma_3:_Eden_Editor_Event_Handlers#RegisteredToWorld3DEN only says it fires when the object is un-deleted.
@meager granite heh, when you say CfgFunctions should point to my script, what should the line say to do so? i should hopefully have this completed once i add this linein
The function will be loaded:
from config: <ROOT>\Category\fn_functionName.sqf
Its actually the other way around, your directory structure and file name has to satisfy CfgFunctions setup
Actually, maybe you need to setup the path with file parameter π€
Didn't have much experience with CfgFunctions in addons to be honest
Thanks!
@meager granite I DM'ed you, if I could harass you to look over my content? It's quite short
I think you need to use the file parameter in CfgFunctions if your PBOs are prefixed, which is standard practice for mod PBOs.
You can also use this easily for example in your missionfile (init/initplayerlocal/initserver).
private ['_code', '_function', '_file'];
{
_code = '';
_function = _x select 0;
_file = _x select 1;
_code = compileScript [_file];
missionNamespace setVariable [_function, _code];
}
forEach
[
["Your_Custom_FunctionName1","code\Your_Custom_FunctionName1.sqf"],
["Your_Custom_FunctionName2","code\Your_Custom_FunctionName2.sqf"]
];
i there a way to do what this button does through scripting?
it indeed only does what it says in the wiki. how do i handle an object being created in 3den?
found it
is it possible to check if the attributes of a layer have been changed without running a check each frame?
the AttributesChanged3DEN EH doesn't work cause addEventHandler requires an object and the only way to refer to a layer is by eden ID
hi guys, i have a EH that draws icon on map when mini map is open. But when i get into some jets the minimap changes to like different profile and draw system no longer draws. Below how i trigger the EH for minimap
private _miniMapControlGroup = _display displayCtrl 13301;
private _miniMap = _miniMapControlGroup controlsGroupCtrl 101;
Probably a very simple question. I'm trying to get a group to moveincargo their squad leaders vehicle. How could I make this work? The vehicle doesn't have a variable name assigned, so I need to find a way to detect the vehicle I guess
is the leader already inside?
in that case his vehicle would be vehicle (leader _group)
Knew it would be obvious. Thank you, I'll give it a go!
Recently i added teleporting to my mission however its recently broke saying it cant find the file despite the file being present in the mission folder. Any help with this one?
check if you've misspelled something
Things don't typically "just break" without any input. Try to remember what you've changed since it was last working.
is it a bad practice to assign multiple event handlers of the same kind to something to fulfill different roles?
Whats stopping you from including it all in one EH?
nothing really. making multiple EHs would just be more convenient
i just haven't seen anyone stack EHs so far and i was wondering if thats because thats bad or if it's just rare
Id do it in one, unsure if there'd be any negative consequences to stacking them, but id avoid it
There just isnt really a reason too
Well, keeping related code together in a very large mission.
if you keep it all in one EH there will be less overhead I guess
but nowadays there's no reason to avoid it really. previously EHs would recompile on every call, so they were slower
then i'll do it the convenient way
gotta teleport arrows around in a Dragged3DEN EH cause attachTo doesn't work with 3den objects
I tested it on a Dedi this weekend - the eventhandler didnt work. Im not sure the initPlayerLocal is the way to go, perhaps i should try adapting it to a init.sqf? It did work when i local hosted and joined it myself
The Killed EH is local-argument anyway. It doesn't fire unless the attached unit is local.
other options are the MP event handler "MPKilled" (ugh) or the EntityKilled mission event handler.
Or having local Killed EHs that pass data around. Sometimes usable.
Hi, is it possible to drop units in the cargo of a "V-44 Blackfish" in multiplayer without the "pilot" land the vtol just after ? Because i tried everything but nothing work. The "V-44 Blackfish" is owned "Player Side" and every units in the cargo are owned by the server and i don't know how to prevent the vehicle to land so is there a way to "prevent landing" ?
code used
{
[[_x],{
params ["_unit"];
isNil {
moveOut _unit;
[_unit] orderGetIn false;
unassignVehicle _unit;
};
}] remoteExecCall ["BIS_fnc_spawn", _x, false];
sleep (_speed);
}forEach _all_gcrew;
simplest way is to have the pilot and the paratroopers be in different groups.
It's already the case sadly π
ah xD What do you want the plane to do, and how are you telling it to do that?
i will explain you everything
i'm spawning a plane using the zeus, and i spawn the units with the zeus too
after i'm changing the owner of every units using "setGroupowner"
when it's finished, i order them to get in the plane and after i move them directly into
when they have an order, they won't get out automatically
after i order the plane to go somewhere and while the plane is above where i need to drop, i'm running a function server side to moveOut only guys in the cargo
i'm using a specific function for that and it's working perfectly
but sadly when it's done or even while they are dropping, the plane is doing a big turn (depending where the closest airport is) and it will land
so the plane is landing because you zeus-order the troops to get in it
you didn't understand
i explained the steps
but the plane will start the "land maneuver" only when they are dropping
when i'm starting to drop them, after like 10 paratroopers then the plane will start to turn (like he got a new order)
I think this waypoint for the troops to get in is remaining in effect. Try giving them another waypoint after they drop.
Preferably before they drop :P
again, it's already the case π because i need the troops to go somewhere so when i ordered them to get in the plane and after i moved them into, then i put a "Move" order to where they need to go so like in a city or something that is near the drop point
so instantly when they touch the ground, they will go to the point
every groups has a specific waypoint
i think i will make a video so you will understand
So what does the plane do if you delete every cargo unit instead?
i will try but according to my test, it's the moveOut function that cause this problem and in particular it's the "Sleep"
if i moveOut every units in a isNil then the problem seems to disappear (I'm not 100% sure but it seems to be the case)
but don't worry i will record what i'm doing and you will understand
Hey all. I wanted to ask for a bit more help on this; if I'm unable to hide the rotors in multiplayer from the mission-side, is there a way to do it by creating a mod?
I think there is, since I know that mods with multiple pylon loadouts can hide/show different weapons.
iirc most helicopters hide the moving rotor and show a static rotor when the hitpoint is fully destroyed.
very few have a state where there are actually no rotors showing.
if you need to fit a heli in a hangar, you should use a mod with folding rotors.
Is there one that already exists that you know of? π I'll do a quick search myself but figured it wouldn't hurt to ask.
Did you get this working lad?
Hatchet H-60 for one
@digital hollow @granite sky https://www.youtube.com/watch?v=b-XIk4pQQ14 The HD is not out yet but you can see what i mean. Note that the units owner were changed just before i start the video.
Already using that, actually. π I'm looking for a way to do that with the Apex MQ-12, as a frigate's observation drone.
Speaking of, how do you fold the hatchet's rotors?
so do you have an idea ?
@faint oasis Are you saying that it works fine locally?
currently every test i did in singleplayer seems to work perfectly so yeah
i will try again in singleplayer but everything seems to work. Now i tried to change the "VTOL" owner to the server and it change nothing. The problem still happen.
- what happens if you
doMovethe plane after it seems to stop responding?
or 2) try not sending the troops groups to server until after the drop is complete?
so ok but i don't understand the first question. You want i doMove when exactly ?
at 3:30 you place another waypoint for the plane, but it doesn't seem to respond. try a doMove instead?
ah yeah ok i will try that then and i will try to do the same thing but with the units locally and i will tell you
does publicVariable wait for the transmission through the network is confirmed before moving to the next line?
no i don't think so
It does not.
Ive done some more testing with 4 people, turns out adding this init.sqf below fixes the issue i was having. (what works: killing your quarry, getting punished for not killing your quarry)
However, while i can clearly see that players do have the DAE_HuntingArray added to them and a hunter in there the last if statement isnt working.
I had my mates determine who they were hunting and who was hunting them, then i made them shoot the one who was hunting them but wasnt their quarry. This resulted in them getting the "You killed an innocent bystander, you have been punished" response.
Paradoxically, removing the ! infront of the (huntingarray) statement made it so that if statement doesnt punish you because they are in that array (atleast i assume that was what was happening)
init.sqf
player addEventHandler ["Killed", {
params ["_killed", "_killer", "_instigator"];
_killed = if (isNull _killed) then {
_killed getVariable ["ace_medical_lastDamageSource", _instigator];
} else { _killed};
_instigator = if (isNull _instigator) then {
_killed getVariable ["ace_medical_lastDamageSource", _instigator];
} else { _instigator};
if ((_killer getVariable ["DAE_Quarry", objNull]) == player) then {
"FD_CP_Clear_F" remoteExec ["playSound",_instigator];
"You killed your quarry." remoteExec ["hint",_instigator];
};
if ((_killer getVariable ["DAE_Quarry", objNull]) != player && !(_instigator in (_killed getVariable ["DAE_HuntingArray", []]))) then {
"FD_CP_Not_Clear_F" remoteExec ["playSound",_instigator];
"You killed an innocent bystander, you have been punished." remoteExec ["hint",_instigator];
_instigator setDamage 0.75;
};
if (_instigator in (_killed getVariable ["DAE_HuntingArray", []])) then {
"FD_Finish_F" remoteExec ["playSound",_instigator];
"You killed one of your Hunters." remoteExec ["hint",_instigator];
};
}];
initplayerlocal.sqf
private _quarry = selectRandom _competitors;
player setVariable ["DAE_Quarry", _quarry, true];
private _huntingArray = _quarry getVariable ["DAE_HuntingArray", []]; //Get the current array.
_huntingArray pushBack player; //Add a new element to the array.
_quarry setVariable ["DAE_HuntingArray", _huntingArray, true]; //Broadcast the updated array.```
Can anyone point me in the correct direction with this. I'm trying to setup some audit logging for our Zeus modules, when the Zeus spawn certain things it causes issues and we're trying to debug what's happening.
I have the below setup in the initPlayerLocal, however it doesn't seem to do anything when activating zeus or placing units.
// Zeus Logging
myCurator addEventHandler ["CuratorObjectRegistered", {
params ["_curator"];
private _message = format ["%1 has become Zeus", _curator];
_message remoteExec ["diag_log", 2];
}];
myCurator addEventHandler ["CuratorObjectPlaced", {
params ["_curator", "_entity"];
private _message = format ["%1 has placed: %2", _curator, _entity];
_message remoteExec ["diag_log", 2];
}];```
assuming you've set myCurator as the variable name of the module?
Yup, been set and reads Ok in the mission editor
the 2. seems to work. I tried in local only without changing the owner of the units and it's working.
Edit : I tried to change the VTOL owner to the server and now it seems to work so i will continue and tell you if it's really working or not.
anyone familiar with pulling inidbi2 data into a gui that allows players to see it?
having a hell of a time and I feel that i'm missing something obvious
Q: in need of an elapsed timer, needs to measure elapsed time from a baseline...
I took a brief look experimenting with BIS_fnc_deltaTime but what I found was this.
It measures call over call, which means you'd need additional cumul(ative) time support.
But furthermore, and perhaps worse, if you ever clear the delta time, you're in trouble, because you get a false positive, total time since server mission start. Oops...
Plus, there are use cases, I might not want to root a variable, the ID, in missionNamespace, but rather some other object of my choosing (that supports setVariable).
FWIW, when I think of a function such as this, I think in terms of test and measurement. Not so much clear (with the literal nilification of a variable), but rather zero, which is to say, re-base the variable, i.e. ostensible to "now" or serverTime, or perhaps the diagnostic analog to that, but in either case, zero, not clear.
I invented a slightly heavier weight tuple shape, in which I do something similar when I need to track timers across server sessions, i.e. [_duration, _startTime, _elapsedTime, _remainingTime], that does the trick, and its _startTime can even be re-based over server sessions, since I have the constituent elements to retrace steps accordingly.
https://community.bistudio.com/wiki/BIS_fnc_deltaTime
Thoughts π§ ?
just make your own timer
well, I am, of course, just curious anyone ran into this, thoughts, was I missing something, etc...
When making a public server/custom mission, are there rules around how you have to manage DLC?
I spawn players directly inside certain vehicles, and this bypasses the dlc thing
not sure what you mean bypasses... IIRC, non-owned assets cannot be 'manned', i.e. passenger slots may be fine, but I do not think you can drive, command, gun, etc... could be wrong, I vaguely recall something like that.
You can't do what you want, player count it not scripted
Unless you just want to show it in-game, but the server browser will always include the admin(s)
Having players spawn in the vehicles is fine. It's a supported feature in the Editor.
They will receive a DLC watermark/popup, and if they leave the vehicle, they won't be able to get back in the gunner or driver seats because of the restriction. But having them start there is fine; the game allows it and it's not like you're hacking to make it happen.
Although, since the script will most likely be called locally, you'll have to check if there's an admin online each time the player count is requested.
So it's probably easier to set a global variable which contains the amount of admins online (which is updated when they join/leave the server), and use that variable to add/remove the total player count.
Hey folks, quick question. lol. just wanna clarify how something works. Why is the following script not working, but the second one is?
_artillery = [ar1, ar2]
_target = m1 call BIS_fnc_randomPosTrigger;
_firing = selectRandom _artillery;
_firing commandArtilleryFire [_target, "", 1];
_target = m1 call BIS_fnc_randomPosTrigger;
_firing = selectRandom [ar1, ar2];
_firing commandArtilleryFire [_target, "", 1];
m1 = trigger with area, ar1/ar2 are two SPGs
why isn't the first script properly randomlyselecting either ar1/ar2 from _artillery?
missing ; in line 1
Oh, that was just when copying here, but pretty sure script I kept testing had the ;. Wasn't getting any errors when putting script into "on activation" of trigger
π€·ββοΈ post your logs...
and nothing is showing on server rpt? try just doing systemChat, not remoteExec'd, to make sure the EH is firing.
Correct, I have an audit event log at the start and end of the event handlers which shows it processed the lines, but I can't trigger them.
Is there a difference in using adminLogged vs assigning zeus to a role through the module owner?
is there a time delay? remember if player is 'aiming' targets it takes time to acquire... maybe spawn and/or with some sort of delay.
also, I have not rtfm... I might start there...
Shouldn't be. Try adding the ehs in debug console, and log to zeus player systemChat to make sure the EH works.
does GetOut trigger on aircraft ejection as well?
I just used GetOut while in a blackwasp in editor yesterday, it doesn't eject you
What would be the best method to pull info from inidbi2 and putting it into a gui that clients can see?
sorry I meant the event handler
I have a nice interface setup, works when I host, but once on dedi, it's all blank
remoteExec your data
_my_data remoteExec ["my_function_that_puts_data_into_gui", 0];
Thanks @meager granite , I have some workings in the script to get the values to show, should those be sent to clients too?
Or just the end results that actually get displayed
Depends on what you do and your intended code design
For example if you're going to display vehicle names, don't send actual name but vehicle classname
So each client gets their own vehicle name since they might have different game language
I'm on phone atm, but essentially pull from inidbi2 database list of vehicles and put them into an lblist
If its class names, send the class names and have clients works with them
Then get the lblist selected, grab the editor preview and send that to a picture aspect of the interface
Have server send all needed data to clients once
Then clients do the rest locally
Yes
Read about remoteExec, you can send data to certain client specifically
Or server
So you can for example have client ask the server for this data when they open the menu
and have server respond with the data back to that certain client
Again, depends on your program design
If its static data through entire game, just send it once to everyone (there is JIP flag too)
If it changes over time or individual per client, have clients query the server for it
Show some "LOADING" message in the menu after request is sent to server and hide it once data arrives back
I have a question about map objects. When I play multiplayer, I can knock down certain trees/fences, and they will seemingly reappear 30 minutes later. I'm curious if this is an engine issue or something that could be fixed in a project I'm working on
Trees and fences remain dead until the end of the round
Either you're mistaking something or they're repaired through script somewhere
I've experieced this past couple days on Warlords official server, I'll clear trees/light posts to land a jet somewhere, but they'll reappear randomly. I don't see any reason there would be a custom script to bring them back, so I was curious.
It doesn't happen with buildings, only those annoying wire fences and light posts**
Probably scripted?
Yeah, they're repairable through script
I guess Warlords does it?
Unpack the mission to check yourself?
I took a peek, couldn't find anything. However I know the official mission file is very different from the one available on the client. Only thing I can think is maybe it's a weird side effect of some generic 'EntityKilled' script. Oh well, just wanted to make sure it was something I could avoid on my own server.
getCursorObjectParams params ["_cursorObject", "_selections", "_distance"];
``` does anyone know where the `_distance` is measured from? it's not `eyePos`...
I noticed that distance increases quite a bit when you switch weapon
Probably from the gun?
ah yeah, big difference between weapon up vs weapon lowered, or perhaps different selections are used
Hi there ARMA peeps.. Does anyone have a fast travel script that transports the vehicle plus whatever players are in the vehicle. I've been trawling the net for 2 days and found nothing that transports both vehicle and player? Thanks in advance guys
If you transport the vehicle then the occupants go with it.
I assumed the same thing, but so far I haven't successfully transported a vehicle with any script that I have found π¦
I can do it as admin, but looking for players to be able to do it
If you find nothing, you write one
If I could write one I would. No need to be a dick mate, I'm here asking for help
I'm not being a dick
maybe check that mate
At least you better to tell us what you got so far so we can point it out
sure
My preference would be to get Fex_Fast travel working.
description.ext
#include "Fex_FastTravel\defines.hpp"
#include "Fex_FastTravel\dialogues.hpp"
init.sqf
//variableString = format ["fexInternal%1_discoveredMarkers", name player];
//missionNamespace setVariable [_variableString, []];
//missionNamespace getVariable _variableString;
FexInternalDiscoveredMarkers = [];
_fexInternalSelectMarker = createMarker ["Fex_Internal_Select",[0,0,0]];
_fexInternalSelectMarker setMarkerShape "ICON";
_fexInternalSelectMarker setMarkerType "Select";
_fexInternalSelectMarker setMarkerColor "ColorOPFOR";
_fexInternalSelectMarker setMarkerSize [0,0];
_handle = addMissionEventHandler ["Map",{
_handling = [_this,"Fex_Internal_Select"] execVM "Fex_FastTravel\markers.sqf";
}];
confirm.sqf
_markerPos = _this select 0;
_internal = _markerPos select [1,((count _markerPos) -1)];
_numbers = _internal splitString ",";
_selMrkPos = [];
{_selMrkPos append [parseNumber _x]} forEach _numbers;
//hint format ["%1",str _selMrkPos];
closedialog 1;
cutText ["","black out",0.5];
titleText ["Loading...","PLAIN",1];
sleep 0.5;
//VEHICLE TYPE - SWITCH - DEFAULT IS WALK
/*
switch (typeOf (vehicle player)) do {
case :
};
*/
_time = ((position player) distance _selMrkPos)/3.96;
//time = distance / speed
//speed = 14.27 km/h -> 3.96 m/s
_time = _time / 3600;
//skipTime takes in hours, therefore seconds / 3600
//skipping time is not necessary (in most cases) > leave commented out
//if you want to skip time travelling, uncomment the next line
//skipTime _time;
waitUntil {preloadCamera _selMrkPos};
cutText ['','black in',1];
titleText ["","PLAIN",0.1];
openMap [false, false];
player setVelocity [0,0,0];
player setPos _selMrkPos;
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
Please format this so easy to understand which is which
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
It only tells how you do
let me scroll up and try to find an example
You are using wrong character. If you wonder copy the example
Description.ext
#include "Fex_FastTravel\defines.hpp"
#include "Fex_FastTravel\dialogues.hpp"
hint "good!";
Yup
ahh, thank you.. Ok I'll pump out the script
init.sqf
//_variableString = format ["fexInternal_%1_discoveredMarkers", name player];
//missionNamespace setVariable [_variableString, []];
//missionNamespace getVariable _variableString;
FexInternalDiscoveredMarkers = [];
_fexInternalSelectMarker = createMarker ["Fex_Internal_Select",[0,0,0]];
_fexInternalSelectMarker setMarkerShape "ICON";
_fexInternalSelectMarker setMarkerType "Select";
_fexInternalSelectMarker setMarkerColor "ColorOPFOR";
_fexInternalSelectMarker setMarkerSize [0,0];
_handle = addMissionEventHandler ["Map",{
_handling = [_this,"Fex_Internal_Select"] execVM "Fex_FastTravel\markers.sqf";
}];
scripts folder
Confirm.sqf
_markerPos = _this select 0;
_internal = _markerPos select [1,((count _markerPos) -1)];
_numbers = _internal splitString ",";
_selMrkPos = [];
{_selMrkPos append [parseNumber _x]} forEach _numbers;
//hint format ["%1",str _selMrkPos];
closedialog 1;
cutText ["","black out",0.5];
titleText ["Loading...","PLAIN",1];
sleep 0.5;
//VEHICLE TYPE - SWITCH - DEFAULT IS WALK
/*
switch (typeOf (vehicle player)) do {
case :
};
*/
_time = ((position player) distance _selMrkPos)/3.96;
//time = distance / speed
//speed = 14.27 km/h -> 3.96 m/s
_time = _time / 3600;
//skipTime takes in hours, therefore seconds / 3600
//skipping time is not necessary (in most cases) > leave commented out
//if you want to skip time travelling, uncomment the next line
//skipTime _time;
waitUntil {preloadCamera _selMrkPos};
cutText ['','black in',1];
titleText ["","PLAIN",0.1];
openMap [false, false];
player setVelocity [0,0,0];
player setPos _selMrkPos;
trigger.sqf
// your code here
_trigger = _this;
_markerNearest = ([allMapMarkers,_trigger] call BIS_fnc_NearestPosition);
FexInternalDiscoveredMarkers append [_markerNearest];
_markerNearest setMarkerType "mil_marker";
_markerNearest setMarkerColor "colorBlack";
titleText ["New location discovered","plain down",0.6];
playSound3D ["a3\sounds_f\sfx\hint-5.wss", player];
FexInternalHandle = nil;
That's all of it. I've tried various other scripts and teleport scripts and triggers, so far nothing. This seems to be the best of the bunch as I got this working to fast travel a player to a set location. If I am in a boat, it send me but the boat stays put
I was thinking the answer is in the confirm.sqf script but not sure what to change
as you can see, I struggled to us the code template.. I won't moving forward though, thanks for that
oh there are two hpp files which I didn't send through
Sanity check, does player setPos unloads you? I don't recall right now, but maybe try to replace
playerintovehicle player, in last two lines of confirm.sqf
cheers will try now
it worked a treat, thank you. I did change those last night but I also changed this line at the same time, which broke it
_time = ((position player) distance _selMrkPos)/3.96;
I added position vehicle player π¦ I only needed to change two of them.. Thank you so much.
position vehicle player is fine. You must have typo'd something.
Not necessary either though.
it was 2am and my style is google, change, test, google, change test π¦ no foundational coding knowwledge
Hey folks! Trying to figure out the semantics of nested forEach, but the wiki's example 8 at https://community.bistudio.com/wiki/forEach is a bit unclear to me. So not sure if this is right:
What I want my script to do:
-I have 3 batteries of 3 guns each. I want my script to repeat 4 times (outer forEach): select one of the batteries, have each SPG in that battery shoot at a randomly selected location. (I imagine if I just have each gun shoot 4 rounds, instead of the forEach [1...4], then they'll shoot 4 times at the same location, rather than once at 4 different locations)
{
{_battery1 = [ar11, ar12, ar13];
_battery2 = [ar21, ar22, ar23];
_battery3 = [ar31, ar32, ar33];
_artillery = [_battery1, _battery2, _battery3];
_battery = selectRandom _artillery;
{_x setVehicleAmmo 1;
_target = m1 call BIS_fnc_randomPosTrigger;
_x commandArtilleryFire [_target, "", 1];}} forEach _battery;} forEach [1, 2, 3, 4];
Does anything look off here?
(I guess I should add: this goes in the "On activation" field of a trigger)
Are there any performance improvents to;
_object remoteExec ["SomeFunction", clientId];
vs
(netId _object) remoteExec ["SomeFunction", clientId];
Additionally, if _object has a lot of 'setVariables' attached to it (including many only set on the server side), which version of the object will the client recieve? Is the servers copy of _object serialized and sent over the network in its entirety? Or just some identified/pointer/references which the client will use to look up the object the have on their end?
Most objects exist globally anyway. Whether their setVariables are broadcast depends on how you set them.
Sending an object reference with a remoteExec doesn't cause any additional transfer of information.
so having an object as a paramater for a remote exec sends it as a reference to the object?
Yes. I'm not sure on the exact low level mechanism.
Alright good. I've managed the setVariables so only relavant information is sent to the client, and I didn't want to 'contaminate' the clients values with the server accidentally by remote exec
Thank you
Since haven't tested yet not sure if it does flawlessly, but I must add that _battery1 2 3 and _artillery would be better to define outside of the outer forEach so efficient, but other than that I don't see big issue there. Maybe you better to use indent wisely, but the code does make sense to me at least
Got it, cool! Thanks @warm hedge . I think the trouble is less that the script is wrong, but more that the SPGs are getting firing commands too quickly one after the other, so some of those commands may be getting lost, resulting in me not getting the expected number of impacts at end. I might have to add a couple of seconds delay between each iteration of the script on the outer forEach. Dunno if I should just spawn the whole script, since I don't think I can add a sleep command in there.
Then try to nest the entire code with spawn and use sleep
Nice. It's nice to know I'm not completely lost π Thanks, @warm hedge ! Helpful as always
Feeling dumb. Asked for some help finding a leader's vehicle yesterday and I can't get this script working. Can anybody help me out? I need the squad members to spawn in the leader's vehicle cargo, without having a variable name for the vehicle
{ _x moveincargo vehicle (leader _this) } forEach units group _this;
Sorry that should have been:
{ _x moveincargo vehicle (leader _group) } forEach units group _this;
_group, but neither works
It is supposed to go through each of the group members (forEach units group _this) and move them into the leader's vehicle.
It's part of a code i'm using for NR6 HAL addon. When reinforcements spawn, their leader is changed to the vehicle and I need the squad members to be mounted into the leader's vehicle
In where actually? How do you execute that?
It executes on the group leader. _this is the group leader
No I'm pretty sure its the group leader's init
Then this w/o underscore
Still not working. There's nothing obviously wrong with my code apart from that, is there? I'll take it to the HAL discord, I'd hoped it was my lack of coding skills
Not working how? Any errors?
if(local this) then {{_x moveInCargo vehicle leader group this} forEach units group this};
No errors at all
Sa-Matra's code works in the group leader init, just not in the module I'm using so it must be an issue on the mod's side
oh! It's working! Changed Sa-Matra's code to use _this instead and it works in the mod too.
Thank you both!
It would be so nice to have Arma Debug Engine working again with STATUS_INTEGER_DIVIDED_BY_ZERO issue solved 
_array2 = [];
_array2 insert [0, _array, true];
moves that whole foreach loop into engine
Its still O(nΒ²) tho, just.. faster
As far as I can see its the same as for scripted user actions and take weapon from ground weapon holder.
Can't actually find any distance check and don't have time to search longer
This code goes back to OFP times so... ugh
Yeah its some engine voodoo magic
Thus my request for a command to check it
Rather than figuring out what the hell is going on
group _leader setGroupOwner remoteExecutedOwner;
_vehicle setOwner remoteExecutedOwner;
```still triggers this stupid message:
Script command setOwner cannot be used for object 'B_UGV_01_rcws_F'. Use setGroupOwner instead.
Why this warning is even there, everything works properly despite it.
group _leader setGroupOwner remoteExecutedOwner;
_leader setOwner remoteExecutedOwner;
```Same with this.
(_leader is driver btw)
I vaguely remember reading months (if not years) ago that this:
private _foo;
private _bar;
is faster than:
private ["_foo", "_bar"];
since the former is O(n) and the latter isn't. Is there any merit to this? Similar question for params vs. _this select N
Usually the less commands you run the better
Otherwise diag_codePerformance [{...code...}] the hell out of it
One "slow" command is usually faster than few "fast" commands.
ack, thanks!
does anyone know where i can find the classnames of static weapon ammunitions? Like mortar and howitzers
@granite sky i have 7erras config viewer but i cant for the life of me find how to match the correct magazine to the corect static weapon
CfgWeapons, find weapon, go to magazines[] property.
ive tried loking into the config entry for the static weapon for example
f1={
private ["_abc", "_def", "_ghi", "_jkl", "_mno", "_pqr", "_stu", "_vwx", "_yz1"];
_abc = "one"; _def = "two"; _ghi = "three"; _jkl = "four"; _mno = "five"; _pqr = "six"; _stu = "seven"; _vwx = "eight"; _yz1 = "nine";
};
f2 = {
private _abc = "one";
private _def = "two";
private _ghi = "three";
private _jkl = "four";
private _mno = "five";
private _pqr = "six";
private _stu = "seven";
private _vwx = "eight";
private _yz1 = "nine";
};
private _result = diag_codePerformance [f1, 0, 100000];
systemchat format ["f1: %1", _result select 0]; // 0.00292
private _result = diag_codePerformance [f2, 0, 100000];
systemchat format ["f2: %1", _result select 0]; //0.00197
So it seems the non-array version takes about 2/3 of the time. Probably since the array version has to parse said array. But the number are so small, that unless you call a function 1000s of times every frame, it won't make a difference. And I think the array variant is more compact and readable.
ew no :P
i can only find the static weapon in cfgVehicles not in cfgWeapons
incidentally im trying to find out for an antistasi template i'm making π
f1 will probably be faster without assignment
but yeah, new inline private is much faster
can you suggest anything?
there is actually an example on the bottom of that page that seems to be specificly for finding magazines and some other info
ill try it out
it worked!!
Similarly if you're building loadouts the quickest starting point is often to equip the gear and use getUnitLoadout.
Only reason to use the array form of private declaration is when you're initializing several vars used by a short and perf-critical loop. Not important though.
params is great though, because it assigns at the same time and improves readability.
Unless you spam pointless defaults everywhere like some people do :P
Yeah, definitely using params over this#X
It helps with udnerstanding undocumented functions
@granite sky the BM-21 is the only vehicle not returning anything from the function given as example on that page
i guess because the static weapon is on the back of it
any idea how i would retrieve the classname of a specific portion of the vehicle like that?
Nothing to do with O(N) stuff.
What Sa-Matra said, fewer commands is better.
and private _var = x is not a command, its a modifier for =
unless you call a function 1000s of times every frame
You probably don't call this specific function many times. But if you do that stuff everywhere, it adds up and you get much closer to that number of calls.
Its not only array parsing, you also have to create the array too
It's not even new, Arma 2 had it.
I thought it was introduced in A3 π€
Aaah, never knew about "local" back then
what has higher cost in SQF set new value in array or create new array instead? Lets say trying to update multiple values
Depends. If you're changing two elements in a 100-entry array then setting the values is gonna be faster. If you're changing two elements in a 4-entry array then creating a new array is probably faster.
well in most programing languages setting new elements in big arrays stars new memory allocation thus its faster to create new array
No, in any reasonable language, changing an element in an array does not cause a memory allocation.
Adding elements may or may not. Usually there's some dead space allocated.
However this is largely irrelevant for SQF because engine is >100x faster than script.
New array is guaranteed memory allocation. Adding elements to existing is just maybe memory allocation
Always is more than sometimes.
But it always depends on what you're actually doing. What you said doesn't provide enough context
And you can always profile yourself if you want
you can't compare floats like that
Say serverTime returns 1.0, and next time it returns 2.0000001
Now its not equal anymore
well given what you want you shouldn't do it like that
hi, im trying to make something run "this setVectorUp [0,0,-1];" on a loop to keep it vertical, is it possible to do it without creating an sqf file? i want to save it and spawn it as zeus.
compare using < > >= <=
yes
but the questions is why constantly set something vertical? can't you e.g disable its sim or something?
im trying to attach it on a helicopter
but helicopters rotate when moving and i dont want that
well, i want the helicopter to move, but not rotate the attached thing
how do i do that? tried putting it in the "init" part in properties but it doesnt work
did you spawn the loop if you are using scheduled environment?
depending on the speed at which you need to run this command, you can do a eachFrame handler to run it on every frame
i have no idea what a schedules environment is and i dont know i need to spawn the loop
i just wanna keep running the script without making an sqf file, so i can save it and spawn it with zeus in any mission
then this won't work
because attached object coords are relative
tbh no matter what you do it'll be ugly 
if you spawn it, it won't run every frame, so it'll look bad
if you run it every frame, it'll waste perf
curious to what you you wanted to do with it anyways
i wanna attach a ship to a helicopter
lol
but i dont want the ship to rotate with the helicopter
real
are you trying to make a ship appear to be moving? or do you actually want it flying through the air
i actually want it flying
and it does when i attach it to a heli
what i want to do is keep it horizontal
is it cinematic? like only in one direction? or do you want it player controlled.
player controlled
i see lol
prob too hard for me to do
can a function that is registered via CBA PREP have a name that starts with a number?
How do you get around the issue of PvP on the same team?
so like, civs killing other civs becoming hostile? Is it addrating?
what are your players doing?
killing eachother and blufor as civs duh
i suppose you could tell them not to
but thats the game
are you having issues with ai or players?
You can use the HandleRating EH to prevent that thing.
We override it because it's quite daft about vehicles.
do you have an example? ive already torn my hair out over the killed event handler
im not sure my heart can take another
For local unit:
_unit addEventHandler ["HandleRating", {0}];
It's respawn-persistent.
so just in initPlayerLocal then? with player addEventHandler
you can disregard my previous reply since i found out i was missing another condition in the 2nd if statement, i will post this mission on the workshop too when im happy with it so nobody else has to suffer the pain of trying to recreate this mode
yeah, initPlayerLocal should be good.
ty
Sorry, I was too busy to get back to you. What was missing? π
if (side _instigator == civilian && (_killer getVariable ["DAE_Quarry", objNull]) != player && !(_instigator in (_killed getVariable ["DAE_HuntingArray", []])) && ((_killed getVariable ["DAE_Quarry", objNull]) != _instigator)) then {
tested the mission with 5 players, tried every outcome and it works
only had the issue now of civs being treated as hostile cause of all the lost rating from teamkilling
handle the score and your problem is gone, there is a mission event handler for that
any one tried this isPlayer [cursorobject] (Pointing at dead player)) returns false
https://community.bistudio.com/wiki/isPlayer
The array version is an alternate syntax that's supposed to work on corpses (at least for a certain time after death)
Seems like when player dies his object becomes null for split second
Yo, anyone knows how to edit the fontsize in RscText? I can't find the fuction for that
I thought it's ctrlSetScale but it ain't working
Is there a way to skip the distance param for addAction and just have the player who has the action always able to see it but no one else?
Currently we add an action to leaders, with a tiny range so only they can see it, but that becomes a problem when they get into a vehicle and the action moves to the center of the vehicle instead of the center of the player lol
Quite a lot is actually achievable with SQF, just not how you'd usually do it in another language
it's called sizeEx
with a tiny range so only they can see it
add it locally and you won't need to worry about range anymore
a function?
i wanna put it inside a trigger
How do you add the action locally?
there is only setfontheight
ctrlSetFontHeight
well I said "something". i.e. that was from memory...
xD
how do you add the action rn?
Currently we add it through a loadout class hpp file
dunno what you mean
class ftl : g
{
displayName = "Fireteam Leader";
code = "_this addAction [""<t color='#0096FF'>Deploy Group</t>"", { execVM ""groupTeleport.sqf""; }, nil, 25, false, true, """", ""true"", 1.6, false]; _this addAction [""<t color='#0096FF'>Deploy Self</t>"", { execVM ""selfTeleport.sqf""; }, nil, 25, false, true, """", ""true"", 1, false ]; onMapSingleClick {_shift};";
vest[] = {
"rhsusf_iotv_ocp_Grenadier"
};
I cut some extra fluff out so this wouldn't be too huge, does this help?
is _this the player?
btw the ctrlSetPosition, im a bit confused how do i make the text in the bottom left of the screen, what's the x and y for that
im a bit confused
Yes
safeZoneX + safeZoneW and safeZoneY + safeZoneH
but you should subtract those from the width and height of your ctrl
just put if (!local _this) exitWith {}; at the beginning
Hm, did not seem to work (can still see the actions if I remote control an AI and look at the player character)
I meant other players won't see that
Oh so me remote controlling the AI is basically like it's still me
change the true condition to cameraOn == _target
That definitely seems to have done the trick, thank you!
Can anyone tell me if im even remotly close to what i want to achieve, Comments added to show thought process.
Trying to make it so the arma 3 default sensor system show all players in a server as hostile even tho they are all on the same side. Dont want to change sides due to how other scripts are working. Thoes who know exile, thats what mod i am using.
// initPlayerLocal.sqf
if (hasInterface) then {
[] spawn {
waitUntil { !isNull player };
player addRating 2000; // Make the player friendly to themselves
"ExileClientPlayerStart" addPublicVariableEventHandler {
params ["_eventName", "_player"];
if (_player != player) then {
_player addRating -2000; // Make other connecting players hostile
player reveal _player; // Reveal the other player to ensure they show up as hostile
};
};
};
};
no. well addRating has global effect. so the players become enemies to everyone
could you point me in the right direction?
Been trying to do this for a long longggg time. π
its pretty safe language by the looks of it
dunno 
rip
Hi guys i have a question about variable varspace. I have this code: https://pastebin.com/ek2MPnmC
but how would i make it so the var LEG_isEscorting and LEG_isFree are local to that object.
Basicly i will add this code in Init of a Civilian and save as a composition. So when i spawn multiple of these if i interact with 1 hostage i dont have interaction on all other hostages.
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.
can i use
BSD1 animate["Door1",1];
to close doors on a building?
Opinion question:
What's better, having a trigger activated by player, or a loop that checks distance between marker and player?
For performance
From recent testing a trigger would likely be more efficient, but not by much
If I recall, if its a default Arma building, it would be
_doorIndexYouWantToAnimate = 1;
_building animate [format["Door_%1_rot",_doorIndexYouWantToAnimate],1];
yeah, I should note that i'm dealing with 50 + markers / triggers
but I'm kinda leaning towards triggers too
I personally went with triggers for a mass amount like that
Even over 1000 triggers didnt seem to affect performance at all when I tested so might be easier
Instead of doing missionNamespace setVariable
You would use yourObject setVariable
Where yourObject is a reference to the object you are wanting the variable to set to.
Rewrote it a little bit with just local variables to the hostage, just as an example
https://pastebin.com/skfxPbaU
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.
what would an example of this look like if i were to do lets say 5 buildings
Ty very much!
Just a small example of how to close/open doors - edited to show multiple buildings
https://pastebin.com/XMmMnk3B
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.
In theory, wouldn't you just be able to player addRating -3000
and it would count you as an enemy to every ai/player?
The command has local argument (so you can only use it on units that are local to you, or yourself), and global effect, so you'd technically just set yourself as an enemy for every other unit.
Edit: Probably set yourself well below -2000 due to possibility of gaining points.
Another way this might be possible (obviously whatever side you use as default)
west setFriend [west,0] - Havent tested
Maybe walk through list of sensor targets https://community.bistudio.com/wiki/getSensorTargets and script confirm them as the enemy https://community.bistudio.com/wiki/confirmSensorTarget ?
Only guessing, not sure if this is a working solution
There is also https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#KnowsAboutChanged group event handler
Maybe you can use that to force confirm the target as enemy
When new target gets known about, confirm it as enemy. Not sure how often you need to do that so it stays enemy though
thank u
what does "Door_%1_rot" mean?
"%1" is a parameter that gets replaced by format
It's essentially "Door_1_rot" or "Door_0_rot
https://community.bistudio.com/wiki/format
If I add deleteVehicle like this: sqf addMissionEventHandler ["EntityKilled", { params ["_unit", "_killer", "_instigator", "_useEffects"]; 0 = _unit spawn { waitUntil {sleep 1; isTouchingGround vehicle _this}; deleteVehicle _this; }; }];
Will it also delete the nearby weapon holder holding the dead unit's weapon?
It should
_i = 0;
{
while {_i < 5} do {
if (_i == 3) then {
break;
};
systemChat str [_i, _x];
_i = _i + 1;
};
} forEach ["a", "b", "c", "d"];
Are while loops ignored when using break and continue?
The above statement simply stops the entire outer loop once the inside loop has _i == 3 and breaks.
If I swap break with continue, it works how I originally wanted it to.
Additionally, if I have a single while loop, break and continue seem to have the exact same effect and break the loops when either is called.
Curious for clarification on the wonky business to avoid future headaches π
is there a method of playing a prerecorded video file in a mp game without a mod?
Only if its included in a mission file
Is it possible to script an aeroplane's automatic vectoring or auto hover to be enabled or disabled? I want to set my VTOL to have auto vectoring off by default
this would be in a mission file what format and what comand would one use?
https://community.bistudio.com/wiki/Arma_3:_Actions#VTOLVectoring
Maybe you can create some logic entity and have it execute this action on the vehicle
Not sure if it works if Logic is outside of the vehicle though
https://community.bistudio.com/wiki/Arma_3:_Actions#VTOLVectoring propably with this
damn you beat me to it
You don't reset your _i inside forEach
Its _i = 3; when next forEach loop starts and your while instantly breaks
Oh lord, I clipped the bracket around the wrong side of that when refactoring several hours ago. My eyes are bleeding. Thank you so much, I can sleep now π
Okay, another VTOL related question: is it possible to get/set the (non-AFM) engine torque? The little number that appears next to the engine icon
I want to prevent that from ever hitting 0 unless the engine is off, so that the VTOL doesn't magically lose all lift because plane simulation funny moment
Not sure about torque but thrust yes
Throttle was the word, it seems! https://community.bistudio.com/wiki/airplaneThrottle But I definitely wouldn't have found that page if you hadn't suggested thrust, so thanks
So, you can connect terminal to a UAV, then drop it from your inventory and hide it somewhere and UAV will remain unconnectable forever until terminal is found and disconnected or deleted
Who thought it was a good design? 
Thankfully deleting the terminal will allow UAV to be connected to again
If only remoteControl wasn't such a POS command, I'd just ditch this hardcoded terminal bullshit and made my own system
This is also local, so remote clients can connect to such UAV. This way you end up with several players connected to same UAV
Arma moment
Can't control same UAV unit at the same time though, thankfully
Still, this system is busted
If you were using a debugger, that would be easy to track down. Which btw, SQF debugger exists π
Would you be able to link? I have vscode with a very outdated sqf syntax highlighter currently, I got the bare minimum and just started scripting for fun
Arma Mods:
https://steamcommunity.com/sharedfiles/filedetails/?id=1585582292
https://steamcommunity.com/workshop/filedetails/?id=1645973522
https://steamcommunity.com/workshop/filedetails/?id=450814997
Visual Studio Code Extension:
https://marketplace.visualstudio.com/items?itemName=billw2011.sqf-debugger
00:00:00 Arma Mods
00:00:38 Visua...
Use blackfisch's SQF extension, it's (the most) up-to-date
Pls fix DIVIDE_BY_ZERO 
Finally installed and tried this thing last week, worked like a charm, until it faced its first 'for' loop and crashed.
:u But I thought I fixed it two weeks ago. Its still broken?
Do you mean for loop anywhere, or for loop while actively debugging it
While debugging
Specifically for,step,to loop? not foreach?
Specifically 'for', it turned off the moment I F10'nd to this line and then I saw that Arma crashed as well
Was debugging mission scripts, not mod, if that makes any difference
Hello, can anyone advise why this dialogue is erroring:
// Create the display
display = findDisplay 46;
testGui = display createDisplay "RscPicture";
// Set the position and size of the dialog box
testGui ctrlSetPosition [0,0,0,0.1];
testGui ctrlCommit 0;
};
[] call _createDialog;```
testGui |#|ctrlSetPosition [0,0,0,0.1];
Error ctrlsetposition: Type Display (dialog), expected Control
it looks like you are trying to create control but are using createDisplay . you should use https://community.bistudio.com/wiki/ctrlCreate instead
It's interesting as the wiki gives this exact syntac on create display
which page?
the "createDisplay" is nowhere in that page
np
getText ((configOf vehicle player) >> "icon")```
`"\A3\Armor_F_Tank\AFV_Wheeled_01\Data\UI\map_AFV_Wheeled_01_CA.paa"`
Probably your code is wrong at some point
Also icon can be default icon from CfgVehicleIcons
drawIcon accepts names from CfgVehicleIcons so it should be fine
thanks, will try
Hello,
Does postInit execute after all is including attributes .
but is executed at a later point after mission start.
Currenlty I cannot get values from attributes in my function which I have called from postInit.
Or do I need use some other way to achieve these?
So if i make a function that confirms all new targets as enemy. in it, the fucntion will get all targets detected, iterate through them all and confirm them as enemy.
then call the function every x seconds whilst inside a vehicle with sensors?
No idea how often it should do that
There is also a group event handler, maybe doing it on knowsAbout change is enough
problem is, im not sure how the knowsAbout event handler works, and the EnemyDetected wouldnt ever be activated due to the fact all players are on the same side.
Add the event handler, make it show a hint or write something in the chat
Or do a diag_log
Then test to figure it out
Is there anyway to make a unit a "slave"?
In the sense that the client (player) inputs are copied by the slave unit?
Trying to figure out how I could make a hologram soldier to fool enemies e.g. https://youtu.be/PqubhTODE-Q
I have disabled AI on the unit
How do I get my hands on a watch like that?
Yo, anyone knows how to make rscText show even when hud is off?
seems to be a dead end. there isnt a way to force change the targets identification status
onEachFrame {
copyunit switchMove animationState player;
};
Don't use onEachFrame in real scripts though, there is stackable EachFrame which you'll need to add and remove as you need
Have it on disable separate from the one that HUD being off hides
wdym?
is it a function?
Will also be a bit more complicated in MP
If disabled HUD hides your RscText, means its probably in a display that gets hidden
Create your controls in a display that doesn't get hidden
left operand
_hud = uiNamespace getVariable ["RscUnitInfo", controlNull];
_text = _hud ctrlCreate ["RscText", -1];
this is how i create mine
so u mean change the getVariable?
So I apologize, but I'm curious if anyone can help me out, I've scowered this discord and the internet for a solution but I can't seem to find one. I'm currently using KillzoneKid's Livefeed, I got it streaming, I have it some what tracking? and I'm using the cup MQ-9, it's Driver controls are: PiP0_pos, and PiP0_dir then it's gunner controls are: laser_start, and laser_end. I'm tracking a object called o1 and my camera looks at it seems but shortly after it doesn't stick to it and kind of follows behind the UAV, I can provide any information regarding it. I've also tried swapping up the laser_start and laser_end
Is there a list of displays somewhere in the docs i can pick from?
Do you use doWatch to order AI to watch somewhere?
No, I looked it up and someone was trying to do that and a person gave them the solution for "lockcamerato" from Killzonekid(KD from here on)
Side note, your name sounds familiar...
Create your own display and display your controls there, this way it won't get hidden without your actions
There is RscTitleDisplayEmpty to use with https://community.bistudio.com/wiki/cutRsc
Create it with createDisplay, then create your controls there
You can get positions from RscUnitInfo display and use them on your new display's controls
with findDisplay 1
No idea, try it?
Probably wont, likely main menu or something
I'm not much with AIs but I remember recently struggling with having AI follow an object
Turned out it was AI's auto targeting ignoring my commands
Try gunner drone displayAI "AUTOTARGET" ?
yap it works thx π
See I want to say that's the issue but the camera is being attached to the uav, the drone gyro-camera is following the target but my camera wont follow the direction of the uav cam(By following the laser_start/laser_end commands
If I create a thread will that be a suitable place for images?
I think you can post images here (don't quote me on that), if they're not too big
Okay, I will I apologize in advance, admins
I guess your selection names aren't correct if your camera doesn't follow gunner's camera
You could be right, I'll double check that in a second
Try
getText(configOf yourUAV >> "uavCameraGunnerPos")
getText(configOf yourUAV >> "uavCameraGunnerDir")
here is the first image it shows the camera following the object(White platform)
Stock A3 Greyhawk's values in config are:
uavCameraDriverPos = "PiP0_pos";
uavCameraDriverDir = "PiP0_dir";
uavCameraGunnerPos = "laserstart";
uavCameraGunnerDir = "commanderview";
Would I post that in the ingame debug?
CUP's drone probably has own selections
Yeah cups is "laser_start" and "laser_end"
Did you run these commands to make sure?
Do I try those in the debug menu ingame?
Sorry just a bit of an amature still
[getText(configOf yourUAV >> "uavCameraGunnerPos"), getText(configOf yourUAV >> "uavCameraGunnerDir")]
yourUAV should be variable name of your drone
π€
Maybe its an issue with CUP's model?
Try using some other drone, like stock Arma 3 Greyhawk drone?
figured it out π€¦ββοΈ
addRating -7000
on all players. makes them join sideENEMY
Being renegade creates other issues
I think renegades can't get into same vehicle
You're right
Something is wrong with the cup mq-9 unless you can somehow rotate the camera manually just simply using the grey hawk works fine, just needed to swap up "laser_start" with laserstart and "laser_end" with commanderview for the vectoring part of KD's code. For future reference anyone wondering unless you figure out MQ-9 Reaper isn't as reliable for live feed or as simple, if you figure it out give me a message π
I remember fixing MQ-9 for CorePatch in OA, it used to lase improperly, maybe CUP's MQ-9 didn't inherit these fixes
Very likely possibility, I'd like to let CUP know but I don't know how to contact them unless there are developers in here for CUP ^
I don't have CUP downloaded right now, can you please run
[yourUAV selectionPosition "laser_start", yourUAV selectionPosition "laser_end"]
```on MQ-9 in debug console?
You'll need to assign yourUAV to the MQ-9 or change variable name
uav1 is not right variable name then
Tried in-game, got this [[0.000874763,4.15517,-0.920886],[0.000874763,4.29776,-0.920886]]
Looks right π€
Maybe gunner LOD view has turret ball hidden and that's why it looks properly
And since camera is not "inside" the vehicle, the ball is there and blocks the view?
Perhaps, the turret ball was following the target oddly though, but the applied camera didn't follow it's direction(Not saying you're wrong)
Hey I'm trying to make a quick script to play a sound when a player interacts with the object (via addAction, my favorite
) but I am big stupid and don't know how to make it play the noise
Thanks in advance
Say3D or playSound3D
Bonjour, if it's a quick change, it can go as an issue on https://dev.cup-arma3.org/, if not there's a couple of CUP people in here.
I know at least I and Varanon are.
How can I make a drone turret always miss? (suppress only)
brilliant idea, thank you
setTurretOpticsMode can change the zoom level of a turret without being in gunner view. Is there a way to do the same for PilotCamera?
is there something like a postInit EH that i can attach to an object?
EntityCreated
mission EH
if that's what you mean
not what i'm looking for
then what are you looking for?
imma have tp explain some context for that
what if you use [-1] for turret path?
Sadly does not seem to work. the command goes through class OpticsIn subclasses but not PilotCamera seemingly
i have a bunch of trenches that in their init spawn some helper objects around them.
these helper objects are supposed to have a variable referencing a mated helper object of a different trench.
which helper it will be mated to will be taken from 3den attributes.
during the init of the trenches i can't rely on the helpers of the other trenches already existing, so i wanna have a second script run once per trench after init is completed.
reading what i wrote here i realize i can just mate the helpers only if their mates exist and fix the mates mates in the same pass
did you check if synchronizedObjects works?
cba has InitPost
synchronizing the helpers instead of having variables inside them pointing at eac other might be a good idea
good to know
3DEN script question, need a way to get all "Layers" in the current editor as an array... possible?
Nvm, just found "all3DENEntities"
https://youtu.be/hrkGi5Zgx04?t=600
hello every one , if i am asking at the wrong section , please guide me to the right one .
from this video and also it is time stamped , dyslexi here can open the gunner cctv from the pilot seat , is there some kind of mod that can do this that i missed , also while searching online , i found this , but can't really know how to utilise it
https://community.bistudio.com/wiki/Arma_3:_Targeting_config_reference#class_pilotCamera
if there is some one who can help would be much appreciated
βΊ Like my content and want to support me more directly? I'm on Patreon: http://www.patreon.com/dslyecxi
βΊ About #ShackTac: https://shacktac.dslyecxi.com/
βΊ About this channel/my videos: http://dslyecxi.com/yt/
Bohemia Interactive, the creators of the Arma series from Operation Flashpoint to #Arma3, can be found here: http://www.bistudio.com
Hey folks, 1 quick conceptual question: I have a group Event Handler setup in the init field of an AI squad: when they detect an enemy, some pre-pplaced SPGs fire at the location of the detected target. For a multiplayer mission, to ensure that all the different local copies of the EH don't all fire (resulting in tons and tons of fired shells), should I just put my arty-firing script in a if (isServer) then {...} type filter to ensure it only runs in the server, and hence only runs once?
it might be pilot camera, no?
yes⦠and no.
adding only one EH would be wise, but I don't think that e.g the server will know the group learns about a target if the group is lead by a human player (locality, etc)
AI calcs should be local afaik
so the EH will only trigger where the AI is local
where the group* is local?
The squad will be AI only: basic idea is when they find one of my players, my players get hit by artillery.
ah well, yes, AI group you said
when he enters the cctv camera , the type of helicopter appear and i think that this one is the little bird and it is the rhs version , and i think that this little bird the pilot can't enter the gunner cctv
if you don't have headless clients, it's ok
are you sure it's the gunner view and not the pilot's camera?
Ah, I do. My unit's logistics guy insists on them haha.
if (isServer || !hasInterface) then, I would say?
So, given that I do have hc's, I should then just filter in that way?
I'm trying to get a Curator EH to work so that when I spawn in a new group, that CEH adds the Detected EH to the new AI group, but haven't managed to make it work. If I did, I could see how to make it easy to ensure it only adds a single EH, but otherwise, filter seems like best option.
Cool, thanks Lou!
uhm did you even try it by adding the EH to every PC first?
like I said it should only trigger once
EH is currently only on initbox of Eden-placed AI squad, because I can't figure out how to add it through a curator EH whenever I spawn in a new squad. So, I assume it'll be on every PC. But, haven't tested it when more than 1 players yet. I'm also asking bc EH are new to me, so I'm trying to understand how they work.
you can test it in multiplayer by running Arma twice on the same PC
in case you didn't know
Oh. I didn't. lmao. Good to know. Thanks Leo!
you now will make me open the game and make sure that the pilot doesn't have access to some kind of camera π
just to make sure , the pilot's camera is accessed by ctrl +rmb , right ?
yep
just keep in mind you can't do that thru Steam. you need to use the exe directly (if you want to load mods, etc. make a .bat file with command line args)
you made me doubt my self π
gud
i will open the same heli and get right back at you
ShackTac has private mods, see the direction markers. Those probably add pilotcamera.
that what i think , and i was wandering if i would like to make it for my self
Well, Leo, since I have you here and just in case you feel like looking at my dumb code, any chance you can take a look at this and see where it's going wrong? This doesn't seem to be working, even though the "sub" EnemyDetected EH code works when added directly to a group's initbox. Idea is: whenever I spawn a new independent squad, I want it to have my EnemyDetected EH, rather than having to create X number of AI squads in Eden to get it to work in the op itself.
this addEventHandler ["CuratorGroupPlaced",
{
params ["_curator", "_group"];
_squad = _this select 1;
if (side _squad == independent) then
{
_squad addEventHandler ["EnemyDetected",
{
params ["_group", "_newTarget"];
_self = _this select 0;
_newTarget = _this select 1;
_target = getPos _newTarget;
_battery1 = [ar11, ar12, ar13];
_battery2 = [ar21, ar22, ar23];
_battery3 = [ar31, ar32, ar33];
_artillery = [_battery1, _battery2, _battery3];
_battery = selectRandom _artillery;
{
_x setVehicleAmmo 1;
_x commandArtilleryFire [_target, "", 1];
} forEach _battery;
_self removeEventHandler [_thisEvent, _thisEventHandler];
}];
};
}];
what is this?
the init of the curator module. Pretty sure that's necessary for the Curator EHs
yeah I was just checking
do you place a group or just a single unit? maybe the EH only triggers when you place an entire group?
I tried both; maybe I'm just missing something obvious, but It should work when I place a new unit, no? I mean, it creates a new group
But I'll try again in a bit, report back if that's the issue. I was testing at like 3 AM so who knows if I did actually do both group/single unit haha
it does but idk. maybe that EH works differently
also this bit is redundant:
params ["_curator", "_group"];
_squad = _this select 1;
you can just write params ["_curator", "_squad"];
I realize π . I'm just practicing pushing through params and stuff.
same here:
_self = _this select 0;
yeah, it's just for me to reinforce the idea of what's going on, how it works haha. I'm slow
well for starters place a systemChat str _this at the beginning of this EH
see if it fires at all
you can. do you know any config stuff?
okay lou , i made sure now and the pilot don't have any camera for this version
oh, sure. I had a "hint "Curator EH worked"; at end of EH, but removed it to post here to not look like a complete noob. π
It wouldn't go through last night, which is why I was posting here. But game's starting, so I'll test with whole group/individual troop, see if it makes any difference.
nah everyone does that π
Oh, some people don't. But they are wrong.
but use systemChat instead to see multiple texts at once
also put another one inside the if ... check
So, you were right, the Curator EH only fires if a whole group, not just an individual troop.Good to know! Seems to be working fine now, just going to have to test it out a bit. Thanks Leo. I could've sworn I tested it out with whole group at 3am... but maybe not.
Although, as far as I can tell, the "EnemyDetected" EH is not working as it does when added directly to group's init. It's being added correctly: I'm getting the systemChat with the right params for it when they detect an enemy. But now the artillery isnt firing.
Is the artillery on the same machine as the curator?
actually not even sure where the curator EH fires.
I honestly dont know.
Currently testing it on localhost. But eventually, ie when op is run, actual setup is DS+hc+client.
Hello guys, I made a small script for Ai but I wanna make a module that users can place and put the group name that will be used by the script, I also want to add a checkbox that will add some lines or run another script. I googled, searched on YouTube, used ChatGPT but I really can't find anything!! Please help me π¦
Is there no sample?
you can check vanilla modules in config viewer
you can also extract the modules_f.pbo and look at its configs
:0
Looks like a fairly good example under "Creating the module config" too.
oh! I got it to work, John, when local hosting. Will have to test to see if it works with DS/hcs in the mix. Thanks!

where can I find this? In editor's config viewer or somewhere in arma folder?
Oh damn
I also DMed you an example
Oo
Hey sorry for interjecting, but I am trying to save everyones loadouts every 5 minutes on the server, is this the right way of going about it?
While ο»Ώ{true} do
{
if (Alive Player) then
{
profileNamespace setVariable ["stalker_mission_loadout_01", (getUnitLoadout player)];
saveProfileNamespace;
};
Sleep 300;
};ο»Ώο»Ώο»Ώ
np
@cobalt path If you're running that locally to each player, it will save to their local profilenamespace, not on the server's.
as long as it saves and I can load it once they rejoin
well, it should basically work.
My idea was to put
While ο»Ώ{true} do
{
if (Alive Player) then
{
profileNamespace setVariable ["stalker_mission_loadout_01", (getUnitLoadout player)];
saveProfileNamespace;
};
Sleep 300;
};ο»Ώο»Ώο»Ώ
into Init.sqf (or is it initPlayerLocal.sqf?) and than put
null = this addeventhandler ["respawn","_this execvm 'loadsavedloadout.sqf'"];
into playable characters init
and loadsavedloadout.sqf
would be
_playerLoadout = profileNamespace getVariable ["stalker_mission_loadout_01", []];
player setUnitLoadout _playerLoadout;
};
should I put it in init or initplayerlocal
Well, you could shortcut and just put the loading code in onPlayerRespawn.
oh, I probably could
Otherwise initPlayerLocal probably makes sense. I'm not sure when the player object becomes valid though, so you'd need to check that when adding the respawn EH.
thanks I will check
https://community.bistudio.com/wiki/Initialization_Order at what point in there does CBAs XEH_preInit get called?
cause it seems like it's after "Expressions of Eden Editor entity attributes are called"
at least in 3den it seems like that
According to the code (https://github.com/CBATeam/CBA_A3/blob/master/addons/xeh/CfgFunctions.hpp) it is run with the preInit cfgFunctions flag, so whenever that happens
Hello π
Followup to my question, where am I putting the config.cpp?
in a folder...
which one?
With the seatSwitchedMan, I'm wanting to get the seat the person just left and move them back into it if they aren't a driver etc, am I missing an obvious way to get the seat they just left?
you could store it in a variable, but youd have to set that earlier in a different way apart from the EH
Set in GetInMan, update in SeatSwitchedMan, I guess.
just read that entire Creating an Addon page I sent you
Yeah trying to understand it ngl
A file named config.cpp should be created** in the root of the Addon Folder** for the game to be able to recognize the addon contents.
what part of it is hard to understand?!
Bro making a mod is harder than sharing it :/
thanks, i just realized i messed up in thinking about what starts which script
Do you guys think it is worth it, performance wise, to turn dead bodies into agents as soon as the Ai units die? I've seen some servers do this because dead bodies seemed to be a resource hog but perhaps that was a long time ago... Here is an idea of how to do the agent thing:
VAL_fn_bodiesOptimization = {
addMissionEventHandler ["EntityKilled", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
if (_unit isKindOf "Man") then {
0 = [_unit] spawn VAL_fn_bodiesToAgents;
};
}];
}; ```
VAL_fn_bodiesToAgents = {
if !(isServer) exitWith {false};
params [
["_body", objNull, [objNull]]
];
if (alive _body) exitWith {false};
if !(local _body) exitWith {false};
if (isAgent teamMember _body) exitWith {}; // body Already an Agent
if (isNull objectParent _body) exitWith {[_body] call VAL_fn_bodyDisembark;};
_body disableAi "ALL";
_body setSkill 0;
_body enableSimulation false;
private _wuTimer = time + 10;
waitUntil {sleep 1; isTouchingGround _body || time > _wuTimer};
if !(isTouchingGround _body) exitWith {deleteVehicle _body}; // Body has been in the air for 10+ seconds! Just delete the bastard!
private _pos = getPosATL _body;
private _dir = getDir _body;
private _type = typeOf _body;
private _loadout = getUnitLoadout _body;
private _face = face _body;
private _name = name _body;
private _textures = getObjectTextures _body;
private _bodyAgent = createAgent [_type, [0,0,0], [], 0, "CAN_COLLIDE"];
_bodyAgent setVariable ["BIS_fnc_animalBehaviour_disable", true];
_bodyAgent disableAi "ALL";
_bodyAgent setSkill 0;
_bodyAgent setUnitLoadout _loadout;
if (_face != "") then {_bodyAgent setFace _face};
{_bodyAgent setObjectTextureGlobal [_forEachIndex, _x]} forEach _textures;
_bodyAgent setDir _dir;
_bodyAgent allowDamage true;
_bodyAgent setDammage 1;
sleep 1;
deleteVehicle _body;
if (_name != "") then {_bodyAgent setName _name};
_bodyAgent setVariable ["vGC_deathTime",time];
_bodyAgent setPosATL _pos;
true
}; ```
nevermind i was not mistaken
Dead bodies still are a resource hog but I'm not sure what you'd be saving here.
does 3den have a different initialization order?
Body's still rendered and still simulated, and hopefully the AI is turned off on death. Maybe other units still check visibility against corpses?
That is my exact question, yet some servers turn dead bodies to agents or to bodybags to preserve resources but I don't know if that still holds true, perhaps some optimisations have been made to the regular bodies since then..
Bodybags are preferable for pretty obvious reasons.
but not necessarily an option.
Agent thing is another matter. Might test it.
Any suggestions on a good way to "move" a marker around the map?
I want it to simulate the movement of a group, so an instant teleport is not ideal, if I can get it to move toward a certain position at steady pace, that would be ideal
The group is not physical either, so I can't attach the marker to the group
There is no good way. You just have to spam position updates.
hmm. Does setMarkerPos _object actually track the object?
I'll have to check
I'm wondering if I can get the direction to the position, then move the marker in that direction by X meters every loop
GetDirRel I think
You certainly can do that, yes. Also vectorFromTo if you prefer vectors to angles.
Maybe:
For "_i" from _startPos to _endPos....but then I get lost hah
You probably want this https://community.bistudio.com/wiki/BIS_fnc_interpolateVectorConstant
Ohhhhhhh that looks like it would work
Thanks @hallow mortar , I'll try that once I get on the pc tonight
@wind hedge This script loses the dropped weapons. There's a small perf improvement but that'd account for it.
Arma sure runs slow for a few seconds when you murder 150 guys at once though :P
(regardless of that script)
Now did Arma always delete the dropped weapons when you delete the attached corpse, or is that a semi-recent change...
It has been like that for as long as I remember
no
How was your fps when the bodies were normal vs agent bodies?
Was like 45 fps vs 47 fps, but the agent version had 150 fewer simulated weapon objects :P
an agent is no different than a normal AI
So perhaps the same fps
simulation wise they're both soldiers. they have the same skeleton and everything
the only difference is when they're alive. agents have simpler AIs
And the fact that agents don't occupy a group slot
Could you set the corpse to enablesimulation false and a simple object?
Hello (apologies for interjecting) I have the stuff ready, how do I test everything btw? π
Leaopard π I used chatgpt and holy shit it helped me a lot simplying the code and documentation
enableSim could help. simple object no (a soldier as simple objects doesn't have ragdoll or head anymore
)
How do you ask it? "Improve upon this code in SQF?"
I guess disable Ai "ALL" won't do anything for bodies either
no
That's interesting, didn't know that about simple soldiers...
In fact, if you getDir from a corpse, would it get the direction the head or feet are at?
Or where the eyes are looking
There is no such thing as simple soldiers, you have "simpleObjects" which doesn't work for units and you have simulation disabled Units which is what Leopard is referring to...
where the model is pointing
it has nothing to do with head or eye or feet. the unit just starts ragdolling
Yeah, that's what I was talking about too lol
I'm wondering if he could get a body bag prop, get/set dir to match the body
Simple object and disable sim on the bag
i mean i guess you could do a vectordiff of the head and pelvis
inb4 tombstones Worms-style
just pack it into a mod and test
again I explained on that page
Looks like youre missing a curly bracket
class sdrs_convoy brackets are not closed (line 101)
also your function is not correct
...?
π
you didn't tell Addon Builder which files to copy
yes
remove leading \ ?
okay...
ChatGPT said this
nope
not working
Im so tired of this
I spent 3 hours making then mod and almost 8 publishing it
and its still not done

And this is why we don't use an AI that isnt fluent in sqf
Just search the discord, loads of people have the same issue, when using that chatai. It's more hassle than its worth
Does your PBO have a prefix?
yeah
and that's what exactly?
fn_SDR_ConvoyEnhancement.sqf
ok, click that gear wheel button in PBO manager
mmm
below that
myTag, ok
so you call the function as myTag_fnc_SDR_ConvoyEnhancement?
BIS_fnc_arsenal is one example of a function
yeah I dunno, maybe don't make a module as your first mod :P
this all seems very confused.
;-; i kinda need module
thats the nature of the mod
module shows up tho
everything is good when I load it
its just my file wont "load"
In the last version of the config.cpp you posted, you had this:
function = "TAG_fnc_initConvoy";
which doesn't remotely match the CfgFunctions.
yeah I was trying different things and initConvoy was from another dude's thing? but my mainfile doesnt have initConvoy as a name so ye had to change that
its this
why is it so hard π¦
Did you read this: https://community.bistudio.com/wiki/Arma_3:_Functions_Library
little bit
so you're having to sync four different pieces of data here.
- The PBO prefix.
- CfgFunctions.
- The filename of the function.
- The function name in the module config.
Uhhh
So far none of your shit matches :P
LMAO
so I'm not sure which part to change.
Ok, let's leave the prefix as "addons". Change the filename to fn_convoyEnhancement.sqf. Change the function name in the module config to SDR_fnc_convoyEnhancement.sqf. Set CfgFunctions like this:
class CfgFunctions
{
class SDR
{
class whatever
{
file = "addons\functions";
class convoyEnhancement {};
};
};
};
okay
hold on...
i have few new files in the pbo
got new files tho
how do u guys did it?
how did u define the thing
especially u polpox
You didn't rename the file.
re-read my instructions.
nope
i give up man, making mods is wayyyyyyyyyy more easier than publishing it.
its 4:37 am
i spent 9 hours trying to publish it but eh... i give up
Your "addons" prefix sounds not fine
Hello, Iβm looking for an ace healing script that heals a player when they ace interact with the object the script is put in
when getting stuck, always step away and come back later. it might pop right out for you.
i also suggest using mikero's tools and setting up your p drive properly
https://github.com/acemod/ACE3/blob/master/addons/interact_menu/functions/fnc_createAction.sqf
https://github.com/acemod/ACE3/blob/master/addons/medical_treatment/functions/fnc_fullHealLocal.sqf
https://github.com/acemod/ACE3/blob/master/addons/interact_menu/functions/fnc_addActionToObject.sqf
in that order. mind the locality as some things are local only.
Thank you!
is there a way to execute code from a "link" within structured text?
there is execute expression for diary record
Context: what to allow people to copyToClipboard from the field manual (ie code samples) you want to have in your external text editor
There is a HTMLLink control eventhandler.
That fires wehn link is clicked
thanks! trying
this would required to overwrite the onLoad from the display, or can you inject by other means?
like maybe via some preInit, waitUntil that display is no longer null - seems quite hacky too
Maybe there is some child control/thing that has no onLoad yet.
You can add your own onLoad, find parent display from there.
If you're worried about modability and others modifying the same onLoad
Where is your control?
Some vanilla display?
@meager granite field manual
we tried a couple of things but nothing working yet. ie
arguments[] =
{
"TEST_FieldManualEntry = true; _ctrlList = (findDisplay 162) displayctrl 1500; _ctrlList ctrlAddEventHandler ['HTMLLink',{if (isNil 'TEST_FieldManualEntry') exitWith {}; forceUnicode 1; copyToClipBoard (loadFile 'file.sqf'); TEST_FieldManualEntry = nil;}];"
};```
its Tree View control. maybe it doesnt support the HTMLLink EH?
onHTMLLink
Use on: HTML
Fired on: Pressing and releasing a HTML link.
What kind of tree view item do you have there?
Do you want to execute some script when certain tree item is selected?
Had a look at it, here is how you can add your EH to Field Manual's Tree View with Scripted Event Handlers:
[missionNamespace, "OnDisplayRegistered", {
params ["_display", "_class"];
if(_class == "RscDisplayFieldManual") then {
private _ctrl_tree = _display displayCtrl 1500;
_ctrl_tree ctrlAddEventHandler ["TreeSelChanged", {
params ["_ctrl_tree", "_path"];
diag_log ["onTreeSelChanged", _this];
diag_log ["tvData", _ctrl_tree tvData _path];
diag_log ["tvText", _ctrl_tree tvText _path];
}];
};
}] call BIS_fnc_addScriptedEventHandler;
19:21:15 ["onTreeSelChanged",[Control #1500,[1,0,1]]]
19:21:15 ["tvData","bin\config.bin/CfgHints/ExplosivesList/apmine"]
19:21:15 ["tvText","APERS Mine"]
19:21:18 ["onTreeSelChanged",[Control #1500,[0,6,5]]]
19:21:18 ["tvData","bin\config.bin/CfgHints/PremiumContent/PremiumJets"]
19:21:18 ["tvText","Jets DLC"]
19:21:21 ["onTreeSelChanged",[Control #1500,[0,0,2]]]
19:21:21 ["tvData","bin\config.bin/CfgHints/Arma3/Welcome1"]
19:21:21 ["tvText","New to Arma?"]
tvData contains config of the entry
ok awesome! much appreciated πββοΈ
Looks like text itself is class HintDescription: RscStructuredText, not RscHTML
Just tested it, HTMLLink works with structured texts too
[missionNamespace, "OnDisplayRegistered", {
params ["_display", "_class"];
if(_class == "RscDisplayFieldManual") then {
private _ctrl_text = _display displayCtrl 1100;
_ctrl_text ctrlAddEventHandler ["HTMLLink", {
diag_log ["HTMLLink", _this];
}];
};
}] call BIS_fnc_addScriptedEventHandler;
19:28:31 ["HTMLLink",[Control #1100,"http://www.arma3.com"]]
Event triggered when I pressed on the link
One issue with this approach though, its missionNamespace which gets reset during mission change
Not sure how well this will work in main menu
will check and report back
what does OBJ spawn { ... }; do exactly, again? Does it just execute when ever it gets a chance or does it wait for certain conditions or?
I use it a bit, but realized I don't actually know what it does. xD
it creates an SQF "thread", running the code ASAP
Expansion: a spawned thread is scheduled, and separate from the current thread it was spawned from. That means the script scheduler can manage when it runs to balance performance, and that the current thread will continue without waiting for the spawned thread.
The obj part is passing whatever obj is as an argument to the spawned scope, so it can be retrieved with _this or params.
Technically there is no guarantee that the code will ever run.
Can someone write me an example of CfgFunctions for config.cpp? Please and then tell me what would be pbo name, sqf file name and mod name (like @Vine Boom)
Keep pbo prefix in mind when specifying paths
Uh
Test with loadFile scripting command to avoid rebuilding addon over and over
to see if your files exist or not

formationLeaderReal when?
Perks of Sandbox game 8)
I like how there is entire frameworks for "teams": https://community.bistudio.com/wiki/Category:Command_Group:_Teams did anybody in the history since A2 used this for anything? Yet there was no getHit until A3.
is there a quick way to change the text size of RscButton (through .sqf) or do I have to make it's own subclass of button?
ctrlSetFontHeight?
Also don't use RscButton, there is RscButtonMenu
I was ctrl+f for 'text', thank you.
fileExists
Hey folks! Super quick question. Now learning about initializing order so...
Is it a problem if I have an EH added to an object's init which refers to a few global variables that won't get defined till my init.sqf (for MP op)?
On the one hand, object init is initialized before init.sqf, but on the other, the EH won't fire till we actually play the op, so when they do, the variables will have already been defined
(Just trying to learn this new thing)
Hi! there is this document π
https://community.bistudio.com/wiki/Initialization_Order
Yep! I saw that. That's why I know init.sqf is initialized after the object initialization. π
Like... I understand that if the object init had a script set to go off immediately, and it refers to a global variable in init.sqf, that won't work, because the variable hasn't been defined yet.
BUT, if the script in the object init is an EH, and it won't be fired till after the init.sqf is initialized, is that a problem or will it be fine?
an EH just registers a piece of code to run on a certain event ("hit", "killed" etc)
you could add safeties like "if value does not exist, exit" but in general it should be fine
ideally, such values should not be defined in init.sqf though
Oh. What's the best practice for defining a global variable that'll be used by some of the EH I have?
--What I currently have is just each EH's executed script defining local variables with the arrays my EH use, which works, but I wanna just define those arrays as glob variables and then have the EH refer to them


