#arma3_scripting
1 messages · Page 777 of 1
you mean you only want the markers that are local to you?
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.
do your marker names follow a certain pattern?
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.
well no that won't be helpful
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"
if your only concern is running allMapMarkers every frame, just update them via event handlers
Is there a marker placed EH?
I actually forgot that this exists 😓
This is the sort of compass I am making which is
DESCRIPTION: Generates a lightweight and fully customizable compass ui on your screen resembling the one from battlegrounds. Easily place your markers on the map and they will update on everyones compass. Here is an example video. Preview the script || mod at YouTube or Gfycat. Customization opti...
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.
If Im picturing what you want to do correctly here, I believe I've done the exact same thing before, except I used allMapMarkers
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.
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)
You need to check inThisList
find the vehicle and find if the object in this list is inside the area of a trigger
im using a premade script rn (i dont know the most of scripting rn)
this and ((getPos (thisList select 0)) select 2 < 1)
is the script it uses
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)
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
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?
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
so for this would i put it on a seperate marker or just the trigger?
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.
not really but never hurts to learn XD
_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?
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.
Aha... Nope. Now it's named based on the position of the ambulance
It's now called "E of Bay Dunes"
IS the AI named Ambulance?
Not the vehicle?
No
The vehicle is named Ambulance
are u spawning in it or out of it
I don't understand how this would make any difference, I want to rename what the spawn is called
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
well the code is wrong. you wrote player in call BIS_fnc_listCuratorPlayers; which returns a boolean
and _zeuss is undefined in what you're remoteExecing
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];
didn't mean how "you" would do it lol was just asking how do you mention it but thank you
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
for that typeOf works
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
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
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?
? that still doesn't solve the custom building position problem
AI can only walk along path LODs
the CBA_building pos is just a dummy object, in theory it could be anything
do you place them exactly at predefined building positions?
any XYZ pos would work. in game the positions are behind some trenches in the open
grad trenches
that's what I'm telling you. it doesn't work
AI can't move to wherever you want
even if there is no actual building blocking them? like, the position in question is right there on the terrain itself
ok I see what you mean now
this is the thing
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
damn, what if made the trenches simple objects? (and log piles)
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";
null = not needed for a while not
what do you mean by "set a trigger's condition" ?
The condition of the trigger. So I have a trigger, it's condition currently is false. I want to change this to true via the SQF.
During the game.
use setTriggerStatements, but… why putting code in a trigger then 🤨
Look mate, I'm not the smartest when it comes to this type of stuff so bare with me 😂. It's not the most effective way to do this ik but it's just how i've done it. How would I implement setTriggerStatements into the sqf?
private _triggerStatements = triggerStatements _theTrigger;
_triggerStatements set [0, "true"];
_theTrigger setTriggerStatements _triggerStatements;
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.
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
put a bool in the triggers activation field, have that bool be false at the start of the mission, then at code start of hold action make that bool true
Ok thanks a billion!
also don't make a habit of using triggers for everything
Ok is there a better way to implementing it during the Code Start
yes by putting the trigger's code for the alarm in code start
Ok (can I find that here ? https://community.bistudio.com/wiki/Eden_Editor:_Trigger#Trigger_Owner)
of course you need to do two things
- 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
LOL gotcha and where does the mission start bool go?
Awesome yeah I just wanted to make sure
Generally the best way to use setVelocityTransformation is to call it in an EachFrame mission event handler with an updated interval value (0-1) each time.
oh
You can pre-build the args and pass them in, and then it's a cheap EH.
can you tell me more about the interval?
0 - object is at the start pos, 1 - object is at the end pos.
0.5 - in the middle :P
hmm
You can use it in a while loop with short sleeps instead, but that goes to hell when something else is lagging scripts.
If I want the plane to cross 4kms in 25 seconds, how would I do that
I'm trying to think of a ratio
maths
yeah
That's 160 metres per second, so set the forward velocity to that.
In setVelocityTransformation? No, it's world space.
Well, it kinda will, because the velocity inputs are only used for MP interpolation.
I will use this in MP yeah
but it'll look wacky as hell between updates :P
so setVelocityTransformation is not good for MP?
It's fine but you should set the velocity components to something sensible.
Like here it could be _startPos vectorFromTo _endPos vectorMultiply 160
yeah
that's a good idea
let me try it and fail miserably and come back
lol
well yeah
it having a spasm (NVM)
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?
what is the problem?
Its not working but I am not sure why
As I did what I am used to doing I feel like its not right
what did you do?
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
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.
fixed it so nvm
ahhh okay is there an easier way to make a sound spawn?
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)
Totally understand that!
So how do I make that sound spawn after flipping compbool to true then deleting it upon the completetion?
playSound3D
store the result of https://community.bistudio.com/wiki/playSound (see examples, the 2.00 part) and then use it with https://community.bistudio.com/wiki/deleteVehicle
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"
AKA Dev-Branch only so far
Stupid question (sorry), but if I implement this will players that are not using dev-branch be able to use the mod?
The mod?
I am building a mod with several functions in it, amongst them I would like to add some code when an enemy is detected
Yes everyone needs Dev-Branch. Until 2.10 hits the stable
uuh
ok
Thank you!
Any idea how i could do a workAround to get the same result?
(some code executed on 'enemy spotted')
I can think up something but never recommended. Because it is performance unfriendly
I am guessing a loop
EachFrame more like
store near-targets and look for a change?
Guess so
yah
I wouldn't try workaround and just tell them to try Dev BTW
Good luck then
better not publish it until 2.10 is out. you wouldn't believe how many people can't read... 
LMAO! I have noticed ho many people cannot watch a 2 min video, so I can imagine the reading skills are even worse
https://sqfbin.com/lijuduviyevorahagawi
in this function, is there a way I can return the _Cargo object without waiting for the while loop?
Spawn the while loop?
it won't affect the performance much right?
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?
Both select 0 in at Time.sqf
["_timeOfDay", "_shorternight"] call compile preprocessFileLineNumbers "scripts\time.sqf";
should be
[_timeOfDay,_shorternight]
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.
I got there, cheers 👍
if you need it outside the function why do you create it in the function?
if you want to keep your code you have no other choice
but again, you should just create it outside that fnc
_Cargo = createVehicle [_cargoClassName, [0,0,0], [],0,"NONE"]; literally pass the _cargo (create it in the calling function) itself instead of _cargoClassName to the function
I will go with that since it works the same
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.
//Dressup
_this call HR_fnc_dressUp;
``` where is this located?
Coint_Back.Altis/Functions/Players/fn_dressUp.sqf
i mean the code
where is that code located
init.sqf or initPlayerLocal.sqf
this does not line up with what you have written
Oh, in initPlayerLocal.sqf
initPlayerLocal.sqf automatically passes an array with both the player object and JIP boolean
Anyone know what the fastest way to get the closest road to a position is?
so _this returns [player object, true] for example
is that addressed in the script you're calling?
BIS_fnc_nearestRoad exists but I don't know how fast it is, so I guess I'll do some tests
What do you mean by addressed?
Sorry not the one who wrote the script, so don't know too much about it 😅
What are the instructions the author gave to call the script?
You're passing an array to the script, it might be looking for an object
/*
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;
interesting, it does take the array
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
try putting it in onPlayerRespawn.sqf
This line you mean I assume?
yeah
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.
try adding a systemChat or diag_log line at the top to see if the script is being called
👍
Will hint work too?
diag_log is your best bet
just check the rpt
hint or systemchat may not work during init stage
Okie Dokie
if (alive HELI_2 && HELI_2 emptyPositions "Cargo" > 0) then {
_unit moveInCargo HELI_3;
``` there's a typo here
Just to confirm, you meant my own RPT or the server's RPT? cause I have logging turned off for my self.
should be yours since the code is called on the client
Ah need to enable that if SystemChat doesn't work then
Use nearestRoads?
Sorry I meant nearRoads
@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?
this should be resolved by using onPlayerRespawn.sqf
Weird, cause the function call is already there.
//FF
if (hasInterface) then {
[player] call FFPP_fnc_punishment_FF_addEH;
};
//Dressup
_this call HR_fnc_dressUp;
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
Will test that.
respawnOnStart is -1
I gotta change it to 0 I believe
this blocks respawn on start and respawn script
Yep just looked up the documentation.
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?
the systemChat str _this; worked
in onPlayerRespawn.sqf
but still was not teleported to helicopter
is the helicopter named HELI_1
if you do systemChat str _list1; after this what does it give you
even aborting and rejoining doesn't work anymore :(
Yep
Will have to try this 1 sec
Testing it on a dedicated server so have to boot it off and on :L
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;
including the params?
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
if this doesn't work then you should probably enable logs and log a bunch of stuff
huh, wait, why does it _unit = _jipOrNewUnit if the _jipOrNewUnit == objNull
thats what I just caught
the author must've thought onPlayerRespawn is [_oldUnit,_newUnit]
Nomas, how the hell did that script work in the past missions?
Ma man, the script is made to dress up people not teleport them into a helo xD
it would work with initPlayerLocal
Even then it had some issues here and there
I guess that's what was causing issues then.
I think onPlayerRespawn is the cleaner method for applying loadouts as it happens last
Does ValidateObjects actually exist?
I need to clean our standard files pretty soon.
yes it had a return
that script is generally a mess if you haven't caught on
I can see that.
It just removes the unexisting objects from the array so there is no error pop up I think?
If you are doing a lot of what you are doing why not generalise the script to parameters?
If you know what I mean?
I don't see the point of ValidateObjects there
you can test vehicleVarName against that array of strings
Yeah using array in somevar
Those files were unchanged for years, we really need to update them, better sooner.
the whole gang here
For the sake of the script author, he did exactly what I asked from him, the mess is on me for using it for a purpose it wasn't made for xD
I mean, TS?
Something also that makes this much harder is the lack of comments.
Comments are you friend.
Not today, too tired xd
Okie xD
Well there is a massive comment at the top
/*
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
*/
Thats called a function comment block header
Ah a'ighty
Not really a "comment"
I use C++ version of a comment block generator with A3
In Visual studio code
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;
@open fractal Your script magic works, I love you xD
still dont know why initPlayerLocal didnt work
//**======================
** FUNCTION NAME
*@param name type
*@return type
*========================**/
Automatically generates comments
as curios as I am, it is also 2:14 AM, so that s a mystery for another day, you guys all have a good night ^
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
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
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
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.
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.
Ah sorry it should have been ||
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.
@granite sky I'm not going to give the entire answer.
You want to know If specific unit is assinged to vehicle?
Or crew from vehicle?
Neither. Groups have a vehicle pool:
https://community.bistudio.com/wiki/AI_Group_Vehicle_Management
Looking for programers
what is the parent class for Cars i tried car_f but it seems that even trucks are included and inherit from it
That's probably about as close as you're going to get. Trucks are functionally just large cars so there isn't any need for a separate parent class.
You might be able to check the textSingular config attribute instead: <#arma3_scripting message>
Wait a minute, that was an answer to you last time 🤔
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 ?
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.
ah i see, so do i have to define _vehicle, like objectparent player = _vehicle
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
oh cool, i think i understand i will try it
i changed truck with Car and when i get in a car it return false
it's case sensitive and checks against all-lowercase text. You must use "car" and not "Car".
hmmm, it still return false
for trucks it works but not for cars
When you made the changes to the script, did you save the file?
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;
wierd, what is "_generalMacro"
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.
ok i will try to contact him
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?
there are some invisible walls
i guess thats what you want
Alright I will have a look
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.
Uhh, why would you use this legacy 3D editor sqf?
elaborate please?
IDK how you'd get this sqf but seems like from an legacy 3D Editor, is very obsolete in the first place
I created this SQF in the Eden editor, and have made compositions previously using this method
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?
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.
So... I don't think it is reliable enough solution. I'd suggest this method instead, if you still have the composition in Eden
https://community.bistudio.com/wiki/getMissionLayerEntities
How many groups is that?
That too. Arma 3 only allows up to 144 IIRC groups in a time
maybe only ~55 here though :P
Maybe an rpt knows
nods
I could try putting all the code for the AI in it's own SQF and could see if that works.
RPT is your friend
!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.
I wouldn't be able to do that, I'm not experienced enough with scripting and all that to learn a new method. The only reason I know of this method I'm doing is because I was taught by some people along with a youtube video.
So to generate the errors I'm having with the RPT, should I execute the code in Eden or like a MP server?
Either
Or... the latest rpt already knows, I think
The method itself is simple enough, and reliable. I can give you some codes actually
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.
Should be on the server
{
_x hideObjectGlobal false ;
_x enableSimulationGlobal true ;
} forEach (getMissionLayerEntities "YourLayerName")#0 ;```
Of course this method needs the composition in the mission, and has to be in a layer in Eden
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.
Official servers?
Yes, official Zeus servers
So I believe that there may be issues that could occur from that, but I wouldn't be entirely certain.
I don't play MPs so wouldn't know how it would work, but...
Ah, that's why you're using this method
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.
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?
seconds
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
_objectsArray = entities "yourClassnameHere" (single classname)
_objectsArray = entities [["yourClassname1","yourClassname2"],[]] (multiple classnames)
entities "type" probably
ty ill give it a whirl
Because it uses isKindOf you might get unexpected results in some corner cases.
seen it just now, tried:
_allalive = entities [[], [], true, true];
systemchat format ["%1", _allalive];
as a test and it was pulling p3d files
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.
_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?
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.
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
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
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.
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
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 🤔
This is a client Respawn EH remoteExecCall'ing a logging function on the server?
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
Are you deleting the corpse in the same EH or what?
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)
Potentially faster than the remoteExecCall then?
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
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
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
What's the condition for deletion?
!isPlayer and then check if its within spawn area for instant deletion
Yeah, definitely possible then.
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
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)
Yeah, lobby units are created on server, respawned units are created on clients
wow ok
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
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.
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

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
Do you have the respawn points set to the correct side and have you enabled respawns in the settings?
You're going to need to share what you've tried
there's multiple ways of doing respawns
Describe it
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
Isn't that for respawn markers?
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
what is the best way to measure a player's ping?
getUserInfo
how did I forget that
thanks a lot
how do I know if a number is infinity ?
does getUserInfo actually return infinity?
or are you just guessing?
yes
it returns something like 1.67.... e+007
tried finite (((getUserInfo (getPlayerID player))#9)#1, it returns true
that's not infinity
you said it yourself
it returns true -> it's not infinity
ah alright
also that's wrong
what is the right one?
Bracket issues
Looks like you just clipped it though?
yeah
lost one off the end
that's good to know
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?
no
how do I fix it?
don't use while... 
getUserInfo is server exec
why do you even use it in there?
is that being called on the server?
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
it was correct
nvm
but the getUserInfo part is still wrong
what you just said
[[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
Ideally you turn that into a function :P
is proud
[{
Tro_PlayerPing = ((getUserInfo (getPlayerID _unit))#9)#1;
remoteExecutedOwner publicVariableClient "Tro_PlayerPing";
}
]remoteExec ["call", 2];
how will the game know what _unit is?
it doesn't 
remoteExecutedOwner shenanigans maybe :P
but yeah
I'm more worried
if it will ddos the server
or cause too much traffic
like if a player goes afk?
lol wat?
It's not really much compared to what clients normally send.
a server is receiving thousands of more messages
idk man people always beat me to a pulp whenever I use remoteExec lol
well you don't have any other choice now
This is a dialog that most people wouldn't have open all the time, right?
everytime you go to escape menu it shows you the dialog
yeah that's probably the best approach then. Other than making a function for it.
blinks
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?
You should really start :P
yeah of course I'm just making sure
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.
yeah I will use that then
trying to minimise the minor ddos
cfgFunctions sounds good
_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?
delete the comma after WBK_axe
also is this for MP?
did that and yes it is for MP, changed addItemCargo to the global version
ty for the help, will test
if it's a lot of containers you may want to have this execute from an event handler instead of a loop
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
well if you use pushBack instead of pushBackUnique it'll get faster
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}
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.
How is it less readable than forEach?
AFAIK, no major programming language has an apply function or similar function.
It's just poorly designed in terms of usage IMO
you can always create one in your "major programming language"
poorly designed?
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)
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.
its going to add it to them all, once. at the start as the mission boots then never again
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
wat? C# has LINQ Select, c++ has std::transform, i'm sure others have something similar aswell
is there a way to know since how long the mission started?
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?
Probably correct. That's what serverTime is for, if you want to know when the mission started on the server from a client.
That's actually a really good idea. I'll have a gander at it
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
You can set and broadcast a variable on the crate
I could tag it with a variable then run a check maybe
Same train of thought, I'll give it a whirl
Ty for the idea
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
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;
};
};
Only problem is client host might abort a mission then replay it, it will still count as if the mission kept running
stop using BIS_fnc_selectRandom there's a selectRandom command
_rifle = selectRandom _weaponPool;
you should add diag_log lines to see where your script is going wrong
elaborate please
its in a while loop so it happens multiple times with near buildings
and also so it can be stopped
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
im trying to get weapons in cup then spawn them in points with mags
you want to create a weaponholder in every position in every building and repeat this action multiple times per second?
you wrote while {true} dude
you want it to dynamically spawn loot in buildings as the player approaches them right?
yes
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
would i check with nearentities
or just when it creates the weapon holder it moves it to another list
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
just make it _buildingPosition = buildingPositions [_x]; right?
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
even better you can construct an array of the weaponholders spawned in the building and store it in a variable so they can be cleaned up later
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
time is for mission time (though: 1/ it gets reset on save load iirc, and 2/ it's incorrect for the first few seconds in JIP)
serverTime is for how long is the server up
Cc@granite sky
where are you finding this syntax?
are you reading the wiki?
i read nearestbuilding because visual code sent me there 🤦♂️
that part's fine
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];
}
};
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
yes
that should be fine right there as long as you don't put it inside a loop
ok
I don't know if your config stuff is correct so im just going to skip over it
ive tested it with hint str and it was for what i was after
ok
_building setVariable ["_lootCreated",true];
``` I wrote the tag in front for a reason
you only start local variables with a _
it was in a while true loop with no sleep earlier so we're taking baby steps here
Find a way to use forEachIndex with your loop
yeah im stupid
And eliminate the forEach nesting
what's wrong with forEach nesting?
how is he supposed to eliminate it when that's what the script needs?
it's going thru all building positions in all buildings
_holder addMagazineCargoGlobal [_wepMagazines, _magazineCount];
``` in case I forget to point it out `_wepMagazines` is an array so the command won't work
also:
_holder = "WeaponHolder" createVehicle [0,0,0];
pretty sure it should be GroundWeaponHolder
yeah i was very confused because there is around 6 (i think) weapon holders
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
_holder setPosATL _pos;
_pos is AGL
i just got the loop working havent thought about optimization
tho I doubt he's placing the building on water so probably doesn't matter here
that was my thought
the groundweaponholders tend to float a little bit above and below the floor
_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
that is a fair warning
what do you think would be a good alternative? logging building position?
dunno maybe it was GroundWeaponHolder_Scripted?
try the scripted one
same behavior
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
yeah you're right
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)
huge
but there is a problem
in some buildings the simulated weaponholder spawns under the floor and glitches out
you can use the getPos trick above 😛
about to check that with the problem buildings
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)
oh gosh
this one passes the stratis vibe check
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
well you can also extract the surface normal and apply it
I'd probably end up doing a random setDir for all of them anyway
_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;
};
_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
I'm going to go ahead and stop working on this but would creating a separate entity (game logic?) on the building's position and storing variables to it instead be a bad idea?
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;
};
};
k thx
yes
maybe using a hashmap is better
^
definitely more efficient
Thats what I meant by the o(n^2)
I have added it there
but the script is not searching for anything
it's storing the variable on the _building object
setVariable is still a hashmap (O(1))
the problem was the streaming
could the building's pos be used as a key?
no
well is there a way to know for how long a player has been in a game
like in the mission
not out of the box, no
use SQS and _time maybe
just track it yourself
e.g. put joinTime = time in initPlayerLocal
then total play time is time - joinTime
yeah thought of that but was more about diag_tickTime
but that works too
btw is it possible to get a correct time by running it on the server?
and returning the value?
meaning?
like making a function which a client remoteExec on the server, then the server returns time as a public variable
how do you do a remoteExec return something 🙃
because yes, the server can be the authority on that too
In case time is inaccurate on the client
wat?
even if it was why would it matter?
Doesn't it update/sync every 5 minutes?
just wanted an accurate display of time on the dialog I'm making
time may be 0 on JIP for the first seconds
or, like, 0, 1, 2, 3, 4, 5, 6, server update, poof 5128
guess its time to use diag_tickTime then
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
handleDamage event handler
something like this
Thanks, I will check it out
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?
@little raptor where are the watch vars saved on your Advanced Developer Tool addon ?
what do you mean where?
i mean, they are saved in profilenamespace or? i have something in a watch field that shouldnt be there 😄
yeah 
do this:
uiNamespace setVariable ["DBUG_expressions", nil];
profileNamespace setVariable ["DBUG_expressions", nil];
saveProfileNamespace
it will remove all of them
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? 😅
ok ty xD
if you have any repro steps let me know. I will try to fix the problem
not possible afaik
idk im tired and my brain decided to place ```SQF
setMousePosition [0.5, 0.5];
xD
I thought you meant a watch field wasn't deleted. that one's on you 😅
ye mb
remplace it with disableUserInput true;
that will fix it /s
wait, creating an https://community.bistudio.com/wiki/CT_OBJECT_CONTAINER you can change its size isnt it?
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)
placing it on screenToWorld position, and change its size, it will need to change on every frame, but i guess something like that is on the editor.
there is an object that looks like an trigger area
yea, cant stretch it on Z axis, you are right
yea, so close 😦
You could probably use drawLine3D to visualise the trigger area. Hell of a lot of maths to get it right though
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
damn, it will be a nice feature to have lol, but im the only one who will ever request this
but no rectangle one won't work 
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
well if you're happy with drawing lines on the screen you can create 2D lines
Arma doesn't have drawLine2D but you can create rscLine ctrls instead
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
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
Yea ill try at least to see what happen
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
How did you do that?
config viewer search config option
threw in a p3d name and it memory crashed part way through searching cfgvehicles
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.
animation viewer?
I've never encountered your laggy animation issue
how are you playing the animations?
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.
ok but what's the script
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
= is to declare == is to compare
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
if () , not in {}
and polpox earlier said that = is to declace and == is to compare.
while {SCS_active} do ..
if (!allowedChan) then ..
Boolean == true is not an error since the last update AFAIK tho
Skekuwu had while {SCS_Active = true} do ..
Not ==
Or SCS_Active
Which mod?
You misinterpreted what I said. You just write the Boolean variable, == true is redundant you can delete it entirely
you changed it to = true (?)
while {SCS_active}
can you detect windows via some intersect command?
If you use Mac/Linux, you can't
Yes windows should have Fire Geometry
ok but how do you check it's window that was intersect?
Good question, I don't think there is a very straightforward solution
ok
Or, perhaps use intersect and see if the selection name has glass in it
just found that command 😄
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HitPart
Alternatively, use this EH to get surface type so possible to check if it is a wall or a glass
I guess?
not shooting anything
No, you could make a small bullet and try to hit it
hmmmm
Also probably HitPart EH allows you to disable the damage?
Forgot if it is a case for it
thats quite extreme
I think this is the only way to detect bisurf
intersect works for some windows but not all
this is the code I have so far (only 90% of windows work): https://sqfbin.com/deyamesobejujurugage
Can you name which window of which building don't work?
wait I think powerline object is interfering
yep works now, it was powerline that was messing things up
Gud gud
Something that you can see thru but not shoot thru is a glass 
Tho it does apply to units too in Arma 😅
Just a showerthought but it would be great if lineIntersectsSurfaces return bisurf too
It does now
Does it?
I beat you to it
Think wiki forgots it
In 2.10
Lovely. I'll write the wiki
that would actually be ideal for me because I need building wall and window collisions
intersect only gets selections
looks like Dedmen forgot to write it in #community_wiki
Das why
anyway it returns 2 more things
I'm writing biki whatsoever
selection name and bisurf path
Is there a way to detect a type of unit being placed to automatically execute code on it?
Zeus?
No way to do it with triggers?
I was asking if it was a Zeus-placed case
Yes, or also spawning via scripts
ah, then I believe an event handler is coming… next patch
so wait a little?
