#arma3_scripting
1 messages ยท Page 478 of 1
You're probably restarting your mission all the time to test. You can put your code into some *.sqf file and then edit the code while the mission is running for a lot quicker testing. Especially if you do lots of trial and error.
๐คท
I knew this was going to be a headache, i underestimated how much lol.
show me that code again
I was like "pfft, how hard could it be to make something appear in a trigger, Ive worked on whole games."
lol
_loopCount = 0;
while {_random_pos_in_trigger isEqualTo [] && _loopCount < 100} do {
_random_pos_in_trigger = trigger_spawn call BIS_fnc_randomPosTrigger;
_random_pos_in_trigger = _random_pos_in_trigger findEmptyPosition [0, 0, "vehicleType"];
_loopCount = _loopCount +1; //Prevents infinite executions with severe hit on performance if no position can be found
};
_nul = [_random_pos_in_trigger, 10, true] call anomaly_fnc_createFog;```
i borrowed the random location finder from here
https://forums.bohemia.net/forums/topic/209350-random-pos-in-trigger-area/
diag_log format ["Debug info: %1", _random_pos_in_trigger]; --------> "Debug info: [<null>,<null>,-2]" ??????
aye.
๐ค
๐ค
Let me tinker in the editor for a minute
nods.
while you do that im gonna look into what it takes to setup a .sqf file outside of game
literally nothing. just save your mission in the editor, go to like C:\Users\Zombie\Documents\Arma 3\missions or C:\Users\Zombie\Documents\Arma 3\mpmissions and toss the *.sqf in the missionfolder.
and then you can call, execVM etc it to your hearts content
yea. im looking up the formatting for a .sqf file now.
๐
just think of it as the same as your init field.
I've placed a test_trigger in editor.
_random_pos_in_trigger = test_trigger call BIS_fnc_randomPosTrigger;
diag_log format ["_random_pos_in_trigger: %1", _random_pos_in_trigger]; // "_random_pos_in_trigger: [2829.82,1472.43,0]"
seems to work fine
Without a trigger:
_random_pos_in_trigger = test_trigger call BIS_fnc_randomPosTrigger;
diag_log format ["_random_pos_in_trigger: %1", _random_pos_in_trigger]; // "_random_pos_in_trigger: any"
Conclusion: Your trigger is missing or has a different name ?
oh wow
having it as a script makes much better debugging
it actually tells me what line
_random_pos_in_trigger = thistrigger call BIS_fnc_randomPosTrigge>
22:44:29 Error position: <thistrigger call BIS_fnc_randomPosTrigge>
22:44:29 Error Undefined variable in expression: thistrigger
22:44:29 File C:\Users\roypr\Documents\Arma 3 - Other Profiles\Zombie\mpmissions\ChernarusRedux_Ravage_Stalker_Escape.chernarusredux\script.sqf, line 4
22:44:29 Error in expression <_trigger = [];
_loopCount = 0;
while {_random_pos_in_trigger isEqualTo [] && _>
22:44:29 Error position: <_random_pos_in_trigger isEqualTo [] && _>
22:44:29 Error Undefined variable in expression: _random_pos_in_trigger
22:44:29 File C:\Users\roypr\Documents\Arma 3 - Other Profiles\Zombie\mpmissions\ChernarusRedux_Ravage_Stalker_Escape.chernarusredux\script.sqf, line 3
22:44:29 "Debug info: array"
22:44:29 Error in expression <loopCount = _loopCount +1;
};
_nul = [_random_pos_in_trigger, 10, true] call a>
22:44:29 Error position: <_random_pos_in_trigger, 10, true] call a>
22:44:29 Error Undefined variable in expression: _random_pos_in_trigger
22:44:29 File C:\Users\roypr\Documents\Arma 3 - Other Profiles\Zombie\mpmissions\ChernarusRedux_Ravage_Stalker_Escape.chernarusredux\script.sqf, line 8```
For a piece of code to redress units, which iterates over newly spawned AI, would it be worh the performance difference to manually feed the magazine type into the weapon array instead of retrieving it dynamically via:
{
_mags = getArray(configfile >> "cfgWeapons" >> (_weapon) >> "magazines");
{
_unit addMagazines [_x, 10];
} forEach [_mags select 0];
}
```?
You should also get an editor that has syntax highlighting, a linter, autocomplete for sqf and BIS_fnc's and preferably mikero's tools as well ๐ people seem to mostly pick visual studio code, i like my sublime 3 with some adapted sublime 2 packages from the sublime 2 poseidon package. Makes it SO MUCH easier.
ive got notepad++ i just need to download .sqf extension
I'm partial to Atom IO, but sublime has hands down the industry leading speed.
I haven't found anything that has all the features of my sublime yet.
Conclusion: Your trigger is missing or has a different name ?
@waxen tide but its the trigger the call is in. I plan to use this type of trigger a lot. How should I call the trigger that the script is executed in?
im in a .sqf file now btw
hmmm
inside the trigger you can reference it with magic var this .. outside? just give it a variable name in eden (there is a field all the way on the top) and use that.
hrm... but i plan to use this script to spawn a lot of different stuff with different triggers.
@unreal siren I would measure it: https://community.bistudio.com/wiki/BIS_fnc_codePerformance Or wait until Awoooo wakes up and gets bored, he'll optimise it to death and your script will run so fast it goes backwards.
basically the anomaly are like traps that will be all over the map. I just dont want to know where they are.
so im trying to use triggers to spawn them in an area, but i dont know where.
Simply spawn the triggers randomly and give them iterative names. you can do like a for loop and use the loop's internal _i variable inside the trigger name.
for "_i" from 100 to 0 step -1 do {
format ["trigger_%1", _i] // trigger_1, trigger_2 ...
};
LOL, sweet.
hrm...
only problem i see with that is there will probably be hundreds of them. I didnt want them to spawn unless the player goes that way. Think of like an escape mission with zombies and traps. I didnt want it to spawn the traps unless the player actually gets near it.
is it a single player mission ?
๐ค i think i would get the position of each player, then generate some random positions around each player, and put triggers for the anomalies there. obviously you need to update that at some reasonable interval. you could do like _old_pos distance2D _new_pos to check if the player moved far enough to justify re-calculation of the positions.
oh thats interesting.
Idk about trigger performance, I think if they become too large it can become quite bad. Also they evaluate 3d coordinates and they're evaluated onEachFrame afaik. Depending on the precision you want you could do some lazy evaluation every second or so and just manually check distance2D or something.
I've always considered triggers to be something you use in eden if you don't want to touch scripts.
I didn't mean it judgemental, but obviously BI tried to make it easy to do elaborate missions in eden even if you have little to no scripting experience.
yea.
if you're already slapping dozens of code lines into init fields, why bother with placing stuff in eden you can just script to appear randomly where you want it.
@unreal siren I didn't see anyone answer your question.. the difference is marginal, and you get the added benefit of easier-to-maintain code if you grab dynamically from config
oh there he is
Even stuff like this: https://i.imgur.com/ppFC16k.jpg - https://i.imgur.com/z8kjYGY.jpg (grabbed from config) is blazing fast.
Result:
0.0023 ms
Cycles:
10000/10000
Code:
getArray(configfile >> 'cfgWeapons' >> (_weapon) >> 'hgun_Rook40_F' >> 'magazines')```
Wow
That's fast, lol
You'll have to profile the difference between those commands, but I imagine they're similar in speed
Depends on exactly how they do weighted selection
Gotcha. The mission I'm working with, replaced some of their spawn/call compiles with execVM, before, restarts would be seamless for the player; IE loading right into intro, now there's a 2-4s delay on "debug island" (preinit location) before it switches to intro, so while optimizing I'm doing my best to worry about little things.
lol @waxen tide i did something kinda funny.
i did
_nul = [_random_pos_in_trigger, 10, true] call anomaly_fnc_createFog;```
Inside the trigger.
instead of doing one fog, i think it did fog spawns in every position.
lol
fog clouds everywhere
oh wait. no
i think its working as intended
oh btw: https://community.bistudio.com/wiki/createVehicleLocal + https://community.bistudio.com/wiki/Arma_3_CfgVehicles_EMPTY makes for some nice 3d position debugging.
@unreal siren honestly the number one thing I would look at / learn is scheduled vs unscheduled. Unscheduled is very fast and scheduled is slow. If there is a lot of "init" work that needs to be done before the intro, I would do that work in unscheduled assuming it's behind the loading screen anyway.
Result:
0.0006 ms
Cycles:
10000/10000
Code:
dingdong
``` JEeeSsuuSSS
Oh wait, I've made a mistake
You can get some solid performance increases if scheduled execution is used when it's not needed
Ah, hence why they did that then?
var call compile final preprocess , replaced with execVM
Don't know why they would, especially if it interferes with the intro
No way to know I guess unless they say
Maybe they interpreted the faster loading of the mission as better performance, without considering how it affected the transition of loading screen --> intro
Outside of memory allocation (Which would be negligible at best?) I don't know either. Considering init code is ran once. I might revert if so
Appreciate the help! Here's the performance difference, assuming I did it right:
Result:
0.0023 ms
Cycles:
10000/10000
Code:
getArray(configfile >> 'cfgWeapons' >> (_weapon) >> 'hgun_Rook40_F' >> 'magazines')
second method:
Result:
0.0015 ms
Cycles:
10000/10000
Code:
_weapon = ['hgun_Rook40_F', 'dingdong'];_magazine = _weapon select 1; _magazine```
Well unless you store the contents of the file/function in a variable, there's no memory difference
Actually, I'm dumb should've seen this
Call waits for the init script to complete, execVM sends it to its own scheduler "thread"
So you might be seeing issues with that, assuming this is happening inside init.sqf
Yes, if you are currently in scheduled scope, call will wait for the executed function to finish. ExecVM will start the script but then continue to execute in "parallel"
Ah, my bad. It was Spawn
"Tweaked: All spawn compileFinal preprocessFileLineNumbers replaced with execVM."
Ok, that makes sense. That change holds the same function, just making it easier to read
ExecVM will essentially compile the script then spawn it on its own
What do you make of the above benches? 0.0010ms difference worth it? ๐
Definitely not, and I'm a performance hardass :)
What's a good hardline or indicator on "do this or face the consequences of a bad time"?
generally speaking
Since it varies
IE, a delayed intro isn't game breaking, but a niggle.
Basic things to keep in mind.
-how often does it run
-how intensive is the work done in the function as a whole
-what's the tradeoff between performance vs readability
Generally, you can just plug away until you see performance degrade
You'll get better intuition over time regarding when to trade readability and maintainability for performance
When in doubt, profile your options and judge your results. I've thrown thousands of things in the debug console for a quick test
And yes I realize I sidestepped your question ๐
lol, appreciate it.
Once wrote a script that crawls road objects with roadsConnectedTo and calls itself with new start points at each intersection. After a few seconds i had 100+ scripts running in parallel and after 10 minutes i wondered if it would ever complete. ๐ณ
Ruh roh
Wooooah
I accidentally ran codePerformance on the old BIS function ๐
If anyone is curious, 0.0024 ms for selectRandom VS 0.0078ms for the old function.
In my case, selectRandomWeighted was 0.0036
Wonder if the old function has been updated to use the command or not
Would think it would be much slower if not
@waxen tide With a little playing with it, i think ive finally gotten it to do what i want the way I want. Thank you so much for your help.
you are a good dude for being so patient with me
Eh i've gotten so much help here, glad if i can actually help someone at times when no more-experienced people are here anyways.
Well, here's some funny maths
0.0024x1,100 (1,100 dudes spawned and this segment ran on) = an additional 2.64ms
0.0036x1,100 (1,100 dudes spawned and this segment ran on) = an additional 3.96ms
50% slower
However, considering it will be doing maybe 30 units at a time, that's fair.
I've done far worse to 150 units at once ๐ค
is that just the difference between grabbing from config and using a defined array?
regardless, like you said, you're often not dealing with 1100 units ๐
Are you trying to say that grabbing from config is slower?
Because that's probably why ace overheating uses cached config https://github.com/acemod/ACE3/blob/master/addons/overheating/functions/fnc_getWeaponData.sqf
well in that case they do more work than simply grabbing a config value
but yes grabbing from config is slower
Well, the array vs config file was 0.0015 vs 0.0023ms
Wait
Are you saying I could make use of the cached config from ACE for my mission? @peak plover
you could if its that important to you
just save the config value to a variable
then check if that variable exists before checking config
So maybe generate the cache at mission start?
I doubt you need the same config, so make your own version of this
I would just do it inside the file
check if a var is nil, if so then grab the value from config and set the value equal to it. If the value exists already, just use that value
OooOh
Neat
The file gets called multiple times though, since it's in a loop.
The loop file does a pushback on AI if they don't have the var "yeahbroyouvealreadybeenredressed" essentially
Then calls it
are you running cba
you could just use the cba init event for units so you don't need an overarching loop
I am, yes
@cerulean crane Wish it was like lua or something that ive worked with before.
Like this https://github.com/intercept/intercept-lua/blob/master/addons/armalib/dedmenlib.lua ? ๐
@waxen tide Or wait until Awoooo wakes up and gets bored no time for bored today. RHS update means busy :D
and they're evaluated onEachFrame afaik
Triggers are executed every 0.5 seconds. Their condition code is unscheduled.
@snow pecan You can get some solid performance increases if scheduled execution is used when it's not needed depends on which "performance" you mean. Scheduled get's you more FPS. But slower scripts.
@unreal siren var call compile final preprocess , replaced with execVM The Final from compileFinal was just idiotic dumb nonsense.
And if you remove that spawn compile preprocessFileLineNumbers is literally equal to execVM.
And both are dumb too for things that are executed more than once. You should use CfgFunctions.
Also your benchmarks are basically irrelevant if you run scheduled code anyway.
If you run unscheduled code you have to pay more attention to benchmarks but with scheduled it's not that important.
I was talking perceived execution speed
run one script in scheduled and other in unscheduled, one finished noticeably faster
useful tool if something is needlessly running scheduled
which is a lot of the time in many missions
I've done quite a bit of scripting for missions, and i've never really done anything elaborate in unscheduled. I literally do everything scheduled. Most stuff in mission scripts simply does not have to be realtime.
yeah it all depends on what you need
my point was that missions often contain inexperienced code (which is typically full of stuff running in scheduled)
and if you want something to run quicker
often times the easiest solution is to look and see if you can switch to unscheduled
sure
especially big mission frameworks that were worked on for years.
People always proudly say "I worked on this for 6 years"
Yeah.. Awesome.. That means most of your script is now horribly outdated and probably shit. Good job.
๐
Eh well, there are people who constantly rework almost everything and produce high quality code (speaking missions) and sometimes a project is passed on, refactored completely and overhauled. sometimes even twice in a row. But yeah, for sure, lots of really scary missions out there script wise.
fetches a really big stick and pokes @still forum
Write a blog article about arma debugging and profiling ๐
In the past I wanted to contribute to some missions but I was either faced with ignorance and "Why does that even matter??" or so much work that a rewrite would be the better approach. Which is what the KP liberation team is now doing ^^
I fixed a minor thing in "Antistasi" a few weeks ago and jesus that thing is a mess. 1000 lines of random shit in the initplayerlocal including like 200 lines of intro camera stuff ๐ท
Yeah, I think I have not seen any mission yet where code was well structured and documented.
Quiksilver's Invade is quite awesome.
But most missions are so small that objectively thinking there is no incentive to spend a lot of time on optimization.
And documentation.
I will take a look at it. :D the more I know the less chance that we will have to rewrite the liberation rewrite ๐
its not good if you havent rewritten at least 3 times ๐
Permanent refactoring FTW.
I would argue that Dorbedo structured his Kerberos very well, i'm sure he has cut down on a lot of work for himself by automating things and even writing external tools for that, but due to lack of documentation i haven't yet met anyone who looked at his stuff and found it easy to work with.
@waxen tide Quiksilver's Invade is quite awesome.
Uh... Quiksilver? He left this discord because so many people used him as example of bad code
๐
When i got into A3 mission editing, the first stuff i looked at was his old I&A. That's excessively well documented to a point where even a noob will quickly find his way around. Haven't looked at his latest apex edition code, but it plays nicely for sure.
See ^
Because of things like that he left discord
Now if i looked at it again i would probably immediately be reminded of all the code performance stuff i was told here and find flaws.
So maybe horrible code, but well structured and documented ๐
But now i'm curious...
https://github.com/Brig13Team/Operation_Kerberos
saw that too, I dont see the plugin anywhere though
so who knows how indepth it's being used if at all
Question to anyone who has tested it, is there any performance difference between createVehicle using string "none" over "can_collide"?
"CAN_COLLIDE" creates the vehicle exactly where asked, not checking if others objects can cross its 3D model
Which I assume would cause the engine to do less checks than "none"
Correct. Engine does a "FindFreePosition" search if the placement type != CanCollide
Here's the result of a simple test
NONE
Time: 0.0120239
CAN_COLLIDE
Time: 0.00299072```
Keep in mind that'll vary a bit depending on the position
you can start working on arma 4 cherno cti framework, nigel ๐
Uh... Quiksilver? He left this discord because so many people used him as example of bad code
i mean maybe that was a bit excessive though
Honestly there's not that many mods that have really good code all around. Some of it looks "good" because muh macros and shit
But I'd say most big mods out there you can find shit that is just silly, really because its older code or you are fighting against vanilla or whatever
Like when i look at ace medical i'm not like SUCH WOW MUCH GREAT CODE tbh
Probably the main thing that annoys me is when its just 200 functions thrown in a folder, instead of something at least organized per feature (modular is nice too obviously, but even just splitting it up in some logical areas is good)
Few people I know would not categorize 8-nested-conditionals as objectively bad code (unless auto generated and even then...). But rather than point people towards "bad code", maybe point them towards good code / recommended practices instead.
Few people I know would not categorize 8-nested-conditionals as objectively bad code you are living in the arma world
ever tried to do some else if chain?
Yeah. Never needed it to be deep though
And for readability you can easily wrap it in a call and do exitWith instead.
@austere granite size != length ๐
just got reminded that i should continue working on my modding stuff ...
but rly cannot be bothered to do currently
@meager heart copy that
Will do
'gon start with cti today
Let's see how long it takes me
take your time...
lol
this reminds me
The creator of the linter for GLUA is really passive aggressive
"Are you egyption? What's up with all these f**king scope pyramids"
๐
Is there any less garbage way to do this? ```sqf
player spawn {
while {
true
}
do {
waitUntil {
sleep 3;
alive _this
}
;
_this setVariable ["defcamo", _this getUnitTrait "camouflageCoef", true];
while {
alive _this
}
do {
if (stance _this=="PRONE") then {
_surfaceType=(surfaceType getPosATL _this) select [1];
_grassCover=getNumber(configfile >> "CfgSurfaces" >> _surfaceType >> "grassCover");
_newCamo=1 max 500 * _grassCover;
_this setUnitTrait ["camouflageCoef", _newCamo];
}
else {
_this setUnitTrait ["camouflageCoef", _this getVariable "defcamo"];
}
;
sleep 1;
}
;
}
;
}
;``` AI are spotting people through dense foliage on a cloudy rainstorm night. :/
Oh dear god
Let me try to reformat that
yes please
Is this not how everyone formats their code? ๐
M.A.X.I.M.U.M P.E.R.F.O.R.M.A.N.C.E! N.O.L.I.N.E!
player spawn {
while { true } do {
waitUntil { sleep 3; alive _this };
_this setVariable ["defcamo", _this getUnitTrait "camouflageCoef", true];
while { alive _this } do {
if (stance _this=="PRONE") then {
_surfaceType=(surfaceType getPosATL _this) select [1];
_grassCover=getNumber(configfile >> "CfgSurfaces" >> _surfaceType >> "grassCover");
_newCamo=1 max 500 * _grassCover;
_this setUnitTrait ["camouflageCoef", _newCamo];
} else {
_this setUnitTrait ["camouflageCoef", _this getVariable "defcamo"];
};
sleep 1;
};
};
};```
Ran that through a prettyprinter for CS because I'm lazy
Does a prettyprinter actually exist for SQF?
If there's one for VS Code, please let me know
I used to be a huge Sublime fan, then tried Atom for a bit, then started using VS Code and I haven't looked back haha
Yeah each have their pros and cons really
i always feel like those lack a lot of features i use on day-to-day base ...
stuff like ALT+Drag for block selection
CTRL+D for quick line duplication
i am fairly sure those are possible in there too ... but already that those are hidden behind weirdo combinations or "feature sets" ...
What do you use @queen cargo
Question about your code @unreal siren, do you intend for the camouflageCoef to go over 1? So far i have no idea what this returns getNumber(configfile >> "CfgSurfaces" >> _surfaceType >> "grassCover")
visual studio mostly currently
for everything else notepad++ @scenic pollen
Fair
I'm honestly not sure, diwako.
yeah all i am missing from code is alt+block select really
@unreal siren camouflageCoef is default 1 unless the unit is a sniper in the configs. the lower the number the less they can be seen. Well, or rather the more effective their camo.
so putting anything above 1 will make them more and more a lirghtbulb. I had a mission once in which we were sneaking around at night, but the mission maker set camouflageCoef to 30 as they thought it makes sneaking easier, but nope every ai saw us from miles away and it became a "RUN AWAY" simulator while being chased down by ai like light by moths
Oh neat!
XD lol
it has no code formatting. But I recommend it.
It supports CfgFunctions library ^^.
But has some problems with config parsing sadly.
Yeah that is really helpful actually.
https://gyazo.com/4a2e62428c862c1ebe8ef395a62656f7 < Current state of my Atom IO setup
eg.
class SomeClass
{
someVal[] = {1, [1,2,3]}; // does not support nested arrays with []
}
will break parsing of config files and this fill break CfgFunctions parsing.
"addons/fpsFix" please share xD
Please can we also have a "addons/useAllCores"
lol
[...] also should not be valid in config at all
So I'm currently working on a script which spawns local objects. The objects have been "cached" with another script which saves their position, type, vectorDir and vectorUp,if it has simulation enabled, if it can receive damage and if it has a custom texture, the custom texture.
But when I create the objects with this code
params ["_objectInformation"];
if (isNil "BuildingsToDestroy") then {
BuildingsToDestroy = [];
};
{
_pos = _x select 0;
_type = _x select 1;
_dirAndUp = _x select 2;
_simulation = _x select 3;
_allowDamage = _x select 4;
_textures = _x select 5;
_obj = _type createVehicleLocal _pos;
_obj enableSimulation _simulation;
_obj allowDamage _allowDamage;
_obj setVectorDirAndUp _dirAndUp;
_obj setPosATL _pos;
if (!(isNil "_textures")) then
{
{
_obj setObjectTexture [_forEachIndex,_x];
}forEach _textures
};
BuildingsToDestroy pushBack _x;
sleep 0.01;
} forEach _objectInformation;
all objects which are not placed 100% vertical are moved a by a few meters.
Here is an example: http://prntscr.com/ki321q
Is there a way to spawn the objects correctly?
@queen cargo val[] = [1,2,3] is not valid but val[] = {1, 2, [3,4]} and val[] = {1, 2, {3,4}} are both valid.
@vagrant sedge Maybe something to do with 'can collide'?
"CAN_COLLIDE"
Afaik the engine looks to place the vehicle in a spot it deems 'safe', which may not necessarily be exactly where you tell it
But with "CAN_COLLIDE" it skips this check
@vagrant sedge Use get/setPosWorld
Still working on redoing parts of this redress code, can somebody explain what the first check does? ```sqf
if (_x=="this") then
{
_mags = getArray(configfile >> "cfgWeapons" >> (_weapon) >> "magazines");
{
_unit addMagazines [_x, 8];
} forEach [_mags select 0];
}
else
{
{
_unit addMagazines [_x, 8];
} forEach [_mags select 0];
};
} forEach _muzzles;```
this inside muzzles means the weapon itself
Oh, weird
muzzles don't need to contain the weapon itself. But many do
that would be a different muzzle then
Hi Guys, I need help with a bullet cam script, I want to simulate the missile real cam sensor, but I cannot find how to put the camera position in front of the missile, this is the script Im using
this addEventHandler ["Fired", {
_null = _this spawn {
_missile = _this select 6;
_cam = "camera" camCreate (position player);
_cam cameraEffect ["External", "Back"];
waitUntil {
if (isNull _missile) exitWith {true};
_cam camSetTarget _missile;
_cam camSetRelPos [0,-3,0];
_cam camCommit 0;
};
sleep 0.4;
_cam cameraEffect ["Terminate", "Back"];
camDestroy _cam;
};
}];
I gotta do the same for sidearms; this isn't a function. Should I run the whole block under another for each?
@tough abyss Thank you. Worked perfectly.
@vagrant sedge Exactly why it was added
When I set the _cam camSetRelPos [0,-3,0]; to a positive value like [0,10,0]; the camera rotates to look the missile from the front to the back and I want to put int he fron looking to the front like a POV
Unexpected
Shouldn't this be using cases?
if ((count _SLunits) > 0) then
{
{
removeHeadgear _x;
_x addHeadgear _slheadgear;
_x addMagazines ["SmokeShell", 1];
_x addItemToBackpack "FirstAidKit";
_x addMagazines ["APERSBoundingMine_Range_Mag", 1];
} foreach _SLunits;
};
if ((count _SNunits) > 0) then
{
{
removeUniform _x;
_x forceaddUniform _snghillie;
_x assignItem "NVGoggles_OPFOR";
_x addItemToBackpack "FirstAidKit";
_x addMagazines ["APERSBoundingMine_Range_Mag", 1];
} foreach _SNunits;
};```
There's probably seven of these, one for each "special" unit type.
Hey guys i am in need of your help. I wrote a script to do building interior compositions to populate a few buildings with stuff to not have empty buildings. My script is currently targeting petrol stations. I had it running on the map Malden for quite some time without any problems and than i started hosting a mission on Chernarus. On chernarus there are no buildings of the class i wanted to populate so i am loading some building on the map trough scripting. What is happening is the objects that i place are sitting on random places when the players load up. Sometimes they look perfect other times the objects are displaced but the displacement seem to be the same every time it fails.
Any ideas how to what is causing the displacement and why if the server is placing these objects the coordinates are thrown off sometimes for everything that is referencing the host object.
The setting for the objects is [Server side : Simple objects for the interior objects, Normal objects for the buildings and interactive objects]
for those of you going crazy: https://i.redd.it/gwjc82ylluf11.jpg
14:53:20 Inventory item with given name: [Headgear_H_MilCap_ghex_F] not found
WHAT
Locality for addMagazines causing this?
is there a way to get the positions of weapons attached to a vehicle: I'm trying to draw UI in screen space at the position of a weapon pylon in world space?
selectionnames doesn't contain the actual names of the pylons in a way that's parsable without heavy processing of the strings
maybe you can pull stuff from the configs
Wouldn't it be cheaper to simply unassign the item and let the commands silently fail if the unit doesn't have NV, than to use an if statement?
sqf _nvgs = hmd _x; if !(_nvgs isEqualTo "") then { _x unassignItem _nvgs; _x removeItem _nvgs; };
_x unassignItem "NVGoggles_OPFOR";
_x unassignItem "NVGoggles";
_x unassignItem "NVGoggles_INDEP";```
btw _x unassignItem _nvgs; _x removeItem _nvgs;->unlinkItem
Solved, after a bit of playing. Active Solution Configuration was 'Debug' and should be 'Release' in order to work.
Hello. I am editing a few scripts and trying to change positions however I am issues with this one script. Can somebody confirm to me what I am looking for (X / Y / Z) within these variables? Thank you. _posApts = [[0.0732422,8.21582],[0.723145,2.35547],[0.729004,-2.39551],[1.8501,-8.38477],[1.23389,8.32764],[1.61963,2.26953],[1.50342,-2.50537],[1.67139,-8.31201]]; _posAptsATL = [0.231,0.231,0.231,0.231,3.00974,3.00974,3.00974,3.00974];
is there some magical reason why i can't preview a mission in singleplayer? I'm pressing the button in eden... and nothing happens
No RPT, no nothing whatsoever, it's after i added some macros from an include in description.ext and it just doesnt like working anymore
MP preview is still good
oh now when i am reloading the mission in eden it says 3:18:14 Wrong color format in RPT
I have 0 related to colors, nor any UI configs in my mission though
Hey guys a question I want to make it so when players are detected or they shoot the box spawned will delte itself. is there a way to do this? player addAction ["<t color='#009BFF'>Stealthbox</t>", {_box = "Land_PaperBox_closed_F" createVehicle position player; _box enableSimulation false; _box attachTo [player, [0, 0, 0.6]]; player setUnitTrait["camouflageCoef", 0.01]; player playAction "PlayerCrouch";}]; sleep 300;
@unreal siren Inventory item with given name: [Headgear_H_MilCap_ghex_F] not found it's a weapon. You can't add a weapon with addMagazine
@lament grotto or they shoot the box Hit Eventhandler on the box.
@edgy halo https://community.bistudio.com/wiki/Extensions#Visual_C.2B.2B_3
notice the outputSize-1
Why the F is it called num in there?? @queen cargo ? It was called output,outputSize,function since the page was created and btw is also how it's called in engine. Why was that changed?
It even still has the old names on the C# one but all the C ones were changed
Well.. Fixed now.
afaik there is fov and distance
distanceZoomMax/Min and opticsZoomMin/Max/...iirc init ?
found it
It's under itemInfo
optics modes
private _maxZoom = call {
private _items = primaryWeaponItems player;
private _maxZoom = 1;
{
private _item = _x;
private _modes = ('true' configClasses (configFile >> 'CfgWeapons' >> _item >> 'ItemInfo' >> 'OpticsModes'));
{
private _zoom = getNumber(_x >> "opticsZoomInit");
if (_zoom < _maxZoom && _zoom != 0) then {_maxZoom = _zoom};
} count _modes;
false
} count _items;
_maxZoom;
};
Result:
0.0491 ms
Cycles:
10000/10000
Code:
call zoom_fnc_eachFrame
How fast should eachFrame scrips be/
as fast as possible ยฏ_(ใ)_/ยฏ
I'd say that thing is fast enough. But can probably be faster
And I can see you are running a Intel CPU. AMD users won't be that fast
You are like google, knowing stuff about me without me telling you
Hmm, yeah
I guess I'll have to cache the config into a namespace
Dedmen knows how every instruction runs on the various CPU architectures, from your benchmark he can tell you make and model and your current clockspeed! Just accept it ๐
I guess I'll have to cache the config into a namespace Yeah that would be one of my recommendations for the code you posted above.
But I don't know what zoom_fnc_eachframe does. Because just looking up a value and throwing it away each frame wouldn't make much sense
You don't have to cache the whole config. Just cache the current zoom and attachments. You don't need to make new config lookups if the attachments didn't change since last time.
Browsing config on every frame is bad
zoom_fnc_readCache = {
params ['_name','_code'];
private _value = mission_zoom_cache getVariable _name;
if (!isNil '_value') exitWith {_value};
_value = call _code;
mission_zoom_cache setVariable [_name,_value];
_value
};
I wonder what's best look up for such cache, STRING in ARRAY or OBJECT getVariable STRING?
location getvariable
Don't think there is much difference between different getVariable
in ARRAY will probably be very slow with big arrays
Gonna test this now
Yes. Both things are true
in ARRAY get's slower the further back your search value is. It is O(N).
getVariable is a hashtable. So roughly O(1) access time.
In addition in ARRAY is case-sensitive whereas getVariable isn't
_obj = "UserTexture1m_F" createVehicle getPos player;
_arr = [];
_to = 1000000;
for "_i" from 1 to _to do {
_obj setVariable [str _i, _i];
_arr pushBack str _i;
};
_search = str _to;
[
"STRING in ARRAY", diag_codePerformance [{_search in _arr}],
"OBJECT getVariable STRING", diag_codePerformance [{_obj getVariable _search}]
]
["STRING in ARRAY",[0.00037,100000],"OBJECT getVariable STRING",[0.00036,100000]]
๐ค
Tried with very long strings instead of str _i, same result, I was expecting in ARRAY to perform worse
is there a way to detect the reload state of a vehicle gunner?
or do you have to use firedEH, monitoring magazine change, etc yourself with timestamps
in ARRAY should also be much slower.. It isn't magic. I don't know what's wrong with your code ๐
I had that issue with find in CBA "hash"es.
It just get's incredibly slow if you have many elements.
Are you sure that local variables carry over into the code of diag_codePerformance?
How is the speed of diag_codePerformance [{_obj}] @meager granite ?
The 0.0037 might very well be the "variable is nil. I'll just skip this then"
oh, good point
My own profiling commands accept local variables because they don't open up a new VM. But I think the BI ones do
Yeah I was confused that something isn't right too
With that in ARRAY vs isKindOf comparison I did week ago where in ARRAY turned out to be many times worse
just try the same with global variables
Just did: ["STRING in ARRAY",[0.171262,5839],"OBJECT getVariable STRING",[0.00066,100000]]
Both code pieces execute the commands now and as expected in ARRAY is nowhere close to getVariable STRING
Got too used to old BIS_fnc_codePerformance which ran in same thread and made this mistake
@velvet merlin Have you tried "Reloaded" EH?
@tough abyss not yet, but was referring to that implicitly as its the same principle
@velvet merlin You will need to add this EH to vehicle to monitor reload of a vehicle gunner though
yes. was just hoping to see a more simple variant
Hey guys back with the box script player addAction ["<t color='#009BFF'>Stealthbox</t>", {_box = "Land_PaperBox_closed_F" createVehicle position player; _box enableSimulation false; _box attachTo [player, [0, 0, 0.6]]; player setUnitTrait["camouflageCoef", 0.01]; player action ["SWITCHWEAPON",player,player,-1]; sleep 3; player playAction "PlayerCrouch"; sleep 40; player setUnitTrait["camouflageCoef", 1]; deleteVehicle _box; }]; I have this working but I am having trouble with my event Handler deleting the box. My init line is [player] execVM "scripts\mgsbox.sqf"; player addEventHandler ["Hit", {null = [] execVM "scripts\mgsend.sqf";}]; and the mgsend script is deleteVehicle _box; player setUnitTrait["camouflageCoef", 1];
add the eventhandler to the box
not to the player
adding the Hit eventhandler to the player will tell you when the player is hit.
will that still work if the box has disabled sim? or should I remove the disablesimulation?
need to remove it I think
I changed it, when the ai shoot the box, but the trigger doesnt fire
also the eventhandler for _box goes in the init? even though the box isnt spawned in at the start?
That doesn't make sense as you can see yourself
you cannot add a eventhandler to something that doesn't exist
add it in your script that spawns the box
okay will give it a try
still doesnt work, box gets hit and then nothing. ```script looks like this now
player addAction ["<t color='#009BFF'>Stealthbox</t>", {_box = "Land_PaperBox_closed_F" createVehicle position player;
_box attachTo [player, [0, 0, 0.6]];
player setUnitTrait["camouflageCoef", 0.01];
player action ["SWITCHWEAPON",player,player,-1];
_box addEventHandler ["Hit", {null = [] execVM "scripts\mgsend.sqf";}];
sleep 3;
player playAction "PlayerCrouch";
sleep 40;
player setUnitTrait["camouflageCoef", 1];
deleteVehicle _box;
}];
sleep 300```
can you try without the attachTo?
Also why are you doing null = [] execVM instead of just execVM?
I need the attachTo as I want it so the player can hide in the box, I do null as thats the way I first learned to do it. Sorry I am still new to most of this scripting
think metal gear
Yes I know that you need it.. I guess else you wouldn't have it there.
But I'm still asking you to try without as it could be that it's breaking the Hit eventhandler which means we need to find a different way
Does the box have collision? If bullets go straight through and don't hit it then you can't detect a hit.
it does I can hear the rounds hitting it
and see
not trying to sound grumpy or anything I really do appreciate the help
The _box is undefined inside your script, you could get the instance with attachedObjects player
Ohhh.. ๐คฆ duh. Didn't see that at all
could you explain that a bit more for me? sorry its getting late here and my brains all bio ed rn
A eventhandler is a new script.
Local variables don't carry over to new scripts
Also execVM additionally creates a new script
Which means that your _box variable that you try to deleteVehicle _box is undefined
I would just add {detach _x} forEach attachedObjects (_this select 0); to your player Hit EH and be done with it.
he wants to delete. Not just detach
Detach makes more sense, anyway as I said I would just do it like this
no harm in trying it ๐
Hit eventhandler already get's the object. So do this
_box addEventHandler ["Hit", {_this execVM "scripts\mgsend.sqf";}];
And then inside mgsend.sqf
deleteVehicle (_this select 0);
player setUnitTrait["camouflageCoef", 1];
Actually I would add some upwards velocity to the box as well upon hit for fun ๐
The box might not have hitpoint to trigger Hit EH
if that does prove the case is there another eventhandler I could use?
Attach EH to player nothing is wrong with that, bullet will penetrate paper box anyway
so if I move the EH to a player, (i have swapped the box to a pennable one) how would I write the eh to delte the box
inside mgsend
{deleteVehicle _x} forEach attachedObjects player; will delete all objects attached to the player. If you know you'll have more objects attached than the paperbox that would get a little more complicated. Just a little though.
works a treat thanks @dedmen and @tough abyss
lockDriver maybe?
How
hello, anyone have altis life mpmission with: Goverment, tax, laws ect? if anyone please pm me
Anyone know how to rotate an object around a certain point on the object vs the center of an object. setVectorDirAndUp seems to only use the center and I was wondering if i can change that to a certain point
No one stop command, but its basically a bit of struggling with vectors: rotate it normally, check the vector between the rotated point and the original position of the point, move he object by that vector.
ah so im going to have to ditch that command and do it manually
Is there an event handler which can be called when I restart my mission through editor? Mission event handler 'Ended' seems to be not firing.
@tough abyss you could probably try addTorque in combination with setCenterOfMass
sadly not a physx object
Im sure this topic is common among other 3D graphics topics, like rotation matrices, etc @tough abyss
Ok I think I know how to do it... in SQF there are cool commands like modelToWorld and worldToModel.
- Find the pivot point in model coordinates.
- Store the pivot coordinates in world coordinates somewhere.
- Rotate your object around its origin as usual.
- Convert the pivot point from model coordinates to world coordinates again. Calculate the offset by which the pivot coordinates have changed in world coordinates. Substract the offset from object's position. ๐ค
I've never messed with these matrix transforms really, sorry if I'm wrong.
Ye I figured out the maths. Itโs a matter of finishing it now
How did I miss addTorque and addForce ๐ค
5 years later, we finally have some PhysX manipulation commands ๐
uu those are pretty new right
Still no way to disable physx state on bodies though, the most basic of basics
yeah, 1.72
Ohh these are new
Hello guys. Is there any tutorial for 3DEN dialog creation?
I used to have some fun with torque in OA: https://www.youtube.com/watch?v=lgUqaJ4HJIg
Finally a proper scripting command
new? that was more than one year ago... used it to test out planes with 3d vectoring nozzles (for a custom flight model that's now shelfed)
These AGL, ASL, ATL, etc position systems give me a laugh every time, but now i've found one more: there is modelToWorld but then there is also modelToWorldWorld ๐
I'm not lying https://community.bistudio.com/wiki/modelToWorldWorld
๐
Don't forget modelToWorldVisualWorld
Yeah naming is severely dammaged
You'll get used to it after a couple years
Letโs not forget camConstuctionSetParams
surely in Enfusion we'll have actual data types where AGL and ASL are different ones
try and put in AGL into an ASL command and computer says no
i wouldn't actually mind that
๐๐ป
i highly doubt that there would be two positions @austere granite
both most likely will get something like vector3
in fact: one could check right now ๐ค
Has any one figured out a way to order the new cruise missile launcher to launch only 1 rocket at a lased target on its own? I've got it to fire, but it fires several missiles
Never mind, found an answer further up the chat history, Discord chat search is surprisingly good!
when an object is killed, are the local variables it has destroyed ? Or should i delete them manually?
I assume when obj is deleted, local variables are deleted with it from memory?
no, depends, yes
I hope in enfusion we do everything in world pos. And there will be functions to get the water/terrain/ground height at a certain position. Just like it is in engine right now ๐
@austere hawk variables are refcounted. Reference count goes to 0. Variable goes away
I wonder what would be best way to change turret's owner as there is no setTurretOwner
Having an issue where all my client-side logic fails if you manual fire remote turret which renders all scripted controls over projectiles useless.
Whats a good average of server CPS to have with 1 player?
CPS?
You mean FPS?
With only 1 player and nothing else it should run at the full 50 fps
Thanks dedmen, we're having a issue where it is indeed 48 / 47 with 1 player. But as soon as more join it goes down to a horrible 12
sounds like rogue scripts and locality issues ๐
You can use #perf_prof_branch profiling binary to profile what's going wrong
That's not trivial though
@inner swallow We thought that as well but we checked almost every running script both serverside as clientside
Almost every? Including all BI scripts that you don't even know are running?
You can speculate for eternity now and try to guess around what could be wrong. Or you could actually check what's actually wrong using profiling build.
It can't be scheduled scripts. So it has to be something unscheduled going on
I've never used the profiling build but ill look into it. Thanks. Hope i can find the issue with it
run profiling build on server and your client. Execute diag_captureFrame on the server. It should then dump to some text file on the server.
Then you can run the command on the client to open the dialog and copy-paste the text from the file on the server into the dialog
Doesnt seem to be the issue since we had another server with 75 people run totally fine
using the same configs and box
A custom made one
No ai, not alot of objects.
another performance troubleshooting related question: using diag_fps and diag_fpsmin I get the average of the past few frames. When I want to process these numbers further, what's the current state of the art approach to send the fps numbers further, to an external script? diag_log and parse the log? Or use some copy/paste buffer? Or one of the db approaches? Background is to create a tool for map development that checks where low fps are to be found on the map.
thanks
I'd just dump FPS, playerid, position to a database.
Problem is how to get the "slow script causing slowdown" and "many players around you causing slowdown" stuff out of there
Also general reduction of FPS the longer the mission goes. If everyones FPS gradually reduces and many people start from the same base on the terrain and go in the same general direction. It would look like further away has the lower fps.
And FPS in general are also not useful, has to always be compared to the average because some people just have slower PC's that only run 20 fps. Whereas some others run 90fps constantly
Does anyone know if it's possible to compile a Linux .so (DLL equivalent) from C#?
Tried googling but didn't get any concrete results
no, C# libraries are always a .dll
even with mono on Linux
most C#/.NET applications built on Windows would run on Linux
excluding using Windows only UI stuff
so you'll still be running the .exe and .dll binaries ๐
.exe and .dll on Linux? Hmm that doesn't sound right
hi, please help someone. cuttext ["<t size='10'><img image='titles.jpg' />", "PLAIN",-2, false, true]; I need show the picture little bit more down on screen. Im not able to put bold in there. And i dont want to use Plain down to have it down. How to use bold in this?
sorry got it - cuttext["<br /><<br /><br /><br /><br /><br/><br/><t size='10'><img image='titles.jpg' />", "PLAIN",-2, false, true];
forgot it can handle html
you can do it with ctrlCreate "RscStructuredText" and less br br's ๐
oh thank you ๐
Anyone happen to have some hacky way of establishing how big a location is?
I know in terrain making you actually give them a size, but cant find the command to return a location ๐
Hey guys! making a small mission for some friends tonight, but need help with one thing.
The players are to find a downed pilot who is to wounded to walk so they have to carry him.
Basicly I would like the pilot (AI unit) to be in the wounded animation and then give the players the action to Carry him, eventully load him into a vehicle aswell.)
Any good links or ready scripts are most welcome. Thank you guys!
@austere granite This probably isn't what you want, but you can use worldSize to get the size of the entire map
it turns out it's just size one of those consistent named commands ๐
Oh nice, didn't know that was a thing. Good to know ๐
And yeah I wish they'd deprecate some commands and replace them with more consistent names. In this case locationSize (like worldSize) instead of size. But I guess it's not really worth the effort, especially with Arma 4 being in the works
If we ever get some sort of object oriented language in Arma 4, I'd be very happy ๐
added as linked command here too: https://community.bistudio.com/wiki/locationPosition
If we ever get some sort of object oriented language in Arma 4, I'd be very happy we do. But don't be happy yet. Even if it's object oriented it can still be crap
size also rectangular for locations (too late...) ๐
sqfO
@austere granite Yeah I suppose
@still forum Yeah I was thinking that after I typed it haha. Ok, object oriented, fast, consistently named built-in functions, and a consistent syntax
๐
Optional typing would be cool, but perhaps a turn-off for newbies
Isn't object oriented slower in most cases?
Depends on how fast the runtime environment is. It is slower in theory, but can still be faster than current SQF runtime if implemented properly. Although tbf I don't know how well optimised the sqf runtime is, but I'm guessing not as much as it could be
If it's a compiled language (like Java) then it's pretty much guaranteed to be 1000s of times faster than sqf
We already have Java in Take On Helicopters, and was rumoured to be in Arma 3, but it never happened
https://community.bistudio.com/wiki/Java_Scripting
From the BI CEO in 2011:
"Arma 3 is going to build upon this technology, so if you can, Take On Java now and help us to shape it up"
https://forums.bohemia.net/forums/topic/122486-take-on-java/?do=findComment&comment=2032445
I wonder what happened
priority switched to modelling railgun tanks and halo gunships ๐
SQF runtime is shit.
Enscript is better. But neither have any kind of "optimizer" besides that community made one for SQF.
Also SQF is also a compiled language. But compiled to a intermediary. Same as Enscript
the Enscript interpreter is much better tho. And it's instructions are more low level
Here is a new look at enscript and the new IDE
https://data.bistudio.com/dayz/img/jules_modding_00_workbench_01_f.jpg
Oh wow, I didn't realise it was already available. DayZ I'm assuming?
it's not already available. They only showed screenshots
line 129: ... date.Get(1), date.Get(2), date.Get(3) ...
select has found a new home ๐
Line 133 and 135 look confusing though. Apparently the variables are passed by reference and output is written into them.. Why??
Why doesn't CastTo return the thing it casted to?
And why doesn't MatrixIdentity4 return the identity matrix?
Same on line 114/116... Why??
Hmmm
No, really, TIntArray data = new TIntArray and then data.Get(1), i mean, they have invented square brackets for arrays in last century ๐ค
They are keeping the Arma like consistency alive I see
Oh lol. Didn't even think of square brackets
Look at line 150
square brackets are there
yeah
Wait line 133, is that an upcast? Those need to be explicit? nvm.
Also.. Builtin debugging. You can see it on the left side
Ok that is very nice (the debugging)
You are very nice
โบ
They have object oriented code now.
But still do stuff like g_Game.ConfigGetFloatArray.
They are pushing everything into the game class instead of just making a config class.
And they are using g_Game everywhere which I read as "Global Game class singleton" but then in line 132 they call GetGame() instead of using g_Game.
Also look at how the config paths are built. They are space delimited. wtf?
Haven't seen any trace of one yet
๐ฟ
Looks like this could be another inconsistent mess
Atleast they keep their traditions ยฏ_(ใ)_/ยฏ
They are keeping the inconsistencies consistent โ
Code still looks like a mess
Probably just because whoever wrote the code wasn't that gifted
And to part because of these shit consistent inconsistencies
Also that SwapYZ, oh boy how much headache it will cause
Is it possible to assign a different name to a player instead of his profile name, just for a single mission? I need it for role-playing.
anyone here has scripted a goverment system with president and taxes for altis life?
i was thinking how to start it, should i create licenses due to sql licence section? or should i make new tables?
if it is lowlevel enough, one can create a highlevel-enough language to fix the problems introduced by the actual script language
Error position, missing ] and what not with
params["_unit", "_container", "_item"];
if (_item isKindOf ["Bag_Base", configFile >> "CfgVehicles"]) then {
hint "You really don't want this backpack";};
};
];```
Can't point out why. Could someone else?
also i will gladly implement sqf-to-enscript "compiler" once we get our hands on enscript
@forest ore behind the semicolon of the hint
};};]; is too much?
one of the }; is extra
player addEventHandler ["Take", {
params ["_unit", "_container", "_item"];
if (_item isKindOf ["Bag_Base", configFile >> "CfgVehicles"]) then {
hint "You really don't want this backpack";
};
}];```
there you go mate
you da real MVP
nah
it is sqf-vm which did the thing for me โค
[ERR][5|C5] Expected ']'.```
though ... there is a ^ missing below the ; for some weird reason ..
Yep, thanks Dedmen, SuicideKing and X39. Extra semicolon there. How could I have known that *sigh'
Canโt have semicolon inside array
by checking how sqf works actually ๐
the ; is a "end-statement" thing
not end codeblock
but it is ok
such mistakes happen to the bests
^^
thinking now ... what about emulating SQF inside of enscript instead of writing some "port" thingy ๐ค that could get funny
i mean ... probably slow AF
bbbuuuuuuttt .. funny
The extra semicolon wasn't even the problem
you can have as many semicolons as you like
Ah lol. Didn't even see the error. I thought he had a }; too much behind the hint. Because of that horribly wrong indentation
A indentation a day keeps the errors away
that is why sqf-vm now can pretty print files @still forum ๐คท
Also wouldn't enscript be available alongside sqf? They have so many sqf scripted systems, I doubt they would rewrite all of them for Arma 4
they already do @meager granite
PS D:\Git\SQF-VM\Release\x64> .\sqfvm-cpp.exe --pretty-print file.sqf
player addEventHandler ["Take", {
params ["_unit", "_container", "_item"];
if (_item isKindOf ["Bag_Base", configFile >> "CfgVehicles"]) then {
hint "You really don't want this backpack";
};
}];
``` sqf-vm is love guys
What happens in there? ๐๐ป ๐
they scrapped all of SQF for dayZ
Did they also scrap SQF support or just port all their own sqf to enscript?
Would someone happen to know why "Put" eventhandler doesn't fire when I tell my subordinate AI to drop its backpack with the command "Drop some backpack"
buut the EH fires when I open the AI's inventory and right-click to drop items from its inventory
@austere granite they didn't say. They said they want to drop all SQF
iirc when asked "will there be a way to auto-port SQF to enscript", the answer was "no"
i wasn't talking about that ๐
but good luck with that, they seem to say that it's impossible because the two are so different ๐คท๐ฝ
@austere granite for DayZ they say they ported the code manually
pff ... there might be some major incopatibilities for stuff
but in the end sqf also is just some code
I'd say very few people know FSM here. You might have to wait quite a while to get an answer
Those declared in start state should be available everywhere
one last question conserning the init oder
where does missinflow.fsm fit in?
it's not listed in the wiki
Donโt think it is part of global init
ok thank you m242, i think i will include it into cfgfunctions and call it postinit
Anyway to put vertical text in a control?
Is it possible to execute a function from a function library before the map screen automatically?
My issue is that postInit calls the function after the briefing screen init
and preInit before all the variables of 3den menues are setup
or is there a variable i can wait for to know that people are in the briefing screen?
Maybe getClientState ๐ค
before the map screen?!??!
BEFORE?
What do you mean
preInit
well
Map screen shows up after postinit because otherwise you wouldn't have a map (map is added as an item after object initializes)
>postInit calls the function after the briefing screen
no it does not
Were u using sleep?
How do I check if camera is player again?
cameraOn ?
talking fsm: a private variable only exists in the state it was declared?
just think about it as script with multiple local functions, except "start state" that will be like parent/main scope in normal script, that's it
To be more precise i need to call the function between EExpressions of Eden Editor entity attributes are called and before Functions with postInit attribute are called
nigel, check this > https://gyazo.com/635a3ecddaec0257ee1b8f7e09542933
so... maybe....
terminate ten_handle;ten_handle =[] spawn {
waitUntil {
sleep 1;
systemChat str cameraOn;
};
};
open ace arsenal
waitUntil waits for true, systemChat returns nothing, so what is that code supposed to do?
Ok
Hello! Is there any way that i can set a ppEffect to a camera that has been created by script and not the player camera?
Because setPiPEffect with 6 value doesnt work ๐ฆ
And also is Arma limited to have only 8 cameras created as max?
New question to the ones I posed the other day heres my script ```player addAction ["<t color='#009BFF'>Stealthbox</t>", {_box = "Land_PaperBox_01_small_stacked_F" createVehicle position player;
_box attachTo [player, [0, 0, 0.6]];
player setUnitTrait["camouflageCoef", 0.01];
player action ["SWITCHWEAPON",player,player,-1];
player addEventHandler ["Hit", {_this execVM "scripts\mgsend.sqf";}];
sleep 3;
player playAction "PlayerCrouch";
sleep 40;
player setUnitTrait["camouflageCoef", 1];
deleteVehicle _box;
}];``` I want to add a cooldown to using this action about 5 minutes how can I go about this?
my init file ```[player] execVM "scripts\mgsbox.sqf";
Player is already defined if executed locally, so no need to pass it to the script.
Also, it looks like you may have some stray brackets at the end
Scripts working fine if there are stray brackets. Player is defined as I plan on making this mp compatible
hm, oh wait. This is all part of the add action execution?
the first box is yeah
you don't need to pass player object reference to the script, period.
What's the question you are trying to pose though?
I want to make this on a cooldown after use
so players dont spam cardboard boxes on themselves constantly
Okay. Remove the action (add action returns action index id iirc), note the code and re add it after suspension.
Could make that a function and just call it after everything is done being used.
so at the top of the addction command I would do this? player removeAction 0; then at the end call the script to be added to a player with a sleep?
Sure I guess. You don't know if 0 will always be the action id. So it's best that you actually find that value and use it instead of 0
okay how would I go about finding or setting the action id?
I think its this code _actions = actionIDs player;
Number- The ID of the action is returned. Action can be removed withย removeAction(see alsoย removeAllActions. IDs are incrementing, the first given action to each unit has the ID 0, the second the ID 1, etc. IDs are also passed to the called script (seeย scriptparameter)
Return value of addAction
actionIDs returns an array.
private _actionID = player addAction ...
@meager heart I bet you cheated during math tests, giving straight answers.
ยฏ_(ใ)_/ยฏ

#orangecountychoppers ๐
:D
what was his name...
Dunno. It's been a little whike
๐
player removeAction (_this select 2); inside action code, then re-add it 5 min later
also ez way will be >
private _action = ["<t color='#009BFF'>Stealthbox</t>", { /* code */}];
player addAction _action;
I am sensing some MGS shit right here.
also x2 there is ^ hit eh with execVM maybe just use code in eh without it
guys, i'm trying to run intercept and i'm getting this
Recursos insuficientes en el sistema para completar el servicio solicitado
Insufficient resources in the system to complete the requested service
Battleye
that's to me?
yes
it's a known problem? documented somewhere?
Extensions need to be battleye whitelisted
that's not a "problem" that's just how it's supposed to be
and how you know it's BE? where in that logs say something about BE?
I just know that message is BE
it blocks loading of the library on kernel level and that throws that message
Arenโt BattlEye causing Extension cannot be loaded message? That other message could be win10 related as well
That above message is the own thrown in RPT
That is the reason for "extension cannot be loaded"
BE should also provide "normal" notification messages in the BE Log in the Arma Launcher
usually if you just want to try stuff out.. You just disable BE.
hmm, better
Extensions can be exploited client side, hence whitelisting, you donโt like it, switch off BattlEye
For Intercept addons you cannot debug anyway if you enable BE.
So you cannot really develop.
i wont make a public thing, just learn...
then disable BE.
Even more reason not to run BattlEye if youโre just experimenting
that's so dramatic
Actually getting a debugger connected to the game with BE running would get you a global ban...
So I wouldn't even try that.
This ^^
Can you elaborate on that Dedmen? Like what exactly would be such a debugger? Not a debug console extension for arma, i figure?
Better ?
I don't know how to explain it.. It's just a Debugger. That's literally what it's called.
https://en.wikipedia.org/wiki/Debugger
Is it against BI terms to use one?
to debug your own code? no.
battleye is way beyond enraging me.
not playing much on public servers, eh?
figures
maybe you mean both?
pay2win life servers and.. pay2win.. life....
Man.. That's unfair..
If you wanna send the RPT. please send the full RPT. You've sent all the useless unimportant stuff and omitted all of the important information.
Though all that "Attempt to override final function" sounds like something is very wrong. Seems like you are loading the vanilla PBO's twice or something...
And you are also somehow loading CBA twice.. wtf?
Create a logs folder in your Arma directory. Intercept will dump it's logs into there.
Launch your Arma to main menu. Then send me your full RPT and the latest of the intercept logs (should be the smallest file)
For some reason it tries to register all BIS and all CBA functions twice though.
[10:56:14]-{error}- Client plugin: Intercept Template Plugin was not found.
https://github.com/intercept/intercept-plugin-template/blob/master/addons/main/config.cpp#L19
Change this
I think the guide is missing the note that's supposed to tell you to look at that config file and change it as noted in the file
Yeah. But it says "Change this" for a reason
the plugin name on Line 19 needs to be the name of your plugin. So "template-plugin"
In the intercept logs. Far bottom
ok
It says right here https://github.com/intercept/intercept/wiki/Getting-Started#creating-the-visual-studio-2017-project
You can also use the Visual Studio file browser to navigate to addons/main/config.cpp. This is the config for your PBO that will take care of loading your Plugin. Modify the marked lines to your liking.
but the only real line to modify it's that 19 huh?
yes.
ok
I've updated the template. https://github.com/intercept/intercept-plugin-template/commit/451bd17f7b5d00eb1c191a43c393702b4c0184db
great, thx
It's always hard for the developers to find issues like this. Because we know exactly what you are supposed to do and how things work.
I didn't expect that people would just ignore Change this and leave it as default and expect it to work.
But it seems logical now ๐
xD
well things like that happen when i fail to make it work
so i say, let it be by default and try, then understand how it works and then i'm ready to modify
atleast this is the way how i learn xD
this is not my first try to intercept, it's like 4, but this is the first time i ask for help
i failed the other tries
We are building up documentation as we go along and people fail to do some things :D
If you fail doing something. We help and then add the changes necessary to prevent others from making the same mistake.
so, i did not read the full documment
but i haven't seen the BE thing, about dissable BR or BE whitelist the extension
I expected extension devs to know about the fact that BE requires whitelisting
i'm not a extension devs and i'm learning ๐
great
[11:23:46]-{info}- Load requested [template-plugin]
[11:23:46]-{info}- Load completed [template-plugin]
worked
the AI it's not following me, but the extension works ๐
thx
not sure if i should put this here or in #other_games_chat but it's enfusion/enscript stuff https://forums.dayz.com/topic/238731-a-first-look-at-dayz-modding/
already posted here yesterday
i dont even know where to start with this xD
i will wait for the community movement :p
Silly question, but do we have an estimate/guess on when Arma 4 will be available (alpha+)?
2035
Canโt wait to bury A3, can we?
Then nobody can complain about futuristic warfare
I think it's inevitable that by the time A4 rolls around, there will be good documentation for enscript, and the community will of course make it better over time, just like with A3/SQF
This time atleast we seem to be getting a IDE with tooltips.. But they didn't show tooltips that show documentation about functions and their parameters. Probably because it's waaay not done. Even the existing tooltips what show how a variable was defined are bugged
it'll come i'm sure, they're still hiring programmers after all
(although this might be me not being involved with scripting until 2015...)
i have a uav obj that i dont want anyone to be able to connect to it regardless of side. so i do
{ _x disableUAVConnectability [_uavObj , true];
} foreach allplayers;
(problem with this is when new players connect they can access it unless i do jip stuff?)
my headache starts here tho, doc https://community.bistudio.com/wiki/showUAVFeed
says
"#(argb,512,512,1)r2t(uavpipsingleview,1.25)"
how can i get that rsc thing into a customView pip like how a normal uav feed works in the navigation gps minedet etc panels? i want the player to still be able to connect to a normal spawned uav and see its feed as normal, but also have my custom uav in its own pip window thing without overwriting the default BIS uav stuff.
hope that made sense
@lusty canyon i don't know if will work, but you can try with remoteExec and use JIP option, that may solve the problem, i guess :p
how can i get that rsc thing into a customView pip like how a normal uav feed works in the navigation gps minedet etc panels?
you can try just stream feed on custom control, something like this >
private _mission = uiNamespace getVariable "RscDisplayMission";
private _ctrlFeed = _mission ctrlCreate ["RscPicture", -1];
_ctrlFeed ctrlSetText "#(argb,512,512,1)r2t(uavpipsingleview,1.25)";
....
```also you can create camera, attach it to uav and do almost the same ^ (just stream on texture `_camera cameraEffect ["internal", "back", <rendersurface>];`)
or both at the same time
lol
How difficult is it to create a cross-platform shared library (DLL for Windows, .so for Linux)? It looks like C# isn't an option, so I'm left with C/C++/Go. Any others I'm missing?
thanks @meager heart ill try that
@still forum I get the feeling you're the local expert in this area
@scenic pollen c# is an option
as long as you utilize mono on linux
for some arma extension, https://community.bistudio.com/wiki/Extensions#C.23
Ah that is music to my ears. Will do some googling. Cheers!
Are you sure though @queen cargo ?
linux tries to find a file named <extensionname>.so
it won't find the C# dll
about running DLLs on linux? yes, i am
using mono you 100% will be able to
about the c# extension stuff, well ... never tried
it is old information from the previous wiki
I'd even say the wiki C# stuff was written before mono for linux was a thing
I'd just go with C++. That 100% works.
go should work too.
C will make easy things way to hard and errorprone for you
๐คท mono works
that is what i know
and as long as mono works, there is a way in which you can load a c# dll on linux too
I guess you can make some .so wrapper extension that forwards messages to the mono dll ๐ค
yeah ... though ... i doubt that would be much useful ๐คท
if you actually are concerned about linux, use c/c++
Hmm yeah I'm doing some googling and not finding many results for how to compile a .so file (which Arma looks for when you call callExtension) from C#
because c# "DLLs" are no real dlls
Ah. Damn
also, you would have to google for "mono dll linux loading" or something like that
Looks like I'm gonna have to use C++ then. I've been trying to avoid it haha. Coming from a Java/Python background, C++ is a little daunting
I see, thanks @queen cargo
as you have to use mono to actually get your c# dll running
Is Arma limited to have only 8 cameras created as max?
I can't find anything on the wiki or elsewhere about cameras being limited
i create 20 cameras and assign them to a RSCPicture and only 8 are showing
sometimes ones and sometimes others
oh ::(
I have a dialog to control some security cameras before knowing the limit, I had 20 pictured ad assign each camera to a picture but due to the limit i can only see 8. Now I have only 2 pictures and i ned to click ina list to see the camera into a picture BUT when i have clicked 8 cameras, the other ones are black. I remove and create the camera each time it changes
I'd imagine 20 PIP would destroy performance anyway?
And you are sending the cameras render target to a number<8 when you create it again?
And each camera has a unique surface name? https://community.bistudio.com/wiki/Procedural_Textures#Render_To_Texture
Do you "terminate" the source? like shown on https://community.bistudio.com/wiki/cameraEffect ?
player removeAction 0;
_box attachTo [player, [0, 0, 0.6]];
player setUnitTrait["camouflageCoef", 0.01];
player action ["SWITCHWEAPON",player,player,-1];
player addEventHandler ["Hit", {player execVM "scripts\mgsend.sqf";}];
sleep 3;
player playAction "PlayerCrouch";
sleep 40;
player setUnitTrait["camouflageCoef", 1];
deleteVehicle _box;
sleep 120;
player addAction _action;
}];```
Hey guys I want to make that script show up as an add action, however it does not. Unless I put player addAction _action; at the bottom, however that duplicates my addactions
Is there a way to make only show the one action instead of two?
Remove the player addAction _action; from the addAction codeblock?
If i do that, will it appear again after use as I want it to remove the action then add it in after a cooldown
I removed it and I still get the double effect
Where are you running player addAction _action;?
at the end of the code, after }];
I think I found the issue
I was callling the script twice elsewhere
Hello, comrades! Need your advice again. I have some strange problem. My includes have stopped working inside pbo mission file.
Instead of #include "\pzn_camp\Campaign\Missions\description.hpp" game tells me that it cant find pzn_camp\Campaign\Missions\description.hpp file (no slash before the addon name). If i run local server from a folder everything works.
I even managed to bypass server crash if i land mission into server cycle, but includes are not working.
Has anyone faced this?
My includes have stopped working inside pbo mission file. correct
got broken with the 3DEN update
only fix is removing the #include
Thank you
@lament grotto ```
actionBox = player addaction ["<t color='#009BFF'>Stealthbox</t>", {_box = "Land_PaperBox_01_small_stacked_F" createVehicle position player;
player removeAction actionBox ;
_box attachTo [player, [0, 0, 0.6]];
player setUnitTrait["camouflageCoef", 0.01];
player action ["SWITCHWEAPON",player,player,-1];
player addEventHandler ["Hit", {player execVM "scripts\mgsend.sqf";}];
sleep 3;
player playAction "PlayerCrouch";
sleep 40;
player setUnitTrait["camouflageCoef", 1];
deleteVehicle _box;
sleep 120;
player addAction _action;
}];
_action is now undefined
The player removeAction 0; Removes the action with the ID 0, and your action possibly is not the action 0, actionBox has now thhe id and doing player removeAction actionBox;; will do the trick
ah
didnt see the last part
You could likely recreate the addAction using actionParams within the addAction codeblock
player removeAction boxID;
_box attachTo [player, [0, 0, 0.6]];
player setUnitTrait["camouflageCoef", 0.01];
player action ["SWITCHWEAPON",player,player,-1];
player addEventHandler ["Hit", {player execVM "scripts\mgsend.sqf";}];
sleep 3;
player playAction "PlayerCrouch";
sleep 40;
player setUnitTrait["camouflageCoef", 1];
deleteVehicle _box;
sleep 120;
boxID = player addAction BoxAction;
}];
boxID = player addaction BoxAction;```
saving the action and its ID to a global variable will do the trick ๐
BoxAction contains the Action and boxID contains the action ID
Generic global variable names are usually not a great idea
:/
player removeAction (_this select 2);
_box attachTo [player, [0, 0, 0.6]];
player setUnitTrait["camouflageCoef", 0.01];
player action ["SWITCHWEAPON",player,player,-1];
player addEventHandler ["Hit", {player execVM "scripts\mgsend.sqf";}];
sleep 3;
player playAction "PlayerCrouch";
sleep 40;
player setUnitTrait["camouflageCoef", 1];
deleteVehicle _box;
sleep 120;
player addAction BoxAction;
}];
player addaction BoxAction;
Just Using 1 global var
the _this select 3 is the current ID of the action so its easy to remove
to add it again...
BoxAction = ["<t color='#009BFF'>Stealthbox</t>", {
_box = "Land_PaperBox_01_small_stacked_F" createVehicle position player;
player removeAction (_this select 2);
_box attachTo [player, [0, 0, 0.6]];
player setUnitTrait ["camouflageCoef", 0.01];
player action ["SWITCHWEAPON", player, player, - 1];
player addEventHandler ["Hit", {
player execVM "scripts\mgsend.sqf";
}];
sleep 3;
player playAction "PlayerCrouch";
sleep 40;
player setUnitTrait ["camouflageCoef", 1];
deleteVehicle _box;
sleep 120;
player addAction BoxAction;
}];
player addaction BoxAction;```
@minor lance you should start formatting your code
makes it much more readable
This may work with no global variables ```sqf
_arr = player actionParams (_this select 2); // before removing the action
_arr deleteRange [10,2]; //to make output match addAction input
player addAction _arr; //re-add the current action
Just use actionParams to get the current action's parameters, store them as a local variable while executing the action, and then use that variable to re-add a duplicate of the current action
@queen cargo I just copied this guys code, how can i set the language?
```sqf
ty
but was talking about indentation
I indent my files, but as I copy paste from discord ...
I like indentation XD Its our friend
player addAction ["<t color='#009BFF'>Stealthbox</t>", {
_box = "Land_PaperBox_01_small_stacked_F" createVehicle position player;
_actionParams = player actionParams (_this select 2);
player removeAction (_this select 2);
_box attachTo [player, [0, 0, 0.6]];
player setUnitTrait ["camouflageCoef", 0.01];
player action ["SWITCHWEAPON", player, player, - 1];
player addEventHandler ["Hit", {
player execVM "scripts\mgsend.sqf";
}];
sleep 3;
player playAction "PlayerCrouch";
sleep 40;
player setUnitTrait ["camouflageCoef", 1];
deleteVehicle _box;
sleep 120;
_actionParams deleteRange [10,2];
player addAction _actionParams;
}];``` there we go. That *might/should* work
Its working @ruby breach @lament grotto
does anyone know what could be the cause of createSimpleObject working with one model but but not another? trying to place some weapons. MX example i found works fine. if i replace the path with the one from one of the apex rifles, there is nothing to see
Could you show the code?
works
_rifle = createSimpleObject ["A3\Weapons_F_Exp\Rifles\SPAR_01\SPAR_01_F.p3d", getPosWorld player];
_rifle setVectorDirAndUp [[0,0,1],[0,-1,0]]
damn ๐
```sqf
code
```
ty
doesn't work
_rifle = createSimpleObject ["\A3\Weapons_F_Exp\Rifles\CTAR\CTAR_F.p3d", getPosWorld player];
_rifle setVectorDirAndUp [[0,0,1],[0,-1,0]]
difference is model path and result is. nothing is visible on second one. could be offset maybe? although i tried offsets and didn't see it still
Now look at your filepaths again. Are you sure there's nothing different about them?
leading slash bois
_startsWith = {
params ["_string", "_check"];
if (count _string < (count _check)) exitWith { false };
(_string select [0, count _check]) == _check
};
_endsWith = {
params ["_string", "_check"];
if (count _string < (count _check)) exitWith { false };
(_string select [count _string - count _check, count _check]) == _check
};
params ["_modelPath"];
if (_modelPath isEqualTo "") exitWith { "" };
// -- Add p3d
if !([_modelPath, ".p3d"] call _endsWith) then {
_modelPath = _modelPath + ".p3d";
};
// -- Remove leading slash
if ([_modelPath, "\"] call _startsWith) then {
_modelPath = _modelPath select [1, count _modelPath - 1];
};
_modelPath
feel free to use that
just split it up in actual functions instead of inline pls
@ruby breach i see. thx. was pulling from the config via gettext. assumed it was valid...
If there's one thing to know about Arma, it's consistently inconsistent. lol
i wonder, if the config file paths will always be like that. do you know, if they need the \ to work? doesn't really matter since i gotta remove it but i could leave out the condition for it to be present, if that makes any sense
probably doesn't matter performance wise since it's not a frequent thing but, i sure would make the code more "dumb"/"blind", if i'm 100% all paths will look the same
https://gyazo.com/eff557c2e91b68ac86852af4d48818ef Is there a opposite EVH of this that runs when storing a item?
Container/Closed/Opened also Inventory/Opened/Closed < you can try those
(on the same page btw)
Is there a way to recompile functions with CBA while the mission is running?
How to check if a item is a weapon, i need to also be able detect it while the item is in the player backpack or any other container. (This marks of currentWeapon)
iirc theres a bis function to detect item type
Ah thanks lads. I hate how hard it is to find these bis fncs
Camper back at it again with a question. ```player addAction ["<t color='#009BFF'>Stealthbox</t>", {
_box = "Land_PaperBox_01_small_stacked_F" createVehicle position player;
_actionParams = player actionParams (_this select 2);
player removeAction (_this select 2);
_box attachTo [player, [0, 0, 0.6]];
player setUnitTrait ["camouflageCoef", 0.01];
player action ["SWITCHWEAPON", player, player, - 1];
player addEventHandler ["Hit", {
player execVM "scripts\mgsend.sqf";
}];
sleep 3;
player playAction "PlayerCrouch";
sleep 40;
player setUnitTrait ["camouflageCoef", 1];
deleteVehicle _box;
player removeEventHandler ["Hit", 0]
sleep 120;
_actionParams deleteRange [10,2];
player addAction _actionParams;
}];``` So I know this script works in singleplayer due the Player variable but how can I get it to work in Multiplayer?
private _action = ["<t color='#009BFF'>Stealthbox</t>", {
params ["_target", "_caller", "_actionId"];
private _box = "Land_PaperBox_01_small_stacked_F" createVehicle [0, 0, 0];
_box attachTo [_caller, [0, 0, 0.6]];
_caller setUnitTrait ["camouflageCoef", 0.01];
_caller action ["SwitchWeapon", _caller, _caller, - 1];
_target removeAction _actionId;
private _id = _caller addEventHandler ["Hit", {
params ["_unit", "_source", "_damage", "_instigator"];
_unit removeEventHandler ["Hit", _thisEventHadler];
/* code here from scripts\mgsend.sqf */
}];
[_caller, _box] spawn {
params ["_caller", "_box"];
sleep 3;
_caller playAction "PlayerCrouch";
sleep 40;
_caller setUnitTrait ["camouflageCoef", 1];
deleteVehicle _box;
sleep 120;
_caller addAction (_caller getvariable "var_action");
};
}];
player setVariable ["var_action", _action];
player addAction _action;
```like that ^ maybe
okay and then how bout this script that removes the box on hit. playSound "alert"; {deleteVehicle _x} forEach attachedObjects player; player setUnitTrait["camouflageCoef", 1]; player removeEventHandler ["Hit", 0]
yeah
playSound "alert";
{deleteVehicle _x} forEach attachedObjects _unit;
_unit setUnitTrait ["camouflageCoef", 1];
replace comments with this ^
/* code here from scripts\mgsend.sqf */ < that comment there ^ ^ ๐
I really do need to remember to make comments
so it would look like this ```private _id = _caller addEventHandler ["Hit", {
params ["_unit", "_source", "_damage", "_instigator"];
_unit removeEventHandler ["Hit", _thisEventHadler];
playSound "alert";
{deleteVehicle _x} forEach attachedObjects _unit;
_unit setUnitTrait ["camouflageCoef", 1];
}];
yes
also
find this > deleteVehicle _box; and replace it with >
if (!isNull _box) then {deleteVehicle _box};
```in case your eh will fire before...
full version with edits ๐ > https://pastebin.com/u2buiLBV
Ill give it a test thanks a bunch
gl
works a treat on the dedi bo thanks @meager heart
Is there a MP friendly function for invoking animations? BIS_fnc_ambientAnim doesn't work in MP.