#arma3_scripting
1 messages · Page 257 of 1
b:ARRAY inareaarray ARRAY
b:ARRAY inareaarray LOCATION
b:ARRAY inareaarray OBJECT
b:ARRAY inareaarray STRING
u:switchcamera OBJECT
I'm guessing that allows you check whether multiple objects are inArea in one go?
[player1, player2, player3] inAreaArray _markerRandom >> [true, false, false]
@opal thistle
- optimization last
- optimization work is done based on statistics
2 is hard(er) in arma
one has some options though
- debug.log in diag.exe show long running sqf and fsm
- wireshark et all to analyse traffic
- log amount of script calls (total and per minute/second)
- log amount of network calls
- compute data sent for each network call
(talking about network traffic optimization)
that aside one can try to improve coding design/architecture ofc - depends largely on goals and specific setup though
someone with access to the source code could also create a mapping for mpnetwork.log - atm it only shows ids, but it logs the amount of different network calls (init, pV, setVar, etc)
@polar folio I don't think you can get around the weapon sway from HitHands. And you have to prevent handleDamage from overwriting your "states" without changing the health system
it's a mess
again. i was just trying to reskin units to make them bloody like if all body parts are damaged except the head
only visual
appreciate the help though. i'm curious though. why would you want to disable arm injury induced sway? i think it's a neat feature
You can't do that
why would you want to disable arm injury induced sway?
can't do that either
I looked everywhere
all hard coded
just like how vehicles with HitEngine == 1 blow up after ~5 seconds
or was it changed to HitFuel? It was one of them
Think its hitfuel, the crippled walk occuring at 0.5 health bugs me :/
@opal thistle ALiVE uses setVariable on logics/modules quite a bit for it's OOP-ish bits, haven't heard of major drawbacks so far. Also check out CBA's hashes.
@opal thistle this: https://www.reddit.com/r/armadev/comments/3haiax/improving_the_speed_of_associative_maps_with/
is pretty dated. we found a nice method of creating "pseudo namespaces". Instead of select STRING you use getVariable STRING.
testNS = [] call CBA_fnc_createNamespace;
for "_i" from 0 to 1e7 do {
testNS setVariable [str _i, _i];
};
(takes a long time ofc.)
testNS getVariable "13221"
0.0022 ms
@tough abyss probably 1 thread in general; depends on some specifics though
kju_laptop - Yesterday at 9:13 PM
b:ARRAY inareaarray ARRAY
b:ARRAY inareaarray LOCATION
b:ARRAY inareaarray OBJECT
b:ARRAY inareaarray STRING
feel free to update the wiki
Anyone active?
no
sweet
Does anyone have any ideas why selling a vehicle from the garage in altis life is crashing my server?
Hi Guys. Just a quick question about remoteExec. I am adding an add action for all users using a specefic item ingame. Current the code looks like this:
params["_object","_screenMsg","_scriptToCall",["_arguments",""]];
fnc_addActionMP = {
params["_object","_screenMsg","_scriptToCall","_arguments"];
if(isNull _object) exitWith {hint "Object is nothing"};
_object addAction [_screenMsg,_scriptToCall,_arguments];
sleep 1;
};
[_object,_screenMsg,_scriptToCall,_arguments] remoteExec ["fnc_addActionMP", -2];
My question is why does it add multiple action menu lines? I know -2 means it will execute on everyones pc except for the server but I thought it would only show one action line but allow everyone to execute it.
While testing this I made the target 2 then it doesnt show at all, since I suppose it only executes on the server.
So I am a bit confused how to use it effectively. Any direction would be appreciated.
Executed from a stand: null = [this,"Teleport to ACE Medical Training","scripts\teleportScript.sqf","marker_training_medical"] execVM "scripts\addActionMP.sqf"; Will do.
and where is that line located?
if it's
for example from the init.sqf
then every client and the server will execute the remoteExec
which means that you have one action for every connected machine
No its added in the init of the item, thus locally on the server
Thats whats boggling my mind
what do you mean by init exactly? Editor init box?
Yes, object init
That is executed on every machine
So every machine will send the event to every machine
n^2
Seriously? I always thought that all items with codes in the init will only be executed on the server.
Not the init box. That will be executed everywhere
in theory you can simply omit the remoteExec and switch to addAction
I just can't remember if these persist through respawn
And if I add if (isServer) exitWith {}; to the script?
I mean if !(isServer) exitWith {};
Same problem
Oh. The second line might work
But it's really overcomplicated
I mean. You filter out all clients, just to send the remoteExec to them
Not really needed
Also
There is a general problem with your approach
You remoteExec that "fnc_addActionMP" function
But that requires the function to be defined on the clients in the first place
defining it in init.sqf won't do, because that is executed after the object init in multi player
I hear you. But for some reason, when I added it normally some people are able to use the addaction, others wont.
Yes, because you made a race condition
if the remoteExec of "fnc_addActionMP" arrives before that function is defined locally (by executing the object init line)
then the function will be undefined and no action will be added
I dont exexute it in the init.sqf. I execute it in the object init of the object placed in the editor.
I didn't say init.sqf
even the object init boxes can be executed after the remoteExec command arrives
So the remoteExec arrives, but fnc_addActionMP was never defined on the client
Your whole approach is overcomplicated which introduces problems like this
Should I then rather define in description.ext as a cfgFunction?
I still believe that you don't need the remoteExec in the first place
so no CfgFunctions entry is needed either
I understand I might be overcomplicating it, I am just trying to wrap my head around the everything
If you make it simpler it will be easier to understand
It being hard to understand is the first sign of it being too complicated
First of all
You don't need fnc_addActionMP at all
all the function does is use addAction
So you might as well just remoteExec the addAction command
that would get rid of the need to define a function
And secondly. You're adding the function at mission start
But you have full control of what is being executed on the clients already
By utilizing init.sqf and all the other init boxes/files/scripts
So there is no need to use remoteExec on mission start in the first place
Another minor thing. You planned to execute the addAction everywhere, but the server
But that doesn't really make sense if you think about it
In single player, you are the server
And even in MP, headless clients don't need the action, but they are clients
What you really want is a hasInterface check
(remoteExec can't do that)
Only add the action on machines that "have an interface"
which means that there is a player sitting behind the keyboard on that machine
Same problem with local hosted MP
The host would be the server and would lack the addAction
Ok I will execute it directly. I developed it for MP, so thats why I didnt bother about the server. Just added the target as 0 to test it and change it when I tested on the server. Thanks for that command, first time I have seen it, definitely usefull
You mentioned that respawning might cause the command not to persist. I will test it to see if so but any suggestions to circumvent it if it happens?
I'm not 100% sure. I think the usual method is to utilize a "respawn" event handler
I don't use addAction much.
And if I would, i'd probably make a framework to fix all these issues first
I mean, we do use it for some hacky implementations in ACE.
But it's all behind frameworks, so you never actually use the command
Maybe use onPlayerRespawn.sqf somehow? Regardless, thanks for all the tips commy. Appreciate it
Hey guys i am trying to wrap my head around https://community.bistudio.com/wiki/Object_Oriented_scripting_shell do you know of a place with better examples other than the Wiki. Trying to find out how do i reference object attributes within the constructor function
There is this: https://github.com/CBATeam/CBA_A3/blob/master/addons/common/fnc_addPlayerAction.sqf
if you're using CBA. That should persist
All you need to do is to call it in init.sqf
on every machine with "hasInterface"
I don't know anyone who ever used that @earnest path
What would you need that for? Opening these BI functions is pretty intimidating
Thanks Commy, I should really dig into CBA. THey have sooo many usefull command. CHeers!
I am trying to make an ambient transit system so busses travelling on routes and picking up and dropping off passengers. I want to have a nice encapsulated structure for the code and i can not find a descent structure anywhere. That link that i posted looked quite nice but there is 0 information about it
I hope it still works. It's one of the functions I haven't maintained for A3
ivaylosp
I think you are better off just using the actual busses as objects with setVariable/getVariable
There is a reason that there isn't much info about it. It's probably all quirky and broken
is there a quick and easy case-insensitive variant for "find" ?
(_haystack apply {toLower _x}) find toLower _needle;
ok thanks
quick, but not easy
private _index = -1;
{
if (_x == _needle) exitWith {
_index = _forEachIndex;
};
} forEach _haystack
_index
the array is already lower case, only the needle is upper - so the first version is much simpler^^
_haystack find toLower _needle
then
imo
it's good practice to make all arrays lower case
if you plan on using find in etc. at least
noted. im working with hitpoints and config data though
Yeah. If you always toLower on every input you should be good
a bunch of FSM questions:
some say FSM processes faster, some say it's not. I heard FSM processes conditions generally faster due to its differewnt realization
that's true?
I see that FSM allows a natural re-usage of the states in the logic, which is a bit hard in sqf
The FSM uses a different scheduler space from what I've heard. So you don't take away from the 3ms of the SQF scheduler
@little eagle nit 100% Trze
condition run in the unscheduled space and Actions in scheduler
ok
and FSMs run bevor the other
sooo. the conditions are done every frame?
you have CPS that is not 100% depended in frames
but basicly as far i understand it yes
so it's like triggers
i think trigger are FSMs
hmm
but FSMs can slowdown masivly the game and make AI stupied
because the AI is Based on FSMs
and than higher the CPS are than better reacts the AI
That is true. Since AI is running on FSMs, taking away scheduler time from FSMs is bad for AI behaviour
a SQF based Statemachine is way better and would run way better
the annoying thing about .fsm is the editor
for sure
so how often are the conditions evaluated? they are unscheduled, but the delay between checks depends on what exactly?
Or is it hard coded to be 0.5 s like the triggers?
you're right about the conditions being unscheduled
{systemChat str canSuspend} execFSM cba_common_delayless
-> false
0 spawn {
{systemChat str canSuspend} execFSM cba_common_delayless
};
yes but the question is where they split it because CPS and FPS not must be equal
What is CPS exactly?
condition evaluations per second
So it doesn't matter how long they take?
0 spawn {
{systemChat str ["fsm", canSuspend, diag_frameno]} execFSM cba_common_delayless;
{systemChat str ["dc", canSuspend, diag_frameno]} call CBA_fnc_directCall
};
DC still is one frame earlier
But it's a nice alternative
in case they fuck it up
to change the Env from scheduled to unscheduled
executes a piece of code in unscheduled env. inside scheduled env. while still supporting return values, HarryD
But I'm reminder of another reason why fsm sucks for this, joko.
You have to preprocess and load the .fsm file every time with execFSM
no precompiling
sqs all over again
its for AI
Or you know
Don't use state machines in the first place
But then again. Baer got the medic AI to work with this
they can improve the performance massivly
we in PRA3 use also a statemachine. it is way simpler then the one from baer but a little bit more controllable
i think he joined our QA team
I see
and what's better performance-, and consistency-wise, if you have to monitor&change the state of 50 towns: to spawn the same loop for every town, or to check all the towns in one large loop and call the state processor if necessary?
spawn != new thread in sqf, so I don't see a real difference
probably one spawn for everything.
no idea what you mean by "state processor"
if you want "consistency" then don't use the scheduler at all. <---- my opinion
by state processor I meant a script that's called if there's something changed in the town state (bool indicator is true) and processes the necessary logic (what do we do if the town is under attack? Changing values, spawning units, etc)
probably one spawn for everything.
How would I use this without
addAction
since I need to run this function onButtonClick?
this addAction[localize ""STR_MAR_Rebel_Clothing_Shop"",life_fnc_clothingMenu,""reb"",0,false,false,"""",' license_civ_rebel && playerSide == civilian'];
So I basically need to run this
life_fnc_clothingMenu,""reb"",0,false,false,"""",' license_civ_rebel && playerSide == civilian
Anyone who knows how to do it? Thanks in advance
if ( license_civ_rebel && playerSide == civilian ) then {
call life_fnc_clothingMenu
};
???
yes but it's not calling "reb"
that button would open the rebel clothing shop
so i need "reb" in it
... call life_fnc_clothingMenu, ""reb""?
oh
if ( license_civ_rebel && playerSide == civilian ) then {
"reb" call life_fnc_clothingMenu;
};
You'd need it as the fourth element, as to not change the function
@little eagle that doesn't work
[nil, nil, nil, "reb"]
as BoGuu said ...
read here what is passed in addActions: https://community.bistudio.com/wiki/addAction
if (licence_civ_rebel && playerSide == civilian ) then ["","","","reb"] call life_fnc_clothingMenu; ?
["","","","bruce"] call life_fnc_clothingMenu; works well
is a game logic spawned only by createUnit command?
Yes
question on fired eventhandler from config.cpp: Is the script executed on all connected clients or where the vehicle/weapon is local? Code looks like fired = "_this execVM '\uns_armour_c\scripts\zu23_fired.sqf'; _this call BIS_Effects_EH_Fired;";
Fired is executed on all clients
Hi! BRPVP have a Rush version that is only a mission. I'm having problem with the loading image, it gives an error "brp_imagens\brpvp_tanoa.jpg not found" but the image appears. Tried many formats and names. What is wrong?
it's not a wonder that the Flak fire would induce lag in Unsung 2.6 on arma 2 with stuff like that then
I'll make zu23_fired.sqf a function via CfgFunctions and use spawn instead of execVM. also will change it to fired = "if (isServer) then {_this spawn uns_armour_fnc_zu23_fired;};" I guess it will put stress on the server that way, but reduce lag a bit. Any suggestions to execute the script in a different way that's less costly?
I checked the script, it selects an ammo burst vehicle, waits for a fuze delay length and then creates the ammo burst vehicle
I don't see any particles or other that needs to be local
this really depends on what the script actually does.
my bet is that you'll break it
here's the zu23 fired script, if you want to have a look: http://pastebin.com/dQnyDW3w
yup
RADAR_SETTARGT_HT is probably a variable set on the gunners machine
on the other hand, it is very strange that it uses a global command (createVehicle) in a global event handler (fired)
this would create n projectiles. one for every machine
yes, that's why I'm tasked to look into, to better the situation
and before I stumble in this multiplayer forest, I thought I come here for help
you're tasked to optimize this code?
yep
ok.
or at least to not have it execute on every client
yes, Unsung depends on CBA
Good
Because the sleep in while thing will never work in MP
I'll explain later. brb in 15 mins
ok, thanks!
ok. here my suggestions:
- get rid of
execVMby precompiling (seems like you've already done that)
- get rid of
_this select 1by usingparams
- get rid of the
private ARRAYat the start by using theprivate keywordsyntax
- No need for the typeOf here:
_btype = typeof _bullet;, because that already is argument 4 (iirc) in the fired eh
- replace:
if ( (_btype == "Uns_ZAP23_API") || (_btype == "Uns_Quad_ZAP23_API") || (_btype == "uns_RU_B32_145x115_API_quad") ) exitwith {};
with:
if (toLower _btype in ["uns_zap23 ....]) exitWith {};
_ammo = _ammoArray select floor random count _ammoArray;
use `selectRandom
- replace the binary
createVehiclewith the unary one:
createVehicle [type, position, markers, placement, special]
use special == "FLY" for projectiles and use position [0,0,0] and then setPosASL
^ that is much much faster
It's a sum of small things plus that createVehicle
Oh and regarding locality
(Since Arma 3 v 1.65)
gunner: Object - Unit that fired. The actual shot instigator could be retrieved with getShotParents command
iirc this should be working right now too
Use the gunner and exitWith if the gunner isn't local
ok, 1.65 is current dev I guess
otherwise use:
private _gunner = [cameraOn, "HMG_127_mbt"] call CBA_fnc_getFirer select 0
If gunner isn't defined yet, you can use the CBA function I posted
shouldn't make much difference, but eventually you want to use the gunner reported from the event handler
so you would recommend against publicVar'ing the setvar and just executing it on the server?
Do it on the gunners machine
You should get rid of the lag from scripting if you use the createVehicle ARRAY - setPosASL trick
if it still lags, then it's particle effects from the explosions or something like that
maybe uncompressed sounds
ok, will give it a try! Thanks a lot
Don't think so. Last time I used AGLToASL for that, no one complained
Quiksilver, do you remember what the default value for getText is?
In case the entry is undefined?
I don't need to know
But if you figure it out
And stare at BIS_fnc_effectFired long enough
You'll find something nice
"nice"
...
yup
😉
I think it's hard coded like init.sqf
it doesn't appear in the all in one config
gl with that
teach the plebs how to install mods
ffs
The projectile should be the same
but there is no way to tell when it pops
maybe some kind of array pushing back all projectiles a gunner shot
and then poping the oldest one via onFlare.sqs
if the gunner is the same?
retrieve it with the method I described
should be simple enough
they're not gonna update a .sqs file
Flares are neither shotBullet nor are they parachutes though
So who knows what it does in C++ land
It never specifies a "sub projectile"
like the mine thrower arty does for example
or shot guns
So I'd say it's the same projectile
Doubt it
Pretty sure even if you could get a scripted flare to actually glow
It would use the local config for that
Evening all, trying to make a world intro for my ArmA 3 mod. I put this in the initIntro.sqf however when it starts, its just a black screen
[
{
["InitDummy",["Altis",[4711.24,21737.6,1.67612],346.591,0.7,[-0.606029,0],0,0,493.103,0.00851527,0,1,0,1]] call bis_fnc_camera;
setViewDistance 2000;
}
] call BIS_fnc_initWorldScene;
I tried setting view distance higher but that didn't work
that works for me fine ^
hmmm, I am not sure why it is a black screen.
Hey guys i have the following setup:
@mod1
Addons
mod1.pbo
init.sqf
mod2.pbo
init.sqf
I can not get the init.sqf of mod2 do execute. Any ideas why?
How is the init.sqf executed? CfgFuntions pre/postInit = 1; ?
My guess is that the configs clash
the class names
Omg i thin you are right
I will try it now
So i have CfgFunctions class in both pbo
Is this not allowed
You can have CfgFunctions in both, but the sub classes inside have to use different tags
I usually use "Component" names
So in your example the master config would look like this:
class CfgFuntions {
class MyTag_mod1_functionName { ... };
class MyTag_mod2_functionName { ... };
...
};
for mod1.pbo and mod2.pbo
Do you spawn npcs with createVehicle?
Thanks!
@little eagle When you refer to master config. Where is that config situated?
Nowhere. it's what the game generates when it's started out of all "config patches"
which are all the config.cpp and config.bin files of all loaded PBOs
I see
You can look at it in the ingame config viewer
i will check it now
If there is only one entry, the game will only execute one function
how do you swap recoil of weapons (base game) . for example replace MX recoil with MK20
you need to edit r
configs for that
class GM6_base_F: Rifle_Long_Base_F {
recoil = "recoil_gm6";
};
No errors, ether.
hey anyone here to help?
well anyway Im trying to add a action for a certain type, how I make something like this work if addAction ["Delete Vehicle", "deleteVehicle cursorTarget;"];
with if type="B_diver_F" then
okay that code formatting got fucked up
also i'd add the action on the vehicle itself
is there a bound sitting animation? Only one I can find on the wiki is for Queen's Gambit
@modest sonnet Can you send that code a bit more proper?
I'd also recommend putting the addaction in the vehicle and using deleteVehicle
@little eagle cant you say class GM6_base_New_F : GM6_base_F { recoil = "recoil_gm6"; };
Yes
does anyone know how to make AI give "Take Cover" order available to player?
looking for a script to play music from a vehicle in 3D (gets quieter as you move away). Anyone able to be a legend and help me?
TPW mod has a radio transmissions going on when you are inside vehicle and near it, you can take a look at the scripting to maybe see how's it done.
playSound3D seems to be a good way, it supports a max range
should you execute addaction on initPlayerServer or initPlayerLocal? All players will have this addaction.
Initplayerlocal
Initplayerserver only gets called on the server when a player joins the mission
Roger.
is there a better way to handle a specific AI's death other then a trigger? I want something to happen when a player kills a specific AI and want to avoid trigger objects if at all possible.
maybe look at event handlers?
@inner swallow cheers. Looks like this is what I'll need.
Hello, I'm having a wave script and it doesn't work.
I have 3 groups of enemies spawning from a script, I named each group with a global variable "groupWaveOne" "groupWaveTwo" and "groupWaveThree". In the RPT file I get script faults saying that it doesn't recognize the variables.
({alive _x}count units groupWaveOne) <1 && ({alive _x}count units groupWaveTwo) <1 && ({alive _x}count units groupWaveThree) < 1;
};```
It should recognize the variables because I've done something like this berfore, and the groups script is just the same as it was before.
@tough abyss create the global variables in init and set them in your script you're calling them in, then call publicVariable groupWave___ after giving them value. Should be able to call them after the fact.
publicVariable broadcasts the change. If you cant set the value in init it should work fine.
Sorry, I don't think I got it right.
I need to create the group in the init file? or just do
publicVariable groupWaveOne;
creating the group creates the veriable, I think,
Based on the error it sounds like the global variable(s) haven't been instantiated yet. As if your waitUntil is being called before your groups are created. If they aren't, try calling publicVariable _____ after setting the value of each
Is there a reliable event I can use that always runs whenever a mission is ended, but still has all the info on objects / players? (Specifically getPlayerUID and allPlayers)
no
10/10 : (
I can do modside things btw, any way then? 😦
This sorta stuff still seems.... obvious to me to have in some way
I don't have the game on this PC to test, but I'm guessing "Ended" mission event doesn't run when #missions is used then?
Or does that not have the functional commands anymore
any idea how to disable an object's disassemble action? removeAction and removeAllActions doesnt work.
you have to edit the configs for that. no script solution possible
guys, there's a thing. I plan to store mission-related player data, like money, role, etc in an array. But when a man is no longer on the server, I have to clean this info. How?
there's onPlayerDisconnected EH, but does the event fires every time the player disconnects, e.g. on kick, not-responding-timeout disconnect?
can't find any way to check if a player with given UID is still on the server
or with given GUID
you can't save it to profileNamespace? on the clients
didn't know which section to ask this in:
if your addon released on the workshop consists of several pbos, can you update only one of them or will putting only one in cause in the other pbos being perceived as obsolete?
@broken mural I think that's actually possible, see example 3 from here https://community.bistudio.com/wiki/inGameUISetEventHandler
Any ideas how to pass a task variable and a unit into a trigger as parameters?
params ["_targets"];
private _count = 1;
{
//element in targets array
private _target = _x;
//check if target is group leader or in group? //TODO
//create eliminate task for this target
private _eliminateTask = ["eliminateTask", _count] joinString "";
[
west,
_eliminateTask,
["Eliminate hostile forces","Neutralise"],
getPos _target,
1,
2,
true
] call BIS_fnc_taskCreate;
//create a trigger that completes the task when the target has been eliminated
_eliminateTrigger = createTrigger [["eliminateTrigger", _count] joinString "", [0,0,0]];
_eliminateTrigger setTriggerArea [0, 0, 0, false];
_eliminateTrigger setTriggerActivation ["NONE", "present", true];
_eliminateTrigger setTriggerTimeout [0, 0, 0, true];
_eliminateTrigger setTriggerStatements ["!alive _target", [_eliminateTask, "SUCCEEDED",true] spawn BIS_fnc_taskSetState , ""];
_count = _count +1;
} forEach _targets;
@native hemlock No. That won't block pressing space/f or whatever "default action" is bound to
you get an icon to disassamble and that doesn't use the interaction menu and the ui handler
@cedar kindle ah, yeah, it might be good idea for a role. As for the rest, well, the server has to know about player money at least, hence I need a public data structure for it
Well, and storing money locally is unsafe
Another problem! I'm calling a function from initServer which spawns a bunch of objects, and for each object I addAction. Works just fine when Im testing in multiplayer client hosted. When I switch to dedicated, it fails to addaction. The only information I can find refers to BIS_FNC_MP which the wiki says use RemoteExec or RemoteExecCall. What would the proper syntax be for calling a function in an addaction via remoteExec/RemoteExecCall, and which remoteExec iteration would be better suited?
Note: the addaction has to be present for all players.
Furthermore, @native hemlock I added that event handler and it worked perfectly! For those interested, I found this: https://forums.bistudio.com/topic/186347-eject-player-using-mortar/
code
inGameUISetEventHandler [ "Action", " _target = _this select 0; if ((_this select 3) in ['GetInTurret','DisAssemble'] and (typeof (_this select 0) in ['B_G_Mortar_01_F','O_Mortar_01_F','I_Mortar_01_F'])) then { true; }; " ];
doesnt remove the action from the object but it doesnt do anything when the player selects it.
it appears [_object, ["interact", functionName, ["f", 1], 6, true, true, "","side _this == west", 3, false]] remoteExec ["addAction", 0, true]; works fine in client hosted but not in dedicated.
did you try adding a delay before doing the remoteExec to allow the clients to sync up with the server after object creation?
Trying now, @halcyon crypt
negative, @halcyon crypt . sleep 1; before remoteExec had no effect.
hm weird
perhaps try increasing the radius to 10?
probably won't do much but it can't hurt to try ^^
also, does functionName exist on the server?
I think it's better to create a function that does the addAction and stuff and call that function with remoteExec, that way you can also "debug" the thing.
I have one function that spawns each object and adds addaction to each which calls a function that dictates what happens based on the object calling it. Yes, fn_functionName exists. for clarity, the code works fine in isServer, just not isDedicated.
test it like that:
[{player addAction [blablubsettingsvarsetc]}] remoteExec [blablaTargetBla];
How do you make a certain side win a PVP game mode based on trigger conditions? The trigger conditions are set, but "SideScore" call BIS_fnc_endMissionServer; doesn't work like I need it to for this. I want to it specifically say Blufor or Opfor won based on triggers I've set.
interestingly i tried testing remoteexec and remoteExecCall from debug in dedicated server and only I receive the hint
Alright small update; I was able to get this to work in the debug console [player, ["Greetings!", {hint "Hello!"}]] remoteExec ["addAction", player ,true]; however I had to click Global Exec. What is the script equivelant of running that as global exec? lol
That is exactly what I have been needing for a long time quiksilver haha
stupid question i guess, but diag_log pushes a format to the (server) log file, right?
if (isDedicated) then {
while {profiler} do {
_profilesBySide = [ALiVE_profileHandler,"profilesBySide"] call ALIVE_fnc_hashGet;
_profilesBySide = _profilesBySide select 2;
sleep 30;
diag_log format ["Profile Count OPFOR - %1", count (_profilesBySide select 0)];
diag_log format ["Profile Count BLUFOR - %1", count (_profilesBySide select 1)];
//diag_log format ["Profile Count INDEPENDANT - %1", count (_profilesBySide select 2)];
};
};
Doesn't show up in the logfiles for some reason :/
profiler false or undefined?
this might be nit-picky, but does it matter if independent is mis-spelled?
isDedicated also is only true on a dedi. Might want to use isServer to support local hosted MP
the command, Vauun?
//diag_log format ["Profile Count INDEPENDANT - %1", count (_profilesBySide select 2)];
This line.
nah. it's just a string
I'd like to make a redundant zeus module which doesn't let anyone initially connect to it, and if the primary one goes down the zeus can take the other slot with the game checking against his PID so there's only one zeus.
Thanks.
@tough abyss With regard to your example, <target> refers to the object I'm adding the action to? Because player addaction would just add it to the player. Would it be
[ [], { <target> addAction ... } ] remoteExec ['call',<target>];
instead?
No. The code block is executed on the targets machine. Where "player" is the object you want to attach the action to
<target> in remoteExec can be an object. but it can also be a side or a group
or a number
2: server
0: everyone
-2: everyone but the server
And if you want to pass variables to the code block, which <target> presumably is, you'll have to use the first array and then params inside the code block
anyone know of a way for getting the mass of an object without spawning it in?
@little eagle profiler = true
it's a quick way for me to turn it on or off while in game to enable the profiler debug, but it's on by default.
@little eagle it's also hosted on a dedi, so that's not the issue
hmm, last time I checked mass isn't set in config but in the model itself?
nope 😦
getnumber (configfile >> 'cfgvehicles' >> 'B_MBT_01_cannon_F' >> 'mass') returns 0
yeah we figured, was hoping that it changed in the last weeks/months ^^
it's probably something they should add to https://community.bistudio.com/wiki/getModelInfo
oh right
wasn't there something that accepts the models path?
I guess I'm thinking of createSimpleObject
yo
the physx masses are BS anyway
like
a ammo box has 500
You litterally have to make tripods weight 250 kg for them to not topple
@lavish ocean any known plans to allow getting the mass of an object by classname without spawning in the object? 😊
Hello guys - looking for a in-car radio script similar to this http://maca134.co.uk/arma-3/nradio-arma-3-internet-radio-streaming/
anyone able to script something like this ?
it requires an extension so mod only
if you want to stream internet radio stations anyway
@little eagle
while {profiler} do {
_profilesBySide = [ALiVE_profileHandler,"profilesBySide"] call ALIVE_fnc_hashGet;
_profilesBySide = _profilesBySide select 2;
sleep 10;
if (isServer) then {
diag_log format ["Profile Count OPFOR - %1", count (_profilesBySide select 0)];
diag_log format ["Profile Count BLUFOR - %1", count (_profilesBySide select 1)];
//systemchat format ["Profile Count INDEPENDANT - %1", count (_profilesBySide select 2)];
}
else{
systemchat format ["Profile Count OPFOR - %1", count (_profilesBySide select 0)];
systemchat format ["Profile Count BLUFOR - %1", count (_profilesBySide select 1)];
//systemchat format ["Profile Count INDEPENDANT - %1", count (_profilesBySide select 2)];
};
};
even doing it like that doesn't poop it out on the dedicated logs
@clear tendon sounds like the script isn't even called
@little eagle would the same apply if I wanted to attach an addaction to an object and not the player? So
[ [], { _objectLikeABoxOrSomething addAction ... } ] remoteExec ['call',-2];
would fire for every player including JIP to addaction to that object? Would you place that in initPlayerLocal?
are there any freelance scripters that any of you guys know of ?
literally all of us here freelance
emphasis on FREE
it's just that the lengths we go to are less to solve problems compared to someone who is getting paid
ok 😃 , well if anyone has the opportunity to look into that- it would be highly appreciated, I'm also happy to make a donation for someones time
@tough abyss or you can just ping @brazen sparrow ^^
@halcyon crypt He doesn't seem interested
no clue if he's active though
@clear tendon put a diag_log before the while loop and check if that shows up
goodone, you're @halcyon crypt from aliveforums too right 😉
mhm
whuuut..
14:55:30 Error in expression <hile {profiler} do {
_profilesBySide = [ALiVE_profileHandler,"profilesBySide"] c>
14:55:30 Error position: <ALiVE_profileHandler,"profilesBySide"] c>
14:55:30 Error Undefined variable in expression: alive_profilehandler
@halcyon crypt perhaps add a waitUntil {!isNil "ALiVE_STATIC_DATA_LOADED"}
or something to check if alive is actually called
waitUntil {!isNil "ALIVE_profileSystemInit"}; seems to be the right one
Rgr, let me boot the server gain.
@halcyon crypt - got it working now. Dumped it in a septerate sqf w/ that waitUntill + loop:
Loop:
waitUntil {!isNil "ALIVE_profileSystemInit"};
while {profiler} do {
_profilesBySide = [ALiVE_profileHandler,"profilesBySide"] call ALIVE_fnc_hashGet;
_profilesBySide = _profilesBySide select 2;
sleep 10;
diag_log format ["Profiler is: %1", profiler];
if (isServer) then {
diag_log format ["Profile Count OPFOR - %1", count (_profilesBySide select 0)];
diag_log format ["Profile Count BLUFOR - %1", count (_profilesBySide select 1)];
//systemchat format ["Profile Count INDEPENDANT - %1", count (_profilesBySide select 2)];
}
else
{
systemchat format ["Profile Count OPFOR - %1", count (_profilesBySide select 0)];
systemchat format ["Profile Count BLUFOR - %1", count (_profilesBySide select 1)];
//systemchat format ["Profile Count INDEPENDANT - %1", count (_profilesBySide select 2)];
};
};
Debug:
15:14:09 "Profiler is: true"
15:14:09 "Profile Count OPFOR - 44"
15:14:09 "Profile Count BLUFOR - 15"
gives me insight to see if the backup/ai spawns keep working
neat 😃
@broken mural You cannot use _objectLikeABoxOrSomething inside that code block. You have to pass it as argument.
would fire for every player
It would fire for every machine that is not the server (-2)
including JIP
No, but there is a flag to do that. See: https://community.bistudio.com/wiki/remoteExec
Would you place that in initPlayerLocal
Probably a good idea, unless it's an object that is spawned by the server and thus has no reference on the client when initPlayerLocal is executed
hmm ok , so it appears the creator maca134 has had issues with his own creation, asked for help to fix it, now that he has he wont share it :p sounds fair
@little eagle so it'd be
[ [objectLikeABoxOrSomething , [addaction parameters]], { _player addAction ... } ] remoteExec ['call',-2, true];? Trying to fully understand this as this is a cornerstone for the mission file.
If ithe objectLikeABoxOrSomething IS spawned by the server, how would you call this addaction so that all players have the action?
_player is undefined
[
[_objectLikeABoxOrSomething , _addActionParams],
{
params ["_objectLikeABoxOrSomething", "_addActionParams"];
_objectLikeABoxOrSomething addAction _addActionParams;
}
] remoteExec ['call',-2, true];
like this
passing arguments
@little eagle thanks, i really appreciate the example.
oh @little eagle where should you call this if the objects are spawned by server on initServer (the function is the last thing called in initServer that handles all the spawning)? Still initPlayerLocal?
No. If you use remoteExec , then you do it from the server
otherwise all the clients would remotely add these actions on all other clients
You'd end up with multiple copies for every connected client
What's the best way to bar connections to a slot based on player UID?
I have a second zeus module I would like to not have players connected to based on the UID of the primary Zeus. I can ensure players don't start in the secondary Zeus initially, so I can add a script that grabs the UID just fine, but I want to bar connection to it if their UIDs don't matc.
Does arma2net still work with arma 3
That's easy enough. Is there a kick command? At work, I can't browse the library right now.
endMission locally?
Sounds good. Thanks!
@little eagle Thanks for the info!
Hello, is there someone online willing to help?
Okay, is there some way, when I set a boolean variable in a script to true, to move certain AI unit to certain position, say, to position of Game Logic?
there's a question here:
https://community.bistudio.com/wiki/Game_Logic states that the game logic will always be local to a host that created it. What if I spawn a gameLogic at the mission start for both client and server with the same name and then call myGameLogic setVariable [name, value, true]?
does the value updates for all clients as well?
quick question.....why would this work " if (sign > 4) then { sign = 0 }; " but not this " if (sign = 4) then { sign = 0 }; "
sign = 4 is an assignment
sign == 4 is what you are looking for @modest sonnet
Thanks dude, was SO confused
@opal thistle
Server side: CreateLogic, PublicVariable it
iirc "=" assigns a value ( x = 0) whereas "==" means equal to. I'm sure someone will correct me if im wrong (cause thats how we roll here 😉 )
\a3\ui_f_curator\ui\displays\rscdisplaycurator.sqf: line 146
_draw3d = addmissioneventhandler [
"draw3d",
{
_fadeStart = uinamespace getvariable ["",1000];
_fadeEnd = uinamespace getvariable ["",2000];
@fallen locust thanks!
@modest sonnet = (set) == (equals) once you know that you never forget... i dont know how much SQL/SQF borrows from C+ with operators, but it shares some https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B
Like && (AND) and || (OR) and !value_x (not value_x)
new SQF in dev since yesterday:
Version: 1.65.139010
b:GROUP enabledynamicsimulation BOOL
b:OBJECT enabledynamicsimulation BOOL
b:STRING setdynamicsimulationdistance SCALAR
n:dynamicsimulationenabled
u:diag_dynamicsimulationend STRING
u:dynamicsimulationdistance STRING
u:dynamicsimulationenabled GROUP
u:dynamicsimulationenabled OBJECT
u:enabledynamicsimulation BOOL
acn someone check what they are about it please
they have an interesting sound to them at least
I want to change the key of this function but I don't now wich is the key.
player addaction [("<t color=""#FF0000"">" + ("Admin Menu") +"</t>"),"AdminTool\Admin-Pfad.sqf","",5,false,true,"",""];
Hm, I just came up with a way to move remote object each frame without sending setpos packets
- Create (invisible) non-network object (createVehicleLocal)
- Attach remote object to that local object (no attachTo packet is sent when attaching to non-network)
- Move that local non-network object each frame however you like
Any flaws in the plan?
Could work like an imitation of setPosLocal
"should" work? I guess it's similar to how the player pos is updated, packet wise.
kinda out there but yeah ^^
What's the best way to add an eventhandler for an array of units?
getMass only works with an entity as it has to read the data from the model/p3d - its not related to the "mass" stuff set in configs
@velvet merlin In-game command help doesn't tell much about the dynamic simulation. But the same thing is used when placing objects, and the tooltip says: "Makes object simulation dynamic. Simulation is enabled only if player or enemy unit is nearby".
thanks!
That'd be nice, would save from having to use a caching script
time to bother BI in the forum i guess
Oh, there's also a new entry in the editor's performance menu: "Dynamic simulation - Objects and empty vehicles: <distance>. Infantry: <distance>
dynamic simulation = old garbage collector?
Sounds more like enableSimulation that is engine controlled & you can define the distance to enable/disable it.
Instead of doing it via sqf
@little eagle small thing but the "getVariable ARRAY is not supported" comment at https://cbateam.github.io/CBA_A3/docs/files/common/fnc_createNamespace-sqf.html should be fixed. That syntax has been there since 1.60, according to the wiki.
hello, would anyone happen to know how I can change the button layout of the Y Menu in altis life like if I were to make a tablet and have the buttons look like apps in it? like I want to know how to position them properly on screen
@zenith whale, you will need to edit the \dialog\ files. Arma has a GUI editor that can be opened after pressing escape when previewing inside of the Eden editor.
anyone know how to run something as soon as the loading screen after the map screen is gone? basically trying to show a splash screen as the mission starts
endLoadingScreen;``` using this before creating the UI but half the time it does the splash screen while the loading screen is up
thanks, will give it a shot
@little eagle aahhh bad assumption 😁
So players have asked us several times on moving our tazer to another slot so they can quickly move between a pistol and a tazer because we dont allow rifles. Without changing how the tazers look and feel does anyone have any suggestions on how I could do this efficiently?
@vapid frigate https://community.bistudio.com/wiki/onPreloadFinished
anyone else stumbled on this?
https://feedback.bistudio.com/T120705
@runic heart keep track of the trazer and pistol in memory and switch them on a keypress / menu action? That's similar to how ACE2 and DayZ Mod handled it for the "weapon on back" kind of thing.
not too sure about ACE2 but DayZ Mod definitely
Ya something where they don't have to drag the tazer/pistol out of backpack in a situation
Anyone know if the SQF (Status Quo Function) language is single threaded in scheduled or unscheduled enviroments?
Because what I've observed it executes single-threaded in unscheduled pushing CPU core 0 usage to 70 - 80%
Then drops down again.
@flat hornet from what I know scheduled scripts run on a single thread.
Why?
Why couldn't they I don't know?
Create local headless clients?
to the client?
This way you could have as many HC's to offload from the primary thread?
I mean I even performed a hack when I hate a messaging system where by I had the HC's listening for a remoteExec message
and upon recieving it sent the message to clients
so it would go from Server Initial message -> Headless client (Processes messge) e.g setrain and setOvercast, then [60,1] remoteExec ["setRain",-2,false];
From the headless client to the main clients.
Could you see any useful benefit with this Kegan Hollern?
In this way the headless client behaved more like a server than a client.
?
That'd work @flat hornet but it'd be a lot of work for them. The best solution is to implement a way for scripters to create multiple environments (that run on different threads) for non time sensitive script threads to be run on.
I haven't looked to much into the engine but from what I gather that would still be a tall order.
What about my method of offloading processing from the server?
Is there any danger in letting the HC's do processing via remoteExec ?
The interesting thing with that is it allowed me to stipulate exactly which HC's handled the code and which didn't
by simply getting the HC's ID's build it into an array
get the ID send it to the HC for processing
Wait...
Last time I checked I read something about Single player headless clients mentioned
I don't see a danger in your offloading idea. Just be sure to secure remoteExec to prevent clients from sending the HC commands.
Although, headless clients need to be put under a microscope. We need to be able to run more than one on a dedicated box
I do run more than one.
Actually our server runs 3
Using CPU pinning to prevent them from affecting the main server
Then a bunch of bat files.
Which are going to get replaced with PowerShell
At the current time we only run 2 HC's as we need more CPU cores
But both of them are given 2 cores to play with.
Using the binary masks 1100000 and 00110000 -> C0 and 30
/affinity confining the HC's to 2 cores each
That's what we did with our old desolation servers. Set affinity with the bat file.
Well now I feel out of the loop... Lol
Yeah, I cleaned up a lot of stuff when MOTO reorganized. Basically you can set the affinity with /affinity and define which cores you want it to run on from start. Only ran into problems when the shutdown didn't work properly, duplicating the servers.
You know what I did to address that?
I shure would
The bat-file had an interrupt waiting for you to press any key
hit keyboard twice server would terminate
*facepalm
I also renamed the arma3server.exe
and then targeted taskkill to the /F /IM "arma3ServerOurExec.exe"
this way it would look for the file image name
and terminate correctly.
Also renamed for the arma3serverheadless.exe
that way we used taskkill /F /IM "arma3serverheadless.exe"
it would look for all the file image names
and terminate them
This way I could deal with the unknown /PID problem
You try that BigBen?
PowerShell is better suited to these tasks though.
I had all the exe changed to unique names. Not sure why taskkill wasn't working. Have not ran public servers from that dedi since Desolation died.
Were you running them as administrator?
Yes.
did you use /F ?
I would have to take a look. I'm at work, so no access to that dedi.
Unless @spark phoenix is still awake and can look.
taskkill /F explicitly forces it to close it
but seriously powershell
is much much more flexible.
You can allow remoteSigned
Set-ExecutionPolicy remoteSigned
otherwise nothing will run
Funny story BigBen
Because our community was named something similar to the US marines
Chinese hackers kept trying to break into our server
Too bad for them I had lockout policies enabled
unfortunately I didn't account for a lockout policy DDOS
So even though they could keep trying to break into the server
I did the numbers and worked out how long it would take them to try every permutation
Hello! Is there a tutorial on how to create database and insert/read player data from it? Thank you!
//Added: A set of bitwise scripted functions
class Bitwise
file = "A3\functions_f\Bitwise";
class bitwiseAND
class bitwiseOR
class bitwiseXOR
class bitwiseNOT
class bitflagsSet
class bitflagsUnset
class bitflagsFlip
class bitflagsCheck
class bitflagsToArray
in regards to the new sqf cmds - there are most likely for this new module and Eden functionality
http://pastebin.ubuntu.com/23392082/
maybe someone feels like extracting their scripts in dev branch and check how they are used/if the cmds can be used elsewhere too
or someone gets BI to document them 😉 @lavish ocean
they have also extended their task modules (made them configurable via the editor if i get this right) - sample
http://pastebin.ubuntu.com/23392087/
Global namespace not passed during: false
Error in expression <false>
Error position: <false>
Error Local variable in global space
any idea where this could come from - mission.sqm? (not my mission 👼 )
I have this same thing in my RPTs, not sure why.
Rip BI
For someone who doesn't do programming outside arma, what would you use the bitwise stuff for?
@velvet merlin it's an issue in a mod.cpp I believe, RHS had this issue before.
issue found here http://feedback.rhsmods.org/view.php?id=1786
An absolute plethora of things @austere granite
Encryption, networking, video/audio codecs, bit fields
The list goes on and on, I think a quick google search might quench your thirst to know 😉
For a quick fun example using the right shift operator (>>), the snowflake of your user on Discord is 106185333267255296, which corresponds to (by shifting 22 bits, then using the Discord epoch) your account being made at: 21/10/2015 00:22:36
@velvet merlin RHS or a different mod.cpp. It's what happens when you teach people that false and true are valid things in config
ok thanks 😃
//Added: A set of bitwise scripted functions
Why are these functions and not SQF commands
Yeah. Everyone who could've used them is smart enough to make them themself
But no one does and guess why
XOR would've been nice
@velvet merlin I've seen "local variable in global space" when editor-placed units have local variables in their init. That is, _x, _this, or _whatever
when it doesn't make sense to have one..
Hey, i have a structuredtext in my controlsgroup but it wont show the text when i set it in the script. Just trying with (_control is defined) _control ctrlsetstructuredtext parsetext _mytext; any ideas ?
what are the contents of _mytext; @dim owl
@little eagle adding bitwise commands would take < an hour for them to add to the engine. Hopefully theyll take the time.
@spark phoenix I have a switch and inside are for example these:case "1": {"<t align='center'>I am so cool!</t>"}; (thats just an example)
show the whole thing, Basti
_display = findDisplay 4354;
_ctrlgruppe = _display displayCtrl 121212;
_data = _contentlist lbData (lbcursel _contentlist);
_contenttext = switch (_data) do {
case "0": {"<t align='center'>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</t>"};
case "1": {"<t align='center'>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</t>"};
_ctrlgruppe ctrlSetStructuredText parseText _contenttext;
_h = ctrlTextHeight _ctrlgruppe;
_ctrlgruppe ctrlSetPosition [0, 0, 0, _h];
_ctrlgruppe ctrlCommit 0;
For testing just some lorem ipsum from the web
hmm. needs some formating
okay. what i need to do ? just add like some linebreaks or something like that ? xD
wait
okay
_display = findDisplay 4354;
_ctrlgruppe = _display displayCtrl 121212;
_data = _contentlist lbData (lbcursel _contentlist);
_contenttext = switch (_data) do {
case "0": {"<t align='center'>Lorem ipsum dolor sit amet.</t>"};
case "1": {"<t align='center'>Lorem ipsum dolor sit amet.</t>"};
_ctrlgruppe ctrlSetStructuredText parseText _contenttext;
_h = ctrlTextHeight _ctrlgruppe;
_ctrlgruppe ctrlSetPosition [0, 0, 0, _h];
_ctrlgruppe ctrlCommit 0;
see how the switch block never closes?
there's a missing }
oh lol. just opened a old file. that was fixed in the old version
_contentlist seems to be undefined
so thats not the error
disableSerialization;
_display = findDisplay 4354;
_contentlist = _display displayCtrl 1997;
_header = _display displayCtrl 1000;
_ctrlgruppe = _display displayCtrl 121212;
_data = _contentlist lbData (lbcursel _contentlist);
if (_data isEqualTo "") exitWith {hint "Es ist ein Fehler aufgetreten!"};
the whole script is too long to send it. thats the important part of the defines and the switch part
Use pastebin or git gist then
i have a structured text in my controlsgroup and no content is showin up. positioning in the dialog is right and the structuredtext elemt is found by the script. just the text will not showing up
What type of control is it? Structured text is only supported by RscStructuredText
class contentcontrols: RscControlsGroup
{
idc = -1;
x = 0.438125 * safezoneW + safezoneX;
y = 0.313 * safezoneH + safezoneY;
w = 0.298125 * safezoneW;
h = 0.451 * safezoneH;
class Controls
{
class Content: RscStructuredText
{
idc = 121212;
text = "";
x = 0;
y = 0;
//x = 0.438125 * safezoneW + safezoneX;
//y = 0.258 * safezoneH + safezoneY;
w = 0.45 * safezoneW;
h = 3 * safezoneH;
sizeEx = 0.04;
colorBackground[] = {-1,-1,-1,0};
};
};
};
...
class Content: RscStructuredText
{
onLoad = "(_this select 0) ctrlSetStructuredText text 'Lorem ipsum';";
idc = 121212;
...
This is what I'd try first. To see if the config is right
The onLoad line I mean
okay i will try it
if that shows, then the next step would be adding debug lines to your script
systemChat, diag_log
to see if it does what you think it does
Is it possible to retrieve weapon items of a weapon inside a weaponHolderSimulated container?
IE which attatchments are on it?
Also it's still not possible to remove only a single weapon from a weapon holder (nor any other cargo container) is it? 😦
@little eagle Is this going to work ? systemchat _contenttext;
if not try systemchat str _contenttext;
pr systemchat format ["%1", _contenttext];
Ok
XOR?
You can make XOR from compound statements
((a || b) && !(a && b))
Like that.
@dusk sage
Ah I see operating on individual bits much like C's counterpart
They introduced 'bitwise functions'
Not commands
Would be nice to have some commands, such as XOR 😉
Commands would be really easy for them to implement....
Indeed
Would there be any specific benefit for them?
With a C++ backbone, doesn't make much sense
Well anybody wishing to do any bitwise operations
Yeah it would take 10 seconds to write the function.
XOR, being one example
Is there a version of array subtraction that doesn't involve unary subtraction?
e.g _array - [array] ?
You can delete specific elements
deleteAt
doesn't that mean you would require the usage of deleteAt count(_array) ?
To find the last index then subtract it?
That wouldn't do much 😉
That would be specific to deleting the last element, yes, with count(_array)-1
@little eagle the systemchat is showing right and i tried to set the structured text with the script and it worked (i dont used the variable for the text i used an custom parse text)
I swear Python, PHP, so much better than Status Quo Function...
Well if you wanted to delete all entries in an array of numbers for example.
You could do
_array = _array - [1];
or
while{_array find 1 != -1} do {
_array deleteAt (_array find 1);
};
@flat hornet
but for just the last entry @dusk sage is right.
wouldn't recommend that second code block though
Yeah thats the method I used for changing to
In a Zeus object grabber
I'm better the second code is slower though.
betting*
Does anyone know how I can use the Zeus object grabber code to grab AI created using BIS_fnc_spawnGroup. Basically I use specialty marker key-names retrieve them so I can then dynamically spawn AI on those markers, they then randomise their patrols etc.
But for some reason the BIS_fnc_spawnGroup won't append the AI to the multiple curators I use.
It spawns them fine on the markers randomises their patrols fine.
But doesn't make them Zeus editable.
Yep, the first would be quicker
Also do you guys know the absolute safe AI threshold?
Even with headless clients?
Because all client FPS is severely degraded?
before*
Does anyone know if this would be a valid check (in Exile):
if !(ExileClientPlayerIsInCombat) then {
I'm doing a check and looking to do something only if the player is NOT in combat.
@flat hornet depends on a lot of other stuff too.. (how many players, scripts, objects/vehicles on the map)
our group of 30-40 players on a dedicated with 2 HCs gets about 40-60 AI before it starts going to crap (it's quite bad at 80)
it's not really the server struggling though, it's the clients
we use a fair few mods including ACE3 and RHS
(well parts of ace3.. it was a lot slower when we used to use advanced ballistics/wind)
[player, -1, 0.8, true] call BIS_fnc_sandstorm;
did anyone try to turn this into a snowstorm/blizzard?
Change the particle sizes
obviously - let me rephrase the question. can this be used as a base for something fitting?
ayone knows whether namespace getVariable/setVariable are atomic and as fast as getting element by its key from a hashtable in normal languages?
yes
and it's about as fast as you get with SQF
I posted an example last week here...
oops
Array forming is not atomic
<namespace> setVariable [<key>, <value>] is not atomic
<namespace> getVariable <key> is atomic
testNS = [] call CBA_fnc_createNamespace;
for "_i" from 0 to 1e7 do {
testNS setVariable [str _i, _i];
};
(takes a long time ofc.)
testNS getVariable "13221"
0.0022 ms
Proof, Sa-Matra? I'm not sure about it
If array forming was atomic then doing [call func1, call func2, call func3] would execute all 3 funcs at same time in scheduled, wouldn't it?
I've heard people argue that it does.
IDK. I never use the scheduler
From my understanding it can pause after every command. If it's just an array, there is no command
Too bad it's never explained anywhere
From my understanding array forming is an instruction by itself
and I thought it isn't. Although using call inside the array is one. We don't know without proof
Yeah I'm not sure if single instruction is considered atomic by VM
one can try this:
0 spawn {
diag_log [diag_frameNo, diag_frameNo, ... diag_frameNo];
};
afaik, all will report the same frame. no matter how long you make the array
which should mean that getVariable ARRAY is just as atomic as getVariable STRING is
Scheduler is BS
Did few tests, long array of diag_frameNo's indeed logs as all same frame numbers
But doing call {diag_log diag_frameNo}; many times does as well
This is with scheduler flooded with 1000 threads that do nothing
0 spawn {
diag_log [
call {nearestObjects [player, [], 3000] select 0; diag_frameNo},
call {nearestObjects [player, [], 3000] select 0; diag_frameNo},
//...
call {nearestObjects [player, [], 3000] select 0; diag_frameNo},
call {nearestObjects [player, [], 3000] select 0; diag_frameNo}
];
systemChat "Done";
};
This ends up with different frames
0 spawn {
diag_log [
getPos (nearestObjects [player, [], 3000] select 0),
getPos (nearestObjects [player, [], 3000] select 0),
//...
getPos (nearestObjects [player, [], 3000] select 0),
getPos (nearestObjects [player, [], 3000] select 0)
];
systemChat "Done";
};
This freezes game and all positions are the same with player running during execution of experiment
No matter how many getPos'es I add into array there is just single freeze and all positions are the same, so does it mean that array creation is indeed atomic expression?
But if context changes during array creation (call {} inside array) then VM can pause
Tried with same getPos expression but with call this time
0 spawn {
diag_log [
call {getPos (nearestObjects [player, [], 3000] select 0)},
call {getPos (nearestObjects [player, [], 3000] select 0)},
//...
call {getPos (nearestObjects [player, [], 3000] select 0)},
call {getPos (nearestObjects [player, [], 3000] select 0)}
];
systemChat "Done";
};
Each array value is different
Still doesn't fully answers the question though, maybe
<Namespace> getVariable [<Key>, <Value>] is two atomic operations, first is array creation, second is binary command?
good question.
So, @opal thistle There you have your answers.
as fast as getting element by its key from a hashtable
yes
atomic
who knows
I'd say likely yes. Looks like expressions are atomic, but VM can be interrupted if instruction inside expression executes another expression through call.
Unless there is evidence of otherwise I'm fine with believing it works like this.
Is anybody aware of issues with lbSetValue/lbValue for large integers?
It seems large values (such as 6.5 million - tested) will come out the other end as some random negative of the same order
In this case: -3.04146+006
probably a conversion error between signed and unsigned floats
idk what they do internally with lbValue's
So that's what lbValue uses, right?
If you go past 4194303 with lbSetValue
The return from lbValue will be random
Well 'random'
Undefined behaviour
Integer value
rounds
interesting
Ah, wiki says it though Sets the additional integer value
mystery solved
yop
lb values are integers, yes
The question is, why are they 22 bit integers
Because a dev made them that way?
Probably because of float->integer method used in the engine
lovely bit of overflow 😉
Guess who answered 😃
Suma himself!
I assume this is what Arma uses as well
Assert( fabs(fval)<=0x003fffff ); // only 23 bit values handled
0x003fffff is 4194303
Dirty 😛
'A commonly used trick for plain x86/x87 code is to force the mantissa part of the float to represent the int. 32 bit version follows.'
Sums it all up
So yeah basically they throw away exponent bits and you get your integer
Hi guys, sorry to interrupt the converation. Is there a way to hide a vanilla action like "eject" from a vehicle. As I understand removeAction is only for user added actions.
Anyone remember that command that check if a vehicle is usable?
canMove?
OOOOH! Thankyou!
@leaden knoll
Scripted way: Prevent player from pressing it with https://community.bistudio.com/wiki/inGameUISetEventHandler
Addon way: Change it in CfgActions
THanks, will give it a bash
logging shows like _objects = ((vehicle player) nearEntities ["rhsgref_cdf_b_para_grenadier_rpg", 1000]); takes 1 frame to execute
do I do something wrong here?
"nearEntities took 393650 - 393650 frames"
meaning it started at 393650 and ended at the same frame
so it take less than 1 frame?
or 1 frame
otherwise you will had 393650 - 393651
can be one frame exactly
but is more possible to be less than one frame
and it searches all the instances in 1000-m radius
in less than one frame
is that possible?
@opal thistle yes, i believe the nearEntities function is very fast but it can't search buildings for example.
well, found the mistake
I should've wait a sec or two to get all the mission vars initialized
anyway
you can use the editor creat a simple mission (just a unit) run it and then press esc and execute a nearEntities function on the exec box.
nearEntities takes "0 ms", meaning it takes a time below recognition if someone's interested
the game will execute it and say how much time it take
ah, tx Donnovan
if you do that, run the mission from the editor
@tough abyss a profiler says it takes 0,022 - 0,23 ms in all 3 attempts I made
0,022-0,023
meaning 22 nanoseconds
for 100 units in 1000-m range
impressive
nearEntities only searches through mission entities, it will take longer the more stuff you have in the mission
unlike say nearObjects which searches through entire world and goes through all objects including tress, bushes
I know
@opal thistle and i believe it run the function 10000 times.
Donnovan, you think it's a result of 10 000 times, not an average exec time measured from 10 000 attempts?
@opal thistle if you used the mission preview benchmark, it tries to run it 10000 times.
It not run 10000 times only if it take too much time.
There is a indication on the results showing how much times the code was run.
no, I mean you think it shows the whole time spent on 10 000 attempts, or it calculates and average time of 1 run from 10 000 attempts?
it is average of one run
@opal thistle oh, sorry. This what Sa-Matra sayd.
recoil = "recoil_p07";
author = "[SAWRecce]Maj.AntiAlligat3r";
_generalMacro = "srifle_EBR_F";
scope = 2;
model = "\A3\weapons_F\LongRangeRifles\EBR\EBR_F.p3d";
displayName = "MK14 EMR [Nutria]";
picture = "\A3\weapons_F\LongRangeRifles\EBR\Data\UI\gear_EBR_X_CA.paa";
UiPicture = "\A3\weapons_f\data\UI\icon_regular_CA.paa";
hiddenSelections[] = {"camo1", "camo2"};
hiddenSelectionsTextures[] = {"\SAWRecce_ArmA3\Nutria\Weapons\data\MK14EBR\MK14_EBR_Nutria_co.paa", "\a3\weapons_f\longrangerifles\ebr\data\m14_ebr02_co.paa"};
class Library {
libTextDesc = "$STR_A3_CfgWeapons_srifle_ABR_Library0";
};
descriptionShort = "$STR_A3_CfgWeapons_srifle_ABR1";
class WeaponSlotsInfo {
mass = 60;
};
inertia = 0.700000;
dexterity = 1.300000;
class ItemInfo {
priority = 1;
};
}; ```
can anyone explain why i have 0 recoil
why can i not override recoil and replace it with another weapons recoil
0 ms is incorrect for nearEntities
MP Performance diag_codePerformance only works for 1 cycle
for security reasons.
thanks shall try
How do I make a trigger that when activated destroys all buildings withing a certain distance? So far i've tried ```
{ _x setdamage 1;} foreach (nearestobjects [getpos this, [],200]);
Use thistrigger @warped fractal
bloody hell that seems simple, thank you very much it works perfectly
when you call lompile preprocessFile and assign the handler to a var, the result resides in RAM or stored on the HDD with its handler in memory?
RAM
good
RAM can be paged out to disk though 😛
you mean the OS paging system?
yeah
ah, well, nothing we can do about that))
Hey guys, anyone that could help me out with the fastest way to remove map objects? Been trying alot of commands but nothing seems to work my way. Been trying to remove with ID but don't know how to get an Object ID and with position it doesn't work either. Any help?
Just want to be able to remove objects fastest way possible
Hi all, trying to get a count of alive units in a group. This script returns the same number even if all the group is dead
hint str count units (group target1);
Okay so I've been asking about this topic a lot in the last few weeks and I cant get this damn thing to work..
From initServer, I have _this call fn_initServer. I'm trying to separate as much of the code from files players have access to. From fn_initServer, I'm setting some variables and grabbing objects in a radius of a specified object and passing the array to another function via call. In this function, I'm spawning objects (which functions properly) and trying to addaction to these objects for all players to interact with them. Here's a sample of one of several objects I'm trying to do this with.
_paperwork = createVehicle ["Land_Document_01_F", [getPosATL _x select 0, getPosATL _x select 1, getPosATL _x select 2], [], 0, "NONE"]; _paperwork setDir (getDir _x); _myAction = ["Interact",Test_fnc_delegateInteraction, ["1", "2"], 6, true, true, "","side _this == west", 3, false];
Using what @little eagle suggested,
[ [_objectLikeABoxOrSomething , _addActionParams], { params ["_objectLikeABoxOrSomething", "_addActionParams"]; _objectLikeABoxOrSomething addAction _addActionParams; } ] remoteExec ['call',-2, true];
and adapting it to my own does not appear to be working.
[ [_paperwork, _myAction], { params ["_paperwork", "_myAction"]; _paperwork addAction _myAction; } ] remoteExec ['call',-2, true];
Any insight into why this is not working? Because there are so many moving parts, I'm concerned that the call from fn_initServer somehow makes it no longer executing as initServer or something
No idea, I would recommend posting that in the BIS forums. Its a lot of information on a channel
@tough abyss will do.
I have this on my description.ext: loadScreen = "BRP_imagens\BRPVP_tanoa.jpg";
But i near allways get a image not found while joining the server.
Not obstant the erros, the image appears.
Helpus!
convert it to .paa
@little eagle i just converted from paa to jpg to try to end the problem... will try paa again 😦
Image
Must be in PAA file format.
2:1 aspect ratio (different aspect are rendered correctly as well, but won't cover the whole area).
Ideally 1024x512 pixels.
I'd argue that you should use 2048x1024 these days, but w/e
oh
and save and load the mission again. I had problems with this before. apparently the game reads the files from a temporary folder
@little eagle i did that now!
First join was ok.
setUnitTrait needs to be reapplyed after respawn?
😦 😦 😦 😦 just got the image not found error after server restart...
The message comes when the server closes.
its a bug TM
setUnitTrait needs to be reapplyed after respawn?
I don't think so
@velvet merlin is there a ticket for this?
@little eagle @velvet merlin thanks a lot. No way to have the loading screen in mission without the error? 😦
I will leave default image for now. Best to do.
there is ticket and repro I made years ago
If you're talking about loading image missing when switching servers
if("true" configClasses (configFile >> "CfgWeapons" >> _configName >> "Single")) then
it return Array not Bool :/
@little eagle i gave up doing tickets the way BI decided to handle the A3FT
I can return true or false for it?
isClass
no if you want to have a inverted condition2 you need to make it in the {}
@zealous solstice thankyou.
ArmA 3 is so retarded when it comes to conditional evaluation
When it evaluates part of a compound conditional expression even after going false
It still evaluates it.
When it should treat it as explicit code termination
false is false no questions asked
you can't change that
&& and || are implemented as low priority binary commands
left and right side of these commands are almost always evaluated first
also I don't see why lazy evaluation would necessarily be the expected behaviour
Is there any "hacks" to get around it @little eagle
?
Probably could bypass the expression and use a ton of exitWith {} ?
Actually. Demorgans rule might help with that expression problem
Can probably take multi-expressions and compress them into a single boolean expression.
Why does ArmA do this in such a dirty way...
Still probably could still use Boolean algerbra to simplify your expressions
@tough abyss On that note of lazy evalulation, doesn't that violate the optimisation?
concept?
Test it out and check yourself
Also while I've got you Torndeco do you know of anyway I can test code-performance in MP?
As I know diag_codePerformance doesn't work @tough abyss ?
Nvm diag_tickTime
The old way the BIS_fnc_codePerformance worked
Short circuiting is a standard in most languages
so what? I argue that lazy evaluation violates the associative property of the || and && operators. Just because other languages do it, doesn't mean that it's the correct approach. Even if all other programming languages (would) do it that way.
I agree @little eagle explicit control of code is much better.
what's the best way to 'hide' AI? i.e: they're hidden behind or prone on a building/ground, and have them get up only when you pass a trigger?
Hmm.. Also useful
What would be the way to define functions via remoteExecCall
Lets say I have the function XY on the server and want to broadcast it to the client with remoteExec.. I tried to send the name of XY and the code as seperate params of of remote exec to a function that would do: missionNameSpace setVariable [name,code]
but it didnt really work out
[Release] SQF Classes for ArmA 3 - posted in ARMA 3 - MISSION EDITING & SCRIPTING: SQF Classes for ArmA 3 Edited - release updated with a couple of bugfixes - if you downloaded prior to 6pm GMT on 29 October then please re-download to get the corrected files. If . . . [the] fact [that brutes abstract not] be made the distinguishing property of that sort of animal, I fear a great many of those that pass for men must be reckoned into their number. -...
@grizzled cliff
^ excerpt:
_code = str _code;
_code = toArray _code;
_acc = [];
for "_i" from 1 to ((count _code) - 2) do {
_char = _code select _i;
_acc = _acc + [_char];
};
_code = toString _acc;
_code;
the conversion stuff doesnt look to be efficient - also pushBack at least to be used
however for game logic where performance doesnt matter this is OK
select 😄 ?
According to several prominent coder/commenters, Multiple Inheritance is an OOP practice that should be avoided at all costs. Any opinions?
Avoid any problems it can cause
and another question - what language(s) does BI use for the main Arma3 application(s)?
C++ C#
Czech 😉