#arma3_scripting

1 messages Β· Page 64 of 1

sullen sigil
#

ignore that wrong syntax

meager granite
#

side _x sometimes is not equal to side group _x btw

proven charm
meager granite
#
[
     count units civilian
    ,count (allunits select {side _x == civilian})
    ,count (allunits select {side group _x == civilian})
]
``` => `[2,1,2]` in my mission
proven charm
#

the civs come from civ pres module. idk what side they are πŸ™„

sullen sigil
#

could be agents

dark echo
#

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

meager granite
#

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
proven charm
meager granite
#

client_func_mapDraw_initMapControl is a function that adds "Draw" EH

sullen sigil
#

civ presence module does that

meager granite
proven charm
#

the agents are not kind of "man" ? thonk (isKindOf)

meager granite
#

Logic can be agents

dark echo
#

@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

meager granite
#

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

meager granite
dark echo
#

oh boy

meager granite
#

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)

dark echo
#

these are dedicated servers

meager granite
# dark echo oh boy

Its not that hard.

  1. Have simple addon with just CfgFunctions definition to point to your script inside that same addon.
  2. Have that script contain that remoteExec snippet 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

#

Pretty much

class CfgPatches {
    class CfgMyAddonWithACoolName {
        units[] = {};
        weapons[] = {};
        requiredVersion = 0.1;
        requiredAddons[] = {};
    };
};

class CfgFunctions {...
#

Prefixes and file paths inside addons can be a bit tricky at first, your CfgFunctions will have to point to correct file

#

Welcome to Arma modding

dark echo
#

yeah its a different beast to most modding architectures

meager granite
#

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

dark echo
#

whats the current arma 3 version? 1.034?

meager granite
#

2.12

#

That number in CfgPatches doesn't matter for you, just have it as 0.1

dark echo
#

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?

meager granite
hasty gate
#

How to show/hide group bar GUI using SQF (which is showing units in your current group)?

hallow mortar
hasty gate
hallow mortar
#

The group info bar is only shown to the group leader. This is intentional, it's how the game always works.

quiet gazelle
dark echo
#

@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

meager granite
#

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

opal zephyr
#

Thanks!

dark echo
#

@meager granite I DM'ed you, if I could harass you to look over my content? It's quite short

granite sky
#

I think you need to use the file parameter in CfgFunctions if your PBOs are prefixed, which is standard practice for mod PBOs.

sharp grotto
#

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"]
];
quiet gazelle
#

i there a way to do what this button does through scripting?

quiet gazelle
quiet gazelle
#

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

high vigil
#

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;
spare matrix
#

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

quiet gazelle
#

is the leader already inside?

#

in that case his vehicle would be vehicle (leader _group)

spare matrix
#

Knew it would be obvious. Thank you, I'll give it a go!

zealous night
#

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?

quiet gazelle
#

check if you've misspelled something

hallow mortar
#

Things don't typically "just break" without any input. Try to remember what you've changed since it was last working.

quiet gazelle
#

is it a bad practice to assign multiple event handlers of the same kind to something to fulfill different roles?

opal zephyr
#

Whats stopping you from including it all in one EH?

quiet gazelle
#

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

opal zephyr
#

Id do it in one, unsure if there'd be any negative consequences to stacking them, but id avoid it

opal zephyr
granite sky
#

Well, keeping related code together in a very large mission.

little raptor
#

but nowadays there's no reason to avoid it really. previously EHs would recompile on every call, so they were slower

quiet gazelle
#

gotta teleport arrows around in a Dragged3DEN EH cause attachTo doesn't work with 3den objects

old radish
#

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

granite sky
#

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.

faint oasis
#

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;
digital hollow
faint oasis
digital hollow
#

ah xD What do you want the plane to do, and how are you telling it to do that?

faint oasis
#

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

digital hollow
#

so the plane is landing because you zeus-order the troops to get in it

faint oasis
#

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)

digital hollow
granite sky
#

Preferably before they drop :P

faint oasis
#

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

granite sky
#

So what does the plane do if you delete every cargo unit instead?

faint oasis
#

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

molten tree
#

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.

digital hollow
#

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.

molten tree
slow brook
#

Did you get this working lad?

faint oasis
molten tree
molten tree
granite sky
#

@faint oasis Are you saying that it works fine locally?

faint oasis
#

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.

digital hollow
#
  1. what happens if you doMove the plane after it seems to stop responding?
    or 2) try not sending the troops groups to server until after the drop is complete?
faint oasis
digital hollow
#

at 3:30 you place another waypoint for the plane, but it doesn't seem to respond. try a doMove instead?

faint oasis
fair drum
#

does publicVariable wait for the transmission through the network is confirmed before moving to the next line?

granite sky
#

It does not.

old radish
#

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.```
slow brook
#

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];
}];```
digital hollow
#

assuming you've set myCurator as the variable name of the module?

slow brook
faint oasis
north leaf
#

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

dreamy kestrel
#

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 🧠 ?

dreamy kestrel
grand stratus
#

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

dreamy kestrel
exotic flax
#

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)

hallow mortar
exotic flax
#

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.

pulsar pewter
#

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?

quiet gazelle
#

missing ; in line 1

pulsar pewter
#

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

dreamy kestrel
digital hollow
slow brook
dreamy kestrel
#

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...

digital hollow
boreal parcel
#

does GetOut trigger on aircraft ejection as well?

grand stratus
#

I just used GetOut while in a blackwasp in editor yesterday, it doesn't eject you

north leaf
#

What would be the best method to pull info from inidbi2 and putting it into a gui that clients can see?

boreal parcel
north leaf
#

I have a nice interface setup, works when I host, but once on dedi, it's all blank

meager granite
#

remoteExec your data

#
_my_data remoteExec ["my_function_that_puts_data_into_gui", 0];
north leaf
#

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

meager granite
#

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

north leaf
#

I'm on phone atm, but essentially pull from inidbi2 database list of vehicles and put them into an lblist

meager granite
#

If its class names, send the class names and have clients works with them

north leaf
#

Then get the lblist selected, grab the editor preview and send that to a picture aspect of the interface

meager granite
#

Have server send all needed data to clients once

#

Then clients do the rest locally

north leaf
#

I see, so give the client a DIY kit and build the interface on client side

#

Boom

meager granite
#

Yes

north leaf
#

Awesome, thank you

#

Felt like I was missing something simple lmao

meager granite
#

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

north leaf
#

Gotcha

#

I'll give it a try, thanks again @meager granite

grand stratus
#

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

meager granite
#

Either you're mistaking something or they're repaired through script somewhere

grand stratus
#

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**

meager granite
#

Probably scripted?

#

Yeah, they're repairable through script

#

I guess Warlords does it?

#

Unpack the mission to check yourself?

grand stratus
#

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.

digital hollow
#
getCursorObjectParams params ["_cursorObject", "_selections", "_distance"];
``` does anyone know where the `_distance` is measured from? it's not `eyePos`...
meager granite
#

Probably from the gun?

digital hollow
#

ah yeah, big difference between weapon up vs weapon lowered, or perhaps different selections are used

sharp parcel
#

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

granite sky
#

If you transport the vehicle then the occupants go with it.

sharp parcel
#

I can do it as admin, but looking for players to be able to do it

warm hedge
#

If you find nothing, you write one

sharp parcel
warm hedge
#

I'm not being a dick

sharp parcel
#

maybe check that mate

warm hedge
#

At least you better to tell us what you got so far so we can point it out

sharp parcel
#

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;

warm hedge
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
warm hedge
#

Please format this so easy to understand which is which

sharp parcel
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
warm hedge
#

It only tells how you do

sharp parcel
#

let me scroll up and try to find an example

warm hedge
#

You are using wrong character. If you wonder copy the example

sharp parcel
#

Description.ext

#include "Fex_FastTravel\defines.hpp"
#include "Fex_FastTravel\dialogues.hpp"
hint "good!";
warm hedge
#

Yup

sharp parcel
#

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

warm hedge
#

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

sharp parcel
#

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.

granite sky
#

position vehicle player is fine. You must have typo'd something.

#

Not necessary either though.

sharp parcel
pulsar pewter
#

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)

grand stratus
#

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?

granite sky
#

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.

grand stratus
#

so having an object as a paramater for a remote exec sends it as a reference to the object?

granite sky
#

Yes. I'm not sure on the exact low level mechanism.

grand stratus
#

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

warm hedge
pulsar pewter
#

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.

warm hedge
#

Then try to nest the entire code with spawn and use sleep

pulsar pewter
#

Nice. It's nice to know I'm not completely lost πŸ˜‰ Thanks, @warm hedge ! Helpful as always

spare matrix
#

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;

meager granite
#

So what do you have, _this, or _group?

#

And what is _this?

spare matrix
#

_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

warm hedge
#

In where actually? How do you execute that?

spare matrix
#

It executes on the group leader. _this is the group leader

warm hedge
#

Not quite specific. In which field?

#

Group Init?

spare matrix
#

No I'm pretty sure its the group leader's init

warm hedge
#

Then this w/o underscore

spare matrix
#

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

warm hedge
#

Not working how? Any errors?

meager granite
#
if(local this) then {{_x moveInCargo vehicle leader group this} forEach units group this};
spare matrix
#

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!

cyan dust
#

It would be so nice to have Arma Debug Engine working again with STATUS_INTEGER_DIVIDED_BY_ZERO issue solved meowheart

meager granite
still forum
#
_array2 = [];
_array2 insert [0, _array, true];

moves that whole foreach loop into engine
Its still O(nΒ²) tho, just.. faster

still forum
#

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

meager granite
#

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

meager granite
#
        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)

mellow scaffold
#

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

meager granite
#

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.

mellow scaffold
#

ack, thanks!

snow viper
#

does anyone know where i can find the classnames of static weapon ammunitions? Like mortar and howitzers

granite sky
#

CfgWeapons -> magazines

#

(have you ever used config viewer?)

snow viper
#

@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

granite sky
#

CfgWeapons, find weapon, go to magazines[] property.

snow viper
#

ive tried loking into the config entry for the static weapon for example

mellow scaffold
# meager granite Otherwise `diag_codePerformance [{...code...}]` the hell out of it
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.

granite sky
#

ew no :P

snow viper
granite sky
#

oh right, that gets complex actually :P

#

probably quicker to use commands.

snow viper
#

incidentally im trying to find out for an antistasi template i'm making πŸ˜›

meager granite
#

but yeah, new inline private is much faster

snow viper
granite sky
#

magazinesAllTurrets is probably a good shortcut here.

snow viper
#

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!!

granite sky
#

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

mellow scaffold
#

Yeah, definitely using params over this#X

#

It helps with udnerstanding undocumented functions

snow viper
#

@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?

granite sky
#

Might be a pylon vehicle.

still forum
still forum
still forum
meager granite
still forum
#

nu, it was renamed in A3

#

from "local" to "private"

meager granite
#

Aaah, never knew about "local" back then

high vigil
#

what has higher cost in SQF set new value in array or create new array instead? Lets say trying to update multiple values

granite sky
#

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.

high vigil
granite sky
#

blinks

#

You mean adding elements?

high vigil
#

set index value

granite sky
#

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.

still forum
#

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

little raptor
#

you can't compare floats like that

still forum
#

Say serverTime returns 1.0, and next time it returns 2.0000001
Now its not equal anymore

little raptor
#

well given what you want you shouldn't do it like that

brittle burrow
#

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.

still forum
#

compare using < > >= <=

little raptor
#

but the questions is why constantly set something vertical? can't you e.g disable its sim or something?

brittle burrow
#

but helicopters rotate when moving and i dont want that

#

well, i want the helicopter to move, but not rotate the attached thing

brittle burrow
# little raptor yes

how do i do that? tried putting it in the "init" part in properties but it doesnt work

fair drum
#

depending on the speed at which you need to run this command, you can do a eachFrame handler to run it on every frame

brittle burrow
#

meowsweats 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

little raptor
#

because attached object coords are relative

#

tbh no matter what you do it'll be ugly blobdoggoshruggoogly
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

fair drum
#

curious to what you you wanted to do with it anyways

brittle burrow
brittle burrow
#

but i dont want the ship to rotate with the helicopter

brittle burrow
fair drum
#

are you trying to make a ship appear to be moving? or do you actually want it flying through the air

brittle burrow
#

i actually want it flying

#

and it does when i attach it to a heli

#

what i want to do is keep it horizontal

fair drum
#

is it cinematic? like only in one direction? or do you want it player controlled.

brittle burrow
#

player controlled

fair drum
#

i see lol

brittle burrow
#

prob too hard for me to do

quiet gazelle
#

can a function that is registered via CBA PREP have a name that starts with a number?

brittle burrow
#

thx for the help πŸ‘

#

prob gonna do it with a vtol aircraft or smth instead

old radish
#

How do you get around the issue of PvP on the same team?

#

so like, civs killing other civs becoming hostile? Is it addrating?

quiet gazelle
#

what are your players doing?

old radish
#

killing eachother and blufor as civs duh

quiet gazelle
#

i suppose you could tell them not to

old radish
#

but thats the game

quiet gazelle
#

are you having issues with ai or players?

granite sky
#

You can use the HandleRating EH to prevent that thing.

#

We override it because it's quite daft about vehicles.

old radish
#

do you have an example? ive already torn my hair out over the killed event handler

#

im not sure my heart can take another

granite sky
#

For local unit:
_unit addEventHandler ["HandleRating", {0}];

#

It's respawn-persistent.

old radish
#

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

granite sky
#

yeah, initPlayerLocal should be good.

old radish
willow hound
old radish
#

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

kindred zephyr
#

handle the score and your problem is gone, there is a mission event handler for that

high vigil
#

any one tried this isPlayer [cursorobject] (Pointing at dead player)) returns false

hallow mortar
high vigil
#

Seems like when player dies his object becomes null for split second

oblique anchor
#

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

ruby bronze
#

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

snow cedar
#

Quite a lot is actually achievable with SQF, just not how you'd usually do it in another language

little raptor
oblique anchor
little raptor
#

no it's a config entry

#

there's also setFontSize something

oblique anchor
#

i wanna put it inside a trigger

ruby bronze
oblique anchor
little raptor
little raptor
oblique anchor
#

xD

little raptor
ruby bronze
little raptor
#

dunno what you mean

ruby bronze
#
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?

little raptor
#

is _this the player?

oblique anchor
#

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

ruby bronze
little raptor
#

but you should subtract those from the width and height of your ctrl

little raptor
ruby bronze
#

Hm, did not seem to work (can still see the actions if I remote control an AI and look at the player character)

little raptor
#

I meant other players won't see that

ruby bronze
#

Oh so me remote controlling the AI is basically like it's still me

little raptor
ruby bronze
#

That definitely seems to have done the trick, thank you!

tough abyss
#

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
            };
        };
    };
};
little raptor
tough abyss
#

its pretty safe language by the looks of it

little raptor
#

dunno blobdoggoshruggoogly

tough abyss
#

rip

fleet sand
#

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.

limber heart
#

can i use

BSD1 animate["Door1",1];

to close doors on a building?

north leaf
#

Opinion question:

What's better, having a trigger activated by player, or a loop that checks distance between marker and player?

#

For performance

dusk gust
dusk gust
north leaf
#

yeah, I should note that i'm dealing with 50 + markers / triggers

#

but I'm kinda leaning towards triggers too

dusk gust
#

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

dusk gust
dusk gust
limber heart
dusk gust
dusk gust
# tough abyss Can anyone tell me if im even remotly close to what i want to achieve, Comments ...

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

meager granite
#

Only guessing, not sure if this is a working solution

#

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

limber heart
dusk gust
wind hedge
#

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?

meager granite
#

It should

grand stratus
#
_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 😐

tough abyss
#

is there a method of playing a prerecorded video file in a mp game without a mod?

meager granite
hasty current
#

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

tough abyss
meager granite
#

Not sure if it works if Logic is outside of the vehicle though

meager granite
#

Its _i = 3; when next forEach loop starts and your while instantly breaks

grand stratus
hasty current
#

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

warm hedge
#

Not sure about torque but thrust yes

hasty current
meager granite
#

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? thronking

#

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

meager granite
#

Arma moment

#

Can't control same UAV unit at the same time though, thankfully

#

Still, this system is busted

still forum
grand stratus
tender fossil
cyan dust
still forum
#

: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

still forum
#

Specifically for,step,to loop? not foreach?

cyan dust
#

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

still forum
#

I'll try to check it tomorrow

#

I didn't know that bug existed, need to tell me πŸ«‚

agile flower
#

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

proven charm
agile flower
#

It's interesting as the wiki gives this exact syntac on create display

proven charm
#

which page?

agile flower
#

Wait one

#

Example 4

#

This code in example 4 executes with no error

proven charm
#

the "createDisplay" is nowhere in that page

agile flower
#

Flip me

#

I see it now

#

Duh

#

Thanks

proven charm
#

np

warm hedge
#
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
meager granite
#

Also icon can be default icon from CfgVehicleIcons

#

drawIcon accepts names from CfgVehicleIcons so it should be fine

stable dune
#

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?

tough abyss
meager granite
#

No idea how often it should do that

#

There is also a group event handler, maybe doing it on knowsAbout change is enough

tough abyss
#

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.

meager granite
#

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

atomic badger
oblique anchor
#

Yo, anyone knows how to make rscText show even when hud is off?

tough abyss
meager granite
#

Don't use onEachFrame in real scripts though, there is stackable EachFrame which you'll need to add and remove as you need

meager granite
oblique anchor
#

is it a function?

meager granite
meager granite
#

Create your controls in a display that doesn't get hidden

oblique anchor
#

its the second parameter of the ctrlCreate no?

#

the display

meager granite
#

left operand

oblique anchor
#
_hud = uiNamespace getVariable ["RscUnitInfo", controlNull];    
_text = _hud ctrlCreate ["RscText", -1];    
#

this is how i create mine

#

so u mean change the getVariable?

ripe stratus
#

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

oblique anchor
#

Is there a list of displays somewhere in the docs i can pick from?

meager granite
ripe stratus
meager granite
#

Create it with createDisplay, then create your controls there

oblique anchor
#

will using display 1 work?

#

IDD_GAME

meager granite
#

You can get positions from RscUnitInfo display and use them on your new display's controls

oblique anchor
#

with findDisplay 1

meager granite
#

No idea, try it?

oblique anchor
#

kk

#

thx

meager granite
#

Probably wont, likely main menu or something

oblique anchor
#

oh

#

then mission i think probably will

meager granite
#

Turned out it was AI's auto targeting ignoring my commands

#

Try gunner drone displayAI "AUTOTARGET" ?

oblique anchor
#

yap it works thx πŸ™‚

ripe stratus
meager granite
#

I think you can post images here (don't quote me on that), if they're not too big

ripe stratus
#

Okay, I will I apologize in advance, admins

meager granite
#

I guess your selection names aren't correct if your camera doesn't follow gunner's camera

ripe stratus
#

You could be right, I'll double check that in a second

meager granite
#

Try

getText(configOf yourUAV >> "uavCameraGunnerPos")
getText(configOf yourUAV >> "uavCameraGunnerDir")
ripe stratus
#

here is the first image it shows the camera following the object(White platform)

meager granite
#

Stock A3 Greyhawk's values in config are:

        uavCameraDriverPos = "PiP0_pos";
        uavCameraDriverDir = "PiP0_dir";
        uavCameraGunnerPos = "laserstart";
        uavCameraGunnerDir = "commanderview";
ripe stratus
meager granite
#

CUP's drone probably has own selections

ripe stratus
#

Yeah cups is "laser_start" and "laser_end"

meager granite
#

Did you run these commands to make sure?

ripe stratus
#

Do I try those in the debug menu ingame?

Sorry just a bit of an amature still

meager granite
#
[getText(configOf yourUAV >> "uavCameraGunnerPos"), getText(configOf yourUAV >> "uavCameraGunnerDir")]
#

yourUAV should be variable name of your drone

ripe stratus
meager granite
#

πŸ€”

#

Maybe its an issue with CUP's model?

#

Try using some other drone, like stock Arma 3 Greyhawk drone?

ripe stratus
#

Maybe, I'll try the Vanilla grey hawk

#

^

tough abyss
meager granite
#

Being renegade creates other issues

#

I think renegades can't get into same vehicle

ripe stratus
#

You're right

ripe stratus
# meager granite Maybe its an issue with CUP's model?

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 πŸ™‚

meager granite
#

I remember fixing MQ-9 for CorePatch in OA, it used to lase improperly, maybe CUP's MQ-9 didn't inherit these fixes

ripe stratus
#

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 ^

meager granite
#

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

ripe stratus
#

Hmm I get "[array,array]"

meager granite
#

uav1 is not right variable name then

ripe stratus
#

Tried in-game, got this [[0.000874763,4.15517,-0.920886],[0.000874763,4.29776,-0.920886]]

meager granite
#

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?

ripe stratus
#

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)

lunar goblet
#

Hey I'm trying to make a quick script to play a sound when a player interacts with the object (via addAction, my favorite meowheart) but I am big stupid and don't know how to make it play the noise

#

Thanks in advance

hallow mortar
#

Say3D or playSound3D

tough herald
#

I know at least I and Varanon are.

slow isle
#

How can I make a drone turret always miss? (suppress only)

meager granite
#

Mess with projectile speed so AI always misses?

#

On Fired event handler

slow isle
#

brilliant idea, thank you

digital hollow
#

setTurretOpticsMode can change the zoom level of a turret without being in gunner view. Is there a way to do the same for PilotCamera?

quiet gazelle
#

is there something like a postInit EH that i can attach to an object?

little raptor
#

mission EH

#

if that's what you mean

quiet gazelle
#

not what i'm looking for

little raptor
#

then what are you looking for?

quiet gazelle
#

imma have tp explain some context for that

little raptor
digital hollow
quiet gazelle
#

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

little raptor
digital hollow
#

cba has InitPost

quiet gazelle
#

synchronizing the helpers instead of having variables inside them pointing at eac other might be a good idea

quiet gazelle
dusk shadow
#

3DEN script question, need a way to get all "Layers" in the current editor as an array... possible?

dusk shadow
untold ivy
#

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

β–Ά Play video
pulsar pewter
#

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?

winter rose
winter rose
little raptor
#

so the EH will only trigger where the AI is local

winter rose
#

where the group* is local?

pulsar pewter
winter rose
#

ah well, yes, AI group you said

untold ivy
# winter rose it might be pilot camera, no?

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

winter rose
#

if you don't have headless clients, it's ok

winter rose
pulsar pewter
#

Ah, I do. My unit's logistics guy insists on them haha.

winter rose
pulsar pewter
# winter rose if you don't have headless clients, it's ok

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!

little raptor
#

uhm did you even try it by adding the EH to every PC first?

#

like I said it should only trigger once

pulsar pewter
#

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.

little raptor
#

you can test it in multiplayer by running Arma twice on the same PC

#

in case you didn't know

pulsar pewter
#

Oh. I didn't. lmao. Good to know. Thanks Leo!

untold ivy
winter rose
#

yep

little raptor
untold ivy
winter rose
#

gud

untold ivy
#

i will open the same heli and get right back at you

digital hollow
#

ShackTac has private mods, see the direction markers. Those probably add pilotcamera.

untold ivy
pulsar pewter
#

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];
            }];
        };
    }];
little raptor
#

what is this?

pulsar pewter
#

the init of the curator module. Pretty sure that's necessary for the Curator EHs

little raptor
#

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?

pulsar pewter
#

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

little raptor
#

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"];

pulsar pewter
#

I realize πŸ˜‚ . I'm just practicing pushing through params and stuff.

little raptor
#

same here:

_self = _this select 0;

pulsar pewter
#

yeah, it's just for me to reinforce the idea of what's going on, how it works haha. I'm slow

little raptor
#

see if it fires at all

little raptor
untold ivy
pulsar pewter
#

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.

little raptor
granite sky
#

Oh, some people don't. But they are wrong.

little raptor
#

also put another one inside the if ... check

pulsar pewter
# little raptor 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.

granite sky
#

Is the artillery on the same machine as the curator?

#

actually not even sure where the curator EH fires.

pulsar pewter
#

I honestly dont know.

granite sky
#

This is a DS+client setup?

#

Or localhost or what?

pulsar pewter
acoustic yew
#

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 😦

granite sky
acoustic yew
#

Is there no sample?

little raptor
#

you can check vanilla modules in config viewer

#

you can also extract the modules_f.pbo and look at its configs

acoustic yew
#

:0

granite sky
#

Looks like a fairly good example under "Creating the module config" too.

pulsar pewter
#

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!

acoustic yew
acoustic yew
little raptor
#

addons folder

#

where Arma is installed

acoustic yew
#

Oh damn

little raptor
acoustic yew
#

Oo

cobalt path
#

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;
};ο»Ώο»Ώο»Ώ
granite sky
#

@cobalt path If you're running that locally to each player, it will save to their local profilenamespace, not on the server's.

cobalt path
#

as long as it saves and I can load it once they rejoin

granite sky
#

well, it should basically work.

cobalt path
#

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

granite sky
#

Well, you could shortcut and just put the loading code in onPlayerRespawn.

cobalt path
#

oh, I probably could

granite sky
#

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.

cobalt path
#

thanks I will check

quiet gazelle
#

cause it seems like it's after "Expressions of Eden Editor entity attributes are called"

#

at least in 3den it seems like that

hallow mortar
acoustic yew
#

Hello πŸ™‚

Followup to my question, where am I putting the config.cpp?

little raptor
#

in a folder...

acoustic yew
#

which one?

cold pebble
#

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?

opal zephyr
granite sky
#

Set in GetInMan, update in SeatSwitchedMan, I guess.

little raptor
acoustic yew
#

Yeah trying to understand it ngl

little raptor
#

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?!

acoustic yew
#

Bro making a mod is harder than sharing it :/

quiet gazelle
wind hedge
#

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
}; ```
quiet gazelle
granite sky
#

Dead bodies still are a resource hog but I'm not sure what you'd be saving here.

quiet gazelle
#

does 3den have a different initialization order?

granite sky
#

Body's still rendered and still simulated, and hopefully the AI is turned off on death. Maybe other units still check visibility against corpses?

wind hedge
granite sky
#

Bodybags are preferable for pretty obvious reasons.

#

but not necessarily an option.

#

Agent thing is another matter. Might test it.

north leaf
#

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

granite sky
#

There is no good way. You just have to spam position updates.

#

hmm. Does setMarkerPos _object actually track the object?

north leaf
#

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

granite sky
#

You certainly can do that, yes. Also vectorFromTo if you prefer vectors to angles.

north leaf
#

Maybe:
For "_i" from _startPos to _endPos....but then I get lost hah

hallow mortar
north leaf
#

Ohhhhhhh that looks like it would work

#

Thanks @hallow mortar , I'll try that once I get on the pc tonight

granite sky
#

@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...

wind hedge
wind hedge
granite sky
#

Was like 45 fps vs 47 fps, but the agent version had 150 fewer simulated weapon objects :P

little raptor
little raptor
#

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

wind hedge
little raptor
#

afaik that's also part of the AI thing

#

objects don't have groups themselves iirc

north leaf
#

Could you set the corpse to enablesimulation false and a simple object?

acoustic yew
#

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

little raptor
wind hedge
wind hedge
little raptor
#

no

north leaf
#

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

wind hedge
little raptor
north leaf
#

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

quiet gazelle
#

i mean i guess you could do a vectordiff of the head and pelvis

south swan
#

inb4 tombstones Worms-style

little raptor
acoustic yew
#

okay!

#

how..

#

πŸ˜‚

#

dont mind me, im a noob

little raptor
#

again I explained on that page

acoustic yew
#

I do have pbo manager...

#

lemme see!

acoustic yew
#

Im getting an error building the addon 😦

#

I guess I found it...

opal zephyr
#

Looks like youre missing a curly bracket

little raptor
#

also your function is not correct

acoustic yew
#

yeah got it fixed πŸ™‚

#

Also

#

it built fine but....

little raptor
#

...?

acoustic yew
#

πŸ˜…

little raptor
#

you didn't tell Addon Builder which files to copy

acoustic yew
#

it says addon source directory

#

should I add function folder too?

#

nvm

little raptor
acoustic yew
#

oof...

#

hehehe

#

it works

#

can I rename the pbo?

little raptor
#

yes

acoustic yew
#

yay

#

xD

#

You're a big big help man

#

time to sign the key ^^

#

hehehehehe

acoustic yew
#

😦

frank mango
#

remove leading \ ?

acoustic yew
#

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

frank mango
#

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

acoustic yew
#

xD

#

trying

#

I mean idk I really got no other resources

granite sky
#

Does your PBO have a prefix?

acoustic yew
#

yeah

granite sky
#

and that's what exactly?

acoustic yew
#

fn_SDR_ConvoyEnhancement.sqf

granite sky
#

ok no

#

prefix is like a folder name.

acoustic yew
#

uh

#

and when I pack it into a PBO...

granite sky
#

ok, click that gear wheel button in PBO manager

acoustic yew
granite sky
#

mmm

acoustic yew
#

yesss?

granite sky
#

what's in your CfgFunctions atm?

#

not the ChatGPT version

acoustic yew
#

uh

granite sky
#

below that

acoustic yew
#

nothing

granite sky
#

myTag, ok

acoustic yew
#

ye

#

didnt use much brain

granite sky
#

so you call the function as myTag_fnc_SDR_ConvoyEnhancement?

acoustic yew
#

no

#

uh wdym function btw?

#

in my script or file name?

warm hedge
#

BIS_fnc_arsenal is one example of a function

acoustic yew
#

:0 polpox himself

#

where is it btw?

granite sky
#

yeah I dunno, maybe don't make a module as your first mod :P

#

this all seems very confused.

acoustic yew
#

;-; 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"

granite sky
#

In the last version of the config.cpp you posted, you had this:
function = "TAG_fnc_initConvoy";

#

which doesn't remotely match the CfgFunctions.

acoustic yew
#

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 😦

acoustic yew
#

little bit

granite sky
#

so you're having to sync four different pieces of data here.

#
  1. The PBO prefix.
  2. CfgFunctions.
  3. The filename of the function.
  4. The function name in the module config.
acoustic yew
#

Uhhh

granite sky
#

So far none of your shit matches :P

acoustic yew
#

LMAO

granite sky
#

so I'm not sure which part to change.

acoustic yew
#

I changed one thing

#

ahhhh nope doesnt work

#

this is a pain

granite sky
#

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 {};
    };
  };
};
acoustic yew
#

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

granite sky
#

You didn't rename the file.

acoustic yew
#

uh

#

what file?

granite sky
#

re-read my instructions.

acoustic yew
#

uhh

#

ohhh

acoustic yew
#

nope

acoustic yew
#

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

warm hedge
#

Your "addons" prefix sounds not fine

tough abyss
#

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

fair drum
tough abyss
#

Thank you!

velvet merlin
#

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

still forum
#

There is a HTMLLink control eventhandler.
That fires wehn link is clicked

velvet merlin
#

thanks! trying

velvet merlin
#

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

still forum
#

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

meager granite
#

Some vanilla display?

velvet merlin
#

@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?

meager granite
#
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?

meager granite
# velvet merlin <@107672558320496640> field manual

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

velvet merlin
#

ok awesome! much appreciated πŸ™‡β€β™‚οΈ

meager granite
#

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

velvet merlin
#

will check and report back

astral bone
#

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

winter rose
#

it creates an SQF "thread", running the code ASAP

hallow mortar
#

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.

pliant stream
#

Technically there is no guarantee that the code will ever run.

acoustic yew
#

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)

acoustic yew
#

Uh

meager granite
#

Test with loadFile scripting command to avoid rebuilding addon over and over

#

to see if your files exist or not

acoustic yew
#

loadfile…..

#

I’m legit gonna passout

meager granite
#

formationLeaderReal when?

acoustic yew
#

Perks of Sandbox game 8)

meager granite
grand stratus
#

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?

meager granite
#

Also don't use RscButton, there is RscButtonMenu

grand stratus
#

I was ctrl+f for 'text', thank you.

pulsar pewter
#

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)

winter rose
pulsar pewter
#

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?

winter rose
#

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

pulsar pewter
#

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