#arma3_scripting

1 messages · Page 628 of 1

little raptor
#

yeah do that

timid niche
#

Scripting wise I have done something like this:

_controls = _someArray;
_angle = 360/ count _controls;
_Xc = (0.473 * safezoneW + safezoneX);
_Yc = (0.469 * safezoneH + safezoneY);
{
  _x ctrlSetPosition [_Xc + 0.19 * cos (_angle), _Yc + 0.24 * sin (_angle)];

  _line = _display ctrlCreate ["RscPicture", -1];
  _line ctrlSetText "line.paa";
  _line ctrlSetPosition [0.3145 * safezoneW + safezoneX, 0.207 * safezoneH + safezoneY, 0.35 * safezoneW, 0.572 * safezoneH];
  _line ctrlCommit 0;

  _line ctrlSetAngle [_angle - (_step / 2), 0.5, 0.512];
} forEach _controls;
little raptor
#

syntax highlighting pls

timid niche
#

How i do that?

little raptor
#

see the pins

timid niche
#

aight

little raptor
#

@timid niche For lines, you can use "RscLine"

timid niche
#

Is that a thing

little raptor
#

yes

timid niche
#

ohh

little raptor
#

@timid niche For lines, w and h can also be negative
start is at [x,y]
end is at [x+w, y+h]

#

That pretty much solves your issue

timid niche
#

lines dont seem to be the real issue though

little raptor
#

what was it then?

jade abyss
#

@timid niche For lines, you can use "RscLine"
@little raptor "RscLine" ?!

timid niche
#

Think positioning wise

little raptor
#

@jade abyss You didn't know?!

jade abyss
#

Never seen it before oO

timid niche
#

Text on the 4 controls one is alligned, 5 controls is fairly off.

jade abyss
#

Thought about the 4:3 + Aspect Ratio?

timid niche
#

no, that I did not

jade abyss
#

Then, have fun there 😄

little raptor
#

Aspect ratio in arma is always 4:3 though isn't it?

#

nvm I got what you meant

jade abyss
#

4:3 is how the stuff gets calculated

#

e.g.
pixelGridStuff
w = 1
h = 0.75
= proper square

drifting sky
#

A2OA. Is it possible to get map objects (trees and bushes) that are intersecting an object (such as a building), and to remove or flatten them?

little raptor
#

@drifting sky yes.
one of your options is to find if the two areas collide. (might be difficult if you're not good at math)
your other (easier) option is to use lineIntersectsWith. Set the beginning pos at the land contact of the object. The end pos is a few meters up in the [0,0,1] direction (also, ignore this object). If it intersects with any building, use hideObject to "flatten" the object.

both methods are not 100% accurate

drifting sky
#

If I were to do the areas intersect method, I would need to obtain a list of nearby trees/bushes

little raptor
#

Yeah. The 2nd one is easier

drifting sky
#

is there a way to get a list of nearby trees?

little raptor
winter rose
#

maybe near(est)Objects

drifting sky
#

but what class to search for?

little raptor
#

no class

#

[]

drifting sky
#

I'd prefer to narrow the list to things which are trees and bushes

little raptor
#

Some trees do not have a class (or config)

drifting sky
#

so I guess I'll just have to try it a bunch to see what names are returned by nearobjects

#

I don't suppose there is a command to return the size of the bounding box around an object, or the radius from origin to farthest vertex.

winter rose
#

boundingBox(Real), then get the difference
or sizeOf

drifting sky
#

Alright, I think that's all the information I need. Presuming boundingBox works on tree and bush objects as well as buildings.

drifting sky
#

Is there a way to find a string in a string in arma2?

winter rose
#

toArray, but not easily

drifting sky
#

Ok, hideObject does not work on trees or bushes

#

however, setDamage does seem to work

#

Now, I cannot get a typeof for bushes or trees, it just returns ""

#

so What I'm doing is checking if the type is ""

warm hedge
#

hideObject should work with them

cold glacier
#

If you want something quick and dirty @drifting sky , try this:

private _collidingObjects = nearestTerrainObjects [
    _position,
    ["TREE", "SMALL TREE", "BUSH", "FENCE", "WALL", "ROCK", "ROCKS"],
    sizeOf _placedBuilding,
    false,
    true
];

{ _x hideObjectGlobal true } forEach _collidingObjects;
#

Downside is it uses sizeOf, which tends to bigger than the actual object.

#

So it's a little over zealous with its hiding, but you're unlikely to get collisions.

drifting sky
#

Thanks, but i'm in A2

hushed tendon
#

Hello, I’m looking to make some repeating and hopefully randomized 155m artillary strikes and after hours of searching I can’t find a way to make this work. Anyone able to help me out?

slim oyster
#

@drifting sky can you use CBA for arma 2? It has string functions

drifting sky
#

Didn't know that. I'll look into it.

leaden haven
#

This is how to create a artillery strike on a position. [[14642.2,16752.9,0],"Sh_155mm_AMOS",300,6400,10,nil, 32,4900, 150] spawn BIS_fnc_fireSupportVirtual;

#

This part of it is the position. [14642.2,16752.9,0]

proper sail
little raptor
#

@drifting sky Objects that do not have a type (or config) are not necessarily trees or bushes. Any simple terrain object may not have a type.

wispy cave
#

How does one remove an eventhandler added with addPublicVariableEventHandler?

winter rose
#

you can't, as explained on the wiki page

wispy cave
#

I shouldn't be coding less than half an hour of waking up, I can't seem to read properly then 😄

winter rose
#

my bad, it is actually not written there - will add soon\™

#

but also, "public variable" scripting is obsolete, you should do otherwise

#

@wispy cave ↑

wispy cave
#

I've got a holdaction that's sending doing a publicvarserver to tell the server that a mission has been completed, is there a better way?

astral dawn
#

yes, remoteExecCall

winter rose
#

updated the addPVEH page.

robust hollow
#

There is no way to remove this EH
you can overwrite the event to do nothing. not technically removing but effectively the same.

winter rose
#

does it replace the EH then? (then it should be named set and not add, but hey)

robust hollow
#

yea

winter rose
#

worth changing then

@wispy cave if you want to take the ugly shortcut ↑

wispy cave
#

I already made an uglier shortcut with a //todo to replace it by something better soon^tm

finite sail
#

ooooooo

#

ive often thought of requesting this because I'd use it a lot, but feared I'd get ostracised by those better than me

little raptor
#

@winter rose Also ⤴️

finite sail
#

did i request it, but was so drunk I forgot?

#

checks link

little raptor
#

It was mine

finite sail
#

lol good

#

were you sober?

little raptor
#

yeah 😒

finite sail
#

not the answer i have on my card tbh

#

but nevertheless, its going to get used bigtime

#

thank you

little raptor
#

thank Dedmen!

finite sail
#

do i have to? 😄

little raptor
#

No but he's the one who implemented it

finite sail
#

well...

#

thank you dedmen

winter rose
idle jungle
#

Hey guys wondering if anyone can point me in the right direction.

I'm making a training playground for my group and it will have multiple areas where we can do different training I.e. halo, firing range, shoothouse etc etc we also want to place a number of live fire mini missions down.

Is there a way to reset the AI that are patrolling and garrisoned at these mini missions so we don't have to restart the mission if others are doing something else? Like an addaction command like start and reset

winter rose
#

yes, you could list all the opfor units, grab their classname/direction/position, and on reset, delete all then recreate them

mortal wagon
#

anyone good at fixing a script wouls you lease dm me?

winter rose
#

nope to dm support, but you can post your script snippet here or on sqfbin.com

#

line 16, you didn't remove the last comma

mortal wagon
#

thanks

idle jungle
#

yes, you could list all the opfor units, grab their classname/direction/position, and on reset, delete all then recreate them
@winter rose

Do you know of any example code

winter rose
#

are you asking me to write it? 🙃

#
// _unitsList; ← define that

private _unitsData = _unitsList apply { [typeOf _x, getDir _x /* or vectorDirAndUp*/, getPosATL _x] };
```example to grab info
little raptor
#

wouls you lease dm me
What language is that?! 🙃

still forum
#

UwU

winter rose
#

c'm'ooon no bulli

little raptor
#

follow up to what Lou wrote:

private _unitsData = _allGroups apply {[units _x apply {[typeOf _x, getDir _x, getPosATL _x]},  side _x]};
{
  _x params ["_units", "_side"];
  _g = createGroup _side;
  {
     _x params ["_type", "_dir", "_pos"];
     _u = _g createUnit [_type, _pos, [], 0, "NONE"];
     _u setPosATL _pos;
     _u setDir _dir
  } forEach _units;
} forEach _unitsData;
#

you can include the vehicle of the unit too

gilded rover
#

whats the least resource intensive way to spawn a ungrouped soldiers? I have a working script using arrays and a temp array for random selection of spawn points, but isn't there another way to do this? the arrays are for variables assigned to game logics.

winter rose
#

if you want soldiers, createUnit
if you want agents, createAgent
?

#

@gilded rover ↑

cold mica
#

Is there something on the wiki explaining how to organize my mission scripts into separate files? Currently, I have everything into init.sqf but I want to move all of my scripts into seperate sqf files and "inherit" them from init.sqf instead.

winter rose
#

hmm not really

cold mica
#

I have been looking at other scripts and they sometimes say to include [] execVM others use [] spawn into the init.sqf to inherit the custom script into the mission. However, I do not know the difference between the two and I am not sure if there are more ways to inherit scripts into the mission.

winter rose
#

"inherit" is an improper term for this, but I get the idea.

if the code is to be used only once, you can use execVM (it will load the file from the disk, parse it then use it)

#

if the code is to be used many times, either make a function or spawn it

cold mica
#

So, from my understanding, there is:
execVM for single executions
call <fnc> for multiple executions, though it requires the function to be defined
spawn for multiple executions within its own thread
but then I have seen the #include used as well! What is the point of that argument? meowsweats
https://community.bistudio.com/wiki/PreProcessor_Commands#.23include

jade abyss
#

E.g. defining macros

#
#define DODIS(VARA,VARB) VARA-VARB

_math = DODIS(2,2); // = 0
#

very very simple example

winter rose
#

nothing!

jade abyss
#

😄

shadow sapphire
#

Okay, I'm still having trouble migrating units to headless clients. I've given up on spawning them with the headless clients, fuck all the remote exec stuff, I'll get to that later, I guess.

There is a group leader with variable name A11AA.

This is in a trigger:

Null = [A11AA, HC1] execvm "Functions\Headless\FN_Migrate.sqf";

This is in the mission file:

If (!isserver) exitwith {};
If (!ismultiplayer) exitwith {};
Waituntil {time > 2};

_unit = _this select 0;
_HC = _this select 1;

If (isnull _HC) exitwith {};

_HCid = owner _HC;
_unitgroup = group _unit;

_unitgroup setgroupowner _HCid;

I launch a dedicated server, I launch a headless client, the HC joins and loads up profile HC1, I join afterward, I fire my script, had some errors, but now now errors, but regardless, the group owner ID is always 0.

winter rose
#

only the server can set ownership iirc

shadow sapphire
#

That makes sense, but I thought that's who I was asking to set the group owner.

#

I'll look through my logic. Thanks!

winter rose
#

well, it seems correct actually

shadow sapphire
#

I never know why scripts work or don't. I just shuffle things around until I get what I want or give up, whichever happens first.

winter rose
#

first thing first, why do you think one server won't be enough for your system? HC coding is quite advanced

shadow sapphire
#

Nearly eight hundred combat AI, nearly eighty vehicles, nearly seventy players, over thirty control sectors, eight high commanders, civilian traffic and population, etc.

I just want the most seemless experience for what I'm asking Arma to do.

#

I don't understand why the headless clients have to be so advanced. I wish I could just put them on headless clients and be done, but nothing seems to work, and other people's AI scripts ruin the high command stuff I've got.

winter rose
shadow sapphire
#

I don't mind at all! When someone helps me, I try to give them as much as I can to ease that burden.

I did declare HCs in the server config. They are confirmed as joining the server and loading a profile, so I think that means I did it right.

I did read Monsoon's tutorial, but it's been a while (years ago, for a different project). I actually have it open this morning, though. It may have already been helpful.

I want to have a headless client spawn my AI, if it is practical.

My previous attempt was to define a function and try to have it remoteexec'd by the HC, but it kept firing on server, HC, and me.

winter rose
#

how was this function triggered?

shadow sapphire
#

Via a trigger in editor, for testing purposes.

winter rose
#

if the trigger is global, then… yes
why not use the init_HC.sqf example?

#

as a starting point

shadow sapphire
#

The trigger was editor placed, but server only checked, the trigger activation was;

RemoteExec ["ASG_FNC_GIP1"];

while the function was;

If (isServer or hasInterface) exitWith {};

_RP = (getmarkerpos "Origin");
_Vic1 = "I_E_Truck_02_F" createVehicle _RP;
Sleep 1;

[
    _Vic1,
    ["EAF",1], 
    true
] call BIS_fnc_initVehicle;

clearItemCargoGlobal _Vic1;
clearMagazineCargoGlobal _Vic1;
clearWeaponCargoGlobal _Vic1;
clearBackpackCargoGlobal _Vic1;

Sleep 1;

_LIS1 = [_RP, INDEPENDENT, [
    "B_G_Soldier_SL_F",
    "B_G_Soldier_TL_F","B_G_Soldier_F","B_G_Soldier_GL_F","B_G_Soldier_AR_F",
    "B_G_Soldier_TL_F","B_G_Soldier_F","B_G_Soldier_GL_F","B_G_Soldier_AR_F",
    "B_G_Soldier_TL_F","B_G_Soldier_LAT_F","B_G_Soldier_LAT2_F","B_G_Soldier_lite_F"],
    [],[],[],[],[],0] call BIS_fnc_spawnGroup;
_LIS1 setGroupIDGlobal ["A 1 1"]; //Hint groupID group cursorTarget;

_LIS1 addVehicle _Vic1;

    {
        {
            _equip = _x execvm "Functions\Gear\IFGear.sqf";
            waituntil {scriptDone _equip};
        } foreach units _x;
        GM hcsetgroup [_x,""];
    } foreach [_LIS1];

I'm about to try to use Monsoon's example right now. It looks like a good start.

winter rose
#

yep
what you are doing "hey, everyone on the network! run this"
then filter
you could remoteExec ["theFunction", theHC] to target HC's owner

shadow sapphire
#

OH! Beautiful! I'm going to try that right now.

Haha, it looks like the script I was attempting to use this morning (lifted from an old mission of mine, where it DID work) is straight from Monsoon's guide.

timid niche
#

Anyone able to answer me, whats best for performance?

  1. Setting a variable and then making it public.
  2. Setting a public missionNamespace variable.
#

Is there even a difference?

shadow sapphire
#

It's way out of my depth, but I can say that for whatever reason, I know that the developers in my old community, who were VERY good, tended to use missionNameSpace variables.

timid niche
#

So do I, but was looking into if its worth changing older scripts where it might be used to missionNamespace.

shadow sapphire
#

@winter rose, when using a trigger with

RemoteExec ["ASG_FNC_LIS", HC1];

to execute

If (isServer or hasInterface) exitWith {}; //Dediclient

_RP = (getmarkerpos "Origin");
_Vic1 = "I_E_Truck_02_F" createVehicle _RP;
Sleep 1;

[
    _Vic1,
    ["EAF",1], 
    true
] call BIS_fnc_initVehicle;

clearItemCargoGlobal _Vic1;
clearMagazineCargoGlobal _Vic1;
clearWeaponCargoGlobal _Vic1;
clearBackpackCargoGlobal _Vic1;

Sleep 1;

_LIS1 = [_RP, INDEPENDENT, [
    "B_G_Soldier_SL_F",
    "B_G_Soldier_TL_F","B_G_Soldier_F","B_G_Soldier_GL_F","B_G_Soldier_AR_F",
    "B_G_Soldier_TL_F","B_G_Soldier_F","B_G_Soldier_GL_F","B_G_Soldier_AR_F",
    "B_G_Soldier_TL_F","B_G_Soldier_LAT_F","B_G_Soldier_LAT2_F","B_G_Soldier_lite_F"],
    [],[],[],[],[],0] call BIS_fnc_spawnGroup;
_LIS1 setGroupIDGlobal ["A 1 1"]; //Hint groupID group cursorTarget;

_LIS1 addVehicle _Vic1;

{
    {
        _equip = _x execvm "Functions\Gear\IFGear.sqf";
        waituntil {scriptDone _equip};
    } foreach units _x;
    GM hcsetgroup [_x,""];
} foreach [_LIS1];

It's still running three times. What's more surprising is that ever single one of them is owned by the server, not one by the HC.

#

@timid niche, radical. I doubt it would be worth it, unless it's a major savings for relatively little work. Even if it IS faster, you'd have to have so many to change to make it noticeable, I'd think.

winter rose
#

@timid niche not worth changing, just best practice from now on yes

#

@shadow sapphire I simply believe there is another issue, other than that.
maybe your script gets called at other places

start from scratch an empty mission, just place the very basics, and practice

shadow sapphire
#

Will do.

old marsh
#

Hi,
I need some help with the dynamic group code, I would like to have people automatically be a part of a dynamic group when they join with a specific insignia.
I understand the private _data stuff being the image, name and weather it should be private or not, but what do I change so that when those people join the groups will be created?

if (isServer) then
{
   private _group = group player;
   private _leader = leader _group;
   private _data = [nil, "Awesome Group", false]; // [<Insignia>, <Group Name>, <Private>]

   ["RegisterGroup", [_group, _leader, _data]] call BIS_fnc_dynamicGroups;
};

note: I only need the leaders of the groups to be automatically added, the rest can just do it manually.

little raptor
#

I've read your question 5 times over and it makes no sense to me. Can you explain what you want in more detail?

old marsh
#

I want the server to automatically create a specific group when a specific player joins with a specific insignia.

frank ruin
#

Can you server side push an addaction to a vehicle?

shadow sapphire
#

@winter rose, I built a new mission from scratch. The remotely executed script is still running multiple times.

little raptor
#

yes, remote exec

old marsh
#

What do I change within that example that the wiki has, so that I can make that so?

little raptor
#

I want the server to automatically create a specific group when a specific player joins with a specific insignia.
Not that part. These parts:
what do I change so that when those people join the groups will be created?
note: I only need the leaders of the groups to be automatically added, the rest can just do it manually.

old marsh
#

The code I posted is the example that the wiki has, within it is private _group = group player; and private _leader = leader _group; I understand that I have to change something about those but I have no clue as to what I would need to change, what is group, what is player, and what is leader?

little raptor
#

I understand that I have to change something about those but I have no clue as to what I would need to change,
What you ask has nothing to do with that code.

winter rose
#

@shadow sapphire what is your code?

old marsh
#

Then what code would I need, because that seemed to be the one I needed

shadow sapphire
#

@winter rose I simplified it quite a bit. May I send you the whole (small) mission file?

winter rose
#

negative, on mobile rn ^^

shadow sapphire
#

Hokay. Wait one.

#
_RP = (getmarkerpos "Origin");

_LIS1 = [
    _RP, INDEPENDENT,[
        "B_G_Soldier_F"
    ],
    [],[],[],[],[],0
] call BIS_FNC_SpawnGroup;
#

Had to start Arma again. I was about to hang it up for the day.

winter rose
#

ah well, maybe you want to rest? it's no good working on something "hot brained"

shadow sapphire
#

This is the entire setup:

Scenario Setup:

Editor:
Trigger.
Radio Alpha.
RemoteExec ["ASG_FNC_LIS", HC1];

    HeadlessClient (HC1)

    Rifleman (Player)

Marker (Origin)

Scenario Folder:
Mission.sqm
Description.ext
EnableDebugConsole = 2;
SkipLobby = 1;
Class CfgFunctions {
#include “Functions\CfgFunctions.hpp”
};

class CfgRemoteExec {
class Functions {
class ASG_FNC_LIS {
allowedTargets = 0;
jip = 0;
};
};
};

Functions Folder
Headless Folder
FN_LIS.sqf
_RP = (getMarkerPos “Origin”);
_LIS1 = [_RP, INDEPENDENT, [
"B_G_Soldier_SL_F"],
[],[],[],[],[],0] call BIS_fnc_spawnGroup;

        CfgFunctions.hpp

class ASG
{
tag = "ASG";
class Headless
{
file = "Functions\Headless";
class LIS {};
};
};

I think.

#

If you have input, I can just put that to use tomorrow. If you don't feel like it, it's all good.

I do need to step away, though.

winter rose
#

Roger that
If you want, please dm me the zip so I can check that tomorrow

shadow sapphire
#

Thanks so much!

dusk gust
#

Does anyone happen to know if you can pull text from a hint, or if there is an IDC for it?

winter rose
#

hmm yes, see findDisplay's page maybe, there should be a list @dusk gust

dusk gust
#

I did a loop looking through all displays and all controls to each display while a hint was active and it still doesn't grab text. I found some supposed IDC's for the hints, but they always return "" even if I hint something specific.

#

Was curious if there was a special way to do it

winter rose
#

not that I specifically know - but if I may ask, why?

robust hollow
#

personally, ive never seen anything for getting text from a hint

dusk gust
#

Just to detect some things

robust hollow
#

assumed it was on the same level as chat (until the handlechatmessage event) where you cant access it after it is sent

dusk gust
#

That sounds about right

winter rose
dusk gust
#

Thank you

winter rose
#

now, to see if it works…

distant oyster
#

well the hint is not a display so findDisplay wont work

winter rose
#

findControl on 46 then?

distant oyster
winter rose
#

oooh, a ticket I can forcefully close 😋

dusk gust
#

Lmao

distant oyster
#

damn the hint display is part of RscInGameUI which is a very mysterious config

#

sadly it does not set a variable to the uiNamespace

#

hrngh i am trying to copy the config but it won't let me send

dusk gust
#

What's the path to it?

distant oyster
#

P:\a3\ui_f\config.cpp if you have the data unpacked

dusk gust
#

That'll work, thank you :)

distant oyster
#

config: configFile >> "RscIngameUI" >> "RscHint"

dusk gust
#

Lol

#

Thanks for the help. Unfortunately it's not possible as you stated above :/

distant oyster
finite sail
#

thats a nasty cough

gilded rover
#

if you want soldiers, createUnit
if you want agents, createAgent
?
@winter rose ```sqf
private["_arr","_randomElement","_tempArray"]; // private var
_arr = [g1_0,g1_1,g1_2,g1_3]; //virual entities used as place holders

_tempArray = [] + _arr;

for "_i" from 1 to 2 step 1 do // 1 to what ever number of soldiers you want to spawn provided it be smaller than the _arr size (number of elements , in this case 4 elements)
{
_group = createGroup east; //set group side
_randomElement = selectRandom
_tempArray ;
_tempArray set [_tempArray find
_randomElement ,objNull];
_tempArray = _tempArray - [objNull];
_unit = _group createUnit
["CUP_O_TK_INS_Soldier", _randomElement
, [], 0, "FORM"];
// in the " " the name of the unit is given (the coding name , hover over a unit in 3den editor and the name under the display name is what you use)
};```

I have this , was just wondering if there was a better way to go about spawning soldiers in random defined places

winter rose
#

scramble your array with BIS_fnc_arrayShuffle, then pick one then the other element
no need to selectRandom/find/replace/remove at all

cold mica
#

How could one use a custom .paa image on drawIcon for a mission?

robust hollow
#

with getMissionPath to get the full path to the image

#

(assuming the image is in the mission file)

cold mica
#

Understood, will return with results.

tiny wadi
#

I want to add an array of items to a container, could be 1-100000, and I want to check if all of those items can fit in the container, and only if everything can fit will they be put into the container. Problem is im not sure how I can do that because canAdd checks one item at a time and wont account for things that were previously checked but arent yet in the container.

hollow thistle
#

canAdd has alt syntax

#

object canAdd [item, count]

exotic flax
#

You can get the mass value of each item and compare the sum with the container size

hollow thistle
#

ah multiple item types. hm.

tiny wadi
#

Ah is that how storage is calculated for cargo? mass?

exotic flax
#

Yes, at least that seems to work for me

tiny wadi
#

Awesome, i'll give it a shot. Thanks

compact maple
#

I wish it was possible to use a rest api instead of the extdb3 system 😄

cunning crown
#

You could use something like the URL fetch extension, dunno how it handle json and whatnot but that can be a good start

compact maple
#

Yep I could, something native would be awesome tho

languid oyster
#

I mean, how can I change the color? From red to the default white for example

sharp spire
#

I'm getting an error when using the Clear mines way point, I have mines set on the ground through a module and the mines are OPFOR mines, they will approach the way point, and the error will pop up telling me something is wrong on line 37 of the https://community.bistudio.com/wiki/BIS_fnc_wpDemine script. I have explosive specialists, and engineers in the squad, as they approach they are mounted (They are a QRF), and I want them to approach (obviously the crew spots the mines from the APC) and disarm the mines, mind they may be ambushed part way through.

#

Since Im heading to bed if someone can answer this, please pm me the answer, so far this is the only issue I've run into in setting up what I've got so far.

velvet merlin
#

trying to parse URLs in SQF mad but struggling with cases where legal domain suffixes are part of the name itself. ie

  1. XXX**.irXXX.ir**
  2. XXX**.comXXX.com**

with splitString [:./] i have the issue of:

  1. two part suffix .co.uk
  2. to detect the right part of the splitString array return i can think of only a domain suffix check again (aka infinite recursion)
winter rose
#

first split with / , then split with .

#
  • starts with http:// or https://
  • remove first x characters (7 or 8)
  • split with /
  • first element: split the .
#

@velvet merlin ↑ ?

#

https://www.mywebsite.co.uk/all/the/rest?of=Url#path

velvet merlin
#

so to handle the standard case is simple, yet my system should handle all valid cases 😐

winter rose
#

well, technically, in a web.co.uk , co is the domain's name

#

you have to make one exception about the UK, that's it

#

if (website == "co") then { website = lastSubdomain };

little raptor
#

You could just strip all the symbols and read the words.
I'm not sure what you are trying to do, so maybe my answer is irrelevant

velvet merlin
#

parsing server names for website, discord, ts, etc

#

so gotta deal with very diverse definition types 🙂

winter rose
#

1/ if http or https, remove that
2/ split on /
3/ split on . the first element
4.1/ 1 element: take that one
4.2/ 2 elements: take these ones
4.3/ 3+ elements: take the last two
4.3.1/ if last two are co uk, take the one before
5/ parse the parts after the first /

#

this should cover all the cases @velvet merlin

#

also note that websites can have the same name but different extensions, so the only good identifier is name+extension (e.g whitehouse.gov vs whitehouse.com… for those who knew)

little raptor
#

1/ if http or https, remove that
2/ split on /
well:

_dirs = _string splitString "/";
if (toLower(_dirs#0) in ["https:", "http:", "ftp:"]) then {_dirs deleteAt 0};
_dirs joinString "/"
winter rose
#

@velvet merlin u good? 🙂

little raptor
#

I was the one who reacted! 😜

winter rose
#

I saw that, don't worry 😁 but he might be already running away, idk

velvet merlin
#

4.1/ 1 element: take that one
what should this reflect - can there be a domain without a dot?

need to leave for lunch, but i think yours dont cover these properly yet, do they?
XX.CO
TS.XX.CO
XX.CO.UK
TS.XX.CO.UK

little raptor
#

Isn't it possible to go in reverse:

_domains = ["co", "com",...,"us","uk",...];
_mainSite = _reveredSplit findIf {!(_x in _domains)};
winter rose
#

4.1/ https://localhost/ 😬 that's the only one I can think of.

mine covers all of these - it will just take the XX.co or XX.co.uk, nothing before the domain's name like ts or www

#

4.3.1/ if last two are co uk, take the one before
the only case where you want an exception I believe

velvet merlin
#

current combo prefixes:

".co.uk",
".co.za",
".com.au",
#

for the reverse i would need to know the end of the (main) domain - can be done with splitString "/"

winter rose
#

so far, you're good then?

exotic flax
#

inb4 IPv4 and IPv6 support 🤣

#

like; I can think of a bunch of other cases which are a pain to get...

  • different protocols (basically anything between 3 and 9 characters)
  • username@password
  • IP address (v4 and v6)
  • port

Even with regexes it's almost impossible to get all cases, and even there I have never seen a proper separation of subdomain/domain/tld because it's impossible...

still forum
#

quick poll. Who does search in big strings.
like find/in on big strings, and what do you do that for?
How big is the string you are searching for usually?

winter rose
#

regex support? blobcloseenjoy

robust hollow
#

I do a fair amount of searching in my function viewer for syntax highlighting. Usually only searching for a couple of chars or so to start/end a segment. I made it use an extension implementation by default because its faster though.

Also do a lot of string manipulation in my chat mod where the biggest searches are possibly 20/30 chars, maybe. I split messages into smaller segments though so maybe not what you’re asking for 🤷

winter rose
#

@cosmic lichen ↑ tool makers are most welcome to say something I believe! 🙂

cosmic lichen
#

In my functions viewer I have an option to search for specific key words. String size can vary from very short to long (See BIS_fnc_arsenal code)

still forum
#

regex unlikely. I looked into that already

#

@robust hollow what does your extension use for string searching?

#

Yeah R3vo that would probably a case that would benefit alot.
I implemented Boyer-Moore-Horspool (yes... Arma didn't have it yet...) and thinking if I should use it in SQF string searching

robust hollow
#

a lot of indexof iirc. it is a direct port of the sqf so there is nothing fancy going on.

still forum
#

indexof or find() ? c++ std::string has no indexof 🙃

winter rose
robust hollow
#

C# IndexOf, Contains and Substring. i really dont have any idea what im doing outside of sqf so its just whatever comes with .net 4.5.2

winter rose
#

Parallel.forEach

little raptor
#

@still forum I also do a lot of search for syntax highlighting in my mod.
And there's also a different type of search I use a lot (if you're interested in that too):
https://feedback.bistudio.com/T154274

still forum
#

basically "findAny" isnt it?

little raptor
#

yeah

still forum
#

thats a pretty specific usecase thing, not sure about that, we'll see i put it on my list

queen cargo
#

spawnForEach @winter rose is probably what you mean 🤪

#
{
  systemChat format ["this %1 idea serves no purpose but to clutter the scheduler", _x];
} spawnForEach ["fancy", "stupid", "ideas"]```
winter rose
#

this ideas idea? 😁

queen cargo
#

yes

winter rose
#

DayZ (SA) has its own Discord server, if you want

#

does createGroup creates the group on the machine that called it, or only the server?

shadow sapphire
#

@winter rose, how can I get a string to output as a number?

_HC = netID HC1;
_LIS1 setGroupOwner _HC;

Error type string, expected number.

tribal flower
#

@winter rose Solved the problem, thanks

winter rose
#

@shadow sapphire netId is not the command to use
owner is

shadow sapphire
#

Oh? HC1 owns itself? I guess that makes sense! Didn't think of it that way.

winter rose
#

well, yes
it's a "player" slot, and a player is local to its machine

#
_LIS1 setGroupOwner owner _HC;
shadow sapphire
#

Ah, makes sense. Well. Owner is still 0. I thought 0 was server, but the wiki says 0 is everyone. Am I understanding that appropriately?

winter rose
#

yes
in single player, it is always 0

delicate oasis
#

Ayo

shadow sapphire
#

Hmm... Well, I'm not in single player. But the server, my headless, and my actual client are all on the same machine.

#

Guess I need to upload the mission for testing. What a bother!!

delicate oasis
#

Oh god such a bother yes

hollow fable
#

some1 want to help me on scripting? am in kinda learning fase. (early one) if someone care to PM me if wish to learn me, please be my guest. Right now I am doing it on BI Forums but maybe being on discord could give me answer's a bit faster.. 🙂

shadow sapphire
#

What do you need done? I don't know of a better way than to generically learn scripting other than just copy tutorials on YouTube, but if you have a specific task, then you can get a more focused approach.

hollow fable
#

@shadow sapphire I have a mission to finish that prob. will take me ages since I am not really good at scripting at all. (this mission is gona be mostly done by scripts) So what I kinda need help on would be when to use what and maybe something what to do this guide.

#

But I want to learn scripting so I beleave I will succeed at the end. (hopfully) 🙂

shadow sapphire
#

Those guides are all on the wiki. As far as I know, learning to script is literally just learning to use the community wiki. The better you are at the wiki, the better you'll be at scripting. Even syntax, if it's not clicking, spend more time on the wiki, or look up a general programming tutorial.

hollow fable
#

thats the thing. I am kinda past this point.

#

I have just learned to use the wiki. 🙂

shadow sapphire
#

If you know how to use the wiki, and if you understand syntax, the next step is just specific questions, as far as I know.

hollow fable
#

But for now I am trying to get the understandings of it. Cuz as far I have read there by now. It is not much telling me why use that or when use it.
may be syntax I am still trying to learn maybe.

shadow sapphire
#

Sounds like syntax, yeah.

winter rose
hollow fable
#

SQF syntax wiki I found. Got right to the place I needed to be. Thank you! 😄
now a year more and I might complete the mission. 🥳

shadow sapphire
#

What is your mission concept?

shadow sapphire
#

Radical stuff.

hollow fable
#

prob. the hardest mission for a guy that barley know it. 😛

shadow sapphire
#

I've been there. Was honestly very close, due mostly to the work of others better than me, but feature creep and perfectionism eventually got over on us.

hollow fable
#

you mean that you couldnt deal with it anymore? was to much? (I am not english so just trying to understand correctly. 🙂 )

shadow sapphire
#

Not exactly that we couldn't deal with it anymore, but just got busy with life, and were no longer as interested.

hollow fable
#

xD... okay... well thats what I could be afraid for. But I beleave with effort I do wish to complete this I may succeed since I am a no-lifer (for now ofc.) have 1 week every 3 weeks with hollyday so I thought I could give it a shoot.

shadow sapphire
#

That's great! Good luck!

hollow fable
#

I just hope I will complete it before (if it comes) Arma 4. 😛

shadow sapphire
#

Roger that!

hollow fable
#

simple question. (I could only find a ESC script on Armaholic for this. But wonder if there is a easier way to this.
Make a trigger (var name: sec1) to be a sector. without the sector module synced to it. just by scripting.

shadow sapphire
#

I actually have a very similar question, so if someone has the answer, it'd be helping me as well.

winter rose
#

answer: yes

#

you can script everything, even without a trigger
just that… well, it's not using modules

shadow sapphire
#

What would be the advantage of the module over a scripted one, other than work?

hollow fable
#

I have heard that with more modules in a mission the more fps drop or more on the mission engine is being used. as for scripted one the less? (this might be since modules are in the mission.sqf . And that bigger the mission.sqf file gets. the more engine needs to focus on it and for that it gets slower maybe?. But more .sqf files the better is running. ? I might be way out of my league here. just a thought.

shadow sapphire
#

I have personally noticed that at least sector modules do SEEM to negatively impact the server, but I can't say for sure.

#

My goal for the scripted sectors is more about getting less HUD on the screen and so forth. I don't like lots of magic mission markers in my elite operator games, haha.

hollow fable
#

I have personally noticed that at least sector modules do SEEM to negatively impact the server, but I can't say for sure.
@shadow sapphire
This is why I want to learn scripting. because I do know how to use the modules... and one mission I made it was much fps drop on it and the other mission edit guys sayd that I had too much for the mission. We throw in HC as-well since they said HC help the server to run more smoothly. dont know if this is true doe.

shadow sapphire
#

Headless clients are very good at improving performance, but they are also pretty tough.

winter rose
#

What would be the advantage of the module over a scripted one, other than work?
the principle of modules is to have easy-to-use systems; but everything behind is scripting

so scripting is more flexible, while modules are easy to use

slim oyster
#

module is in mission.sqm but executes a module function that runs sqf like a file would. One advantage is that it has a different initialization order and you can set the priority

#

modules would be powerful if people made 3den controls for them and implemented them better, that's what I tried to do with my mod but making a whole integration with these modules is difficult. Most of the modules are ad hoc and lots of mod modules are simply ways to activate functions that could otherwise be activated via a cba setting

astral dawn
#

Modules are meant more for designers than for scripters. Also with module you get a free transform (position, scale, rotation) and a free logic object.

slim oyster
#

Yeah the trigger area style is great

#

Much better than getting markers as inputs

round scroll
#

is there a way to detect via sqf if a textureSource has been applied from VirtualGarage when spawning the vehicle? In Unsung we have these random texture selections scripts and now I would like to add some vehicle textures via virtual garage. But they fight each other. I guess only different subclasses are a way out, or is there some sqf magic to detect if a textureSource has been used?

exotic flax
#

Question; I'm currently working with extDB3 to retrieve data from a database, but for some reason I get empty results.

_return = [];
_check = 1;

_query = "extDB3" callExtension format["0:FETCHDATA:SELECT col1, col2, col3 FROM table WHERE 1 = %1", _check];
_result = parseSimpleArray (_query);

if (_result select 0 == 1) then {
   _return = _result select 1;
};

_return // should contain [val1, val2, val3]

The query is correct and gives the correct data when running directly on the DB, but the above script only returns an empty array.

Is there something weird happening with parseSimpleArray, or is there some setting I need to set to make this work?

robust hollow
#

what does the return set to _query look like?

exotic flax
#

Unfortunately do I not have access to the server to test that :/
Although we use the same query in some old code which uses ```sqf
_query = "extDB3" callExtension format["0:FETCHDATA:SELECT col1, col2, col3 FROM table WHERE 1 = %1", _check];
_result = _query splitString "[,]";

_value1 = call compile (_result select 1);

But for obvious reasons I try to make the code a bit more cleaner than this...
#

as far as I can tell is the result from the DB correct, but seems to break when parsing it

robust hollow
#

ehh, without the return it is hard to say for sure.

exotic flax
#

trust me I know, but since both scripts use the same DB and query, and one returns a value and the other not; the only difference is how to parse the result.
Which is my question about, unless there is some setting I need to set in the extDB3 settings to make it work correctly (although since there are no errors I doubt anything is technically wrong)

robust hollow
#

nah you should be able to make it work without changing any settings. what data type is _value1 in the second snippet?

exotic flax
#

a string

#

integers are being used directly without call compile
scratch that, the code also does that for all other return values

#

all values from the database (MariaDB) are either strings or integers, and all currently all handled the same way.

#

The only thing I can image is that the extension is not properly putting double quotes around the strings, which than break parseSimpleArray. Which I can't test on the server, but will need to test on my local server.

robust hollow
#

yea, without the query return i can only theorize possible solutions. how are you able to test it if you don't have access to the server?

exotic flax
#

Have the server admin setup the server with my mod, start the server, get in the server, test if it works, make changes, pack and upload to the workshop, and repeat...

#

although for testing the rest of the features I simply made a simple if/else statement which checks if the DB exists, and if not, use dummy data

inland valve
#

using a simple attach smoke to a plane but I need it to respawn or repeat any help appreciated

#

_smoke1 = "SmokeShellOrange" createVehicle position Orange; _smoke1 attachTo [Orange, [0, -2, .1] ];

winter rose
#

a smoke lifetime is 30s

inland valve
#

yeah it runs out but I need the smoke endless

vernal venture
#

So, google gives me a dozen different answers, and they all seem to be wrong.
this switchAction "HandSignalRadio"; and this switchAction "Salute"; come up as answers when I look for ways to put two AI into permanent animations via their init, but it doesn't work. I've also tried playAction with no results. What should I be using to force these guys into the respective animations and stay there?

warm hedge
#

What's your goal?

vernal venture
#

Want an AI to stand there and salute, and another to stand there on the radio. Permanently. I'm just decorating a base.

#

BIS_fnc_ambientAnim works, but doesn't include either of those animations.

inland valve
#

@vernal venture unitplay/unitcapture?

warm hedge
#

BIS_fnc_UnitPlay/BIS_fnc_UnitCapture don't do anything with it

inland valve
#

he could record himself saluting/standing whatever for 20 min and repeat the play action, no?

#

im still learning so ignore me as needed, just chiming in

warm hedge
#

He technically could, but what about radio? Player can't do

vernal venture
#

[this, "Acts_Kore_TalkingOverRadio_actions"] remoteExec ["switchMove", 0]; doesn't work, nor does
this switchMove"Acts_Kore_TalkingOverRadio_actions";
Any ideas?

warm hedge
#

Put a small suspension there IIRCsqf this spawn {sleep 0.01; _this switchMove brabra};or something like that

vernal venture
#

That works for the salute. Not for the radio, which means I probably have to go down the list and try all the radio looking ones on that page.
Thanks for the assist.

inland valve
#

keep me posted if anyone can help a noob make a smoke grenade smoke continuously/or repeatedly, thanks

#

_smoke1 = "SmokeShellOrange" createVehicle position Orange; _smoke1 attachTo [Orange, [0, -2, .1] ];

#

is what I have attached to a vehicle (named Orange)

exotic flax
#

I only know of test_emptyObjectForSmoke which can be attached to an object to have infinite smoke.
Or replace the grenade before it runs out of juice (timings can be found in configs)

inland valve
#

Thanks for the reply Grez... time for me to learn how to change config settings I guess

#

I have the smoke create/attach in an sqf ... if I add more smokes with a 30sec delay then 60 then 90 etc wouldn't that work? also how do I write that?

fierce drift
#

I’m trying to make a script for just an initial, basically the ai disables PATH, waits 15 seconds and then renables PATH but uh I just get error codes cause I have no idea what I’m doing

tiny wadi
#

Dedmen if you are still taking script suggestions you should add in += -= *= /= syntax, it's small but would be nice 😛

fair pilot
#

And else if would be nice to have too

warm hedge
#

He said elseif won't happen at this stage

compact maple
#

@inland valve You don't want to change the smoke config, you could do something like this (the next smoke wait until the old one epires):

spawn {
   while {true} do { 
      _smoke1 = "SmokeShellOrange" createVehicle position Orange;
      _smoke1 attachTo [Orange, [0, -2, .1] ];
      waitUntil {isNull _smoke1};
   };
};

or continuous smoke...

spawn {
   while {true} do { 
      _smoke1 = "SmokeShellOrange" createVehicle position Orange;
      _smoke1 attachTo [Orange, [0, -2, .1] ];
      sleep 30; //adjust it, depends on the smoke duration
   };
};
winter rose
#

while { }* but yes

#

these damn other languages, they make you make mistakes in SQF — why can't they comply!! 😋

compact maple
#

lol! thanks! damn other languages or damn sqf?meowsweats

languid oyster
#

Following code snippet counts default magazines and default rounds of a mk6 mortar.

    private _weapArray = [];
    {
        private _cfgTurret = _x;
        {
            _weapArray pushBack [getArray (_cfgTurret >> "magazines")]
        } forEach (getArray (_cfgTurret >> "weapons"));    
    } forEach ([_mortarMK6] call BIS_fnc_getTurrets);
    _weapArray = _weapArray select 1 select 0;
    private _defaultHEmags = {_x == "8Rnd_82mm_Mo_shells"} count _weapArray;
    private _defaultIllumMags = {_x == "8Rnd_82mm_Mo_Flare_white"} count _weapArray;
    private _defaultSmokeMags = {_x == "8Rnd_82mm_Mo_Smoke_white"} count _weapArray;
    private _defaultHEammo        = _defaultHEmags * 8;
    private _defaultIllumAmmo     = _defaultIllumMags * 8;
    private _defaultSmokeAmmo     = _defaultSmokeMags * 8;

Works well, except one thing bothering me. I am not able to obtain the default number of rounds of one magazine. I have to place an '8' for calculation. I would rather have a more elegant solution. Anyone?

cosmic lichen
#

Have you check the config entries of those magazines? They should have the default count.

languid oyster
#

@cosmic lichen can you point me to a command on how to read out those values?

cosmic lichen
#

configFile >> "CfgMagazines" >> "11Rnd_45ACP_Mag" >> "count"

#

getNumber might be your friend

#

config related commands

languid oyster
#

perfect. Many thanks.

median cairn
#

Is there a way to make an event handler occur when respawning, ideally global argument/effect.

winter rose
#

yes, see the EHs page on the wiki
there are unit EHs, or mission EHs

median cairn
#

Ahh EntityRespawned, thanks! Didn't see the mission EHs!

#

Ah, Mission EHs are local effect only, similar to the onPlayerRespawn.sqf or Respawn Event handler that are local effect only.

Not sure if you know of any others, or a link to a way to create an event handler?

winter rose
#

you can make the EH happen on the server only, but broadcast its effects through remoteExec 🙂

median cairn
#

Ooh cheers!
I tried getting the player Insignia to load via respawn/onPlayerRespawn but didn't work.
Works via close inventory. I'll try the remoteExec approach

little raptor
#

And else if would be nice to have too
you should add in += -= *= /= syntax
I'd much rather have a command that can do something new than a new way of doing something that's already possible.

candid cape
#

Hi , one question . How would it be so that when it is 20:00 on Arma 3 a script is executed?

oblique arrow
little raptor
#

You'd have to use a loop

#

It's awkward

oblique arrow
#

See

if (date select 3 >= 19) then { // 7pm
    hintSilent "ah, Arma sunset"; {{|...cue bad guys}}
};
#

But yeah need a loop

exotic flax
#

have a loop which runs every n seconds/minutes, check the current time and if time is correct, run script

winter rose
#

waitUntil { sleep 1; date select 3 > 19 } yep

#

maybe gathering info from a church ringing its bell is a teeeny tiny bit too far-fetched 🤣

exotic flax
#

so how would that work in the middle east? 😉

little raptor
#

what the other guys said is kind of correct, but if you want it to be exactly at 20:00

date select [3,2] isEqualTo [20,0]

is what you want

exotic flax
#

floor daytime == 20 is easier

candid cape
#
while {true} do {
sleep 1;
if (date select 3 >= 19) then { // 7pm
    hintSilent "ah, Arma sunset"; {{|...cue bad guys}};
};

};
#

?

little raptor
#

you might want to break the loop after that (and you didn't say if you want it to be exactly at 20:00 or not)

candid cape
#

Yes, but I have copied the example that they told me before xd

little raptor
#

what that loop does is trigger every second after 7pm

#

It was an example. Don't take it too literally

candid cape
#

Basically, what I want to do, is that every time it is 20:00 a script is executed

little raptor
#

Exactly 20:00?

candid cape
#

yep

little raptor
#

then use what I said:

while {true} do {

if (date select [3,2] isEqualTo [20,0]) then { //20:00 sharp
    hintSilent "ah, Arma sunset"; {{|...cue bad guys}};
sleep (23.9*60*60); //sleep 23.9 hours! :D
} else {
sleep 1;
};

};
#

Not sure about the sleep value...

#

It also depends on time simulation in the game (how fast time passes)

candid cape
#

ahh ok

#

thanks , I will test it

little raptor
#

You can just use a sleep value of 1, and use a condition to avoid running the code multiple times during that 1 minute

#

it's safer this way than sleep 59

inland valve
#

@compact maple Thank you!

fierce drift
#

What’s the best way just to add a delay between 2 lines of script

#
this disableAI "PATH";
((Need Some Sort of Delay Here))
this enabaleAI "PATH";
compact maple
#

@inland valve de nada! dont hesitate if you need anything else

winter rose
#

@fierce drift sleep

fierce drift
#

I see, so I could just implement it like

sleep 15;

in between those 2, Im completely new to arma scripting

hallow mortar
#

Yes, but only if you're doing this in an external sqf script. I suspect you're trying to do it in a unit's editor init field, which won't work.

fierce drift
#

Yeah I'm trying to do it in init

hallow mortar
#

You will need to write your script in a separate sqf file, then use something like remoteExec or execVM to run it

fierce drift
#

Hm ok then so I'd have to execute the sqf from the init field?

hallow mortar
#

hold on a sec, I'll write something

#
// unit init field

if isServer then {[[this],"yourScript.sqf"] remoteExec ["execVM",this]};

// yourScript.sqf

params ["_unit"];

_unit disableAI "PATH";
sleep 15;
_unit enableAI "PATH";
#

if you have a list of units you want to do this for (for example, every unit has a variable name, or they're all in specific groups) there are also ways to optimise it so you don't have to use the init field at all

fierce drift
#

i see thanks for showing me this

winter rose
#

yep, init field should ideally not be used, most of the time

little raptor
#

spawn?

winter rose
#

as it is run for each and every client, in the case of an MP mission

fierce drift
#

Yeah that doesn't seem optimized

#

So try to run server sided instead of client

little raptor
#

as it is run for each and every client, in the case of an MP mission
can be avoided using a variable

winter rose
#

@little raptor what do you mean, isServer/local?

little raptor
#

that too, but:

if (missionNamespace getVariable ["codeExecuted", false]) exitWith {};
missionNamespace setVariable ["codeExecuted", true,true];
this spawn {
  _this disableAI "PATH";
  sleep 15;
  _this enableAI "PATH";
};
winter rose
#

huuuh… no

little raptor
#

Not saying it's a good thing to do, but possible

winter rose
#

please no 😂

hallow mortar
#

alternate implementation for initServer.sqf

// Use if every unit has a specific variable name (remove if second applies)
_unitsArray = [unit1,unit2,unit3];
// Use to apply to entire groups (remove if first applies)
_unitsArray = (units group1) + (unitsGroup2);

{[_x,"PATH"] remoteExec ["disableAI",_x]} forEach _unitsArray;

sleep 15;

{[_x,"PATH"] remoteExec ["enableAI",_x]} forEach _unitsArray;```
little raptor
#

please no 😂
just saying this can be avoided like that, but it's not an ideal solution
as it is run for each and every client, in the case of an MP mission

winter rose
#

yeah, but by the time it synchronises on the network, did some non-JIP players run it too

little raptor
#

hmm yeah, maybe

#

Like I said, not ideal at all.

finite sail
#

evening fellas.... group question... moving AI to another group if an AI is a member of an existing group, do I have to have him join grpNull before joining him to the new group?

little raptor
#

No

finite sail
#

k, thanks

little raptor
#

do I have to have him join grpNull
if you did that, the engine would create a new group for that unit (because it can't not have a group)

finite sail
#

yes, good point

#

join grpNull makes him leave current group, according to biki

#

but as yoiu say, he must be in a group

little raptor
#

join grpNull makes him leave current group, according to biki
Yes, and it joins a new group created automatically

finite sail
#

right, good, thanks

hollow fable
#

BIKI down? cant enter.

#

this website is not available it says xD

#

Might it be due to me having prob. 20 sites open at once on B.forums? xD

winter rose
#

yep, wiki up

hollow fable
#

I ment the forums sorry

winter rose
#

ah, yep

hollow fable
#

Might I be banned for 10 min or something since I was on with so many pages? + maybe refreshed them at same time?

winter rose
#

no, confirmed on my side

hollow fable
#

?? that I am not banned for 10 min?

winter rose
#

you cannot be banned from the forums for just browsing it

hollow fable
#

tells me ottherwise

#

I was posting a PM to a person who helping me and. it ended up saving for some mins and than this camed up

winter rose
#

I am telling you the forums are down for everyone, not just you

hollow fable
#

no, confirmed on my side
@winter rose you ment the forum was down here?

winter rose
#

yep, it's down

hollow fable
#

Well dang it. wrote like 1000 words maybe more and now all is gone... And I dont recall what I wrote. so ty allot Bohemia 😫

slim oyster
#

i like continue a lot, as with the other loop commands

#

good job

fair drum
#

if I do a addRemainsToCollector on an alive unit, will the garbage collector run on that unit or does it have to be dead

winter rose
#

it adds to the list of managed objects yes - it will not delete it while alive ^^

shadow sapphire
#

How do I make this work?

BA42 select 11 moveInGunner BA42MB;
#

BA42 is a group, BA42MB is a mortar.

exotic flax
#

And what is the 11th item the BA42 group?

winter rose
#

like that… with units in front of BA42

shadow sapphire
#

B_G_Soldier_F

winter rose
#

also, better naming plz

shadow sapphire
#

Better naming?

winter rose
#

by reading, you cannot understand what are BA42 / BA42MB

shadow sapphire
#

It's a unit designation. Blufor Alpha company fourth platoon, second squad. MB is mortar bravo.

IDK how else to do it.

slim oyster
#

Just for clarification, there is no caching for the config commands right?

#

so making a caching system for the purposes of repeatedly getting config info would make sense, right?

exotic flax
#

I would say yes

#

As in; yes, it makes sense to cache common results

jade abyss
#

What was the max length for integers again, before they transform to that 1.fersgubnfsigdfignx01#lol stuff?

#

I am having ~2.3mill in my head, but not sure atm 🤔

thick lintel
#

@jade abyss The largest positive number that can be archived is 3.4028235e38 and the largest negative is -3.4028235e38.

little raptor
jade abyss
#

nvm, i was looking for that 1e+006 stuff. All fine 👍

hollow fable
#

Since BI forums are down, I give Discord a try. I got a simple question that I need to be certan too.
In init.sqf I got this:
['Flag1', 'Flag2', 'Flag3', 'Sector1'] execVM "xxx\init_xxx.sqf";

than in init_xxx.sqf; we have
[] call _initclients; // this means _initclients; gona run all thats in [] from init.sqf right?

potent depot
#

@hollow fable not necessarily, if you do [this] it'll pass those arguments from init through. this will contain an array of arguments passed through to the current script. That said if you with to have them passed as separate arguments, same as they were called in init, you will need to swite them like[this select 0, this select 1, ... and so on for all the ones you want to pass through.

hollow fable
#

but in this case its correct?

potent depot
#

in the written case nothing will be passed to _initclients

#

as [] means no arguments

#

I assume you have _initclients declared at least as well?

hollow fable
#

in the written case nothing will be passed to _initclients
@potent depot

sorry next time I fill it all :
_initclients = compile preprocessFile "xxx\init_clients.sqf";

now correct ^^^^ this in the init_xxx.sqf

potent depot
#

ofc

hollow fable
#

ofc
@potent depot
ok thank you 🙂

potent depot
#

keep in mind if it confuses you, why not just test it with dummy values?

#

its simple once you get the feel for it but you just gotta try it

hollow fable
#

cuz I am not in arma nor do I have this in any mission folder.. I am just recalling stuff and tryin to understand. get answer here is faster. Since I am now on BI Wiki to studdy more 🙂

potent depot
#

fair enough, its something youll get a feel for once you try it

#

itll make more sense then

hollow fable
#

btw. I found something in BI wiki that I think may be wrong in the line here:

Associativity is (then) done from left to right (e.g 3 + 5 + 8 will be processed as ((3 + 5) + 8))

Should it not be one more "(" in the last here? I count 3 ")" and only 2 "(" there.

potent depot
#

yeah extra ) on the right side

#

that said I think thats the closing for the whole excerpt

#

(e.g being the opening

#

not a syntax thing

hollow fable
#

true I see it now. lol thanks.

#

to late to studdy or reading stuff maybe at 05:20 in the morning. xD

woeful mantle
#

can someone help me with a small amount of scripting in a campaign im making for some friends?

I want to set up a form of "multiplayer checkpoints" for me and a few friends in a relatively linear campaign im making. I wish I could say it was for a clan of 30+ players, but there is only 4 of us, and we are all kind of bad.

so as a result I decided to try and set up a checkpoint system to respawn dead players, heal living ones and save the game in case we get wiped. I set up a trigger waypoint to activate when a player enters the designated area (all set up in areas that we have to enter to progress) with saveGame; and allPlayers setDamage 0; set for activation, but I cant seem to find a way to respawn dead players, any help would be appreciated!

wild prairie
#

Is there any way to add custom colors to assignTeam?

fair drum
#

anyone have their VSC automatically parse their code for errors? I downloaded a few extensions but I can't seem to get it to work

astral dawn
#

depends on what kinds of errors

#

such stuff can barely parse run-time errors (wrong argument type and such)

#

I use SQF VM to parse syntax errors

fair drum
#

like I have SQF Language and SQFLint right now. I can't remember what I had on my desktop (it got borked) but it used to highlight undefined variables, missing brackets etc.

#

let me try out sqf vm

astral dawn
#

use the task to compile file with sqf-vm

#

it might fail to do so because I didn't implement some proper path resolution somewhere, but should work on simpler files

#

also X39 is making a proper language-server implementation for his SQFVM which should replace that

fair drum
#

one of these extensions used to find the errors as you typed them

winter rose
#

@wild prairie negative

fair drum
#

found the parser sqf-vm.sqf-vm-language-server

wild prairie
#

Shame. Thanks.

willow hound
astral dawn
#

mp saving is not really implemented for this game even for official missions

#

I guess you need to enable respawn as said above, then when these triggers are triggered, you can create a marker like respawn_west

languid oyster
#

I named an AI unit Bob. He shall take the nearest position of the nearest building of the player:

_nearestBuilding = nearestBuilding player;
_allpositions = _nearestBuilding buildingPos -1;
_allpositions = _allpositions apply {[_x distance player, _x]};
_allpositions sort true;
Bob doMove (_allpositions select 0 select 1);

Problem: Bob walks through doors. I want him to open, and, if possible, to close the doors he passes. Is this possible somehow without a trigger on each door?

distant oyster
#

btw. I found something in BI wiki that I think may be wrong in the line here:

Associativity is (then) done from left to right (e.g 3 + 5 + 8 will be processed as ((3 + 5) + 8))

Should it not be one more "(" in the last here? I count 3 ")" and only 2 "(" there.
@hollow fable still confusing. I adjusted it and removed the outer brackets

fair drum
#

if I had an array such as:

_array = [[apple,pear,orange],[peanut,almond]]

how would I go about deleting the inner arrays and making it one combined array?

still forum
#

@jade abyss depends on what "toFixed" is set to, you can just outright disable it if you want
The largest representable integer is 16,777,216

hollow fable
#

simple question.
isPlayer are for dedicated server or local hosted server as-well?

fair drum
#

both

hollow fable
#

corpseLimit (<=) 10; //does not work. have allso tried
corpseLimit (<= 10); // what I done wrong?

winter rose
#

what is corpseLimit, where is it defined?

#

@hollow fable

hollow fable
#

not sure I understood you if u meant what file (Description.ext) I have it in. or
if I have added something more to it than this. I just look at BI-wiki :
corpseLimit = 1; // Default: 15 works allso with (<=) it says.

winter rose
#

no, it doesn't work that way - use only = in description.ext

#

the <= states about "before or equal to corpseRemovalMaxTime" only 😉

queen cargo
#

@astral dawn while that is correct, it is kinda on halt right now due to University stuff

finite sail
#

@queen cargo waiting eagerly 🙂

queen cargo
#

i accept volunteer developers btw 🤫

finite sail
#

I'd be well out of my depth unless you need a bunch of mismatch brackets and missing semi colons

#

I'll defer to someone better qualfied 🙂

winter rose
#

I vote X39 to help you indeed!

#

wait

finite sail
#

hehe

fervent kettle
#

how come I still respawn on my death position when using this:

mobileRespawnDE setVehicleLock "LOCKED";

[west, mobileRespawnDE] call BIS_fnc_addRespawnPosition;

respawn is set to custom position in MP options

winter rose
#

because I believe this is only compatible with the respawn menu @fervent kettle

jade abyss
#

@jade abyss depends on what "toFixed" is set to, you can just outright disable it if you want
The largest representable integer is 16,777,216
@still forum AH! toFixed, right! Thx man 👍

shadow sapphire
#

Why isn't this working?

SR_Module = "SupportRequester" createVehicle _RP1;
SP_Module = "SupportProvider" createVehicle _RP2;
SR_Module SynchronizeObjectsAdd [MortarMan];
[HQ, SR_Module, SP_Module] call BIS_fnc_addSupportLink;
winter rose
#

is HQ defined?

shadow sapphire
#

It's the variable name of an 3den placed playable character.

winter rose
#

I see two issues here:

  • modules should be created w/ createUnit I believe
  • BIS_fnc_initModules_disableAutoActivation module variable should be set to false via setVariable
shadow sapphire
#

I may also need to createGroup sideLogic.

#

Thanks!

#

I need to set that variable on both modules?

winter rose
#

I would do so yes

finite sail
#

iirc, logics need a createCenter too

shadow sapphire
#

The wiki says you're correct, but I think I have it covered in 3den. I may do so anyway.

#

How do I do this without creating a new group for each module?

winter rose
#

createCenter still useful in A3?

finite sail
#

for logics, yes

winter rose
#

oh okay 🙂

#

(only if there are no logics in the sqm I assume)

#

@shadow sapphire that's what you already do when placing a module, so you can either create a group for each module, or create one group and use it for all of your modules

finite sail
#

i create logics in script, lots of them, last time i removed the createCenter for logics, if broke the mission bad

next kraken
#

got a problem with holdaction function. its removed not for all players if executed even if i use remoteExec
https://pastebin.com/BbpNcruA
any idea?

cosmic lichen
#

You need to remove the action with remoteExec when the action is done.

#

codeCompleted: Code - code executed on completion. Passed arguments are:
remoteExec here in combination with removeAction @next kraken

little raptor
#

And the action ID is different on each client.

finite sail
#

isnt there a 'remove after use' flag in the function?

#

No, there isnt. How odd

#

Oh wait..yes there is

shadow sapphire
winter rose
#

why would you need to edit the unit's init field if you have a reference to it with the main syntax?

shadow sapphire
#

To set the variable.

finite sail
#

that used to be the hackers way in

#

changing init

shadow sapphire
#
setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true];```
winter rose
#

private _myModule = ...
_myModule setVariable ?

shadow sapphire
#

Killzone Kid's note says that the alternative syntax is safer. Should this be a consideration?

#

Interesting. I don't know or understand the syntax for setvariable.

slim oyster
#

The main syntax returns a reference, you can use that to set a variable

shadow sapphire
#

I'll look it up.

exotic flax
#
_module = _group createUnit ["SomeModule", [0,0,0], [], 0, "NONE"];
_module setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true];

and done

shadow sapphire
#

Nevermind. It clicked. I'm dumb is all.

#

Oh, haha, thanks!

winter rose
#

Killzone Kid's note says that the alternative syntax is safer. Should this be a consideration?
no as the logics group will remain local to the server 😉

shadow sapphire
#

Ah! Thanks!

#

Tips on giving a custom HQ to these modules?

#

Hmmm... this isn't throwing any errors that I see, but it's not adding anything to the support menu.

_RPBA42 = (getmarkerpos "RPBA42");
_LogicSide = createGroup sideLogic;
BA42R = _LogicSide createUnit ["SupportProvider",_RPBA42,[],0,"NONE"];
BA42R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
BA6R = _LogicSide createUnit ["SupportRequester",_RPBA42,[],0,"NONE"];
BA6R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
BA42R SynchronizeObjectsAdd [BA42MA];
[GM, BA6R, BA42R] call BIS_fnc_addSupportLink;

Edit: Corrected one provider to requester.

exotic flax
#

[ player, BIS_requesterMod, BIS_providerMod ] call BIS_fnc_addSupportLink;
at the moment you're adding 2 Provider modules to the unit

shadow sapphire
#

Mother. Goose. That'll do it.

#

That didn't do it. Dang. Apparently there are more problems.

little raptor
#

What is _rpba2? Doesn't seem to be defined. It has to be a position.
And why do you create 2 support providers? You need only 1

shadow sapphire
#

I fixed the support provider. One is now a requester.

_RPBA2 is a rally point defined elsewhere in the script.

Edited for corrections and clarity.

#

I think I know what it is.

#

BA42MA is a mortar, not a mortar gunner.

little raptor
#

Well there's no support provider unit. Why do you expect something to appear?
Also, I'm not 100% sure, but shouldn't you use createVehicle?
Anyway, I'll give you a solution when I'm home (currently on mobile)

shadow sapphire
#

CreateVehicle is what I originally had. It was incorrect.

There is a support provider unit. They are spawned earlier in the script.

Thanks for the help! Hopefully I'll have it solved before you get home, though!

hollow fable
#

Okay, So. I want to script a simple syntax. Were the point is to give all players at the end 10000$ cash. Starting with
cash = "5000$";
// than something like
cash = _this select 0;
if (isPlayer) then {
cash + "5000$";
};
how to make this syntax correct?

timid niche
#

This makes absolutely no sense

#

Make a script with a cash parameter and remotexec it on the server so each client is given his the amount entered in the parameter.

#

So like:

Params [[“_add”,0,[0]]];
Cash = Cash + _add;
little raptor
#

to give all players at the end 10000$ cash
what is "cash"? A variable defined in each unit's variable space?

#


what's this?

#

@shadow sapphire I think you should use this:

_RPBA42 = (getmarkerpos "RPBA42");
_LogicSide = createGroup sideLogic;
BA42R = _LogicSide createUnit ["SupportProvider_Artillery",_RPBA42,[],0,"NONE"];
BA42R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
BA6R = _LogicSide createUnit ["SupportRequester",_RPBA42,[],0,"NONE"];
BA6R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
GM SynchronizeObjectsAdd [BA6R];
BA42R SynchronizeObjectsAdd [BA42MA];
[GM, BA6R, BA42R] call BIS_fnc_addSupportLink;
#

I'm assuming BA42MA is the artillery unit?

#

And hopefully GM is a player unit?

shadow sapphire
#

Yes, BA42MA is the mortar and GM is the player.

#

Oh! I was using the wrong support provider module!? Dang...

little raptor
#

Yes. And you hadn't synced the requester module to the player

next kraken
#

And the action ID is different on each client.
@little raptor well thats stupid. do you have a workaround for that?

shadow sapphire
#

I tried synching the module to the player earlier and it didn't fix anything, I'm going to try it with and without.

Thanks ton!

little raptor
#

Save the actionID into a variable when you add it

next kraken
#

thats over my knowledge=)^^ could you post an example

winter rose
#

or put a condition?

little raptor
#

@next kraken Example:

//better to use a function for remoteExec
[[], {
  _id = [costas,....] call BIS_fnc_holdActionAdd;
  costas setVariable ["ActionID", _id];//local variable saved into the target's var space
}] remoteExec ["call",....];
#

or put a condition?
or that. Also hold actions can be removed automatically when they're completed

next kraken
#

yea i put a true on this parameter, and its removed, but not for the other client in multiplayer

little raptor
#

So you want it to be removed for everyone when it's completed by one user right?

next kraken
#

yea true

little raptor
#

Then you should put something like this into the action completion code:

//again, better to define a function for this
[0, {
  [costas, costas getVariable ["ActionID", -1]] call BIS_fnc_holdActionRemove
}] remoteExec ["call", ...]; //exec for anyone you want
#

You should use the previous code too (to save the actionID)

next kraken
#

well thx, but i dont undersatnd the code fully. is there a way to just remove all holdactions for him

little raptor
#

I don't think the game has such function

shadow sapphire
#

This code:

BA42R = _LogicSide createUnit ["SupportProvider_Artillery",_RPBA42,[],0,"NONE"];
BA42R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
BA6R = _LogicSide createUnit ["SupportRequester",_RPBA41,[],0,"NONE"];
BA6R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
GM synchronizeObjectsAdd [BA6R];
BA6R synchronizeObjectsAdd [BA42R];
BA42R synchronizeObjectsAdd [BA42MA];
[GM, BA6R, BA42R] call BIS_fnc_addSupportLink;

I get this in the log when I check for supports. It's probably irrelevant.

10:09:18 User menu description 'BIS_fnc_addCommMenuItem_menu' not defined.
10:09:21 User menu description 'BIS_MENU_GroupCommunication' not defined.

I'm not getting the things added.

little raptor
#

i dont undersatnd the code fully
It sends a code to each client, asking them to remove the specific actionID from costas

And the first code saves the actionID into a variable ("actionID") when it's added

#

@shadow sapphire Are you executing it on a "headless" client?

#

Or dedi server?

shadow sapphire
#

I'm executing on client server right now. Plan is to execute on dedicated server later.

little raptor
#

I think what the log is saying is that those two communication menus are not defined (they're used for calling support)

#

Did you see the menus?

shadow sapphire
#

Yeah, I figured it was that, but thought maybe it would be helpful.

I saw blank menus.

little raptor
#

Well, then the game cannot find those menus

#

Either a bug or undefined because !hasInterface

shadow sapphire
#

That's because the module is failing to fire.

#

It's the same thing that happens if you place the modules incorrectly in the editor, if I remember correctly.

little raptor
#

The module syncs and setup is correct. Not sure if there's somthing wrong with the units tho

shadow sapphire
#

Yeah, IDK if I'm supposed to call the gunner, rather than the mortar or something.

little raptor
#

I use the gunner in my mods

shadow sapphire
#

Oh? Hokay!

little raptor
#

Just tested. Works for me

shadow sapphire
#

Interesting, is it still what you have pasted above?

little raptor
#

Something like that

shadow sapphire
#

OH!! Interesting! Good find.

little raptor
#

Hold on that wasn't it!

shadow sapphire
#

Uh-oh.

little raptor
#

There's an error in some code for me. Not sure what it is

#

Hold on, it was 🙃

#

@shadow sapphire ```sqf
_LogicSide = createCenter sideLogic;
_LogicSide = createGroup _LogicSide;
_RPBA41 = [0,0,0];
_RPBA42 = [0,0,0];

BA42R = _LogicSide createUnit ["SupportProvider_Artillery",_RPBA42,[],0,"NONE"];
BA42R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
BA6R = _LogicSide createUnit ["SupportRequester",_RPBA41,[],0,"NONE"];
BA6R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
type = "Artillery";
BA6R setVariable [(format ["BIS_SUPP_limit
%1", _type]), 10];
GM synchronizeObjectsAdd [BA6R];
BA6R synchronizeObjectsAdd [BA42R];
BA42R synchronizeObjectsAdd [BA42MA];
[GM, BA6R, BA42R] call BIS_fnc_addSupportLink;

what I tested
#

Still gives me the error

#

But works

next kraken
little raptor
#

@next kraken costas setVariable ["ActionID", 1];
Did I say this?!

#

costas setVariable ["ActionID", _id];

#

That's what I said

shadow sapphire
#

Crazy. Still not working for me.

Can I send you this mission file?

next kraken
#

urgh sorry, working well thx !

little raptor
#

@shadow sapphire What I did:
create a player named "GM";
created an MK6 mortar named "BA42MA";
executed that code in debug console

shadow sapphire
#

Ah, I see.

#

These are all in a function.

#

I got it working by calling the same exact chunk later in the function. No idea.

little raptor
#

Well, look in the rpt, see what you were doing wrong (possibly an undefined var)

#

Also, positions do not matter for the modules.

#

So just use [0,0,0]

shadow sapphire
#

It wasn't throwing any errors in the RPT.

shadow sapphire
#

How do I export a module into a readable file?

little raptor
#

The important part of a module is its function.
Place a module in editor, right click on it, go to config, look at its "function"

shadow sapphire
#

Thank ya!

#

How do I deconstruct or inspect the function?

BIS_fnc_moduleSupportsInitProvider

little raptor
#

function viewer

#

or extract the pbo file and find it there

#

or just type the function name in debug console (the result is preprocessed, so no comments or anything in it)

shadow sapphire
#

Those are hot tips!

I found the sqf file names.

#

Drats. I don't think this is helpful on its own.

little raptor
#

I found the sqf file names
The first "folder" is the mod folder (almost always the same as pbo name)

#

Drats. I don't think this is helpful on its own.
why not?

shadow sapphire
#

My Arma isn't unpacked.

little raptor
#

Just unpack that one pbo

#

@shadow sapphire

_logic = _this param [0,objNull,[objNull]];

_this execVM "A3\modules_f\supports\init_provider.sqf";

extract it from modules_f.pbo

shadow sapphire
#

I used to have a script that exported modules into readable code. It was beautiful.

shadow sapphire
#

How do I depbo? I got mikero's depbo and deogg, but I don't remember how to work it.

cosmic lichen
#

Why not use the arma 3 tools?

fair drum
#

If I do a action surrender, how do I reverse it?

cosmic lichen
#

They are easier to use IIRC

shadow sapphire
#

I didn't see the depbo in the Arma 3 tools.

fair drum
#

i just use pbo manager

cosmic lichen
#

It's called BankRev

shadow sapphire
#

Got it! Thanks!

little raptor
#

@shadow sapphire I recommend PBO Manager v1.4 because of its context menu options (you can find it on Armaholic)

shadow sapphire
#

Hot tip!

I've got these things open in SQF now, though. Trying to identify the problem.

little raptor
#

@fair drum Surrendering == Surrender animation + setCaptive

#

So just do another animation and setCaptive false

shadow sapphire
#

I'm getting this error, and can't identify the problem.

My code:

BA42R = _LogicSide createUnit ["SupportProvider_Artillery",[0,0,0],[],0,"NONE"];
BA42R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
BA6R = _LogicSide createUnit ["SupportRequester",[0,0,0],[],0,"NONE"];
BA6R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
BA6R setVariable [(format ["BIS_SUPP_limit_%1", "ARTY_8Rnd_81mmHE_M252"]), -1];
GM synchronizeObjectsAdd [BA6R];
BA6R synchronizeObjectsAdd [BA42R];
BA42R synchronizeObjectsAdd [BA42MA];
[GM, BA6R, BA42R] call BIS_fnc_addSupportLink;

Error:

Error in expression <mat ["BIS_SUPP_limit_%1_total", _type], _total]
} forEach [
"Artillery",
"CAS_He>
12:31:45   Error position: <_total]
} forEach [
"Artillery",
"CAS_He>

BIS function:

{createCenter _x;
_HQGrp = createGroup _x;
(["B_Soldier_F", "O_Soldier_F", "I_soldier_F"]
select _forEachIndex) createUnit [[10,10,10], _HQGrp, format ["this setUnitRank ""MAJOR""; BIS_SUPP_HQ_%1 = this; this setVehicleVarName ""BIS_SUPP_HQ_%1""; publicVariable ""BIS_SUPP_HQ_%1""", _x]];
    } forEach [WEST, EAST, RESISTANCE];
little raptor
#

BA6R setVariable [(format ["BIS_SUPP_limit_%1", "ARTY_8Rnd_81mmHE_M252"]), -1]; what's this?

#

I don't recall telling you to do this

shadow sapphire
#

You didn't, but things have to adapt. It was throwing the same error even when I used your exact code, but that was before I moved the code block.

little raptor
#

but things have to adapt
This thing doesnt

#

For artillery you MUST use:

BA6R setVariable ["BIS_SUPP_limit_Artillery", _number]
#

You can even see it in the function

shadow sapphire
#

You sent me this:

BA6R setVariable [(format ["BIS_SUPP_limit_%1", _type]), 10];

little raptor
#

Yes I used format to help you understand that it's different for each support type

shadow sapphire
#

Interesting.

little raptor
#
        "Artillery",
        "CAS_Heli",
        "CAS_Bombing",
        "UAV",
        "Drop",
        "Transport"
#

That's what it says in the function

shadow sapphire
#

Now it's sorta working, but it's still throwing the same error. _total is undefined.I don't understand that.

little raptor
#

Just use what I wrote above

#

Set the rest to zero

shadow sapphire
#

What do you mean set the rest to zero?

little raptor
#
{
BA6R setVariable [format ["BIS_SUPP_limit_%1", _x], 0];
} forEach [
        "CAS_Heli",
        "CAS_Bombing",
        "UAV",
        "Drop",
        "Transport"
];
#

Everything except artillery is zero now

#

if you need those too, just remove them from the code

shadow sapphire
#

Interesting! Okay, now I've got it.

shadow sapphire
#

How do I set this thing to default or unlimited uses, rather than just a set number of times it can be called?

crude vigil
#

@shadow sapphire unlimited calls for BIS support systems is -1

shadow sapphire
#

I tried that, but it treats it as zero.

little raptor
#

unlimited calls for BIS support systems is -1
It shouldn't be (afaik)

#

anyway, just set a large value (e.g. 1e9)

crude vigil
#

There is a queue u need to follow when you setup BIS support system

#

I think you didnt do it properly and system doesnt work as it should

shadow sapphire
#

I almost certainly didn't do it properly.

crude vigil
#

@shadow sapphire Where is the LimitSupport function in ur code, I couldnt see it?

shadow sapphire
#

I don't have it.

crude vigil
#

well :)

shadow sapphire
#

I don't see that referenced in init_provider or init_requester.

#

Could you post a relevant template?

crude vigil
#

I had tested and found it myself, not sure if it is correct approach

#

was years ago.

shadow sapphire
#

That's tough.

crude vigil
#

There was a bug in mp scenario though so it wasnt that correct but it was only causing an issue when it had to finish.

shadow sapphire
#

I looked up that function. It was easy to make it work.

Thanks a ton!

crude vigil
#

yeah, just put it before addSupportLink

#

iirc, putting it after wasnt applying that function.

shadow sapphire
#

Roger!

shadow sapphire
#

What is the easiest way to be able to setAmmoCargo etc., on a non-standard support vehicle?

Like if I want an unarmed prowler to be able to reload my mortar magazines.

Nevermind. Will just attach objects and hide them for now, see how that goes.

little raptor
#

Will just attach objects and hide them for now
won't work (actions don't work on hidden objects)

shadow sapphire
#

Drats.

#

Tips for how to give ammo, fuel, and repair roles to vehicles that don't have them by default?

willow hound
#

Mod.

shadow sapphire
#

Dang.

willow hound
#

(Hold) Action + script will also work if you can figure it out.

scarlet rain
#

hiho all, i am looking for a way to determin (via script) if a backpack classname contains mags/items/weapons by default. i know how to pull information from the config, such ass "count", "scope",.... but the information (TransportWeapons, TransportMagazines, TransportItems) seems to be specified within a sub class in the backpacks config and i dont get how to access that info. Or alternatively, check if I am looking at the classname of a base version of a backpack "family". I want to ensure that a loot spawner feature will not spawn backpacks that have ammo/items by default. appreciate any hint in the right direction:)!

winter rose
#

@scarlet rain you could still empty that backpack by script?

exotic flax
#

if a mod is properly made, backpacks with contents won't have scope=2 😉

scarlet rain
#

hi both, thanks! scope is a good hint thanks grezvany, i didnt know that. yes lou in some scenarious i could indeed clear cargo. in some specific scenarios, my application of the Inidb2 persistency system would load such backpacks (that where stored empty) into the storage box with their default content after a server restart.

exotic flax
#

... was looking for that as well

scarlet rain
#

shame i didnt find this in my great googling adventure on the subject today🤪

exotic flax
#

which is basically doing the same; it simply check if it has a parent class and what the scopes are 😉

scarlet rain
#

i should really browse the bis_functions more often😂

#

oh ok so scope is really the key info then! that would be great as with this i could avoid pulling all backpacks from config and then filtering out the bad apples with above bis_fnc

#

cheers guys:)

exotic flax
#

BIS_fnc_basicBackpack will first filter out known backpacks (all vanilla ones), check if they have cargo and if they have scope 2 (all in one script).

#

of course, if you already can filter out scope most likely got 90% already done

scarlet rain
#

ok cool, i ll pull scope 2 ones only and let it run trough the bis fnc for a final check👍

exotic flax
#

that should do the trick; never had any issues with it

frank ruin
#

remoteExec ["addAction",0,_stand];
Can you add multiple addactions this way on an ingame object?

#

Seems to ignore the first one and put the 2nd only on the object

winter rose
#

you can but don't use _stand as an argument

#

@frank ruin ↑

frank ruin
#

But _stand is my object:
_stand = createVehicle ["Land_InfoStand_V2_F", [12468.372,15202.081,0], [], 0, "NONE"];

winter rose
#

yes, but you can only have one identical JIP id

#

if you don't plan to delete _stand, remove the param 🙂

frank ruin
#

Oh ye, I call the object in the PARAM part

#

But now it doesn't add either of them

#

yikes

winter rose
#

what's your code now?

frank ruin
#
_stand = createVehicle ["Land_InfoStand_V2_F", [12468.372,15202.081,0], [], 0, "NONE"];
_stand enableSimulationGlobal true;
_stand setObjectTextureGlobal [0, "images\atm.jpg"];
_stand setDir 298.9;
[_stand, ["Test1",life_fnc_menu1,"dd",0,false,false,"",' vehicle player == player && player distance _target < 5 && playerSide == civilian '] ] remoteExec ["addAction",0];
[_stand, ["Test2",life_fnc_menu2,"",0,false,false,"",' vehicle player == player && player distance _target < 5 && playerSide == west && !life_action_inUse '] ] remoteExec ["addAction",0];
winter rose
#

```sqf pwease :3

#

yeah well, it should work
won't work for JIP players of course

frank ruin
#

mmm but it has to do that héhé

winter rose
#

then set true as the 3rd parameter

hollow fable
#

Hi, question:
offset[] = { 0, 10, 0 }; // --- custom offset (optional)
will this mean its 10 meters in the air? or 10 meters from the one calling this ?

winter rose
#

it depends on what you are talking about, but it looks like #arma3_config

hollow fable
#

no its for Warlord mission. in the class Defences..

winter rose
#

yes, config

#

config is not for mods only ^^

hollow fable
#

Well will this say it will be 10 from the one doing this call in-game or will the object be 10m above his head?

winter rose
#

I don't know 🙃

cold glacier
#

@scarlet rain @exotic flax - One thing to be aware of with BIS_fnc_backpack is some mods don't contain empty variants of some backpacks (IFA has this issue, for example). If this happens, BIS_fnc_backpack returns "", which can sometimes cause issues - like if you're expecting basicBackpack to always return a valid backpack. Not necessarily a problem, but worth remembering

scarlet rain
#

thanks!

quartz coyote
#

Hello fellow scripters !
I'm having a strange behaviour :
I have a dialog that I am displaying on the player's screen through a spawn function with createDialog "ctf_dialogChooseSide";
I know it is working because it works fine in singleplayer but when I switch to local multiplayer, the dialog closes instantly after having been opened. I know it's being opened because I added a if (!_ok) then {hint "Dialog couldn't be opened!"}; to make sure :D
Anyone know what I might have missed ?

willow hound
#

Did you develop the dialog?
Else it could be that some function running after dialog creation checks isServer and closes the dialog.

quartz coyote
#

I found the answer ...
I had forgotten waitUntil { !isNull findDisplay 46 };

#

Now it works ...

#

@willow hound thanks for taking the time

next kraken
#

searching for the possibility to delete dead players gear AND corpses. guess onplayerdead.sqf would need a code but didnt find anything

quartz coyote
hollow plaza
#

Uh, as I tried asking a few minutes ago.
I'm planning on using a custom scroll menu script for my scenario(s), which should only be active for certain people. Would it be easier to just add a variable and set it to be true on those certain peoples' init fields or to make a script that detects whether the person has a certain vest, for example, on them for the script to activate.

little raptor
#

Would it be easier to just add a variable and set it to be true on those certain peoples' init fields or to make a script that detects whether the person has a certain vest, for example, on them for the script to activate.
Doesn't make much difference in terms of "being easy".
If they MUST have that vest you speak of, then use the latter condition. If they simply are not supposed to use it at all, use the former

hollow plaza
#

Meant to say quicker/better instead of easier, but alright.

bronze jetty
#

Hello, please explain why addaction is tripled with remoteExec? Calling from initserver. The essence of the script is to change into the enemy's uniform

CODE:

{
    _x addEventHandler['Killed', {
        params["_unit", "_killer"];
        _unit setVariable ['killedLoadOut',getUnitLoadout _unit,true];
        _killer setVariable ['killerLoadOut',getUnitLoadout _killer,true];
        _westUnits = allUnits select { side _x == WEST };
        _westUnits = _westUnits - [CIA_1,CIA_2, SF_3, SF_4];
        [_unit, ["<t color='#37db16' size='1.3'>Переодеться</t>", {
                params["_target", "_caller", "", "_westUnits"];
                if (count _westUnits <= 3) then {
                    _target setVariable ['unitKilled',true,true];
                    _arr = missionNamespace getVariable ['killedArray',[]];
                    _arr pushBack _target;
                    missionNamespace setVariable ['killedArray',_arr,true];
                    if (count _westUnits == count _arr) then {
                    missionNamespace setVariable ['task3_completed',true,true];
                    };
                };
                private _loadOut = _target getVariable "killedLoadOut";
                [_caller, "Acts_JetsCrewaidRCrouch_in"] remoteExec["switchMove"];
                sleep 2.5;
                _caller setUnitLoadout _loadOut;
                [_caller, true] remoteExec['setCaptive'];
                _target remoteExec["removeAllActions", 0, true];
                [_target] remoteExec["hideBody"];
                [_caller] spawn {
                    params ['_caller'];
                    private _u = uniform _caller;
                    waitUntil { uniform _caller != _u };
                    ["end1",false] remoteExecCall ['BIS_fnc_endMission',0];
                };
                
            },
            [_westUnits], 1, true, true, "", "_this distance _target <= 3"]] remoteExec["addAction", _westUnits, true];
    }];
}forEach [I1,I2,I3,I4];
distant oyster
#

is there a way to distinguish a vanilla config from one added in by a mod?

cosmic lichen
#

Maybe get the vanilla CfgPatches from an unmodded game and then use configSourceAddonList ?

distant oyster
#

might be the way. for now I'll just run the script in unmodded version but when I release it it would ideally be safe to use under any circumstance

little raptor
#

@bronze jetty Probably because the event handler is being triggered on 3 machines.

#

If you had 3 machines connected to the server at the time, it is almost certainly because of that

fair pilot
#

How do i get all vehicle hitpoint names which are associated with engine?

little raptor
#

There's no way to do this (with absolute certainty), because the hit point names (and their order in the list) are chosen by the mod authors

robust brook
fair pilot
#

@robust brook So how do i know which are associated with the engine?

#

Is there a way to fully damage engine of any vehicle?

cosmic lichen
#

hitEngine

#

hitEngine2 is only for planes and helicopters which might have 2 engines

sudden yacht
#

Lets say i wanted to execute a server command using an SQF such as loading up a new mission on a local host. with uiNamespace do { ctrl = findDisplay 12 ctrlCreate ["RscButton", -1]; ctrl ctrlSetPosition [0,0,0.5,0.1]; ctrl ctrlSetText "new mission"; ctrl ctrlCommit 0; ctrl ctrlAddEventHandler ["ButtonDown", { serverCommand "#mission HATAK.VR"; }]; };
How would i get this to work and find the mission in the picture? I have the script in an SQF. but it seems to not find the mission. The mission in my C:\Users\Shadow\Documents\Arma 3 - Other Profiles\Jack%20Oniell\missions. Help

winter rose
#

@sudden yacht ```sqf to color-format your code 😉

fair pilot
#

@cosmic lichen Well, i'm trying to make script that can fully damage engine of any vehicle

#

It won't work in case of xian, which has 4 engine hitpoints

#

I wonder why is there no simple way to just damage the engine

sudden yacht
#
vehicle player setHit ["HitEngine3", 1];vehicle player setHit ["HitEngine4", 1];``` @fair pilot try something like that
fair pilot
#

@sudden yacht I want to make it work for vehicles that are added with mods, so there can be any number of engine hitpoints

sudden yacht
#

@fair pilot try just adding a 100?

#

vehicle player setHit ["motor", 1];

winter rose
#

setHitpointDamage ?

little raptor
#
_veh = cursorObject;  
getAllHitPointsDamage _veh params ["_names", "_damage"];
{//fully heal  
  _veh setHitIndex [_forEachIndex, 0];  
} forEach _damage;  
_hits = [];  
{  
  _veh setHitIndex [_forEachIndex, 1];  
  if (!canMove _veh) then {  
    _hits pushBack [_forEachIndex, _names#_forEachIndex];  
  };  
  _veh setHitIndex [_forEachIndex, 0];  
} forEach _damage;  
{//restore damage  
  _veh setHitIndex [_forEachIndex, _x];  
} forEach _damage;  
_hits
fair pilot
#

Won't work in case of xian which has 4 engine hitpoints

little raptor
#

Do that

fair pilot
#

it won't damage engine fully

#

thx i will try it

winter rose
#

use getAllHitPointsDamage and damage the ones you want

fair pilot
#

How do i know which are associated with the engine?

little raptor
#

also, if you're going to use my code, call it unscheduled

#

How do i know which are associated with the engine?
my code does that

#

It damages all hitpoints till it finds the one(s) which prevents the vehicle from moving (typically the engine)
The hull is also included, but you can remove that

winter rose
#

How do i know which are associated with the engine?
they are usually named *engine* something

little raptor
#

Not always

winter rose
#

usually

little raptor
winter rose
#

if mods are wrong, they don't deserve scripter's attention :p

little raptor
#

xian which has 4 engine hitpoints
My method gives only 2 (plus the hull)

fair pilot
#

Yea your code also returns hitpoints of other parts

little raptor
#

That's your best bet. There's nothing else that can give the engine hit points (because as I said, hit point names are arbitrarily chosen by the authors)

fair pilot
#

End up writing this
`_hitPointName = getText(_config >> "HitPoints" >> "HitEngine" >> "name");
_vehicle setHit[_hitPointName, 1];

_i = 1;
while { true } do {
_cfgName = _config >> "HitPoints" >> ("HitEngine" + str _i) >> "name";
if (not isText _cfgName) exitWith {};
_hitPointName = getText _cfgName;
_vehicle setHit[_hitPointName, 1];
_i = _i + 1;
};`

inland valve
#

Hi Im using a little script to make smoke trails, but under any real stress the smoke grenades hang outside the hull of the vehicle, is there a way to use smoke module with this instead of spawning grenades?

#

[] spawn {
while {true} do {
_smoke1 = "SmokeShellYellow" createVehicle position Disco; _smoke1 attachTo [Disco, [5, 0, -1.2] ];
_smoke2 = "SmokeShellBlue" createVehicle position Disco; _smoke2 attachTo [Disco, [0, 0, -1.2] ];
_smoke3 = "SmokeShellGreen" createVehicle position Disco; _smoke3 attachTo [Disco, [-5, 0, -1.2] ];
sleep 58;
};
};

crude vigil
#

@inland valve Just hide the grenades with hideObject command?

inland valve
#

cool! how does one do that?

crude vigil
inland valve
#

Im here because I dont really understand that, not because I couldnt find it

#

so I posted my example

crude vigil
#

Ok so it is not that hard contrary to belief... To use this command, you should check out the Syntax section, see it says:
Syntax:
hideObjectGlobal <object>
<object>: Type is Object
You do not know what an Object type is , since you just started.
So you again go to same link and search for Object:
You find this link:
https://community.bistudio.com/wiki/Object
You understand what an object is. Okay it may not be understandable from this page but a grenade shell is an object, if it hadnt been so, you would not be able to use createVehicle this "object".
So you take this Syntax written above, what are your smoke objects? They are returned from createVehicle commands and are named as _smoke1, _smoke2, _smoke3. So in order not to confuse you more, you would simply need to hide these 1 by 1.
So as a result, you would write a code like this:

hideObjectGlobal _smoke1;
hideObjectGlobal _smoke2;
hideObjectGlobal _smoke3;

Not the best way but it will work and you be happy for it. If you understood, then you learned something, possibly you are more curious, most likely you will just take the code part but I hope you wont and actually give a try to understand. Now yes there is this code, where will you put it ?
You will put it before

sleep 58;

Why? Because it creates 3 smokes every 58 seconds and every 58 seconds you gotta hide the new ones.
So as a result you will have something like this:

[] spawn {
   while {true} do { 
      _smoke1 = "SmokeShellYellow" createVehicle position Disco; _smoke1 attachTo [Disco, [5, 0, -1.2] ];
      _smoke2 = "SmokeShellBlue" createVehicle position Disco; _smoke2 attachTo [Disco, [0, 0, -1.2] ];
      _smoke3 = "SmokeShellGreen" createVehicle position Disco; _smoke3 attachTo [Disco, [-5, 0, -1.2] ];
      hideObjectGlobal _smoke1;
      hideObjectGlobal _smoke2;
      hideObjectGlobal _smoke3;
      sleep 58;
   };
};
inland valve
#

thank you!!!!!!!!!!!!!!!

#

@crude vigil

crude vigil
#

Thank me by trying to understand it. notlikemeow

inland valve
#

I am,(slowly) the "why?" was great because the subtleties of scripting get lost on me, wonderful little detail that didnt go unnoticed

crude vigil
#

I believe people who asks "why?"s instead of "codes" are always welcomed by me and many others in here.

inland valve
#

again thanks... on behalf of SOME of the "codes request" type people - I really learn from seeing it, and seeing it work made me want to learn more. I could see how that might come across as lazy, but I assure you from my POV it is the motivator.

shadow sapphire
#

What is the easiest way to check if a variable exists, or a player is in a slot with a specific variable name in this context?

If ((player == BHD66) && (!"present" BHA66)) then {};
finite sail
#

isNil

shadow sapphire
#

Oh... duh! Thanks so much!

finite sail
#

if you're checking variable, dont forget to put it in quotes

shadow sapphire
#

Double thanks!

finite sail
#

🙂

shadow sapphire
#

Is there a clean alternative to !isNil or is that the only way to do that? Not for the same problem, that one is solved, this is a new one.

#

How do I get this to use lazy evaluation?

If ((!isNil "BHA66") and (player == BHA66)) then {};
unique sundial
#

you can also
if (condition) then {
if (anothercondition) then {
instead

willow hound
#

stylepoints--;
readability--;

shadow sapphire
#

Thanks a ton to both of you!

@unique sundial, I thought you retired from Arma? Honor to have interacted with you.

little raptor
#

retired from Arma
He's one of the devs.

shadow sapphire
#

Arma 4 this decade?

Kidding. I'm actually in no real hurry for a new Arma. Arma 3 has so many issues, but we know them at this point, and can work with them, haha.

exotic flax
#

Can't even tell the issues anymore... Since I'm used to them since OFP 🤣🤣🤣

austere hawk
#

Wanted to see if i can put in a runge kutta integrator to reduce performance cost of ballistic calculation with air friction, but found out that theres actually an analytical solution...
https://abload.de/img/geoa7jo8.jpg

sacred slate
#

hello. i was away a while and have installed the 2.0 update recently. now my script init isn't working anymore. its a folder in arma 3 root level: execVM _mjk_scripts\mjk\init.sqf"; has the update changed anything at how to reach scripts outside pbo's?

young current
#

how does it not work?

sacred slate
#

its like its not there

#

no error message

young current
#

you may need to put it in your mission folder instead

#

or perhaps you run it wrong way

little raptor
#

a folder in arma 3 root level:
It never worked this way. (maybe you could run it with filepatching)

#

Also, what about the rest of the parameters (e.g. drag coeff)?

calm whale
#

Need advice... I have this MP mission on server where we play as Vietcong and i want to have asian faces for all playable units, i do managed to set them, however on players respawn, the face is reseted to player default non asian face... So i need command to stick that asian face tru death

robust hollow
#

maybe something like this on mission init 🤷

player addEventhandler ["Respawn",{
  params ["_unit","_corpse"];
  [_unit,face _corpse] remoteExec ["setFace",0,_unit];
}];
calm whale
#

Thanks will try

austere hawk
#

@austere hawk
Source?
@little raptor physics ...
force equilibrium on the projectile in x and y. This leads to 2nd order non linear differential equation of motion in x and y. x''(t) = - airfriction * x'(t)^2 ; y''(t)=-airfriction * y'(t)^2 - gravity
gravity & airfriction as positive values.
Solve the differential equation to get x(t) and y(t), then caclulate the 4 integration constants from boundary conditions.
https://www.wolframalpha.com/input/?i=y(t)"%3D+-a*y(t)'^2+-g
(note - in wolfram alpha log = ln , not log10)

little raptor
#

That's where you're wrong.
The drag is acting along the path (Fd = -cd*V^2). In other words:
Fy/Fx = tan (theta)
What you write doesn't (Fy/Fx = tan^2(theta))

#

That's why I was shocked by that equation

#

I wanted to say your source is incorrect

austere hawk
#

🤔 <sound of brain gears grinding>

little raptor
#

what you wrote:
airfriction * y'(t)^2/airfriction * x'(t)^2 = (y'/x')^2 = tan^2(theta)

#

theta is the slope of the trajectory @(x,y)

#

what you wrote would be correct for linear drag

#

but not for quadratic drag

austere hawk
#

is drag actually calculated quadratic ingame?

finite sail
#

drag? womens clothes are in game?

little raptor
#

yes. but not sure if Arma devs are using the correct equation like mine

#

But all I know is that their equations are wrong somewhere (due to weird ballistics behavior)

austere hawk
#

vanilla artillery have no air friction at all, if thats what you mean

little raptor
austere hawk
#

i think the use is correct in game, i just checked the standard "euler step" algorithm i use for my calculator, which is accurate in predicting the impact, and that has _ax = _airfriction * _v * _vx

#

ah, you mean rockets/missiles. I'm not touching those with a long pole... i'm just after normal bullets

sudden yacht
#

How can i check if a player is next to a building position? Within a couple of meters through a if then statement?

winter rose
#

nearestBuilding I assume

sudden yacht
#

But nearest building feels a bit to general?

winter rose
#

that or nearestTerrainObjects then

finite sail
#

if ((player distance _mybuildingposition) < 3) then { code goes here }

sudden yacht
#

another quick question what is a "Hide"

finite sail
#

ah, the million dollar question lol

#

many things are hides according to the nearestterrainobjects command

sudden yacht
#

refering to terrain objects.

#

Can you give a few examples?

finite sail
#

I've always assumed that hides are things the AI can hide behind when in combat

sudden yacht
#

ty ill investigate more

winter rose
#

Hide are usually rocks and stuff

finite sail
#

rocks are usually rocks in the nearestterrainobjects command

winter rose
#

not small ones? 🤔

finite sail
#

checking now, to be sure

#

runwayedgelights are hides

#

almost all runway lights are, in fact

#

land_bench_f

#

land_watertank_02_f

#

almost all sidewalk, kerb objects

#

all roadsigns, all garbagebin type objects

#

you get the idea, there's no real method behind what is a hide other than 'it doesn't fit neatly into another type'

sudden yacht
#

ty

finite sail
#

np

#

on the otherhand, nearestterrainobjects is good at finding tree, house, fuelstation, railway, transmitter, powerwave

#

and others

#

oh, and road, main-road track and trail since 1.99

#

nearestterrainobjects is the dynamic mission makers best freind

#

@winter rose , some rocks, big and small are hide, some are rock

#

rocks isnt used

winter rose
#

you get the idea, there's no real method behind what is a hide other than 'it doesn't fit neatly into another type'
I had that feeling, but didn't dig further, thank you for doing so

finite sail
#

🙂

#

NTO is a great command, very fast and cpu cheap

#

even with proper big radii

gilded rover
#

weird question , but whats the chances you can assign a unit a variable when it enters a trigger?

winter rose
#

…please rephrase?

COND: this && random 1 < 0.25
ACT: OneVariable = thislist select 0
```?
gilded rover
#

like you have a unit with variable null
upon entering trigger area he gets assigned variable BIS_FD_Competitor
bottom can wait :P
/upon entering a different trigger he gets assigned a random variable so the next player can be assigned variable BIS_FD_Competitor/

winter rose
#

…Y u work with BIS prefixed vars

#

…because Firing Drill.

#
BIS_FD_Competitor = thislist select 0; publicVariable "BIS_FD_Competitor";
#

@gilded rover ↑

modest vector
#

Hello, sorry for my English, I'm French;)
So here I have a little problem, I would like to execute a function that only server knows from the client, suddenly, as seen on the bohemia wiki, so I use the CfgRemote and the remoteExec function in order to execute from client to server the function, but nothing works: / can someone explain to me how I can go about running a server function from the client? Thank you

winter rose
#

yes, remoteExec 🙂

#

with 2 as a target

modest vector
#
class CfgRemoteExec
{
       class Functions
       {
               mode = 1;
               jip = 0;
               class life_fnc_get_player
               {
                      allowedTargets=2;
                      jip = 0;
               };

               class life_fnc_set_player
               {
                      allowedTargets=2;
                      jip = 0;
               };
       };
};
``` and remoteExec 
```sqf
[serveur_id_sauvegarde,_uid,"pos"] remoteExec ["life_fnc_get_player",2];
#

but this does not work, it does not run from the server

winter rose
#

tried without CfgRemoteExec?

modest vector
#

okay I will try

tough abyss
#

Hello, is it possible to check the array in the array?

I'm Trying to make a condition for the distance of the first player who comes closer than 5 meters to any unit from the array.

Did:

{
    _enemyArray = _x;
    allPlayers findIf {_x distance _enemyArray <= 5};
}forEach [
    security_1,
    security_2,
    security_bpost_1
];

But this method doesn't work

gilded rover
#

…because Firing Drill.
@winter rose exactly , trying to push this to its limits xD in terms of MP , thanks I will try that!

modest vector
#

@winter rose it doesn't work either

winter rose
#

so the issue may be with the function itself 🙂

#

CfgRemoteExec being innocent here

willow hound
#

@tough abyss Your code looks good to me, you're just not doing anything with the value returned by findIf, so the code just runs and the result is discarded.

tough abyss
#

@willow hound I just run it in the console and see the result

modest vector
#

Ok, I'll do my research, thank you very much

willow hound
#

The result is what forEach returns - probably nil, is it not?

tough abyss
#

@willow hound The result is -1 always, ForEach result is the last element in the array for commands that return nothing

willow hound
#

Heh.

#

It's -1 because no player is within 5 meters of security_bpost_1 I believe.

tough abyss
#

Yes, but I do not know what to replace it with

willow hound
#

That's what the last loop iteration checks.

#
if ((allPlayers findIf {_x distance _enemyArray <= 5}) != -1) exitWith {true};
#

Try that

tough abyss
#

Thx, i will try

#

it works, thank you

spring stone
#

Hello guys, I have a question: I want to have a message written to the log file when someone enters Zeus but I can't seem to make it work. I tried it with the following for a test to make it work but I feel like I'm missing something

player addEventHandler ["CuratorObjectRegistered", {
[format ["%1 entered Zeus", name player]] remoteExec ["diag_log",2];
}];
willow hound
#

Can you confirm the EH fires?

spring stone
#

No thats the issue

#

triedit with hint and systemchat but whenI enter Zeus nothing happens

#

other EHs do fire the (e.g. fired)

willow hound
#

It might be expecting a curator game logic (Zeus Module) instead of a player, have you tried adding the EH to that?

spring stone
#

mhhh didn't check that message up there. That explains a lot. Thanks

#

Funny, I can get CuratorObjectPlaced working but not CuratorObjectRegistered I feel like I understand this one wrong

#

I hoped it would fire whenever the player entered the Zeus interface

winter rose
#

I only wanted to create a function that would make a check between deleteVehicle/deleteVehicleCrew
what happened, I ended up with a 64 lines script 😵

shadow sapphire
#

That's radical.

winter rose
#

moar efficienter!```sqf
while { true } do // just to be sure
{
deleteVehicle _this;
if (random 1 > 0.999) exitWith {};
};

shadow sapphire
#

No kidding!

That's one of my weakest attributes is efficient code. Like... I can finally understand what's going on well enough to make it work, but not well enough to crush anything down to do the same job with fewer lines or better run time.

cosmic lichen
winter rose
#

Best Practices too

shadow sapphire
#

Well, I've more or less got step one, step two I have, depending on who you ask, but step three is still wayyy down the line for me.

winter rose
#

No kidding!
but just to say, I ended up making a function to delete about everything - group, array elements, objects, markers…
couldn't help it 😄

shadow sapphire
#

What's the use case?