#arma3_scripting
1 messages ยท Page 146 of 1
something like (allCurators # 0) addEventHandler .....
or with YourCuratorName instead of that
Oh that was really obvious now that I look at it from after you showed me that. Thank you.
I still can't get the information about the vehicle that I placed the composition upon, unfortunately.
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.
Although I can after I select it AFTER putting down the helipad.
so how does your code look like now ?
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.
and when do you run it? like where
Land_HelipadEmpty_F.
If this is the problem then it can be anything else I can place as Zeus.
@proven charm Excuse me what are you confused about? That's the technical term for the empty, invisible helipad. From the object init.
Did you mean to ask something else?
oh idk why you mention that...
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.
no problem, that info just isnt important
Alright, so can you help me?
i'll try, i asked where you run the code?
From the object init in the invisible helipad after I grab it from the compositions folder as a Zeus.
try init.sqf instead its much better place
I don't think that's possible because I want to run this composition in public Zeus lobbies.
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
sorry i dont understand what you are trying to do exactly. usually composition means a bunch of objects
Here I'm just using it to spawn a script.
Usually it's just me but sometimes there's a game moderator with permissions. So #0 and #1.
ok
I'm testing all of this in singleplayer btw rn.
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];
}];
};
Well, the problem is that I want to know what the entity-
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.
Although fyi the problem is that I want the script to basically force the vehicle to crashland if it's airborne and disable it if it's ground-based, so I need it to select the same entity I click on WITH the script from the menu.
Like a lightning strike module. You select it, then select a unit, and it dies.
Same here except instead of dying it gets downed.
hmm sounds tricky, i hope you get it sorted. maybe others who are better with zeus/curator in this chat can help you better
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.
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
2.18 is the next major update. The current stable branch version is 2.16.
oh fuck me
That's why the version indicator is orange.
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.
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
Texture layers? Do you mean getObjectTextures?
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.
_r = [];
{_r pushBack [_forEachIndex,_x]} forEach getObjectTextures _vehicle;
copyToClipboard _r```Not tested
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.
My code should count the array from 0
Is there any way in arma3 to work with files (create, update, remove) in missions folder from sqf scripts?
No native way
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...
Probably because you're running a LOT of spawns
ARRAY insert ARRAY doesn't return array it operated on ๐ก
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
just like most array-modifying commands do? pushBack(Unique)/set/deleteAt/deleteRange/resize/sort...
Yeah, really bad
GIB pushBackRet, resizeRet, deleteAtRet (deleteRet), setRet (setN @ https://feedback.bistudio.com/T178841)
Also appendRet, reverseRet, insertRet
inb4 pushBackChain and so on for chainable array commands ๐
yaay for even more naming conventions
crew _this apply {if(unitIsUAV _x) then {_x getVariable ["koth_uav_controlling_player", objNull]} else {_x}} select {alive _x}
```Improved
yaaay, SQF golf!
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
should work the same with the first snippet, though
There is unique flag in insert
ah, i've missed that
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
Is there any way to only display blufor and not the player's name?
Use other chat command(s)
But on the wiki it appears without any unit name
If this is what you mean probably the format has been changed over years
inb4 it's SP/MP difference

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;
};
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;
};
};
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)?
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
Theoretically yes. I know Ded ever shared the math to calc such, but I don't know it actually does work
Hi, Im making a firing table mod without ACE (so with the vanilla Arma 3 ballistic) using Mildots. Anyone knows how to calculate the ballistic on vanilla ? For example: initspeed=900; airFriction=-0.00085; Targets Range: 750 meters Question 1: Whats the equation to know the bullet drop in cm ? (i...
thanks, ill have a look at that
`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?
which config file? mission config file cannot declare a class
no the one for the model mod I'm working on
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?
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 )
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.
If that is a weapon.
You need to use a weapon holder.
See
https://community.bistudio.com/wiki/createVehicle
Example 9.
did the tests, all null
I have read this, didn't understand it as such. are the variable names for the "vehicles to create" not customizable? if that' the case, the _weaponHolder used in this samples could be anything. The actual model is weapon_empty. I don't want to hold the weapon, I just need a position reference.
could you try having your empty object inherit from something other than a weapon?
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.
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)
curatorMouseOver.
It's literally just curatorMouseOver.
good you figured it out. i thought you needed something more ๐
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
It's probably combat mode rather than disableAI: https://community.bistudio.com/wiki/setUnitCombatMode
yeah i checked with this, doesnt seem to be the case, i tried all of them to see if they are related got no luck
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.
Extension to make http requests, currently supporting: GET POST PATCH DELETE PUT First parameter is the mode. Second is the method. Third is the url. Fourth is the authorization, if no authorization needed just pass null Fifth is the request body, only used by POST, PATCH and PUT, if no body need...
HTML rather than a json
wat. Can you provide an example, please?
You probably did it wrong. It is set(Unit)CombatMode. For holding fire you should use "blue"
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 
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
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
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
Awesome thank you
oh lol I commented on that forum thread
You did, I was going to just DM you directly but I didnt want to impose
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
We dont run battleye on the server so I believe we should be fine?
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.
That's what I thought actually, maybe add that to the Wiki? Or adjust it to make the number start with 7656xx as most Steam IDs starting with these numbers
I'll need confirmation then yep, can do
now I can basically just do a foreach with allPlayers. Looks much better.
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.
You could just check until every player object parent is not null, so they are in the vehicle.
Yeah, but there may be more vehicles standing around and it needs to be foolproof as this will start the mission and lift off the Helicopters to the AO
How many helicopters do you have?
And players need to be in your specific helicopters?
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 ๐
A simpler solution:
_players = ...; // either fixed array or using allPlayers or...
waitUntil {
sleep 1;
_players findIf {alive _x && vehicle _x == _x} == -1
};
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)})
Ah, that is awesome, thank you.
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;
Yeah, the "if" should be a waitUntil as you already commented it
action ["GetOut", _veh] can force them to leave the Helicopter
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.
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};
But even on a crash-land or a in-between stop that would make the AI get out no?
Thats true, but just add the triggerActivated condition to it
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?
Yes
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.
๐ฌ
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
Yes, it will repeat the code every calculcated frame and check the condition. Once the condition is met, it will go further
Correct
Its not an if
Probably should add a sleep 1; then? Because it's not really needed to check every frame
yeah, sure you can.
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 
Yeah, I thought that something like that might happen.
Do you need the while anyways?
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?
Yeah, that should work
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
#server_windows please, this is a channel for SQF scripting
sorry
I have tried using difficulty from profile and I've given up. I just put it as a mod (same kinda thing in mod config).
Also you set forcedDifficulty in server config, not as a start parameter
yea i was just trying things to see if i could get this to work, thanks for the reply @still forum
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
AFAIK you can only do that with an extension
i use killzone kid's http://killzonekid.com/arma-extension-real_date-dll/
only needs to be on the server
works nicely
think i just did setDate call compile ("real_date" callExtension "");
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
should be an easy edit for him
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
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.";
};
which ChatGPT-like kind of junk did this
https://community.bistudio.com/wiki/BIS_fnc_httpRequest does not exist.
Yep I was advised to chat gpt but I guess it wasn't the best idea
glad it was actually an AI, otherwise I would have been insulting someone with my message ๐
Hmm ok I try rewrite it with documentation
there is no vanilla http comm system
Your goal is not achieable via SQF
you would have to use an extension for that
Ok that means I need to make a extension
Well
where can I find documentation for this
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."
["make players spawn as deers"] call BIS_fnc_doWhatITellYou;
Small question is there simple way to make these like
Send request to web and webpage script send webhook
Or I must make a extension for these to send it anywhere
First thing first: why you want to achieve it anyways
if you want to do HTTP(S) comms, either use extensions or use Arma Reforger ๐
Im doing a similar thing at the moment, Dedmen is just sorting out a small change in his extention but then you should be able to use that
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?
Game Logic is not a hidden asset in Eden
anyone know why im getting this error?
setVehiecleLock is not a valid command
huh strange because its on the community wiki
https://community.bistudio.com/wiki/setVehicleLock
setVehiecleLock is not setVehicleLock
oh im stupid, apologise ๐
Coincidentally we talked about exactly such a extension right here yesterday
Custom content type headers for post request aren't working currently, I'll fix that today though
Yep, but:
?
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
I don't know what is UnitNamesStorage and even the context/where you exactly done the code
i have Game Logic module in eden editor scene, and in debug console i want to do some logic with that module in script, but i cant get it by its var name, why? I execute the script in editor, without launching the scenario
named entities are not named in Eden; they are once the game is started
well, how can i get it in other way?
nearestObjects and such
bruh
ยฏ_(ใ)_/ยฏ
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. 
its long to explain but i solved it)
You must explain. You're like putting pickles on a peanut butter sandwich.
All working now, and I added some examples in a readme https://github.com/dedmen/DAA_Mod
@jovial belfry
thanks
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?
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.
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
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?
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
You can't assume that sort of thing :P
If you want to detect an explosion that could happen on any machine then you have to install the EH globally, anyway.
Which makes sense, but executing it globally via scripting doesn't seem to net any results
Show the script.
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
Does anyone by some chance have jwcustom scripts? Im looking for his cool CAS script but armaholic is down apparently https://forums.bohemia.net/forums/topic/157575-close-air-support-field-system-v04b/
That's not executing anything globally.
This is in a .sqf file which is being remoteExec'd from the init.sqf
Show that.
[[], "bridgeEvent.sqf"] remoteExec ["execVM", 0];
No JIP. Are you sure the client is connected when that's executed?
Yep, I restart the server and reload the mission every test so the mission wasn't JIP
The client, not the mission
As in does the mission start before the client joins or after?
Yes.
Mission starts after the client connects
shrugs
I need to select it from the mission select anyway
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.
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
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
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
What do you mean by "actions"? Like its engine side orders?
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?
Is it just open area? I cant think of any commands to get its engine side stuff
it's in an open field but i want it to go into a shack
It sounds like it either cant pathfind to the location, or had other orders overwriting it
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?
I got 3 prints which I assume is for Me (The client), The server and the HC
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.
Ah, it seems to be executing on the same machine
Got ID 14, 3 times
In my client RPT
You can send it here, sorry was crossing a boarder and data turned off for a sec
I think init.sqf gets executed everywhere, so it'd make sense if it was running three times everywhere.
Ai refuses to go to this move order, for some reason being NEAR the shed prevents it. not just inside but nearby to it
So you cant tell it to go next to the shed then either?
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
Did you put the shed there or is it part of the map?
part of the map
What is your ai synced to?
a task? it has a task on it
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
Ah, yes, weird angle
Are you familiar with sqf at all? Could you try moving it with that
im somewhat familiar, but i haven't ever had to move an AI with it
Made a clause for if isServer then remoteExec a diag_log. Got a return so my best guess that it's executing on the server as well
This is in the normal range for Arma AI pathfinding.
The commands are pretty simple, look at doMove and similar. Maybe use enableExactMovement (named something like that) as well
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. 
Ai at its finest
The phase logic is super unreliable. You can never make it do it when you want to.
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
lets hope reforger doesn't suffer this miserable fate
Your original question Kaele is likely better suited for #arma3_editor if you want to try your luck there as well
i found a workaround so that my mission doesn't rely on the AI being functional
Can I select only artillery units using commands like 'entities'?
Like: "_allCars = entities "Car";" but instead of "Car" it's something else, like "Artillery"?
Find the object in config viewer (in eden editor you can just right click on it), and look at its parents
Thanks.
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";
};
_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
how would i do both of those things?
!wiki addEventHandler
ie change the code to a call and the entity filtering
aw no it doesn't work ๐
call command to call it
isKindOf "CAManBase" to check if unit is soldier
the wiki is so confusing
Ask ChatGPT again, it will help you for sure 
I mean it did help me with ideas on what to do, though completely relying on AI to code is a bad idea as presented above.
Like it showed me a new script command I didn't know about that was very useful.
didnt say i wrote it i said i was trying to get it to work on what it gave me and ive been trying to understand it for the past hour tried throwing myself into falty code and didnt work so ill go back to my working drone camera to monitor code
You should start coding something small instead.
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.
Asking to correct ChatGPT code is like asking to write the code for you with extra steps
^ true
i already wrote a script that displays a drones current perspective to a monitor anywhere on the map
do you understand it and did you write it from scratch?
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.
It can teach you about script commands and what they do
which is a lot
especially for a beginner
its 21 lines so ye and its got 1 eventhandler so that helps and i got two lines from forums
You should read the wiki as a beginner instead of hoping that it randomly shows you something or hallucinates non-existing command or syntax.
It's easy, you verify it by copy and pasting the command on google and checking if it appears on the wiki and/or forums.
For the second part that is.
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.
There are some local AI models that you can train overtime, that works much better i heard (even for Arma) ๐
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) ?
Check client's zoom level
You might want to add some exceptions for scopes and turrets that have zoom
cameraVew
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
Thanks a lot! didn't fully understand its logic yet, but it surely solves the issue. appreciated!
Sorry love the username. What have you written so far
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๐ฅฒ๐ฅฒ๐ฅฒ
well to call a function you have to use the keyword call or spawn. The wiki page states spawn:
notice the syntax
yes i do hold 1 ๐ซก
i will be back tomorrow either a happy man or a depressed kitten
no time to try it?
i give it a try right now
no error code just doesnt spawn in anything atm
what do you have, you never posted your "fix"
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
so you are using two different systems here. what is your end goal? explain everything in just human terms atm
so its going to be a hostage mission where you enter the trigger area boom enemy pick up hvt boom enemy respawn no good
๐
so:
1.) players enter area
2.) players interact with the HVT, capturing him
3.) enemy reinforcements spawn
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
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
sounds good
i'll make a thread
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];
remoteExec ["OH_fnc_my", crew vehicle select {isPlayer _x}];
Ah, crew and select. That is smart. Thank you man.
Select is just such a useful function and I always forget about it.
well, in the end it's just a one-liner version of your own code ๐คฃ
But will be much faster because it doesn't go over all Players and it doesn't need the pushback as an additional command.
And I like clean, fast and efficient code.
I just wish I could write it myself ๐
inb4 crew vehicle arrayIntersect allPlayers ends up even faster 
Is the command 'hint' visible to all players or only the admin/curator in a server with a Zeus?
It is a "local" command, so it will only be visible on the computer it is called, unless you specifically remotely execute it.
Wonderful, thank you.
Oh and when does it automatically disappear?
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.
Yeah but I'd rather double check with real people, I don't want to embarass myself or others while Zeusing.
After a few seconds it disappears, like 10 maybe
Thanks again.
It is local command but it also depends from where are you calling it. If you are calling it from InitPlayerLocal.sqf It would be localy executed to every player so everybody would see it localy on their machine.
I'm calling it from an object that Zeus places.
Although it is wrapped in a spawn function.
So my concern is that it turns global.
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
[this] spawn {
hint "Forward Observer set!";
deleteVehicle (_this select 0);
sleep 5;
hintsilent "";
};
I think he is calling it form the init of the object when you double click in zeus.
Bingo.
Also pasted the code if this matters.
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.
Isn't that a ZEN feature? ZEN lets you choose global/local
ZEN?
Zeus enhanced. I don't remember vanilla Zeus having an init box but I could be wrong
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.
I dont think ZEN lets you choose locality. Now i dont know object locality is the object that zeus placed down local to server or to the zeus that placed it down.
Ah right the init of the objects in the composition will be called on every client.
So the hint will be global? In this case, what's the alternative to make it only visible to the curator[s]?
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.
Okay, so for other players what would it print if I checked the _object type? That it's global?
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 "";
};
};
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
Oh alright thanks.
Also dont forget to enable zeusCompositionScripting in your Description.ext
https://community.bistudio.com/wiki/Description.ext#zeusCompositionScriptLevel
Thank you but I'm running these on public zeus servers.
So like EU#02 and as such.
Actually no, _this is an array so either do the select 0 again (or use params
It won't detect if the array is local?
Arrays are just data structure, locality refers to objects
You need the check the object in the array (_array select 0)
Yeah sorry, I used to code in Roblox and things are different there despite running on the same coding language.
You're passing [this], which is a single element array containing your object
Yup that one I know.
Something like this:
[this] spawn {
params ["_obj"];
if (local _obj) then {
deleteVehicle _obj;
hint "Forward Observer set!";
sleep 5;
hintsilent "";
};
};
Perfect
So _obj is basically the same as _this select 0?
Yea
Alright thanks, I'll keep that in mind.
Wait, so if I understand correctly, in a script like this in a spawn function if I add the command to make artillery open fire on a position, then it will fire the same amount of times as there is amount of players?
Like for instance a mortar firing a 82mm 3 round barrages in a 10 player server would equal to 30 rounds?
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
Yes, I understand that. Thank you. Can you answer my previous question too? It's very important to me and I want to know if I understand that as well.
Yes, each client would instruct the mortar to fire. But I think the mortar only listens to where it is local.
But you understand the concept and how it can go wrong. Once I had a guy create a script which attached lights to a vehicle... Using createVehicle in object init. Worked great for him on his own but when 30 players joined the server, 30 lights were created
Oh that's terrible, yeah I can see clearly the dangers of this.
Yes but its not because of the spawn its becouse of locality. Spawn switches Sceduels you can read more about here: https://community.bistudio.com/wiki/Scheduler
So the mortars, MLRS, etc. will ignore the command if it's not sent by the Zeus machine but other machines?
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
So basically just to be safe I should add a check in the beginning of spawn functions to see if the machine running it is the one that created the script in the first place?
If you only want it to run once, yes.
Unless it's in a while loop then it runs in a loop but only for the local machine, right?
There's nothing special about a while loop, same rules apply
Just making sure so that I don't blow up my code in a way lol
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
I made it like this "if (local _NPC) then { [...] };"
with the loop and all the functionality inside of this if statement.
If I understand correctly, non-local machines will just ignore it (contents of the if statement) and leave on their own.
Here is a good read about locality. https://community.bistudio.com/wiki/Multiplayer_Scripting
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
Oh that's true. So how would I make it so that it's not Zeus or the players that run it but the server itself?
Thanks, I'll read this, I didn't even know that the wiki had this page.
Do I just change my code to be like this? "if (isServer) then { [...] };"?
And then only server runs the code and nobody else, not even Zeus?
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
I see. So if I don't want the target to run on a specific client but the server, like for instance artillery firing, I can just do that without remoteExec?
Or do I use remoteExec with the 'targets' argument being 2 for the server?
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.
As an alternative can I replace _object with 2?
Which according to the wiki is for the server?
"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.
2 will mean to always runs in the server yeah
Awesome, thank you.
Locality is a bit of a mindfuck at first, but once you understand it it is intuitive lol
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?
Yeah, exactly.
Great, thanks!
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
Yup precisely. And in the second case is that when the Zeus leaves, the code stops because there is nobody left to execute it according to the script itself, which allows only the local machine to run it.
So the script just stops.
Yep, so run it on the server and if the server stops you have bigger problems
Haha true that.
Yeah I know something about locality, I made a game on Roblox before so it's not my first time playing with LUA.
Though I got bored of it and switched to Arma.
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
I think it does in my code but I just closed Arma so I can't say for sure. But I'll double check once I launch it.
And on the wiki, you can see which commands need to be local and which don't.
For example: https://community.bistudio.com/wiki/setVelocity
Local argument global effect means the object will only listen to the client that owns it, but every client will see the result
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;
};
};
};
That's a bad example because it only checks the owner once, which could change
So in while loop again each iteration check locality ?
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.
@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
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
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
_var = call compile _string;
i tried but got nothing for some reason
oh, i got it, so _var will have its value, not like the name of var, but i need some how get varname (i use it in arrays in other codes)
so whats your string exactly?
Use getVariable
Are you trying to convert a string to another data type? If so parse commands like parseNumber or parseSimpleArray do that
Or if you have the name of the variable and want to receive it do something like missionNameSpace getVariable "name"
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
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 .
thanks you i'm new to this so i will be need many help
"ArmA 3 1.50: This command now returns the correct values on dedicated server"
well that's good to know
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
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 ?
You just need first element from weaponsItemCargo Array ? if so you just do it like this:
private _wic = weaponsitemscargo [cont1,true] select 0;
_wic select {_x#0 in _ARifle}
Great, thanks. That's what I need.
@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.
on a side note: you can ```sqf
toString {toLowerANSI getText (_x / 'cursor') in ['arifle'] && ...} configClasses (...
1 more question, is there a script that makes AI revive you with the BI/Endgame revive?
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.)
if(isServer) then {thisTrigger setVariable ["noLongerWorks", true, true];}
```in activation
Unless your activation is more complex
But you can just setVariable and getVariable from the trigger itself to track its state
It's pretty simple. Just a blufor present.
I will try this on the dedicated server and see what happens. Thanks!
Unfortunately, it doesn't work. I have the addaction that's tied to trigger stored in my initplayer local. Could that be an issue?
You also need getVariable in condition
That checks this
!(thisTrigger getVariable ["noLongerWorks", false]) && ...your other conditions...
Oh okay I see. I'll work on that now. Thanks!
How does this look?
This is the trigger I'm trying to get working with JIP.
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?
Trigger adds addAction. The action is allowed to remain for the duration of the mission. Problem is that JIP players don't have access to the action.
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.
Use a server-only trigger that remoteExecs the addAction with JIP true
Ill try that now!
is it possible to create a dialog dynamically?
What do you mean?
Works perfect thank you!
like create a dialog where i can have mouse control, without having to write the classes in description.ext
yep
at least you can create controls at runtime
you may want to have a blank dialog in your config files already
or could i not just add the ctrls to a vanilla dialog rsc?
Ingame? MainMenu?
in game
sure, possible
So getObjectTextures cursorObject; worked yesterday and now it just... doesn't. Any thoughts?
you just needs the IDs for bohemia's stuff
this ctrlcreate stuff is all new to me since last week, is confusing
Nah, not rly
cursorObject only works in game, not in Editor
the most advanced stuff i've ever done is only a table building itself dynamically with clickable activeTexts
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.
dunno if that helps or not, the code is on github if needed
"execVM, 0, true" this is invalid
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
["scripts\intro.sqf"] remoteExec ["execVM, 0, true"]; // invalid way`
["scripts\intro.sqf"] remoteExec ["execVM", 0, true]; // is this what you mean```
only one "?
omg...
wow thank you thak you thank you. ima try it right now. btw love the SS guide you made.
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
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
???
disableSerialization;
_Btn = findDisplay 46 displayCtrl 1000;
_Btn ctrlSetText "MyText";
_Btn buttonSetAction "hint 'MyTextHint'";
_Btn ctrlSetPosition [0.5, 0.5]; ```untested, just wrote quick
doesn't seem to work (tested it)
curious about how mouse control would work with that
but no button shows up
_Btn ctrlCommit 2; try that in the end
Man, haven't made that stuff for a few month, may forgot something in it
: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
Why should i do it? I don't need it.
fair enough
I used that stuff before for the Gear Menu, but thats a few months ago.
In editor you can click on an object and use this to get the selected object:
(get3denSelected "object"#0)
thanks, i'm a bit closer but i'm still pretty confused
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
none of this is documented well at all by BI
just in case what's the big problem with having an empty dialog in your description ?
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
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
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
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;
whats _prisoner?
shouldnt it be ```sqf
{ _x assignAsCargo _helicopter; } foreach _prisoners;
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
ok well try out the foreach script
I guess it should be this because _x is already defined?
{ _prisoner assignAsCargo _helicopter; } foreach _prisoners;
nope
forEach defines _x within itself. So _x instead of _prisoner
need the _x there, even its defined before
gotcha
Perfect! Thanks, that worked! So does assignAsCargo only assign it for the group leader and not everyone within that group?
_x assignAsCargo assigns it for all in _prisoners
I mean the way I had it. That only assigned it to 1 unit?
yep
And I forgot to define it for everyone in that group, therefor you need to specify the foreach
foreach always goes thru an array
Sometimes I still get bedazzled by the differences of unit, group, object etc in the wiki's :p
array of units in this case ๐
thanks o7
@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)
i don't have an account, or feel like i understand this shit enough to even explain the problem
ye ... for sure
be lazy somewhere else
lol i'm not being lazy, i'm pleading ignorance
create an account
as scripter it is a frking must have ...
but that already moves too much to #offtopic_arma or #general_chat_arma
http://feedback.arma3.com/view.php?id=27008
0027008: No empty dialog class available per default for usage in combination with ctrlCreate etc. commands
There is no single command to get a vector from one object to another, right?
vectorDiff?
You need to get positions first for it
Then no I guess. What is the need of one command?
Was thinking if there is something like ENTITY getDir ENTITY but to get vector instead of azimuth ๐ค
My obsession with trying to have as less commands as possible, I guess
I guess calling few more commands a frame won't hurt that much
is diag_codePerformance the same process that is run when you click the performance test button in debug console?
It does BIS_fnc_codePerformance which is a wrapper to the scripting command with some pretty text window
ok thx
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:
Tell it that ext files are not its business, I guess.
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
That doesn't get me anything about the textures being applied.
That command is only referencing the selected object in Eden. Which means (basically) equivalent to cursorObject
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...
Didn't I told that already?
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.
_vehicle there is the object
Okay let me try something then.
Copytoclipboard expects a string, not an array.
_r = [];
{_r pushBack [_forEachIndex,_x]} forEach getObjectTextures _selected;
copyToClipboard _r;```
Ah yes
copyToClipboard str _r;
oh hey it works now 
_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.
When during the init order is the JIP stack executed on a client machine?
Before preinit?
Typically prior to running initPlayerLocal though, IIRC
preinit CfgFunctions? I would expect that to be earlier.
Yes, I just want to be sure I am not re-assignint on the client.
I'd like to be sure about many things but Arma is resistant to this desire.
One more question, is waypoint's onActivation stacked in JIP, probably not, right?
God I hope not.
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.
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.
Is sleeping the isRunning boolean?
I would suggest that you figure that out by experimentation.
I think I did once but I forgot since :P
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
rhs_fnc_brdm2_atgmSafe and the BRDM-2 (ATGM)
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
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};
Isn't that supposed to stop when it's done?
Doesn't seem so
Looks horrible anyway :P
I just gonna overwrite the function and add alive check into waituntil, if its dead then it just continues
Thx for help
Why doesnยดt this work _playerUnit moveInCargo heli;, when called from initPlayerLocal.sqf on mission start? But it works from console after start.
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
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
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:
- Players can equip scuba gear via addAction. (working as intended)
- If scuba gear is equipped they can restore their loadout via addAction. (working as intended)
- 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?
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
is that the same as OnplayerConnected. I see that one in the wiki
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?
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?
Have you tried the CH view distance mod?
i think i have, but i don't want to use mods for that
Via script
if (isServer) then {
setViewDistance -1;
setObjectViewDistance -1;
};
make sure that ACE isn't overriding it
make sure that basic.cfg in your server doesn't have a viewDistance parameter in it
I don't have a basic.cfg file
basically, server has to have unlimited view distance. view distance is always capped at whatever the server's setting is
yeah but where can i find that file, i don't have a dedicated arma server
i'll put that in init.sqf
yes you do it in your mission init
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
Myb VectorAdd
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];
};
};
i dont understand how that can create a vector?
something like this myb:
params ["_pos1","_pos2"];
private _vec = _pos1 vectorAdd _pos2;
_vec
im confused ;D
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
needed a variable for the resize command
With this code you can have 3d and 2d vector all depends are you putting in 2d pos or 3d pos values.
im trying to create the vector by just using Angle and Distance
are you wanting to run this each frame or something? why does the minimal performance gain matter?
inb4 in-line select [0,2] instead of resize ๐คฃ
using it a lot in loops and such so i thought maybe it pays off optimizing it
but yeah, no much optimization can be done in 2-line logic ๐คทโโ๏ธ
i was thinking that too but havent tested yet...
this is 0.0001 ms slower.
like i said, minimal gains lol
i was just doing
[50, 50] call { /* your stuff */ };
but remember, we have different machines
Try this myb:
params ["_pos","_angle","_distance"];
private _vec = [_distance * sin _angle + _pos#0, _distance * cos _angle + _pos#1];
_vec
thats like my original code that I began optimizing ๐
getPos way should be faster.....
Is there any way how to save player's loadout into a field when a player exits arsenal or inventory of specific supply crates?
ace or vanilla
vanilla
I want to save the loadout they make on the base, then to give it to them back every time they spawn.
for vanilla arsenal events
[missionNamespace, "arsenalClosed", {
params ["_displayNull", "_toggleSpace"];
// do something
}] call BIS_fnc_addScriptedEventHandler;
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 
May your rotations be blessed by the fishlord
I think in this line you are missing the position it should be
distance * sin angle + xposition, distance * cos angle + yposition right ?
[_x#1 * sin (_x#0), _x#1 * cos (_x#0)] - 13.0895 ms
private _vec = [0,0] getPos [_x#1, _x#0];_vec deleteAt 2;_vec - 17.4653 ms
oh yea nvm its 0 so it dosent matter yea you right
all are starting from the [0,0]
has anyone found a way to implement zeus to the dynamic recon combat/recon ops missions?
Just open scenario in Eden editor and place down the game master module done.
[0,0] getPos [_x#1, _x#0] deleteAt [0,1] - 9.5588 ms for some 2.18 magic
interesting stuff, thx
only works in the settings part of the mission
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.
If you dont need a visual timer then you can just use the sleep command
Otherwise, use sleep with a hint that pops up every second
bombTimerStart = time;
waituntil { sleep 1; (time - bombTimerStart) >= (60 * 15) };
// Kaboom!
Yeah I dont need any visuals on screen.
?
He was asking if I need a visual timer
Then what gencoder posted will work
oh sorry XD
Thanks let me try this!
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;
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
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.
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?
Be cautious using time because its value is different between machines. Ideally this code should run on the server only, for that reason and also to prevent the timer being cancelled if the client running it disconnects halfway through.
yes
Thank you were much! I got it working in editor and now to test on my server.
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;
};
...
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?
Dont do that.
Only stuff what sould be in cfgFunctions is this: https://community.bistudio.com/wiki/Arma_3:_Functions_Library
here in example 1 is a good example of how to exit scopes.
https://community.bistudio.com/wiki/breakOut
Also isNil command is checking is your hole code expresion nil or not so dont use that if you dont need it.
I need isNil to make it happen in a single frame. Also not sure what you mean by donยดt do that? Thx
IsNil isnt makeing stuff happend pre frame what you can do with isNil is change enviormente example:
0 spawn {
//sceduled Enviormente
isNil {
//unsceduled enviormente
};
};
That is the same as calling this from debug console:
call { hint str 123; };
What i meant dont put SQF code in CfgFunctions.hpp
That is exactly what I need, to make it unscheduled, but my problem is that it that it does not breakOut the scopeName.
If you need to exit just one scope you can just do this:
0 spawn {
//sceduled Enviormente
isNil {
//unsceduled enviormente
if(codition) exitWith {};
};
systemChat "Yay";
};
This will exit only the isNil block if I am not mistaken.
I need to break the whole function though.
Try this:
scopeName "Main";
0 spawn {
//sceduled Enviormente
scopeName "SE";
isNil {
//unsceduled enviormente
scopeName "UE";
if(codition) then { breakTo "Main";};
};
systemChat "Yay";
};
systemChat "I am free";
Thanks, it seems it is not possible to prevent the Yay from being executed no matter which scope I break.
But I used it previously with if statements successfully like this.
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.)
In that example, breakOut "SE" would skip the "yay".
"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.
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.
I tried it in debug console and it did not.๐คท
hmm, works with call, doesn't work with isNil. Arma is fucked.
That's probably a bug.
It worked for me when used in while or if
While -isnil - break
But not spawn - isnil - break
And spawn - break worked too afaik
When I placed isnil with breakout command, inside if or while block.
link not relevant?
While { isnil { breakout "while"} }
Something like this in pseudocode
is this all theory craft? or are you actually going to use it like this?
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.
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
wouldn't know. never really hear talk about altis life here.
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
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?
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
Shouldn't this copy whatever is in thisList? copyToClipboard str thisList; 
Does this command even do anything on dedicated server?
Use diag_log for logging
or hintSilent str thisList if tested on local MP
turn off the "server only" and it should work. In condition put "player in thisList".
This will work on dedi aswell
But as mentioned by Sa-Matra, player is not used on Dedi..
Confusing me :p
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
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
You mean that if I have 20 clients, it would spawn 20 instances of the script?
Each client will run their own instance of the script, yes
Is there a way to log how many scripts are running at the time?
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
Yea, that makes sense. The script i'm running basically a search for nearby helicopter, if AI is within 15m it forms it's own group and loads up in the heli.
I'm trying to keep it in mind.. with those things somewhat in mind.. but it's quite a challenge to be honest
especially being a freshie with this.
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
Even the people who do not step into the trigger area?
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
From what I tested on my dedi server, If the trigger is not server only and a player steps in the trigger, the trigger will activated for that player only (better if in the condition you put "player in thisList"). Of course, it depends on what are you trying to achieve. You shouldn't use a trigger like this to spawn stuff, it's better to use a "server only" trigger to do that and not repeatable
Checked, it triggers for any player
this trigger will only run on the player that is in the trigger, and will run it once for each client if the server only is off (correct me if i'm wrong)
Check is local of course, so activation might not happen at the same time and not happen at all in case of lag
yea, so in this case.. with unticked server it will only fire the script for that particular player. If I understand it correctly?
hmmm, try to put in the condition "player in thislist"
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]};
"
];
I use this kind of trigger to put and remove addAction or event handler for the player
Yeah, this will limit activation only if current client's player enters the trigger
It will fire again later if another player enters it though
so your group will be added to different player's group
so, if a trigger is unticked server only, each client will have a chance to run it once?
Yes
Even if set to non-repeatable?
Triggers are SP in a sense, each client runs their own, does condition checks on their owner, call their own activation, etc.
I think it will run once for each client in this case
use the a command to remove the trigger after you activated it
once their condition is met (player being in thisList)
this will do the trick
Yeah you can delete the trigger on activation so whoever activates it first deletes it
deleteVehicle thisTrigger
^^^
Or set some flag
Ah! That's a good shout!
Probably easiest to put that below the other 2 lines in the trigger onActivation right?
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
or just make a variable
- Init.sqf
TAG_triggered = false;
Trigger Condition:
!TAG_triggered && player in thisList;
On activation:
TAG_triggered = true;
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
I'm just a bit confused now about the deleting of the trigger. Your suggestion is permanently disabling the trigger and not deleting it ?
yes, the last line
Yes, its a scripted disable
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
No it shouldn't. It's pick up prisoners, fly out, and done.
so, for a better performance is it preferable to delete it?
Performance impact should be a drop in an ocean
okay
Yea, but with the tasking that the players will get it won't matter that much.. then player 2 will just escort the prisoners. Instead of player 1. And they will mostlikely be in the same squad anyway.
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
I guess you can just not care about it at the moment
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
talking about prisoners, yesterday I did a mission with my friends, I manage to pick some ace flashbang framework and manage to make the enemy surrender if you use a flashbang near them, if you want it I can share it
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.
So if your trigger spawn a tank there is a slight chance it might spawn two
So this is how the 2 options should look like right?
Yes, correct
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
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?
Yes, you can put like if (selectRandom [true,false]) then {};
50/50
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
I'm gonna have a look at it! Thanks for sharing. I can definetely use this
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";```
idk about rest of the script but you should create waypoints like this: ```sqf
_wp = _CHF7F addWaypoint [getPosATL PlayerRto, -1];
_wp setWaypointType "UNHOOK";
Okay, so you actually make another group for the wp
Same effect, the chinook spawns and lowers to the standard flight altitude then stays idle, do you think I could have messed up the GetPosATL part ? I did give the RTO for this mission the variable name of PlayerRto
_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
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
Wdym with valid object ? And with the group for the helo part ?
_wp = (group (driver _CHF7F)) addWaypoint [getPosATL PlayerRto, -1];
_wp setWaypointType "UNHOOK";
are _CH47F and _CHF7F supposed to be same object? typo perhaps?
Yes, I noticed it a tad earlier, it was a typo
ok
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
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)};
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 ?
If your z value (200) is below terrain
Use _spawnPos vectorAdd [0,0,200]
https://community.bistudio.com/wiki/vectorAdd
It will result
[x,y,+200] to your position.
Set will set 200 your z, not +200
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
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).
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;
well, it doesn't wait for heli to arrive
I read somewhere on the wiki that with the SetSlingload you need to do another one with the ObjNull to actually make it drop
Good eyes ! It's exactly where I am now ^^
Change to waypoint completed your setslingload objnull
How so ?
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 ]; ?
Isn't better to just use isTounchingGround?
_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
_wp setWaypointStatements ["true", _CH47F setSlingLoad ObjNull ];
"execute _CH47F setSlingLoad ObjNull and pass whatever it returns as a second argument to setWaypointStatements"
How do I see what it returns ? When I do local exec, nothing seems to be happening
doesn't matter
Sorry if I'm slow, still a newbie
the problem is: you're executing it right now, instead of telling the game to execute it later 
_wp setWaypointStatements ["true", "(vehicle this) setSlingLoad objNull"]; should work
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
you may need removeAll
and use Global, on MP it will remove stuff local
clearItemCargoGlobal _cargo;
clearMagazineCargoGlobal _cargo;
clearWeaponCargoGlobal _cargo;
Do I keep the variable name ?
No needed
Alrighty-o !
_cargo = "B_CargoNet_01_ammo_F" createVehicle _spawnpos; <--- here you define your box to _cargo, so it will clear cargo from it
