#arma3_scripting
1 messages ยท Page 480 of 1
I think it's complaining about the addAction title I gave it, but I don't see the issue
different error now?
yea, "please start server first". I'll have to wait a minute ๐
woops wrong log
currently no whining so gonna check it out client ๐
do remoteExec need a timeout before sending the next? sqf [_veh,["Open BIS Virtual Arsenal",_fnc_arsenal,[],2,false,false,"","",5]] remoteExec ["addAction",0,_veh]; [_veh,["Summon Vehicle Drop",_fnc_garage,[],1,false,false,"","",5]] remoteExec ["addAction",0,_veh]; [_veh,["Request Medical Attention",_fnc_heal,[],1.5,false,false,"","",5]] remoteExec ["addAction",0,_veh]; only the last one sent is visible without any RPT errors
do the others throw errors?
nope
RPT is clean
if I disable the last one, the previous one appears
maybe the JIP object causes an issue here?
overwriting the queue or something
Hello, comrades! I have a question again.
Have anyone found a way to track primaryweapon reloading before it ends?
what you mean with track reloading before it ends?
the reload EH fires at the end
yep
Lately, interesting addon hit workshop - KKA3 TFAR Radio animations. It has a sad bug - if animation playactionnow'ed during reload cycle, one magazine (new one) is deleted.
Looks like it happens because game is 'reserving' it, and kinda adds it into weaponitems.
Im willing to fix this, but i cant find how to fire reload event handler before it is ended, while another reload related mod "goko mag drop" spawns an empty magazine in the middle of reloading, but i dont get how it does that
only way io can see is to track animatinos
@still forum it's the _veh part of JIP, it sends the same netID, overwriting the JIP queue (after some extensive reading)
why do you pass _veh at all even?
saw it used on the wiki for an example involving a vehicle, instead of true which was my initial guess
anyone know the max size of procedural textures ?
mine looks fooked when i tried 1024 or over
Perlin noise?
r2t
https://community.bistudio.com/wiki/Procedural_Textures
yup, I guess it's a hardcoded limit somewhere (max 6 R2T too btw)
didn't set a ratio?
is it still possible to override BIS scripts by using the proper $PBOPREFIX$?
I need to override a script that is execVMed from within a BIS module
there's a pretty bad bug in there that's breaking my stuff ^^
I've done this in A2 once or twice until a fix was made by BI but not sure if it's still a thing in A3
@knotty sun last parameter is the JIP "context" Just use true there.
@halcyon crypt it shouldn't be... But ACE is overwriting BIS scripts without proper pboprefix. I think the check for that is borked
Have you reported that bad bug @halcyon crypt ?
I completly missed the execVM part :D
You can also just override the script the module executes by just editing it's config
That might be easier than messing around with pboprefix
@still forum thank you ๐
@tough abyss I haven't yet, first I need to make sure that this the actual problem ^^
@halcyon crypt what is it then?
the HC module removes all control event handlers on the map control when you no longer have HC groups under your command
which breaks a lot
like the mouse cursor with the coord and altitude
ACE map pointing
C2
etc
(โฏยฐโกยฐ๏ผโฏ๏ธต โปโโป
HC as in High Command
That's probably why almost no one uses that stuff ๐
hehe
it's probably an oversight I guess
it's the only module function that does this
the rest all use the stacked ones
well the HC module does use stacked EHs for adding but not resetting
//--- Reset GUI
{
(uinamespace getvariable "_map") ctrlSetEventHandler [_x, ""];
} foreach ["mousemoving","mouseholding","mousebuttondown","mousebuttonup","keydown","keyup"];
as a workaround I can just set that variable to controlNull before removing the last group but meh
don't want to edit mission files
Must be ancient, no one uses seteventhandler
it is ๐
oh I'm sure it is but certain missions rely on it
and it's quite useful for the solo play environment
Yeah we still use it
In fact, started using it again
Wish they had kept working on it though
is the feedback tracker still the place to get BI script bugs fixed or is it a lost cause?
with most of the team moving to other projects
They were quite active lately fixing feedback tracker bugs
I think in last dev-branch update we had a bug fixed that only was reported a couple days before that
interesting
I'll give it the benefit of the doubt then ^^
first I have to relearn phabricator ๐
any comments to improve the thing?
Hello.
Can some one explain. Is there any difference in variable initialization?
private _varName = 5;
_varName = 5;
Private is essential knowledge. Read that over and over till you understand it
@still latch If in function A you define variable _myVar (without using private) and then call function B (from within A) and B also has a variable _myVar, then B will overwrite _myVar in both A and B. However, using private ensures both _myVar variables are separate.
At least that's probably the most common use case
But not the only one
via execVM, and B also has a variable _myVar
no
execVM and spawn launch new script instances
Local variables don't carry over to new instances
Ah yes you're right, should be via call
Also putting private infront of variables increases performance if you are in a deeply nested call tree
But most people probably don't care about that part
I've amended my comment
@still forum oh. Thank you. Will care :)
Btw params always sets the variables to private, which is very useful.
Yeah. No one should be using _this select more than once to get parameters
good
Of course thank you too))
Dude I'll just make 500 new accounts and PM everyone that you're bullying me, that'll surely work
oh god lol
@still latch Here's an example:
_funcA = {
_myVar = 1;
[] call _funcB;
hint str(_myVar); // Outputs 2
};
_funcB = {
_myVar = 2;
};
[] call _funcA;
However, if we used private for both variables then the hint would output 1.
you can use sqf to highlight as sqf code
Oh nice
You are nice
Wait does that work for all discord servers (for sqf I mean)?
yes
noice
discord > steam
which doesnt do any code blocks at all
Does anyone have any clean written basic group systems under a fancy license THAT WORKS WITH AI?
I'm too lazy to cleanup the overkill frontline group system for another thing i'm working on, figured I'd use the BIS one for now, but it doesnt list AI. I want to be able to create groups and put AI in them
@scenic pollen yep I got it. Scopes goes deeper and deeper that is why I need to define private in every sqf/{} for "idiot security"
and performance
Yep
Don't yall forget ma perf bois
@still forum cant get sqf highliting work from mobile.
Hello!
is it possible to add 2 lines with different size to a sible row in ListBox?
for example witha parsetext command?
Is there anyway with nearObjects to only get eden placed objects. Or for that matter any easy way to get eden placed objects position. (Not with BIS_fnc_objectsGrabber)
I think while you are inside 3DEN there are commands to grab every placed object
But do you mean ingame? Like.. Not in editor ๐
Yeah exactly in 3DEN, oohh need to look for that
You mean open the SQM right adam?
nope
in 3den, click file->export->TerrainBuilder
and you get a list with all objects and positions
Oh, ill look into that now! Thanks!
np ๐
https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3 all commands with 3DEN in the name
"ClutterCutter_large_F";206759.859375;6671.509766;0;0;-0;1;4.95;
"ClutterCutter_large_F";206759.90625;6664.634766;0;0;-0;1;4.95;
"ClutterCutter_large_F";206759.953125;6657.838867;0;0;-0;1;4.95;
"ClutterCutter_large_F";206760.0;6651.22168;0;0;-0;1;4.95;
"ClutterCutter_large_F";206759.8125;6680.115723;0;0;-0;1;4.95;
Thats the output
Why there is not a "lbSetStructuredText"
๐ฆ
Both of them kinda works so cheers for them ๐
But to go more in-depth what im looking for and doing is: First place stuff in the 3DEN grab their positions so I can later build them up from an sqf file. So I would require the same syntax as for example createVehicle
/*
Function: ADA_Store_fnc_exportBuildings
Author: Adanteh
Description: Exports building array in proper format for store files, _layerID refers to the name of a layer in 3DEN
Example: ["Layer 1"] call (uiNamespace getVariable 'ADA_Store_fnc_exportBuildings')
*/
#include "macros.hpp"
params [["_layerID", "ExportLayer"]];
private _array = [];
if (is3DEN) then {
private _layerIndex = (all3DENEntities select 6) findIf { (_x get3DENAttribute "name") select 0 == _layerID };
if (_layerIndex == -1) exitWith { _array };
private _layer = (all3DENEntities select 6) select _layerIndex;
private _entities = get3DENLayerEntities _layer;
{
private _className = (_x get3DENAttribute "itemClass") select 0;
private _position = (_x get3DENAttribute "position") select 0;
private _direction = (_x get3DENAttribute "rotation") select 0 select 2;
_array pushBack [_className, _position, _direction];
} forEach _entities;
};
private _linebreak = toString [13,10];
private _nextLine = "," + _lineBreak;
private _allText = format ["[%1%2%1]", _lineBreak, ((_array apply { " " + str _x }) joinString _nextLine)];
copyToClipboard _allText;
_array;
@mellow obsidian that allows you to put things in a layer and then export that ezpz
private _objectsArray = call compile preprocessFileLineNumbers _fileName;
private _objectsCreated = [];
{
_x params ["_className", "_posATL", "_direction"];
private _object = createVehicle [_className, _posATL, [], 0, "CAN_COLLIDE"];
_object setPosATL _posATL;
_object setDir _direction;
_objectsCreated pushBack _object;
} forEach _objectsArray;
that's the format
Additionally add full rotation (instead of yaw only), enableSimulation and so on, basically grab whatever attribute you need
also findIf isn't highlighted as command, seems like discord's sqf needs an update
oh also...
lbSetPictureRight
lnbsetpicturecolorselectedright
ctrlSetPixelPrecision
ctrlAnimateModel
ctrlTextWidth
Amazing Adanteh! Thanks! How do I use this though?
either use cfgFunctions, and then use the example (just replace ADA_Store_fnc_exportBuildings by whatever you call it). I think creating a .sqf file in your mission folder also works and then just doing sqf ["SomeLayer"] execVM 'yourfilename.sqf'
I think that works too when you're loaded in eden
then it'll copy the proper text with proper formatting on your clipboard, so you can paste it into some file
Ahh I see, cheers.
you gotta make a layer, click the button in the bottom left, then drag objects into that and it'll export that
Ohh thats what that parameter is for, many thanks
Should I execute ingame (play as character) or in the 3DEN?
3den
Had some issues with a mod blocking debug in 3den but it all works now. Many thanks Adanteh, this is amazing!
while {c130_inAir} do {
c130_ussFreedom allowDamage false;
hint 'allowDamage isEqualTo False - Deck';
} else {
c130_ussFreedom allowDamage true;
hint 'allowDamage isEqualTo True - Deck';
};``` Is this correct usage of `allowdamage` and `else` within a `while` statement?
do doesn't take array
allowDamage is correct yeah
but you can't pass ARRAY to do
and else on a while doesn't make sense anyway
Best to change it to an if?
c130_ussFreedom setPos _deck;
c130_ussFreedom setDir _deckDir;
if (c130_ussFreedom distance2D ussFreedom < 100) then {
c130_inAir = false;
};
while {c130_inAir} do {
c130_ussFreedom allowDamage false;
hint 'allowDamage isEqualTo False - Deck';
} else {
c130_ussFreedom allowDamage true;
hint 'allowDamage isEqualTo True - Deck';
};``` Full script (is it called within an addAction)
If you want else then that's the only possible option
(is it called within an addAction) If you don't spawn then the while won't work anyway
It will freeze your game for a while and then just exit
Okay.
@meager heart Thanks!
I do have a question about the function ace_interact_menu_fnc_addActionToClass. Why can't I use "CAManBase" as type for this? Judging from the config way to add actions it should work, but for some reason it does not with scripts.
Do I really need to add it each CAManBase Object by hand?
it should work
// works
[typeOf dude, 0, ["ACE_MainActions","Medical"], _action] call ace_interact_menu_fnc_addActionToClass;
// does not
["CAManBase", 0, ["ACE_MainActions","Medical"], _action] call ace_interact_menu_fnc_addActionToClass;
it's essentially an ACE specific wrapper for CBA_fnc_addClassEventHandler which I know works
hmm
I'm guessing that the CBA part of it works fine
so the EH on CAManBase is set
but something ACE related isn't taking it or something
no clue beyond that though
@digital jacinth probably need to specify that you want the interaction to be inheritable
hmm so that is what that flag does, huh
* Arguments:
* 0: TypeOf of the class <STRING>
* 1: Type of action, 0 for actions, 1 for self-actions <NUMBER>
* 2: Parent path of the new action <ARRAY>
* 3: Action <ARRAY>
* 4: Use Inheritance <BOOL> (default: false)
4 needs to be true
["CAManBase", 0, ["ACE_MainActions","Medical"], _action, true] call ace_interact_menu_fnc_addActionToClass;
pretty sure that is the problem
hmmm, nope. still nothing
ยฏ_(ใ)_/ยฏ
actually, hang on. I added it to all the actions EXCEPT the one i wanted to test...
it works now
Anyone know how to convert the values given from get3DENAttribute "rotation" (Degrees) to vector, so I can use setVectorUp
Or does a different method to set rotation on x/y axis?
private _value = (_object get3DENAttribute "rotation") select 2;
_object setVectorDir [sin _value, cos _value, 1];
```maybe
private _vectorDir = _object vectorFromTo _targetObject;
private _vectorAt = vectorNormalized (_vectorDir vectorCrossProduct [0, 0, 1]);
private _vectorUp = _vectorAt vectorCrossProduct _vectorDir;
_object setVectorDirAndUp [_vectorDir, _vectorUp];
```maybe x2 ๐
also if that for some ui things we have ctrlModelDirAndUp and ctrlSetModelDirAndUp
Hmm.. I seem to be unlucky. Its from Adanteh's script above. Wanna grab all rotation (x/y/z) and then create the object with those attributes
check this part maybe > https://discordapp.com/channels/105462288051380224/105462984087728128/481846931962986497
you have there "direction"
Correct but direction is only the rotation on Z axis, as far as im aware
Yeah Im doing so i believe:
private _direction = (_x get3DENAttribute "rotation") select 0 select 2;
private _rotationX = (_x get3DENAttribute "rotation") select 0 select 0;
private _rotationY = (_x get3DENAttribute "rotation") select 0 select 1;
_array pushBack [_className, _position, _direction,_rotationX,_rotationY];
But that gives me the rotation in degrees and im trying to convert it to vectors
_x params ["_className", "_posATL", "_direction", "_rotaionX", "_rotaionY"];
private _object = createVehicle [_className, _posATL, [], 0, "CAN_COLLIDE"];
_object setPosATL _posATL;
_object setVectorDir [sin _rotaionX,cos _rotaionY,0];
But no luck. However im might just be super tired right now and missing something super basic ๐
Also tried the setVectorUp
Yeah there was something special to 3DEN rotations.
But my vector math is not up to spec, needs to be recalibrated.
maybe x3 ez way will be with just getPosWorld vectorUp and vectorDir in that grabber function ๐
Anyone knows how to script a "roll aircraft" that takes into account if it's a small sports plane or a b52?
Thinking I either have to do some model size and then guess its performances but would be great if could just plane applyAlieron [1,"left"]
add torque
Is it better for a frequently called (every 1s) server-side script to run for 18ms in unscheduled, or 100s of ms in scheduled? Which one has the overall lesser impact on server performance?
scheduled can only run 3ms per frame. That's designed so that it can't have any major impact on anything else
So with scheduled you are on the safe side.
Sorry, I meant 100s of ms total time spent in scheduled (due to the 3ms limit)
yeah. I understood it like that
20ms is not that bad for something that runs only once per second. On clientside you wouldn't want the fps drop. On serverside isn't not that bad
the question that I'd ask though is.. Why is it slow? Why not make it run faster?
So if I have a script that's very intensive, and run it in scheduled, it shouldn't affect performance? I thought this was the major contributor to performance issues in missions?
correct. No it isn't
Whoa
What you probably mean by the second thing is that.. Because if 3ms are filled no other script can run that frame and everything else is pushed back.
If you make things like UI buttons or any interaction as scheduled. That could delay the actual execution of the script by quite a lot of time.
Technically even up to hours.
You don't want to wait an hour after pressing the respawn button till you actually respawn
Also scheduled scripts are in general slower than unscheduled.
Because in scheduled mode, the scheduler checks for the 3ms timeout after every single expression that was executed.
I see. So scheduled scripts shouldn't impact major things such as AI performance?
correct
Excellent, thanks for your explanation
copyToClipboard doesnt work in MP?
Correct.
with scheduled you are always on the safe side "performance" wise. Besides ofcourse if other people put important stuff that has to execute quickly into scheduled...
But that's their fault then
still. 18ms script.. It can sure be optimized.
Yeah 18ms is slow, but I'm not sure how to speed up performance beyond the optimisations I've already made. My script is iterating over every unit + vehicle, and calling an extension for each one.
Perhaps it's better if I show you the script
This is called every 1s, in an unscheduled environment
Is the Extension the actually slow part? How fast does it run if you just comment out all the extension calls?
Good question. I haven't tried this with the latest version of my script, so perhaps the DLL is a bottleneck. However, the DLL isn't really doing much - just appending some values to a dict. I tried threading the DLL, but this is in fact slower (spawning the thread takes longer than just executing the code synchronously)
You usually don't spawn the thread. It should already be running and waiting for work
Yeah I considered that too (using a thread pool). Perhaps this is the route I should take. I wanted to avoid threading though, since each DLL call operates on the same variable (so could result in conflicting writes). This may be my only option though
the same variable (so could result in conflicting writes) Make the variable as small as possible.
In TFAR for example I use a work queue. The thread only locks it for a very short time when it takes a job out.
First thing would be to test if the extension is actually the problem though.
https://github.com/ocapmod/OCAP/blob/develop/gameserver/%40ocap/addons/ocap/functions/fn_captureFrame.sqf#L70 you should move that to the top. Before _id.
If that condition makes it exit, then the two variables above it are useless
Yep you're right. The if statement made use of those two variables before - I must've forgotten to move it.
_entityCount = _entityCount + 1; Just return true at the end, and false in the exitWith's and let count take care of the counting for you
Good tip, thanks ๐
Also you are doing all the rounding in SQF.
You could also move that to the seperate thread of your extension
I did wonder whether SQF rounding was slow
same for your parseNumber to turn bool into number. Just do that in extension
every SQF command is "slow". Less commands == better
But do you really need to go through allUnits every frame? For my own recorder, I only do it ~7 seconds, but more often for fast moving vehicles.
every second. not every frame
Arma Engine internally also differentiates between veryslow, slow, fast, veryfast Entities
It's every 1s atm, but that's really only for stress testing. In the end I'll probably only run it every 3s
Arma Engine internally also differentiates between veryslow, slow, fast, veryfast Entities(edited)
How so?
And what do you mean by slow/fast etc?
For example buildings are veryslow, They don't need to be updated often
bullets are veryfast, they are updated as often as possible.
And are you saying there's a performant way to filter this when calling allUnits (for example)?
not really. Atleast not accessible from script I think
you could make a intermediary list and refresh it every 10 seconds or so.. But that's alot more work and won't really help you much
Ah I see. I thought that's what you were building up to haha
@umbral oyster if it says so on wiki https://community.bistudio.com/wiki/copyToClipboard
@still forum For things like rounding (or other math operations), is it quicker to make a synchronous extension call that does the rounding for us, than to call SQF round by itself?
Just trying to figure out exactly how much is worth moving to an extension
no
sqf command is faster
But you pass them to the extension as string anyway
just pass the unrounded value directly
if the extension needs to round it, it can just do it in a seperate thread
Cool, makes sense
Also your extension might be slow because you are doing all the string parsing
you should just copy the strings and send it off to a queue to be processed by a second thread.
That can then take care of the parsing and rounding and everything that's needed
Yeah, it does indeed look like threading is the way to go
(assuming the extension is what's causing the bottleneck)
Anyone happen to have a function that adds given classname to cargo inventory? Aka give it a classname and it goes into box, so it handles whether its item, magazine or weapon?
or nevermind.... i already have it myself with tiny adjustment ๐
How is that possible that createMarkerLocal becomes global?
Not remoteExecuted to everyone, so not shared on every PC.
Just created on one PC and with some magic it becomes visible to everyone.
if you use any global command on it, it'll turn into a global marker
_marker = createMarkerLocal blablal;
_marker setMarkerColor "ColorBlack";
and tada its global
yep
Is that noted somewhere on wiki?
Gotta make sure you use local commands on it
i think so
NOTE: Local markers have own set of local commands "XXXXLocal" to work with. If you use global marker command on a local marker, the local marker will become global marker.
See this is where SQF should raise an error (e.g "Error: Used global command on local marker") instead of just silently performing some other unexpected function
It can't though.
Because it doesn't know whether a marker is global or local
If it knew that we wouldn't need specific local/global commands. As the command could just check whether the marker should be local only
True, but overall it's just bad design (or at least could be better)
As in it should know whether a marker is local or global
But then tbf we all complain about SQF but I can't think of any other game that is so open and has such a dedicated scripting community
Yeah I also don't know why it would be hard to add a variable to it..
Legacy stuff ยฏ_(ใ)_/ยฏ
Yeah I'm assuming the devs have a tough time having to build on top an engine that's a decade (or more?) old
Some of it is 2 decades old
The "Real Virtuality" Engine.. https://en.wikipedia.org/wiki/Gravon:_Real_Virtuality
Oh wow, didn't know this was where RV started
Any idea why the following has no return?
_vehicle = vehicle player;
_vehicleWeapons = (_vehicle weaponsTurret ((assignedVehicleRole player) select 1));
_vehicleMagazines = _vehicleWeapons apply {getArray (configFile >> "CfgWeapons" >> _x >> "magazines")};
_vehicle weaponsTurret ((assignedVehicleRole player) select 1) works just fine, for a Slammer it returns ["cannon_120mm", "LMG_coax]. Both have a magazines[] entry in the config...
It works fine here. But I mean the result of an assignment expression is nil, so that is the return value?
okay and?
You might wanna delete your violation.
@elder vigil I'm guessing it's rule "9) Do not cross-post" since you asked the same question on #arma3_questions
Two questions:
- How does one go about un-nesting an array? Turn
[[1,1],[2,2],[3,3]]into[1,1,2,2,3,3]. - How do I go about removing dupliate entries from an array?
[1,1,2,2,3,3]into[1,2,3]
_arr = [[1,1],[2,2],[3,3]]
_unnested = parseSimpleArray ("[" + (((str _arr) splitString "[],") joinString ",") + "]");
_noduplicates = _unnested arrayIntersect _unnested ;
(โฏยฐโกยฐ๏ผโฏ๏ธต โปโโป
Nice, thanks @still forum!
Is there anyway currently to set an init of a object/vehicle or is that fully removed?
init eventhandler? Init box in 3DEN? what init?
Oh crap my bad, i'm pulling an init from the Init box of 3DEN and then with scripts placing that object backdown and would like to place the init from 3DEN aswell
you are creating objects via script and want a init script running on them
Very much correct, saw that the setVehicleInit got removed a couple of years back. So wonder if there is a smart and safe work around
just execute the script right after createVehicle
Thats what im currently trying. But when the object has init code of an addaction I cant seem to get it to work.
_initcode; //code with the init code from the object
_object //the object itself
Is how I have it set up
hey everyone fsm stuff again:
any ideas why isServer is not true on a dedicated server when checked in a condition?
can you show me your actual code @mellow obsidian ?
@sleek token AI FSM? or AI unrelated and 100% sure it's running on server?
ai unrelated stuff, i am doing missionflow and HC balancing with fsm
params ["_callFile","_enableSimulation","_allowDamage"];
private _objectsArray = call _callFile;
private _objectsCreated = [];
{
_x params ["_className", "_posATL", "_vectorDir", "_vectorUp","_initCode"];
private _object = createVehicle [_className, _posATL, [], 0, "CAN_COLLIDE"];
_object setPosATL _posATL;
_object setVectorDirAndUp [_vectorDir,_vectorUp];
_object enableSimulation _enableSimulation;
_object allowDamage _allowDamage;
if( _initcode != "")then{_object ??? _initCode}; // <----This is the part im working on
_objectsCreated pushBack _object;
} forEach _objectsArray;
it's strange the fsm is running fine while tested in editor and being hosted localy but as soon i try i to run on a dedicated server instance it never executes past isServer
_object ??? _initCode -> _object call _initCode
is _initCode actually code, or a string? I don't remember if != requires the same type is why it matters
@ruby breach yes, != requires same types for both operands, isEqualTo - no
Looks like its a string Gnashes
private _initCode = (_x get3DENAttribute "Init") select 0;
becomes
"this addAction [""a useless action that does nothing"", {}];"
Trying the call but gotten some errors from it so trying to figure out why currently
Replace this with _this and compile it
_object call compile _initCode;
Works!
Hats off to all of you!
Many thanks
Can anyone point me in the right direction with making extensions scheduled. (Tfr exists so it should be possible right)
Extensions 'scheduled'?
? The term scheduled refers to the "context" the code runs in. Pretty sure from SQF perspective there is only unscheduled when using callExtension.
allow suspension
Spawn threads, and return immediately so SQF can keep running. Then later check back with another callExtension command.
does the freeze when calling a extension end when returning something or when the dll reaches the last line of code (At vacation atm so cant test)
When you return to the engine
You'd have to spawn a thread to continue executing extension side, like Muzzleflash said
Interesting, thanks.
isnt the post init executed on the serverside as well?
im having trouble cause a script doesnt execute on serverside after isServer check
systemChat "im running it in 30sec";
sleep 30;
missionHandle = [] spawn EB_MAINMISSION_fnc_missionAI;
How to get contents of groundweaponholder?
getMagazineCargo / getWeaponCargo / getItemCargo / getBackpackCargo / etc
@sleek token Does it execute before isServer check?
idk
i guess it kinda has todo with suspending
because switching all code to initServer.sqf fixed all my problems
You can guess or you can test, itโs up to you of course
I will try it out later, i never put anything before the check
I doubt isServer command is broken so I expect it wonโt execute either because the whole script doesnโt execute for some reason
But until you test it you got yourself a Schrรถdinger's cat
Running something in post-init is unscheduled, right? So if you did that then it probably got aborted at the sleep command.
Where-as initServer.sqf (and the other init*.sqf files) are run scheduled.
nope post-init is scheduled but it will be suspended for the time the mission is loading
Ah, yeah forgot post-init was odd one that did not run unscheduled.
Interesting problem. I don't think this affects it - based on the description it doesn't look like it would - but there is this note in the bottom: https://community.bistudio.com/wiki/Initialization_Order#cite_note-enginewaits-1
I just tested this
if (!isServer) exitWith {};
sleep 20;
["Hello World"] remoteExecCall ["systemChat"];
It works, sorta. I tested on both editor, locally hosted, and dedicated.
Strange thing is it does seem to run twice.
Firstly I am stuck in the loading screen for an additional 20s while the server (including editor) before the game will start.
Then after the game start, I can run around, and when 20s have passed from start I get the message.
Does it happen to run twice when running local?
I am only guessing it runs twice because of the delay (happening twice). I only see the "last" message, because I am not ingame before that - still loading.
But yes the behaviour is the same in editor, hosted MP and dedicated.
Shouldn't happen even if you don wait.
Oh, well it could be that you are indeed exeucting this twice? Where is it being executed?
I have a fresh mission, just a player, and a post-init in CfgFunctions which should run once per machine on loading right? I am looking at my clock watching seconds tick. I sit at the loading screen for roughly 23s (20s + 3s normal loading time) before I get in the game, the another 20s before the message.
This is my CfgFunctions part:
class myPostInit
{
file = "myPostInit.sqf";
postInit = 1;
};```
If I remove the sleep, I get into the game after the 3s and then immediately get the message.
20s from the server that will block the players from loading in plus 20s from the client itself
Yeah, but then the dedicated server still gets it wrong.
I still wait twice when joining a dedi.
@indigo snow btw that explains another problem i had...
Something strange is definitely going on:
I change sleep time to 5s: I now wait additional 20s still in loading, and then 5s ingame before the message.
Remove sleep time completely: Wait < 3 seconds loading, and message immediately.
Okay change sleep time to 5s again: I now wait additional 20s in loading again, and then only 5s ingame.
Might be a crowded scheduler
yep
Still sounds wierd for it to be that
If I add a sleep > 0, Arma will somehow create delay/work for ~20s . Then it will also do the actual sleeping. So if I sleep 40, it will take 20s before I get into the game, and then another 40s for the "actual sleeping". With 5s it become 20 + 5 and so on. But if the sleep is not there or 0s you will not get the additional 20s.
I am not really convinced there is 20s of scheduled work to be done in vanilla Arma, only one unit on map, but whatever.
My take away is, try hard not to have to sleep in post init.
And @sleek token I closed Arma now, so did not try with spawn. But my code continued running on the dedicated, after the sleep as expected. Essentially this worked for me in post-init:
if (!isServer) exitWith {};
sleep 15;
["Hello World"] remoteExecCall ["systemChat"];
[str clientOwner] remoteExecCall ["systemChat"];```
And the number for the last command was 2 which is the server.
allright thanks for testing this out
however i moved all my init code to initserver
this "bypasses" the limitation for function libs
Is there a standard way we handle DLL exceptions in Arma? Every time my DLL raises an exception, Arma crashes. I get that I should be correctly handling exceptions in the DLL, but an error could occur at almost every line - surely I don't need to surround everything in a try/catch?
anyone knows any way to do silent footsteps?
its for a special player not for all players
Does the engine have issues with nested for or while loops?
currently just putting two big circle marker with 2 dot markers inside it
my guard bools and exitWiths won't fire and break loops, so it goes on and on endlessly
kinda ez way > map control ctrlAddEventHandler > "Draw" and no loops ๐
eh, this is more of a test for some dynamic mission creation I have planned for later
the map markers are proof of concept for it
and I've no experience on ctrlAddEventHandlers ...
afaik there are no issues with loops in loops aka nested loops, except that every loop can/will impact performance, if that was done wrong... also depends where you have those loops (scheduled/unscheduled)
you're right. There's nothing wrong with it. I had a trigger that was being triggered constantly, running my script endlessly.
changed it to trigger once, poof, no more loopy loops
is there a way of creating a unit at the players position and having a init field still?
Hello! I have a problem with calling scripts. If I have variable _test in my main script and in that script I do [] cal test_fnc_test;. In that script i called i have a variable called _test too but as different scripts should affect the main one. After called, first variable value is equal to the value in the call script. EXAMPLE:
test_fnc_test = {
_test = player;
_test
};
_test = 0;
[player] call test_fnc_test;
hint str _test;
//_test == player WTFยฟ?
Am I crazy or its made to work like that?
Is there a way to change the way an object explodes? I'm trying to change the way the "cup -usmc vehicle service point" blows up. By defualt it's just a big 3 sec explosion then the object disappears and leaves a crater. I want to make it so when it explodes the ammunition starts "cooking off" and the object changes leaving only a shipping container so that it looks like the ammo boxes and fuel barrels were destroyed.
This is the object I'm referring to - https://ibb.co/mfOPYK
@lean estuary Can anyone point me in the right direction with making extensions scheduled. (Tfr exists so it should be possible right)
You can't. And TFAR doesn't.
or when the dll reaches the last line of code Do you even know how dll's work at all?
@sleek token how do you launch that code?
@errant jasper Firstly I am stuck in the loading screen for an additional 20s while the server That's because the loading screen waits till all postInit scripts are done.
Some idiots put waitUntil and sleeps into there, and then you get that bug that the waitUntil never exits and you end up in a endless loading screen.
IMO postInit scripts should be handled as if they were unscheduled. (I use the CBA postInit which actually is unscheduled)
@scenic pollen but an error could occur at almost every line - surely I don't need to surround everything in a try/catch? The fix for that is what people call "good code"
Just don't write code that could crash anywhere.
@sonic cradle Does the engine have issues with nested for or while loops? no.
@willow rover is there a way of creating a unit at the players position and having a init field still?
Yes? Why not? If you spawn the unit with createUnit just call your initCode manually right after that.
@minor lance [] cal test_fnc_test; Typo in there. It's call
Damn Dedmen knocking out these questions left and right
Groundhog Day ๐
Still surprised, that there is 20s of postinit to run in vanilla Arma. I just assumed postinit was unscheduled so never had the problem myself.
So to be sure, will postInits be always executed in the order they are in CfgFunctions as sleeps in there will just prolong the execution instead of giving the scheduler time to execute something else?
scheduler runs it's...... Uh.. Need to look that up
I doubt that
My assumption is that it runs Alphabetical
no
Nope.
That's a optional extra that's used for things like CfgVehicles. And only if you search by name. Not if you iterate
This now... Is horrifying
Inside loading screen the scheduler runs it's 50ms (instead of 3ms) per frame of scheduled code.
But the initFunctions.sqf (Functions_f.pbo) script calls all postInit script in a loop while iterating through the list of postInit functions. And ends the loading screen when it's done.
And as we know call waits till the script is done.
They are executed by order of definition/initialization. Things like requiredAddons plays into that.
If you put an addon into your requiredAddons, it's pre/postInit functions will execute first, it's functions will also be compiled first.
Thanks Dedmen.
What part of that is useful?
Besides the "never sleep/waitUntil in postInit" which I tell people quite often
idk, in case I'm run into some weird bug and knowing that is useful
and could solve my problems
https://community.bistudio.com/wiki/startLoadingScreen
The red note might be interesting too.. Use a sleep in postInit in singleplayer and you'll never get out.
although, seems like it's probably something I will never have to worry about
Just always think about that your postInit script is delaying the loading screen.
If you don't want that then add a layer of [] spawn {}
Added notes to the startLoadingScreen/Scheduler/CfgFunctions wiki pages
imo better just do not suspend any "init" scripts at all/in general (not only in posInit) init/initPlayerLocal/initServer... etc
also like so ^ you will have less players rage quit after they got old while waiting for mission start ๐
init.sqf suspending is fine.. But it's evil because you always have to think about which line to put new stuff in.
I prefer to do everything unscheduled when I can
@still forum after spending some time in this channel, I'm trying the same tbqh ๐
Also unscheduled stuff has way better profiling tools wink wink
๐
Same lag just distributed over a longer timespan
you can do the same in unscheduled. Only spawn limited number per frame
Yeah
It's just that you have to actually use your brain and think about what implications the things, you are doing, have
@tough abyss that is a horrible lie
And I also find it's way more fun having to think about exactly what you are doing. Instead of just throwing a splat of code onto the wall
Someone's having fun with SQF over here! Burn him ๐ฅ ๐ด
You can spawn units in unscheduled and have no stutter.
Just because you tried spawning 10 units during a single frame doesn't mean unschedueld is bad
@peak plover spawning units is always horrible Performance wise... If you got a low fps System, a single Spawn Hits you hard
The fix for that is what people call "good code"
Ouch
@still forum How uncomfortable does this make you? ๐
@scenic pollen
Are you evil?
Yes man, you are.
Mwhahaha
eyetwitch
@queen cargo please elaborate?
more so if you spawn a unit which has clothes and weapons you haven't seen with your client
like spawn in a AAF squad and then another one
2nd time is less laggy
then spawn in a csat squad
Spawning in units always is laggy for the Client doing so..
loading models and textures from disk. Initializing the unit's state. Maybe spawning a new AI group. Transmitting the new unit over network..
Well i haven't analysed it down to the deepest level, but on reasonably well scripted missions i do not experience lags when units are being spawned. I have a decent CPU tho and my arma runs from SSD. If a lot of stuff is spawned in bulk, yeah i get a small lag, sure. But if its spread out in tiny portions it seems fine, no lag no fps drops nothing.
๐ค Now is this really a matter of bad arma engine design and/or bad scripting habbits or should you guys finally replace your Phenom CPUs
If a lot of stuff is spawned in bulk, yeah i get a small lag, sure. But if its spread out in tiny portions it seems fine, no lag no fps drops nothing. That is exactly what we were talking about.
And SSD has a huge effect on exactly this
But what about the "clothes your client hasn't seen yet" ?
I thought an SSD would impact that the most
Yes.
But once that item is loaded, re-use of it for spawning 100 AI shouldn't matter?
That's what I just said didn't I?
correct
Once you have all the stuff in memory, spawning more is "fairly" cheap
But you still have the setting up unit state and AI and transmitting over network stuff
Also don't forget about unit init scripts
@waxen tide got some money? My CPU Upgrade is currently preparing to pay the car repair..
Well maybe i should be more specific. I would have thought that SSDs help with loading textures and models from disk, while a fast cpu will help with spawning lots of objects
You need to set priorities. Stop eating for a month or something.
So X39 by "low fps system" you mean someone with a really old PC or just a high load mission environment with lots of stuff already going on?
Haha, good luck explaining someone how to spread AI creation per frame in unscheduled instead of telling them to use spawn and be done with it
I'm already doing that. We had that discussion like 2 weeks ago or something.
But everyone i tested it with in MP has a good to very good cpu so i'm wondering if there is more things to do for people with old systems.
I mean you could get arma to pre-load the data by pre-placing units etc.
Theoretically, yes
Thing is: the Client doing the task will lag
If the Client is an actual Player or the server does not matters... Unless they improved it a lot since last time I worked on xinsurgency ๐คทโโ๏ธ
๐ค You mean the client that actually spawns the units takes a hit, but clients to which the new units are being synced to do not ?
does not matters ๐จ
@queen cargo Can you clarify what you mean with "the task"? I'm a bit of a slowpoke today.
spawning the object
Hey Guys, im trying to create Templates for AI's, cause there are no Units defined in the Niarms mod . i wanna define classes in the description.ext to spawn this Unit with a script. problem is im not really sure how to start to describe it : class B_Soldier_GL_F_niarms { .... .
can't do it in description.ext
hmm. What about playMoveNow ? It wouldn't ignore the que like switchMove does and hopefully respect the animation set it's being moved into right?
@tough abyss
isn't the keyword "hopefully" when it comes to playMove? maybe add a setUnitPos "DOWN" too. might help with reliability
Possibly, there is no assurance with any of it. As the player controller probably doesn't like getting forced to do things
Especially when AI FSMS are telling it to do one thing when you're telling it to do another
I imagine intercept could help with this engine layer stuff?
Theoretically yes. Practically no cuz I'm probably the only guy that could and I don't have free time
setUnitPos seems promising
idk if that will be any faster but there is alt syntax for the createUnit with init ๐ค
example 4 > https://community.bistudio.com/wiki/createUnit
Is there any way with a camera to make a "photo" ?
like get the picture and save it to a variable or something
You can freeze the scene and save composition and when you want to view photo, hide everything that wasnโt on photo and recreate composition. Doable but major hasslehoff
Where do you configure the vanilla helicopter sling loading?
Or its just scripted-only with sling* and rope* commands?
@minor lance no, but you can use screenshot command to save a png =|
Is there anyway to lock player from going STAND from PRONE?
@minor lance it was discussed here. several approaches https://forums.bohemia.net/forums/topic/205878-how-to-force-a-player-to-stay-prone/
Is there a function which locks to a specific coordinate on the map? Can't seem to find it but rather be sure ๐ค
By locks I mean moves to XY
Kind of like pressing show on map when you got am objective.
ctrlMapAnimAdd ctrlMapAnimCommit
Is there any like a radiation detector script ?
Radiation detector? What?
Like a it will play a sound in a specific area when you have an specific gadget
Sick thanks sharp.
if("ItemGPS" in (items player)) then {
if((player distance (getMarkerPos "marker_zone")) < 10) then {
//beep beeep
};
};
@rustic pendant There is no radiation in Arma ๐
Iknow hahaha
Lets say you are in a mission to find some stolen radioactive material, let say in Fallujah , I guess you can use triggers that play the sound louder as you get closer to the radioactive material position
But it will only play the sound if the player has a specific device
๐คฆ ,
snow. Look at what I posted and adapt it to what you need. It'd be best that you also learn how to use SQF yourself.
Thanks Midnight
https://community.bistudio.com/wiki/fadeSound could potentially produce your decreased and increased volume
^ it would lower the general game sound level
@winter rose My take on this would be that the sound will only play if you're close enough to be concerned about it at all, you'd need the headphones to hear it anyways. But I guess you could also use say or playSound3D to emulate a speaker
I would define multiple sounds in CfgSounds, with 10%, 20%, โ 100% volume
Oh, duh. Yeah that would be more effective
if it's a playSound player-side. if the sound is on the object itself, a shorter sound radius would do it
Huh? playSound is local effects, so no one would hear it anyways if it was player side
But it will only play the sound if the player has a specific device
it might be a local effect, only hearable by the player, that I don't know
I might be missing something, but I cant find a command for the following problem:
I have got two objects a and b. I have a rope attached from a to b. An eventhandler is applied to b and when it fires I need the rope object for further instructions.
"ropes" does not work for b only for a (startpoint of rope). But as I have multiple ropes going away from a I cant use that.
Does somebody has a suggestion? Thanks.
When you create the rope set a variable on b containing the rope object
Yeah I guess thats the way to go. Not the prettiest.
Alright. Ill go for it. Thanks.
any idea what could the ai make immortal if its not allowDamage?
strange error, while in local ai dies normaly but in mp they don't give a fu*ck
you can try allowDamage but this time without locality issues ๐
i tried this allready, but nope that doesnt work
isAllowedDamage says it is allowed to take damage anyways
i checked the attached event handlers, one or more HandleDamage eventhandlers have been attached to this unit
but it is not done in my code
show it maybe..
is there a way to see the code of the eventhandlers in the mission running?
also check this page, there is some warnings > https://community.bistudio.com/wiki/allowDamage
i executed the allowDamage command on the owner side of the ai
is there a way to see the code of the eventhandlers in the mission running?
add therehintdiag_logsystemChat....
?
maybe we talking cross purposes, im guessing a mod like ace is messing up the AI
i didnt add any eventhandlers to the ai, just want to find a trace where i can look after the issue
The funny thing is; this only happens on a server. it doesnt happen in the editor
@sleek token i'd try brute force removeAllEventhandlers just to see, if it's an EH causing it.
What function can I use to remove and add the Slat cages in mission?
@sleek token Always run vanilla when troubleshooting.
@outer fjord I believe they are set as animation sources, so look in config and use setAnimationSource
Sweet, thanks.
Yea, what I want to make is a option to add and remove them as needed.
So you can load say a NYX onto a blackfish.
Simple goal, simply adding a add action that takes time to take it on and off. Ultimate goal, make it require a engineer class with a tool kit.
Is it possible to check if player can see an object?
thanks
Im having issues with making MGI_Halo jump Script work
i put the script in the mission folder and put the ex in the object i attempt to play and it says missing _ name .sqf
@spring vigil Well its explicit - you mistook the destination folder or its really missing.
yeah i thought so as well
I canโt post a pic or I would
I thing Iโve figured out an issue I think widows is doing script.sqf.txt
@still forum I'm using ASP for the 1st time. I have the addon enabled, and the Brofiler open. How do I start profiling?
I've tried (in the debug console):
private _scope = createProfileScope "testScope";
profilerCaptureFrame
Nothing is copied to my clipboard, and nothing appears on Brofiler. Sorry, not familiar with this. Not using the Profiling build.
Figured it out.
You just need to launch your game with the -nopause startup parameter and the mod enabled (no need to run any script commands). Then open the Brofiler and hit the play button to start profiling. Hit the stop button to stop profiling and view results.
Im using get3DENAttribute to grab an markers Variable name
private _markerName = (_x get3DENAttribute "name");
_x being the object.
However it returns Null.
The text of the marker works fully fine.
private _markerText = (_x get3DENAttribute "text");
Somebody had this issue before?
Having an issue finding whether positions are greater than a set distance from an array of positions. My check on distance keeps failing when I run it against the array:
0 = {if (_safePos distance2d _x < 400) exitWith {
player sideChat format ["Too close!"];
_isValid = false;
}} count array_of_previous_positions;```
But I get the error for _safePos only showing 1 element instead of 3.
0 = {if (_safePos distance2d _x < 400) exitWith {
Error position: <distance2d _x < 400) exitWith {
Error 1 elements provided, 3 expected```
I'm stumped. _safePos is supposed to be a position (an array of 3). Distance is supposed to take in two positions... but _safePos is only feeding it one? huh?
@scenic pollen How do I start profiling? Click the green play butotn in brofiler
You just need to launch your game with the -nopause startup parameter Nope. But if you don't you need to be tabbed in
hi
does your debugger/profiler thingy rely on extensions or are you doing some fancy hacking?
im a script kiddie in search of help in terms of custom sound adding
Intercept.
oh right, ofc ^^
Sooo.. A little bit of extensions and fancy hacking if you wanna call it that
The old debugger before Intercept was veeery fancy hacking. The new one is just normal intercept (mostly)
Intercept it's pretty, but i'm too noob for that ๐
i managed to put 3 songs in .ogg without any problem, but after i activate one trigger to play one, i cant play the other ones
sounds like your triggers aren't setup correctly
could be
or maybe you have to stop the previous song before starting a new one?
playMusic "" should stop it
class CfgMusic
{
tracks[]={};
class Music1
{
name = "Music1";
sound[] = {"\sound\ThreeChainLinks_DieHistoric.ogg", db+0, 1.0};
};
class Music2
{
name = "Music2";
sound[] = {"\sound\music2.ogg", db+0, 1.0};
};
class Music3
{
name = "Music3";
sound[] = {"\sound\EspanaUno.ogg", db+0, 1.0};
};
};
= "Music1";
wait
i think i got it
Yup
Got it
Thanks eitherway
๐
I feel like a noob for asking this but how do I skip an iteration of a forEach loop?
Remove it from array
Wait, really? That seems really hacky (not blaming you, blaming sqf)
Whatโs hacky, you donโt want element to be iterated over remove it. Alternatively you can put if inside the loop and check every iteration if the _x is not that element, but that wouldnโt be wise
Do you mean remove it from the array while iterating over the array, or before?
Why remove it while iterating??? I donโt get what you are asking.
arr = [1,2,3]; arr deleteAt 1; {systemChat str _x} forEach arr;
{
if (!(alive _x)) then {
// Skip this iteration
};
// Do stuff
} forEach allUnits;
In other languages we would simply use continue to skip an iteration
I invert that boolean and put the processing inside the if()
@ionic orchid I was afraid you might say that haha. Seems to be the only way
@scenic pollen if you delete the current element from the array. The forEach loop will skip the next one after that
if that helps ๐
Oh god ๐
In SQF we donโt care if unit is dead because allUnits returns only alive units https://community.bistudio.com/wiki/allUnits
you could also check the _forEachIndex instead of deleting, or use select to select parts of the array
asd = nearestObjects [this, ["Land_BarGate_F"], 200];
asd = this nearObjects ["Land_BarGate_F", 20];
hint format["%1", asd];
any hint?
@indigo snow Thanks, but in my case I need to check a condition for each element of the array
use array SELECT {code} to precondition the selection
select will only select elements where the {code} returns true
nvm top my post
Hmm, but wouldn't that command need to iterate over each element of that array (behind the scenes)? I'm aiming for high performance
youll be iterating either way, dont sweat the small stuff too much
Yeah but then I'd be iterating twice (effectively)
Normally I'd be fine with that (it's a good solution)
any hint?
3 hints for 5 gates >
player spawn {
for "_i" from 1 to 5 do {
private _gate = "Land_BarGate_F" createVehicle (player modelToWorld [0, 10, 0]);
};
hint str [
nearestObject [_this, "Land_BarGate_F"],
nearestObjects [_this, ["Land_BarGate_F"], 200],
nearestObjects [_this, ["Land_BarGate_F"], 200] param [0, objNull]
];
};
``` into the console ^ and check wiki @late gull ๐
@meager heart i want to use it inside a trigger
the problem it's the trigger position return an arr[2] and nearestX spect arr[3]
You sure about that? https://community.bistudio.com/wiki/nearestObject
also this in triggers fields probably undefined, you need thisTrigger or position of that trigger or thisList select 0 < that will be player ๐ค
Hello!
Is tehre any way to know when a player double clicks the radio inventory slot?
this is the control ((findDisplay 602) displayCtrl 6214)
class SlotRadio: SlotPrimary
{
idc=6214;
x="41 * (0.03) + (-0.25)";
y="10.5 * (0.04) + (-0.25)";
w="2 * (0.03)";
h="2 * (0.04)";
colorText[]={0,0,0,0.5};
colorBackground[]={0,0,0,0};
};
onMouseButtonDblClick = "systemChat str ['onMouseButtonDblClick', _this]; false";
```maybe
Nope
((findDisplay 602) displayCtrl 6214) ctrladdEventHandler ["MouseButtonDblClick", "hint str _this"];
Doesnt work
Hello
Hey!
How can I spawn a rocket ont he ground
hpos = getPosATL heli1;
_rocket = "rockets_230mm_GAT" createVehicle _hpos;
Just for explosion effect
"HelicopterExploSmall" createVehicle getPos heli1;
Wow thank you god
MouseButtonDblClick eh works with buttons controls types and maybe with active pictures @minor lance
https://community.bistudio.com/wiki/Code_Optimisation for global knowledge
Nice
Worse on perf though
private["var1","var2","var3"];
_var1 = 1;
_var2 = 2;
_var3 = 3;
// is slower than
private _var1 = 1;
private _var2 = 2;
private _var3 = 3;
@hasty violet
see https://community.bistudio.com/wiki/Code_Optimisation#private
Yes
If you're not assigning a variable to them in your code, then your code is probably not that good.
Is Arma's garbage collector just fine when it comes to throwing out variables when the scope is left? There is no garbage collectors @hasty violet
Click the 3 dots next to the message. on the right side
It's a dev mode feature iirc
private "string" and private [array] are commands
private _var is a compile-time keyword
it is evaluated at compiletime. And has 0 runtime impact
And as the others have 0 runtime impact.. The keyword is infinitely faster.
anyone have idea idea what could be causing my RscCombo to do https://gyazo.com/09512d77c6485410da8dba5931458549 not had this issue before
are the variables even required outside of the loop?
no they aren't. only _names and _data
For example this https://github.com/Raptoer/F3/blob/88c8d72b3744f4698bff29f6c7f8cb24c9f7e4ef/f/nametag/functions/fn_nametagGetData.sqf#L57 it doesn't need to exist outside of the loop
what?
I don't know what you are trying to say with these things
You mean no performance difference between only declaring them inside the loop instead of outside?
assuming you are using the variable. second one is faster to access the variable
When you try to access a variable. It always has to walk up the scopes until it finds it
in your second example it's already in the current scope. It doesn't even have to walk anywhere.
In your first example it always has to walk upwards atleast one scope to find it
Same happens when you set a variable. It walks up all scopes until it finds it already defined. Or if it reaches the last scope and didn't find it, then it defines it in the current scope
it creates a new group
do that group gets deleted after it becomes empty again?
I thiiink.... DeleteIfEmpty is now enabled by default
never tried though
you can easily test that tho. Just check if allGroups get's smaller
non-null group yes
non-null name no
CAManBase uhhhh...
Think so yeah..
Team?
can't be
because the wiki page says assignedTeam has "MAIN" as default
And it returns a string
a string cannot be null
yeah
no
unless _x is nil
also what you wrote there. Can be expressed as just
_name = [name _x] param [0, ""]
maybe even without the []
ye
Hello, back again with a quick question. Is this possible with the method's I've used?```sqf
[] spawn
{
_veh = [ // 36 while loops
plane1,plane2,plane3,plane4,c130_ussFreedom,
air1,air2,air3,air4,air5,air6,
car1,car2,car3,car4,car5,car6,car7,car8,car9,car10,car11,car12,car13,car14,car15,
truck1,truck2,truck3,truck4,truck5,truck6
];
{
_vehName = "true" configClasses (configfile >> "CfgVehicles" >> "_x" >> "displayName");
_mark = "_x";
_alive = "ColorBlue";
_destroyed = "ColorBlack";
while {TRUE} do
{
sleep 1;
_mark setMarkerPos position _x;
if (alive _x) then
{
_mark setMarkerColor _alive;
_mark setMarkerText "_vehName";
};
if (!alive _x) then
{
_mark setMarkerColor _destroyed;
_mark setMarkerText "_vehName" + ": Destroyed";
};
};
} forEach _veh;
};```Taken from: https://forums.bohemia.net/forums/topic/201842-how-to-set-markers-on-vehicles-best-practicemethod/
I'm trying NOT to write the same thing 36 times. I have enough hassle with creating the variables in each vehicle AND marker, 72 things to do. I don't want to make it anymore time consuming than needed.
" Is this possible with the method's I've used?" what is this?
};
if (!alive _x) then
{
what you wrote there is just a very complicated else
Also that will stop at the first vehicle
because the while never ends
Okay.
^ updated script to actually not throw any errors.
In regards to the while loop, is there another way I could achieve the forEach / if statements?
@still forum How about this? ```sqf
//[] spawn
//{
_veh = [
plane1,plane2,plane3,plane4,c130_ussFreedom,
air1,air2,air3,air4,air5,air6,
car1,car2,car3,car4,car5,car6,car7,car8,car9,car10,car11,car12,car13,car14,car15,
truck1,truck2,truck3,truck4,truck5,truck6
];
{
_vehName = "true" configClasses (configfile >> "CfgVehicles" >> "_x" >> "displayName");
_mark = "_x";
_alive = "ColorBlue";
_destroyed = "ColorBlack";
/*
while {TRUE} do
{
sleep 1;
_mark setMarkerPos position _x;
if (alive _x) then
{
_mark setMarkerColor _alive;
_mark setMarkerText "_vehName";
};
if (!alive _x) then
{
_mark setMarkerColor _destroyed;
_mark setMarkerText "_vehName" + ": Destroyed";
};
*/
_mark setMarkerPos getPos _x;
_x addEventHandler ["respawn", {
_mark setMarkerColor _alive;
_mark setMarkerText "_vehName";
}];
_x addEventHandler ["killed", {
_mark setMarkerColor _destroyed;
_mark setMarkerText "_vehName" + ": Destroyed";
}];
//};
} forEach _veh;
//};```
I have a resupply script for the mission I'm working on where the players can call in resupply but I don't want them to be able to do it over and over again. What's the best way to limit the script so once they call it they have to wait 24 game hours?
@leaden summit https://community.bistudio.com/wiki/time
How are you calling the resupply?
At this stage it's a script running from an ACE interaction on a laptop. It's spawns a chopper with supplies
ACE. Would you be able to provide the wiki for that?
Is it a script you made, using ACE interaction?
Yeah well I added the ace interaction to a laptop and that in turn calls a script
Could you provide the script pls
Yeah sure it's an absolute disaster script that I've used for multiple missions
if (!isServer) exitWith {};
// pull class names from arguments passed through execVM
//slingloading helo
_heli_class = _this select 0;
// marker positions
_spawn = _this select 1;
_spawn = getMarkerPos _spawn;
_destination = _this select 2;
_destination = getMarkerPos _destination;
_despawn = _this select 3;
_despawn = getMarkerPos _despawn;
// spawn invisble helipad object for heli to target
_helipad_obj = "Land_HelipadEmpty_F" createVehicle _destination;
_heli_spawn = [_spawn, 0, _heli_class, West] call BIS_fnc_spawnVehicle;
_heli = _heli_spawn select 0;
// safeguard it
_heli allowDamage false;
_heli setcaptive true;
// get heli's crew and assign waypoints
_heli_grp = group (driver _heli);
_heli disableAI "AUTOCOMBAT";
_heli_grp setFormation "WEDGE";
_heli_grp setBehaviour "SAFE";
_heli_grp setSpeedMode "NORMAL";
// delete all of heli crews' waypoints
while {(count (wayPoints (_heli_grp) )) > 0} do {
deleteWaypoint ((wayPoints (_heli_grp)) select 0);
sleep 0.5;
};
_mvWP = _heli_grp addWaypoint [_spawn,1];
_mvWP setWaypointType "HOOK";
sleep 5;
// tell heli to move to and attempt to land at the destination
_mvWP = _heli_grp addWaypoint [_destination,2];
_mvWP setWaypointType "UNHOOK";
// tell heli to move to and attempt to land at the destination
_mvWP = _heli_grp addWaypoint [_despawn,3];
_mvWP setWaypointType "MOVE";
Place this at the end.```sqf
supplyTimeCalled = time;
supplyTimeTimer = supplyTimeCalled + 86400;
if (supplyTimeTimer isEqualTo time) then {
startSupplyLoop = true;
} else {
startSupplyLoop = false;
};```
The supplies are spawn separately at the supplymarker and the chopper picks them up slingloads them to the drop off point and them flys away and despawns
OK sweet thanks. I was thinking about just adding a variable which stored the time the last drop was called and them check against that but I wasn't sure if that was the most efficient way
Thanks
Updated: https://pastebin.com/z0xR0q3C
Added the while {startSupplyLoop OR firstSupply} do { and ```sqf
// Timer
supplyTimeCalled = time;
supplyTimeTimer = supplyTimeCalled + 86400;
firstSupply = false;```
Do you understand that. Let me know if it works ๐ @leaden summit
Yeah sweet, thanks ๐
86400 is 24 hours in game.
if you want real time then do serverTime from: supplyTimeTimer isEqualTo time to supplyTimeTimer isEqualTo serverTime
Ok cool, thanks again
np
๐ค
@drowsy axle isEqualTo must hit on the precise millisecond of serverTime, it's not a good idea - at the very least round it @leaden summit
I would use >=
It's all good I'm just using >
:+1: purrfect then ๐ฑ
@drowsy axle "_x" doesnโt do what you think it does. You probably want typeOf _x
@tough abyss I found that out myself ๐ Thanks though
Sorry Capwell.. Don't have time to explain EVERYTHING to you again for the dozenth time now.
Just read the wiki please. The bullshit you are trying to do in some places just doesn't make sense and the wiki tells you that
Im using get3DENAttribute to grab an markers Variable name
private _markerName = (_x get3DENAttribute "name");
_x being the object.
However it returns Null.
The text of the marker works fully fine.
private _markerText = (_x get3DENAttribute "text");
Somebody had this issue before?
Are you sure the variable identification is just under "name" ?
https://community.bistudio.com/wiki/get3DENAttribute
https://community.bistudio.com/wiki/Eden_Editor:_Setting_Attributes#Attributes Maybe case sensitive? Name instead of name?
I have some script that deals with editor markers - when I reference the name of a layer I used 'name' and used 'Name' for markers
maybe there was a similar casing reason for that (it was a long time ago)
_x is nothing in that code
You have to post the whole code @mellow obsidian
_x undefined in your example
Tried both Dedmen, both returning Null
private _entities = get3DENLayerEntities _layer;
{
private _className = (_x get3DENAttribute "itemClass") select 0;
private _position = (_x get3DENAttribute "position") select 0;
private _rotation = (_x get3DENAttribute "rotation");
private _markerName = (_x get3DENAttribute "name");
private _markerText = (_x get3DENAttribute "text");
_array pushBack [_className, _position,_rotation,_markerName,_markerText];
} forEach _entities;
Returns everything in a good manner except "name". Name or name doesn't seems to want to work
Ok
So that means text also works
can you confirm the markers are correctly showing in _array?
Like text from markers is there?
I've never used it with markers, but if the text works, then the 'name' attribute is probably just wrong on the wiki
what does _x return anway?
This is what it returns
[
["Empty",[5826.91,11569.5,83.04],[231.68],[<null>],["test"]],
["mil_end",[5829.02,11566.7,83.04],[91.3723],[<null>],[""]],
["flag_Hungary",[5832.05,11570.3,83.04],[0],[<null>],["2222"]]
]
Hmm
this is how markers are in missionsqm
As an alternative
You can add mission sqm in your description and then config browse it
class MissionSQM {
#include "mission.sqm"
};
The actual attribute is configfile >> "Cfg3DEN" >> "Marker" >> "AttributeCategories" >> "Init" >> "Attributes" >> "Name"
Ill try again with Name instead of name, ill show code an array in a second
private _entities = get3DENLayerEntities _layer;
{
private _className = (_x get3DENAttribute "itemClass") select 0;
private _position = (_x get3DENAttribute "position") select 0;
private _rotation = (_x get3DENAttribute "rotation");
private _markerName = (_x get3DENAttribute "Name");
private _markerText = (_x get3DENAttribute "text");
_array pushBack [_className, _position,_rotation,_markerName,_markerText];
} forEach _entities;
Array:
[
["Empty",[5826.91,11569.5,83.04],[231.68],[<null>],["test"]],
["mil_end",[5829.02,11566.7,83.04],[91.3723],[<null>],[""]],
["flag_Hungary",[5832.05,11570.3,83.04],[0],[<null>],["2222"]]
]
_x itself is the markername, @mellow obsidian
Was looking there yesterday but im pretty sure it stated "name" then ๐ค Am I going crazy?
Wacky, in my script I go out of my way to set 'Name' so I can read it back later (I'm creating marker entities from script), so maybe that's why it works for me
I do execute this, being in vehicle:
(moveOut player; unassignVehicle player; player action ['eject', (vehicle player)])
First time script gives me exception Error Missing ), on second execution just performs it.
What? Anyone?
Well kinda yes:
(player setDamage 0; systemChat "healed!";)
Or not ๐
Yeah that was a reason, but behavior is still strange. Why it does it well on second time then?
if the task was just kick players out moveOut player is enough
I don't remember for now why, but I know there are some situation where moveOut is not sufficent
probably unconscious units...
yeah, ill get used to it.
is there a way to set a variable to not change anymore?
test = getplayerUID player;
this one will change if the player dies
It will?
You could just not redefine it? Define it only once and itโll never change
It should not change unless you do test = ... somewhere else after player dies
Never seen the page of PreProcessor Commands
so if i do now this:
#define test (getplayerUID player);
it won't change?
Or maybe you have condition and instead of if (test == "" you wrote if (test = ""
Nah no condition i just try to store a value
Drop #define
Okay i will try it intresting sometimes things could be simple... if you find them ^^
hm i don't think this kind of command works with commands in arma 3 since it prints the out.
What I had meant was to assign a value to a variable (i.e, Serga_PlayerID = getPlayerUID player;) once, and from then on never change it
@ruby breach this is what i try
if a unit dies the getplayeruid changes to "" even if it is not looped
at least i think it is not
Has anyone here worked on the Antistasi map? Jets dlc messed up one of the missions.
I think its a path error
@gray thistle no it won't change
Variables don't magically change
and you didn't understand how preprocessor stuff works then
getplayeruid well yes...
but if you store it in a variable before that it won't
getPlayerUID is a command. Not a variable
And if you give it invalid arguments it will return ""
sure @still forum
InitPlayerServer.sqf
[_player] call ser_perhand_player;
ser_perhand_player = Playerpersistance.sqf
private ["_player", "_playerUID", "_playercheck"];
params ["_player"];
_playerUID = (getPlayerUID _player);
_playerside = (str side _player);
_player addEventhandler ["Killed", {
[_playerUID, false, _playerside] call ser_fn_updateplayerlifestate;
}];
ser_fn_updateplayerlifestate = fn_updateplayerlifestate.sqf
private ["_playerUID", "_alive", "_lifestate", "_playerside"];
params ["_playerUID", "_lifestate", "_playerside"];
_mapname = worldname;
_alive = if (_livestate) then {1} else {0};
_side_to_update = switch (_playerside) do {
case "WEST": {"updatelifestateWEST"};
case "EAST": {"updatelifestateEAST"};
case "GUER": {"updatelifestateAAF"};
case "CIV": {"updatelifestateCIV"};
};
"extDB3" callextension format ["0:%1:%2:%3:%4:%5", "dcfdb", _side_to_update, _alive, _mapname, _playerUID];
[20:49:23:937463 +02:00] [Thread 14404] extDB3: SQL_CUSTOM: Error No Custom Call Not Found: Input String any:any:Tanoa:any
private ["_playerUID", "_alive", "_lifestate", "_playerside"]; wtf is that?
for one params already makes them private so most of these are useless.
second use the private keyword
[_playerUID, false, _playerside] call ser_fn_updateplayerlifestate; your two variables are both undefined
why that? they shouldn't be
local variables carry over into lower scopes
not into entirely different script instances
uhm question i have arguments defined to carry over into the fn_updateplayerlifestate.sqf why would it not work?
English please?
what third part?
local variables only carry over to lower scopes
Or maybe easier to understand. Scripts that are executed right there and then
the eventhandler is not executed there
You add code that might execute some time in the future. But at that point your local variables are loooong gone
(str side _player); why do you turn that into a string and then compare the string?
why not compare the side directly?
limitations in the database
there was a reason for that or i was not that far with the logic... but okay this is how i do that right now will probalbly change that then.
back to the arguments:
[_playerUID, false, _playerside] call ser_fn_updateplayerlifestate;
i still don't know why they would not carry over like that
so the eventhandler itself is a diffrent script?
even though the arguments are in the same files?
Does your script freeze till the eventhandler executes?
no.
Files don't matter at all
Scripts can be distributed over hundreds of files and they can all see the variables
Or in just a single file and not see it
That's what i call a mindblow...
logical thinking :u
i thought till now it would carry over like in IFs
but yes it makes sense also i compared eventhandlers to spawns...
but in spawns i can give over the values because they are executed at the point...
shit i have to do a lot of rethinking
i did that once with this
{
//_x addEventhandler ["Fired",{diag_log "ToT"}];//
//_x addEventhandler ["Deleted",{hint "Gelรถscht"}];//
[_x] call ser_fn_insertmine;
hint format ["Gesetzt %1", _x];
[_x] spawn {params ["_mine"]; waituntil {sleep 1; not alive _mine};systemchat "DEAD";
}foreach _updated_mines;};
[_x] spawn {params ["_mine"];
They don't carry over
you are passing a copy of them into the spawn
which then takes it and passes it through as _this variable
wouldn't arguments then be useless in these cases? this is what i don't get :/
This is what happens if you work complete alone on a Project without a clue of anything but you try to get things right for other peoples to have fun...
I don't even understand you right now at least i know now that it does not work as i thought it would.... Frustrates me right now...
Can you make the wind in ArmA 3 more than 110 somehow?
110? km/h?
Yeah.
Ahh, that worked, I was looking at things that had similar command name but only had a value between 0 and 1.
anyway thanks @still forum for the information i may have to rethink a lot now
We had fun with the wind once: https://www.youtube.com/watch?v=aMUHGkHvSOk
One of our weather mods was bugged and steadily increased wind... Snipers weren't happy
Sending infinite numbers into weather commands used to produce interesting results in both OA and A3 back then. Discovered it after skipTime'ing infinite number due to bug, world turned black and white, some other command resulted in sky blinking black and white each frame.
Before numbers were split up into numbers and nans
Good thing cheaters didn't know of this, nuking server like this could've killed an epileptic or something
has scipting gone to far?
I like it
Now that NaN and Inf are special... What is the highest possible non NaN number we can plug into that ๐ค
Good thing cheaters didn't know of this, nuking server like this could've killed an epileptic or something - Damn... that's some nasty shit.
Is it possible to have a vehicle shown as true/false with alive. Or does that only apply to units?
It works with vehicles
Oh right. @ruby breach Thanks
I keep getting this: https://gyazo.com/74e27f5c4f534bc7c8d854def446139a Could someone help a bro out? Seems to have messed up. Ran in init.sqf with nothing else in the file.
[] spawn {
_veh = [
plane1,plane2,plane3,plane4,c130_ussFreedom,
air1,air2,air3,air4,air5,air6,air7,air8,air9,
car1,car2,car3,car4,car5,car6,car7,car8,car9,car10,car11,car12,car13,car14,car15,
truck1,truck2,truck3,truck4,truck5,truck6
];
{
_vehType = typeof _x;
_vehName = getText (configfile >> "CfgVehicles" >> _vehType >> "displayName");
_vehPos = getPos _x;
_mark = str _x;
_alive = "ColorWEST";
_destroyed = "ColorBlack";
while {true} do {
_mark setMarkerPos position _x;
_VehDam = getDammage _x;
sleep 1;
if (_VehDam isEqualTo 0) then
{
_mark setMarkerColor _alive;
_mark setMarkerText _vehName;
} else {
_mark setMarkerColor _destroyed;
_mark setMarkerText _vehName + ": Destroyed";
};
};
} forEach _veh;
};```
shouldn't your forEach be inside the while, instead of the other way around
[] spawn {
_veh = [
plane1,plane2,plane3,plane4,c130_ussFreedom,
air1,air2,air3,air4,air5,air6,air7,air8,air9,
car1,car2,car3,car4,car5,car6,car7,car8,car9,car10,car11,car12,car13,car14,car15,
truck1,truck2,truck3,truck4,truck5,truck6
];
while {true} do {
{
_vehType = typeof _x;
_vehName = getText (configfile >> "CfgVehicles" >> _vehType >> "displayName");
_vehPos = getPos _x;
_mark = str _x;
_alive = "ColorWEST";
_destroyed = "ColorBlack";
_mark setMarkerPos position _x;
_VehDam = getDammage _x;
if (_VehDam isEqualTo 0) then
{
_mark setMarkerColor _alive;
_mark setMarkerText _vehName;
} else {
_mark setMarkerColor _destroyed;
_mark setMarkerText _vehName + ": Destroyed";
};
} forEach _veh;
sleep 1;
};
};
something like that
@ionic orchid Slight problem... the _mark setMarkerPos position _x; doesn't follow the vehicle once moving..
Hi.i have a vehicle Locking script that allows a player to claim 3 vehicles, using for "_i" from 0 to 4 do { _ctrl = _display displayCtrl (2100+_i); _index = lbCurSel _ctrl; if(_index == -1) then { _code pushBack -1; } else { _code pushBack parseNumber(_ctrl lbText _index); }; }; well but where is this saved to and how to reset? Seems persistent over restarts
@drowsy axle
However to answer yours.use a loop with a sleep.
@hasty violet I can't see it
@sturdy cape Only some displays reset when switching games\missions, I guess you're using some global display to store your stuff
is there a way to see the JIP remoteExec queue? I guess if you go wild on JIP it can severely slow down if not completely void the JIP process, or?
@round scroll depends on what you need JIP for and how you implement it. You donโt need to make every little thing persistent with own JIP message, you can probably combine most local changes to execute all together from 1 JIP message.
@tough abyss agreed, it's not my mission, I've been asked to look after it as the JIP is not working and the player gets booted back to main menu. I've checked some function and saw that remoteExec with JIP flag is all over the place. The exportJIPMessages function seems like a good first way to get a feel for the situation.
@meager granite thanks.ive decided to set a persistant variable on those vehicles instead.
@sturdy cape Not sure if you noticed but for _i from 0 to 4 will run 5 times not 3
Doesnt matter anyways now.but.thank you
Does the amount of scripts running in a server impacts the FPS ?
Yes it certainly can do depending on how they run
can't test right now but do you guys think a locally spawned (createVehicleLocal) bullet object would do damage to a remote unit?
@open vigil ^
@polar folio yes
Hit simulation is done locally
and you client just tells the other "hey I've just hit you for this much damage"
well that's great news. thx for the info!
the other client doesn't even have to know what hit him
i figured as much since it works like that in many games afaik at least.
@polar folio No, from my understanding damage isn't done locally in many games.
correct. In most games it isn't
one of Arma's flaws
@tough abyss where did you get that fact from?
You tested the EH?
or you tested creating a local projectile and giving someone a headshot with it?
No the local object
The server belives anything you tell him. If you tell the server you've just given someone a headshot, the server will believe you. Even if it never saw a projectile or you shooting
Yes you can create projectiles with createVehicleLocal
that's exactly what ACE frag is doing.
And it works
Frag or bullet? Explosions are global
Have they got class names?
Then they are not bullets
What?
Bullets are also CfgAmmo classes
You mean bullets are not bullets?
They are subclasses of 65x39 bullets
Ah yeah my bad they are
bullets coming out of grenades reminds me of 762 high calibre
Frags are simulated differently afaik
Yes I take it back, script created local bullet does kill remote unit
Doesnโt even have to be in the same frame as original bullet
does anyone have a script for invade and annex?
@sturdy cape I am using a sleep within the while loop
@tropic orbit Here ๐ https://forums.bohemia.net/forums/topic/212240-apex-framework/
thanks dude
and how would i install this ?
@tender fossil
nvm ill follow the steps
Hey, I have a question:
I have an array of weapons. Now I want to have an Array of all Attachments or all magazins of each of these weapons.
Is that somehow possible?
(Basically I want an ACE Arsenal with a selection of weapons and all compatible magazines and attachments)
@tropic orbit According to BI Wiki: no
https://community.bistudio.com/wiki/setSkill
You mean the ones that fit ?
Yes
Do you know how to link a chat, in discord.?