#arma3_scripting
1 messages Β· Page 505 of 1
yeah
but if you want external includes in description.ext you have to copy it into the mission pbo
Well the bug existed for over 2 years now sooooooooooo...
Or was it 3 years? Basically since 3DEN release
When was this created? https://community.bistudio.com/wiki/PreProcessor_Commands#.23include
Like, it would be sooo cool. To have all my functions and shit in one mod, so that any mission or person could reference that function/file
You mean when the concept of a preprocessor was created? That was in 1960s
To have all my functions and shit in one mod, so that any mission or person could reference that function/file Uh.. Why not just put them into a mod then?
Just use CfgFunctions from your mod
What would be an efficient way to log/save positions and then display them on the map later? I tried using an array and drawing the positions to the map using createMarker, but that seems to have performance issues.
you can use the drawIcon command to draw them on map when map screen is open
But performance wise not sure if that's better than markers
right now, it seems that the markers lag behind the actual movement, here's my code, which I know is pretty crap, but right now I'm just trying to get the bare bones working.
frameNumber = 0;
listNumber = 0;
addMissionEventHandler ["EachFrame",
{
if (frameNumber % 5 == 0) then
{
{
listPositions pushBack (getPos _x);
} forEach allUnits;
};
frameNumber = frameNumber + 1;
}];
_handle = [] spawn
{
while {true} do
{
sleep 0.1;
systemChat str (count listPositions);
{
_m = createMarker [(str listNumber), _x];
_m setMarkerShape "ELLIPSE";
_m setMarkerSize [0.5, 0.5];
listNumber = listNumber + 1;
} forEach listPositions;
listPositions = [];
};
};```
while {true} π
it might suspend inside your forEach listPositions loop, and then your EachFrame executes and adds new positions
Also "lagging" yeah.. That's scheduled code.. It lags
I didn't kind of see it
better?
listNumber = 0;
addMissionEventHandler ["EachFrame",
{
if (frameNumber % 5 == 0) then
{
{
_m = createMarker [(str listNumber), _x];
_m setMarkerShape "ELLIPSE";
_m setMarkerSize [0.5, 0.5];
listNumber = listNumber + 1;
} forEach allUnits;
};
frameNumber = frameNumber + 1;
}];```
frameNumber
https://community.bistudio.com/wiki/diag_frameNo
I'd recommend to use diag_tickTime instead of every 5th frame.
That way you can update every 0.1 seconds or so. Instead of like.. every second for very low FPS players, or 20 times a second for very high FPS players
How would I reference that? @still forum Just use CfgFunctions from your mod
I think he means that you should use this:
https://community.bistudio.com/wiki/Arma_3_Functions_Library
then these functions can reference includes in your pbo as I understand π€·
I may be overlooking something, but I can't seem to find a way to get what DLC an item requires reliably, pulling the DLC from the item and looking up it's appID in CfgMods isn't entirely accurate
i.e. The m-900 falsely identifies as Helicopters DLC while the Spar-17 has no DLC in it's config
Required being defined as you'll get watermarked using a weapon or can't enter a vehicle if you don't have the DLC
Β―_(γ)_/Β―
There's no command that takes classname. And if the config is incorrect as you've said, then there's probably not a reliable way
@drowsy axle CfgFunctions in a mod is same as in a mission. You define the functions the exact same way, and then you call them the exact same name
@zenith totem My function from KotH:
// Params: Config
// Returns: String
client_func_getConfigDLC = {
private _addon = configSourceModList (configFile >> "CfgPatches" >> configSourceAddonList _this select 0) select 0;
if(isNil"_addon") exitWith {""};
_addon;
};
Actually, have the whole thing, to also check if you own DLC required for config class or not:
client_ownedDLCs = getDLCs 1;
client_configsDLC = "true" configClasses (configFile >> "CfgMods") select {getNumber(_x >> "appId") > 0};
client_namesDLC = client_configsDLC apply {toLower configName _x};
client_idsDLC = client_configsDLC apply {getNumber(_x >> "appId")};
// Params: Config
// Returns: String
client_func_getConfigDLC = {
private _addon = configSourceModList (configFile >> "CfgPatches" >> configSourceAddonList _this select 0) select 0;
if(isNil"_addon") exitWith {""};
_addon;
};
// Params: String
// Returns: Bool
client_func_isDLCOwned = {
private _index = client_namesDLC find toLower _this;
if(_index < 0) exitWith {true}; // ΠΠ΅ ΠΠΠ¦
client_idsDLC select _index in client_ownedDLCs;
};
// Params: Config
// Returns: Bool
client_func_isConfigDLCOwned = {
_this call client_func_getConfigDLC call client_func_isDLCOwned;
};
Example usage:
(configFile >> "CfgWeapons" >> "arifle_SPAR_01_blk_F") call client_func_getConfigDLC => "expansion"
(configFile >> "CfgWeapons" >> "arifle_SPAR_01_blk_F") call client_func_isConfigDLCOwned => true
(configFile >> "CfgVehicles" >> "C_Heli_Light_01_civil_F") call client_func_getConfigDLC => ""
M-900 returns no DLC requirement like it should
Ah righty. Sounds cool @still forum
Does anybody know of the top of their heads if nearestEntities sort by distance?
did you mean https://community.bistudio.com/wiki/nearestObjects?
If more than one object is found they will be ordered by proximity, the closest one will be first in the array.
https://community.bistudio.com/wiki/nearEntities
According to Code Optimisation, this function is the fastest and should be used instead of nearestObjects when suitable.
And that is probably because it doesn't work. Looking it up right now gimme a few secs
oh holy macaroni... nearEntities iterates through all vehicles :U
Yep. not sorted by distance
nearEntities iterates through all vehicles
So it is actually faster then nearestObjects? π
maybe if you have nothing placed down on the map.
nearestObjects uses the quad tree to find nearby objects... That should be faster if you have lots of objects on map
is it possible to attach a map marker to a player?
No
You can set up a perFrameHandler to move the marker every x seconds, probably best using CBA_fnc_addPerFrameHandler.
waypointAttachVehicle is explicitly for GET IN type waypoints. I'm not sure if it is supposed to work for stuff like DESTROY
In the editor I believe you can drop a destroy waypoint onto a player character, right?
these are for attaching something to the waypoint. not other way around
Like the waypoint doesn't move with the object, it just set's the target object that the waypoint belongs to
Ah, makes sense. The same then.
Thank you!
Hello fellow scriptors.
I am looking for a way for a server executed script to create a public variable when a specific player triggers an event and eventually increment this new variable if he does it again (Just like the score variables in a scoreboard - individual to each player)
Depends on what you wanna do. Like if you set the target of a destroy waypoint to a player, the AI might automatically run to that players current position even if the waypoint is elsewhere
{
private _oldValue = missionNamespace getVariable ["TAG_MyCoolVariable", 0];
missionNamespace setVariable ["TAG_MyCoolVariable", _oldValue +1 , true];
} remoteExec ["call", 2]
you have to use the wavy line ~ to strike text. Not a dash
I added some detail to my request, would that change your answer ?
no that doesn't change it
execute that code. And the variable will be incremented server side and broadcasted to all players
ok so if an other player triggers this, will he have his own variable with his own increment ?
no
ah
well thats what i'd need
like in a scoreboard, i'd need every player to have his own var incremented with each time he triggered
{
private _variableName = format ["TAG_MyCoolVariable%1", remoteExecutedOwner];
private _oldValue = missionNamespace getVariable [_variableName 0];
missionNamespace setVariable [_variableName, _oldValue +1 , true];
} remoteExec ["call", 2]
Variable will be as you see above. Name and the owner ID.
So TAG_MyCoolVariable3 for example
You could also send the player name along as argument
This is very complicated for me to understand but I will save this and experiment it to understand it
thanks for your help
@still forum this script should be executed server-side right ?
My loop in which i'd like to execute this is server-side
so all I'd need to do is delete the remoteExec ?
no
then remoteExecutedOwner won't work anymore
So you have the object of the player available?
you could use his name or ownerID then to generate the unique variable name
hold on, I will adapt this to my situation, and show you
private _variableName = (GetPlayerUID eastPlayer);
private _ESM_touchFlag = missionNamespace getVariable [_variableName 0];
missionNamespace setVariable [_variableName, _ESM_touchFlag +1 , true];```
global variables always need to ahve a tag
private _variableName = "MyTag_"+(getPlayerUID eastPlayer);
private _ESM_touchFlag = missionNamespace getVariable [_variableName, 0];
missionNamespace setVariable [_variableName, _ESM_touchFlag +1 , true];
I see
so this would work server side
so now I'd like to understand how it works
if I get it all right :
I set a variable called _variableName that takes my player's UID
I set a second variable that takes my first var's name and vallue
UID as a string. String part is important as get/setVariable needs string type as variable name
then I set my second first var to increment itself
I set a variable no. GETvariable. not set.
takes my first var's name no. The name of the var would be "_variableName"
It get's a variable with the name of what's inside the _variableName value. And the 0 is the default value in case a variable with that name doesn't exist
Is there a vanilla functions/command to get all units that are visible in the Field of View of a player?
Like the thing choppers do when they have this target scanning
Not sure if this should go in scripting, or mission making, editor maybe? Anyway, I've noticed players slot in with their profile glasses instead of the ones that are default in their loadouts from the editor. Is there anyway to prevent this? I want my players to load in with the default glasses I chose when making the loadouts, not their gucci 2035 combat goggles they chose in the profile screen.
doubt it @frigid raven
Wait a few seconds before applying the loadout @tough abyss
Ah, ok. I'll just add in the intro script a little glasses change. Thanks! π
Problem is that glasses and custom face is applied a little after the game started, and potentially after your loadout script. Thus overwriting your changes again.
Making sure that your loadout script executes after that vanilla thing fixes that
after init?
after init is before init
I guess the waituntil player == player would fix that.
no
I guess time > 5 would be enough then lol. It doesn't have to be perfect haha
the vanilla code does essentially the same
your screen is black for ~15 seconds at start anyway. I can just put it somewhere in there.
I'd say waitUntil {!isNull player} (which is what you are ACTUALLY doing with that player == player) and then sleep 5 seconds after that
Ok, should I start use waitUntil {!isNull player}; instead of player == player? For future reference I mean. Which one of the 300 versions of doing this would be best practice?
== is just missusing the fact that comparing null types (player returns objNull) always returns false
best version is the one that's readable and understandable
well, isNull makes most sense then haha
if you see player == player you think "wat?!"
If you see !isNull player you think "yeah, wait till player is there"
exactly π
Is it possible to get getMissionConfigValue from set attributes in 3DEN in preInit? (not waiting for the expression to set a variable) aka accessing the missionconfigfile customattributes class?
Is there a way to make a on off switch bar on the gui editor that will stay in the screen where i can add my script and that i can enable with the arrow keys
I once again need your help bois
I wrote up some scripts which are in here:
https://codeshare.io/GLbLLk
Fnc_popup is compiled via the #include in the init.sqf
init.sqf runs first and remoteexecutes stuff from Fnc_popup
addAction then makes further use of Fnc_popup
Error:
popup and swivel targets in case "switch" do not at all behave like scripted. They just execute as normal targets would (i.e. shoot them, let them pop back up)
Fnc_popup is compiled via the #include in the init.sqf π€ CfgFunctions?
Fnc_popup = compile loadFile "customization\popups.sqf";
Oh and btw everything works on player host but not when actually tested on a dedicated server
also I should probably use preprocessFileLineNumbers
but that will not change my problem
servers init.sqf can execute before the client's init.sqf
meaning the remoteExec might arrive on the client, while the funciton is still undefined
that's why you should use CfgFunctions
Also remoteExec ["Fnc_popup", 2]; that doesn't make sense
you are inside a isServer check. That means you are already server
no sense in remoteExec'ing to server then
Line 58. You are checking a condition for every single target, even though the condition variable never changes
Check the condition once, and do 2 different forEach loops instead
ok so I have to look into CfgFunctions, I never used that before.
And do the condition change to 2 forEaches
the check in line 30 is also not really useful. The forEach loop just does nothing if the array is empty, you don't need a if to skip the loop
Also you set BIS_poppingEnabled to false 4 times, shouldn't once in init be enough?
Yeah that is still a left over from when I tested something with the swivels. I should totally remove that from anywhere except switch case "init"
the check on line 30 is for myself to see if there are actually any targets or swivels present around the object I call it on
Why would you remoteExec popups everywhere?
I do not, I only execute it on the server
only in the init.sqf dedmen said it wont make sense to make a status because its alsready with in a isServer condition
@tough abyss
oh wait
You originate the remoteExec on server with no target. No target == all clients
won't it be globally executed even if its within a isServer condition?
oh damn, the target was right
Honestly, I generally don't see any reason that one would need a remoteExec in init.sqf.
Also if you just have server specific stuff, why not just put them in a initServer.sqf instead?
because I am already confused enough and actually only need help with why those god forsaken popup and swivel targets won't do what I need them to xD
If it has potential to fix my issue, it has priority, other fancy stuff can be put somewhere else, can be done once all that shit works.
I'm not even sure whether the vanilla swivel targets work properly in MP as such...
I personally have the feeling that the eventhandler more specific the CBA function is somehow failing
they do not, but a dude from armamaniacs posted something about adding this: _target setVariable ["BIS_exitScript", false]; into the swivels init would make it somewhat work with in MP
A CBA function not working correctly... Is unlikely.
It has worked flawlessly for years. I doubt the error is in CBA if there is a error
that is likely because the targets which are executing the else condition in line 43 have no CBA assigned and won't Terc 1 none the less
even tho the eventhandler tells them to
weirdly enough switch case "init" and "reset" just work fine
no cba assigned?
uhm... well they do not call a cba function
sorry
language barrier
using words is hard
could it be an issue with the variable _popenabled?
don't see how
yea also can not be because all the systemchat were shown when I tested it
so its not the condition
currently doing the double condition to two forEach's thing
still no idea why the stuff within the eventHandler wont work
So up until now I am pretty sure its some sort of locality or compatibility issue with addEventHandler
or me missing the need to put some weird condition aomewhere specific
MP notes: "Killed" and "Hit" eventhandlers are executed where given unit is local.
W A T O,O
they are
doesn't matter then ^^ As long as code runs on server
then why would this still fail on dedicated
I am so confused. It works perfectly on player host
wtaf
@still forum would I have to use this?https://community.bistudio.com/wiki/addMPEventHandler
oh nice fork bomb dud
did you try adding diag_logs? are the eventhandlers not being called?
I could actually use a systemChat in each eventHandler which would tell me if its fiored or not
or 2 to see if the CBA function executes well within an EH
WAIT
I can at least say that the event handler at line 47
is not working at all
or just diag_log and you'll know if it's working and also if it fires on server or client
you can also use
to check that they are local. which they should be if placed in mission.sqm
@still forum all that is running in remoteExec server only... would the server actually transmit the locally created eventHandlers to the connected clients?
eg. do they even need to be synced to the clients to show the clients the properly setup targets?
The swivels are currently all in a weird spasm condition when on dedicated, fully extended in terc 0 not doing swivel at all
they seem to suffer from the same issues like the popup ones which us Hit and not HitPart
I will test one more time just to make sure
@still forum https://imgur.com/xtuizQo
@still forum If I would want to execute code on each connected or jip client for every object of a specific class (Target_Swivel_01_ground_F & Land_Target_Swivel_01_F) , how the hell can I do that?
remoteExec without target parameter
or target -2 for everyone except sdservnern
server
hm thats actually better than the if condition I had in mind
should so be possible via execVM as long as the code is set to if ("isDedicated)
because I really do not want to pre compile that
just run it once from the init.sqf
[] remoteExec [
"{_target setVariable ["BIS_exitScript", false];} forEach entities "Target_Swivel_01_ground_F";
",
-2,
true
];
that is all I could come up with x,)
as you can see in the syntax highlight.. that won't work
also if you'd read the wiki page for remoteExec you'd see that the argument there is a command or script function name
And yours is neither
@meager granite
Still doesn't work perfect, I'm thinking there's no way at all to reliably pull this information
i.e.
(configFile >> "CfgWeapons" >> "optic_Arco_blk_F") call client_func_isConfigDLCOwned => false
(configFile >> "CfgWeapons" >> "optic_Arco_blk_F") call client_func_getConfigDLC => "expansion"
(configFile >> "CfgWeapons" >> "bipod_01_F_blk") call client_func_isConfigDLCOwned => false
(configFile >> "CfgWeapons" >> "bipod_01_F_blk") call client_func_getConfigDLC => "mark"
I already looked at vanilla arsenal prior to sa-matra giving that code and it looked to be the same check, which also returns the marksmen for bipods
Ace arsenal seems to be same check as well
I'm loading up with ace now to check
Bipods also return as marksmen DLC in Ace Arsenal
Yeah. Is that not correct?
They're a free platform feature, you don't need the DLC to use them
But yeah, that check won't know that
They say DLC = "Mark"; in config
afaik the game itself iterates through CfgPatches and collects the units/weapons arrays from there
I don't think there is a way to determine what content is locked/premium or not from script commands without erroneous results
The game itself also uses the config though
no. arsenal is just for logo's, not specifically DLC
But the premium content locks seem to be some BIS magic
It's in engine yes
okay, I tried again (FYI I am new to the complicated side of SQF, I am really trying my best to learn this, but I am not a programmer or coder or what not.)
if (isDedicated!) then {
_localTargets = entities "Target_Swivel_01_ground_F" + entities "Land_Target_Swivel_01_F";
{
["BIS_exitScript", false] remoteExec ["setVariable", -2, true];
} forEach _localTargets
};```
@zenith totem do you have a example classname for a real DLC item?
That gets flagged as DLC but isn't?
oh wait, thats bull shit as well, nm
No a real one
SPAR is APEX, isn't it?
Yeah
@still forum
if (!isDedicated) then {
_localTargets = entities "Target_Swivel_01_ground_F" + entities "Land_Target_Swivel_01_F";
{
_x setVariable ["BIS_exitScript", false];
} forEach _localTargets
};```
no reason for a remoteExec anymore
@zenith totem
configFile >> CfgHints >> WeaponList
Has a list of weapons and their DLC appID if they have a DLC
And then there is also CfgMods >> Expansion>>Assets which lists the assets that belong to a certain DLC
Apex in this case
Just search for the classname in a AIO config and see where it appears
Got a link to one?
https://www.google.com/search?q=Arma+3+AIO+config
https://forums.bohemia.net/forums/topic/191737-updated-all-in-one-config-dumps/
https://forums.bohemia.net/forums/topic/191737-updated-all-in-one-config-dumps/?do=findComment&comment=3328016
https://www.dropbox.com/s/kmi3821iyvve0u8/AiO.1.88.145264.7z?dl=0
Thanks
@still forum I don't see any pragmatic approach on those config entries
configFile >> "CfgHints" >> "WeaponList" seems to just be an entry for UI which defines a weapon to show on the hint, it just seems more of a "try this content", here's a classname.
configFile >> "CfgMods" >> _dlc >> "Assets" also seems to be a dead end, some show base classes in their reference but others like the ERCO only have a specific variant listed
i.e. All three items here are DLC Items
private _assetRefs = [];
private _dlcs = "isClass(_x >> 'Assets')" configClasses (configFile >> "CfgMods");
{
_assetRefs append (("!(getArray (_x >> 'reference') isEqualTo [])" configClasses (_x >> "Assets")) apply {getArray (_x >> "reference")});
} forEach _dlcs;
[
_assetRefs select {"arifle_SPAR_03_khk_F" isKindOf [_x#1,configFile >> _x#0]},
_assetRefs select {"optic_Arco_ghex_F" isKindOf [_x#1,configFile >> _x#0]},
_assetRefs select {"optic_ERCO_khk_F" isKindOf [_x#1,configFile >> _x#0]}
]
[[["CfgWeapons","arifle_SPAR_03_base_F"]],[],[["CfgWeapons","optic_ERCO_khk_F"]]]
I'm thinking my next action is to file a ticket with a request for either
A) A command to check DLC status of given class/config
B) Fix/add config properties for required DLC (Not sure what the current DLC property is meant to represent)
~~@still forum You know the CfgFunctions you were talking about yesterday. How does this look? https://gyazo.com/451be1ff831b82f9d3cf36ee4aa39cd5~~
I don't understand why I am getting this error: https://gyazo.com/e0abf7ce63b3593a9b8da60867833038 <-- Error output from Addon Builder | https://pastebin.com/nSCkh3Cj <-- exportGUIBaseClasses.h I've checked for ctrlDefault and it is defined LINE:2353
it cant find this
for whatever reason
possibly some classes are not closed right and the class order is messed up
Id recommend packing with Mikeros PBOProject as it gives out far better debug info
@silk ravine you can pass array of types to entities, this way you donβt need to add the results from 2 different searches
Also _target inside call scope in remoteExec will be undefined, it is a separate scope
Oh wait, it is not even a call scope, you write a code where it should be the name of the function or command? Pretty sure slapping things randomly hoping this time it will work wonβt work.
@zenith totem So what are you trying to do exactly?
Bipod is from Marksman DLC but doesn't show DLC warning if you don't own it?
Determine what items show the premium content watermarks and what vehicles are locked if you don't own the DLC.
Bipods come from the Marksmen DLC, but they're a free platform feature anyone can use so shouldn't get flagged as a DLC item for my usecase
π€
I can't rely on the config method you use as it flags stuff like MXM (Khaki) as an Apex item but it's usable by all IIRC
There must be some kind of config reference that triggers restrictions then
So M-900 doesnt?
I own all DLC to check myself and have no alt accounts
You can uninstall the DLC in steam to check
I was testing on an alt account on my laptop until someone pointed that one out to me, can't risk redownloading all my workshop mods lol
M-900 has no premium content lock, yeah
So
After spending last hour looking all over config, turns out the answer is configSourceMod
configSourceMod (configFile >> "CfgVehicles" >> "C_Heli_Light_01_civil_F") => ""
configSourceMod (configFile >> "CfgVehicles" >> "B_Heli_Transport_03_F") => "heli"
@zenith totem
Then you do same check against getDLCs 1 to see if you own that DLC
If you don't, you'll get restrictions
With my scripts above, change contents of client_func_getConfigDLC to simple configSourceMod _this
Is there a way to override existing functions through another addon? I have like a core addon that has the func fnc_doStuff and then I have a integration addon that has also a function fnc_doStuff. Depending on a specific condition evaluated by script logic I want to have either one or the other logic to be the one that is called through call myMod_fnc_doStuff
I know about namespacing but think about it as having an error message "that function already exists" appearing rather than a quiet override of the latest function loaded
Yeah, you can override all functions but this will break Arma unless you carefully duplicate essential functionality @frigid raven doubt you wanna go that way
@tough abyss My use case is that I have vanilla functionality but when the integration addon is loaded it should executed script calls that are dependend on ACE3
For now I have therefore functions that are suffixed with _ace3 but I do not like that approach much because I have to create a check for ACE3 before chosing whether function should be called, the vanilla or the ace3 one
Sounds complicated
I am complicated
So to clarifiy. Is it possible to have duplicate function names with CfgFunctions? Because both addons would have that? Or do I have to omit the CfgFunctions definition in the integration addon and therefore recompile them manually via Script Logic?
I think the second approach is the only one that works eh?
If integration addon is dependant of the core it will be run after it and everything that has same class name will be updated/overriden
Yea ok I see
But without CfgFunctions defined I have to manually override / recompile them aye?
That's my goal actually. Depending on a specific editor module configuration the "integration" addon should override just some, not all, functions
Gonna try it out later - thx for the infos so far
Is there a way to know if a thing has physics?
A object for example a box or a crate
I'd go with https://community.bistudio.com/wiki/getMass
because In fact, none of these (non-physx) objects has a mass.
meaning if oyu get an object with 0 mass it is most likely a non physx object
Unless someone setMass to 0 on it
Β―_(γ)_/Β―
When developing a mod unpacked and having it within the mod directory (packed) and unpacked in the Arma3 root - do I still have to ... bind the P: drive thingie that is mentioned everywhere?
Why I ask? I managed to get it working with filePatching etc. to adhoc change files without repacking .pbo etc.
But one day it stopped working so I went back to packing and moving the Mod Folder all the time. I just realized that I might have missed to rebind the P: Drive again after I restarted my PC π
If this is scripting related
just put
call my_fnc_temp;
into the functions that are in your mods
and define that function in the debugu console
or profilenamespace
Depending on what you're testing
@meager granite After spending last hour looking all over config, turns out the answer is configSourceMod Will return true for an item in a DLC even if it is free to use, even though none comes to mind
@frigid raven you can overwrite the config entry via config patching. But you can't do it with script logic. You can compile manually without compileFinal.
Or use the CBA scripted functions system. Then you can run conditions before the functions get compiled
@frigid raven no arma doesn't look on pdrive
@tough abyss wenn now know that the issue lies in 2 parts. 1) the event handlers that work perfectly on player host will not fire at all in dedicated environment. 2) the code to fix swivel targets provided by armamainiacs mod functional swivel targets does not work. Working on both. But the eventhandler thing is definitely the more concerning issue here because we can't explain that behaviour.
If you want to look at it it's in there but note that we will replace addMPEventHandler with addEventHandler by next commit. We just threw it in because we grew frustrated with how FUBAR the whole training target thing was done. Looks like it was a sloppy side project noone ever actually finished.
https://community.bistudio.com/wiki/removeMagazines
Can some one update this example? its missleading to undestand that you need to put the weapon name instead of the string of the magazine like "rhs_mag_30Rnd_556x45_M855A1_Stanag"
lul who wrote that π
can you find me a classname of a vanilla magazine? 30rnd stanag?
30Rnd_556x45_Stanag
foxed
Hrm. Is the deletion of empty magazines when reloading a rifle or what have you handled by the engine via black magic?
Czech Space Magic *
@earnest ore If you're wanting to keep an empty mag, you may be able to use the Reloaded event handler to add back a mag if it was empty, you'd need to test that though.
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Reloaded
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/Reloaded
I recall this mod: http://www.armaholic.com/page.php?id=27697 doing just that, but i'm wondering if a more permanent solution is even possible with what's available.
You can see in his issues section that the mags still get deleted when you toss the weapon.
player addEventHandler ["Reloaded", {
params ["_unit", "_weapon", "_muzzle", "_newMag", "_oldMag"];
_oldMag params ["_oldMagClass", "_oldMagAmmo"];
if (_oldMagAmmo isEqualTo 0) then {
_unit addMagazine [_oldMagClass, 0];
};
}];
If it's already gone by that point, you'd probably need to add a keydown event handler to pick up the reload before the engine processes it, you'd probably have issues with other scripts blocking the input to engine but your script firing and adding an empty mag anyway
Or a pretty bad solution to that issue, loop and keep track of what mags the player is using and add an empty mag of that type on a reload EVH
You may be able to use EVHs like the reload itself to get rid of the loop if that's the only way you can get that idea to work
You'd need to expand the script to figure out if it's Throw/Put / whatever you don't want an empty mag for too.
Figured i'd try and take a crack at the 'ammunition and magazines as seperate items' approach from Dayz and Tarkov.
Guess i'll be fighting with Czech space magic.
Hey guys, how can I get a player unit reference dynamically for the purpose of scripting player specific events in a live zeus mission?
Assume I have access to ares script module/debug console.
For example, a player JohnDoe joins my zeus mission. I want to use allowDamage on JohnDoe.
Can I extract the object reference from bis_fnc_listPlayers?
By using a name="JohnDoe" filter? I guess that would work, gotta test it though
allPlayers
ARRAY select CODE
But the name has to 100% match
which isn't that easy everytime
Is there a way to get object reference by player list as admin?
findIf
I'm pretty sure the unit you drop the module on gets passed into the parameters. You can check it, maybe just drop the module on a unit and hint str _this;
With Zeus and debug console you can use curatorSelected as well.
Yeah I have a ton of curatorSelected # 0 # 0 snippets ready to go =p enjoy
(that gets you the single unit you select)
I may be misunderstanding the problem, @ornate sky you could just doop the code module on the unit. The code module returns an array returning pos and object. Ex: [[x,y,z], objNull]
Use _player = _this select 1 to get the player you want to modify in your Achilles module
Yes, that will work I believe, because I did not know the module passes anything, I don't know why I missed that
How can i use isKindOf to find if a class name is clothing?
isKindOf "UniformBase" I guess. Or something similar
"U_B_CombatUniform_mcam_tshirt" isKindOf ["UniformBase", configFile >> "CfgWeapons"]
returning false
i cant find that keyword
if is Vest_Base, Backpack_Base etc for the other items of clothing or is there one term i can use for all?
Uniform_Base worked btw
backpacks are CfgVehicles and "Bag_Base"
But. That's what mod makers are supposed to use
Mod makers don't always do what they are supposed to do
Its for vanilla anyway, but where are you finding this or is this just knowledge
Vest might be "Vest_Camo_Base" but many mod makers don't follow that and use "ItemCore"
im creating a util function where i can pass in a class name for nearly any item and get the displayname
http://tikka.ws/class/index.php?b=cfgWeapons&c=V_PlateCarrier1_blk look at vest classes and see what the inheritance chain is. And find the common factor
There is BIS_fnc_ItemType which returns what type an item is
And not using the faulty isKindOf method
bookmarked, I will use that function then instead thanks
Hello, I'm currently with a problem. I want to add a protective shield around a turret on a vehicle with the Attachto command. I have so far been able to, but it's not rotating with the turret. I found out you have to use setDir and getDir. Now, I'm not good with scripting, so if anyone could help me out. I currently have this:
_vehicle = _this select 0;
_turret = _this select 1;
while {true} do
{
_tanktur = getDir [_vehicle,[0]]; //get direction of commander turret(if you want the gunner turret just make it [0]
_tanktur setDir _turret; //set direction of your turret
};
But this throws an error
Well aside from the fact that we don't know what _vehicle or _turret are, or whether this is being executed in an unscheduled environment improperly, or what the error even is, what I can say is that you're using the wrong syntax for getDir
I'm executing it like this in the init line:
null = [this, kit] execVM '\hades_hmmwv\functions\setdir.sqf';
in the init line for the vehicle used
kit is the static object that's going to be attached
Well then I can also confirm that you're using the wrong syntax for setDir as well https://community.bistudio.com/wiki/setDir
I'm a total beginner at scripting, I have no idea what you're talking about
Read the wiki
getDir
Description:
Returns the object heading in the range from 0 to 360.
Syntax: getDir object
Alternative Syntax: pos1 getDir pos2
``` Nowhere there does it say anything about `getDir Array` being a valid syntax
If you can't help yourself, there's really not much that we can do to help you.
Spoonfeeding you answers isn't going to accomplish a lot. Because then you don't even know why you're doing what it is you're doing
Well, okay then. How would I get the heading of a vehicle's turret?
https://community.bistudio.com/wiki/weaponDirection looks to be one way (for main turret only)
alright, thank you
Alright, I have managed to make it work, it rotates with the turret now, but the shield is now backwards
_vehicle = _this select 0;
_turret = _this select 1;
while {true} do
{
_currentturret = currentweapon _vehicle;
_array = _vehicle weaponDirection _currentturret;
_dir_degrees = (_array select 0) atan2 (_array select 1);
_turret setDir _dir_degrees; //set direction of your turret
};```
from the documentation: https://community.bistudio.com/wiki/Modules
// 0 for server only execution, 1 for global execution, 2 for persistent global execution
isGlobal = 1;
Can sb. tell me the difference between global execution and persistent global execution? Is it like being added to the JIP queue so new players will receive that code as well?
Would _dir_degrees = (_array select 0) atan2 (_array select 1) + 180; work?
Nevermind, got it working. Thank you all!
while {true} without any delay will execute many times per frame, while simulation is only once per frame, so you are wasting your CPU, nothing is wrong with that if that's all you have in mission
Hey, quick question: What do the # does in _musicClassArray # floor random _arraySize;. Can't find any documentation on it (script based on Walords Jukebox). If I delete it it doesn't work anymore but if I replace it by select, it works so is that the same or is there a difference?
= select
no difference at all?
Okey well thanks but why isn't that mentioned on the wiki?
ah no, nvm, didn't read the last comment on select -_-
@austere granite nope, there is the Important difference of predecence
@cunning crown # is executed first most of the times while select is just on Spot 4
More Info at
Oh, interesting to know, thanks π
OMG I wish I could return all the time I have wasted typing select everywhere π
Any ideas on what the Error Zero divisor means?
@lost iris well⦠:3
you tried to delete by zero, or select over an array capacity, or an undefined/badly defined variable
@lost iris What does the full error text say?
I think its fixed i changed my array from this [["",[]],["",[]],["",[]],"","","",["",["","","",""]],["",["","","",""]],["",["","","",""]],[],[]]; to this [["",[""]],["",[""]],["",[""]],"","","",["",["","","",""]],["",["","","",""]],["",["","","",""]],[""],[""]];
It may be because some of the arrays within the array didnt have quotes with in them maybe
For complicated arrays, I suggest you use new lines and tabs like you typically do with {} brackets, to make it more readable
My eyes
You probably did a select 0 on an empty array @lost iris
Now that they are all filled the issue is no more
I don't see why you need an empty array like that anyway
Zero divisor means the array element does not exists
use param instead of select
Does anyone know if curator objects (i.e. from allCurators) are local to each zeus? Or would I need to get the assigned units to remoteExec something to all curators?
@winter rose sqf will tolerate non existing select if it is right after the existing one without error, sort of like .end() iterator
Same goes for select 0 it should not give error
@zenith totem only the curator module that player is assigned to will be local to him.
@frigid raven Is it like being added to the JIP queue so new players will receive that code as well? Yes. That would alteast make sense.
@astral dawn OMG I wish I could return all the time I have wasted typing select everywhere should have most likely used params ^^
It is all fun and games until # fucks up with fucked up preprocessor
I'm thinking about getting rid of ASRAI and looking for a way to increase AI reaction times
I have the ACEx headless client and it usually gets great frames, but I'm looking for a more reactive set of FSMs, might even write my own
I'd really like more aggressive use of suppressive fire
way more aggressive movement
and faster aiming
Try https://community.bistudio.com/wiki/setAnimSpeedCoef that should turn AI into terminators
@tough abyss true! (so might have been a select 1 π)
@leaden venture also setSkill
Is there a way to make AI lean left and right? I thought there was an animation for this, but that wasn't it.
You can try switch move or play move, I think those are called xxx_adjust
Ah no, try playAction with AdjustXXX https://community.bistudio.com/wiki/playAction/actions
adjusts are just stances, leaning is something else.
1.91 must be mistake, we are at 1.87 so there is 1.88 release then 1.89 dev then 1.90 release before that, sound implausible
Dev is 1.87 how could it be
Dunno dev updates are rare and shallow
@still forum It will return no mod for say M-900 which means its available without owning the DLC
(I am fast with responses, yes)
Do I need a script or something in order to be able to go into Zeus, spawn a weapons squad, then assign the weapons squad to a player already in game?
I know I can join the weapons squad with Ace... But I want to be able to take command when I join.
Alternative, can I just set my rank to always out rank the spawned in AI, join their group, and it auto give me lead?
In Zeus you can group anyone to anyone by selecting the subordinates and Ctrl + Click dragging to the new leader.
So I can ctrl + click & drag onto a player (NOT AI)?
If the player is part of that Zeus' editable objects (has a circle).
If player is not, you can use script to add
By default I cannot see the circle unless I add in the Ace utility (forget what it's called) which allows me to see pre mapped items & players
You can run this in debug console or server init to add everything {_x addCuratorEditableObjects [allUnits + vehicles, true];} forEach allCurators;
I will add that, thank you. Did you get that from https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3
Or well.. Use that source at least
The commands are there. The use case as an example, probably not.
Alright sweet. I will do some research. Thank you.
ty
Some script documentions tell this part
*
* Public: No
*/
Example: https://github.com/acemod/ACE3/blob/master/addons/aircraft/functions/fnc_initEjectAction.sqf
What exaclty is meant by this? Aren't all functions possible to be called public ?
that means you are not supposed to use it and that it's argument or return values might be changed at any point without notice
Ah alright
so when I want to use addons API I have to look for functions that are marked as Public to avoid any problems
Yeah. OR just trust that they might break your code
I have trust issues
How are variables and arrays implemented in the engine? I mean it's most likely a C++ struct or class. Any idea what fields there are inside them?
Why? any specific question about it?
Was thinking, should I rather make an array with a few elements, or make the elements separate variables. What would take less space.
And it's just an interesting thing to know on its own
@astral dawn check sqfvm
it is as close as you can get to actual engine sources without having engine sources
and to your question, it depends on how you want to access them:
private _tmp = missionNamespace getVariable ["MyVariables%1", _index]``` would be a classic case for an array
however, if you want to just "save space"
then just do not do it
it is not worth it
it is not worth it
Allright π€·
Looking at SQFVM
Roughly arrays are vectors, variables are hash maps
Thanks... if it's std::vector, it takes about 24 bytes for housekeeping, as I've found in the internet. I guess it's smaller than an entry in a namespace (allvariables).
@astral dawn What would take less space. well variables store the name of the variable and the value. The array just the value
it is as close as you can get to actual engine sources without having engine sources Actually Intercept is closer. As it's the exact same binary layout
No RV is not using STL it is all hand rolled
The array just the value
And the 'housekeeping' stuff because it is an array, which appears to be 24 bytes.
if it's std::vector, it takes about 24 bytes for housekeeping depends on data type
Each item may have overhead too
No RV is not using STL it is all hand rolled
You mean it doesn't use std::vector?
yes
No it doesnβt
Oh allright, thanks
rv::vector π
GameArray
AutoArray
FindArray
Namespace is https://github.com/intercept/intercept/blob/master/src/client/headers/shared/containers.hpp#L1647 with some boilerplate
Actually. I have namespace somewhere
https://github.com/intercept/intercept/blob/dfa2ce681154337a1640ea7fa2d00576fb44349b/src/client/headers/shared/types.hpp#L724 here it is
It will take some time to understand π Thank you
anybody dabbled with the enfusion scripting in dayz yet?
Wrote like 5 lines
how long were the lines?
20 chars or so
Ah. I remember
it was my performance test finding out that enscript is 1000x faster than SQF
what kind of stuff did you test?
Just some loops and math operations and time keeping
there's no docs for it yet right?
Simple stuff like 5*5*5*5*5*5*5*5*5*5*5*5
There is
there is a doc file in the files
jesus
Kinda C# like. With On-clicked events in the Enscript class that you can bind to the UI
so is it a whole new system, or just a nice editor for the painful dialogs from arma?
both
i don't know whether that gives me hope or not
might have a play around with enfusion soon but without any AI or vehicles i dunno how fun it'll be
everything DayZ modding related is 10x more painful than Arma modding right now
Why?
Because most of it is broken or half implemented
when are you going to make a VS code plugin for enscript dedmen? π
I fully trust you to do it
never
why
The workbench stuff is good enough
and I never could make vs code plugins π
nice being able to use familiar editor
Is there a function that can be called to return the current status of flaps for a VTOL?
Maybe animationSourcePhase
Thanks, will look into that
Similar question, is there a function for checking whether or not auto-vectoring is currently on? I don't imagine that correlates to any defined animation.
There exists a isAutoHoverOn command
Nice! Thank you.
_x addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
if (( getDammage _unit)+ _damage >= 1) then {_unit setdamage 0.9} else {_unit setdamage ((getDammage _unit) + _hitDamage)};
systemChat str _damage;
}];
So, this atually avoid units to die and get really low healt, but how does this overrides the return of damage by the handle? I though that it must return something from it like 0.
otherwise the unit would still get the damage still, but some how is just returning nothing?
so how does the unit still alive afther setdamage 0.9 + the damaga that it returns? or the order is the oposite?
most of that code is garbage that doesn't work
( getDammage _unit)+ _damage >= 1 If the unit would get more than 100% damage. Then set it down to 0.9, If the unit wouldn't already die from the shot it will execute the else statement which does... nothing. Literally. It does nothing
it does.
_hitDamage is undefined. Meaning number+nil returns a nil. meaning _unit setDamage nil get's silently ignored and does nothing
_x addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
if (( getDammage _unit)+ _damage >= 1) then {_unit setdamage 0.9} else {_unit setdamage ((getDammage _unit) + _damage)};
systemChat str _damage;
}];
still, the unit does not die
and the code return no value
maybe "nil" automatically falls back to 0 ?
How can I check what is returning?
you can't
or well. you can't see what the engine does
it's obviously returning nil as systemChat returns nil
How about systemChat str getDamage _unit at the end?
no, the chat is actually returning the damage made, even when its above 1.
Just to see what _unit setdamage ((getDammage _unit) + _damage) does
But that doesn't matter. As you return nil at the end
and if Arma really falls back to 0 if you return nil...
I don't have time to check that now
but would explain why he doesn't die
unless if the handle returns the damage before the code
because, if it was returning afther the code the unit would die.
what?
no it wouldn't. If my idea is true
then any hit would do 0 damage
not killing the unit
the code would be aplied and then the handle would do the damage, killing the unit
Do you even read what I'm writing?
so if the handle has no code returning the damage made then it just returns 0 or nil?
If you return nil. You will have returned nil
what the engine does with that nil is unspecified
but it needs to have some kind of fallback
like
this addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
systemchat str _damage;
}];
the unit would still be alive?
if it does fallback to 0 on nil. Then that code would make the unit invincible
Yes, if you don't put _damage; or another number at the end of the code, you make the unit essentially invincible.
Also if there is a second HandleDamage handler after yours. Then your return value will be ignored
that might also be happening
just check that and the unit still dies
unless there is a second HandleDamage overriding it
Maybe a race condition resulting in seemingly random behaviour
The handlers getting added in different order every time
testguy = group player createUnit ["B_RangeMaster_F", position player, [], 0, "FORM"];
testguy addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
systemchat str _damage;
}];
this guy still dies
one shot
Then don't play with nil, but return an actual value as the EH expects...
Yeah stop playing around with undefined behaviour
thats the thing, even if I add nothing to return but use setdammage seems to override the effect
testguy = group player createUnit ["B_RangeMaster_F", position player, [], 0, "FORM"];
testguy addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
systemchat str _damage;
_unit setDammage 0;
}];
this guy now is invunerable
yeah your first code doesn't prevent the unit from dying
did you mean to ask why he doesn't die?
yes
because the handle is supouse to do the damage if it does not return anything
Thats why im saying that the handle return the damage before the code
or some how gets ignored by setdammage
ask me that again in 9 hours and I'll look it up
can I let that in chat for you for more look at it?
Isn't it often the case that when a unit gets damage, that the EH gets triggered multiple times? diag_log would be way better than systemChat...
could be yeah. You can see multiple systemChats too tho
Maybe the damage that would kill the unit is in an earlier trigger and a later trigger can cancel it with your _unit setDammage 0; part. Who knows
There is also the problem that if it did return the damage before the code, it could kill the unit before the code
Not if it only can get killed after all EHs are done.
They are related to different selections of the unit when I remember correctly. I did some logging a while ago, but can't remember all details.
Sorry for interfering other questions. Feel free to answer when time.
This is executed on my dedicated server side
["CAManBase", "killed", { call coopr_fnc_onKilled }] call CBA_fnc_addClassEventHandler;
But coopr_fnc_onKilled is never called. When testing in preview it does work but - that's not an excuse but an info
CAManBase ... wasn't this just an Arma 2 thing?
Nvm it still exists
So i have my file for door animating but i am unable to to get the door to open, cant seem to make a decent SQF for opening doors
any help?
with the statement for Doors
What did you try?
for statment i done this = statement = "[this] execVM ""\doortester\data\fn_frontdoors.sqf"";";
Doesn't tell me anything though
what do you mean by what did i try? thats what i thought you meant cos thats what i used in the Config for like door actions etc.....
Do you use something like
_building animateSource [_source, 1];
nae
_source would be a class name of a subclass of ```sqf
(configFile >> "cfgVehicles" >> typeOf _building >> "AnimationSources")
@languid tundra this is what i have done & thats what i get when i go to open the door, im still learning on how to animate doors & that
What I was interested before is what is the code of \doortester\data\fn_frontdoors.sqf?
You were asking about SQF after all
nvm
@languid tundra https://imgur.com/a/jfbL281
you forgot double quotes at the end
thats what the sqf has
The error message even says missing ""
missing what? i dont see it
Check the statement attribute in the image you posted.
statement = "[this] execVM ""\doortester\data\fn_frontdoors.sqf"
you only have a single double quote at the end
instead of three
So only have 1 (") at the end?
So just have a single double quote? that 2 of these ? = ("")
Now i get this? @languid tundra https://imgur.com/a/K6JrvX2
Good, you fixed the first issue
Yeah but now i have this when its in the right folder lol
@languid tundra https://imgur.com/a/5Vvfjoi
So doortester is the PBO name
yeah
Hmm, you don't work with PBO prefixes. Have to think about what the default is...
Unless you specify one in the Addon Builder...
hmmm im no to sure what you mean by Default. still learning how all this stuff is done π
You are using BI tools for packing the PBO, aren't you?
yeah
Open the Arma 3 Addon Builder and click on OPTIONS
You should have an entry called Addon prefix there
yeah i have that the box below its blank?
Add doortester there for fun and see what happens
then pack the pbo?
yeah
I though by default the PBO name would be used as prefix, so it should be unnecessary...
Still, let's see what happens
So it should work now when i load it up on arma? iv been at this for hours trying to figure this out to, always assumed it was a typo lol
Well, typo would be a likely explanation...
yeah got the same thing, "Script \doortester\data\fn_frontdoors.sqf not found :L
P:\doortester\data\fn_frontdoors.sqf
Thats the path i have of it lol
Your PBO Addon folder structure is flawed anyway
flawed?
maybe
idk what flawed means lol
Where do you put the PBO?
in a addonns folder for the models i make & put in, normally its just static models which dont need memory lods & Sqf's for lol, but i put it in "C:\Users\Stephen Allen\Desktop@Tester\addons"
Nvm, I didn't think it though. If you had a faulty structure, your config woudn't work in the first place, but it does as you can interact with the door and get a script error.
see i dont know any other way to have a door animate open with the statment for opening doors in the config so i just put in in a sqf but if theres an easier way that would solve this issue then id be sorted but i dont know another way
The script error tells you that the suggested path to the script passed ot execVM is wrong. Don't see the error yet though.
hmmm, is there any way i could do it another way with out using a script unless i could use the default arma one? dont know if that would work
Sure, there are various ways. You could put the code in a function defined in cfgFunctions and call it or put the code directly in the statement attribute.
well i wouldnt be to sure how to put that in the cpp, would have to create a cfg functions bit like cfg vehicles would i not ?
But again, if you pass the wrong path, you will get errors again.
It's the preferred way to define functions
yeah, well you know how i would call user actions for open door close door etc.... on this? or would i have to completely change that aswell because the way i have done my code is pretty dodgy to be honest lo
Let's first check how the door opening interaction is done by BI.
BI's way would be preferred, since it also allows scripters to lock doors.
oh i see well im still learning so its only a learning curve sort of thing for me, been watching videos on it & thtat so im prosuming the door opening interaction is on that link you pasted for Arma 3 Functions libary
You can learn a lot from how BI implemented stuff. It's not always superior to other approaches, but can still be a guide for a first implementation.
il need to see about using BI's way about it, cos the way i have done it is obs the complicated way to do it lol
I'm checking out the config
my config?
Nope, one of BI
ah i see isee
How would I π
screenshot i sent xD
Check for instance Land_i_Stone_HouseSmall_V2_F in the config viewer.
BI has created a function already
statement = "([this, 1, 1] call BIS_fnc_Door)";
condition = "((this animationSourcePhase 'Door_1_sound_source') < 0.5) && (cameraOn isKindOf 'CAManBase') && ((this animationSourcePhase 'Hitzone_1_source') < 0.99999 )";
so if i add that in as a statment on my Config it might work?
You will have to adjust the condition
Door_1_sound_source and Hitzone_1_source are likely different names in your case.
i would probaly just leave hitzone source the same & the door sound could just make that my sound for it ? like the path?
You can use the same names for sure
Btw. the lines I copied is for the openDoor case
oki doke cheers lad, sort of got it working now π
3.39002e-007 > 1 //false
why is it returning false? isent that high than 1?
3.39002e-007is 0.000000339002
hello, was wondering if anyone could give me a hand (would be very appreciated), one of the things I have a hard time wrapping my head around in arma is how to reference an object without giving it a name with a script (so I can copy and paste without having to edit the script or rename anything) for example the current mission I'm working on I want to stand in a trigger area and have the block under it change color so I made this script _nObject = nearestObject [player, "Land_VR_Block_05_F"]; _nObject setObjectTextureGlobal [0,"#(rgb,1,1,1)color(1,0,0,1)"];
This works but the problem with it is, it targets me so if another player is in the trigger area it will change the closest VR block near me.
"ReviveDelay" call BIS_fnc_getParamValue; //return 0
this does not return the right value I set in the editor, is there other way to see the the values of revive?
@west mesa You want to change the color of the block under the trigger? Use thisTrigger as the argument in nearestObject. WIll return the block nearest to the trigger object, and not to the player triggering it.
@ruby breach hm when I replace player with thisTrigger I get an undefined variable error
Is the code you provided in a function being called by the trigger, or in the trigger itself?
the trigger is calling a script
Pass thisTrigger as a argument to your script
@ruby breach alright thanks, gonna have to look up how to do that not the best at scripting π but i do appreciate your help!
No problem. https://community.bistudio.com/wiki/call / https://community.bistudio.com/wiki/params should help
thanks
when a unit is unconscious it lost all actions and the AI canot heal that unit, nay fix to get the vanila actions back?
What actions it lost?
Just restating the question from before - mybe now sb. is awake to have an idea what the problem here is?
This is executed on my dedicated server side
["CAManBase", "killed", { call coopr_fnc_onKilled }] call CBA_fnc_addClassEventHandler;
But coopr_fnc_onKilled is never called. When testing in preview it does work but - that's not an excuse but an info
What does it return?
I have seen the same question when I went to bed yesterday π
My thought was killed might be local. But shouldn't be
@frigid raven ```sqf
["CAManBase", "initPost", {_this call score_fnc_unitInit},true,[],true] call CBA_fnc_addClassEventHandler;
score_fnc_unitInit = {
params ["_unit"];
if (!local _unit) exitWith {};
_unit addEventHandler ['killed',{_this call score_fnc_onKilled}];
};
cba doesn't have killed I think
Can't remember but I think that's why it's like this
But how does it work on my preview then?
https://github.com/CBATeam/CBA_A3/wiki/Adding-Event-Handlers-to-Classes-of-Objects killed is one of the examples on that page
@tough abyss good questions - need to debug later in the evening
Β―_(γ)_/Β―
I wrote this a long time ago
but I tried using cba with killed
and for some reason I ended up with that
@tough abyss There we go. Dev-branch update is out.
Increased Dev-branch EXE version to 1.91
Added: say3d command extension to exclude speech category sounds from the filtering
local
I don't quite understand your question
stuff on server is also local
local to the server
So I guess the answer is.. "Yes" ?
Depends what you want to do
If you want to execute the code on every client. You of course want it on every client.
for exemple:
addMissionEventHandler ["EntityKilled", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
systemChat "some one died!";
}];
If I put that on initserver.sqf all players will have the systemchat when a unit dies?
That should only run the once so probably best on the server although there are other ways to do it too without it running on the server.
if you put that in initServer noone will have the systemChat
because systemChat only prints locally. Meaning on the server. And a dedicated server doesn't have a chat
so that is "local"
local means on the machine where the code runs
If you add the eventhandler on the server, the code will only execute on the server. If you only add it on a client, it will only execute on that client
Yeah, thats what I need to know.
Is it me or created displays and dialog now have built-in fade in timer?
@still forum Must be all those hot fixes
Looking to have a script that runs for a given vehicle wherever that vehicle is local that continuously checks certain conditions and takes actions as appropriate. Only part I'm confused about currently is what's the best hook to start that loop and what conditions should I be checking to make sure loop terminates so that I don't have it running after locality has changed, vehicle has been removed, etc...
Greetings, did someone maybe know how to hide objekts at the MianMenu-Arsenal? Maybe even with an example?
*main
In a mission I know you can blacklist and whitelist objects from Virtual Arsenal, however I don't think you are able to hide or disable items from VA when opening it from the main menu not unless there's a mod that does it .
"hide" ? Why not?
Hello
I'm looking to adapt the size of my dynamicText depending on the UI size of each player for it to be automaticly adapted and not work for some and bug for others.
[format["<t color='#FF0000' size = '2 * (getResolution select 5)' shadow='1' align='center' font='PuristaBold'>Match will start in %1 seconds</t>",(Preptime)],-1,safezoneY + safezoneH - 0.2,1.5,0,0,4002] spawn bis_fnc_dynamicText;} remoteExec ["bis_fnc_call"];```
Would this work ?
Looking for a little help with an sqf for some crates here:
//this goes in the init field of the crate
//nul = this execVM "loadouts\SOCOM_riflebox.sqf";
if(!isServer) exitWith {};
_crate = SOCOM_Supplybox;
clearMagazineCargoGlobal _crate;
clearWeaponCargoGlobal _crate;
clearItemCargoGlobal _crate;
_crate addWeaponCargoGlobal ["SMA_HK417_16in",5];
_crate addWeaponCargoGlobal ["SMA_HK416CUSTOMCQBafgB",20];
_crate addWeaponCargoGlobal ["SMA_HK416CUSTOMGLCQB_B",20];
_crate addWeaponCargoGlobal ["SMA_HK416_GL_ODPAINTED",20];
_crate addWeaponCargoGlobal ["sma_minimi_mk3_762tsb_wdl",5];
_crate addWeaponCargoGlobal ["hlc_rifle_416D10_gl",20];
_crate addWeaponCargoGlobal ["hlc_rifle_416N_gl",20];
_crate addWeaponCargoGlobal ["hlc_pistol_P229R_Combat",20];
_crate addWeaponCargoGlobal ["hlc_muzzle_556NATO_M42000",20];
_crate addWeaponCargoGlobal ["SMA_supp1BOD_556",20];
_crate addWeaponCargoGlobal ["sma_gemtech_one_wdl",5];
_crate addWeaponCargoGlobal ["sma_gemtech_one_blk",20];
_crate addWeaponCargoGlobal ["hlc_muzzle_TiRant9S",20];
_crate addWeaponCargoGlobal ["hlc_muzzle_556NATO_KAC",20];
_crate addWeaponCargoGlobal ["SMA_SFPEQ_HKTOP_BLK",20];
_crate addWeaponCargoGlobal ["SMA_ANPEQ15_BLK",20];
_crate addWeaponCargoGlobal ["optic_LRPS",5];
_crate addWeaponCargoGlobal ["sma_spitfire_03_rds_black",20];
_crate addWeaponCargoGlobal ["SMA_ELCAN_SPECTER_GREEN_ARDRDS_4z",20];
_crate addWeaponCargoGlobal ["SMA_eotech552_3XDOWN_wdl",20];
_crate addWeaponCargoGlobal ["SMA_MICRO_T2_3XDOWN",20];
_crate addWeaponCargoGlobal ["hlc_acc_TLR1",20];
_crate addWeaponCargoGlobal ["HLC_optic228_Siglite",20];
_crate addWeaponCargoGlobal ["HLC_bipod_UTGShooters",5];
This is a video of the problem https://youtu.be/3gkMZC-u6P4
Would prefer to stay away from arsenal if at all possible.
I have seen that before... Was caused by tons of people adding/removing items at the same time
Problem is there is only me doing it in that video. Also at most of the times guys are on the server there are maybe 2 guys working on the crate at same time
I'm currently encountering issues in the hide and get loadout functionality.
My get/put goggles functions are working as intended.
I fixed this issue, was due to the scope of my variables.
So I convert player's eyePos into his vehicle object's model space. Store it and every time interval I compare the new value with an old one like this:
// _unit is player
_nul = isNil {
private _eyePosNewVeh = (vehicle _unit) worldToModelVisual (ASLTOAGL (eyepos _unit));
private _eyePosOldVeh = _unit getVariable "eyePosOldVeh";
if ((_eyePosOldVeh vectorDistance _eyePosNewVeh) > 0.15) then {
systemChat format ["=== Prev pos: %1, new pos: %2, distance: %3",
_eyePosOldVeh, _eyePosNewVeh, _eyePosOldVeh vectorDistance _eyePosNewVeh];
};
_unit setVariable ["eyePosOldVeh", _eyePosNewVeh];
};
It's fine until the vehicle starts to move. Then the eyePos in vehicle's space starts to jump around. Like vehicle's position and player's eyes pos are not in sync. Any way to avoid this?
You probably shouldn't mix commands with the visual postfix with one without it like here
private _eyePosNewVeh = (vehicle _unit) worldToModelVisual (ASLTOAGL (eyepos _unit));
I tried to replace worldToModelVisual with worldToModel but it still works bad
You probably shouldn't mix commands with the visual postfix with one without it like here doesn't matter
Well it started working nice when instead of ASLTOAGL (eyepos _unit) I got player's VISUAL position.
But how do I get his eye pos in visual scope then?
Aren't the ones without visual more of an average?
visual ones are interpolated
they are the thing that you are actually seeing being rendered
Well, then. What about the isNil part? Are you using scheduled env?
yeah
Why not something like a for each frame EH?
Yeah I tried to debug it in onEachFrame {}
by attaching a test sphere to the car at the returned position
it was jumping around as well
Hmm. Anyway, BIS_fnc_addStackedEventHandler would be the preferred approach.
so problem is eyePos is jumping around?
Apparently
hmm I'll test it, thanks
But if I use commands like this:
https://community.bistudio.com/wiki/lineIntersectsWith
I think they use simulation time scope, right?
How come when I use unitCapture and UnitPlay, tires dont move on the replay?
Because the function doesn't record animation states?
Tires should still spin
I'm watching tutorials, and on theirs, tires and even steering wheel moves
Just tested in the editor. The functions are inconsistent between replaying on the player unit, and an AI unit. AI unit nothing moves. Player controlled unit the tires would spin, but on a vehicle like the Zamak some tires would rotate backward. Things like engine sounds are also dependent on the player or AI having the engine on before the replay begins.
tl;dr: Bad functions are bad
@still forum
Thx a lot, _unit modelToWorldVisualWorld (_unit selectionPosition "pilot") did the trick, although I used "head" selection. Also lineIntersectswith works a lot better if supplied visual coordinates.
Why isn't this working?
[(_this select 1),0.1] spawn {
_Vehicle = _this select 0;
systemChat str (_Vehicle);
_Time = _this select 1;
_Vehicle addEventHandler ["Fired", {
_Vehicle setVehicleAmmo 1;
}];
};
If I do _Vehicle setVehicleAmmo 1; outside of the eventhandler it works fine
the EH is firing correctly, I added a systemChat
Because _Vehicle is undefined in the eventhandler
this addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
}];
Also, params
So how do I define it for the EH?
just add params ["_vehicle"]; ?
SO just add params ["_vehicle"]; ?
fired
unit: Object - Object the event handler is assigned to //argument 0
``` You tell me
Is the event handler assigned to the vehicle?
If so, then the first param is the vehicle
Correct, with more functionality to allow you to define default/allowed values
It also makes variables private by default, instead of you having to use the private command
Okay, but how do I pass variables from the main scope into the EH?
Because I notice the _Time variable isnt getting to my EH
AFAIK you can't. But you can either store the variable in missionNamespace (not ideal) or in the object you attach the EH to (better)
Nothing gets passed into it because event handler is a totally different scope
Why do you want time in your EH anyway? WHen the vehicle fires, do you want to know the time when the EH was added?
vehicle1 addEventHandler ["fired", format["_vehicle2 = %1",vehicle2]]; you can do something like this if you really need to
you can create event handlers with code {} or with a " "
so when you use format you can create some things to pass arguments
That's not actually doing anything different though
There's really no point to using strings for EVHs, as it just adds compile time
All what you posted did is the same as using a global variable in code
Does handleDamage not work?
The EVH? It works
Hello
I'm looking to adapt the size of my dynamicText depending on the UI size of each player for it to be automaticly adapted and not work for some and bug for others.
[format["<t color='#FF0000' size = '2 * (getResolution select 5)' shadow='1' align='center' font='PuristaBold'>Match will start in %1 seconds</t>",(Preptime)],-1,safezoneY + safezoneH - 0.2,1.5,0,0,4002] spawn bis_fnc_dynamicText;} remoteExec ["bis_fnc_call"];```
Would this work ?
It is second time you are asking this, why donβt you paste it in debug console and try it yourself?
Is there any non-breaking space character accepted by Arma strings?
Oh nvm found it on wiki
decided to rewrite my phone in pixelGrid. https://gyazo.com/b09be74ef26b56bd49782c5e66e2670b what do you guys think of the spacing of the buttons
@wary vine Well what to think, looks proper.
@unreal leaf vehicle1 addEventHandler ["fired", format["_vehicle2 = %1",vehicle2]]; you can do something like this if you really need to No you can't. That works with numbers and strings. Not with objects and tons of other things. Please stop telling people that. Use setVariable/getVariable on the object the eventhandler is assigned on.
so when you use format you can create some things to pass arguments You are NOT passing any arguments when using format. You are just putting a string together that happens to contain a string representation of a value.
Quick question:
Is spawning/keeping logic entities considered a performance hit?
To clarify the terms: how different is it from spawning a (non physx) vehicle/object or a unit?
How many of them could be considered an issue?
By spawning I mean keeping them for the runtime of the full mission, not the actual creation (which is only done once).
I want to use them to modularize script components an so on. Kind of like Singletons
There would be one for each component and about 30-60 in total depending on granularity
logics are simulated yes
Why do you need logics? Can't you just run the scripts..... without them?
Ofc, it's just for grouping them.
Easier to work with probably
Basically namespace creation is the goal π
I heard ACE uses locations for that
CBA uses them yeah
because they have 0 performance impact besides rendering when you have map open
Hey, is addMissionEventHandler global or local? I already looked on the BIKI but it does not say if its local or global.
local
how can i run a script every 5 mins?
one way is to put it into a loop that sleeps 5 minutes
what kind of a script would it be though?
Thats what I did
its a script that randomly select and objective location every 5 mins
another question as well, is there a way to respawn a player back to the location the unit was placed in the editor, lets say respawn a player back to lobby
@young current
for that I have to say maybe. Im not that well versed in mission making.
np, thanks anyway
Question in regards to ACE, ace_interact_menu_fnc_createAction, I want to reference and add some icons to these interactions. My script (Olsen framework module) is found in modules\advanced_actions\.
The icons which I want to use are in modules\advanced_actions\resources\.
How would I properly reference these icons for arg 2 of ace_interact_menu_fnc_createAction?
just use the full path
well I guess the path wasn't correct then
So the full path would be modules\advanced_actions\resources\icon_name.paa then correct?
I've taken these icons out of the game in various but how would I best reference the icons in the games PBOs?
(In terms of efficiency and reliability.)
mission or mod?
I assumed mod
mission will either work like you posted. or you will need to find the mission fullpath
it's the path to the CUR_MP thingy
It's not constant. you need to dynamically retrieve it
there is code for it on KK's blog
Hey there, quick Question. I am currently creating a warlords scenario in the editor. The official "custom asset list" in the discription.ext requires full assets like "B_Soldier_F"(https://community.bistudio.com/wiki/Arma_3_MP_Warlords). Any one has an idea how to use arsenal customized loadouts?
TIL compile and compileFinal are caching results.
Today I also learned, <REDACTED>
And this way you can <REDACTED>. I'm sure that's fun in MP if you can disable whatever function you don't like.
@queen junco First have a read of #rules before you seek help
Oh crap. Guys. Stop frigging using call compile.
Everything you compile is added to that cache and never removed. Meaning if you use call compile on things like extension returns and such, they all accumulate into what's essentially a memory leak.
So if you continously feed the same string into compile it's not that bad (It's still stupid though...) but if you always compile different things, like database returns, or by format'ing things into eventhandler (Yes, Eventhandler strings or addAction strings are compiled too, everything that is compiled is cached, not just the commands) everything add's up till you exit the game, or it crashes because it's out of memory.
I don't really see a fix though. Maybe let cached things expire if they haven't been used for some time? That's probably the best solution
Or an option to disable the cache might be good. Seems the ultimate solution was to allow an alternative, like they added whenever ago
They probably knew about it and that's why they added parseSimpleArray. But they should've been WAY more vocal about this problem...
Did you find this out by accident π ?
I was investigating that https://discordapp.com/channels/105462288051380224/105462984087728128/526162914500018177 bug when I stumbled upon this. Didn't know that a cache existed
Oh God, this explains some memory leaks I created during tests π
Commy just mentioned that in ACE Slack.
Remember when they added parseSimpleArray? BI said it's faster than compile and better and everyone should use it. People profiled it and found it to be actually slower than compile so most people didn't see a need to switch.
Now we know why compile is faster. Because compile only compiles once and then caches the result.
lol. You can really see it too. Go into editor and paste that in debug console watch field (random 50000000000) toFixed 20 Then let it run (only in windowed mode) and watch Arma's memory usage in task manager. You can literally see it slowly climb up
parseSimpleArray not caching data?
yeah
but it dont work with string and already the circle of its use is narrowing
Wow..
onEachFrame {
_arr = [];
_arr set [500000,random 1215235345];
compile str str _arr;
};
You can see your memory usage increase in 100MB steps every half a second.
Ouch
replace (call compile) it turns out not to what?
is that a typo? now instead of not?
Honestly.. No idea..
Maybe expect BI to fix it with already upcoming 1.90
unlikely to happen
That's my Christmas gift to BI
Charcoal*
Well that explains a lot of the problems with memory climbing with everything. That is an amazing find. My mods all just compile once and then utilised the returned code but this is so common you see it throughout a tonne of mods
Even compile once is a waste. I didn't check that really. But I think the instructions array is copied and the instructions too. For something that's just compiled once it's a huge waste
Compiling the same thing often is "good" now.. Theoretically
Shouldn't be a huge waste, it will be hanging around a bunch of references to the code but that is all the compile code is also presumably doing so it shouldn't waste much in the way of memory unless I have misunderstood you.
CBA also has its caching mechanism as well and I imagine that is getting called as well (since I use PREP and FUNC).
@still forum that is actually wrong on so many levels π¦
I have a vehicle spawner spawning boats for the players, it spawns the boat at a remote location and then moves that boat into the boatrack on the destroyer
I'm using the following code in the code line for the vehicle spawner
deletevehicle (getVehicleCargo boat_rack_1 select 0); boat_rack_1 setVehicleCargo objNull; boat_rack_1 setVehicleCargo this;```
and it works fine for the first go, the problem is ```getVehicleCargo boat_rack_1``` is an array that seems to keep growing every time I add a boat. I thought ```boat_rack_1 setVehicleCargo objNull;``` would clear that but it doesn't
So as it stands I would have to increment the select 0 every time I spawn a boat which doesn't seem right
I guess what I need to know is how to clear that array rather than just filling it with <NULL-object>
Anybody know of a nice none-ace repair script that repairs sections of vehicles?
@still forum makes sense for functions as they are all string loaded from file and compiled to code and the string never changes
I think parseSimpleArray primary benefit was secure data to array conversion from client extension. Now that client extensions need to be approved it is not as important
No it's in a vehicle spawner module (MP)
Essentially it is getting run on the vehicles init I guess
In MP it will be executed on every client I imagine so you would get dupes and brokens
Also maybe you should unload and then delete rather than delete and then unload
Everything seems to work right, the boat spawns in the corner of the map and the first time it runs everything is fine, subsequent times though it just continues to fill the array
I put getVehicleCargo boat_rack_1 in a watch list and every time spawn a boat I just end up with another <NULL-object> and the boat spawned gets pushed further into that array
undefined behaviour is undefined. It might work one time it might work 10 times it might not work at all, you should use if (isServer) or if (local.. if you want to put stuff in init
Honestly I've used this vehicle spawner before a lot and added all sorts of commands to the vehicles through it. I don't think it's that.
Hang on I'll load up ARMA again and try without the spawner
Not all the time, but depending on if you put local or global commands in it
I get what you're saying, god knows I've had my run ins with locality in the past, but it just seems weird that boat_rack_1 setVehicleCargo objNull; doesn't empty the getVehicleCargo array
instead it just add another <NULL-object> to the array
it could be a case of I have to empty the rack before deleting the vehicle
@umbral oyster Try something like
call compile format ["[%1,%2,%3]", random 100,random 100, random 100]
vs
parsesimplearray format ["[%1,%2,%3]", random 100,random 100, random 100]
@leaden summit lemmie try, what are the classes for rack and boat?
Land_Destroyer_01_Boat_Rack_01_F
and I'm currently using a modded boat
I think I know what the problem is... it's me I'm the problem
Works fine here, still would suggest to unload the boat then delete it
I had at some stage turned off simulation on the boat rack and when it worked initially loading the boat I didn't think it would cause issues π€¦
This won't affect me using compileFinal for my functions though right ?
what do you mean @wary vine , what else could you use for function?
Thats been mentioning so many times π
@wary vine everything is cached once seen. So your functions are also cached even though there is no need if they just get compiled once. Your code won't dynamically change though so the impact isn't that big.
But there is no alternative for compile. So you have no choice anyway
Okey I checked now. The string of the code is cached, but that's stored in the instructions anyway ( refcounted, so there is only one instance of that code) and the instructions are also refcounted. So the only waste is an array of pointers to all the instructions and a couple more pointers. Not really a problem.
The main issue here is that temporary things are suddenly permanent. In a call compile you don't care about the answer for long, you just wanna call and then you throw it away. Problem is it is not thrown away, it stays till you exit the game.
Go to a public server, play a mission there, disconnect. The functions of that mission are still in your memory. Now connect to a different server with a different mission with different functions. Now you have another load.
Especially big for framework missions like Liberation. They have tons of code, that you cannot get rid of anymore once you join the mission once.
I can make a logger I guess π€ log which script files at which lines are calling compile. And accumulating the length. That should make finding problems easy π
BI should make a logger for profiling branch
color[] = {0.92,0.93,0,1};
how to get other colors?