#arma3_scripting

1 messages · Page 777 of 1

tough abyss
#

@little raptor Local to the players group.

little raptor
tough abyss
#

Local to my group, so it's for the IVAS mod on the steam workshop but I'm building the actual HUD that wasn't made for it, so I want to be able to get local group data only, in terms of all markers so only the markers in that group. And I will add another general marker limit as well. So it's basically being drawn via draw3dicon when people place map markers in the group on the map.

#

AllMapMarkers gets more and more expensive if it gets a lot of data.

#

So that is currently a problem being able to restrict to a players group only won't make it as expensive I'm thinking of testing it with some AI in zeus then switch between them, and use RemoteExecCall then use group at the limiter.

little raptor
#

do your marker names follow a certain pattern?

tough abyss
#

It pulls markers placed by players I am looking for the "USER CREATED #"

#

But only allow up to 10 to be drawn at a time.

little raptor
#

well no that won't be helpful

tough abyss
#

Only wondered that was all.

#

Someone made a "Voyger compass" but costs a lot in terms of compute time.

#

My current situation is making it viable to draw "markers and marker pips"

little raptor
#

if your only concern is running allMapMarkers every frame, just update them via event handlers

tough abyss
#

Is there a marker placed EH?

tough abyss
#

So there is.

#

Much more performance friendly.

#

Thank you.

warm hedge
#

I actually forgot that this exists 😓

tough abyss
#

This is the sort of compass I am making which is

#

There is two versions of the Voyager compass one based on a "tape image" and one based on a giant array manipulation.

#

aussie battler created the Lite version and has basically said I've abandoned this you can have it.

#

So knowing that I'll probably use his work or the first one.

#

which was made by Unknown_GTX

#

The other problem I have is adding the as I said marker pips.

#

Converting a 3D compass into a 2D horizontal representation.

opal zephyr
#

If Im picturing what you want to do correctly here, I believe I've done the exact same thing before, except I used allMapMarkers

tough abyss
#

Yeah but AllMapMarkers is expensive the EH handlers is definitely a better option and then just check if the marker placed was by a player in the players group or the player themselves.

open flume
#

If i wanted to deactivate a trigger if the trigger is left how would i do so?

#

(trying to make a refuel zone that they have to wait in)

tough abyss
#

You need to check inThisList

#

find the vehicle and find if the object in this list is inside the area of a trigger

open flume
tough abyss
#

So "thisList" means all objects inside of the activating trigger

#

this is the "trigger activation" or the boolean return value on the triggers conditions

#

ArmA 3 Script also is nothing more than a procedural language mostly.

#

I'd say it's closer to C or JavaScript (without the OOP functionality)

open flume
#

well good part is i dont know either of those XD

#

i can more or less read my way through em but havent learned to make em yet

tough abyss
#

Hmmm... well the "this" is going to return true or false

#

(getPos (this List select 0)) select 2 is going to get the position of the first entitty that triggers the event

#

and give you a comparison between the Z axis and if it's less than 1

#

Because thats what (getPos (thisList select 0) select 2 does it gets the Z axis of the first object to activate the trigger

#

So if it's a player getPos(thisList) will return a player if the player is less than 1 unit then the code in that line will execute.

#

Thats in the "condition" code correct?

open flume
#

ye

#

_handle = [(thisList select 0)] execVM "rearmVehicle.sqf";
is the activation

tough abyss
#

Yeah so for the condition to become true the trigger must be activated.

#

which is represented by "this"

#

and the first activating object must be < 1 in the Z axis.

#

So if this is a rearming script it's checking to see if the vehicle is actually "on the pad"

#

You can do another technique which is in a while loop checking the distance of the vehicle from the pad

#

You'll commonly see peoples rearm scripts contain [1000,this,"marker"] execVM "monitorVehicleRearm.sqf"

#

or something like that.

#

Then inside the code it will be getting the distance from the rearm point in the Z-axis

open flume
tough abyss
#

The trigger is probably the more elegant solution but, being a trigger it should probably execute in the unscheduled environment rather than scheduled and only use the [] spawn code and wait for it to end inside that script.

#

Well thats what I'd do.

#

But you are probably not familiar with cfgFunctions.hpp.

open flume
#

not really but never hurts to learn XD

worthy igloo
#
_zeuss = player in call BIS_fnc_listCuratorPlayers;
[_channelID, {_this radioChannelAdd [leader player, _zeuss]}] remoteExec ["call", [0, -2] select isDedicated, _channelName];

any reason this wouldnt add zeus to the channel also?

tough abyss
#

Hazzar found d solution to my GUI problem thats fast as well.

#

Using a continious array then using a seletion between two indexes and showing between to beginning and ending indexes the "tape"

#

So much faster.

#

How do I change the name of the respawn point if I use [west, Ambulance] call BIS_fnc_addRespawnPosition; in the game's init? It's giving me the name of the AI inside the Ambulance and I want the respawn name to be "Ambulance"

#

Make the vehicles name Ambulance

#

I have

#

Object - specific object. When some crew positions are available and unlocked, players will be respawned on them, otherwise they will appear around the object.

#

Yeah that's not what I mean

#

The Ambulance is the respawn point not the crew

#

Ah.

#

I've been trying to wrap my head around the wiki for the last 20 minutes and it really isn't user friendly lmfao

#

If I'm correct...

#

[west, Ambulance, "Ambulance"] call BIS_fnc_addRespawnPosition;

#

That should do it?

#

Nope.

#

Ah

#

Try setting the target to the actual ambulance.

#

Not the side.

#

If that doesn't work this will probably work.

#

It said there were three parameters, Target, Position and Name. Well the target is west and the target is Ambulance so then logically, the next thing to put would be the name, which is also Ambulance

#

[west, getPos(Ambulance)] call BIS_fnc_addRespawnPosition;

#

Gotcha

#

I am so glad BI added array index selections.

#

I was trying to wrap my head around the virtual garage a while back

#

I got it to work

#

Kinda

#

Yeah it's not designed for MP

#

Yeah it really isn't.

#

There was a complete rewrite the developer of Patrol Ops 4 did

#

To make a virtual garage that worked with it.

tough abyss
#

It's now called "E of Bay Dunes"

#

IS the AI named Ambulance?

#

Not the vehicle?

#

No

#

The vehicle is named Ambulance

worthy igloo
#

are u spawning in it or out of it

tough abyss
#

HAHAHA

#

MY DUMB CODE WORKS

#

[west, Ambulance, "Ambulance"] call BIS_fnc_addRespawnPosition;

#

Now it's called "Ambulance"

#

Man that's dumb AF but for once my big brain logic actually solved the issue

little raptor
worthy igloo
little raptor
# worthy igloo how would u mention curator player

it's not about how "I" do it. your code is just wrong.
try:

[_channelID, {_this radioChannelAdd ([leader player] + call BIS_fnc_listCuratorPlayers)}] remoteExec ["call", [0, -2] select isDedicated, _channelName];
worthy igloo
agile cargo
#

Here is what I'm doing:

{
            private _unit = _x;
            {
                private _syncedObject = _x;
                if(typeOf _syncedObject == "CBA_BuildingPos") then{
                    _unit setUnitPos "UP";
                    _unit doMove (getPosATL _syncedObject);
                };
            } forEach synchronizedObjects _unit;
} forEach units op_1;

The idea is to upon a trigger activation, the units of this group will move to pre-determined building positions and garrison it

little raptor
#

for that typeOf works

agile cargo
#

the typeOf part seems to work, but the AI just won't go to the correct position... I'll try to retrofit the ACE garrison script into that

little raptor
#

AI just won't go to the correct position
first of all, you're telling all AI to go to the same pos

#

which doesn't work in Arma

#

oh wait nvm you sync to each unit

#

well anyway, second of all, you can't move AI to custom building positions

agile cargo
#

yeah each unit is synced toa building position that they should move to

#

uhm

#

what if I have each AI in individual groups, move them, and then group them together?

little raptor
#

? that still doesn't solve the custom building position problem

#

AI can only walk along path LODs

agile cargo
#

the CBA_building pos is just a dummy object, in theory it could be anything

little raptor
#

do you place them exactly at predefined building positions?

agile cargo
#

any XYZ pos would work. in game the positions are behind some trenches in the open

#

grad trenches

little raptor
#

AI can't move to wherever you want

agile cargo
#

even if there is no actual building blocking them? like, the position in question is right there on the terrain itself

little raptor
#

on terrain yes

#

sometimes

#

but in buildings no

agile cargo
#

this is the thing

little raptor
#

well there's another problem. AI can't move inside the bounding box of objects (unless they have a path LOD)

#

maybe that's why it doesn't work for you rn

agile cargo
#

damn, what if made the trenches simple objects? (and log piles)

little raptor
#

they still have the geometry

#

which means the bounding box is still there

neon owl
#

Does anyone know how to set a trigger's condition from false to true using an SQF file? I've been stuck on this for a bit. Here's my code

radzone4 = true;
null=[]execVM "RandomArray.sqf";

winter rose
neon owl
#

During the game.

winter rose
neon owl
winter rose
pulsar trail
#

Hello there very new to eden scripting I have experience in unity and unreal but just cant wrap my head around edens way! I useually just make really cool maps and stuff in eden but wanted to finally try my hand at making something with some scripts! I have an laptop with the Hold Action being used and I want to have it where an alarm is triggered while someone is using the hold action I assume that what is written goes into the code start section but how do I have it notify the trigger to start the alarm which will loop until the hold action is completed?

#

I tried setting the laptop as the owner but that just lets the trigger activate while in that certain area.

drifting portal
#

I'm trying to make a plane script that flies in straight line from point on the east to point B

#
params ["_end","_height", "_time", "_class"];

_end set [2,_height];
_Start = [worldsize + ([100,300] call BIS_fnc_randomInt) , worldsize,_height]; 
_Vehicle = createVehicle [_class, _Start, [],0,"NONE"];
_Vehicle setPosATL _Start;
_Vehicle setdir (_Vehicle getdir _end);

_VectorDir = vectorDir _Vehicle;
_VectorUp = vectorUp _Vehicle;

_Vehicle setVelocityTransformation [
    getPosASL _Vehicle,
    ATLToASL _end,
    [0,0,0],
    [0,0,0],
    _VectorDir,
    _VectorDir,
    _VectorUp,
    _VectorUp,
    _time
    ];

sleep _time;
deleteVehicle _Vehicle;

#

the code is not really doing anything and it probably has to do with me not knowing exactly what to do with setVelocityTransformation

drifting portal
pulsar trail
#

Ok thanks a billion!

drifting portal
#

also don't make a habit of using triggers for everything

pulsar trail
#

Ok is there a better way to implementing it during the Code Start

drifting portal
#

yes by putting the trigger's code for the alarm in code start

pulsar trail
drifting portal
#

of course you need to do two things

  1. the bool you set to false at the start of the mission, make it so that the code at code start only executes if the bool is false, so
//Bool at mission start:
MyBool = false;

//the code in code start:
if !(MyBool) then {
MyBool = true;
// Alarm code goes here
};

2- this is so that it doesn't keep recreating the alarm every time someone uses hold action

#

trigger is basically a loop with special stuff, if you add too many the game will kick you in the face

#

and you will enjoy arma 144p 2013 experience

pulsar trail
#

LOL gotcha and where does the mission start bool go?

drifting portal
#

init.sqf

pulsar trail
#

Awesome yeah I just wanted to make sure

granite sky
granite sky
#

You can pre-build the args and pass them in, and then it's a cheap EH.

drifting portal
#

can you tell me more about the interval?

granite sky
#

0 - object is at the start pos, 1 - object is at the end pos.

#

0.5 - in the middle :P

drifting portal
#

hmm

granite sky
#

You can use it in a while loop with short sleeps instead, but that goes to hell when something else is lagging scripts.

drifting portal
#

If I want the plane to cross 4kms in 25 seconds, how would I do that

#

I'm trying to think of a ratio

granite sky
#

maths

drifting portal
#

yeah

granite sky
#

That's 160 metres per second, so set the forward velocity to that.

drifting portal
#

yeah

#

the velocity

#

is it model space?

granite sky
#

In setVelocityTransformation? No, it's world space.

drifting portal
#

so if I set the y of velocity to 160

#

it won't go to the direction I want right?

granite sky
#

Well, it kinda will, because the velocity inputs are only used for MP interpolation.

drifting portal
#

I will use this in MP yeah

granite sky
#

but it'll look wacky as hell between updates :P

drifting portal
#

so setVelocityTransformation is not good for MP?

granite sky
#

It's fine but you should set the velocity components to something sensible.

#

Like here it could be _startPos vectorFromTo _endPos vectorMultiply 160

drifting portal
#

yeah

#

that's a good idea

#

let me try it and fail miserably and come back

#

lol

#

well yeah

#

it having a spasm (NVM)

pulsar trail
#

Could I steal someone's eyes real quick as theres a lot to this that I am clueless about? I think I got it there but am confused where I am missing something or I am totally wrong... I have no idea and thats... fun?

drifting portal
#

what is the problem?

pulsar trail
#

Its not working but I am not sure why

#

As I did what I am used to doing I feel like its not right

drifting portal
#

what did you do?

pulsar trail
#

This is in the Code Start for the laptop under the Object:Hold Action

compbool = true;
if compbool == true then { 
_compalarm playSound "alarm;
_compalarm spawn;
};```
This is in the code complete

compbool = false;
delete _compalarm

In my init.sqf I have the 

compbool = false;```

#

I feel like this should work but I am a tad lost why its not

granite sky
#

You have a missing quote in the first one for a start.

#

It looks like you're also assuming that _compalarm is globally accessible, which it probably isn't.

drifting portal
pulsar trail
#

ahhh okay is there an easier way to make a sound spawn?

granite sky
#

Oh, also if (compbool == true) then needs brackets around the conditon like this.

#

err

#

just if (compbool) then

#

(in which case you don't strictly need the brackets, but better get used to it)

pulsar trail
#

Totally understand that!

#

So how do I make that sound spawn after flipping compbool to true then deleting it upon the completetion?

tough abyss
#

playSound3D

somber radish
#

Anyone know how to implement group eventhandlers?

#

I tried doing this:

playerGroup addEventHandler ["KnowsAboutChanged", { 
  params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"]; 
}];
#

but I get this:

 Error addeventhandler: Type Group, expected Object
#

when I try this:

player addEventHandler ["KnowsAboutChanged", {  
  params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"];  
}];
#

I get this:

Error Foreign error: Unknown enum value: "KnowsAboutChanged"
warm hedge
#

AKA Dev-Branch only so far

somber radish
#

ah

#

in other words no way?

warm hedge
#

Use Dev-Branch

#

Or wait until 2.10 hits stable

somber radish
# warm hedge Use Dev-Branch

Stupid question (sorry), but if I implement this will players that are not using dev-branch be able to use the mod?

warm hedge
#

The mod?

somber radish
#

I am building a mod with several functions in it, amongst them I would like to add some code when an enemy is detected

warm hedge
#

Yes everyone needs Dev-Branch. Until 2.10 hits the stable

somber radish
#

uuh

#

ok

#

Thank you!

#

Any idea how i could do a workAround to get the same result?

#

(some code executed on 'enemy spotted')

warm hedge
#

I can think up something but never recommended. Because it is performance unfriendly

somber radish
#

I am guessing a loop

warm hedge
#

EachFrame more like

somber radish
#

store near-targets and look for a change?

warm hedge
#

Guess so

somber radish
#

yah

warm hedge
#

I wouldn't try workaround and just tell them to try Dev BTW

somber radish
#

true

#

ait

#

Thank you again!

warm hedge
#

Good luck then

little raptor
somber radish
drifting portal
granite sky
#

Spawn the while loop?

drifting portal
pine rapids
#

Heya lads, I'm in need of a bit of help. I don't do SQF often and ran into a problem. I have a script located in scripts/time.sqf inside my mission folder.

params ["_timespeed", "_shorternight"];

_timespeed = _this select 0;
_shorternight = _this select 0;

timeacceleration = ["_timespeed", "_shorternight"] spawn {
    params ["_timespeed", "_shorternight"];
    while {true} do {
        if (_shorternight == 1 && (daytime > 20 || daytime < 3)) then {
            setTimeMultiplier(_timespeed * 4);
        } else {
            setTimeMultiplier(_timespeed);
        };
        sleep 10
    };
};

I wish for this script to run on start of the mission so I ran this inside of the initServer.sqf file:

// Params
_timeOfDay = "StartTime" call BIS_fnc_getParamValue;
_timespeed = "TimeSpeed" call BIS_fnc_getParamValue;
_shorternight = "ShorterNights" call BIS_fnc_getParamValue;
_startweather = "InitialWeather" call BIS_fnc_getParamValue;
_weatheroption = "WeatherType" call BIS_fnc_getParamValue;
_wantfog = "AlterFog" call BIS_fnc_getParamValue;

// includes

["_timeOfDay", "_shorternight"] call compile preprocessFileLineNumbers "scripts\time.sqf";

Whilst it does seem that the file is being read I am being greeted with a "generic error in expression" error. Any ideas as to what I did wrong?

stable dune
#

Both select 0 in at Time.sqf

open fractal
#

you want to pass the values, not the words timeofday and shorternight

#
params ["_timespeed", "_shorternight"];

_timespeed = _this select 0;
_shorternight = _this select 0;
``` also this is completely redundant. Why use `params` if you're just going to overwrite the local variables with `_this select`?
#
params ["_timespeed", "_shorternight"];
``` this is all you need, the variables are then defined.
pine rapids
#

I got there, cheers 👍

little raptor
little raptor
#

but again, you should just create it outside that fnc

copper raven
drifting portal
versed belfry
#

Hello :D
Is someone able to tell me why the code in my init.sqf or initPlayerLocal.sqf is not executing the first time I join the server?

//FF
if (hasInterface) then {
    [player] call FFPP_fnc_punishment_FF_addEH;
};

//Dressup
_this call HR_fnc_dressUp;

//Into screens
[] execVM "Scripts\Credits.sqf";
[] execVM "Scripts\Briefing.sqf";

More specifically the dress up function which gives the player a shemagh & teleports him into a helicopter.

open fractal
versed belfry
open fractal
#

i mean the code

#

where is that code located

#

init.sqf or initPlayerLocal.sqf
this does not line up with what you have written

versed belfry
#

Oh, in initPlayerLocal.sqf

open fractal
#

initPlayerLocal.sqf automatically passes an array with both the player object and JIP boolean

brazen lagoon
#

Anyone know what the fastest way to get the closest road to a position is?

open fractal
#

so _this returns [player object, true] for example

#

is that addressed in the script you're calling?

brazen lagoon
#

BIS_fnc_nearestRoad exists but I don't know how fast it is, so I guess I'll do some tests

versed belfry
open fractal
#

You're passing an array to the script, it might be looking for an object

versed belfry
#
/*
Author: Håkon
Description:
    Dresses the player up

Arguments:
0. <Object> unit or oldUnit from initPlayerLocal or onPlayerRespawn
1. <Object/Bool> jip or newUnit from initPlayerLocal or onPlayerRespawn

Return Value: <nil>

Scope: Clients
Environment: Any
Public: Yes
Dependencies:

Example:

License: MIT License
*/
params [["_oldUnit", objNull], ["_jipOrNewUnit", objNull, [objNull, true]]];
private _unit = if (_jipOrNewUnit isEqualType objNull) then {_jipOrNewUnit} else {_oldUnit}; //determine target object as this is used on init and respawn


//build lists to check for dress up
private _list1 = ["P_1", "P_2", "P_3", "P_4", "P_5"] call HR_fnc_ValidateObjects;
private _list2 = ["P_6", "P_7", "P_8", "P_9", "P_10", "P_11", "P_12", "P_13"] call HR_fnc_ValidateObjects;
private _list3 = ["P_14", "P_15", "P_16", "P_17", "P_18", "P_19", "P_20", "P_21"] call HR_fnc_ValidateObjects;

//set goggles
if (_unit in _list1) then {
    _unit addGoggles "FGN_AAF_Shemag_tan";
    if (alive HELI_1 && HELI_1 emptyPositions "Cargo" > 0) then { 
        _unit moveInCargo HELI_1;
    } else { 
        _unit setPos (getMarkerPos "LZ"); 
    };
} else {};

if (_unit in _list2) then {
    _unit addGoggles "FGN_AAF_Shemag_tan";
    if (alive HELI_2 && HELI_2 emptyPositions "Cargo" > 0) then { 
        _unit moveInCargo HELI_3;
    } else { 
        _unit setPos (getMarkerPos "LZ"); 
    };
} else {};

if (_unit in _list3) then {
    _unit addGoggles "FGN_AAF_Shemag_tan";
    if (alive HELI_3 && HELI_3 emptyPositions "Cargo" > 0) then { 
        _unit moveInCargo HELI_3;
    } else { 
        _unit setPos (getMarkerPos "LZ"); 
    };
} else {};

nil;
open fractal
#

interesting, it does take the array

versed belfry
#

The weird thing is if I were to join as the mission is initializing then it would not teleport me

#

but if I were to exit and rejoin or JiP then it would teleport me

open fractal
#

try putting it in onPlayerRespawn.sqf

versed belfry
open fractal
#

yeah

versed belfry
#

A'ight testing it out rn

#

Uhhh

#

It's already there, so didn't change anything :(

brazen lagoon
#

huh. bis_fnc_nearestroad can be called 10000 times in .0073ms so I think that's fine

#

ok that's definitely not true

#

within 100m performance is fine. 200m is maybe fine. 300 it's prob not.

open fractal
open fractal
#

diag_log is your best bet

#

just check the rpt

#

hint or systemchat may not work during init stage

versed belfry
#

Okie Dokie

open fractal
#
    if (alive HELI_2 && HELI_2 emptyPositions "Cargo" > 0) then { 
        _unit moveInCargo HELI_3;
``` there's a typo here
versed belfry
open fractal
#

should be yours since the code is called on the client

versed belfry
#

Ah need to enable that if SystemChat doesn't work then

versed belfry
#

@open fractal systemChat does work

systemChat "Line #1";

params [["_oldUnit", objNull], ["_jipOrNewUnit", objNull, [objNull, true]]];
private _unit = if (_jipOrNewUnit isEqualType objNull) then {_jipOrNewUnit} else {_oldUnit}; //determine target object as this is used on init and respawn

systemChat "Line #2";


//build lists to check for dress up
private _list1 = ["P_1", "P_2", "P_3", "P_4", "P_5"] call HR_fnc_ValidateObjects;
private _list2 = ["P_6", "P_7", "P_8", "P_9", "P_10", "P_11", "P_12", "P_13"] call HR_fnc_ValidateObjects;
private _list3 = ["P_14", "P_15", "P_16", "P_17", "P_18", "P_19", "P_20", "P_21"] call HR_fnc_ValidateObjects;

systemChat "Line #3";

//set goggles
if (_unit in _list1) then {
    _unit addGoggles "FGN_AAF_Shemag_tan";
    systemChat "Line #4";
    if (alive HELI_1 && HELI_1 emptyPositions "Cargo" > 0) then { 
        _unit moveInCargo HELI_1;
        systemChat "Line #5";
    } else { 
        _unit setPos (getMarkerPos "LZ"); 
    };
} else {};
etc...
#

All 5 lines were executed while I was in map screen before clicking continue to load in

#

I guess it is being executed a bit too early since the vehicles and markers were not yet initialized?

open fractal
#

this should be resolved by using onPlayerRespawn.sqf

versed belfry
open fractal
#

does the systemChat still show if you remove it from initPlayerLocal?

#

you should probably write systemChat str _this; or something to make sure it's passing the player object, though I don't know what would be the hangup here

#

onPlayerRespawn.sqf

Executed locally when player respawns in a multiplayer mission. This event script will also fire at the beginning of a mission if respawnOnStart is 0 or 1, oldUnit will be objNull in this instance. This script will not fire at mission start if respawnOnStart equals -1.

#

respawnOnStart defaults to zero unless it was changed

versed belfry
#

I gotta change it to 0 I believe

open fractal
versed belfry
open fractal
#

I couldnt figure out why initPlayerLocal wouldnt work so I loaded up the game

#

the script runs fine, so long as I replace this

//build lists to check for dress up
private _list1 = ["P_1", "P_2", "P_3", "P_4", "P_5"] call HR_fnc_ValidateObjects;
private _list2 = ["P_6", "P_7", "P_8", "P_9", "P_10", "P_11", "P_12", "P_13"] call HR_fnc_ValidateObjects;
private _list3 = ["P_14", "P_15", "P_16", "P_17", "P_18", "P_19", "P_20", "P_21"] call HR_fnc_ValidateObjects;
``` with an array of objects
#

if onPlayerRespawn.sqf works fine then dont bother but if you're inclined to run it again in initPlayerLocal can you log the returns for these functions?

versed belfry
#

in onPlayerRespawn.sqf

#

but still was not teleported to helicopter

open fractal
#

is the helicopter named HELI_1

open fractal
versed belfry
#

even aborting and rejoining doesn't work anymore :(

versed belfry
versed belfry
#

Testing it on a dedicated server so have to boot it off and on :L

open fractal
#

i think i see the issue

#
params [["_oldUnit", objNull], ["_jipOrNewUnit", objNull, [objNull, true]]];
private _unit = if (_jipOrNewUnit isEqualType objNull) then {_jipOrNewUnit} else {_oldUnit}; //determine target object as this is used on init and respawn

change this to

private _unit = _this # 0;
versed belfry
#

including the params?

open fractal
#

get rid of that

#

i think they got the order wrong

versed belfry
#
License: MIT License
*/
private _unit = _this # 0;

//build lists to check for dress up
private _list1 = ["P_1", "P_2", "P_3", "P_4", "P_5"] call HR_fnc_ValidateObjects;
etc...

testing this

open fractal
#

if this doesn't work then you should probably enable logs and log a bunch of stuff

safe cloak
open fractal
#

thats what I just caught

#

the author must've thought onPlayerRespawn is [_oldUnit,_newUnit]

safe cloak
#

Nomas, how the hell did that script work in the past missions?

versed belfry
open fractal
#

it would work with initPlayerLocal

versed belfry
#

Even then it had some issues here and there

safe cloak
open fractal
#

I think onPlayerRespawn is the cleaner method for applying loadouts as it happens last

tough abyss
#

Does ValidateObjects actually exist?

versed belfry
open fractal
#

that script is generally a mess if you haven't caught on

tough abyss
#

I can see that.

versed belfry
#

It just removes the unexisting objects from the array so there is no error pop up I think?

tough abyss
#

If you are doing a lot of what you are doing why not generalise the script to parameters?

#

If you know what I mean?

open fractal
#

I don't see the point of ValidateObjects there

#

you can test vehicleVarName against that array of strings

versed belfry
#

Ok just to make sure it is not a fluke I will try again

#

but it worked

tough abyss
#

Yeah using array in somevar

safe cloak
open fractal
#

the whole gang here

versed belfry
tough abyss
#

Something also that makes this much harder is the lack of comments.

#

Comments are you friend.

safe cloak
versed belfry
versed belfry
#
/*
Author: Håkon
Description:
    Dresses the player up

Arguments:
0. <Object> unit or oldUnit from initPlayerLocal or onPlayerRespawn
1. <Object/Bool> jip or newUnit from initPlayerLocal or onPlayerRespawn

Return Value: <nil>

Scope: Clients
Environment: Any
Public: Yes
Dependencies:

Example:

License: MIT License
*/
tough abyss
#

Thats called a function comment block header

versed belfry
#

Ah a'ighty

tough abyss
#

Not really a "comment"

#

I use C++ version of a comment block generator with A3

#

In Visual studio code

open fractal
#
params ["_unit"];

//assign helicopter to each list
private _heliAssign = [
    [["P_1", "P_2", "P_3", "P_4", "P_5"],HELI_1]
    [["P_6", "P_7", "P_8", "P_9", "P_10", "P_11", "P_12", "P_13"],HELI_2]
    [["P_14", "P_15", "P_16", "P_17", "P_18", "P_19", "P_20", "P_21"],HELI_3]
];

//assign helicopter to unit
private _heli = objNull;
private _unitVarName = vehicleVarName _unit;
{
    _x params ["_unitList","_vehicle"];
    if (_unitVarName in _unitList) exitWith {_heli = _vehicle};
} forEach _heliAssign;

//set goggles
_unit addGoggles "FGN_AAF_Shemag_tan";

//move into helicopter
if (alive _heli && _heli emptyPositions "Cargo" > 0) then { 
    _unit moveInCargo _heli;
} else { 
    _unit setPosATL (getMarkerPos "LZ"); 
};
nil;
versed belfry
#

@open fractal Your script magic works, I love you xD

open fractal
#

still dont know why initPlayerLocal didnt work

tough abyss
#
//**======================
 **   FUNCTION NAME
 *@param name type  
 *@return type
 *========================**/
#

Automatically generates comments

versed belfry
tough abyss
#

Probably should create an SQF comment generator

#

Yeah I think I will make a comment block generator would be nice

#

and making it for .vscode doesn't look difficult

brazen lagoon
#

is there a way to get if a group has a motorized/mechanized/armor vehicle in it?

#

or I guess if it just has a ground vehicle in it

#

eh I guess assignedVehicle of group leader is good enough

tough abyss
#

Check it's kindOf

#
 
{ 
  if (_x isKindOf "Tank" || _x isKindOf "Car") then {} 
} count (units groupName);
#

That will do what you want but also check if the vehicle is alive

#

@brazen lagoon

#

Reason for using count instead of forEach if you don't need the forEachIndex just use count

brazen lagoon
#

yeah

#

makes sense

tough abyss
#

I don't know if it's faster? I think it is because it's not doing another operation.

#

Thats purely based on my understanding of Big-O notation.

granite sky
#

findIf is normally preferable. Your code is pretty busted anyway :P

#

units _group doesn't include the vehicles occupied by groups, and if it's isKindOf "Tank" then it's not isKindOf "Car".

#

"LandVehicle" is probably the best one to use, although there's no guarantee with config that all mobile land vehicles actually inherit from it.

#

If you want to check properly then you'd have to check the simulation or something.

tough abyss
#

Ah sorry it should have been ||

granite sky
#

The if statement isn't doing anything there anyway

#

Ths would kinda work, although it's not good:

{
  (vehicle _x isKindOf "Tank" || vehicle _x isKindOf "Car")
} count (units groupName);
#

Additionally, because there's no accessor for whether a vehicle is attached to a group, there is no way to detect whether a vehicle has been added to a group (with addVehicle) but they just haven't decided to board it at the moment.

tough abyss
#

@granite sky I'm not going to give the entire answer.

stable dune
stable dune
#

Or crew from vehicle?

granite sky
winter crown
#

Looking for programers

versed widget
#

what is the parent class for Cars i tried car_f but it seems that even trucks are included and inherit from it

hallow mortar
#

Wait a minute, that was an answer to you last time 🤔

versed widget
#

lol right, i didnt know how to actually use it

params ["_Vehicle"];
"truck" in toLowerANSI getText (configOf _vehicle >> "_generalMacro")
};```
what does Tally_Fnc_isTruck actually return ?
hallow mortar
#

After defining it like that (or better yet, in cfgFunctions), you would call it like this:

[_vehicle] call tally_fnc_isTruck;

The return will be true if it is a truck and false if it is not.

versed widget
#

ah i see, so do i have to define _vehicle, like objectparent player = _vehicle

hallow mortar
#

Well, defining is the other way around, so that would be _vehicle = objectParent player. But it's just a placeholder, it could be any reference to a vehicle, doesn't have to be a local variable, or called _vehicle, or even a saved variable at all; [objectParent player] call tally_fnc_isTruck; would also be fine if that's appropriate for your context

versed widget
#

oh cool, i think i understand i will try it

versed widget
hallow mortar
#

it's case sensitive and checks against all-lowercase text. You must use "car" and not "Car".

versed widget
#

for trucks it works but not for cars

hallow mortar
#

When you made the changes to the script, did you save the file?

versed widget
#

for now im testing on the debug menu

Tally_Fnc_isCar = {
params ["_Vehicle"];
"car" in toLowerANSI getText (configOf _vehicle >> "_generalMacro")
};

_isCar = [objectparent player] call tally_fnc_isCar;
systemchat str _isCar; 
versed widget
hallow mortar
#

It seems to be some kind of special property used by the engine. The person who wrote that piece of code apparently knows more about it than I do, given that they provided it as a solution for this.
You could try replacing it with "textSingular" if you like; if you want to actually understand why it was used you should ask the person who wrote it.

versed widget
#

ok i will try to contact him

candid condor
#

Hey I have a question I want a object to invisable but this removes the collision any idea how to fix this? object is a wall

#

Or is this the wrong channel to ask?

open hollow
#

i guess thats what you want

candid condor
#

Alright I will have a look

limber oyster
#

I'm a mission creator using SQF to load missions into servers via the debug console and I'm having some trouble and am wondering if anyone could help.

I'm having trouble finding the problem for my AIs and most of my simple objects not loading in when I execute my SQF.

I built a mission that was decently large with a lot of objects and when I attempted to load it all in together in one SQF file 98% of the objects I placed didn't load in, including AI and vehicles and simple objects, and so I decided to split the code into two SQFs, separating the simple objects from the AI and simulated objects, and the code for the custom objects loaded in perfectly fine when I did that, although the code with the simulated objects, vehicles, and AI only partially loaded in, with most simulated buildings, gates, and vehicles not loading in, and none of the AI loaded in.

--One thing I noticed with the code for the AI is that it has code related to the CBA mod I believe. Would that cause issues when translating that to public servers?

The only things that loaded in was like one building and a few crates, when there should be AI, vehicles, ammo caches, and a few other objects that shouldve also spawned in. I'm not sure exactly what the problem is, but I'll link the section of code I'm having trouble with, along with an image of me attempting to execute the SQF in the editor showing an error that I don't have any knowledge on how to fix.

#

^this is the section of code that is supposed to spawn in the AI and simulated objects.

warm hedge
#

Uhh, why would you use this legacy 3D editor sqf?

limber oyster
#

elaborate please?

warm hedge
#

IDK how you'd get this sqf but seems like from an legacy 3D Editor, is very obsolete in the first place

limber oyster
#

I created this SQF in the Eden editor, and have made compositions previously using this method

warm hedge
#

Oh wait, sorry yeah you're right. I just recalled that there's a export as sqf option

#

Which is... something I've never used

#

So, the code, is to spawn an entire composition, and is not spawning the entire properly?

limber oyster
#

The code that I linked is one out of two files I'm using to load a composition. The code you can see is all of the AI, vehicles, and simulated objects, the simple objects are in a different file.

#

And it's only loading some of what it should be loading. No AI is spawning, although if you scroll through you can see that the code for all the AI and everything is there, although only around 10 objects are loading with that code.

warm hedge
granite sky
#

How many groups is that?

warm hedge
#

That too. Arma 3 only allows up to 144 IIRC groups in a time

granite sky
#

maybe only ~55 here though :P

warm hedge
#

Maybe an rpt knows

granite sky
#

nods

limber oyster
#

I could try putting all the code for the AI in it's own SQF and could see if that works.

granite sky
#

RPT is your friend

warm hedge
#

!rpt

wicked roostBOT
#
Arma RPT

Arma generates a .rpt log file each time it's run, which contains a lot of information like the loaded mods, or any errors that appear, this log file can be very useful for troubleshooting problems.

To get to your RPT files press Windows+R and enter %localappdata%/Arma 3

Additionally see the wiki page for more info: https://community.bistudio.com/wiki/Crash_Files

To share an rpt log here, please use a website like https://sqfbin.com/ to upload the full log, that way the people helping you can take a look at it and try to figure out the problem you're having together with you.
Note: RPT logs can hold personal information relevant to your system, the game or others.

limber oyster
#

So to generate the errors I'm having with the RPT, should I execute the code in Eden or like a MP server?

warm hedge
#

Either

#

Or... the latest rpt already knows, I think

#

The method itself is simple enough, and reliable. I can give you some codes actually

limber oyster
#

thats possible but the last time I started Arma I executed multiple SQFs and multiple times so I'm going to restart and get a new RPT

#

Would that method be able to be executed locally? In servers I use a local debug console to load in my missions via SQF.

warm hedge
#

Should be on the server

#
{
    _x hideObjectGlobal false ;
    _x enableSimulationGlobal true ;
} forEach (getMissionLayerEntities "YourLayerName")#0 ;```
limber oyster
#

the rpt ^

#

I wouldn't know what to look for to be honest I apologize

warm hedge
#

No need to be sorry

#

Hm nothing suspicious there

warm hedge
limber oyster
#

hmm i'm wouldn't exactly be sure, but if it enables simulation globally, I believe it would greatly impact the performance of my compositions, because in my comps I have hundreds of trees as simple objects with simulation disabled, so would that cause issues? Also how does this method actually work though? I am loading these SQFs into official servers, so I wouldn't be sure if it would work on them.

warm hedge
#

Official servers?

limber oyster
#

Yes, official Zeus servers

#

So I believe that there may be issues that could occur from that, but I wouldn't be entirely certain.

warm hedge
#

I don't play MPs so wouldn't know how it would work, but...

#

Ah, that's why you're using this method

limber oyster
#

Yes, I have been trying to make missions and comps for pub zeus, although my composition sizes were too big, therefore I am using this method I found to load them in instead.

#

And I haven't had any problems before with loading in compositions with this method until I began adding AI into the comps. There's also at least almost a thousand or more simple objects that is part of the comp, which I have in a separate file I load in, which loads perfectly fine, although the code with the AI has not been working for me.

#

The reason for the large amount of simple objects if you are wondering is because of trees, roads, and props, although since I load them in as simple objects, they have no effect on performance.

grand rock
#

I have a question regarding a command with changing post-process effects; In ppEffectCommit 3, What does the "3" stand for? I'm not entirely certain on the context of what it does, does it call a certain command or does it have a lifetime?

warm hedge
#

seconds

grand rock
#

Ah, gotcha

#

tyvm 🙂

tight cloak
#

whats the fastest way to grab all objects of the same classname or multiple classnames and put them into an array?
eg, ive placed alot of wooden boxes with the same classname, id like to fetch all 3 in the simplest way possible without naming each and every one of them

hallow mortar
#

_objectsArray = entities "yourClassnameHere" (single classname)
_objectsArray = entities [["yourClassname1","yourClassname2"],[]] (multiple classnames)

granite sky
#

entities "type" probably

tight cloak
#

ty ill give it a whirl

granite sky
#

Because it uses isKindOf you might get unexpected results in some corner cases.

tight cloak
#

seen it just now, tried:

_allalive = entities [[], [], true, true];
systemchat format ["%1", _allalive];

as a test and it was pulling p3d files

hallow mortar
#

Well yes, if you use an empty array it detects literally everything it can possibly detect, which can include map entities that are referenced by model name rather than a classname

#

That's not the kind of edge case they were talking about (it's not even an edge case, it's just working as intended). They meant that it will also detect objects that inherit from the classname you put in (e.g. put in Car_F and you'll get not only Car_F but also any class that inherits from Car_F, e.g. most types of car). With a specific box classname this shouldn't be an issue.

tight cloak
#
_objectsArray = entities "Land_WoodenBox_F";
systemchat format ["%1", _objectsArray];

retested with this, returned them all the same but still as p3d

#

does it still work though?

hallow mortar
#

Yes, it still works. It's probably just referring to them by their model name because they don't have any other name.

#

References to unnamed objects can get weird when you try to present them as strings because they are not actually strings. The game knows what it means, it's just having a hard time translating that into a format you can understand.

tight cloak
#

yeah just gave

_objectsArray = entities "Land_WoodenBox_F";
systemchat format ["%1", _objectsArray];
{deleteVehicle _x} foreach _objectsArray;

a whirl and it effects them all. this is perfect then, i can work with it from here

#

ty for the help

limber oyster
# warm hedge seconds

i got my problem fixed by the way, there was an error in the code due to the method i used to export the SQF, although I got it fixed and made note of it if it happens again in the future. Thank you for the help

modern meteor
#

I am using a revive script for my squad AI units. Sometimes when one of the units gets revived the order of my squad changes. Eg. sniper was initially on F4 and is now on F3. Is there a way to run a script which assigns the order of the group? Could run it after the revive.

jovial belfry
#

hello i am working on one mode and i would need to find out which function i made a mistake you don't know how i could make a console debug which would show me what was done and where the code got stuck

meager granite
#

Is it guaranteed that player is new player during Respawn event handler of the player unit firing?

#
25.06.2022 19:00:00: STONE.MAN1335 (24.178.228.20:2304) c869a7bace840865ab7833e741a80c82 - #0 "kg22ww <NULL-object>"
25.06.2022 19:11:44: STONE.MAN1335 (24.178.228.20:2304) c869a7bace840865ab7833e741a80c82 - #0 "kg22ww R Alpha 4-3:1 (STONE.MAN1335) REMOTE"
```Seeing this in `remotexec.log`, `kg22ww` being a `remoteExecCall` function that sends `player` right in player unit's `Respawn` event handler function (unscheduled of course). Not sure if this is a case of `player` not being reliable at this point or BE logging messing up and showing objects as null randomly 🤔
granite sky
#

This is a client Respawn EH remoteExecCall'ing a logging function on the server?

meager granite
#

There is a Respawn event handler on player's unit on client side that sends return of player command to server with remoteExecCall from within that Respawn event handler function

granite sky
#

Are you deleting the corpse in the same EH or what?

meager granite
#

Yeah my mistake of not using EH arguments for old and new unit and having player instead but I'm still curious what's going on

#

No, the server does the deletion, it can be done very quickly, within few frames (1 to say 50 depending on number of players) of respawn (if the body is in spawn area)

granite sky
#

Potentially faster than the remoteExecCall then?

meager granite
#

Nope, should be a bunch of frames after it

#

That's why I guessed that BE is messing up logging with nulls for entities

#

I'll add more logging, but still wonder what is going on

granite sky
#

It's the sort of thing that isn't documented anyway.

#

You just have to add logging and hope that you find something plausible :P

meager granite
#

I wonder if remoteExecCall's arrival due to network latency could be longer than these bunch of deletion frames?

#

Basically by the time remoteExecCall arrives to the server, bunch of frames have already passed and body got deleted, thus a null in BE log

granite sky
#

What's the condition for deletion?

meager granite
#

!isPlayer and then check if its within spawn area for instant deletion

granite sky
#

Yeah, definitely possible then.

meager granite
#

So if player is indeed returning a dead player on Respawn instead of new one, then it explains the whole thing

#

Thus my original question if player is reliable inside player's Respawn event handler

#
25.06.2022 19:16:35: STONE.MAN1335 (24.178.228.20:2304) c869a7bace840865ab7833e741a80c82 - #0 "kg22ww 1da72971480# 1799916: ia_soldier_01.p3d REMOTE"
```More logs, not even a named unit, looks like `player` indeed *may* return a dead body from within a `Respawn` EH
granite sky
#

Log locally as well.

#

I'm not even sure where the new player units are created. The other alternative is that the player unit is created on the client and the remoteExecCall actually get there faster than the unit :P

#

On connection players are created on the server though, IIRC

#

(and then passed over to client-local)

meager granite
#

Yeah, lobby units are created on server, respawned units are created on clients

granite sky
#

wow ok

meager granite
#

Good thought actually, but it kinda sounds strange that entity creation message arrives (gets processed?) later than remote exec message 🤔

#

Its Arma though, so anything is possible

granite sky
#

Possibly arrives in the same frame and it's a frame-order issue.

#

Seems like a lot of dependent stuff to fire in one frame though.

meager granite
#

That non-named entity in logs might also be newly created player unit that isn't a player yet as select player message gets processed even later

#

Guessing here, gonna add more logging to see what's up

#

Maybe @still forum can shine a light if its even possible for remote exec message to be processed before whatever the message for respawning unit is, if remote exec is sent from within Respawn EH

#

Or if its just player not being reliable to return new player unit from inside Respawn EH

still forum
#

is weekend

#

bai

meager granite
calm grotto
#

Im trying to set up an arma op just to frick around and i have 2 respawn points set up and for some reason we spawn in the corner of the map can someone help me?

#

Ive tried for 2 hours now it still doesnt work

opal zephyr
#

Do you have the respawn points set to the correct side and have you enabled respawns in the settings?

open fractal
#

You're going to need to share what you've tried

#

there's multiple ways of doing respawns

calm grotto
#

Yes i have

#

I cant post images

open fractal
#

Describe it

calm grotto
#

alright

#

ive put 2 respawns for runway and helipad for 3 players i have 3 vehicle respawns and i have set everything in my settings that this youtube tutorial said

#

Respawn is set to respawn on custom position

#

I have allow manual respawns on

#

I have select respawn position and loadout on

#

the individual respawn is set to Name - type (Infantry) Side - (BLUFOR) show to - (Only The Side)

#

idk what i did wrong im very frustrated

open fractal
#

is there a MenuPosition option?

#

I don't have the game in front of me but if you use custom position i think it'll take you to 000 unless you place a respawn_west (depending on faction) marker

#

which is a different respawn system than you're using

drifting portal
#

what is the best way to measure a player's ping?

little raptor
drifting portal
#

thanks a lot

#

how do I know if a number is infinity ?

little raptor
#

isFinite

#

or was it finite? thonk

#

latter

drifting portal
#

yep

#

I guess also infinity ping is only possible for client host

little raptor
#

or are you just guessing?

drifting portal
#

it returns something like 1.67.... e+007

#

tried finite (((getUserInfo (getPlayerID player))#9)#1, it returns true

little raptor
little raptor
#

it returns true -> it's not infinity

drifting portal
#

ah alright

drifting portal
#

what is the right one?

granite sky
#

Bracket issues

little raptor
#

yeah

#

order of precedence is wrong

granite sky
#

Looks like you just clipped it though?

little raptor
#

finite is unary

#

is binary

drifting portal
granite sky
#

lost one off the end

drifting portal
#

many thanks

#

although I will throw another question soon lol

#

is the while loop condition at 53

#

correct?

#

will it stop executing when game ESC menu is not shown?

little raptor
drifting portal
#

how do I fix it?

little raptor
#

don't use while... meowsweats

drifting portal
#

for....?

#

I'm confused

little raptor
#

getUserInfo is server exec

#

why do you even use it in there?

#

is that being called on the server?

drifting portal
#

me not reading the biki properly moment I guess

#

that's a problem then

#

that means It will be more tedious to retrieve the ping

#

because I want client to know their ping

#

that means I will have to keep calling the server every second

little raptor
#

nvm

#

but the getUserInfo part is still wrong

drifting portal
#

yeah

#

how will I retrieve the ping then without lightly ddosing the server?

little raptor
drifting portal
#
[[player],{
    params ["_unit"];
    Tro_PlayerPing = ((getUserInfo (getPlayerID _unit))#9)#1;
    (owner _unit) publicVariableClient "Tro_PlayerPing";
}
]remoteExec ["call", 2];
#

?

#

this is what I should call every second for the server to return the ping?

#

yes

#

I know

granite sky
#

Ideally you turn that into a function :P

drifting portal
#

Lou is proud

little raptor
drifting portal
little raptor
#

it doesn't meowsweats

granite sky
#

remoteExecutedOwner shenanigans maybe :P

drifting portal
#

but yeah

#

I'm more worried

#

if it will ddos the server

#

or cause too much traffic

#

like if a player goes afk?

little raptor
granite sky
#

It's not really much compared to what clients normally send.

little raptor
#

a server is receiving thousands of more messages

drifting portal
#

idk man people always beat me to a pulp whenever I use remoteExec lol

granite sky
#

It's not ideal either :P

#

but I'm not sure you have a better option.

little raptor
granite sky
#

This is a dialog that most people wouldn't have open all the time, right?

drifting portal
#

everytime you go to escape menu it shows you the dialog

granite sky
#

yeah that's probably the best approach then. Other than making a function for it.

drifting portal
#

I will make a function why not

#

sqf file?

granite sky
#

blinks

drifting portal
#

I keep committing atrocities it seems

#

i never used cfgFunctions before

#

if that what is it called

#

that's what you are referring to right?

granite sky
#

You should really start :P

drifting portal
#

yeah of course I'm just making sure

granite sky
#

well, you can also just do some abomination like TAG_myServerFunc = { //trash code goes here } on the server

#

and then [player] remoteExecCall ["TAG_myServerFunc", 2] called from the client will work.

#

but CfgFunctions is your friend.

drifting portal
#

yeah I will use that then

#

trying to minimise the minor ddos

#

cfgFunctions sounds good

tight cloak
#
_commonContainers = entities "Land_WoodenBox_F";
{
    _loopCount = [1,12] call BIS_Fnc_randomInt;
    for "_1" from 0 to _loopCount do {
        private _lootCommon = selectrandom [
    "ACE_WaterBottle",
    "ACE_WaterBottle_Half",
    "ACE_WaterBottle_Empty",
    "ACE_tourniquet",
    "ACE_Sunflower_Seeds",
    "ACE_SpraypaintBlack",
    "ACE_SpraypaintBlue",
    "ACE_SpraypaintGreen",
    "ACE_SpraypaintRed",
    "ACE_MRE_BeefStew",
    "ACE_MRE_SteakVegetables",
    "ACE_MRE_MeatballsPasta",
    "ACE_MRE_LambCurry",
    "ACE_MRE_CreamTomatoSoup",
    "ACE_MRE_ChickenHerbDumplings",
    "ACE_MRE_ChickenTikkaMasala",
    "ACE_MRE_CreamChickenSoup",
    "ACE_Can_Spirit",
    "ACE_Can_RedGull",
    "ACE_Can_Franta",
    "ACE_Banana",
    "ACE_elasticBandage",
    "WBK_survival_weapon_2",
    "Crowbar",
    "Bat_Clear",
    "Pipe_aluminium",
    "WBK_axe",
];
        _x addItemCargo _lootCommon;
    };
    systemchat format ["%1 containers remain", _loopCount];
} forEach _commonContainers;

error line 45 - the ]; above _x additemcargo _LootCommon;
error: missing [
any ideas?

open fractal
#

also is this for MP?

tight cloak
#

ty for the help, will test

open fractal
#

if it's a lot of containers you may want to have this execute from an event handler instead of a loop

flat sluice
#

Anyone have a good script or method to mass export all weapon class names from the arsenal? Currently have a script running a configClasses search on CfgWeapons but its taking way too long to execute. Can be BI or ACE arsenal.

#

My current script which isn't quite working for reference

private _classes = "(configName _x) isKindOf ['Rifle', configFile >> 'CfgWeapons']" configClasses (configFile >> "CfgWeapons"); 
private _result = []; 
 
{ 
    _result pushBackUnique (configName _x); 
} forEach _classes; 
 
_result
#

Actually nvm it just randomly worked

little raptor
#

the names are unique anyway

#

you're just wasting computation time

#

in fact you don't even need pushBack and forEach

#

you can just do apply

#
private _result = toString {
  getNumber (_x >> "scope") >= 1 && 
  {(configName _x) isKindOf ['Rifle', configFile >> 'CfgWeapons']}
} configClasses (configFile >> "CfgWeapons") apply {configName _x}
flat sluice
#

Interesting to note. I've generally stayed away from apply due to how unreadable it is, but I'll keep it in mind. Script took about 3 seconds for all primary rifles in my unit's modpack so I'm willing to deal with that since I'm just copying their classnames into a file. If I was running this on init I'd definitely follow that apply format though.

cosmic lichen
#

How is it less readable than forEach?

flat sluice
#

AFAIK, no major programming language has an apply function or similar function.

#

It's just poorly designed in terms of usage IMO

little raptor
little raptor
#

SQF is dynamically typed. being able to readily transform array elements comes very naturally to it

#

and btw many "major programming languages" have a transform function for arrays

#

which is almost like what apply does (except apply creates a new array)

steady minnow
#

Good time of day.I'm new to scripts.Tell me how to make a check whether an object with a certain classname is alive on the map?Thank you for the answer.

tight cloak
open fractal
#

alright. personally I think it's cleaner to run that calculation as-needed when a player accesses an inventory but if it works it works

copper raven
drifting portal
#

is there a way to know since how long the mission started?

granite sky
#

time ? :P

#

(see also serverTime)

drifting portal
#

I checked both

#

isn't time for when a player joins?

#

for example if he joins in the middle of the mission it will be 0 for him?

#

or is that a wrong understanding?

granite sky
#

Probably correct. That's what serverTime is for, if you want to know when the mission started on the server from a client.

tight cloak
#

Didn't think of that

#

But if I do, I'd have to find a way of preventing that crate from having itself be refilled everytime it's opened

open fractal
#

You can set and broadcast a variable on the crate

tight cloak
#

I could tag it with a variable then run a check maybe

open fractal
#

and add a check to the inventory event handler

#

yeah

tight cloak
#

Ty for the idea

open fractal
#

I've done something similar with inventoryOpened

#

it works so long as you return true to override the inventory opening when you add the items and use spawn to give the player a inventory open action with a very short delay so the items show up in the inventory

#

otherwise it'll appear empty the first time

tough abyss
#

this script is supposed to spawn loot from _weaponpool at _buildingPosition ive debugged it a bit but its no longer giving me an error any ideas? or obvious things ive failed? ```sqf

[]spawn{
spawnLoot = true;
while{spawnLoot}do{
_magazineArry = [1, 2, 3, 4];
private _buildings = [];
private _buildingBlacklist = [''];
private _weaponPool = [''];
_weaponPool = "
getText (_X >> 'dlc') isEqualTo 'CUP_Weapons'
" configClasses (configFile >>"CFGweapons");
_buildings append (nearestObjects [player, ["house"], 50]);
_rifle = configName (configFile >> "CFGweapons");
{

     _buildingPosition = [_x] call BIS_fnc_buildingPositions;
     
        {
                _rifle = _weaponPool call BIS_fnc_selectRandom;
                _magazineCount = _magazineArry call BIS_fnc_selectRandom;
                _holder = "WeaponHolder" createVehicle [0,0,0];
                _holder setPos _x;
                _holder addWeaponCargoGlobal [_rifle, 1];
                _wepMagazines = getArray (configFile >> "CfgWeapons" >> (configname _rifle) >> "magazines");
                _holder addMagazineCargoGlobal [_wepMagazines, _magazineCount];
        } forEach _buildingPosition;
    }foreach _buildings;
};

};

drifting portal
open fractal
#

_rifle = selectRandom _weaponPool;

#

you should add diag_log lines to see where your script is going wrong

open fractal
#

why is this in a while loop

#

you can print the arrays to rpt

tough abyss
#

its in a while loop so it happens multiple times with near buildings

tough abyss
#

and also so it can be stopped

open fractal
#

pain

#

you can use your spawn return to stop the script

#
_script = [] spawn {//code};
terminate _script;
#

your code is a little nonsensical

#

I'm having a hard time deconstructing what you're trying to do

tough abyss
#

im trying to get weapons in cup then spawn them in points with mags

open fractal
#

you want to create a weaponholder in every position in every building and repeat this action multiple times per second?

tough abyss
#

no

#

wait does it do that

#

oh

#

oh no

open fractal
#

you wrote while {true} dude

tough abyss
#

shit

#

brain smoll

#

should i remove while () do {} completly?

open fractal
#

you want it to dynamically spawn loot in buildings as the player approaches them right?

tough abyss
#

yes

open fractal
#

you can use a loop for that but do it more conservatively

#

add sleep so the game isn't constantly trying to execute your instructions

#

and put as little in the loop as possible

#

set variables on buildings and add a check to ignore the buildings that have already been done

tough abyss
#

would i check with nearentities

#

or just when it creates the weapon holder it moves it to another list

open fractal
#
if !(_building getVariable ["ncl_lootCreated",false]) then {
//create loot
_building setVariable ["ncl_lootCreated",true];
}
#

I think this works with terrain objects

#

this way you can have your loop skip over a building with minimal processing

#

BIS_fnc_buildingPositions is outdated as well. use buildingPos

tough abyss
#

just make it _buildingPosition = buildingPositions [_x]; right?

open fractal
#

buildingPositions was a typo it's buildingPos

#

and no

#

use the wiki

#
_magazineArry = [1, 2, 3, 4];
_magazineCount = _magazineArry call BIS_fnc_selectRandom;
``` this is unnecessary you can do 
```sqf
_magazineCount = ceil random 4;
``` to get a random integer
open fractal
tough abyss
#

could i do _buildingPosition = _buildings player buildingPos ;
or would i have to do
_buildingPosition = nearestbuilding player buildingPos ;

#

because the 2nd one seems to only be for one

winter rose
open fractal
#

are you reading the wiki?

tough abyss
#

i read nearestbuilding because visual code sent me there 🤦‍♂️

open fractal
#

that part's fine

tough abyss
#

wait

#

i confused myself

#

i think i got it from buildingpos

#

yeah i did

#

ok so ive got this now


_spawn = []spawn{
if !(_building getVariable ["_lootCreated",false]) then {
           _magazineArry = ceil random 4;
        private _buildings = [];
        private _buildingBlacklist = [''];
        private _weaponPool = [''];
            _weaponPool = "
             getText (_X >> 'dlc') isEqualTo 'CUP_Weapons'
            " configClasses (configFile >>"CFGweapons");
             _buildings append (nearestObjects [player, ["house"], 50]);
            _rifle = configName (configFile >> "CFGweapons"); 
        {
         _buildingPosition = _X player buildingPos -1;
            {
                    _rifle = selectRandom _weaponPool;
                    _magazineCount = _magazineArry call BIS_fnc_selectRandom;
                    _holder = "WeaponHolder" createVehicle [0,0,0];
                    _holder setPos _x;
                    _holder addWeaponCargoGlobal [_rifle, 1];
                    _wepMagazines = getArray (configFile >> "CfgWeapons" >> (configname _rifle) >> "magazines");
                    _holder addMagazineCargoGlobal [_wepMagazines, _magazineCount];
            } forEach _buildingPosition;
        }foreach _buildings;
    _building setVariable ["_lootCreated",true];
    }
};  

open fractal
#

you're setting a variable on _building which is undefined

#

and you're calling a selectRandom function on an integer

#

which was already randomly selected and is also not an array

#

I presume _weaponPool can be defined at mission init and doesn't need to be defined in here

#

or at least outside of any loop

tough abyss
#

yes

open fractal
#

that should be fine right there as long as you don't put it inside a loop

tough abyss
#

ok

open fractal
#

I don't know if your config stuff is correct so im just going to skip over it

tough abyss
#

ive tested it with hint str and it was for what i was after

open fractal
#

ok

#
    _building setVariable ["_lootCreated",true];
``` I wrote the tag in front for a reason
#

you only start local variables with a _

tough abyss
#

oh my b

#

Nested loops o(n^2)

#

How often is that script run @tough abyss ?

open fractal
#

it was in a while true loop with no sleep earlier so we're taking baby steps here

tough abyss
#

Find a way to use forEachIndex with your loop

#

yeah im stupid

#

And eliminate the forEach nesting

open fractal
#

what's wrong with forEach nesting?

tough abyss
#

o(n^2) complexity?

#

Increases runtime a lot...

little raptor
#

it's going thru all building positions in all buildings

open fractal
#
_holder addMagazineCargoGlobal [_wepMagazines, _magazineCount];
``` in case I forget to point it out `_wepMagazines` is an array so the command won't work
little raptor
#

also:

_holder = "WeaponHolder" createVehicle [0,0,0];
pretty sure it should be GroundWeaponHolder

tough abyss
#

yeah i was very confused because there is around 6 (i think) weapon holders

open fractal
#
nucle_spawnLoot = [] spawn {    
    while {true} do {
        sleep 5; 
        private _buildings = nearestObjects [player, ["house"], 50];
        {
            private _building = _x;
            if !(_building getVariable ["art_lootCreated",false]) then {
                _buildingPosition = _building buildingPos -1;
                {
                    private _pos = _x;
                    private _rifle = currentWeapon player;
                    private _magazineCount = ceil random 4;
                    private _holder = "GroundWeaponHolder" createVehicle [0,0,0];
                    _holder setPosATL _pos;
                    _holder addWeaponCargoGlobal [_rifle, 1];
                    private _magazine = currentMagazine player; 
                    _holder addMagazineCargoGlobal [_magazine, _magazineCount];
                } forEach _buildingPosition;
                _building setVariable ["art_lootCreated",true];
            };
        } forEach _buildings;
    };
};  
```this works for me
little raptor
#

_holder setPosATL _pos;
_pos is AGL

open fractal
#

i just got the loop working havent thought about optimization

little raptor
#

tho I doubt he's placing the building on water so probably doesn't matter here

open fractal
#

that was my thought

#

the groundweaponholders tend to float a little bit above and below the floor

little raptor
#

_building setVariable ["_lootCreated",true];
also a fair warning about this one: terrain objects are streamed

#

so that variable will be cleared and you can't be 100% sure that you won't spawn the loot twice

open fractal
#

that is a fair warning

#

what do you think would be a good alternative? logging building position?

little raptor
#

try the scripted one

open fractal
tough abyss
#

i saw one where a person created a vr cube attached the holder to it then deleted it would that work?

#

given it was an older script

little raptor
#

building positions are slightly above ground

#

doing this kinda fixes it:

_pos = AGLToASL _pos;
_holder setPosASL _pos;
_pos set [2, _pos#2 - getPos _holder#2];
_holder setPosASL _pos;
#

but still since the roadway LOD is above the geometry LOD it's still a bit floating

#

ah wait it was this holder:

"WeaponHolderSimulated_Scripted"
#

that one falls to the ground (looks the same as what the above code gives, so still a bit floating)

open fractal
#

huge

#

but there is a problem

#

in some buildings the simulated weaponholder spawns under the floor and glitches out

little raptor
#

you can use the getPos trick above 😛

open fractal
#

about to check that with the problem buildings

little raptor
#

though you don't need that trick anymore

#

lineIntersectsSurfaces supports the roadway LOD now

#

you can just do:

_inters = lineIntersectsSurfaces [_pos vectorAdd [0,0,1], _pos vectorDiff [0,0,1], objNull, objNull, true, 1, "ROADWAY", "GEOM"];
_pos = _inters param [0, []] param [0, _pos];

(_pos must be ASL)

open fractal
#

oh gosh

open fractal
#

for some reason they all float at an angle

#

but setDir resolves that

#

I'd go so far as to say this is the move

little raptor
open fractal
#

I'd probably end up doing a random setDir for all of them anyway

little raptor
#
_inters = lineIntersectsSurfaces [_pos vectorAdd [0,0,1], _pos vectorDiff [0,0,1], objNull, objNull, true, 1, "ROADWAY", "GEOM"];
if (count _inters > 0) then {
  _obj setPosASL _inters#0#0;
  _obj setVectorUp _inters#0#1;
} else {
  _obj setPosASL _pos;
};
open fractal
#
_pos = AGLToASL _pos;
_inters = lineIntersectsSurfaces [_pos vectorAdd [0,0,1], _pos vectorDiff [0,0,1], objNull, objNull, true, 1, "ROADWAY", "GEOM"];
_pos = _inters param [0, []] param [0, _pos];
_holder setPosASL _pos;
_holder setDir (random 360);
``` this looks great on my end
#

leopard magic

open fractal
#

also @tough abyss ```sqf
nucle_spawnLoot = [] spawn {
art_iteratedBuildings = [];
while {true} do {
sleep 5;
private _buildings = nearestObjects [player, ["house"], 50];
{
private _building = _x;
if !(_building getVariable ["art_lootCreated",false]) then {
_buildingPosition = _building buildingPos -1;
{
private _pos = _x;
private _rifle = currentWeapon player;
private _magazine = currentMagazine player;
private _magazineCount = ceil random 4;
private _holder = "GroundWeaponHolder" createVehicle [0,0,0];
_pos = AGLToASL _pos;
_inters = lineIntersectsSurfaces [_pos vectorAdd [0,0,1], _pos vectorDiff [0,0,1], objNull, objNull, true, 1, "ROADWAY", "GEOM"];
_pos = _inters param [0, []] param [0, _pos];
_holder setPosASL _pos;
_holder setDir (random 360);
_holder addWeaponCargoGlobal [_rifle, 1];
_holder addMagazineCargoGlobal [_magazine, _magazineCount];
} forEach _buildingPosition;
_building setVariable ["art_lootCreated",true];
};
} forEach _buildings;
};
};

tough abyss
#

k thx

little raptor
#

maybe using a hashmap is better

tough abyss
#

^

open fractal
#

thonk definitely more efficient

tough abyss
#

Thats what I meant by the o(n^2)

little raptor
#

I have added it there

little raptor
#

it's storing the variable on the _building object

#

setVariable is still a hashmap (O(1))

#

the problem was the streaming

open fractal
#

could the building's pos be used as a key?

little raptor
#

yes

#

in v2.10 its ID can be used too

#

see getObjectID

open fractal
#

2.10 isn't out yet is it

#

in stable

little raptor
#

no

drifting portal
#

like in the mission

winter rose
#

not out of the box, no
use SQS and _time maybe

little raptor
#

e.g. put joinTime = time in initPlayerLocal

#

then total play time is time - joinTime

drifting portal
#

but that works too

drifting portal
#

and returning the value?

winter rose
#

meaning?

drifting portal
#

like making a function which a client remoteExec on the server, then the server returns time as a public variable

winter rose
#

how do you do a remoteExec return something 🙃

#

because yes, the server can be the authority on that too

drifting portal
little raptor
#

even if it was why would it matter?

drifting portal
#

Doesn't it update/sync every 5 minutes?

little raptor
#

that's serverTime afaik

#

time is just client's time

drifting portal
#

and if someone joins 3 minutes after the mission started

#

time should be = 180?

little raptor
#

¯_(ツ)_/¯

#

probably

#

why does it matter what time is?

#

just fix your datum

drifting portal
winter rose
#

time may be 0 on JIP for the first seconds

#

or, like, 0, 1, 2, 3, 4, 5, 6, server update, poof 5128

drifting portal
#

guess its time to use diag_tickTime then

cobalt path
#

Question is there a way to make a jet be able to take a few missiles before going down? Like to delete first few missiles that would hit or smth

little raptor
#

something like this

cobalt path
#

Thanks, I will check it out

hallow mortar
#

What dictates the order of sub-arrays returned by a HitPart EH (https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HitPart)?
Specifically, I'm asking about the case of a hit from a weapon that could deal both direct and indirect damage to the same target (e.g. HEAT). Would the first sub-array always be the initial direct hit, or are the sub-arrays sorted in a different way that could result in the indirect damage being the first result?

glossy pine
#

@little raptor where are the watch vars saved on your Advanced Developer Tool addon ?

little raptor
#

what do you mean where?

glossy pine
#

i mean, they are saved in profilenamespace or? i have something in a watch field that shouldnt be there 😄

little raptor
#

yeah meowsweats

little raptor
open hollow
#

someone knows how the trigger area is made in 3den? i mean, i made this mod (https://steamcommunity.com/sharedfiles/filedetails/?id=2585755302) to see, activate or delete triggers with zeus, where the only way to see the triggers, is with a marker on the map, but ill love to do it in 3d too, like in the editor.

Any ideas on how to do it? 😅

little raptor
glossy pine
#

xD

little raptor
#

I thought you meant a watch field wasn't deleted. that one's on you 😅

glossy pine
#

ye mb

open hollow
#

that will fix it /s

open hollow
little raptor
#

it creates a UI model

#

how's that gonna solve your problem?

#

you can create your own model and spawn it in the game, but you can't resize it exactly like 3DEN. you can only scale it (total scale, not individual components)

open hollow
open hollow
little raptor
#

not just that

#

e.g. you can't scale a circle to get an ellipse

open hollow
#

yea, so close 😦

hallow mortar
#

You could probably use drawLine3D to visualise the trigger area. Hell of a lot of maths to get it right though

little raptor
#

but i guess something like that is on the editor.
no. 3DEN doesn't use UI. it spawns a 3D model in the world

#

drawIcon3D might work for you tho

#

create 2 images

#

one rectangle

#

one circle

open hollow
little raptor
#

but no rectangle one won't work meowsweats

#

it becomes a parallelogram on screen
not just that but also the circle one won't be an ellipse, because it's perspective view, not orthogonal

open hollow
#

yea

#

well that things hunt me in my dreams for a while now...

little raptor
#

Arma doesn't have drawLine2D but you can create rscLine ctrls instead

vocal trout
#

Hello! Is there a way to make the Edit Terrain Object module operate locally? I can't seem to make it work on MP scenarios when I use more than 3

little raptor
#

it depends how the module's function works. I'm not in the game to check that for you but I'm gonna guess no

open hollow
#

Yea ill try at least to see what happen

agile pumice
#

how do I use the ingame config search to only look in a certain parent class? say if i only wanted to search cfgWeapons classes?

#

game keeps crashing

warm hedge
#

How did you do that?

agile pumice
#

config viewer search config option

#

threw in a p3d name and it memory crashed part way through searching cfgvehicles

winged summit
#

Is there any way to get the animation source code for the animations I've got playing in game.
Trying to do star wars op with animations for the ending but the animation runs extremely slowly/laggy due to networking, if I put the code into the mission file and have it there to be executed locally for everyone then I believe that would fix this problem, just not sure how to get the code.

open fractal
#

I've never encountered your laggy animation issue

#

how are you playing the animations?

winged summit
#

So I'm using keyframes with the ships to move them into position, unhiding them with a script and executing the animation. I'd execute the script using the debug console in-game and it's laggy no matter if I do it globally or using the server button. However, whenever I do this or a friend does this in singleplayer (or not over a network), it won't be laggy and would work perfectly.

open fractal
#

ok but what's the script

worthy igloo
#
    while {SCS_Active == true} do 
    {
      sleep 2; 
      [channel69, {_this radioChannelAdd ([leader player] + call BIS_fnc_listCuratorPlayers)}] remoteExec ["call", [0, -2] select isDedicated, channelCommand];    
    
      if (allowedChan = false) then 
      {
      sleep 2;
      channel69 radioChannelRemove [player];
      };
    
    };

does any know why this doesnt work

warm hedge
#

= is to declare == is to compare

open fractal
#

== true is redundant

#

it won't break your script it just doesn't need to be there

worthy igloo
#
    while {SCS_Active = true} do 
    {
      sleep 2; 
      [channel69, {_this radioChannelAdd ([leader player] + call BIS_fnc_listCuratorPlayers)}] remoteExec ["call", [0, -2] select isDedicated, channelCommand];    
    
      if {allowedChan = false} then 
      {
      sleep 2;
      channel69 radioChannelRemove [player];
      };
    }; 
``` I get generic error now
stable dune
warm hedge
#

Boolean == true is not an error since the last update AFAIK tho

stable dune
#

Skekuwu had while {SCS_Active = true} do ..
Not ==
Or SCS_Active

open fractal
#

you changed it to = true (?)

#

while {SCS_active}

proven charm
#

can you detect windows via some intersect command?

warm hedge
#

If you use Mac/Linux, you can't
Yes windows should have Fire Geometry

proven charm
warm hedge
#

Good question, I don't think there is a very straightforward solution

proven charm
#

ok

warm hedge
#

Or, perhaps use intersect and see if the selection name has glass in it

proven charm
warm hedge
#

I guess?

proven charm
#

not shooting anything

warm hedge
#

No, you could make a small bullet and try to hit it

proven charm
#

hmmmm

warm hedge
#

Also probably HitPart EH allows you to disable the damage?

#

Forgot if it is a case for it

proven charm
#

thats quite extreme

warm hedge
#

I think this is the only way to detect bisurf

proven charm
#

intersect works for some windows but not all

warm hedge
#

Can you name which window of which building don't work?

proven charm
#

wait I think powerline object is interfering

#

yep works now, it was powerline that was messing things up

warm hedge
#

Gud gud

little raptor
#

Tho it does apply to units too in Arma 😅

warm hedge
#

Just a showerthought but it would be great if lineIntersectsSurfaces return bisurf too

little raptor
#

It does now

warm hedge
#

Does it?

little raptor
#

I beat you to it

warm hedge
#

Think wiki forgots it

little raptor
warm hedge
#

Lovely. I'll write the wiki

proven charm
#

that would actually be ideal for me because I need building wall and window collisions

#

intersect only gets selections

little raptor
warm hedge
#

Das why

little raptor
#

anyway it returns 2 more things

warm hedge
#

I'm writing biki whatsoever

little raptor
#

selection name and bisurf path

formal stirrup
#

Is there a way to detect a type of unit being placed to automatically execute code on it?

formal stirrup
#

No way to do it with triggers?

winter rose
#

I was asking if it was a Zeus-placed case

formal stirrup
#

Yes, or also spawning via scripts

winter rose
#

ah, then I believe an event handler is coming… next patch

formal stirrup
#

so wait a little?