#arma3_scripting

1 messages ยท Page 146 of 1

proven charm
#

you need to give it the curator pointer

#

something like (allCurators # 0) addEventHandler .....

#

or with YourCuratorName instead of that

lyric plover
lyric plover
#

This may seem like a contradiction of my previous message and I'd like to apologize for making it look like the issue was resolved.

lyric plover
proven charm
#

so how does your code look like now ?

lyric plover
#

Changed it to bare bones just to identify if it works the way I'd like it to:

(allCurators #0) addEventHandler ["CuratorObjectSelectionChanged", {
 params ["_curator", "_entity"];
 hint str _entity;
}];
#

By bare bones I mean from my previous script.

proven charm
#

and when do you run it? like where

lyric plover
#

Land_HelipadEmpty_F.

#

If this is the problem then it can be anything else I can place as Zeus.

lyric plover
#

Did you mean to ask something else?

proven charm
#

oh idk why you mention that...

lyric plover
#

Because I'm a beginner and I don't know exactly what this meant so I thought that if I was being specific then you'd know for sure if it's right or wrong.

proven charm
#

no problem, that info just isnt important

lyric plover
#

Alright, so can you help me?

proven charm
#

i'll try, i asked where you run the code?

lyric plover
#

From the object init in the invisible helipad after I grab it from the compositions folder as a Zeus.

proven charm
#

try init.sqf instead its much better place

lyric plover
kind sluice
#

Hello guys, good afternoon, I am looking for a script that the control sector moves in the king of the hill style, I would appreciate it if you can help me or if you have knowledge of any mod that can do this function, thank you

proven charm
lyric plover
proven charm
#

ic

#

u have more than one zeus?

lyric plover
#

Usually it's just me but sometimes there's a game moderator with permissions. So #0 and #1.

proven charm
#

ok

lyric plover
#

I'm testing all of this in singleplayer btw rn.

proven charm
#

well idk how to setup that . with just one player as zeus you could set it in init.sqf

#

this code worked for me in init.sqf ```sqf
sleep 0.1; // Wait curator ready

if(local (allCurators # 0)) then
{
(allCurators # 0) addEventHandler ["CuratorObjectSelectionChanged", {
params ["_curator", "_entity"];
hint format ["Pos: %1", getposATL _entity];
}];
};

lyric plover
#

nevermind

#

This will do, I found a "solution" to this problem, sorta.

#

I'll just make two different scripts, one to enable it and second to disable it if possible

#

And if not then I'll just disable the first eventhandler automatically after selecting a vehicle.

#

Yeah, I guess that can work. Thanks a lot.

lyric plover
#

Like a lightning strike module. You select it, then select a unit, and it dies.

#

Same here except instead of dying it gets downed.

proven charm
#

hmm sounds tricky, i hope you get it sorted. maybe others who are better with zeus/curator in this chat can help you better

lyric plover
#

I hope as well but you really helped me and I got something that's close enough for me to use it. So thank you again.

lyric plover
#

So deletevehicle entry on the wiki says it can accept objects right?

#

what am i doing wrong

#

it's an array and the error says it doesn't want an array but an object?

#

but the wiki said that this function will accept arrays

#

just what am i doing wrong

hallow mortar
#

2.18 is the next major update. The current stable branch version is 2.16.

hallow mortar
#

That's why the version indicator is orange.

lyric plover
#

guess i'm gonna have to do it manually

#

wait no

#

i can do a foreach

#

nevermind, thanks

#

yeah now it works, thanks again

#

Alright my composition is pretty much done, I'm going to release it and I want to ask if anyone wants to test it out because if so, I'll link it here.

raw vapor
#

Hey guys, I lost a useful debug script that I used to have. I was wondering if anyone knew how it was done and could replicate it.

I used to be able to run a local command in the debug menu that would copy all of the file paths for every texture and its associated index number. And then it would output the results to a hint in-game, and my clipboard. Or I could copy it directly from the debug output.

So I'd run the script in the debug console and it would go,
"0","texture\file\path\plane_0.paa","\n","1","texture\file\path\plane_1.paa","\n","2","texture\file\path\funny_roundel.paa","\n","3","","\n","4","","\n","5","texture\file\path\tailcode_csat.paa" or something. This made it way easier to find and set textures with scripts when working with modded vehicles that have no documentation.

#

Somehow I need a debug script that

  • Looks at whatever object I'm looking at, or sitting inside of
  • Gets all the texture layers of the vehicle object
  • Outputs the texture layer numbers and the texture path, or leaves it blank if there is no texture for that layer
warm hedge
#

Texture layers? Do you mean getObjectTextures?

raw vapor
#

That was part of it, yes.

#

One of you may know what I am talking about. I found it on Google years ago and I cannot find it again. It was a string of debug commands.

warm hedge
#
_r = [];
{_r pushBack [_forEachIndex,_x]} forEach getObjectTextures _vehicle;
copyToClipboard _r```Not tested
raw vapor
#

Oh! getObjectTextures cursorTarget; is almost what I am after. The original script I had didn't use cursorTarget but checked what vehicle I was in. But that's not important.

The original script would also number them starting at 0.

warm hedge
#

My code should count the array from 0

delicate hedge
#

Is there any way in arma3 to work with files (create, update, remove) in missions folder from sqf scripts?

warm hedge
#

No native way

late drum
#

Hi, I'm having some problems with my addAction, when I press them it takes a long time to do the script, this didn't happen before, now it's like they have a delay of a few seconds, I've looked in the rpt and there is no error...

warm hedge
#

Probably because you're running a LOT of spawns

meager granite
#

ARRAY insert ARRAY doesn't return array it operated on ๐Ÿ˜ก

meager granite
#
    private _units = [
        driver _this getVariable ["koth_uav_controlling_player", objNull]
        gunner _this getVariable ["koth_uav_controlling_player", objNull]
    ] select {alive _x};
    _units insert [-1, (crew _this select {alive _x && !unitIsUAV _x}), true];
    _units;
```So ugly
south swan
#

just like most array-modifying commands do? pushBack(Unique)/set/deleteAt/deleteRange/resize/sort...

meager granite
#

Also appendRet, reverseRet, insertRet

south swan
#

inb4 pushBackChain and so on for chainable array commands ๐Ÿ™ƒ

#

yaay for even more naming conventions

meager granite
south swan
#

yaaay, SQF golf!

meager granite
#

I live for these moments when multi-line bit turns into one liner

#

Then you come back to it month later and can't get what the hell it is doing

#

Nevermind, this doesn't work because you can be controlling UAV and be inside it too and you end up with 2 of the same unit

south swan
#

should work the same with the first snippet, though

meager granite
south swan
#

ah, i've missed that

meager granite
#

Where's muh unary arrayIntersect so I can get rid of duplicates quickly

#
    private _units = crew _this apply {if(unitIsUAV _x) then {_x getVariable "koth_uav_controlling_player"} else {_x}} select {alive _x};
    _units arrayIntersect _units;
```Gotta go with this then
late drum
#

Is there any way to only display blufor and not the player's name?

warm hedge
#

Use other chat command(s)

late drum
#

But on the wiki it appears without any unit name

warm hedge
#

If this is what you mean probably the format has been changed over years

south swan
#

inb4 it's SP/MP difference

meager granite
#

Seriously though, just create a Logic unit of needed side and globalChat it

#
    server_clients_teamsLogics = createHashMap;
    {
        private _logic = createGroup _x createUnit ["Logic", [0,0,0], [], 0, "CAN_COLLIDE"];
        server_clients_teamsLogics set [_x, _logic];
    } forEach [blufor, opfor, independent, civilian];
    publicVar_clients_teamsLogic = server_clients_teamsLogics;
    publicVariable "publicVar_clients_teamsLogic";
// Params: String
// Returns: Nothing
client_func_chatMessage = {
    publicVar_clients_teamsLogic getOrDefault [client_mySide, objNull] globalChat _this;
};
late drum
#

tysm :)

#

I had to edit the code a bit because the globalChat received an Array instead of a String, I put it like this and it works perfectly

server_clients_teamsLogics = createHashMap;
{
    private _logic = createGroup _x createUnit ["Logic", [0,0,0], [], 0, "CAN_COLLIDE"];
    server_clients_teamsLogics set [_x, _logic];
} forEach [blufor, opfor];

publicVar_clients_teamsLogic = server_clients_teamsLogics;
publicVariable "publicVar_clients_teamsLogic";


client_func_chatMessage = {
    params ["_message"];
    private _logic = publicVar_clients_teamsLogic getOrDefault [client_mySide, objNull];
    if (!isNull _logic) then {
        _logic globalChat _message;
    };
};
warm hedge
#

So... CuratorObjectEdited and such, are only for Curator modules, and not for an object right? Is there actually no way to detect such events only on an object (besides the obvious way)?

errant jay
#

anyone had success in implementing a bullet drop calculator into a scope?

i know ACE has framework for it, but looking to have a non ACE version as well

warm hedge
#

Theoretically yes. I know Ded ever shared the math to calc such, but I don't know it actually does work

errant jay
#

thanks, ill have a look at that

oblique current
#

`private _firedManEH =_unit addEventHandler ["FiredMan", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"];
//hint "shots fired";
_lanceTip = "LanceTip" createVehicle position player;

                if (_weapon == "Iron_Strider_Dragoon_Lance") then {
                    if (!_lanceActivated) then {
                        _lanceTip attachTo [_weapon, [0, 2.5, 0]];
                        _lanceActivated = true;
                    };
                    hint format ["lance tip is %1",  typeOf _lanceTip];
                    [_vehicle, _lanceTip] call Rider_LanceAttack2;

                };
            }];` when I run this script, `_lancetip` always returns as an empty object. I have the stated class declared in the config file. What am I missing please?
winter rose
#

which config file? mission config file cannot declare a class

oblique current
#

no the one for the model mod I'm working on

delicate cedar
#

Hi guys hope you are having a wonderful day. I have a question. Does anyone know if there is a way to save High Command groups to a database?

stable dune
# oblique current no the one for the model mod I'm working on

Does it return empty when you create that

private _pos = getPosATL player;
private _lanceTip = "LanceTip" createVehicle _pos;
systemChat format ["lanceTip: %1", _lanceTip];

Not in EH, just via debug.
If that does. You need to check that your config is done correctly.
You can always share your config ( #arma3_config )

oblique current
#

I haven't tried that. However, the model it'self is an empty p3d. The class inherits from a weapon (that works fine) in the config. I simply want to use the model as a position reference that's why it's empty. I'm not sure if that's why it returns empty in Arma too.

stable dune
oblique current
#

did the tests, all null

oblique current
opal zephyr
#

could you try having your empty object inherit from something other than a weapon?

oblique current
#

might work. I used the predefined "weapon_empty" and it works. I think I'll just work with this. Thanks

#

Thanks @stable dune for the input.

ornate whale
#

Is it possible that the Suppressed event handler is triggered in the opposite direction? I was standing 30-50 meters from the enemy, firing with a suppressor, but it still got triggered with the _distance parameter showing less than 5 meters. Is this a bug? (Dev Build)

lyric plover
#

It's literally just curatorMouseOver.

proven charm
#

good you figured it out. i thought you needed something more ๐Ÿ™‚

sullen trellis
#

does anyone know hold fire command triggers what kind of disableAI? is it "AUTOTARGET"?

#

or if i could find a code to check if a unit has "AUTOTARGET" disabled for example

hallow mortar
sullen trellis
warped hornet
#

Hello, what do people currently use to send HTTP requests? I have attempted to use: https://forums.bohemia.net/forums/topic/226687-http-requests-extension/ however im either using it wrong or its broken as the example is returning the page HTML rather than a json response.

south swan
#

HTML rather than a json
wat. Can you provide an example, please?

warped hornet
#

Using this example

little raptor
south swan
# warped hornet This is what is returned as _response

fun stuff. Doesn't work with http://headers.jsontest.com/ or locally hosted random JSON. Works with https://jsonplaceholder.typicode.com/posts, doesn't with https://jsonplaceholder.typicode.com/posts/1 (just like the report on the forum says). Seems to be broken blobdoggoshruggoogly

warped hornet
#

I figured it was but I wanted to make sure I wasnt being stupid. If anyone knows of alternatives that work could you send it my way xoxo

dull cosmos
#

Hello, I would like to prevent players from joining a different slot from the one where they originally slotted by returning to lobby and reconnect (MP), thanks for hints/help

still forum
# warped hornet I figured it was but I wanted to make sure I wasnt being stupid. If anyone knows...

https://github.com/dedmen/DAA_Mod This is the HTTP extension I use
You can pull DLL's from here https://steamcommunity.com/sharedfiles/filedetails/?id=2622792308
Script would be

addMissionEventHandler ["ExtensionCallback", {
  params ["_name", "_function", "_data"];
  
  if (_function == "JsonTest") exitWith {
    // Here you have _data to use with the contents of the webpage.
    diag_log _data;
  };
}];
"daa" callExtension "callbackReady"; // Tell the extension that it can now send callbacks

"daa" callExtension ["get", ["JsonTest", "http://headers.jsontest.com"]]; // Starts a async request, the result will be given back via ExtensionCallback
"daa" callExtension ["post", ["PostTest", "http://headers.jsontest.com", "PostData"]]; // Starts a async request, the result will be given back via ExtensionCallback
still forum
#

oh lol I commented on that forum thread

warped hornet
#

You did, I was going to just DM you directly but I didnt want to impose

still forum
#

Ugh that extension on the forum isn't even open source, not good

#

I don't know if my build is battleye whitelisted, if not and you need it then I can do that

warped hornet
#

We dont run battleye on the server so I believe we should be fine?

spiral temple
#

I've got a quick question about #kick. In the Wiki it is stated that ID can be used. What ID is that actually? I want to kick players server-side before restart and I currently do a for for-loop with 300 iterations to kick them. I think it could be done more easier.

spiral temple
winter rose
#

I'll need confirmation then yep, can do

spiral temple
#

gimme a sec ๐Ÿ˜‰

#

Yep, it is the Steam ID

spiral temple
remote cobalt
#

Okay, I have a problem and I want to have your opinion on my solution.

I have an array of Vehicles. I don''t know how many vehicles it will be, but I want to have a "waitUntil" that waits until every Player is in the Vehicle.

My solution:
I can't solve this with count because I don't know a way to let the count go over every Vehicle so I write my own count:

waitUntil {
    sleep 0.25;
    _playerCount = 0;
    {
        {
            if (isPlayer _x) then {
                _playerCount = _playerCount + 1;
            };
        }forEach crew _x;
    }forEach vehicleArray;
    _playerCount == count(call BIS_fnc_listPlayers)
}; 

Is that valid? Can that work in MP? I can right now only test it with myself on the server and so far its working.

I was hoping anybody of you could throw a look at it and maybe you already have a better solution for that.

stable dune
#

You could just check until every player object parent is not null, so they are in the vehicle.

remote cobalt
stable dune
remote cobalt
# stable dune How many helicopters do you have? And players need to be in your specific helico...

How many Helicopters:

I don't know. Sometimes its two, sometimes four.

Specific Helicopters:
Well, if they are not in these Helicopters, the helicopters will fly to the AO without them.

And I just know Players.
"Oh we go to the helicopters?"
"Oh, I thought you were talking about the one Helicopter on the other side of the Map..."

So, yeah, somehow my experience tells me I should be specific that they are in the right Helicopters. Or, other vehicles, for all that matters ๐Ÿ˜„

little raptor
#

which means all alive/non-null players are in a vehicle (or you can be more specific and test if they're in your helicopters: _players findIf {alive _x && !(vehicle _x in myHelicopters)})

remote cobalt
meager mist
#

Mornin' I got a question that I've been trying to tackle but my lack of script knowledge is letting me down here ๐Ÿ˜ฆ Working on a script that does the following: Players will rescue 4 groups of 4 prisoners from a camp. Player steps into trigger 1, group 1 gets assigned to their group. As soon as they get < 15 of a helicopter, group boards the heli. Heli needs to take off and bring them back to base. But I cannot seem to get the proper way of getting them off the heli and into the compound. I see that they are getting the "Get out" waypoint, but as soon as they are in the helicopter.

params ["_prisoners"];

// Make the given group of prisoners follow the player and get into a nearby helicopter
while {true} do {
    {
        private _prisoner = _x;
        private _nearbyHelicopters = nearestObjects [player, ["Air"], 15]; // Find helicopters within 15 meters of the player

        if (count _nearbyHelicopters > 0) then {
            private _helicopter = _nearbyHelicopters select 0; // Select the nearest helicopter

             if (_prisoner distance _helicopter < 15) then { 
            // _prisoner doMove (position _helicopter); // Move the AI to the helicopter's position
            prisonGroup = createGroup civilian; // Create new group to not follow player 
            _prisoners join prisonGroup; // Join that group 
            prisonGroup setCombatBehaviour "CARELESS";

            // Add a small delay before getting into the helicopter
            sleep 1;

            // Get into the helicopter
            _prisoner assignAsCargo _helicopter;
            _prisoners allowGetIn true;
            _prisoners orderGetIn true;

            if (triggerActivated baseTrg) then { // Wait until trigger is activated. Should this be waitUntil? 
                   private _markerPos = getMarkerPos "wpMarker";
                    private _wp = prisonGroup addWaypoint [_markerPos, 0];
                    _wp setWaypointType "GETOUT";
                    _wp setWaypointCompletionRadius 10;
                    _wp setWaypointBehaviour "CARELESS"; 
                };
            }    
        };
    } forEach _prisoners;
    sleep 1; // Wait for 1 second before repeating the loop
};

On the triggers itself I have this set up:

[prisonersGroup1] execVM 'prisonerMovement.sqf';
prisonersGroup1 join player;
remote cobalt
#

action ["GetOut", _veh] can force them to leave the Helicopter

meager mist
#

I've tried a lot, but I haven't had it to work yet. I'll go back in and see if I maybe messed something up there.

remote cobalt
#

The thing is, with the "if", it checks right after they got into the helicopter, so the trigger will not be activated at that moment

#

So yeah, that definetly should be a waitUntil.

Question is, how is the Trigger defined. If the Helicopter is still in air, the AI will probably ignore it.

You can check if the helicopter is landed with this:


waitUntil {((velocity  transportVehicle select 2) > -0.2 &&    (getPosATL transportVehicle select 2) <  1) || !alive transportVehicle};

meager mist
remote cobalt
meager mist
#

Probably best to do it with this?

waitUntil {((velocity  transportVehicle select 2) > -0.2 && (triggerActivated baseTrg)   (getPosATL transportVehicle select 2) <  1) || !alive transportVehicle};
#

transportVehicle would be the variable of the helicopter?

remote cobalt
#

Let me be honest, I am not sure if all the Loop thingy you have written there is really gonna work. But as long as you tested it and only the helicopter get out is a problem, that should be fine.

#

๐Ÿ˜ฌ

meager mist
#

Yea, the AI gets into the heli fine with this. It's probably not the worlds best code written.. but I'm just a humble beginner :p

#

If I understand the waitUntil correctly, the script will go through the code.. gets to the waitUntil, if the criteria are met.. it goes onto the next line, if not it pauses until the criteria are met?

#

So nothing that is getting followed up needs to be within the waitUntil brackets

remote cobalt
#

Yes, it will repeat the code every calculcated frame and check the condition. Once the condition is met, it will go further

meager mist
#

Probably should add a sleep 1; then? Because it's not really needed to check every frame

remote cobalt
#

yeah, sure you can.

meager mist
#

I have to change the while {true} do to something else because now the AI gets out and straight back in, because it's running in that loop monkaMEGA

remote cobalt
#

Do you need the while anyways?

meager mist
#

I guess not? The script needs to check if there are any helicopters nearby. But can I just ditch the while and start off with if (count _nearbyHelicopters > 0) then {? With nearbyHelicopters defined at the top of the script outside of the if?

remote cobalt
#

Yeah, that should work

coarse sedge
#

Hey everyone, im trying to get this to work to start a dedicated server and it works fine except for it wont use the profile for custom difficulty it just keeps making a userfolder and then uses the settings from my player profile, Is someone able to please point out what im doing wrong thnk you ๐Ÿ™‚

@echo off
title Arma 3 Dedicated Server Starter
setlocal enabledelayedexpansion

REM Path to Arma 3 server executable
set serverPath=NWO_server_WIPx64.exe

REM Server startup parameters
set serverMods="@CBA_A3;mods\@CUP Terrains - Core;mods\@IFA3 RealPanzer;mods\@IFA3 AIO;mods\@Kazanka boat;mods\@LAMBS_Danger.fsm;mods\@Lingor-Dingor Island;mods\@PLP All in One;mods\@PLP Markers;mods\@Progress 2;mods\@WW2 Armored Cars [IFA3]"
set clientMods="mods\@Reduced Haze Mod v3.1"
set serverProfile=profiles
set profileName=NWO.Arma3Profile
set serverBasicConfig=profiles\NWObasic.cfg
set serverConfig=profiles\NWOserver.cfg
set battlEyePath=battleye
set ip=0.0.0.0  
set port=2302   
set serverDifficulty=CustomDifficulty  

set serverParams=-config="%serverConfig%" -cfg="%serverBasicConfig%" -profiles="%serverProfile%" -name="%profileName%" -filePatching -bepath="%battlEyePath%" -ip="%ip%" -port="%port%" -difficulty="%serverDifficulty%" -mod="%serverMods%"

REM Start the server
echo Starting Arma 3 server...
start "" /b "%serverPath%" %serverParams%

echo Arma 3 server started.

REM End script
pause


#

i just cant seem to get my headaround setting the difficulty for the server

warm hedge
coarse sedge
#

sorry

still forum
coarse sedge
#

yea i was just trying things to see if i could get this to work, thanks for the reply @still forum

bold comet
#

is there any way to get the real time (current system time) via scripts ? google search didn't give anything

#

some guy playing my mission is asking if it's possible to sync the ingame time with real time

candid sun
#

AFAIK you can only do that with an extension

#

only needs to be on the server

#

works nicely

#

think i just did setDate call compile ("real_date" callExtension "");

bold comet
#

ok

#

i guess i'll suggest him to look at your link

#

that's not something i can put in the main branch especially since 99% of the users use accelerated time

candid sun
#

should be an easy edit for him

bold comet
#

depending on his own skills :p I'm always surprised at what people manage to break and that's always funny when they expect me to fix it

#

people who confuse "merge" with "overwrite" for example

#

then "your mission doesn't work here's the error log" yeah sure :p

#

thanks anyways

jovial belfry
#

Hello I'm trying to make a simple script that sends a message to the discord when the toy connects to the server

It just throws me a formatting error

I'm new to scripting and would like to ask if you could take a look at this piece of code

private _webhookUrl = "https://discord.com/api/webhooks/";
private _playerName = name player;
private _message = format ["{\"content\": \"%1 has connected to the server.\"}", _playerName];

private _request = [
    _webhookUrl,
    "POST",
    _message,
    "application/json",
    false
] call BIS_fnc_httpRequest;

if (_request select 0) then {
    diag_log "Discord webhook message sent successfully.";
} else {
    diag_log "Failed to send Discord webhook message.";
};
jovial belfry
warm hedge
#

Worst

#

Nobody can rely on it especially if you're making SQF

#

As pinned

winter rose
#

glad it was actually an AI, otherwise I would have been insulting someone with my message ๐Ÿ˜…

jovial belfry
#

Hmm ok I try rewrite it with documentation

winter rose
#

there is no vanilla http comm system

warm hedge
#

Your goal is not achieable via SQF

winter rose
#

you would have to use an extension for that

jovial belfry
#

Well

#

where can I find documentation for this

remote cobalt
#

But I love how Chat GPT just makes up a BIS function.

#

Like: "Yeah, sure, thats easy. I just make up a function and every problem is solved."

winter rose
#
["make players spawn as deers"] call BIS_fnc_doWhatITellYou;
jovial belfry
warm hedge
#

First thing first: why you want to achieve it anyways

winter rose
warped hornet
delicate hedge
#

How can i get Game Logic module in Eden Editor using script? I wanna set there the Init field to store some values, or maybe is there better way to store values in eden?

warm hedge
#

Game Logic is not a hidden asset in Eden

junior moat
#

anyone know why im getting this error?

warm hedge
#

setVehiecleLock is not a valid command

junior moat
warm hedge
#

setVehiecleLock is not setVehicleLock

junior moat
#

oh im stupid, apologise ๐Ÿ˜…

still forum
#

Custom content type headers for post request aren't working currently, I'll fix that today though

delicate hedge
warm hedge
#

?

delicate hedge
# warm hedge ?

i want to get Game Logic module by its var name from script which executes right in eden (with debug console) and as you can see its undefined for some reason

warm hedge
#

I don't know what is UnitNamesStorage and even the context/where you exactly done the code

delicate hedge
winter rose
delicate hedge
winter rose
#

nearestObjects and such

delicate hedge
winter rose
#

ยฏ_(ใƒ„)_/ยฏ

south swan
#

i fail to understand what's the point of using objects for storage in 3DEN, tbh

#

or whatever is happening out there

#

as for programmatically interacting with entities in 3DEN in general, i suppose you can get them through all3DENEntities (either from _object array directly, or by setting an entity(ies) to a separate layer, getting a layer ID from all3DENEntities's _layers output and using it with get3DENLayerEntities). Variable name for a given 3DEN entity should be accessible as _edenEntity get3DENAttribute "Name" if i read the wiki correctly. blobdoggoshruggoogly

delicate hedge
fair drum
#

You must explain. You're like putting pickles on a peanut butter sandwich.

still forum
quiet wind
#

I'm having trouble with event handlers and the Explosion event. When placing down an explosive with a unit and touching it off the event isn't triggered. But when using zeus and placing an explosive charge and 'End Keying' it, it fires without issue. It sounds like a locality issue as I'm testing this on a dedicated server with HC but after executing the handler in different manners, still no luck. Does the explosive source have to share the same owner as the object with the event handler?

granite sky
#

Apparently that one fires where the explosion is local. I'm not sure what the locality is for placed explosives & touchoff.

#

You'd likely need to figure it out by trial and error. Arma is only 50% documented.

quiet wind
#

Gotcha, I had some success by globally executing the code for the handlers themselves in the debug console in-game. But when using remoteExec in scripting it doesn't work

granite sky
#

It's not clear from your description what case isn't working. Player unit places explosive, triggers it and is damaged by it? Explosion handler is installed on the player's machine and attached to the player's unit?

quiet wind
#

No I have the handler attached to an object to detect if it was hit by an explosion

#

Which I assume is local to the server

granite sky
#

You can't assume that sort of thing :P

quiet wind
#

True

#

So I found out through debug it was :D

granite sky
#

If you want to detect an explosion that could happen on any machine then you have to install the EH globally, anyway.

quiet wind
#

Which makes sense, but executing it globally via scripting doesn't seem to net any results

granite sky
#

Show the script.

quiet wind
#
bridgepart_4 addEventHandler ["Explosion",
    {
        params ["_vehicle","_damage","_source"];
        if (typeOf _source isEqualTo "GrenadeHand") then {
            continue;
        } else {
        _fixedLayerEntities = (getMissionLayerEntities "Fixed") select 0;
        _brokenLayerEntities = (getMissionLayerEntities "Broken") select 0;

        {
            deleteVehicle _x;
        } forEach _fixedLayerEntities;

        {
            _x hideObjectGlobal false;
        } forEach _brokenLayerEntities;
        }
    }
];

Probably a lot of mistakes in terms of scripting errors :D

sullen trellis
granite sky
#

That's not executing anything globally.

quiet wind
#

This is in a .sqf file which is being remoteExec'd from the init.sqf

granite sky
#

Show that.

quiet wind
#

[[], "bridgeEvent.sqf"] remoteExec ["execVM", 0];

granite sky
#

No JIP. Are you sure the client is connected when that's executed?

quiet wind
#

Yep, I restart the server and reload the mission every test so the mission wasn't JIP

opal zephyr
#

The client, not the mission

quiet wind
#

As in does the mission start before the client joins or after?

granite sky
#

Yes.

quiet wind
#

Mission starts after the client connects

granite sky
#

shrugs

quiet wind
#

I need to select it from the mission select anyway

granite sky
#

Stick a diag_log at the top of the bridgeEvent.sqf, check it's actually running on the client.

#

And that bridgepart_4 exists at the time and isn't null.

quiet wind
#

Yeah, the remoteExec is at the bottom of the init file which has a few other scripts running which isn't related. But the object is certainly initialised before the script is ran

granite sky
#

Exists on the client

#

Map objects are kinda odd.

opal zephyr
#

John's definitely right, you should print out all your variables and make sure they're valid and exist. We've all been certain something was valid or correct before just to be proven wrong by armas shenanigans

unkempt marsh
#

is there any way to get a log of an AIs actions in the 3den editor? one of my AI is just refusing to walk 20m straightup

opal zephyr
#

What do you mean by "actions"? Like its engine side orders?

unkempt marsh
#

yea the choices it's making. im not sure why it is but the AI waits the timeout of the move order and then goes onto it's next order, despite being 20m away

#

if it turns to face the waypoint but doesn't take a single step, theres gotta be an error somewhere. is there any debug or logs that can help me find it?

opal zephyr
#

Is it just open area? I cant think of any commands to get its engine side stuff

unkempt marsh
#

it's in an open field but i want it to go into a shack

opal zephyr
#

It sounds like it either cant pathfind to the location, or had other orders overwriting it

unkempt marsh
#

i can send a pic in dms (i assume i can't do it here)

#

is there anything that can cause an AI to expand the completion radius of a move command beyond what it normally is?

quiet wind
granite sky
#

In different logs, I hope :P

#

Unless you're remoteExec'ing the diag_logs, in which case you should print the clientOwner value as well.

quiet wind
#

Ah, it seems to be executing on the same machine

#

Got ID 14, 3 times

#

In my client RPT

opal zephyr
granite sky
#

I think init.sqf gets executed everywhere, so it'd make sense if it was running three times everywhere.

unkempt marsh
opal zephyr
#

So you cant tell it to go next to the shed then either?

unkempt marsh
#

i can tell it to go anywhere, but if the waypoint is too close to the shed, (even outside of it) then the AI just sits completely still

opal zephyr
#

Did you put the shed there or is it part of the map?

unkempt marsh
#

part of the map

opal zephyr
#

What is your ai synced to?

unkempt marsh
#

a task? it has a task on it

opal zephyr
#

It looks synced to another green object as well

#

Or grouped

unkempt marsh
#

thats itself, the AI is the group leader and the only one in the group

#

you can see it in the edit menu, only one in the group

opal zephyr
#

Ah, yes, weird angle

#

Are you familiar with sqf at all? Could you try moving it with that

unkempt marsh
#

im somewhat familiar, but i haven't ever had to move an AI with it

quiet wind
granite sky
opal zephyr
unkempt marsh
#

i completely emptied the shed, even through it had only the quarter furthest from the AI waypoint full, it managed to figure out how to phase through the wall to get inside. even with the door open. arma3

opal zephyr
#

Ai at its finest

granite sky
#

The phase logic is super unreliable. You can never make it do it when you want to.

opal zephyr
#

Im in the midst of writing a script that forces exact movement from the ai to enter buildings since they cant seem to on their own, so I know your pain Kaele

unkempt marsh
#

lets hope reforger doesn't suffer this miserable fate

opal zephyr
#

Your original question Kaele is likely better suited for #arma3_editor if you want to try your luck there as well

unkempt marsh
#

i found a workaround so that my mission doesn't rely on the AI being functional

lyric plover
#

Can I select only artillery units using commands like 'entities'?

#

Like: "_allCars = entities "Car";" but instead of "Car" it's something else, like "Artillery"?

still forum
#

Find the object in config viewer (in eden editor you can just right click on it), and look at its parents

glossy pike
#

im trying to get a arma 3 friendly fire detection script to work any ideas what im doing wrong (posting script in next message)

#

my init.sqf script


// Function to add the "Killed" event handler to a unit
_addKilledEventHandler = {
    params ["_unit"];
    if (!isPlayer _unit && side _unit == side player) then {
        _unit addEventHandler ["Killed", { _this execVM 'friendlyFireCheck.sqf'; }];
    };
};

// Add the event handler to all existing units on the player's side
{
    _addKilledEventHandler _x;
} forEach allUnits;

// Add the event handler to any newly created units on the player's side
addMissionEventHandler ["EntityCreated", {
    params ["_newUnit"];
    _addKilledEventHandler _newUnit;
}];```
#

my friendlyFireCheck.sqf script


params ["_unit", "_killer", "_weapon"];

// Initial debug message to confirm script execution
hint format ["friendlyFireCheck.sqf executed. Unit: %1, Killer: %2, Weapon: %3", name _unit, name _killer, _weapon];
diag_log format ["friendlyFireCheck.sqf executed. Unit: %1, Killer: %2, Weapon: %3", name _unit, name _killer, _weapon];

// Check if the killer is null
if (isNull _killer) then {
    hint "Killer is null";
    diag_log "Killer is null";
} else; {
    hint format ["Killer: %1, Side: %2", name _killer, side _killer];
    diag_log format ["Killer: %1, Side: %2", name _killer, side _killer];
};

// Check for friendly fire
if (!isNull _killer && side _unit == side _killer && _unit != _killer) then {
    // Friendly fire detected
    hint format ["%1 was killed by friendly fire from %2", name _unit, name _killer];
    diag_log format ["%1 was killed by friendly fire from %2", name _unit, name _killer];
    // Add your custom code here
} else; {
    hint "Not friendly fire or suicide";
    diag_log "Not friendly fire or suicide";
};
still forum
#

_addKilledEventHandler _x;
That's a syntax error, that can't even run

#

Seems like you wanted a call there

#

EntityCreated fires for all entities, not just units, you'll want to filter that for actual units

glossy pike
still forum
#

!wiki addEventHandler

glossy pike
#

ie change the code to a call and the entity filtering

still forum
#

aw no it doesn't work ๐Ÿ˜„

#

call command to call it
isKindOf "CAManBase" to check if unit is soldier

glossy pike
#

the wiki is so confusing

meager granite
#

Ask ChatGPT again, it will help you for sure hmmyes

lyric plover
lyric plover
glossy pike
lyric plover
#

And then work from there.

#

That's how I do it and I'm starting to make scripts of my own without even looking them up on the forums or wiki.

meager granite
#

Asking to correct ChatGPT code is like asking to write the code for you with extra steps

lyric plover
#

^ true

glossy pike
#

i already wrote a script that displays a drones current perspective to a monitor anywhere on the map

lyric plover
meager granite
#

ChatGPT is incapable of producing anything more complex than most basic thing and it mostly fails with that too. If you're new, it wont teach you much, if you're experienced it wont help you with anything even slightly complex.

lyric plover
#

which is a lot

#

especially for a beginner

glossy pike
#

its 21 lines so ye and its got 1 eventhandler so that helps and i got two lines from forums

meager granite
#

You should read the wiki as a beginner instead of hoping that it randomly shows you something or hallucinates non-existing command or syntax.

lyric plover
#

For the second part that is.

meager granite
#

Nevermind, good luck with ChatGPT

lyric plover
# meager granite Nevermind, good luck with ChatGPT

No I mean I agree that you shouldn't use it to write scripts for you. I'm just arguing for tolerating its use as a last case resort when you're out of ideas and out of things to search on the browsing engine, forums and wiki.

#

Or discord.

sharp grotto
#

There are some local AI models that you can train overtime, that works much better i heard (even for Arma) ๐Ÿ˜†

visual stump
#

Hi all
I'm wondering if there is a way in SQF to tell if the user is in normal or zoomed view (pressed num+ or hold right mouse) ?

meager granite
#

Check client's zoom level

#

You might want to add some exceptions for scopes and turrets that have zoom

#

cameraVew

heady storm
#

anyone know how to setup ai spawnpoint for a specific unit outside of opfor im using the islamic state army and keep getting error left right and center
its for a hvt and i need help with deactivating when you pick up the hvt and activating upon hitting a area triggee

visual stump
fair drum
heady storm
#

in the trigger on activation its [player, player, Opfor, [โ€œPSZ_ISA_RED_MEA_R_Riflemanโ€]] BIS_fnc_spawnEnemy;

#

i also been watching other tutorials and to someone who just started this last week give me migraines i had no luck either its a error and the unit i want to spawn doesnt or its just regulae csat enemys that spawn i havent even able to get to the dispawn portion of the mission im trying to create๐Ÿฅฒ๐Ÿฅฒ๐Ÿฅฒ

fair drum
#

well to call a function you have to use the keyword call or spawn. The wiki page states spawn:

#

notice the syntax

heady storm
#

yes i do hold 1 ๐Ÿซก

#

i will be back tomorrow either a happy man or a depressed kitten

fair drum
#

no time to try it?

heady storm
#

i give it a try right now

heady storm
#

no error code just doesnt spawn in anything atm

fair drum
heady storm
#

please keep in mind this is my first time making my own mission so dont make fun of me to hard lol plus idk how to screenshot from arma 3 sorry i think its f12 but idk

fair drum
heady storm
#

so its going to be a hostage mission where you enter the trigger area boom enemy pick up hvt boom enemy respawn no good

#

๐Ÿ˜‚

fair drum
#

so:

1.) players enter area
2.) players interact with the HVT, capturing him
3.) enemy reinforcements spawn

heady storm
#

so the enemy will spawn in as soon as you get to the โ€œcityโ€ once you find the hostage in one of the houses the enemy respawn will stop working

fair drum
#

oh okay. so first, you are using modded units, ignore the spawn AI module completely, it really only does vanilla. lets do this all by script

heady storm
#

sounds good

fair drum
#

i'll make a thread

remote cobalt
#

Hey folks, question about remoteExec:

Can I send a remote Exec only to Players that are in a specific vehicle?

something like:

remoteExec ["execmVM",_myVehicle];
#

Right now I am solving it like this:

_vehicleComms = [];
{
  if (_x in _helo) then {
    _vehicleComms pushback _x;
  }
}forEach allPlayers;

remoteExec ["execVM",_vehicleComms];
south swan
#

remoteExec ["OH_fnc_my", crew vehicle select {isPlayer _x}];

remote cobalt
#

Select is just such a useful function and I always forget about it.

south swan
#

well, in the end it's just a one-liner version of your own code ๐Ÿคฃ

remote cobalt
south swan
#

inb4 crew vehicle arrayIntersect allPlayers ends up even faster blobdoggoshruggoogly

remote cobalt
#

Thank you, you guys are awesome. This discord is really a joy.

lyric plover
#

Is the command 'hint' visible to all players or only the admin/curator in a server with a Zeus?

digital rover
lyric plover
digital rover
# lyric plover Wonderful, thank you.

That is what the little "local" image at the top of the page on the wiki means, if you're ever unsure hover over that and it'll tell you how it works.

lyric plover
digital rover
#

After a few seconds it disappears, like 10 maybe

lyric plover
fleet sand
lyric plover
#

Although it is wrapped in a spawn function.

#

So my concern is that it turns global.

digital rover
#

Objects often run code on every client when created, how exactly are you calling the code? Some ways will run on every client some won't

lyric plover
fleet sand
lyric plover
#

It's wrapped in a spawn function because of the sleep command which I use because the time for hint to disappear is too long for me.

digital rover
#

Isn't that a ZEN feature? ZEN lets you choose global/local

lyric plover
#

ZEN?

digital rover
#

Zeus enhanced. I don't remember vanilla Zeus having an init box but I could be wrong

lyric plover
#

Oh yeah I know that now. I'm making those scripts in eden editor and exporting them as compositions.

#

Then I run these on servers with Zeus scripts enabled.

#

I don't use ZEN for my scripts though.

fleet sand
digital rover
#

Ah right the init of the objects in the composition will be called on every client.

lyric plover
digital rover
#

So if you don't want that wrap it in if (local _object) then,

the object will be local to the Zeus that spawned it.

lyric plover
#

And for Zeus spawning it, it would be local?

#

Like this?

[this] spawn {

deleteVehicle (_this select 0);

if (local _this) then {
hint "Forward Observer set!";
sleep 5;
hintsilent "";
};

};
digital rover
#

Yes that does what you want, although keep in mind every client will try and delete the object so really that should be inside the if statement too

fleet sand
lyric plover
#

So like EU#02 and as such.

digital rover
#

Actually no, _this is an array so either do the select 0 again (or use params

lyric plover
digital rover
#

Arrays are just data structure, locality refers to objects

#

You need the check the object in the array (_array select 0)

lyric plover
digital rover
#

You're passing [this], which is a single element array containing your object

lyric plover
#

Yup that one I know.

fleet sand
digital rover
#

Perfect

lyric plover
lyric plover
#

Alright thanks, I'll keep that in mind.

lyric plover
#

Like for instance a mortar firing a 82mm 3 round barrages in a 10 player server would equal to 30 rounds?

fleet sand
# lyric plover Alright thanks, I'll keep that in mind.

Here is a good example of how this would be used:

private _avar = 10;
private _bvar = 20;

[_avar ,_bvar ] spawn {
    params ["_a","_b"];
    sleep 10; // wait for 10 seconds.
    systemChat format ["A + B = %1",_a + _b];
};

_avar and _bvar cant get in spawn scope becouse they are not global so you are refrencing those variables with new ones _a and _b

lyric plover
digital rover
lyric plover
fleet sand
lyric plover
digital rover
#

Some scripts which affect objects and ai only work when run by it's "owner". This could be the Zeus that created it, but the ownership of objects can change over time

lyric plover
digital rover
#

If you only want it to run once, yes.

lyric plover
#

Unless it's in a while loop then it runs in a loop but only for the local machine, right?

digital rover
#

There's nothing special about a while loop, same rules apply

lyric plover
#

Just making sure so that I don't blow up my code in a way lol

digital rover
#

Object init runs everywhere, including a while loop unless you check and do something to make sure it doesn't.

I often do either
if !(local _obj) exitWith {}:
Or
if !(isServer) exitWith {};

Then you know any code which comes after is only running once on a single machine

lyric plover
#

If I understand correctly, non-local machines will just ignore it (contents of the if statement) and leave on their own.

fleet sand
digital rover
#

Yep that'll do what you want.

But for example, if you have a while loop running on your Zeus and they disconnect, the loop will end and the NPC ownership will be transferred to the server, where the loop never ran

lyric plover
lyric plover
lyric plover
#

And then only server runs the code and nobody else, not even Zeus?

digital rover
#

Your check should be (ifserver), and you then use remoteExec with the "target" argument being the object, which sends the instruction to a specific client

lyric plover
#

Or do I use remoteExec with the 'targets' argument being 2 for the server?

digital rover
#

For example
If (isServer) then { [100, 100, 100] remoteExec ["setvelocity", _object]
The server will instruct whoever owns _object, to do the command meaning it doesn't matter who owns it.

lyric plover
#

Which according to the wiki is for the server?

fleet sand
# lyric plover And then only server runs the code and nobody else, not even Zeus?
"message" remoteExec ["hint", 2];                // sends a hint message  the order will only be executed on the server - is both dedicated and hosted server.
"message" remoteExec ["hint", 0];                // sends a hint message to everyone, server and clients
"message" remoteExec ["hint", -2];                // sends a hint message to everybody but the server (also not hosted server)
"message" remoteExec ["hint", myCar];            // sends a hint message where myCar is local
"message" remoteExec ["hint", -clientOwner];    // sends a hint message to everybody but the current machine
``` here is also for other stuff.
digital rover
#

2 will mean to always runs in the server yeah

lyric plover
digital rover
#

Locality is a bit of a mindfuck at first, but once you understand it it is intuitive lol

lyric plover
# digital rover 2 will mean to always runs in the server yeah

So what I learned from this is that if the script is only to be executed once, then I just need to check if it's running on the local machine with "if (local _obj) then { [...] };" and if it's in a loop, then it should be remotely executed on the server?

#

So that even if the guy who owns the object leaves, the server still executes it?

digital rover
#

Yeah, exactly.

lyric plover
#

Great, thanks!

digital rover
#

The reason in the first instance you don't need to mess with the server is obviously when the Zeus creates the object code is run immediately and once, which pretty much guarantees it will run

lyric plover
#

So the script just stops.

digital rover
#

Yep, so run it on the server and if the server stops you have bigger problems

lyric plover
#

Haha true that.

lyric plover
#

Though I got bored of it and switched to Arma.

digital rover
#

Also If you're doing loops you should also check if the object still exists as the condition...

#

So it doesn't run forever on an object that doesn't exist

lyric plover
digital rover
fleet sand
#

Here is a good example of moving the object up every second.

[this] spawn {
    params ["_obj"];

    if (local _obj) then {
        while {alive _obj} do {
            private _pos = getposASL _obj;
            private _offset = 5;
            _obj setPosASL [_pos#0, _pos#1,_pos#2 + _offset];
            sleep 1;
        };
    };
};
digital rover
#

That's a bad example because it only checks the owner once, which could change

fleet sand
digital rover
#

setPos actually has a global argument so just run it on the server, doesn't matter who owns it. But if you only run the script on who owns it when it is created, if they DC the script will end.

mint goblet
#

@bold comet got something similair too, but includes weather information too... Though it only right now gets information from the real Altis/Stratis location, adn might be a little more to setup since it uses arma2net... Havn't updated it either in a while

bold comet
#

good stuff

#

i keep my mission as vanilla as possible so extensions are a no-go, however that's good tools for the milsim groups who may want it

delicate hedge
#

i got my variable as string, but how can i work with it as with variable not a string? i need to convert string into variable

delicate hedge
proven charm
#

test in debug console

#

_string = "7"; _var = call compile _string; _var prints 7

delicate hedge
proven charm
#

so whats your string exactly?

hallow mortar
#

Use getVariable

digital rover
#

Or if you have the name of the variable and want to receive it do something like missionNameSpace getVariable "name"

sharp egret
#

hello i just start making of retexture mod config and i have problem now

#

File TKE_Eusan_uniform\addons\config.cpp, line 0: '.config': '.' encountered instead of '='

#

idk what this funny word mean

bold comet
#

interesting

#

that should work indeed

hallow mortar
#

It means something in your config.cpp is written wrong. The config parser tried to read it and got confused because there was a . where it expected to find a =. (Note: this doesn't necessarily mean that's actually the error - there could be a preceding error that misled it into that expectation, instead.)
Since this is a problem with your config, try #arma3_config .

sharp egret
bold comet
#

"ArmA 3 1.50: This command now returns the correct values on dedicated server"

#

well that's good to know

hushed void
#

Hey, was wondering if there is a solution to being able to choose to spawn on your squad or at base when you die in an MP mission

#

I can't seem to figure out a way to get them to both work

spring stone
#

MenuPosition

serene sentinel
#
private _ARifle = ("toLowerANSI getText (_x / 'cursor') in ['arifle'] && {getNumber (_x /'type') in [1]} && {getNumber (_x /'scope') == 2}" configClasses (configFile /"cfgWeapons")) apply {configName _x}; 
private _wic = weaponsitemscargo [cont1,true];
private _ARifleselect = _wic select....

Who can say how can I select array from weaponsitemscargo [cont1,true] which first index (rifle) matches _ARifle ?

fleet sand
little raptor
#
_wic select {_x#0 in _ARifle}
serene sentinel
lyric plover
#

@fleet sand @digital rover I want to thank you once again for your help as thanks to you guys I got to release my third script for Zeus: #production_releases message

#

I'd also love feedback on it.

south swan
#

on a side note: you can ```sqf
toString {toLowerANSI getText (_x / 'cursor') in ['arifle'] && ...} configClasses (...

hushed void
#

1 more question, is there a script that makes AI revive you with the BI/Endgame revive?

blissful current
#

Is there a way to let a JIP client know that trigger was activated already? Perhaps there is a way to globally broadcast if a trigger was activated already? My issue right now is that JIP players don't have access to an addAction tied to a trigger that was previously activated (before the JIP player joined.)

meager granite
#

Unless your activation is more complex

#

But you can just setVariable and getVariable from the trigger itself to track its state

blissful current
#

I will try this on the dedicated server and see what happens. Thanks!

blissful current
meager granite
#

You also need getVariable in condition

#

That checks this

#

!(thisTrigger getVariable ["noLongerWorks", false]) && ...your other conditions...

blissful current
#

Oh okay I see. I'll work on that now. Thanks!

blissful current
#

This is the trigger I'm trying to get working with JIP.

meager granite
#

I suck with triggers to be honest but this doesn't look right

#

What's the idea? Trigger adds addAction but at some point it no longer should?

#

What's that point?

blissful current
#

I read that initPlayerLocal.sqf is ran when a client connects to the server. So my idea would be to somehow have the server broadcast that the trigger was activated so that JIP player could have access to it.

hallow mortar
#

Use a server-only trigger that remoteExecs the addAction with JIP true

blissful current
candid sun
#

is it possible to create a dialog dynamically?

jade abyss
#

What do you mean?

blissful current
candid sun
#

like create a dialog where i can have mouse control, without having to write the classes in description.ext

bold comet
#

yep

#

at least you can create controls at runtime

#

you may want to have a blank dialog in your config files already

candid sun
#

or could i not just add the ctrls to a vanilla dialog rsc?

jade abyss
#

Ingame? MainMenu?

candid sun
#

in game

jade abyss
#

sure, possible

raw vapor
#

So getObjectTextures cursorObject; worked yesterday and now it just... doesn't. Any thoughts?

bold comet
#

you just needs the IDs for bohemia's stuff

candid sun
#

this ctrlcreate stuff is all new to me since last week, is confusing

jade abyss
#

Nah, not rly

warm hedge
#

cursorObject only works in game, not in Editor

bold comet
#

the most advanced stuff i've ever done is only a table building itself dynamically with clickable activeTexts

blissful current
#

Any idea why this works:
["scripts\intro.sqf"] remoteExec ["execVM"];
But this doesnt:
["scripts\intro.sqf"] remoteExec ["execVM, 0, true"];
The top code will execute the sqf but the bottom one wont.

bold comet
#

dunno if that helps or not, the code is on github if needed

warm hedge
#

"execVM, 0, true" this is invalid

blissful current
#

I'm trying to make this addAction that happens from a trigger appear for JIP players. So I decided to put it in a sqf and remote exec it with true so it works for JIP players

warm hedge
#
["scripts\intro.sqf"] remoteExec ["execVM, 0, true"];  // invalid way`
["scripts\intro.sqf"] remoteExec ["execVM", 0, true]; // is this what you mean```
blissful current
#

only one "?

warm hedge
#

One? No?

#

Look carefully

blissful current
#

omg...

#

wow thank you thak you thank you. ima try it right now. btw love the SS guide you made.

candid sun
#

yeah i'll have a look

#

it's easy enough if i've got an empty dialog already defined in description.ext, i just can't figure out how to do it properly without

bold comet
#

to my knowledge you can't do without that unless you use existing stuff from the game

#

createDialog only takes stuff from the description or ingame configs

jade abyss
#

???

#
disableSerialization; 
_Btn = findDisplay 46 displayCtrl 1000;
_Btn ctrlSetText "MyText";
_Btn buttonSetAction "hint 'MyTextHint'";
_Btn ctrlSetPosition [0.5, 0.5]; ```untested, just wrote quick
bold comet
#

doesn't seem to work (tested it)

#

curious about how mouse control would work with that

#

but no button shows up

jade abyss
#

_Btn ctrlCommit 2; try that in the end

#

Man, haven't made that stuff for a few month, may forgot something in it

bold comet
#

:D

#

still doesn't work indeed

#

that's interesting tho, if you manage to make it work i'd like to see

#

i'll need a custom action wheel and maybe that could help

#

cause as i understand it you're supposed to have mouse control and camera control with createDisplay

jade abyss
#

Why should i do it? I don't need it.

bold comet
#

fair enough

jade abyss
#

I used that stuff before for the Gear Menu, but thats a few months ago.

little raptor
candid sun
#

thanks, i'm a bit closer but i'm still pretty confused

little raptor
#

Also keep in mind that making direct changes to objects in editor (e.g. using setObjectTexture, setPosXXX, etc.) will not be saved to the scenario

#

You'd only be changing the temporary preview object

candid sun
#

none of this is documented well at all by BI

bold comet
#

just in case what's the big problem with having an empty dialog in your description ?

candid sun
#

there's no problem, i'm just writing a little camera script, got to the stage that i'd like to add buttons to it. would be nice to be able to use the script in a few different missions without having to copy all the classes too

bold comet
#

makes sense

#

well just in case you can put all your stuff in a separate hpp to include in your description, which would make porting easier

#

but still that wouldn't be a 100% script solution

candid sun
#

script would just be so much easier

#

like i can add new ctrls to something like RscMap, no problem

#

but there must be some kind of RscEmpty blank dialog or something which is better to use

meager mist
#

Hey, I'm trying to get a group of AI to get into a helicopter as cargo, it "somewhat" works.. but only the leader of the group gets in. What am I missing with this?

 _prisoner assignAsCargo _helicopter;
 _prisoners allowGetIn true;
 _prisoners orderGetIn true;
proven charm
#

whats _prisoner?

#

shouldnt it be ```sqf
{ _x assignAsCargo _helicopter; } foreach _prisoners;

meager mist
#

I'm not sure.. to new to scripting to answer that. If you say that's a better way then I'll believe you :p
_x is defined within the script though:

private _prisoner = _x;
#

_prisoners is a defined array of 4 AI's

proven charm
#

ok well try out the foreach script

meager mist
#

I guess it should be this because _x is already defined?

{ _prisoner assignAsCargo _helicopter; } foreach _prisoners;
proven charm
#

nope

warm hedge
#

forEach defines _x within itself. So _x instead of _prisoner

proven charm
#

need the _x there, even its defined before

meager mist
#

gotcha

#

Perfect! Thanks, that worked! So does assignAsCargo only assign it for the group leader and not everyone within that group?

proven charm
#

_x assignAsCargo assigns it for all in _prisoners

meager mist
#

I mean the way I had it. That only assigned it to 1 unit?

proven charm
#

yep

meager mist
#

And I forgot to define it for everyone in that group, therefor you need to specify the foreach

proven charm
#

foreach always goes thru an array

meager mist
#

Sometimes I still get bedazzled by the differences of unit, group, object etc in the wiki's :p

proven charm
#

array of units in this case ๐Ÿ™‚

meager mist
#

thanks o7

queen cargo
#

@candid sun create a ticket in the feedback tracker

#

(just searched and was surprised i did not yet ... bothers me too that there is no empty dialog class available)

candid sun
#

i don't have an account, or feel like i understand this shit enough to even explain the problem

queen cargo
#

ye ... for sure
be lazy somewhere else

candid sun
#

lol i'm not being lazy, i'm pleading ignorance

queen cargo
#

create an account

#

as scripter it is a frking must have ...

meager granite
#

There is no single command to get a vector from one object to another, right?

warm hedge
#

vectorDiff?

meager granite
#

You need to get positions first for it

warm hedge
#

Then no I guess. What is the need of one command?

meager granite
#

Was thinking if there is something like ENTITY getDir ENTITY but to get vector instead of azimuth ๐Ÿค”

meager granite
#

I guess calling few more commands a frame won't hurt that much

proven charm
#

is diag_codePerformance the same process that is run when you click the performance test button in debug console?

meager granite
#

It does BIS_fnc_codePerformance which is a wrapper to the scripting command with some pretty text window

proven charm
#

ok thx

fleet sand
#

Ok so i am using SQF-VM Language Server by X39 does anybody know how i can remove the error i get in description.ext i dont know why is that happeing. Picture here:

granite sky
#

Tell it that ext files are not its business, I guess.

fleet sand
#

Yea i tried that but i dont know how to exlude ext files.

#

I guess it says here:

Exclude files (or folders) from analysis
Every workspace will have a file available at <workspace>/.vscode/sqfvm-lsp/ls-ignore.txt allowing to exclude files (and folders) from analysis. The file will be auto-generated if it is not existing. Further details are available in that file.
But when i put this in ls-ignore.txt it dosent change anything:

.vscode
.github
.git
.hemtt
description.ext
raw vapor
warm hedge
#

That command is only referencing the selected object in Eden. Which means (basically) equivalent to cursorObject

raw vapor
#

though I suspect this is just a piece of a bigger script I should be--oh

#

ok

#

yeah

#
getObjectTextures _selected;```
#

I got it

#

that does what I want it to do now

#

Now if I could just get the output to automatically have numbers applied...

raw vapor
#

I wasn't able to get that to work but keep in mind I am incredibly novice with scripting and most of this is gibberish to me.

warm hedge
#

_vehicle there is the object

raw vapor
#

Okay let me try something then.

#

Copytoclipboard expects a string, not an array.

#
_r = [];
{_r pushBack [_forEachIndex,_x]} forEach getObjectTextures _selected;
copyToClipboard _r;```
warm hedge
#

Ah yes

raw vapor
#

oh hey it works now smilethonk

_r = [];
{_r pushBack [_forEachIndex,_x]} forEach getObjectTextures _selected;
copyToClipboard str _r;```
#

Output:
[[0,"a3\soft_f_beta\truck_01\data\truck_01_ext_01_co.paa"],[1,"a3\soft_f_beta\truck_01\data\truck_01_ext_02_co.paa"],[2,"a3\soft_f_gamma\truck_01\data\truck_01_mprimer_co.paa"]]

#

Cool.

#

That is pretty much exactly the way the long lost script used to work and this is more helpful because now I don't have to be sitting in the vehicle for it to work.

#

Thanks.

ornate whale
#

When during the init order is the JIP stack executed on a client machine?

granite sky
#

early

#

Not sure if it's strictly defined.

ornate whale
#

Before preinit?

granite sky
#

Typically prior to running initPlayerLocal though, IIRC

#

preinit CfgFunctions? I would expect that to be earlier.

ornate whale
#

Yes, I just want to be sure I am not re-assignint on the client.

granite sky
#

I'd like to be sure about many things but Arma is resistant to this desire.

ornate whale
#

One more question, is waypoint's onActivation stacked in JIP, probably not, right?

granite sky
#

God I hope not.

spiral temple
#

Is there a way to kill a script without scriptHandle? I found via diag_activeSQFScripts that a RHS script is going rogue (100 open threads at the same time) and I want to get rid of it.

granite sky
#

This is not necessarily rogue by Arma scripting standards :P

#

I don't think there is though. Should probably request diag_activeSQFScripts to include the script handle.

#

100 open spawns at the same time isn't bad as long as they're sleeping though.

spiral temple
granite sky
#

I would suggest that you figure that out by experimentation.

#

I think I did once but I forgot since :P

spiral temple
#

Welp, the one thing I figured out if the vehicle what produces it. But deleting the vehicle doesn't fix it as it seems. They keep running. So probably nothing I can do it seems

granite sky
#

Which script is it?

#

(and what vehicle?)

spiral temple
granite sky
#

Read the functions, see what it does. If you're making a mod then you can always fix it.

#

Would not be the first or even second RHS function that I had to kill :P

spiral temple
#

Hm, it is the fold animation for the ATGM launcher as it seems. It either adds or removes the weapon of the launcher when you fold or unfold it. That's basically it. Also it adds some stacked EH for adjusting the reloading time and removed it.. maybe something is stuck there.

#

Aha, it's waitUntil {_v animationPhase "mainTurret_fix" == _rotate};

granite sky
#

Isn't that supposed to stop when it's done?

spiral temple
#

Doesn't seem so

granite sky
#

Looks horrible anyway :P

spiral temple
#

I just gonna overwrite the function and add alive check into waituntil, if its dead then it just continues

spiral temple
ornate whale
#

Why doesnยดt this work _playerUnit moveInCargo heli;, when called from initPlayerLocal.sqf on mission start? But it works from console after start.

meager granite
#

Log stuff

#
diag_log ["_playerUnit", _playerUnit];
diag_log ["heli", heli];
#

also it could be locality, maybe player unit is still owner by server?

#

log that too

#

local _playerUnit

proven charm
#

locality could have something to do with it, if the mission is run on dedi server. if its editor-MP then it's not the issue

blissful current
#

This one is a little tricky to explain. Right now I have it all working minus this JIP issue. Let me explain.

What I want:

  1. Players can equip scuba gear via addAction. (working as intended)
  2. If scuba gear is equipped they can restore their loadout via addAction. (working as intended)
  3. If a player leaves (game crashes) and returns I want them to be able to pick up where they left off. Meaning if they had scuba gear on when they left then when they return the addAction should be to let them equip their loadout (not working as intended)

The problem:
If a๏ปฟ player leaves (game crashes) and returns while they had scuba gear on, when they return they are still wearing scuba which seems normal. However, the addAction available is "Equip SCUBA", which doesn't make sense because they already have scuba. I need the returning player to have "Equip๏ปฟ Loadout".

#

So I'm not sure exactly how to go about this but I think what I need is for a JIP client to somehow check which is the loadout that is currently selected for the player. Is it the scuba? Then allow loadout. Is it the loadout? then allow scuba. I'm still not understanding variable but maybe it could be done with those?

little raptor
#

You have to save the state of the client on the server (e.g. using a hashmap of [uid, state] pairs), and when someone connects, use playerConnected event to check if their previous state exists and if so send it to them

blissful current
#

is that the same as OnplayerConnected. I see that one in the wiki

ornate whale
# meager granite Log stuff
19:34:48 ["_playerUnit",pl2]
19:34:48 ["heli",heli]
19:34:48 ["local _playerUnit",true]

Looks OK to me. It works for the pl1 who is hosting the game. But not for the second player. And the problem occurs only when both are ready on mission start, when the pl2 joins while JIP, it works fine.
But if i place it in onPlayerRespawn.sqf, the moveInCargo command works.
Something is probably not fully initialized at that moment. But how I am supposed to solve this?

wary sandal
#

I'm selfhosting a server (via the game UI) to play with friends, however the view distance is always restricted to a very low number. Is there a way maybe in the server host settings or in the mission directly to unrestrict that and let players choose their view distance?

blissful current
wary sandal
fair drum
#

make sure that ACE isn't overriding it

#

make sure that basic.cfg in your server doesn't have a viewDistance parameter in it

wary sandal
fair drum
#

basically, server has to have unlimited view distance. view distance is always capped at whatever the server's setting is

wary sandal
#

yeah but where can i find that file, i don't have a dedicated arma server

wary sandal
fair drum
#

yes you do it in your mission init

proven charm
#

is there any way to optimize this code? ```sqf
// Create 2D vector
private _vec = [0,0] getPos [_this # 1, _this # 0];

_vec resize 2; // Get rid of Z

_vec

ornate whale
# meager granite Log stuff

So, I tried many things, and ended up using the Eden init field, which works, even though I do not like this solution. #arma3_scripting message

if (isServer or (local this)) then { 
 this setUnitTrait ["camouflageCoef", STMOD_cfg_camouflage];  
 this setUnitTrait ["audibleCoef", STMOD_cfg_audible]; 
 if (isNil "introEnded") then { 
  this moveInCargo [heli, 2]; 
  this moveInCargo [heli, 5]; 
 }; 
};
proven charm
fleet sand
fair drum
#

you can make your code above into one line and don't store variables

#

but you are already quite quick

#

so the gains are going to be in the single ns digits probably

proven charm
fleet sand
proven charm
fair drum
#

are you wanting to run this each frame or something? why does the minimal performance gain matter?

south swan
#

inb4 in-line select [0,2] instead of resize ๐Ÿคฃ

proven charm
south swan
#

but yeah, no much optimization can be done in 2-line logic ๐Ÿคทโ€โ™‚๏ธ

proven charm
fair drum
#

like i said, minimal gains lol

proven charm
#

yeah

#

in my tests i got one third faster code/execution ๐Ÿ™‚

fair drum
#

i was just doing

[50, 50] call { /* your stuff */ };
#

but remember, we have different machines

fleet sand
# proven charm yeah

Try this myb:

    params ["_pos","_angle","_distance"];
    private _vec = [_distance * sin _angle + _pos#0, _distance * cos _angle + _pos#1];
    _vec
proven charm
#

getPos way should be faster.....

ornate whale
#

Is there any way how to save player's loadout into a field when a player exits arsenal or inventory of specific supply crates?

fair drum
#

ace or vanilla

ornate whale
#

vanilla

#

I want to save the loadout they make on the base, then to give it to them back every time they spawn.

fair drum
#

for vanilla arsenal events

[missionNamespace, "arsenalClosed", {
    params ["_displayNull", "_toggleSpace"];

    // do something
}] call BIS_fnc_addScriptedEventHandler;
south swan
# proven charm getPos way should be faster.....
private _vec = [0,0] getPos [_x#1, _x#0];_vec resize 2;_vec - 17.3539 ms
_vec = [0,0] getPos [_x#1, _x#0] select [0,2] - 19.7817 ms
[_x#1 * sin (_x#0), _x#1 * cos (_x#0)] - 13.0895 ms
[sin (_x#0), cos (_x#0)] vectorMultiply _x#1 - 4.20257 ms```
while looping over the same 10001 element long array of random directions and distances ![blobdoggoshruggoogly](https://cdn.discordapp.com/emojis/748124048025714758.webp?size=128 "blobdoggoshruggoogly")
still forum
#

May your rotations be blessed by the fishlord

fair drum
fleet sand
south swan
#

private _vec = [0,0] getPos [_x#1, _x#0];_vec deleteAt 2;_vec - 17.4653 ms

fleet sand
#

oh yea nvm its 0 so it dosent matter yea you right

south swan
#

all are starting from the [0,0]

wary sandal
#

has anyone found a way to implement zeus to the dynamic recon combat/recon ops missions?

fleet sand
south swan
#

[0,0] getPos [_x#1, _x#0] deleteAt [0,1] - 9.5588 ms for some 2.18 magic

wary sandal
blissful current
#

Any ideas on how to make a time bomb that will explode a vehicle after 15 minutes?

#

Was thinking of using an addaction to set "set the bomb" which executes a sqf. with a timer which spawns an explosion. I dont know how to make the timer part mostly though.

opal zephyr
#

Otherwise, use sleep with a hint that pops up every second

proven charm
blissful current
#

Yeah I dont need any visuals on screen.

proven charm
#

?

blissful current
opal zephyr
#

Then what gencoder posted will work

proven charm
#

oh sorry XD

blissful current
#

So I dont see a way to tie that code to a object.

#

I found this on youtube but its not as satisfying because it just deletes the object tied to it. I like it when you get to see the destroyed model.
bomb="M_Mo_82mm_AT_LG" createVehicle (getPos IED); deletevehicle IED;

opal zephyr
#

you can remove the deleteVehicle portion

#

If you use an addAction, then it can pass the object that its attached to into the sqf, check the wiki for the addAction page

hallow mortar
# blissful current So I dont see a way to tie that code to a object.

The point of that piece of code is to do the timer. The timer mechanism doesn't have any connection to a particular object, it just waits until the timer period has elapsed and then allows the script to continue. You would place that in the script after the thing that starts the timer, and before the thing that causes the explosion - neither of those parts is included.

blissful current
#

Got it.

#

So addaction will call sqf with his code. and anything i type below the code gets executed after? do I have that right?

hallow mortar
blissful current
ornate whale
#

Why doesn't the breakOut command exit this scope if alarm = true? The scope is the body of a function defined in cfgfunctions.

scopeName "alarmScope";
isNil {
    if (alarm == true) then {
        breakOut "alarmScope";
    };
    alarm = true;
};
...
blissful current
#

playSound3D [getMissionPath "mySound.ogg", player]; // to play a mission directory sound
I got this off the wiki but it doesnt work. Do you see any errors?

fleet sand
#

Also isNil command is checking is your hole code expresion nil or not so dont use that if you dont need it.

ornate whale
fleet sand
fleet sand
ornate whale
fleet sand
ornate whale
ornate whale
fleet sand
ornate whale
#

But I used it previously with if statements successfully like this.

hallow mortar
# fleet sand IsNil isnt makeing stuff happend pre frame what you can do with isNil is change ...

isNil does actually ensure the code runs in a single frame (by using the unscheduled environment). Yes it's not per-frame as in every-frame, but that's not what they said.
Code being unscheduled means the game can't pause the script to allow the frame to end, so it is always in one frame. (The minefield is of course that if the code takes too long, it will extend the frame to make it fit, causing a freeze.)

granite sky
#

"Main" scopename doesn't exist within the spawn.

#

And "I am free" will typically be printed before the spawn runs, barring long code runs and a lot of luck.

hallow mortar
#

Expansion: spawn creates not only a separate scope but also a separate thread. It's no longer attached to the initial scope, and the initial scope won't wait for it to complete or break.

ornate whale
granite sky
#

hmm, works with call, doesn't work with isNil. Arma is fucked.

#

That's probably a bug.

ornate whale
#

It worked for me when used in while or if
While -isnil - break

#

But not spawn - isnil - break

#

And spawn - break worked too afaik

granite sky
#

What was your case where it worked with isNil?

#

because none of mine do.

ornate whale
#

When I placed isnil with breakout command, inside if or while block.

granite sky
#

link not relevant?

ornate whale
#

While { isnil { breakout "while"} }

Something like this in pseudocode

fair drum
#

is this all theory craft? or are you actually going to use it like this?

granite sky
#

There is a use case where we do a check-and-set to make sure there aren't two threads doing the same thing at the same time, and exit if so.

#

But the case I remember actually does this, which works anyway:

if (isNil {
    if (_originX getVariable ["A3A_JNA_ammunitionTransfer_busy",false]) then {
        nil;
    } else {
        _originX setVariable ["A3A_JNA_ammunitionTransfer_busy",true];
        0;
    };
}) exitWith {};

Something to look out for anyway. You can't break past the isNil scope.

lusty snow
#

Hey, just asking if anyone knows if there is like a modern rewrite of ArmA 3 Altis Life? Did not find any, but I am pretty sure there was one since I worked on one 1-2 years ago lmao

#

If not, I guess I'll do it again lol

fair drum
#

wouldn't know. never really hear talk about altis life here.

cedar cape
#

how do you get the path of a sound?

#

im trying to use some sounds from Project SFX and ive found them in the PBO file but i just cant find the file path

#

nvm i found it

meager mist
#

Got a question as to why a trigger activation is not working on dedicated server, local MP is fine.
As soon as a player gets into trigger area, AI is supposed to join the players group. But as mentioned, they don't when on DS.

[prisonersGroup1] execVM 'prisonerMovement.sqf';
prisonersGroup1 join player;

When I do the join line in debug on the DS it does work. Any ideas?

meager granite
#

There is no player on dedicated server

#

I'm bad with triggers but since you have activation by players, I think thisList will be an array with players that activated your trigger

#
prisonersGroup1 join (thisList select 0);
#

Should probably be this

#

Log it to see what thisList actually contains

meager mist
#

Shouldn't this copy whatever is in thisList? copyToClipboard str thisList; hmm

meager granite
#

Does this command even do anything on dedicated server?

#

Use diag_log for logging

#

or hintSilent str thisList if tested on local MP

thin fox
#

This will work on dedi aswell

meager mist
#

Confusing me :p

thin fox
#

It should work, I use it a lot in my dedi server, even if you use player. Yes, for the <<server>> "player" doesn't exist.

#

that's why you have to turn off the server only

meager mist
#

I'll give it a go, thanks

#

Seemed to do the trick! Thanks o7

meager granite
#

Trigger activations are global, make sure you don't execute commands to spawn something because you'll end up with spawned stuff by number of clients

meager mist
#

You mean that if I have 20 clients, it would spawn 20 instances of the script?

meager granite
#

Each client will run their own instance of the script, yes

meager mist
#

Is there a way to log how many scripts are running at the time?

meager granite
#

and if say script spawns a helicopter you'll have 20 helicopters

#

but that's only brief info

#

you need to design stuff with MP in mind

meager mist
meager mist
meager granite
#

Arma is singleplayer game first, each client runs their own "copy" of a trigger, does their own condition check and their own activation execution. That server checkbox only limits that to server client.

#

If you have it off, keep in mind that each client will run your activation script

meager mist
#

Even the people who do not step into the trigger area?

meager granite
#

I actually don't know how exactly "any player" activation works, I assume it works for remote players too?

#

I guess it should be remote players too

thin fox
meager granite
thin fox
meager granite
#

Check is local of course, so activation might not happen at the same time and not happen at all in case of lag

meager mist
#

yea, so in this case.. with unticked server it will only fire the script for that particular player. If I understand it correctly?

meager granite
#

No, it will fire it everywhere

thin fox
#

hmmm, try to put in the condition "player in thislist"

sharp grotto
#

I used this on a mp server

_trgspos = [8148.1,14199.3,0];
_trgs = createTrigger ["EmptyDetector", _trgspos, false];
_trgs setTriggerArea [750, 750, 0, false];
_trgs setTriggerActivation ["ANYPLAYER", "PRESENT", true];
_trgs setTriggerStatements
[
   "vehicle player in thisList",
   "
    if(ExilePlayerInSafezone)exitWith{};
    [""|> Entered Buffer Zone <|""] spawn ExileClient_gui_baguette_show;
    if((driver (vehicle player)) isEqualTo player) then {vehicle player setCruiseControl [0, false]};
   ",
   "
    if(ExilePlayerInSafezone)exitWith{};
    [""|> Left Buffer Zone <|""] spawn ExileClient_gui_baguette_show;
    if((driver (vehicle player)) isEqualTo player) then {vehicle player setCruiseControl [0, false]};
   "
];
thin fox
#

I use this kind of trigger to put and remove addAction or event handler for the player

meager granite
#

It will fire again later if another player enters it though

#

so your group will be added to different player's group

thin fox
#

so, if a trigger is unticked server only, each client will have a chance to run it once?

meager mist
#

Even if set to non-repeatable?

meager granite
#

Triggers are SP in a sense, each client runs their own, does condition checks on their owner, call their own activation, etc.

meager granite
thin fox
meager granite
#

once their condition is met (player being in thisList)

thin fox
#

this will do the trick

meager granite
#

Yeah you can delete the trigger on activation so whoever activates it first deletes it

#

deleteVehicle thisTrigger

thin fox
#

^^^

meager granite
#

Or set some flag

meager mist
#

Probably easiest to put that below the other 2 lines in the trigger onActivation right?

meager granite
#

Like

thisTrigger setVariable ["was_activated", true, true]

and condition:

player in thisList && !(thisTrigger getVariable ["was_activated", false])
#

first player activating a condition will set a flag to it so others will never have condition met anymore

#

BUT there is still a chance for more than 1 activation in case of lag

#

Say client 1 activates it and lags out, so their was_activated never reaches client 2 who also activated it

#

Same can happen with deleteVehicle thisTrigger actually

#

But that's an edge case

thin fox
#

or just make a variable

  • Init.sqf
    TAG_triggered = false;

Trigger Condition:
!TAG_triggered && player in thisList;

On activation:
TAG_triggered = true;

meager granite
#

Nuances like this are usually cause for missions breaking and stuff being unreliable in general in Arma

#

This is why server only flag is a good thing so server does important decision making

meager mist
meager granite
#

You can just delete the trigger if you don't want to activate it anymore later in game

#

But as I said there is a chance for it to still activate twice due to lag/latency

meager mist
thin fox
#

so, for a better performance is it preferable to delete it?

meager granite
#

Performance impact should be a drop in an ocean

thin fox
#

okay

meager mist
meager granite
#

Neither deletion like this nor scripted disable protects it from potential double activation due to lag

#

Server only checkbox will, but you'll need to redo activation so script runs on needed machine and not server

meager granite
#

Just keep in mind that triggers are local so there is a chance two players can activate it at once even if you delete it on first activation

thin fox
meager mist
#

Oh, I'd like that! I'm running a campaign now to rid Sahrani from drug-empire out of control about to take over the island scenario :p So a bunch of doorkicking and raiding druglabs.

meager granite
#

So if your trigger spawn a tank there is a slight chance it might spawn two

thin fox
meager mist
#

So this is how the 2 options should look like right?

meager granite
meager mist
thin fox
# meager mist That's very dope actually..

put this in the init.sqf

["ace_grenades_flashbangedAI", {
    params["_unit", "_strength", "_grenadePosASL"];
    _grenadePosASL = [_grenadePosASL select 0, _grenadePosASL select 1];
    sleep 1;
    if ((_unit distance2D _grenadePosASL < 10) && (_strength >= 0.6) && (side _unit == east)) then {
// if the distance of the grenade is less than 10 meters, the     strength of the flash is 0.6 or more and the unit that got flashed is in the east side: do what you want to do here.
    }
}] call CBA_fnc_addEventHandler;
#

I took the liberation code for making AI prisoners

meager mist
#

That simple huh? :p Did you think about adding a randomization to it? So that it's not a 100% guarantee that they give up?

thin fox
#

50/50

meager mist
#

That's what I was thinking too ๐Ÿ™‚

thin fox
# meager mist That's what I was thinking too ๐Ÿ™‚

init.sqf

prisonner_ai = compileFinal preprocessFileLineNumbers "prisonner_ai.sqf";

["ace_grenades_flashbangedAI", {
    params["_unit", "_strength", "_grenadePosASL"];
    _grenadePosASL = [_grenadePosASL select 0, _grenadePosASL select 1];
    sleep 1;
    if ((_unit distance2D _grenadePosASL < 10) && (_strength >= 0.6) && (side _unit == east)) then {
    if (selectRandom [true,false]) then {
        [_unit] remoteExec ["prisonner_ai", _unit]; // this will           run the prisonner script for that unit that got flashed
      }
    }
}] call CBA_fnc_addEventHandler;
#

this should work

#

have a nice op

meager mist
#

I'm gonna have a look at it! Thanks for sharing. I can definetely use this

sleek galleon
#

Hello everyone !

I'm having a lil' brain scratcher here, I'm trying to make a script for a Radio trigger to spawn in a supply drop, with the chinook spawning in a corner of the map with a crate slingloaded, and then create a "UNHOOK" WP on the player's position for the delivery. So far, the spawning with the crate works, but it doesn't seem to create any WP, any idea of what I'm doing wrong ?

_CH47F = createVehicle ["CUP_B_CH47F_USA", _spawnpos, [], 0, "FLY"]; 
_spawnpos set [2,200]; 
_CH47F setposatl _spawnpos; 
createVehicleCrew (_CH47F); 
_spawnpos set [2,150]; 
_cargo =  "B_CargoNet_01_ammo_F" createVehicle _spawnpos; 
_cargo setposatl _spawnpos; 
_CH47F setSlingLoad _cargo;
_CHF7F addWaypoint [getPosATL PlayerRto, -1];
_CH47F setWaypointType "UNHOOK";```
proven charm
sleek galleon
#

Okay, so you actually make another group for the wp

sleek galleon
#
_CH47F = createVehicle ["CUP_B_CH47F_USA", _spawnpos, [], 0, "FLY"]; 
_spawnpos set [2,200]; 
_CH47F setposatl _spawnpos; 
createVehicleCrew (_CH47F); 
_spawnpos set [2,150]; 
_cargo =  "B_CargoNet_01_ammo_F" createVehicle _spawnpos; 
_cargo setposatl _spawnpos; 
_CH47F setSlingLoad _cargo;
_wp = _CHF7F addWaypoint [getPosATL PlayerRto, -1]; 
_wp setWaypointType "UNHOOK";```

Here's what I did with your recommendation
proven charm
#

make sure PlayerRto is valid object, and you may need MOVE waypoint first idk

#

oh and you cant use _CHF7F with addWaypoint because its the heli object. you need group for that

sleek galleon
#

Wdym with valid object ? And with the group for the helo part ?

proven charm
#
_wp = (group (driver _CHF7F)) addWaypoint [getPosATL PlayerRto, -1]; 
_wp setWaypointType "UNHOOK";
sleek galleon
#

Oh yes ! Because it's not the helo that has the WP, it's the pilot

#

Fair, fair

proven charm
#

are _CH47F and _CHF7F supposed to be same object? typo perhaps?

sleek galleon
#

Yes, I noticed it a tad earlier, it was a typo

proven charm
#

ok

sleek galleon
#

Didn't do anything when I corrected it so it wasn't the issue

#

Aight, that fixed it, my Uber Eats knows my adress now

#

Tysm

meager mist
#

So.. finalizing my helicopter transport script.. but wanted to change the (triggerActivated baseTrg) to _helicopter inArea baseTrg .. but I can't seem to get it to work. Yet, when if I run a debug script to see if it works, it shows that I am in the area.. What am I missing? Neither _helicopter inArea baseTrg or player inArea baseTrg works.
Original:

waitUntil {sleep 1; ((triggerActivated baseTrg) &&  (getPosATL _helicopter select 2) <  1)};

Changed:

waitUntil {sleep 1; ((_helicopter inArea baseTrg) &&  (getPosATL _helicopter select 2) <  1)};
sleek galleon
#

Aight this is killing me.

_CH47F = createVehicle ["CUP_B_CH47F_USA", _spawnpos, [], 0, "FLY"]; 
_spawnpos set [2,200]; 
_CH47F setposatl _spawnpos; 
createVehicleCrew (_CH47F); 
_spawnpos set [2,150]; 
_cargo =  "B_CargoNet_01_ammo_F" createVehicle _spawnpos; 
_cargo setposatl _spawnpos; 
_CH47F setSlingLoad _cargo;
_wp = (group (driver _CH47F)) addWaypoint [getPosASL PlayerRto, -1];  
_wp setWaypointType "MOVE";
_wp1 = (group (driver _CH47F)) addWaypoint [getPosASL PlayerRto, -1];  
_wp1 setWaypointType "UNHOOK";``` 

This is the latest version of the script. I had to change ATL to ASL for the getpos, because for some reason ATL makes the WP spawn below the terrain.

The helo knows where to go but doesn't seem to be able to actually unhook, and I can't find any ressource as of why on the net.
It goes to the move WP, then seems to be trying to follow the unhook WP because it takes it about 5s to delete the Unhook WP

I tried to use Zeus to give it another drop cargo (unhook) WP in a flat open field to see if it was the buildings around, but it still does the same, like it's actually unable to unhook. 

I tried afterwards with a spawned Huron and a spawned cargo net (thru Zeus), it did pick up & dropped the crate with the Zeus-given waypoints...

What am I missing ?
stable dune
#

Set will set 200 your z, not +200

sleek galleon
#

Well, the Z value isn't the real issue, ASL works (since the value after is -1, I gathered from the wiki) but the issue is that the helicopter doesn't actually drop it's cargo

south swan
#

in my (limited) testing it doesn't drop its cargo. It unhooks its cargo as soon as it touches the ground ๐Ÿค”

#

it also spams d:\Bis\Source\Dev\Futura\lib\collisions.cpp(1733)(func: Landscape::GroundCollision) [AssertUSR] MainThread=24720 Group: Graphic Simulated vehicle doesn't have landContact level seemingly each frame while trying to unhook

#

https://community.bistudio.com/wiki/Waypoints#Drop_Cargo

In Arma 3, this waypoint lets AI helicopters drop off vehicles that their helicopter has already sling loaded. The behaviour seems to be very inconsistent, and the AI pilots seem almost completely incapable of picking up the cargo or dropping it off (They have a tendency to circle around a few times before dropping the object they are carrying).
think_turtle

sleek galleon
#

Well, here's where I am rn

_spawnpos = [8190.08,1.25457,200]; 
_CH47F = createVehicle ["B_Heli_Transport_03_unarmed_F", _spawnpos, [], 0, "FLY"]; 
_spawnpos set [2,200]; 
_CH47F setposatl _spawnpos; 
createVehicleCrew (_CH47F); 
_spawnpos set [2,150]; 
_cargo =  "B_CargoNet_01_ammo_F" createVehicle _spawnpos; 
_cargo setposatl _spawnpos; 
_CH47F setSlingLoad _cargo;
_wp = (group (driver _CH47F)) addWaypoint [getPosASL PlayerRto, -1];  
_wp setWaypointType "MOVE";
_CH47F setSlingLoad ObjNull;
south swan
#

well, it doesn't wait for heli to arrive

sleek galleon
#

I read somewhere on the wiki that with the SetSlingload you need to do another one with the ObjNull to actually make it drop

sleek galleon
stable dune
sleek galleon
south swan
sleek galleon
#

I was trying to do smth like "WaitUntil CurrentWaypoint = 2" (in my uneducated language, was trying to find a correct syntax)

#

Smth like

_ setWaypointStatements ["true", _CH47F setSlingLoad ObjNull ]; ?

thin fox
sleek galleon
#
_CH47F = createVehicle ["B_Heli_Transport_03_unarmed_F", _spawnpos, [], 0, "FLY"]; 
_spawnpos set [2,200]; 
_CH47F setposatl _spawnpos; 
createVehicleCrew (_CH47F); 
_spawnpos set [2,150]; 
_cargo =  "B_CargoNet_01_ammo_F" createVehicle _spawnpos; 
_cargo setposatl _spawnpos; 
_CH47F setSlingLoad _cargo;
_wp = (group (driver _CH47F)) addWaypoint [getPosASL PlayerRto, -1];  
_wp setWaypointType "MOVE";
_wp setWaypointStatements ["true", _CH47F setSlingLoad ObjNull ];```

Makes it drop the cargo at spawn again
south swan
#

_wp setWaypointStatements ["true", _CH47F setSlingLoad ObjNull ];

#

"execute _CH47F setSlingLoad ObjNull and pass whatever it returns as a second argument to setWaypointStatements"

sleek galleon
#

How do I see what it returns ? When I do local exec, nothing seems to be happening

south swan
#

doesn't matter

sleek galleon
#

Sorry if I'm slow, still a newbie

south swan
#

the problem is: you're executing it right now, instead of telling the game to execute it later blobdoggoshruggoogly

#

_wp setWaypointStatements ["true", "(vehicle this) setSlingLoad objNull"]; should work

sleek galleon
#

I see

#

I'll give it a go

#

That did work !

#

Thanks @south swan !

sleek galleon
#

Sorry if it's a lot, but it's by cooking that you become a cook ๐Ÿ˜†

_spawnpos set [2,150]; 
_cargo =  "B_CargoNet_01_ammo_F" createVehicle _spawnpos;
_cargo setposatl _spawnpos;
_cargo SetVehicleVarName "SupplyDrop";
clearItemCargo SupplyDrop;
_CH47F setSlingLoad _cargo;
---``` 

I'm trying to have the dropped crate emptied (and then add my own gear to it) before it's dropped, so I can determine the dropped supplies, but i'm probably missing something

Roughly, what I'm trying to do is : Once it's spawned, set it's variable name to "SupplyDrop", clear the items in "SupplyDrop", then (not done yet) add the items I want in the crate.

For now, it's not cleared
stable dune
sleek galleon
#

Do I keep the variable name ?

stable dune
sleek galleon
#

Alrighty-o !

stable dune
#

_cargo = "B_CargoNet_01_ammo_F" createVehicle _spawnpos; <--- here you define your box to _cargo, so it will clear cargo from it

sleek galleon
#

I see

#

Tbf I still have issues with understanding what's the difference between "_Something" and the variable name in the codes I see, like when to use which to define a particular object