#arma3_scripting
1 messages Β· Page 79 of 1
No
alright
Aha, now I see, but the problem is - it returns the height of a terrain under player's feet, not what I need
huuuh it shouldn't? it should be modelCentre - modelLandContact
nooo wait
getPosATL π
try getPosASL?
Yes, I want a difference in height between model points (getPosATL and getPosWorld measure from different points of the model)
obj worldToModel ASLtoAGL getPosASL obj
that gives you the diff between land contact and center in model coords
you can then convert it to world using vectorModelToWorld
Thank you very much
getPosWorld from some model point.
center, [0,0,0]
which can be pretty much anywhere inside what? 30 meter box? Unless there's autocentering in play, in which case it should by roughly in the geometry center 
that wasn't even the question
I just realized that difference in model points to measure is not a 'bug', but a feature explicitly described in 'getPosWorld' doku 
And yeah, you can use 'getModelInfo' if you so want to know the difference in height between those points.
And for units it's 0, but for hellcat it's almost half its size
So my bad. Thanks for helping.
And yeah, you can use 'getModelInfo' if you so want to know the difference in height between those points.
it's actually a dynamic point
it varies as the object rotates
I have no idea how the game measures it tho
"the vertex in geometry LOD that's furthest down in this orientation" is the first guess 
maybe 
I have a script here that (I believe) needs to be called on every client with remoteExec '0', but it uses a while {true} loop and I'm worried it might impact performance quite heavily.
Could someone correct me if I'm wrong? It seems that calling it with '2' doesn't work on a dedicated server but I don't want to get there tonight and have 30 while loops spawn.
https://pastebin.com/UjdQRWGt
just remoteExec once log is added, no need for loop
Ah, the problem is that it's on a truck - it's free to move and I want it to be able to check for new logs around the area that might be spawned in.
Sorry I'm not sure if I'm misunderstanding something haha, I'm calling the entire script with remoteExec, and since it has the loop on it - I'm not sure if executing it technically more than once would result in poor performance.
ah having a loop in remexec code doesnt make it lag because only the times sent and how big the code is counts
Where are you remoteExecing it from?
That means you will not accidentally generate 30 instances of the loop (provided the trigger is not repeatable)
The trigger only activates once, on the server -> the server broadcasts the remoteExec once -> each client starts one local copy of the loop -> no problems
Alright, thanks for the explanation π
Didn't want a repeat of my last mistake haha
I trust this script is contained in a function which you're remoteExecing? Broadcasting the entire script as plain code would be...unwise
Yep, this is a function
π
It can't.
It only scales attached and simple objects.
Other objects are allowed in Eden for screenshot making needs, but outside Eden the command just does nothing
wait, why are people using the onEachFrame haxx then?
Good question.
The code is
if (isattached)
else if (is simple object)
else (false || EdenIsOpen)
If its a stinky banner, why is the stinky banner not a simple object?
its not reserved, _x isn't either
It does.
Setting a variable without private, Arma has to look all scopes above if the variable already exists, so it can replace its value.
With private, it just sets it in current scope, no need to chec kup
Can you set texture on simple stinky banner?
oh indeed. that's neat, thanks π Cc @open hollow
The script failed to compile
so instead of
[a, b, c, d]
you ended up with
[a, , c, d]
Then it tried to create a 4 element array, but there are only 3 elements on the stack -> stack size violation
Nice π
In the case of loops itβs not recommended, itβs because itβs cheaper to replace a value than create an variable on each iteration I assume, but not sure why itβs not recommended doing:
private _myvar= 0;
While {true} do {_myvar = 2}
iirc in teh wiki, this shoud be:
_myvar= 0;
While {true} do {_myvar = 2};
Where does it say thats not recommended?
maybe i miss understund, wait me a sec
The thing with loops is yeah you repeatedly re-create the variable which is less efficient than lookup in parent scope
I think you missunderstood yea
probably was
While {true} do {private _myvar = 2};
yep, private need to be used out of loops
is private ["_var"]; slower than private _var ?
It's more a question of why would you do that
old code
One is a script command with an array, the other is.. nothing
cool
more commands are slower yes
nice π
but only on assignation, not on further variable use, right? as it is now "set to the local scope if it doesn't exist above"
I had it partly right I guess, but indeed the "assign variable to scope" is faster with private (and maybe equal to new scopes e.g event handlers)
slower as there is array creation
the wiki states that
yes
indeed in eventhandlers it doesn't make sense to use it as there is no parent scope. But it also doesn't hurt adding it
βοΈ @little raptor π
doesn't the check for upper scopes cost them precious ms π
what did I do?! π
you never use private in EHs π
in private page? didnt see it
in Code Performance page I believe
if not on private, I'll make sure it is
well, Example 1 states that the string version is already less performant π
ah didnt see it π
yes but there is no upper scope to check so it never does anything π’
how does one enable the select respawn on map screen?
I have respawn = 3; set, and I have multiple respawns created, one via respawn_west marker and the rest should be created on players via [player, getPosATL player] call BIS_fnc_addRespawnPosition;
But players just instantly respawn on respawn_west, no map screen or anything
you will need respawnTemplates[] = {"MenuPosition"}; at least in description.ext
you can add others, like Spectator, tickets etc too
ah, hopefully thats it. Thank you ill give this a looky
hmm doesnt seem to work locally, any other suggestions?
Lemm check. We use it with respawn position module.
Is there a way to assign a preferred look direction for an AI via script?
I know that as a squad leader you can order AI to look a certain way (like, "watch North-East"). Is there a way to do the same with scripting?
doWatch
yep, that sounds about right, thx!
Is there any way to make this command work with azimuth rather than a specific position?
just tried the respawn modules as well, now it seems I just respawn where I died lol
- Just figured this out, the modules still need
respawn_1,respawn_2etc. Now I cycle through them when I respawn
They shouldn't, you just need to set the team that it works for
Markers are the only ones that need variable names to my knowledge
respawn = 3;
respawnDelay = 1;
respawnTemplates[] = {"MenuPosition"};``` This seems to be minimal
(set delay time as you wish), and ive used module (No markers)
huh, for whatever reason changing the order those 3 lines were placed in fixed it. That or changing the respawn delay to 1
thank you
think its respawn delay, has to be > 0. otherwise i also respawn on death position
Yeah been like that for a good long while
I do have another question, is there any obvious reason why this addAction will work fine in locally hosted multiplayer (via editor) but on a dedicated server there appears to be 2 of this addaction instead of one, and itll fade away not long after you start holding.
[
this,
"Attempt Defusal",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_secure_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_secure_ca.paa",
"_this distance _target < 3",
"_caller distance _target < 3",
{
params ["_target", "_caller", "_actionId", "_arguments"];
format["%1 has begun defusing, protect him!", _caller] remoteExec ["hint", -2];
StartEnemyWaves = true;
publicVariable 'StartEnemyWaves';
},
{},
{
params ["_target", "_caller", "_actionId", "_arguments"];
[getPosASL _caller, 100, false, [true, true, true, true, true, true, true, true, true, true], 1] spawn freestylesNuclearBlast_fnc_initBlast;
},
{
params ["_target", "_caller", "_actionId", "_arguments"];
format["%1 stopped defusing, get back on it!", _caller] remoteExec ["hint", -2];
},
[],
120,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, this];
no. client is only local to itself
added how? In the Init field in the editor?
yes
Init field gets executed by every joining client. And you have remoteExec in Init field. So every joining client would add another copy of said action to everybody who've joined before them 
ah
hmm
okay ill throw it into the initServer.sqf and give the object I want it on a variable name
should fix it then right
If you want everyone to have the action just put the regular addAction/holdAction into the init field
just do [...] call BIS_fnc_holdActionAdd; in the Init 
hmm also true
Effectively the Init does the job of Remote Exec for you
thats good to know as well, I didnt know this before
The same as initPlayerLocal.sqf
Beware scenarios where if you have something remove the action Later, e.g when the action gets used, People who Join after it's removed likely will still have the action Show
alright, thankfully once this holdAction completes everyone dies and mission is pretty much over
Locality can be a nuisance but once you wrap your head around it stuff gets much easier
Do you mean an AI in their Squad?
I believe those become Local to the Squad Leader
No
The players Unit can only be local to that player iirc
That would be a nightmare otherwise
Technically the player's unit is initially local to the server :P
I think it's already player-local by the time initPlayerLocal is executed though. Not sure because undocumented.
Thats because your parent _this is passed along, and contains a number as first element
use [] call instead
is there a built in way to allow players to respawn on one another? like in the apex campaign?
I like this pattern:
call {
if (condition) exitWith { // some code };
if (condition2) exitWith { // some other code };
// default case code
};
Switch works out slightly faster if the the conditions are suitable but not for general conditions.
I attempted to throw this into the initPlayerLocal.sqf but no luck. Does anyone know how the apex campaign does it?
params ["_player", "_didJIP"];
[_player, _player, name _player] call BIS_fnc_addRespawnPosition;
It might not like you using just _player as a position, try this [_player, getPosATL _player, name _player] call BIS_fnc_addRespawnPosition;
no thats what keeps the respawn markers following players, it looks like I just hjad to remote exec it.
params ["_player", "_didJIP"];
[west, _player, name _player] remoteExec ['BIS_fnc_addRespawnPosition', 0, true];
I am trying to remember.. I just cannot find it... There was an event handler for side and system chat ect? Help?
Dont think so? As in intercept chat or when message shows?
Yeah. I remember specifically using something that at leasts checks whats in the chat box
denied
lol ... if (_text == HELP WITH THIS) then { "It's true" } else { "It's false" };...
Yeah but that aint text, its just an error
params ["_channel", "_owner", "_from", "_text", "_person", "_name", "_strID", "_forcedDisplay", "_isPlayerMessage", "_sentenceType", "_chatMessageType"]; if (_text == THISISTEXT) then { "It's true" } else { "It's false" };
}];```
?
THISISTEXT isnt a string, its a global variable at best.
U wanna add quotes "
how would one go about detecting vehicle wrecks? not any specific kind just wrecks in general
would I still look for objects of type Car, Tank, Helicopter etc?
I believe yes, and you should be able to identify them by them being !alive
Q: about BIS_fnc_findSafePos, one of the center types can be OBJECT, is a 'road' in the terrain sense of the word not an object? It appears to be returning nil appearing as any in the logs. worst case I suppose I could do something like getPosATL _road, perhaps. thanks...
https://community.bistudio.com/wiki/BIS_fnc_findSafePos
but also IIRC, alive objNull can lead to false positives... so to be safe, may include conditions like, _x isKindOf "Tank" airing on the safe side. HTH
Yes, I meant in combination with their other checks to determine what kind of object it is. I don't know how they'd end up with objNull on their list of objects to check, but presumably they're not looking for e.g. dead walls and fences.
assuming an over zealous deleteVehicle, along these lines... becomes objNull.
oh heck I see... an args issue, my mistake...
[opforsquad_1, spawn_1] call TG_fnc_squadSpawn;
[opforsquad_2, spawn_2] call TG_fnc_squadSpawn;
[opforsquad_3, spawn_3] call TG_fnc_squadSpawn;
[opforsquad_4, spawn_4] call TG_fnc_squadSpawn;
opforsquad_1Move1 = opforsquad_1 addWaypoint [getMarkerPos "move1", 0];
opforsquad_1Move1 setWaypointType "MOVE";
opforsquad_2Move1 = opforsquad_2 addWaypoint [getMarkerPos "move1", 0];
opforsquad_2Move1 setWaypointType "MOVE";
opforsquad_1Move2 = opforsquad_1 addWaypoint [getMarkerPos "move2", 0];
opforsquad_1Move2 setWaypointType "SAD";
opforsquad_2Move2 = opforsquad_2 addWaypoint [getMarkerPos "move2", 0];
opforsquad_2Move2 setWaypointType "SAD";
opforsquad_3Move1 = opforsquad_3 addWaypoint [getMarkerPos "move3", 0];
opforsquad_3Move1 setWaypointType "SAD";
opforsquad_4Move1 = opforsquad_4 addWaypoint [getMarkerPos "move3", 0];
opforsquad_4Move1 setWaypointType "SAD";
opforsquad_3Move2 = opforsquad_3 addWaypoint [getMarkerPos "move4", 0];
opforsquad_3Move2 setWaypointType "SAD";
opforsquad_4Move2 = opforsquad_4 addWaypoint [getMarkerPos "move4", 0];
opforsquad_4Move2 setWaypointType "SAD";
}```
This code can spawn in squads fine, but waypoints do not work at all. Im totally stumped, especially since I've gotten addWaypoint to work before
What is opforsquad_1 and what does that squadSpawn function do exactly?
An ID for an opfor squad im spawning in. here's the function
_squad = _this select 0;
_spawn = if (count _this > 1) then {_this select 1} else {spawn_1};
_position = getPosATL _spawn;
_squad = [_position, east, [
"1715_Eng_MR_Lieutenant",
"1715_Eng_MR_Captain",
"1715_Eng_MR_Corporal",
"1715_Eng_MR_Corporal",
"1715_Eng_MR_Sergeant",
"1715_Eng_MR_Sergeant",
"1715_Eng_MR_Private",
"1715_Eng_MR_Private",
"1715_Eng_MR_Private",
"1715_Eng_MR_Private",
"1715_Eng_MR_Private",
"1715_Eng_MR_Private"
]] call BIS_fnc_spawnGroup;
leader _squad setVariable ["lambs_danger_dangerRadio", true];
deleteVehicle _spawn;```
_spawn is just an object i'll place down where i want the squad to spawn, since markers dont work sometimes, like when i try to use tasks from lambs ai
Yeah that's not going to work.
You're assuming that opforsquad_1 will end up holding the group but that's not what the code does.
What do you mean by that?
I've used this function in other missions and it worked well
Well, the function will create the group but it won't pass any data back.
_squad = _this select 0 sets the local variable _squad to the value of _this select 0. It doesn't create a reference to it or anything like that.
If you wanted to return the group, the conventional way would be something like opforsquad_1 = [spawn_1] call TG_fnc_squadSpawn, and then at the end of the squadSpawn function you'd return the group on the last line like this:
_squad;
You can modify the input array, but it's not a good idea and still wouldn't set opforsquad_X here anyway, because creating the input array is also making a copy of the variable not a reference.
So that's why it was working before, because i never applied any code on the squads outside of the function until i tried making waypoints
So how would i properly declare the arguments in the function
Well, you're only using one input argument here.
You want an output value, which you're not currently setting.
But you said i shouldn't use _spawn = if (count _this > 1) then {_this select 1} else {spawn_1};
I never said anything about that line but it's certainly going to need to change if you're removing the first parameter.
Oh ok im just dyslexic, so what should i change it to? I never understood how to declare private arguments in code
I'll rewrite it, sec.
if (!isServer) exitWith {};
params [["_spawn", spawn_1]];
private _position = getPosATL _spawn;
private _squad = [_position, east, [
"1715_Eng_MR_Lieutenant",
"1715_Eng_MR_Captain",
"1715_Eng_MR_Corporal",
"1715_Eng_MR_Corporal",
"1715_Eng_MR_Sergeant",
"1715_Eng_MR_Sergeant",
"1715_Eng_MR_Private",
"1715_Eng_MR_Private",
"1715_Eng_MR_Private",
"1715_Eng_MR_Private",
"1715_Eng_MR_Private",
"1715_Eng_MR_Private"
]] call BIS_fnc_spawnGroup;
leader _squad setVariable ["lambs_danger_dangerRadio", true];
deleteVehicle _spawn;
_squad;
And then the top of the calling function would change to:
opforsquad_1 = [spawn_1] call TG_fnc_squadSpawn;
opforsquad_2 = [spawn_2] call TG_fnc_squadSpawn;
opforsquad_3 = [spawn_3] call TG_fnc_squadSpawn;
opforsquad_4 = [spawn_4] call TG_fnc_squadSpawn;
Wow this is really helpful, honestly
yes
And is there a way I can get an atl position from a marker? I could never figure that out either
What
It's a troll, just ignore it.
Now the ai aren't spawning at all for some reason? I made the spawns markers and changed getPosATL to getMarkerPos
shrugs
check it in the debug console.
oh, you know markers are strings, right
so it'd be "spawn_1" not spawn_1
IT ALL WORKS!! Thank you very much :D

Barma
why isnt this simple destroyer placing code not working, the ship is placed on bottom of the ocean? ```sqf
_as = getposASL player;
_as set [2,0];
_e = "Land_Destroyer_01_base_F" createVehicle (getposASL player);
_e setposASL _as;
[_e] call BIS_fnc_Destroyer01PosUpdate```try
ah yes that works! thx
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HitPart
ammo: Array - ammo info: [hit value, indirect hit value, indirect hit range, explosive damage, ammo class name]; Or, in case of a vehicle collision: [impulse value, 0, 0, 0]; hit and damage values are derived from the projectile's CfgAmmo class, and do not match the actual damage inflicted, which is usually lower due to armor and other factors
Anybody knows when this [impulse value, 0, 0, 0] case for vehicle collision happens? Can't seem to get it no matter what.
It is for pre-A3 pre-PhysX stuff only?
it maybe HitPart is not fully implemented - https://feedback.bistudio.com/T162138
Yeah, I just met this problem myself, I now have to track each projectile in shooter entity and query this array in case projectile is null
In my case it happened with RPG-32 shot, original grenade explosion and damage was null in HitPart, while penetrator was properly available in HitPart
Probably not fixable because I know that EHs are called after engine is done doing its stuff, so by the time EH scripts execute, original grenade shot is already deleted because it was submunition.
if I wanted to make a thing where you need an item to get through something, what would I do?
like say, you have a toolkit on you and you can then remove a metal barricade
if("Toolkit" in items) https://community.bistudio.com/wiki/items
but you need valid item name for "Toolkit"
wouldnt it just be the item class name?
yes
I believe it literally is "ToolKit" for the Toolkit
Taken from a function of my own
// Engineer Section
// If they have a toolkit make them Engineer
if ("ToolKit" in _items) then {
player setUnitTrait ["Engineer", true];
} else {
player setUnitTrait ["Engineer", false];
};
Here you go for reference https://community.bistudio.com/wiki/Arma_3:_CfgWeapons_Weapons
It's part of the difficulty settings
I think that was intended.
It can also override stuff from mods like debug console.
Not that i have issue with it, but it would be nice to be able to choose, like you can with cba settings
This gives me an error "6 elements provided, 3 expected". But I'm pretty sure I am passing 5 arguments, not 6 o_0 Am I going crazy?
_type = typeOf _x;
_pos = position gameLogic_2 + _relativePosition;
_newProp = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
the pos array
[0,1,2] + [1,2,3] = [0,1,2,1,2,3]
use vectorAdd
ah damn right. My Unity habits did me bad. Thank you.
_incappedPlayers = _medicalTent nearEntities ["man",200] select {isPlayer _x && _x getvariable "vn_revive_incapacitated"};
_incappedNPCs = _medicalTent nearEntities ["man",200] select {lifeState _x == "INCAPACITATED"};
systemchat str _incappedNPCs;
if (count _incappedPlayers > 0)
then
{_corpList = [[_incappedPlayers],[],{_corpsman distance _x},"ASCEND"] call bis_fnc_sortBy;
_corpTarget = _corpList select 0;}
else
{_corpList = [[_incappedNPCs],[],{_corpsman distance _x},"ASCEND"] call bis_fnc_sortBy;
_corpTarget = _corpList select 0;};
systemChat str _corpTarget;
Bluh. Why isn't my if-then generating _corpTarget? As far as I can tell, everything else functions, it finds the nearest _incapped unit, it's just not passing it forward.
Its not defined outside of if-then-else scope
if(true) then {
_someVar = 123;
};
// _someVar is undefined here
```vs
```sqf
private "_someVar";
if(true) then {
_someVar = 123;
};
// _someVar is 123 here
private _corpTarget = if (count _incappedPlayers > 0)
then
{[[_incappedPlayers],[],{_corpsman distance _x},"ASCEND"] call bis_fnc_sortBy select 0;}
else
{[[_incappedNPCs],[],{_corpsman distance _x},"ASCEND"] call bis_fnc_sortBy select 0;};
```you can also do this
_corpTarget will be nil if both arrays are empty though
... ffffffff of course it's that basic.
The loop this is in doesnt kick off until one of those lists will have at least one unit in it.
π
private _corpTarget = if (count _incappedPlayers > 0) then {
[[_incappedPlayers],[],{_corpsman distance _x},"ASCEND"] call bis_fnc_sortBy select 0;
} else {
[[_incappedNPCs],[],{_corpsman distance _x},"ASCEND"] call bis_fnc_sortBy select 0;
};
```also better formatting
I'll go with that, it's a lot smoother. Didn't know you could '= If'
Now it says I provide 0 elements to createVehicle T_T
_relativePosition = _pos vectorDiff _pos2;
_pos2 = position gameLogic_2;
_pos2 = _pos2 vectorAdd _relativePosition;
_type = typeOf _x;
_newProp = createVehicle [_type, _pos2, [], 0, "CAN_COLLIDE"];
nvm found the error
Did a little touchup and it's working now. Thanks, Sa-Matra!
Is there a "get" function for this thing? https://community.bistudio.com/wiki/BIS_fnc_setObjectRotation
I need rotation in all 3 axes
Wouldn't that be vectorUp?
And vectorDir. But then you have to covert it to angle.
In that case its easier to use setVectorDirAndUp
https://community.bistudio.com/wiki/BIS_fnc_getPitchBank No yaw though
Thats direction π -> getDir
yep
actually just using vectorDir and vectorUp is enough for my needs, thanks
Afaik no. I guess mod can make its own messages with systemChat
deathMessages=0; in profile should rid of them all
Trying to wrap my head around my config files, I'm deep in the weeds on this one.
class CfgFunctions
{
class SRD
{
tag="SRD";
class 1
{
class 2
{}
}
class 3
{
class 4
{}
}
}
}
So, if have in my root mission directory two folders, '1' and '3', and inside those folders I have files labeled 'fn_2.sqf' and 'fn_4.sqf' respectively, that should be correct, yeah?
Or would this be more appropriate for the configmaker's channel? :x
first you dont need tag="SRD"; if function TAG class is already SRD
also im not sure using numbers to name functions is .... okay
compiler might complain
It's an example, they have proper names.
for example youd want
class CfgFunctions
{
class MY_TAG
{
class MY_CATEGORY
{
class myFunc1 {};
class myFunc2 {};
};
};
};
And put fn_myFunc1 and 2 into folder functions\MY_CATEGORY within your mission folder
OR you can
{
class MY_TAG
{
class MY_CATEGORY
{
file="my_folder";
class myFunc1 {};
class myFunc2 {};
};
};
};```
Then your function files go into my_folder\ within your mission folder
This is going in a config.cpp for a mod, I was given to understand it uses a different format - category being the folder name.
And I was hoping to split my functions between different folders :x
then you need to use 2nd example, with file
and you can make multiples yes
class CfgFunctions
{
class MY_TAG
{
class MY_CATEGORY1
{
file="my_folder";
class myFunc1 {};
class myFunc2 {};
};
class MY_CATEGORY2
{
file="my_folder2";
class myFunc3 {};
class myFunc4 {};
};
};
};```
also when using mod you need \addon_prefix\function_folder. in description.ext you dont need that (for file="";)
So, if I have the folder CoMn in the root '@MFAIO' folder, it'd be file="@MFAIO\CoMn"?
Hrn. See, I had a working version before, but it required me to bury my files deep in the folder soup for no reason, it used
file="@MFAIO\addons\Reinforce\functions"
If ur pboprefix is asdf
Then it would be file="\asdf\myFuncFolder"
Alright, time to sound like a pillock, but how do I find my pboprefix?
It's an attribute on the PBO.
How it ends up there depends on how you're creating your PBOs.
I'm using Arma Tools' Addon Builder
The UI or the command line?
UI
The UI sucks :P
Yeah, the trouble is that the option is in the wrong place.
You can add or it add automatic prefix. Have you check your pbo file does is include $PREFIX$
I don't think addon builder cares about PBOPREFIX files.
It may be in the wrong place, but it worked π
Yeah, trouble is that if you have multiple PBOs then you have to change that fucking thing for every one.
So at that point you really want to script it.
You mean, change it in the UI? Or does it have to be changed in each packed PBO?
Addon Builder packs one PBO at a time, and each PBO needs a separate prefix. If you're packing multiple, you have to remember to change the prefix for each one, which is annoying since it's hidden in the settings.
@granite haven Haven't tried death messages, but Arma might not know if you're using medical mods.
(it's common for addons to contain several PBOs for organisation)
You can pack them using a batch
I could never have all my things in One PBO that would drive me insane
Hmm, camera reworkβ¦
systemChat "firstCamera";
_camera camPrepareTarget _officer;
_camera camCommitPrepared 0;
_camera camPrepareRelPos [-0.03, 0.58, 1.43];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 0;
waitUntil { camCommitted _camera };
systemChat "secondCamera"; // this is reached
_camera camPrepareTarget _officer;
_camera camCommitPrepared 0;
_camera camPrepareRelPos [-0.03, 0.58, 1.43];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 1;
waitUntil { camCommitted _camera };
systemChat "titleCut out"; // this is never reached
titleCut ["", "BLACK OUT", 3];
```@still forum is there any chance that camera could get some love / bugfix / exploration or�
I know it's dusty in a corner, so I wonder if investigation is possible
I never even understood what prepared stuff do 
I think it preloads the scene depending on planned camera angles
wtf, camCommitted seems to always return false now? 
oooh wait, it might have to be if I am in map (or in vehicle?let's hope not) when the camera triggers π
ok no, it's something else e_e there are no waitUntil anymore and the script still halts here
"first camera" call _systemChat;
// === 19:15:47
_camera camPrepareTarget _officer; call _systemChat;
_camera camCommitPrepared 0; call _systemChat;
_camera camPrepareRelPos [-0.03, 0.58, 1.43]; call _systemChat;
_camera camPrepareFOV 0.700; call _systemChat;
_camera camCommitPrepared 0; call _systemChat; // this _systemChat is not called... camCommitPrepared shenanigans
β¦understood π¦
but what if you commit it unprepared, like take it by surprise?
then it would be camSet* and not camPrepare*
it would work, but I would have to document camPrepare* failures
Here is a question, why does a one shot trigger keep evaluating condition, even after it has been triggered?
Guys sorry for the question but I wanted to have some way for indenpent/civilian to talk to me on blufor , either by chat or something like that , because I wanted to do it as if it were a task , sorry for the bad English I am using a translator
Thanks a lot if anyone can help!
I need that when I get close to an npc , whether idependent or civilian , he sends me a message via chat , I know there is a trigger for this but it works only for blufor x blufor not blufor x idependent
You have quite a few options for this. Using the <x>Chat commands as suggested in general is one, though only globalChat would be available because the civilian and blufor are different factions.
At the most basic level: Give the civilian a name by double clicking on him and entering a Variable Name at the top. Place a trigger at the civilians position that detects Anyplayer Present. Leave the condition alone (so it doesn't have any other requirements to trigger), and in On Activation add
civiliansNameHere globalChat "Your Text Here"
ok, any stupidity of mine I'll come back here, thank you very much @manic sigil
so im running liberation on my server and I seem to be having FPS drops that to me, look like they atleast partially relate to a spawned script or multiple?
How could I go about finding out what scripts may be responsible?
do folder search for βcreateUnitβ and put a unique βdiag_logβ msg beside it
How do you know it's createUnit that's doing it?
hastily read on an iphone and saw "spawn script" instead of "spawned script"
altho its probably the same thing
usually fps drop follows when a lot of entiteis are added to the game world in a short time
Make a ticket
Why? Am i gonna get an answer with the ticket?
because its a bug
Yeah that
Meh
Then don't complain 
Wasnt complaining, just asking. Perhaps there was reason for it
hello again guys , yesterday i got help from @manic sigil to activate the global chat but i am very noob , i would like to know if someone could help me with the step by step from the trigger to the finalization , i searched but i did not find anything , not even on Youtube
I'm a beginner but I try to get by with the game but there are hours that complicate things more
Scripting is a whole science and art to itself, working with the editor is just the start. Lemme whip something up for you.
thank you very much
In AddonBuilder in cli mode how do you define author?
Like you can via gui Options -> Author
Does it actually do anything in the GUI?
lemme check
yuh class cfgMods { author="Marko"; timepacked="1684685039"; };
in cli mode author="";
Hi all, I think I've hit a bit of a dead end and I need some help π
What I want to do:
- There is a gamelogic_1 object somewhere on the map. Near this object there is a group of props that are arranged in a particular way.
- I want to take all these objects and precisely recreate the composition near gamelogic_2. Essentially, I want to achieve Eden's copy/paste, but with a script.
The problem is, it seems to be working with objects that are standing vertically, but if the object is laying on it's side it does not work. First screenshot is what the source composition looks like, second is what I get after running the code:
_nearbyProps = nearestObjects [gameLogic_1, ["All"], 10];
{
_dir = vectorDir _x;
_up = vectorUp _x;
_posObjectInitial = getPosASL _x;
_posPivotInitial = getPosASL gameLogic_1;
_relativePosition = _posObjectInitial vectorDiff _posPivotInitial;
_posPivotDestination = getPosASL gameLogic_2;
_posObjectDestination = (_posPivotDestination vectorAdd _relativePosition);
_type = typeOf _x;
_newProp = createVehicle [_type, _posObjectDestination, [], 0, "CAN_COLLIDE"];
_newProp setVectorDirAndUp [_dir, _up];
_newProp setPosASL _posObjectDestination;
} forEach _nearbyProps;
I've got a sneaking suspicion that setVectorDirAndUp does not rotate the object around it's pivot but rather uses a different axis
I went through the same ordeal. Throw out setPosASL and use getPosWorld/setPosWorld instead.
^^this
We do setPosWorld before setVectorDirAndUp but I'm not sure if it matters.
up/dir vectors are absolute. Issue is that some versions of setPos will realign the object.
Thank you, it worked π₯³
Cheers
I will make a randomized backrooms generator out of this, somewhere to place misbehaving players as zeus π
Can someone tell me why this isn't working?
I want to force autosave and forbid manual saving, but autosaving isn't working even if I allow saving before using "saveGame"
enableSaving [false, true]; // saving disabled, does autosave
it only autosaves if it isn't already disabled, but I need to keep saves disabled until I need to autosave
so doing enableSaving [false, true]; only works for the first time, then disables the save, then never saves again?
yes, kinda, I just wanna know why saveGame isn't working when re-enabling it through a .sqf script, but does work if I do it in debug console
Pretty sure entityKilled doesn't use a return value.
It did work that way, though I still don't understand why it didn't work with previous script
no idea, it's a mess
why not, at worst, this:
isNil {
enableSaving true;
saveGame;
enableSaving false;
};
what's the difference?
I'd say "it works" π
Isn't it the same as my first variant but with less text (sorry I'm not good at keeping text clean)?
Which didn't work for some reason
no idea
I am just writing what I would do:
enableSaving [false, false]; // disables saving
// then, if needed
enableSaving [false, true]; // -should- save?
// if this above β does not save, then use the following β :
enableSaving [true, false];
enableSaving [false, true];
enableSaving [false, false]; // disables saving
// then, if needed
enableSaving [false, true]; // -should- save?
It isn't saving if enableSaving is false though
Just doesn't do anything
anyway it does work now so thanks for pointing me in the right direction
Liberation is full of super outdated and poorly written scripts, your main culprits are likely the manage_one_sector.sqf and anything it interacts with, perhaps even the one that Handles battlegroups.
glad I could help
I am still surprised that the second bool does not override the enableSaving previous value
as in, "disallow manual save, but keep scripted saves working"
I have a weird script error.
// Basically I have an object, that gets created at certain position:
_lootCache = "VirtualReammoBox_camonet_F" createVehicle _cachePos;
// Then I create a trigget at object position:
_cacheTrigger = createTrigger ["EmptyDetector", _cachePos];
_cacheTrigger setTriggerArea [300, 300, 0, false];
// Then I make a statement to make sure the object is outside the trigger and is alive
waitUntil {(!alive _lootCache) or !(_lootCache inArea _cacheTrigger);};
// Code below gets executed if conditions met
// ...
This piece of code ran with no errors... But when I switched to a different map, the waitUntil started returning nil value...
If anyone could hint on this case I would greatly appreciate!
I guess it has something to do with object creation or its position.
what's _cachePos?
Maybe paste the actual error too, because your description seems mangled.
// Config name of location type
_locationType = "NameVillage";
// Get array of all locations with met config location type
_locationsArray = nearestLocations [[worldSize / 2, worldsize / 2, 0], [_locationType], 25000];
// Gets random location from an array
_randomLocation = selectRandom _locationsArray;
// Gets location position
_locationPosition = getPos _randomLocation;
// Gets an array of all houses with met conditions below
_housesArray = nearestObjects [_locationPosition, ["house"], 300] select {
[_x] call BIS_fnc_isBuildingEnterable;
count (_x buildingPos -1) > 5;
};
// Picks a house found in the above nearestObjects array
_randomHouse = selectRandom _housesArray;
// Finds list of all available building positions in the selected building
_housePositions = _randomHouse buildingPos -1;
// Picks a building position from the list of building positions
_randomPosition = selectRandom _housePositions;
// Assign a value for cache position (its called to a function param)
_cachePos = _randomPosition;
// Cache stuff gets executed next
The error itself
The object gets created, but the code after creating isn't running
The map you switched to. Are you sure it has anything in NameVillage?
You have a lack of sanity-checking in general here.
Oh, so it could be an empty value of NameVillage?
There's an assumption on the houses too.
Like there could easily be nothing with 5+ building positions within 300m.
It gets the house doe
And gets spawned
The objects on map to the left got created correctly, but the other ones (without the task icon) are the bad ones
So they are alive
But even if I remove the inArea check from waitUntil it doesn't run
I can only guess you're missing out some critical structural stuff.
The green crosses are all the locations from an array
That got picked from the config
Where are you running this from?
LAN server
No, I mean how do you execute the code? Why are there four boxes? etc.
Given that you're not using private variables I'm guessing that you have some accidental collisions but the failure point in that case is outside what you've pasted.
_locationType = "NameVillage";
_locationsArray = nearestLocations [[worldSize / 2, worldsize / 2, 0], [_locationType], 25000];
_randomLocation = selectRandom _locationsArray;
_locationPosition = getPos _randomLocation;
_housesArray = nearestObjects [_locationPosition, ["house"], 300] select {
[_x] call BIS_fnc_isBuildingEnterable;
count (_x buildingPos -1) > 5;
};
_randomHouse = selectRandom _housesArray;
_housePositions = _randomHouse buildingPos -1;
_randomPosition = selectRandom _housePositions;
_cachePos = _randomPosition;
[_cachePos] execVM "scripts\fn_spawnCache.sqf";
This is what I run to test whether it breaks.
Occasionally it breaks
Yep
So right now I got generated 2 objects with no error (my _locationsArray is resized to 2)
I guess it has something to do with a location
But if a location is broken I get the error.
Is the first snippet you pasted the literal code in fn_spawnCache.sqf aside from a _cachePos = _this select 0?
I can pastebin, but yeah, it's main thing
Pastebin it.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
This is my init.sqf to call the function.
if (!isServer) exitWith {};
_locationType = "NameVillage";
_locationsArray = nearestLocations [[worldSize / 2, worldsize / 2, 0], [_locationType], 25000];
_locationsArray = [_locationsArray] call CBA_fnc_shuffle;
_locationsArray resize 2;
{
_locationPosition = getPos _x;
_housesArray = nearestObjects [_locationPosition, ["house"], 300] select {
[_x] call BIS_fnc_isBuildingEnterable;
count (_x buildingPos -1) > 5;
};
_randomHouse = selectRandom _housesArray;
_housePositions = _randomHouse buildingPos -1;
_randomPosition = selectRandom _housePositions;
_cachePos = _randomPosition;
[_cachePos] execVM "scripts\fn_spawnCache.sqf";
} forEach _locationsArray;
Hmm. In the broken cases it's not creating the task, right?
systemChat str count _locationsArray; // should be fine
systemChat str count _housesArray; // may be empty
systemChat str count _housePositions; // may be empty
systemChat str isNil "_randomPosition"; // may be nil
so as usual, before a selectRandom, ```sqf
if (_myArray isEqualTo []) exitWith {};
Seems I get 0 _housesArray sometimes somehow
Like there could easily be nothing with 5+ building positions within 300m.
If it's spawning a box there then I have no idea what's going on though.
There's a fun bug with your task creation where you'll get random task ID collisions.
but those should be random
I guess an index of 1000 is fine? 
thanks, yeah I guess ill take a look at that script for now and also start logging timestamps in every script/function see which ones run near the time issue's start occurring.
This seems to fix my issue:
_locationsArray = nearestLocations [[worldSize / 2, worldsize / 2, 0], [_locationType], 25000] select {
count (nearestObjects [getPos _x, ["house"], 300]) > 5;
};
hmm
thinking about it
do you guys think adding this bit of code at the top and bottom of every single script/function in liberation would impact performance at all?
systemTime params ["_year", "_month", "_day", "_hour", "_minute", "_second", "_millisecond"];
diag_log ([str _month, str _day, str _year, str _hour, ":", str _minute, ":", str _second] joinString " ");
diag_log (["Current FPS:", (round (diag_fps * 100.0)) / 100.0, "Script: asymm_notifications.sqf"] joinString " ");
More code you add more impact on preformance. If they call often, they write to log often, you get the idea
hmm well it is hopefully just a temporary measure to figure out which scripts are causing mass FPS drops.
I have this as the first line of all my HandleDamage Eventhandlerssqf params ["_unit","_selection","_damage","_source","_projectile","_hitIndex","_instigator","_hitPoint"];but i noticed they added a new parameter _directHit after _hitPoint. I need to update all params with _directHit or they will work without it? I don't use _directHit.
params doesn't have to interpret all available params. You could just have _unit if that was all you needed.
(still has to be in order though, so if you needed _directHit you'd have to have something for everything before that too)
@hallow mortar π π π
Bear in mind that scheduled scripts themselves cannot use more than 3ms per frame. If performance gets hit hard it's probably because the scripts are creating objects, which they are usually doing for a good reason.
hmm then im probably wrong to assume there is any correlation at all between the increasing spawned scripts and decreasing FPS?
Oh, there's probably a correlation, but the actual hit is likely from unit/vehicle spawning.
In Antistasi we don't actually have much of a script bump from spawning, because it's one spawn per location. It's still a visible perf hit though.
hmm, I guess ill stop this nonsense with logging every script
yeah when units spawn in liberation there is a temporary performance drop as they spawn
but it goes away, this performance drop sticks around
It's sometimes worth running diag_activeSQFscripts to see if there's anything eating script time when it shouldn't.
until the server hits 0fps and needs to restart
but even with the worst script-spamming it's still 3ms/frame
Worst case typically is that you kill latency of other scripts.
but otherwise things look normal.
I tried that last night but maybe I was too late, it didnt actually run until the server caught up again
and I got like 4 scripts out of the 20+ that the performance panel said was running
hmm, would it be worth a shot to instead just have a CBA per frame handler check the FPS and run the diag_activeSQFscripts if server FPS gets below a certain point?
Unit spawning in Liberation is literally a Call so everything stops while it does that effectively
I been tweaking liberation over the past 2 weeks but I have determined that it is simpler to just start from scratch than to try and improve something already so full of problems
From his graph it seems like spawned, you can see spike down on fps, whenever there is a spike in spawned scripts
I would have to look into it but I believe each Sector's Manager is handled by spawned script
It kind of looks like the spawn spike happens right after the FPS drop. It could be that whatever creates the units also creates a set of spawned scripts to do stuff with them - or that whatever condition triggers the unit creation also triggers a bunch of scripts.
I have been trying to implement a different method of handling unit spawning to stop the FPS Freeze experienced when Units spawn, because it's ridiculous
Each unit when created calls a KPLib script to manage the unit, but I doubt its that complicated, I'll have a look now
What we did was just restart server after 3 or so objectives. Yes its annoying but i simply didnt have the will to debug that sphagetti monster :/
I love Liberation but it just has so many problems, even before I broke half of it myself by simply making it more efficient
By doing nothing but changing slightly the unit spawn handling I broke Zone Capturing entirely
Since apparently the Bar that shows doesn't have any bearing on the capture progress
Q: about object bounding boxes, especially as relates to world pos. finding the tricky part is gauging where that center Z dim should be, from object to object it seems 'different' than simply taking one of the BB Z dims, or even total Z, and dividing by two. is there a prevailing wisdom where this is concerned? convention, algorithm, is preferred to configuration in this instance, maybe I am reading the tea leaves incorrectly where the BB is concerned. thanks...
If you want the position of the bounding box in World Position you can use _object modelToWorld [0,0,0] for AGL and _object modelToWorldWorld [0,0,0] for ASL
and for ATL modelToWorldWorldWorld?
Bahahaha, I wish
https://community.bistudio.com/wiki/modelToWorld
https://community.bistudio.com/wiki/modelToWorldWorld
For further Reading, they both have a Visual Version for getting the position in the Render Scope
center is always _min vectorAdd _max vectorMultiply 0.5 and extent is _max vectorDiff _min vectorMultiply 0.5
but in model coords
the MRAP Has a real funny looking box too
He is the above image with a Cross rendered on the Center of each.
I was doing bounding box shenanigans a while ago while making a funny little script to move Objects around
at the moment I am taking the visual (0), and _bb#1 Z dim as my world pos offset. but this is yielding funny results. the error escapes in the logs me at the moment, something about objects under the map terrain, self-corrections etc. for ammo boxes is one thing, but for vehicles, causing havoc. but the root cause I think is interpreting the correct BB Z dim, if I am reading it correctly.
mainly for serialization purposes, which I am also employing to 'create' if you will objects, a serialization record, with prepopulated class names, world pos, etc.
the bounding box has nothing to do with where an object "stands"
Was gonna say
you should use the land contact
wdym, when you are talking about world position, yes, you need to be concerned about the 'middle Z coordinate'
that has an effect 'where it stands'
I have no clue what you mean, just save it's ASL and restore it if you want it that precise
well if you look at fluffy's pictures you can see that "middle Z" has nothing to do with the "land contact Z" of the vehicles
also, I am creating objects from nothing, calculating the anticipated world pos. deserializing to create the object.
You've lost me here
you have setPosASL and setPosATL
they automatically calculate the land contact of the object so you don't have to worry about Z
^ I was gonna say that earlier
trying to find the primitives, there was a reason why world position was being used
I use setPosATL [_x, _y, 0] personally since it does the job
you can do this to place objects on the next roadway LOD:
isNil {
_obj setPosASL _aslPos;
_diff = getPos _obj#2;
_aslNew = +_aslPos;
_aslNew set [2, _aslNew#2 - _diff];
_obj setPosASL _aslNew;
}
they'll always touch the "ground" (even on objects)
but the key was in the docs, as far as I know... "Return Value: Array format PositionASL - the model's centre"
https://community.bistudio.com/wiki/getPosWorld
well don't use world pos
use getPosASL and setPosASL
but if you instist on using setPosWorld you can still calculate the land contact using _obj modelToWorldWorld (getModelInfo _obj#3)
but again, I start from nil there is no object in this instance, but rather the serialized representation.
are you trying to create compositions?
no
are you serializing object positions to recreate them later in the exact spot?
along these lines, yes. presenting the serialized, or meta data, and creating objects via this method
^
yeah just store the getPosWorld + vectorDir + vectorUp + type
and restore via setPosWorld, setVectorDirAndUp
couched in, of course I'd rather use the ATL or even ASL, but there was a reason, I'm sure, why world position was the choice
That is probably better, I just do thing crudely until it works :p
exactly, yes, this is the meta data
then you don't need to worry about Z or anything
this is what I am trying to avoid, worst case, by configuration, class by class
but with world pos yes you do... it is the CENTER of the object, not the 'land contact', if the docs are not lieing
You are already saving it's position I don't see the issue
missing the point, not starting from the object, starting from meta data
well if you want to recreate them exactly where they were you don't need land contact
literally there was no object at first from which to save anything
This is a nonstarter
then what are you serializing?
How can you wish to pre emptively place something at a position you don't have
there was nothing there ever, I am establishing meta data. from that creating the very first instance of the object.
positions, etc, well beyond the scope of the immediate conversation
assume they are known positions
Brother I don't even know what Scope you are aiming for
starting from a meta data point of origin. creating the object from that.
okay, this is not productive for me. my take away's are, if possible, using the land contact, ASL.
Question if you create #dynamicsound with https://community.bistudio.com/wiki/createSoundSource
And then move too far away from it, it will stop playing sound forever, even if you return back into its vicinity.
Is there any workaround to restart it? or do i have to respawn the darn thing?
(i know its marked as broken, but the broken part doesn't relate to that, but its the only sound source that creates perfect sound loop)
without testing anything myself I would imagine you would need to recreate it
im trying to avoid that, as its global. And that means audible stop/restart of sound for everyone who hears it normally.
That slipped my mind when I read the page
Is it absolutely not possible to use a local variant? e.g say3D
that seems to always create audible delay after sound finishes and before its restarted.
createSoundSource seems to be the only one that can splice two sounds together perfectly.
i could work around it (with say3D) by having 2 objects and just obj1 finishes, obj2 starts playing and they alternate.
But that seems like even more dirty workaround than respawning sound source.
Nothing comes to mind honestly
β¦did I break something with fog
no I think someone spilled some milk
nope, just deep snow
I'm trying to figure out why an array containing groups sometimes contains Null group values. I'm setting their group deleteGroupWhenEmpty to false. Is there anything else that can cause a group to not exist, other than deletegroup?
groups that could not be created
groups that got deleted by an automated system
ghooost groups π»
under what circumstances would a group not be created?
If the last member in the group also joins another group it changes it to GrpNull
ahhhh... that's probably what's going on.
does that happen instantly or after a delay?
Not sure seems instant but I am in VR with next to nothing happening
okay, back on the BB question... forget about objects, meta data, etc, for now.
https://community.bistudio.com/wiki/boundingBox
https://community.bistudio.com/wiki/boundingBoxReal
I'd like for a precise BB, so maybe the real? but what is the difference then between the clipping choices?
if, for example, I am seeing objects below terrain surfaces, for example. maybe the BB is too precise?
clippingType: Number - can be one of:
0 - ClipVisual (can significantly reduce bounding box's size on buildings)
1 - ClipShadow
2 - ClipGeometry
3 - ClipGeneral (same type that is used in the main syntax)
thanks...
I have been using the ClipVisual option (0), but perhaps I need one of the others
LODs? that is a different alternative syntax. not talking about LOD.
I will try that, thanks...
They are literally called LODs in Object Builder, I just double checked, Sample House for Example. I have no idea what Syntax 2 actually is referring to but if I had to make a generous Guess, it's probably just grabbing the relative "String" for that LOD, 2 - ClipGeometry meaning "Geometry" in the case of syntax 3.
Wait a minute. if a group with no units in it becomes group null.... does that mean it cannot be deleted????
I believe it just deletes the Group
So if I have the last guy in a group join a new group, it deletes the group he was in.
I would believe so yes, but I would need to test if a deleted Group just becomes GroupNull or Nil
groups can be deleted specifically... but also created with option to auto delete...
which can be important because there is a hard constraint on groups and/or units on an active server, IIRC.
documented somewhere but the url escapes me
Deleted group becomes Null Group
but generally when objects (or groups) are deleted, yes, they just become null, you can test for isNull
grpNull
IIRC the all-join deletion is immediate.
The deleteGroupWhenEmpty merely stops the group from being Destroyed if all the Units in it vanish or get deleted
So a group that has become null has definitely been deleted?
It doesn't stop it being destroyed when they join another group
Yes
As per the Warning at the top This command does not prevent group deletion (through e.g deleteGroup or any engine group management).
the last Unit joining another group I imagine falls under engine Group Management
Yes I wish the doc for "join" said as much. Thanks for your help.
a group that is null is a deleted (non existing) group
I am seeing objects below terrain surfaces
again the bb has nothing to do with it. an object's bb may touch the ground. or it may be halfway in the ground
Well unless he is using the upper most part of the BB as the ground level of the object, but surely not right
There is no way to tell without seeing it but if it appears quite literally just under the surface that likely is it.
wow 74 spawned scripts feels strange
but I think you guys might be right with the unit spawning and managers being the issue I guess
ai count + spawned scripts seem to begin jumping around the same time
what is considered an entity? this just seems to keep rising as well. Seems like perhaps our cleanup script simply isnt running
I'm not sure what doesn't pass as an Entity but as a shot in the dark probably everything that is created that isn't a map object is probably counted as an Entity
hmmm we're getting away from scripting here no π sounds more like server management!
how can this issue be addressed/fixed script-wise?
It's likely related to poor scripting on behalf of Liberation
is this your framework? (iirc, no) Liberation indeed
ah apologies, this is referring to a previous conversation but I was trying to determine what scripts are causing this. and no it is not
yep, you cannot fix that without touching their files
I did try fixing it for a while, not fun
yeah looking at it myself makes me wanna cry
The only real solution is to restart the server every couple objectives, unless you want to rewrite half the gamemode to make it more sensible.
Side note if the entities command is to be believed, Groups, Modules, Units, Object all count towards the total entities
could be fun and a good learning experience to try making liberation from scratch maybe ill give that a go soon. anyways ill temporarily set a server restart for every hour
seems to be around how long performance remains stable for
Groups aren't entities.
Any unit, agent (eg snake) or physX object is an entity. Non-physx objects like flagpoles are not. I don't know what the rule actually is.
Yeah that's my bad I had a bunch of Logics made and because I am stupid I read it as Groups since they are named oh so similar
I can't get
["terminate"] call BIS_fnc_jukebox;
to work correctly. I get this error.
Type Any, Excpected Number
Here is the wiki for this command. Am I missing something?
it was probably never initialized to begin with
let me try with that
this is all terminate does:
/**
* Terminate function
**/
case "terminate" : {
//Remove event handlers
removeMissionEventHandler ["Draw3D", missionNameSpace getVariable "BIS_jukeBox_onEachFrame"];
removeMissionEventHandler ["Loaded", missionNameSpace getVariable "BIS_jukeBox_loaded"];
removeMusicEventHandler ["MusicStart", missionNameSpace getVariable "BIS_jukeBox_musicStart"];
removeMusicEventHandler ["MusicStop", missionNameSpace getVariable "BIS_jukeBox_musicStop"];
//Reset variables
{
missionNameSpace setVariable [_x, nil];
} forEach [
"BIS_jukeBox_initialized",
"BIS_jukeBox_onEachFrame",
"BIS_jukeBox_loaded",
"BIS_jukeBox_musicStart",
"BIS_jukeBox_musicStop",
"BIS_jukeBox_status",
"BIS_jukeBox_musicStealth",
"BIS_jukeBox_musicCombat",
"BIS_jukeBox_musicSafe",
"BIS_jukeBox_volume",
"BIS_jukeBox_transition",
"BIS_jukeBox_radius",
"BIS_jukeBox_executionRate",
"BIS_jukeBox_noRepeat",
"BIS_jukeBox_forceBehaviour",
"BIS_jukeBox_musicChanging",
"BIS_jukeBox_music"
];
//Log
"JukeBox terminated" call BIS_fnc_log;
};
a type any error here can only be linked to one of those vars BIS_jukeBox_onEachFrame, etc. being nil
Gotcha
even with
[] call BIS_fnc_jukebox;
["terminate"] call BIS_fnc_jukebox;
No longer getting error but the music doesn't stop
well terminate doesn't have anything to stop the music as you can see for yourself
it just removes a bunch of event handlers
Ok
I'd say stop using that function. it seems poorly made
to stop music playing (how did it start, did you use playMusic?)
you can use```sqf
playMusic "";
This works for a certain period of time and then music starts playing again.
well you can terminate it and do playMusic ""
so whatever loop is playing music is not terminated
I tried doing this but it didnt work:
[] call BIS_fnc_jukebox;
["randomMusic", [["jungle"]]] call BIS_fnc_jukebox;
["terminate"] call BIS_fnc_jukebox;
playMusic "";
Cc @still forum @little raptor @stark fjord
For info: I am sometimes not smart. This was happening due to a scriptHandle manager that killed the executing handle next frame π
apologies⦠I'll most likely do that again 
do you happen to have mods
try "initialize" in the first one
might help
it initializes by default
ah, didnt read that far in.
Yes, ACE disables music control.
I think I got it back to default with:
ace_hearing_disableVolumeUpdate = true;
perhaps, stupidly but DEFAULT could be a variable
instead of default as in default in switch
well it's not a var or macro as far as I see
macro would already be expanded at this point
ace_hearing_disableVolumeUpdate = true;
[] call BIS_fnc_jukebox;
["randomMusic", [["jungle"]]] call BIS_fnc_jukebox; // Completely ignores this function...?
sleep 5;
["terminate"] call BIS_fnc_jukebox;
playMusic ""; // doesn't work
it wouldn't
you also have case NOTHING
it's raw text
no #includes?
whats the part that does playMusic?
hm
does it play on EH or?
[["myMusic1", "myMusic2"], 1] call BIS_fnc_music;
this seems to do something similar
*For what I'm trying to do
but i'm also having trouble stopping with BIS_fnc_music;
When it restarts, does song start from start? Or in the middle?
which function?
Jukebox
@winter rose
switch (true) do {
case default {
1
}
}
``` 
works

worth documenting?
When you terminate and playMusic ""
doesnt do anything lol
This works for me:
[["side", "wild"], 1] call BIS_fnc_music;
[[""], 0] call BIS_fnc_music;
Oh thunk you said it stops it for a while
here it might work for bad reasons
is default a variable? ruh roh
no
can I start a thread in the channel? got something I need help parsing through, do not want to lose it, or flood the channel, could get a bit lengthy.
I think the reason it works is default {} doesn't return NOTHING. it returns ANY
and case can consume ANY so... 
well yeah ofc it doesn't return NOTHING because you can return stuff from switch
you can also do switch (true) do { case true : default { 1 }} π
I doubt you can
try it
sure
default {{}} maybe
so the engine is reporting ThingX:
17:52:54 ThingX 1d397864100# 1780671: cargonet_01_ammo_f.p3d was falling under terrain! Position corrected to ground [8345.56, 22.57, 11081.46]. Disable simulation to keep object under terrain.
but there is a some back story to that...
need to show more of the log.
aaanyway - not documenting weird usage, nope nope noppity nope π
that works too wtlf
want sum more fuckup?
case 1 : {3};
case true : default {
1
}}```To the well organized mind, default is but another great adventure...
thread created; you may need to !verify in #offtopic_bot_cmds for you to be able to do so as well
amma ban anyone not privateing their variables π
ah okay I did not see that one, thank you
switch (true) do
{
case default { 1 };
case false: { 0 };
case true: { 2 };
}
// 2
Whats wrong with that?
nothing
everything
just trying out the case default horrendous thingy
But riddle me this ^
Output 1
I'm confused, I have DMs from server allowed but the bot is still complaining
Actually i know why this works. Meh dissapointing
true not matching, therefore using the default block?
Yup. If it was true, would also be 1
but that means > The default block will be executed only if no case matches, no matter its position inside the code block. It is not a case, and will never be entered by fallthrough.
aint true
something like that yeah
evaluated anyway
case 1 : {3};
case true : default {
1
}}
// 1
Oh go on then:
switch (true) do {
case call { default { 1 }; false };
case 1 : {3};
};
// 1
switch (true) do {
case call { default { 1 }; true };
case 1 : {3};
};
// 3
switcheroo
I leave for like 10 minutes and I come back to Cursed Switch statements
Is it possible to remove environmental vehicle damage? So I can get these ai to stop breaking their tires
Maybe a handle damage EH? I'm wondering how to get it to recognize it didn't come from a player or ai though [just from crashing]
"" damage source
Word? I'll give it a shot, thanks!
well, rather go for "damage author" to be objNull
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage
isNull_instigator && _hitPoint == "theTyreHitPoint"
Alright, packed everything into a local mod, running on a dedicated server... is there some reason I can't see my functions in the function viewer?
Do funcs work?
If they must be in configFile
They are mostly functioning. Thats part of the problem, only some of my functions are operating :/
Did you accidentaly the functions?
Operates fine when run locally. For values of 'fine'.
Can you just not look up functions if the mod is loaded on the server?
So the function to add an action works, but the function that action is supposed to call can't be found π€‘
Yeah, tag ain't showing.
It does when locally running, but that doesn't do much good for usability :/
You are running the mod locally as well, right...
incident.
Alright, back to 101 basics.
My intent was to create a mod that only needs to be run on the server, as a companion for a specific scenario. I know mods can be run client-only, and most require client+server, so I was assuming that server-only was also an option.
it is an option...
It is, but any CfgFunctions entries won't be on the clients.
Which would make sense, because the action I'm activating is looking at the client's Cfg and saying 'woah nothing here boss' π€
Ah see, that would assume that I'm a good coder who doesn't absolutely fail to grasp the line between client and server.
A lot of exploding jeeps the last time we tried that, when I took this mod from 'everyone load it' to 'please only server load' and someone forgot.
... Ah, that also makes sense; I have a similar function to what I'm trying to achieve right now that works fine, because the action is an in-line function in the same file.
If very little code needs to run on the client then it's acceptable to send it, I guess.
It's not an incredible amount, but it is a whole looped timed script, I don't think sending it would be best.
Testing just throwing it in an in-line in the same file.
At least one version of that Advanced Towing mod transfers almost its entire codebase from server->clients :P
should really fix the version in Antistasi
Works so far. Alright, the problem is identified, at least.
And the follow up action has the same issue, trying to use a non-existing function... Alright.
srd_fnc_fhp_inlineActionAdd =
{
params ["_helipad"];
_helipad addAction ["<t color='#e2a750'>=Send Reinforcements</t>",
{
params ["_target", "_caller", "_actionId", "_arguments"];
_target setVariable ["fhp_Tasked",true,true];
[_target,srd_fnc_fhp_heliAction] remoteExec ["spawn",0];
},nil,5.6,true,false,"","!(_target getvariable [""fhp_Tasked"", false])",10];
};
[_helipad,srd_fnc_fhp_inlineActionAdd] remoteExec ["Call",0,true];
This is the (trimmed down) script I'm using to add the actions to the object.
srd_fnc_fhp_heliAction works in this context if I in-line it in the same file, and publicVariable it besides.
I decided I am gonna spend some time attempting to remake Liberation cause I think it could be fun.
What do you guys think would be a good way to go about detecting when players are nearby a zone?
Im thinking grab all the markers on the map placed for liberation and creating repeatable triggers to detect if a player is within a radius and then calling a script most likely
Is there a way to tell if a unit has finished playing an action initiated by playActionNow?
I generate Zones across the Map randomly and create Logics for Each of them to hold all the Details of the Zone within a Variable on each, I just have a Local Loop on the Player that looks for Logics within the Maximum Zone Distance and show them.
I haven't thought of how to check it server side yet
Could have the client remoteExec a function Server side to add the Zone to an Array for a Serverside Loop to handle.
I was planning to keep the marker portion to keep map creation similar to how its already done.
now you say you store details of the zone, this would basically be the same as having different types of markers right?
Im thinking triggers would be best to keep it simple and fast but would the way your talking about entail a speedier method of determining if players are within radius?
triggers I would just have activate on any player so long as the condition (most likely checking if ai cap is reached) hasnt been met
Well I have much more I want to handle about the Zones so for me it works best, but a trigger likely would do the job if you really wanted it to
I am handling quite a few properties for each Zone, Type, Side, Garrison, Buildings, Size, etc and likely a couple more down the line
Liberation handles only 2 of those, Side and Type
im kind of thinking each type of marker/trigger will have its own script. One for Radio tower, city, factory, and big city right?
Each script would handle its own ai spawning, maybe push the ai into its own global array for counting and handling later?
I would also plan to have the scripts handle patrols + garrisons and whatnot
is that a bad idea?
I get the syntax and whatnot and how to do things I want (most of the time) I just dont know about performance much
The only problem is you need to make sure it would only fire once for the first player that enters the trigger and it would by nature need to be able to reactivate at a later stage if the Players fall back or Leave the zone long enough for it to deactivate
You don't want a Zone to spawn like 8 times because you had 8 players walk in
right, well I could assign a variable to each zone that gets flipped true or false when the zone is active and check for this in the condition.
I guess its a question of how to look for deactivation. Maybe a countdown could be initiated in the triggers deactivation eventually deleting all the ai and setting the variable back to false right?
true
... Oh god I've been sending all of my functions to the clients already, that's why all my bullshit was working before T_T
But I wasn't doing it for my latest functions, hence why they don't work.
i have to ask tho... if its just for a scenario, why not put it into mission itself (description.ext)?
Clients and server both have same mission, hence have same cfgFunctions.
Why bother making a server only mod, just to send functions which are mission related stuff to client?
obfuscation maybe?
sure... i guess, but why obfuscate things like adding actions on objects...
This is a companion mod for Mike Force, and as divine punishment for my varied sins, I'm trying to do it as a separate beast and not just a fork of the base scenario.
It's a bunch of quality of life enhancements aimed at single/low player count servers, so you can slap it on top of any modload without causing too many conflicts.
ah so you are trying to change scenario without the need of repboing and reuploading it.
Yeh.
still doesnt make sense (to me) why you would avoid "shared" mod and stick with "server only", so you have to do shenanigans like sending functions to clients etc.
Cause obfuscation obviously isnt a goal here.
But i guess you have your own reasons.
Honestly, I don't, but I'm just really bad at separating server and client interactions; early versions required everyone to have the mod on, but it started cropping up issues with multiplication, resulting in a cascading explosion of jeeps I placed at the airfield for convenience.
It might be worth it to turn around and go back to client+server, and just resolve that issue.
i mean what you are doing doesnt solve multiplication, you are just adding extra layer of complexity. Makes whole thing harder to debug.
Overall just remember things with Global Effect (marked GE) on wiki, you most likely only want to run once (eg spawning vehicles), so always do that on server (to keep it simple). Things with local effect, you want to do on clients.
Your exploding jeeps is a prime example of running code everywhere and you spawned a jeep from each client+server
and most things are
{
//server stuff (things with global effect)
};
if (hasInterface) then
{
//client (player) - local effect stuff, sounds, hints, chats, UI, etc
};
if (!hasInterface && !isServer) then
{
//Headless horseless client
};
//Shared stuff, that will run on all machines
and code written like this should be safe to execute with remoteExec on all clients
Yeah, I've dabbled a bit on those filters, and looking at it I didn't put one in on the vehicle spawner... but on the other hand, I (cringe incoming) remoteExec'd them to the server, 2.
If you remote exec code to spawn a vehicle at the same time, its still gonna spawn as many vics as there is clients
Yeah, because everyone had a copy of the code running; even if it was only telling the server to spawn it, it was being told player# times... x_x
Yes. And by sending that same code during runtime doesnt exactly remedy the issue.
Fair point :/
I mean, at least it's only being sent out once, it's not like I'm constantly updating and resending... but it's still a weird way to do it.
For example, stuff with global effect, like spawning vic, you dont have to do it on server. You can create vic on client and it will be created for everyone.
But spawning large amounts of troops you wanna do on server, or headless client, to not overburden the players pc.
If you spawn unit on client, that players pc will have to calculate ai stuff like pathfinding etc. But if players pc sucks, they will rubberband etc
Yeah, I did that for the F100 spawner - action added to an NPC by the hangar, call remotexec'd to _caller to spawn it in.
But the current bugbear, a helicopter delivering troops, is local to the server. At least, how I have it so far.
Thats something of a poetic nonsesnse π
What you did is tell client, to tell server, to say back to itself, to spawn f100
In this case, you dont remote exec, you just spawn the thing
TBF, I did want to functionalize it, since it's a selection of like 10 different types, and that was easier to handle by passing it through a [] call
... I'll be damned, it looks like that'd work at least.
Umm... you can just use call, not remoteExec then xD
After the jeeps, I was being very careful about controlling how things were created π
If player is expected to enter that vehicle as driver/pilot, then the locality will transfer to them anyways. So its preferable to create it on client straight away and skip the middleman, well middleserver
Anyhow, good luck with that.
In the end, if it works, there is no wrong paths, there is just more or less efficient ones.
I'll settle for 'works' at this point T_T
can I not define a variable like so:
private ["_military", "_factory", "_bigtown", "_tower", "_village"];
Then use it as an array? _military pushBack etc
im getting undefined when I try to do so, do I need to do _military = []; first?
seems kinda annoying
Lemme try
Yes, you do.
Yeah Arrays need to be declare properly
That works fine for normal Variables though from what I can see
not sure what you call normal here.
For most variables you set the type when you assign data to them.
A single Value Variable
A number, right
but then you couldn't do this and expect it to assume zero or anything:
private ["_myVal"];
_myVal = _myVal + 1;
Well of course It wouldn't do anything with that _myVal wasn't assigned in the first place
Consider that this is also completely valid SQF:
private _myVal = [1,2,3];
_myVal = "wibble";
That's normally what happens when you assign Variables
They become the thing you assign it
pushBack isn't assigning, it's appending. I guess they could make commands like pushBack and set do "if this variable is nil then turn it into an empty value of the appropriate type" but that's pretty dangerous.
wouldn't work with set anyway because array/hashmap overloads.
What would be a cause for a server not being able to get allPlayers or playableUnits?
too early?
Is it possible to get the muzzle position in the world of a unit?
IIRC Leopard has a pretty epic script for that.
I created a client side mod that spawns an admin panel for the server I have, inside this admin panel there's a listbox that's supposed to get allPlayers, yet when I'm in the dedicated server and open the ui up the list doesn't populate. But if I host the mission myself in MP then the list populates with allPlayers on the server
Q: when dealing with the getAllHitPointsDamage and conversely the setHitPointDamage, what do the selectionNamesArray have to do with anything? is that for groups of individual hitpointsNamesArray items? also what are the damages in damagesValueArray? scale of 0-1 like damage, setDamage? thanks...
Log each step of your list population process to see where it breaks
selectionNamesArray are internal model selection names for appropriate hit point, you can set and get damages by these names with setHit/getHit
All damages are 0 to 1, yes
hitpointsNamesArray -> setHitPointDamage/getHitPointDamage
selectionNamesArray -> setHit/getHit
Index of getAllHitPointsDamage return can be used in setHitIndex/getHitIndex
So you can operate same hit point by its config name, model selection name or just index
sweet thanks for the shake down. so I could easily jam them into a HASHMAP and massage them out more meaningfully if I had to, thinking HP and damage pairs.
Using hit point indexes is the most reliable way, its possible to have identical config names or empty selection names for hitpoints
This can happen if asset designer messed it up (A3 used to have plenty of such cases), might still be relevant for mods
So if you want to 100% cover all cases, operate hit points with indexes
not sure what you mean, mess what up? as long as you are consistent with the HP name?
that is all setHitPointDamage takes, correct?
i.e. does not take an index
setHitPointDamage takes config name, but its possible to configure vehicle and have it have two identical hit points
setHit takes model selection name but its possible to have hit point with empty selection name, so you won't be able to set/get it with setHit/getHit
Example of it, back in the day main tank turret had HitTurret hit point, but then there is commander turret on top of main turret which also was named HitTurret
So you had 2 hit points with HitTurret name and setHitPointDamage would only work on a first hit point with such name
that so... so this code might be a possible kerfuffle, pending the object modeler...
{ _object setHitPointDamage _x; } forEach _hitpointsDamage;
as taken from our persistence model, deserialize object function
Official assets fixed it by renaming commander turrets into HitComTurret but it might still happen somewhere and likely in some mods
Same with setHit, if hit point points to empty selection, setHit ["", 1] won't work (or will only work on first hit point with empty selection name)?
All in all, if you want exact 100% coverage, use hit indexes
If you only operate main hit points (which are also hardcoded in the engine) like HitFuel, HitEngine, then setHitPointDamage is sufficient
filed under good to know, not sure we'll need hundred percent coverage, though
which the above, certain strategic parts, yes, that is the primary use case
thanks for the insight, plenty helpful
Fix one thing, break a dozen others T_T
Is hashValue ["", objNull] always guaranteed to be "YAb76Oozh/g"? π€
Running another instance of the game returns same hash, wondering if somehow can be platform-dependent?
hey guys, i could use some help. pretty sure its a coding/script thing. Iβm trying to use a fire effect module that is trigger activated by the module that sets damage to the these vehicles with no damage animation to simulate the vics being destroyed once theyβve been given full damage. Problem is I canβt figure out how to activate the module via the trigger. Iβm sure thereβs a code I have to use but I canβt find anywhere that says what that code is
doing this in eden btw
Q: about ``HASHMAP, given _keys createHashMapFromArray _values how are duplicate keys treated? last one wins? which I would half expect, or is an error generated? docs seem silent on the subject... I'll test, because I am curious... also somewhat in context with my above hitpoints questions...
["key", "key"] createHashMapFromArray [123,321] => [["key",321]]
I have my answer I think... meaning I need to smartly reverse the arrays for use with a HASHMAP
i.e. assuming setHitPointDamage meaning first named HP wins
Synchronize the trigger with the module
That is because the case is ignored (gets nil arg)
the default is executed first, which will correctly run the code, that then returns nothing, causing the case to be skipped
nu thats not how that works, the "do" is what returns value from switch, defaults return value got nothing to do with that
yes you can
case true : nil
means the : is silently ignored because you pass nothing
Yes because no case matched, thus the default runs
switch (false) would also return 1
No they cannot, because commands that get nil as arguments don't execute
So if case nil, or case ? : nil, case is ignored?
Its the hash of the type, and type is same across all platforms
yes
Every script command is ignored when you pass nil
nil call function
will not call function
This could cause some unwanted "it works but it shouldnt".
Maybe worth adding to wiki
Also what about this, where default is declared in child scope?
default executes, but the function returns false, so then you do a case false
Its equivalent to
switch (true) do {
default { 1 };
case false;
case 1 : {3};
};
Ugh
I tried ray and it didnβt work. Am I able to post screenshots in here so I can show the settings of them all?
Yes
But I don't guarantee that the hashing code will never change
general explanation of the situation
the fire module for effect
the trigger the module is set to
the object the trigger is set to
So fire modules constantly make fire, regardless of the trigger? Or do they just not make fire at all?
im honestly not used to the ones in eden or eden in general. im fairly new to mission making with eden and ive only really used the zeus module of which im pretty sure that one does fire the moment you put it on. in the fire module, i do see that theres a placement radius but even after altering that, it didnt show anything
So if you just play the mission there is no fire?
(Without triggering trigger)
Also, if that is true, then do trigger trigger (pickup that item), and check if fire perhaps appears on ground level. From what im guessing you have that ship floating in the sky
correct, if i play the mission, there is no fire. in this video is the mission being played and me placing down the custom fire module from zeus. as you can see that works immediately.
this is all on ground level actually. maybe a couple feet above it but i think i get what youre asking me to check. although, what do you mean "do trigger trigger (pickup that item)"
Well complete trigger condition
how do i translate that into code, if thats your meaning. if you just mean to play through it and se if the fire is on the ground, then ill do that now.
Yes. Just tp there and pickup the item thats supposed to make things burn
And then check on ground level
sir
you are a genius
i was going through the steps to show you what was supposed to happen and when i checked under, the fire was all there lmao
Yes but. That means you cant easily move fire upwards. Fire or smoke module will always create particle source on ground
hello!
Can someone explain what I'm doing wrong here? Everything works except for when it runs the remoteExecCall... It says that variable doens't exist. am I doing the str right?
{
_group = _x;
_group addAction ["<t color='#D61300'><br>---------------------------------------</t>", {}];
_group addAction ["<t color='#1D8EDB'>Start All Targets</t>", { startAllTargets }];
_group addAction ["<t color='#1D8EDB'>Stop All Targets</t>", { stopAllTargets }];
{
_group addAction ["<t color='#D61300'>---------------------------------------</t>", {}];
_group addAction ["<t color='#12E900'>Start Target " + str _x + "</t>", {["snipergrp" + str _x, "MOVE"] remoteExecCall {enableAI, "snipergrp" + str _x;}}];
_group addAction ["<t color='#12E900'>Stop Target " + str _x + "</t>", {["snipergrp" + str _x, "MOVE"] remoteExecCall {disableAI, "snipergrp" + str _x;}}];
_group addAction ["<t color='#12E900'>Target " + str _x + " Walking Pace</t>", {}];
_group addAction ["<t color='#12E900'>Target " + str _x + " Running Pace</t>", {}];
} forEach [1, 2, 3, 4, 5];
} forEach [snppc1, snppc2];```
well it seems it created it right under the thing i wanted it to be under. im currently messing with it to see if i can get it where i need
How do you remoteExecCall it?
Ah sorry didn't see it
Well... this doesn't seem fine like at all
Do you know what exactly it is, and how exactly it works?
If not, the pinned Leopard's explanation would help
to be honest, I've never used RemoteExecCall before. Just RemoteExec. the wiki says the syntax is the same. But I've never also done the nested foreach with a variable that needs to append the number.
I have it working except for the remoteExecCall.
Nothing is different than remoteExec, it is just spawn vs call but in MP
I can fix the enableAI function but I'm more so looking, what would be the best way to do the snipergrp and append the 1?
this is running in the mission files init.sqf btw
missionNamespace getVariable "snipergrp"+x. But can disableai even take group as argument?
No it cant
Also _group is a number in your case. And you need to put action on an objects.
So i guess all of your script is basically wrong
hmm, well it is working, just the remoteExecCall isn't.
But to answer your question, you are doing str right there π
so it should be: snipergrp + str _x ?
I know it wont work, but just trying to learn lol
before, I had a init.sqf file of over 2000 lines, I've gotten a lot of it down to about 800 - 1000 lines by using foreach lol
Well, i guess.
It wont do what you want but yes it will make "snipergrp1/2/3/4/5"
Oh nvm _group is okay, i didnt notice you have nested loops
I fear for what ever mission you have made that requires over 2000 lines in the init.sqf
its a training type map lol been working on it for about 10+ years now lol....
its traveled from A2 through A3
lol
thats a really cool sounding personal project
I have even more questions than when I started
wanna see it? lol

if youre feeling inclined to share, of course
But question. When you added addAction to group, where does action appear?
does addaction even accept groups?
My question exactly π
It shouldnt
But then again, it may have some undocumented "features"
on a PC that folks can select. this part of it controls moving targets that I have targets attached to an AI to allow moving targets lol
This is arma after all
And it DOES appear?
if you want to see it lol
It controls a 60,000+ object training map and I've gotten 30+ people on at the same time with avg 40FPS lol... I know, but it has been a project!
without the remoteexec it does
America explain...
lol
just dont flame me tooo hard on the init file lol
but im always down for contributions/help
What is startAllTargets?
Dear God the eventhandlers
so that one, when you hit Start All Targets all 5 groups that have popup targets attached to them will make the AI start moving.
Thats okay. But in the script context, what is it?
uhhhh how do i open this lol. pbomanager?
Notepad of any kind
yea, notepad. its not the actual pbo
oh wait is that all the coding?
Yes
ah i thought it was the mission file. i had a feeling it looked weird lol
yea the mission file is 422 files large lol
i dont knoe coding/script enough to understand what im looking at
Based OhMyPosh User
lol
when you said this, i thought you meant show the actual map. this makes more sense lol
{
// addAction to group... i wont question it
{
_x addAction ["Disable move on " + name _x, {[_x, "MOVE"] remoteExec["disableAi", _x];}];
} forEach units _x;
} forEach [group1, group2];```
Thats how id do it. Also untested and typed on phone, so mistakes are likely...
All the Hit event Handlers could probably each be turned into a one liner
// Adds "Hit" eventhandlers to the targets then moves the information from local into global.
L1_50L addeventhandler ["hit",{shooter1 = _this select 1; publicVariable "shooter1";}];
L1_50R addeventhandler ["hit",{shooter1 = _this select 1; publicVariable "shooter1";}];
L1_75L addeventhandler ["hit",{shooter1 = _this select 1; publicVariable "shooter1";}];
L1_150L addeventhandler ["hit",{shooter1 = _this select 1; publicVariable "shooter1";}];
L1_175L addeventhandler ["hit",{shooter1 = _this select 1; publicVariable "shooter1";}];
L1_250L addeventhandler ["hit",{shooter1 = _this select 1; publicVariable "shooter1";}];
L1_300L addeventhandler ["hit",{shooter1 = _this select 1; publicVariable "shooter1";}];
// Into
{_x addeventhandler ["hit",{shooter1 = _this select 1; publicVariable "shooter1"}]} forEach [L1_50L, L1_50R, L1_75L, L1_150L, L1_175L, L1_250L, L1_300L];
Doesn't change much, just looks nicer imo
Yea, I got it into a foreach but then I broke it lol Ill study yours! Thank you!
Thank you! Ill study this as well!
But yeah, overall, no offence but sweet lawd jesus...
so many globals
yea, I know lol I'm not a programmer. But I've tested things over the years and just found that setting it as a globalvariable makes things work in MP lol but over the last couple years, I've been learning about remoteExec.
The biggest problem you would run into is probably desync depending on how many things update and how often although it's mostly position updates that I find blast the network the hardest
hmmmmmmmmmmmmmmm
I do see desync but only when people join the mission
could that cause it?
I Accidently set the Position of a Player several times a second for a short period of time, needless to say I Desynced to hell and back and I was the host
If you don't see any desync apart from that I wouldn't worry
It's probably just the sheer amount of Globals getting sent over the network if I had to guess
yea, i want to figure it out tho lol it can be like a min usually a couple seconds.
ahh
It would only happen on Join mostly
yea, only on join
Since init.sqf is run on the server and each player
what would be a good alternative?
A minute is a wee too much in my personal opinion
yea, I used to see a min, but normally its only been about 10-15 seconds.
That's insane, but I wouldn't worry about it
do you think Global Variables in Triggers would also cause it? lol
It's likely just the sheer volume which you can't fix without just, well, doing less XD
yea lol
But i guess i wanna test that addAction on group now
I closed my game a short while ago after like 10 hours of ramming my head against the wall making a gamemode
oh no, Im sure it doesnt work lol
Best case scenario it uses the Leader of the Group
But but but you said it does
oh nooo, it works without the remoteExec. But this:
startTargetGroup = {
{
_snpgroup = _x;
{
[_x, "MOVE"] remoteExec ["enableAI", 2];
} forEach units _snpgroup;
} forEach _targetGroups;
};```
```sqf
_group addAction ["<t color='#1D8EDB'>Start All Targets</t>", { startAllTargets }];``` iirc works
but anyway, I wish I knew more lol but Ill keep stabbing at it! Thanks for the help! Need to get sleep for work... lol
sorry to tag you mate
do you happen to know the script for sometihng
i want a heli to take off as soon as a scenario loads and go to a certain point in the map
Waypoint in editor would do just that
^
I doesnt go up it starts up but doesnt go up
Please don't ping someone if the question is very generic.
noted
Waypoint must be farther than 200m from the current heli pos
hi there, is there anyway I can identify the cfggroup of an AI using objcursor code in the extended debug console? Or some other way to identify this for any AI unit group? cheers
Nope
thanks mate
@still forum - as long as your AI optimisations (don't calculate AI where it is not local) are not on trunk,
is disableAI "ALL" on clients an alternative to performance?
π
Don't know :x That would take too long to look up
empiric testing it is then π thanks π (and hoping this fix reaches Stable!)
disableAI "CHECKVISIBLE" should do it?
Although the other related command is dead IIRC so maybe that one is.
What if ai changes locality tho? That is then applied and bad things happen.
found out my error, cameraEffectEnableHUD true; should be executed after camCommit, and not on each frame, dunno why i missed that
yep, worth a Locality EH or simply no locality change
I was speaking theoretically, I don't plan to make a framework for now
Hello :D
Quick question, I am trying to use the addItemToUniform command: https://community.bistudio.com/wiki/addItemToUniform
It is working as intended however I'd like to be able to overfill a uniform, by overfill I mean keep adding stuff even if it is full, this command will stop adding items if there is no space, is there any other command or way to do so?
I dont think you can overfill the uniform, like you can overfill a box
no
Oh :(
Ah welp, thanks for the quick response.
Yea, not without mods at least, ACE allows you to do so if you edit the loadout after copying it and apply it again through the arsenal.
Not good practice tho since overfilled uniforms or containers aren't good, this is one of the few cases where I need it :/
you could add to the max load the amount you need for the specific item I guess
I want to spawn players on a Chinook on the air
as soon as the chinook is filled up with players I want to land the chinook in a certain position as a infil
define Filled
I don't know that you need to be specific. I feel like if you increase the load to whatever, add your stuff, then reduce the load again, it probably won't delete items over the limit
the chinook doesnt have any seat where players can sit
unarmed chinook full with players
Is there a way to script something to play a video or some sort of cutscene when a trigger is activated? Trying to add something to a multiplayer operation and basically need the player camera to be sent to a different location for around 20 seconds, preferably without the player themselves moving.
Sounds like a job for waitUntil and emptyPositions
So I'm working on a mission, I have a Cut Scene already made and working with a trigger. The issue that I'm running into is that only I can see the Cut Scene and not the other players.Current scripting: Trigger On Act. this exec "camera3.sqs"; //camera3 because this is the 3rd video of 3, working backwards on this.// camera3.sqs: player setCapti...
waitUntil {
sleep 1;
(_heli emptyPositions "") == 0;
};
following on from my hit points question... getting and setting them, looks great so far. however damage indicates 0. I gather does not translate to actual vehicle "damage" as it were. should I average the major components in terms of overall damage, i.e. fuel, engine, hull, body, etc?
If it can be fully damaged 1 and not blowup then I think it isn't considered major
what about⦠"GetIn" EH?
not really my question... I want to approximate the damage based on hit points. or is that not the driving factor(s) for a vehicle?
canMove
in other words you can tell if vehicle is alive, correct? which is a function of damage? or maybe it isn't?
That would also work. Personally I'd favour waitUntil as it's a bit more self-contained and I don't like to add whole EHs just for one event like this. Down to preference really, no significant performance overhead either way.
I spend too much time scripting Reforger hahaha ^^
Do you use ace?

