#arma3_scripting
1 messages ยท Page 444 of 1
Now I am trying to figure out why my guy doesn't shoot.
He is 700 meters away
and he has line of sight.
Any input fellas?
maybe target is null
out of ammo ? ๐
0 spawn {
player allowDamage false;
private _sniper = createGroup east createUnit ["O_sniper_F", player modelToWorld [0,1000,0], [], 0, "NONE"];
_sniper reveal [player, 4];
_sniper doWatch player;
waitUntil {([objNull, "VIEW"] checkVisibility [eyePos _sniper, aimPos player]) >= 0.5};
_sniper doTarget player;
};
``` works ^
range 1 km ^
Oh, that check vis is fancy.
Question
waitUntil {
([objNull, "VIEW"] checkVisibility [eyePos _sniper, aimPos player]) >= 0.5
};
Will that shit out if the player dies / goes down while it's waiting?
maybe not when he will die, but if player body will be removed/deleted...
while {[_targets] call ORMP_fnc_numberAliveInGroup > 0} do {
private _targ = selectRandom units _targets; // select rand victim in group
_sniper reveal [_targ, 4];
_sniper doWatch _targ;
// If in view, take the shot.
if (([objNull, "VIEW"] checkVisibility [eyePos _sniper, aimPos _targ]) >= 0.5) then {
_sniper doTarget _targ;
};
sleep random[60, 65, 120]; // wait between shots (prevent shot spam)
};
Will that preform as expected?
If the targ is in view, take the shot, otherwise on to the next target
as per the while loop?
Also, should I convert the while loop to a spawn call within the function.
I don't normally like while loops to be honest.
[snp1, ormp1, false] spawn ORMP_fnc_sniperFire;
[snp2, ormp2, false] spawn ORMP_fnc_sniperFire;
That is in a script called manageSnipers.sqf
that gets kicked off in the init server.
Will this work as I think it will, and both of these happen 'at the same time' meaning I don't have to wait for the first sniper to finish to have the second one do stuff.
maybe you can make function for that shot and then just call it, without loop
Example of how you would do that?
The goal of the effect is to.
- have sniper at static pos in distance
- have player team someplace in sight
- continious sniper fire, if sniper can see players, ends when out of ammo or sniper dead.
The conttinious part is what kills me.
D:
hmm
I want the use case to be this.
Place a 'sniper' in editor. Give him a hold waypoint or something.
in init.sqf / initserver, etc.
call this function, pass the sniper, and his target group.
enjoy recreating that scene from full metal jackety.
lol
these functions will be eventualy handled by some sort of 'situation manager'
the goal of the frame work is to create a suite of puzzle peices for creating 'combat situations'
arty fire, sniper scenarious, etc.
and be able to kinda plug and play them to units without init calls on the units.
just wait until players group will be at that "AO", select player, pass him in that "shot function" and that's it... ๐
Haha, yeah.
I am gonna test thee change now tho.
With the spawn methods, and see if it works.
probably the easiest way is just distance check
oh?
for the players
Like, if targets, in distance, do shot.
That works for a single shot, I wan't continious for this one tho.
private _script = [] spawn {/* here some code, for the all checks and call for the 'shot fucntion'*/};
waitUntil {scriptDone _script};
//--- more checks
[] spawn _script;
kinda loop without loop
but this is not really far from while loops, in performance
ยฏ_(ใ)_/ยฏ
Yeah.
I mean, I could have some kind of manager in place in the future.
For now I can do it manually, and just not fire more than 1 or 2 of them at a time.
I wish there was some way to see the status of the scheduler.
OR something.
Hmm
// Fire on target.
while {[_targets] call ORMP_fnc_numberAliveInGroup > 0} do {
["INFO | ORMP_fnc_sniperFire | Checking target validation"] call ORMP_fnc_log;
private _targ = selectRandom units _targets; // select rand victim in group
_sniper reveal [_targ, 4];
_sniper doWatch _targ;
// If in view, take the shot.
if (([objNull, "VIEW"] checkVisibility [eyePos _sniper, aimPos _targ]) >= 0.5) then {
["INFO | ORMP_fnc_sniperFire | Taking shot"] call ORMP_fnc_log;
_sniper doTarget _targ;
_sniper doFire _targ;
} else {
["INFO | ORMP_fnc_sniperFire | No shot"] call ORMP_fnc_log;
};
sleep random[60, 65, 120]; // wait between shots (prevent shot spam)
};
I am always getting the no shot coming back.
ORMP_fnc_log < what is this ?
Just a logging function that slows down execution.
Wraps a remoteExec call of system chat
Later it will do more.
params [["_text", "", [""]]];
[_text] remoteExec ["systemChat", 0, true];
sleep 3;
"INFO | ORMP_fnc_sniperFire | Taking shot" remoteExec ["systemChat"];
``` you can just ^
_targets < that is group ?
Yes.
It is a valid group, I know it's correct because I tested against a invalid group as well.
And got the expected output, that the group size was zero.
Group size comes back as 1 with the valid group.
if you have reveal in a loop, i think you need forgetTarget also
Oh?
from the wiki
Values greater than or equal 1.5 reveal the side of the target, too.
kinda spam...
i mean _sniper reveal _targ; if sniper cant see the target _sniper forgetTarget _targ;
while {[_targets] call ORMP_fnc_numberAliveInGroup > 0} do {
["INFO | ORMP_fnc_sniperFire | Checking target validation"] call ORMP_fnc_log;
private _targ = selectRandom units _targets; // select rand victim in group
_sniper reveal [_targ, 4];
_sniper doWatch _targ;
// If in view, take the shot.
private _vision = [objNull, "VIEW"] checkVisibility [eyePos _sniper, aimPos _targ];
if (_vision >= 0.2) then {
["INFO | ORMP_fnc_sniperFire | Taking shot"] call ORMP_fnc_log;
_sniper doTarget _targ;
_sniper doFire _targ;
} else {
[format["INFO | ORMP_fnc_sniperFire | No shot, %1 vision, needed 0.2", _vision]] call ORMP_fnc_log;
};
_sniper forgetTarget _targ;
sleep random[60, 65, 120]; // wait between shots (prevent shot spam)
};
So, first loop... target not in view, output as expected.
move into view
Second loop
I am in view, output is expected, and I can see visible movement on the ai as he aquires me as a target, but he doesn't shoot.
something with his weapons/ammo maybe ๐
also just _sniper reveal _targ;
and
if (_vision >= 0.2) then {
["INFO | ORMP_fnc_sniperFire | Taking shot"] call ORMP_fnc_log;
_sniper doTarget _targ;
_sniper doFire _targ;
} else {
[format["INFO | ORMP_fnc_sniperFire | No shot, %1 vision, needed 0.2", _vision]] call ORMP_fnc_log;
_sniper forgetTarget _targ; //--- forget if cant see
};
I just blocked him.
while {[_targets] call ORMP_fnc_numberAliveInGroup > 0} do {
["INFO | ORMP_fnc_sniperFire | Checking target validation"] call ORMP_fnc_log;
private _targ = selectRandom units _targets; // select rand victim in group
_sniper reveal [_targ, 4];
_sniper doWatch _targ;
// If in view, take the shot.
private _vision = [objNull, "VIEW"] checkVisibility [eyePos _sniper, aimPos _targ];
if (_vision >= 0.2) then {
["INFO | ORMP_fnc_sniperFire | Taking shot"] call ORMP_fnc_log;
[format["INFO | ORMP_fnc_sniperFire | Target in sight, %1 vision, needed 0.2", _vision]] call ORMP_fnc_log;
_sniper doTarget _targ;
_sniper forceWeaponFire [primaryWeapon _sniper, "SINGLE"] ;
} else {
[format["INFO | ORMP_fnc_sniperFire | No shot, %1 vision, needed 0.2", _vision]] call ORMP_fnc_log;
_sniper forgetTarget _targ;
};
sleep random[60, 65, 120]; // wait between shots (prevent shot spam)
};```
Yeah, I don't know @meager heart it's still not firing..
Would you be willing to test it?
i'm on the "wrong pc", cant test it atm... sorry, Jay
just spawn vanilla ai and try it in perfect conditions (vr maybe) also hint or systemchat on every "stage" will helps
also for the commands, check comments here https://community.bistudio.com/wiki/fireAtTarget
It has to do with the checkVis I think
i posted example above, with that thing... it works
try it in the console
0 spawn {
player allowDamage false;
private _sniper = createGroup east createUnit ["O_sniper_F", player modelToWorld [0,1000,0], [], 0, "NONE"];
_sniper reveal [player, 4];
_sniper doWatch player;
waitUntil {([objNull, "VIEW"] checkVisibility [eyePos _sniper, aimPos player]) >= 0.5};
_sniper doTarget player;
};
this ^
I can get him to fire.
It's getting him to fire only when I want.
With the above, he just starts firing, no delay.
May be the best I can do, I am testing setCombatMode "BLUE" now
"BLUE" > never fire
Man, this seems so damn fickle..
D:
Worked fine until I tested in on a dedi server and with a friend
When I add custom turrets and ammo to vehicles, will the AI use them? (addWeaponTurret)
How would I go about making it so that the continue button on a debriefing (triggered by BIS_fnc_endMission) takes you to the slot selection lobby rather than completely exiting to the server list?
I think it would be more of a server config than mission scripting... Or a mod issue?
@winter rose I've seen lots of servers do it, but I'm not sure how which is why I was just checking to see if anyone knew
How would I go about removing large sections of grass?
@radiant needle in the mission editor, there are "grass cutter" (small, medium, large) you can create to get rid of grass
@warm gorge it may be about mission cycle - last mission = "closing" the server
You could detect grass (idk how) and use hideObject maybe
IS there a good way to check to see if a spawn location is safe?
Can lights be greated globaly?
depends on how you create your light
how come when I define a variable inside a switch do case
I cant use it outside the switch
using trigger for https://community.bistudio.com/wiki/inArea
Does it use triggers Z size?
When did BIS finally fix side command? So that if you query a OPFOR soldier in a BLUFOR group it actually says 'west'.
@peak plover light objects can be global, just the values of the light e.g. brightness and color are always local, you'd need to remote exec that on all clients
Anyone knows about the Rsc Dialogs?
Are setPos commands effected by the unit direction? if so there is other command i can use?
Anyoe got a template or know class for creating particle effect of like a tiny red light
https://community.bistudio.com/wiki/setLightDayLight does not function for me so I need to make new particle
https://community.bistudio.com/wiki/setParticleClass how do i find the classnames for this?
nvm
I need to make flare but Can't find flare classname
Now I'm just getting mad that lights and light flares don't work at day and making a particle flare/light is too fucking stupid
If anyone can help with particles:
_particle = "#particlesource" createVehicleLocal [0,0,0];
private _object = cursorObject;
_particle setParticleParams
[
['\A3\data_f\ParticleEffects\Universal\Universal.p3d',16,12,8,0],"",
'Billboard',
1,
1,//todo 0.1
[0,0,0],
[0,0,0],
0,0,0,0,
[1,1,1,0],
[[1,0,0,1],[1,0,0,1]],
[1,1],
0.1,
0,
"",
"",
_object,
0,
true,
0.5,
[[1,0,0,1]]
];
_particle attachTo [_object,[0,0,3]];
_particle setDropInterval 1.0;
Can't get anything of thisto work
@winter rose You could detect grass (idk how) and use hideObject maybe No and no ^^
@peak plover Can lights be greated globaly? if you have a real model light you can use createVehicle which is global.
The SQF light point isn't though as you probably already noticed.
So far all the stuff I did with particles was... Randomly try to change things till something nice happens
Example particle classes ObjectDestructionSmoke1_2Smallx , Ace_cookoff_cookoff, BloodUnderwater1
Maybe look into the Flare CfgAmmo class and see what that does. Maybe you can find something there
Maybe there is just a particleClass entry ยฏ_(ใ)_/ยฏ
How i use channelEnabled? It's right this? if ((channelEnabled 8) select 1 isEqualTo true) then { hint "In call" }; if ((channelEnabled 8) select 1 isEqualTo false) then { hint "Not in call" };
I need to know if channel exist or not...
isEqualTo true doesn't make sense. It would do exactly the same if you didn't write that
and yeah.. I think that's correct.
You check the voice channel though. Not chat
Yes i just want to check if you have that channel
if (true in (channelEnabled 8))
would check if you can access voice or text or both of that channel.
Ok thank you!
Does anyone know how to limit the distance AI will wander away from a DISMISSED waypoint? Also how to kill one after a random amount of time?
Is there a way to play a local sound with path to sound file similar to https://community.bistudio.com/wiki/playSound3D
say3D ?
yep
A question for the guys with good knowledge about performance is it better to do
private _enemies_in_zone = (allUnits - playableUnits) inAreaArray "defend_area";
in a scheduled script every two seconds or do that via a trigger detecting opfor?
uh...
do it in a scheduled script every 2 seconds. Or do it on a scheduled script every 0.5 seconds.
I think you can answer that yourself
You could also do it in a trigger every 2 seconds. That would be golden
probably just inAreaArray [<position params>] without anything placed on the map, will be better... ? ๐ค
Not sure if sarcastic or not @still forum Basically i have no idea how demanding that (allUnits - playableUnits) call gets when there are a LOT of AIs around. And i know that a trigger checks its condition rather often but i have no idea how he detects units in its area. If that is way better or even pretty much the same... Therefore could you clear that up shortly? ๐
defend_area is a for the players visible marker on the map and i think i prefer the better readability over the possible performance gain in this case. @meager heart
I think you can answer that yourself
that is the right answer ๐
test it...
may the fps be with you
Also you cannot kill the FPS with that anyway cuz scheduled
It's not demanding enough to care about. I thought you were talking about inAreaArray which is waaaaay more demanding than the single -
am I able to clip something like
https://gyazo.com/8d1731515bfc4d0d7248c266133d8c89 into something more like
https://gyazo.com/9d59629a687814507470d5cefc2c2ede
with camera functions ?
you want make something like this https://gyazo.com/a91c98c7d85d50d8ed805f3ca60a8adb
to look like this https://gyazo.com/b04288565821fdafa264fcebab8d1e8c
๐ค
with camera functions
just resize it... I had to come up with an alternative xd
just made an image that covers up part of the picture
๐
we have only camSetFov and nothing for the aspect ratio afaik...
if the mission is running on dedicated server does unit setDamage 1; have to be run on the server, not just on the player?
Is there a compileFinal version just for code? E.g:
MY_fnc_awesome = finalize {...};
no
If you have CBA there is a function for that https://github.com/CBATeam/CBA_A3/blob/master/addons/common/fnc_compileFinal.sqf
oh, right - indeed
compileFinal str code ๐
(just kidding, I don't know if it would work)
awful, but it "works"
If loading screen disappears after you having called startLoadingScreen, but not endLoadingScreen would this indicate an addon screwing with you?
this would indicate some other script somewhere calling endLoadingScreen maybe to end it's own loading screen
maybe use the BIS loading screen function
Thx, that did it.
How do I spawn via script a premade composition that's in the editor drop down already? So for example under Guerrilla there is Camp Site #1. Do I need to use objectgrabber and then mapper on this, or is it possible to output already as the file with all the offsets must exist somewhere to do it in editor?
Write a script for it.
I know I asked this last night, but I'm still having trouble figuring it out. Does anyone know what determines whether the Continue button in the Debriefing menu forces you to the server browser (disconnect) or just back to the lobby?
This is a strange question.
If the server kicked you.. You'll go back to server browser
otherwise I never experienced the button throwing me back to server browser
Yeah its very strange. I'm basically just calling BIS_fnc_endMission when the pause menu abort button is clicked, and whenever the continue button is clicked it freezes for a couple of seconds and then puts me to the server browser
Why?
Huh?
Why would you do that?
strange stuff
does "if(alive _x && _x != player) then" means if the player is alive and not alive?
or means Alive and dead?
if x is alive and x is not the local player then ...
yes.. alive most likely means dead.
if it would mean alive. It would be named dead ofcause. To not confuse people
Write a script for it. now why didn't I think about that...I'm gonna just take that answer as a "I don't know and I can't be arsed trying to help you."
create3DENComposition [
configFile >> "CfgGroups" >> "Empty" >> "Guerrilla" >> "Camps" >> "CampA",
screenToWorld [0.5, 0.5]
];
I don't know which camp you want, but this is how you do it using the create3DENComposition command (https://community.bistudio.com/wiki/create3DENComposition).
@sand axledog [3CB]#2890
Reddog, I question the approach of using a 3den composition for that in the first place. Imo you should ignore the 3den stuff and make something from scratch.
Should a function that is called from within a loop (in another function) include anything in particular within it so that the function can be called multiple times?
I have a couple of loops that call a function, but it only ends up being called once, irrespective of loop iteration
If I copypasta the function into the loop itself, it works as desired
Does the function contain a breakOut/breakTo?
Nope
Otherwise no, you can use a function as often as you want.
Good (I don't even remember, may be dementia).
If u scroll up abit i asked about alive _x
Yeah, I just translated it to English.
Anyone knows how to make a RscText Clickable?
put a invisible button over it
Could try
_control ctrlEnable true;
_control ctrlAddEventHandler ["MouseButtonDown", {systemChat str _this}];
But I am not sure this control supports this event.
enable part may be needed, or may not be needed.
can someone tell me if this right for the RscListBox https://hastebin.com/notatadaqo.bash
Why not try it? How could anyone here know if it works or not?
If you clean up your code and stop using tabs, you might have an easier time getting people to help you. @molten folio
Yeah, at least get the syntax highlighting right if you want it reviewed. And try to get the indents and formatting consistent.
And yes, commands like lbAdd is what you're looking for.
The script has 26 { and 30 }, so it is fucked.
Who's idea was it to name a global bann. Boy I hope they add a command with that name.
Lels
Also _script1 = _display displayCtrl 901;
Why would you name a variable containing a display _script1? ๐ค
Master of deception.
that idd also
what was this loop again called?
for (int i = 0; i < somelargenumber; i++);```
*performance loop* was not what i can find the xkcd comic for (think it was xkcd)
Trolling right? @queen cargo
nah @rotund cypress
seeking a meme right now
think it was speed loop now
loops that can get removed so you can write at the end of week "improved performance"
And how are you supposed to improve that one?
Wait I am so lost right now.
removing a zero
I think the SQF equivalent is:
for "_i" from 0 to 10000 do {};
And there's nothing inside the code block, so the whole thing is pointless and you can be praised for fixing performance by removing it later or something like that.
http://thedailywtf.com/articles/The-Speedup-Loop <-- was this here
โThe idea is,โ Wayne continued, โwhenever we have those really slow weeks โ you know, the kind where donโt actually fix any bugs or make any other changes โ we just drop one of the zeros on the loop. And then we just tell the manager that we ran into some speed issues with the latest change request, but after a whole lot of deep-juju optimization, we were able to speed things up significantly and should be able to do the change request the next week.โ
So essentially it's fraud.
You can get fired for this, this is a stupid idea.
Also: things that never happened.
It was unsuccessful fraud. Remember the interview question Wayne asked.
you have to check wording
manager gets told that from the programing department
it is essentially a joke
nothing else
Imagine giving an interview and just making shit up.
I know it's a joke. Double on the irony what Wayne doesn't know the mistake himself.
speedup loops are pretty much a meme and only that
explaining away why some programs are dead-ass slow
in sqf that kind of 'for loops' is "for forspec" ?
for [{private _i = 0}, {_i < 5}, {_i = _i + 1}] do {};
is that correct ?
yup
avoid it
like
always
take it as vodoo magic that should not work but somehow does
not using it, i'm just asking
i mean... your question was >what was this loop again called ?
Speaking of existing but useless commands, why is scudState in Arma 3?
Heh, he doesn't know about the SCUDs.
why for gods sake is there no z coord for markers? would solve so much problems...
with rhs maybe (scud)...
maps are flat.....but you have buldings on it...dont you?`^^
And?
even if.... we still could set it to 0 if needed.... lol
K. Didn't realize anyone but bohemia actually used that command.
Seems like it a bit redundant when there are animations...
try it with rhs, Muzzleflash
I tried the 9P129-K while systemChatting the vehicle's scudState - it stayed 0 all the time.
yep... just tested it
hint str (scudState scud_name); //--- 0 always 0 ๐คท
https://gyazo.com/f117a1a3e0587eb0764d58eb9da94662
@little eagle Just to follow up re. function that was only calling once inside loop that continued to run: the function call only works if I spawn it, not call it - is that a memory thing?
No, makes no sense to me.
@little eagle are you able to elaborate, or tell me where I can read more to understand that?
if you call it from unscheduled and try to sleep inside it, it will throw an error and abort your script. aka it won't run a second time
Any error that would kill your script would kill it and not have it run a second time. So check your RPT for errors
you could alternatively show us the script.
And for todays horrid code snippet. Desolation Redux!
params["_container"];
_weapons = (weaponsItemsCargo _container);
if(isNil "_weapons") then {_weapons = [];};
_output = [];
{
if(typename(_x select 5) == typename([])) then {
_output = [_x select 0,_x select 1,_x select 2,_x select 3,_x select 4,_x select 5,_x select 6];
} else {
_class = _x select 0;
_muzzle = _x select 1;
_side = _x select 2;
_optic = _x select 3;
_magInfo = _x select 4;
_bipod = _x select 5;
_newData = [];
{_newData pushBack _x;} forEach [_class,_muzzle,_side,_optic,_magInfo];
_newData set [5,[]]; // set launcher ammo to []
_newData pushBack _bipod;
_output pushBack _newData;
};
} forEach _weapons;
_output;
What a beautiful piece of art
nice to see, guys getting close to "maestro Q" standards ๐
well atleast they use params.... But only for _this. And also not param...
I'm sure they'll get it someday
params["_container"];
private _weapons = [weaponsItemsCargo _container] param [0, []];
_weapons apply {
if((_x select 5) isEqualType []) then {
_x;
} else {
//Insert empty launcher ammo at index 5
(_x select [0, 5]) + [[], _x select 5];
};
}
Can anyone come up with a better variant? Besides getting rid of the _weapons variable?
_output = [_x select 0,_x select 1,_x select 2,_x select 3,_x select 4,_x select 5,_x select 6];
Imagine being the person having to write this down.
if(_container isKindOf "Men") exitWith {
Another snippet from them... Isn't it Man?
but allDeadMen ๐คท
It's Man.
And it should be CAManBase.
Men is 404
The weaponsItemsCargo array doesn't even have 7 elements, so no idea where _x select 6 comes from.
From the code snippet's i've seen. Desolation Redux seems to be Altis Life level script skill.
It has. If there is launcher ammo
that's not listed on biki apparently
aka secondary magazine in primary weapon
secondary muzzle mag, okay.
I still don't get it. Why would it report the fift element as array... Fml, BI does skip the bipod for launchers and append the secondary mag at the wrong index, don't they...
Because if it has launcher ammo then _x select 5 is the launcher ammo array. And then the 7th element will be the bipod.
Otherwise 6th element is bipod string and 7th element doesn't exist
["arifle_Mk20_GL_plain_F","","","",["30Rnd_556x45_Stanag",30],["LAUNCHER AMMO,"1],""]
["arifle_Mk20_GL_plain_F","","","",["30Rnd_556x45_Stanag",30],""]
Yes the first one is a syntax error. Copied it like that from desolation discord
Oh, they use "launcher" for grenade launcher!
launcher refers to the secondary weapons in my book.
yeah. Mine too
Not ugl / secondary muzzle.
I get it now.
params ["_container"];
private _weapons = [weaponsItemsCargo _container] param [0, []];
_weapons apply {
_x params ["_weapon", "_muzzle", "_side", "_optic", "_primaryMagazine", "_secondaryMagazine", "_bipod"];
if (_secondaryMagazine isEqualType "") then {
_bipod = _secondaryMagazine;
_secondaryMagazine = [];
};
[_weapon, _muzzle, _side, _optic, _primaryMagazine, _secondaryMagazine, _bipod]
} // return
My version. Readability focus.
I personally would probably
params["_container"];
[weaponsItemsCargo _container] param [0, []] apply {
if (count _x >= 7) then {
_x;
} else {
_x insert [5, []];
_x
};
}
but we don't have that insert
set ?
insert is like pushBack, but not necessarily at the end I guess.
pushBack element is equal to insert [end, element]
it's ez ded, resize the array use set to move all the other indexes past the wanted index then use set to change said index
EZ I TELL YOU
in c++ end is an iterator pointing to one after the last element
wasn't sure if count is correct. And didn't want to think about it
So, and why the fuck would weaponsItemsCargo report nil?
It doesn't actually. I forgot to fix that
The only thing that comes to mind is objNull.
Oh wait. if _container is nil then it wouldn't be executed and return nil immediately
no biki says objNull returns []
If container was nil, the script would error in scheduled environment everyone loves so much.
params [["_container", objNull, [objNull]]];
weaponsItemsCargo _container apply {
_x params ["_weapon", "_muzzle", "_side", "_optic", "_primaryMagazine", "_secondaryMagazine", "_bipod"];
// no secondary muzzle means bipod takes the index
if (_secondaryMagazine isEqualType "") then {
_bipod = _secondaryMagazine;
_secondaryMagazine = [];
};
[_weapon, _muzzle, _side, _optic, _primaryMagazine, _secondaryMagazine, _bipod]
} // return
They actually code in scheduled yeah..
weaponsItemsCargo param [0, objNull] apply {
if ((_x select 5) isEqualType []) then {_x} else {
(_x select [0, 5]) + [[], _x select 5];
};
} // return
WAIT
woah... dude
#define CARGO(obj) (weaponsItemsCargo ([obj] param [0, objNull]) apply {\
if ((_x select 5) isEqualType []) then {_x} else {\
(_x select [0, 5]) + [[], _x select 5];\
};\
})
The only correct answer.
Commy is the best SQF compression algorithm. Turning a 780 byte script into 170 bytes.
tfw no algorithm to fix shitty code
we need a big neuronal network for that
In the case of sqf, it would be a neurotic network instead.
we got the best machine learning expert from the ACE3 slack here: me
it's very simple, SLAP THE EVERLOVING SHIT out of the bot until it works
๐คข
EZ
But flummi made the chatbot AI thingy
Yeah, everyone who disagrees with me is a bot. I mean, could any real person even disagree with ME?
Nope, thus we're both humans
Damn right, toady.
Somebody said SQF compression?
No.
@little eagle I say your assumption is false
bot
there is new "shrug" for the bots ยฏ\๐ค/ยฏ
ok I'm sure
I've asked this
And other people have asked this
Anyone have a snipped to test the slowness of scheduler and would I benefit from unscheduled?
Mainly doing missions, and from time to time
I'm using a loop, or a sleep here or there
So I'm like, maybe I should just move everything into unscheduled
I assume it's easier to find out what's slow with @still forum 's new tool
Btw is that out or what's the deal with that?
I saw some screenshots here last week
yes it would benefit
every scheduled script is slower than the same unscheduled script.
my profiler can't profile scheduled. It's currently in beta-ish https://github.com/dedmen/ArmaScriptProfiler/releases/tag/brofilerRC3
Ignore all the newer builds. I gotta disable that.
You start Arma with the mod. Go into a mission (Per frame handlers need to run) then start the Brofiler UI and connect to game. Then it starts to capture. Then you press the stop button and you'll see all the info that was captured
every scheduled script is slower than the same unscheduled script.
if (!canSuspend) then {
for "_i" from 1 to 10000 do {};
};
Oh right. Forgot to explain why.
The scheduler checks at every script instruction if the 3ms limit is already reached.
unscheduled doesn't have that check. Thus faster.
Hey, is it possible to force a new line in a listbox? I've tried straight up doing + \n +, but that didn't work, so then i moved onto putting it into a stringtable, still didn't work. It just came up with test\ntest, anyone have any ideas?
The same item with linebreak? I don't think that is supported, but may be wrong.
Yeah - i'm not too sure either, i thought i saw it somewhere else, but idk
I wanna improve (a bunch) so I'll try fixing as many bugs and move into unscheduled, Anything I should look out for when converting into unscheduled?
I already imagine
don't wreck fps
Since some things really do need to check some things every second
I thought about that yeah
I know that at least 5 things will check every second
CBA.
So I could have 1 dedicated unscheduled check that runs some codes every second
But wouldn't that mean
ALL of the code running every second
causes stuttering
every second
So I should do separate checks that (hopefully) will not land near eachother frame wise
Yeah but there's gotta be a part where I can make it run as fast as possible
and then just cuz I have them all run on the same frame, they all kill
like 30 if checks are still 30 if checks, can't get aroudnthat
CBA seems nice for this yeah
What do you need to check all the time?
maybe you can replace some by eventhandlers
Yep.
Well
I have a (i think) really good way of doing AI for ex
What I see some people do is make a loop for every group and set waypoints on completion and check for some things to happenn like caching etc.
since those things can be expensive I made 1 loop that checks 1 group every frame.
CBA statemachine ^^
Issue with that was, I was using 2 men teams for enemies and had ~500 groups that were checked which ment the script took like ~4 seconds(on my machien) to check all of those
But if fps is lower the time went to like evne ~10 seconds
I'd say keep the loop very simple and make the rest event based. Switch to unscheduled using isNil if needed. And if you're worried about performance, do a set amount of checks per frame and continue with the other groups and units next frame, so your ai stuff scales for tons and tons of ai without lowering performance.
So that ment sluggish ai
and had ~500
here's your issue
Well
400 were cached
so those were only checking if they should uncache
Also something that needs to be checkd frequnetly enough due to speeds of some vehicles
then you had a 100 groups
Only check 20 per frame, continue with 21+ next frame. Something like that. Like you implement your own scheduler so to speak.
I did something like that for my performance testing(clientside caching)
But it's hard to nail down some loss of performance in scheduled
And also
I moved so far
That instead of checking all the 500 groups
I dynamically cluster them
And only do like 50 checks for 500 groups
But like everyone keeps saying to use CBA
Sounds to me like you're doing something no one else has managed to do yet, and want advice.
I might just bite the bullet and say goodbye to possibility of doing vanilla missions
Well
I did that and from my testing so far
Client fps gets very nice gains
But by the time the gains made sense, the huge amount of ai caused server to drop performance
I havent tested with mroe than 3 people yet
Amount of clients shouldn't matter as long as your stuff doesn't send data around a lot.
Also if I move to a unscheduled workflow I can debug and find out what's slow faster
That's my issue commy
if a unit is hidden / disabled on the client locally to that client, it continues to move around wherever it's local
synching stuff scales horribly in Arma, guess that's the price of server client structure.
but positon updates cease
This means
If nigel disables all ai units on his client
they keep running towards him on the server
nigel never knew about movement
so he doesn't know to uncache
causing invisible (disabled/cached) ai to shoot poor nigel
Sounds to me like that stuff should be managed on the server exclusively in the first place. Why would the client handle AI stuff?
No
Client uses disableSimulation and hideObject
These commands have local effects
Causing nigel to gain FPS
hideObjectGlobal.
and disableSimulation has to be local where the object aka the AI is. If it's on the server it only needs to run there
Yeah, but those command should be remote executed or some global event in case of cba. Not the whole loop on a client, just what's needed.
So I made a system that sends the (TO UNCACHE) array of units to nigel from server. That way nigel knows what to uncache if they come towards him.
I don't wanna relay all client checks to server
Why not?
So all clients do caching loops. While server does a uncaching loop,
better 5fps less on all clients. than 0 fps on server ^^
No
The improvement of disableSimulation andhideObject is bigger than you think. I went from like 40 to 70
fps
So all clients do caching loops. While server does a uncaching loop,
Well that sounds awkward.
So it's well worth it
I don't use global hideObject and disablesimulation because, I want units to be still moving arouind
This means
IF nigel is fighting in Berezino he only knows and sees units in Berezino.
Then commy is fighting in Vybor he only knows and sees units in Vybor.
This way there can be a lot more objects and units fighting around all over the map while also being cached and increasing performance
Basically nigel doesn't even know what commy is up to
If I do getpos commy on nigel
it will always be the position where disableSimulation was enabled on nigels client for commy's unit
Like I said, from testing clients gain A LOT of fps
Sounds like you could do all this on the server. And abuse the shit out of that sweet inArea command.
I do inArea
And clusters
But even then
I struggle to get the server to provide updates fast enough and without a performance drop on the server
However
The issue I have
How many lines is this? I think you could write that in ~100 lines.
Is that at the point when fps gains make sense, the server is already low on fps
If you do this right, you don't lose any fps. These checks are simple enough.
It just gets annoying when you add vehicles and shit to this.
I made a copy paste version with 1 file
1k lines
I also tell the server about which things have been cached on the client
i hope that your tests with "improvements", was on dedicated server and that server was not on the same pc with your client, nigel
Maybe I'm missing some essential feature, but 1k seems way too much.
What's a cluster?
It's a location that has a variable containing all units inside of it
So if I wanna check what to uncache for a client
I don't ahve to do 500 checks
Instead ~50
LOCATION as in the data type?
inArea
// create location
_location = createLocation [_nClusterType,_clusterPos,_distance,_distance];
_location setVariable ['perf_cluster',true];
_location setVariable [_nClusterUnits,_clusterUnits];
Yea
That's more advanced than I though^^ Not convinced that all that is necessary, but if it helps that specific mission, I guess it's fine.
Well
You try inArea for 500 units for 10 players
That's 5k inArea
That's a stutter/lag
That's why you only do a set amount of units each frame.
Then it doesn't matter how many ai there are.
You get attacked by invisible ai
or have to increase the distance to a point where it makes less difference
I could do set amount of units each frame if I had a script per player
But I have 1 script chjecking a player per frame
There're like 20 frames a second. That's 400 units each second.
If you check 10 units a frame, and have 20 fps, you can have 12000 units on the map and check them all in one minute.
inArea < sqf // get clusters that are in uncaching distance private _clusters = (nearestLocations [_pos, ["Invisible"], (_distance)]);
why the fuck are you creating locations .....
He kinda already explained that @lone glade
it's unnecessary tho
Locations are faster than objects and inArea is slower than nearestLocations
I don't see how else to do it
markers
with same perf
arrays.
nearestLocations is faster because
inArea/inAreaArray would check all locations/clusters
meaning 50 clusters
nearestLocation was like almsot twice as fast with large amount of clusters
From my experience, the more commands you use the slower shit gets, so there remains doubt in me. Though I obviously never messed around with your stuff.
You could leave the loops scheduled, and move to unscheduled with isNil in the "events" part of the code. Though idk if scheduled is all that good for this in the first place, as it will probably break down when the server actually has load.
Does your stuff handle vehicles / crew?
Why is unscheduled better? Im still pretty new to Arma scripting?
Yeah handles all objects and vehicles(including men)
@still forum Said: The scheduler checks at every script instruction if the 3ms limit is already reached. unscheduled doesn't have that check. Thus faster.
Ah, thanks
Is there downsides to unscheduled scripts?
if your script is slow the game will stutter/freeze
or fps will drop
In scheduled, if your script is slow
U'll jsut make the scheduler slower
causing ALL scheduled scripts to hinge on slow scirpt
and ruin your framerate
Is there downsides to unscheduled scripts?
It doesn't complain about undefined variables, which may cause scripts to fail silently.
you shouldn't use unscheduled if you don't know exactly what you are doing.
It doesn't complain about undefined variables
Didn't know, thanks
in some cases*
In all cases.
lies
Example please.
either i'm remembering wrong or i'm crazy but i'm fairly sure i've seen an RPT entry about undefined vars from an unscheduled func
You dreamt that, alganthe.
Using the default value so It's ok for me
Maybe that was from
diag_log [_number, 8, _number == 8] -> [8, 8, false] thing
wait, that errors in scheduled?
Yeah, Error undefined variable in expression: _number
We really do need that sqf blog, so I can write down all the diffs between scheduled and proper environment
It is there
and you can write
Why don't you just do it
http://sqf.ovh ezpz
Carefully and biologically produced Arma 3 sqf training site
go make a PR commy
told him already
pls nerf
https://github.com/arma3/arma3.github.io/compare There ya go
like a month or two ago
Yes. I'm a design noob. I don't know how to do these things. Bux did everything. I only wrote the article
didn't even know flat copy existed
I still have to fix that one ace arsenal issue and finish the feature / framework doc overhaul but meh
didn't even know flat copy existed
That is why we need that post.
y u no make then
Shy?
I was a very shy kid, I think, maybe I just wanted to be left alone...
It's okay commy, I'm just picking cuz im shy too
@still forum Can you please tell which TFAR functions are performed when somebody change waves?
^ yeah sorry
correction, wave bender ๐
ARR_2
Latest pic from the profiler. Can now filter by threshold on top right. All frames lower than threshold will be hidden :3
Btw nigel. The profiler automatically add's measurement code to everything compiled with compile or compileFinal
But if you only compile one file that has all the functions inside it like myFunc = {} then it won't add measurement code into these as they are not directly compiled by the compile command
๐ค Why is ACE arsenal compiling campaignConfigFile>> "CfgUnitInsignia" >> "" and missionConfigFile>> "CfgUnitInsignia" >> "" and configFile>> "CfgUnitInsignia" >> "" and each of them twice in onSelChangedLeft? ๐ค
uniform tab?
must be the BI func I call to reapply the insignia
the var is restricted
[Control #13, 35] are the args to onSelChangedLeft.
fillLeftPanel [#1127001, #2010]
Could be uniform yeah
yep, uniform
The BI func doesn't have a scope though ๐ฎ
idc above 1e7 :^)
that BI func is all sort of fucked ded
Yeah. Probably
[ace_arsenal_center, ""] call bis_fnc_setUnitInsignia;
[ace_arsenal_center, ace_arsenal_currentInsignia] call bis_fnc_setUnitInsignia;
Where ace_arsenal_currentInsignia == ""
nowhere huehuehuehue
Am I the only one that finds the giant BI single file scripts like arsenal confusing?
Would be nicer imo if they split it up
arsenal is a mess anyway. even if split up
Still like the basic concept of having giant 1 file scripts
I do this only when prototyping a script
you can easilly open multiple files next to each other on multiple monitors. With a single file that's a little more tedious
like the n00b way of defiing functions ```sqf
my_fnc = {
};
But I later move them into separate files and functions library with a comment in front of every file
I wish I had multiple monitors...
You gotta get monitor and set it up vertically
Better for coding I've heard
Unless you are quicksivler
IN which case you need 3 widescreens to fit the code
3 widescreens. set up vertically. Stacked on top of eachother
I have 2 additonal monitors, but they're 4:3
You keep them around from 2005.
Those are awesome when writing papers though.
Hate the scrolling you have with wide screens.
Hi guys! Is only one way to do network between server and client trough public variables and messages? Or there is semethink better?
see remoteExec and remoteExecCall for example
You have publicVariable(Client/Server), setVariable public, and remoteExec(Call) and that is all you could ever need.
Does ownership apply the same to createUnit, so if I create one from server it will return 2?
AI units are local to the machine of the group leader.
So the first unit created in a group is a leader by default, or not?
The group leader is whoever has the highest rating/rank. If they have the same rating, then the leader is the previous leader until someone else overtakes them. And if you create two units, the first created will be the leader and is never overtaken.
thanks
What determines whether or not a helicopter can pick up an object? Having trouble figuring out a way to return all of the objects that a helicopter is capable of slingloading
The helis and the cargos configs.
Interesting.. BIS_fnc_colorRGBtoHTML also doesn't show up in the profiler.. Maybe it's all BIS functions
#include "..\paramsCheck.inc"
#define arr [0,0,0]
paramsCheck(_this,isEqualTypeParams,arr)
private _hextable = [
"00","01","02","03","04","05","06","07","08","09","0A","0B","0C","0D","0E","0F",
"10","11","12","13","14","15","16","17","18","19","1A","1B","1C","1D","1E","1F",
"20","21","22","23","24","25","26","27","28","29","2A","2B","2C","2D","2E","2F",
"30","31","32","33","34","35","36","37","38","39","3A","3B","3C","3D","3E","3F",
"40","41","42","43","44","45","46","47","48","49","4A","4B","4C","4D","4E","4F",
"50","51","52","53","54","55","56","57","58","59","5A","5B","5C","5D","5E","5F",
"60","61","62","63","64","65","66","67","68","69","6A","6B","6C","6D","6E","6F",
"70","71","72","73","74","75","76","77","78","79","7A","7B","7C","7D","7E","7F",
"80","81","82","83","84","85","86","87","88","89","8A","8B","8C","8D","8E","8F",
"90","91","92","93","94","95","96","97","98","99","9A","9B","9C","9D","9E","9F",
"A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","AA","AB","AC","AD","AE","AF",
"B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","BA","BB","BC","BD","BE","BF",
"C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","CA","CB","CC","CD","CE","CF",
"D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","DA","DB","DC","DD","DE","DF",
"E0","E1","E2","E3","E4","E5","E6","E7","E8","E9","EA","EB","EC","ED","EE","EF",
"F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF"
];
params ["_r","_g","_b"];
format [
"#%1%2%3",
_hextable select linearConversion [0, 1, _r, 0, 255, true],
_hextable select linearConversion [0, 1, _g, 0, 255, true],
_hextable select linearConversion [0, 1, _b, 0, 255, true]
]
https://github.com/acemod/ACE3/blob/master/addons/common/functions/fnc_displayTextPicture.sqf#L47
Maybe the ACE toHex function would be faster with that table and linearConversion?
What do you mean? toHex is also a lookup table, except that it's generated on the fly.
BI variant per hex byte
0.0342ms 0.0337ms 0.0335ms
ACE variant
0.0036ms 0.004ms 0.0044ms
Okey.. yeah....
Didn't see the lookup table because of dynamically generated ^^
The BI variant is slower because of 0-255 range,
But, it is ret... stupid to use linear conversion here.
Just multiply with 255, ffs.
I guess the clamp flag handles out of bounds, but why go for a lookup table then if you're going to waste time on input validation like that plus that paramscheck thingy from kk.
Oh, ACE handles out of bounds too, except efficiently:
_number = ((round abs _number) max 0) min 255;
All those parenthesis are superfluous btw.
@still forum Clock this one:
#define CLAMP(num) ((num) max 0 min 1)
if (isNil "commy_hextable") then {
commy_hextable = [
"00","01","02","03","04","05","06","07","08","09","0A","0B","0C","0D","0E","0F",
"10","11","12","13","14","15","16","17","18","19","1A","1B","1C","1D","1E","1F",
"20","21","22","23","24","25","26","27","28","29","2A","2B","2C","2D","2E","2F",
"30","31","32","33","34","35","36","37","38","39","3A","3B","3C","3D","3E","3F",
"40","41","42","43","44","45","46","47","48","49","4A","4B","4C","4D","4E","4F",
"50","51","52","53","54","55","56","57","58","59","5A","5B","5C","5D","5E","5F",
"60","61","62","63","64","65","66","67","68","69","6A","6B","6C","6D","6E","6F",
"70","71","72","73","74","75","76","77","78","79","7A","7B","7C","7D","7E","7F",
"80","81","82","83","84","85","86","87","88","89","8A","8B","8C","8D","8E","8F",
"90","91","92","93","94","95","96","97","98","99","9A","9B","9C","9D","9E","9F",
"A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","AA","AB","AC","AD","AE","AF",
"B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","BA","BB","BC","BD","BE","BF",
"C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","CA","CB","CC","CD","CE","CF",
"D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","DA","DB","DC","DD","DE","DF",
"E0","E1","E2","E3","E4","E5","E6","E7","E8","E9","EA","EB","EC","ED","EE","EF",
"F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF"
];
};
params [
["_r", 0, [0]],
["_g", 0, [0]],
["_b", 0, [0]]
];
format [
"#%1%2%3",
commy_hextable select CLAMP(_r) * 255,
commy_hextable select CLAMP(_g) * 255,
commy_hextable select CLAMP(_b) * 255
] // return
Keep in mind ACE toHex is one color, while this and the BIS one is all 3.
yeah. I reduced every test to just one byte
Hmm, how comes toHex is faster then? Lack of validation in params?
also removed the params. As I only have one number
Maybe the 0-1 range as opposed to 0-255.
commy_hextable is shorter than ace_common_hexArray ๐
Nothing beats:
call compile format ["0x%1", _hexnum]
call compile ("0x" + _hexnum);
``` ?
Dunno, unary + array, vs binary. Not sure which one comes out on top here.
code length, I win
speed, I don't know. If it's the same as in C#, string + string is faster as long as there are less than 4 strings
C# knows data types at compile time, sqf + has to check them for both sides during execution.
well, format too in this example
And + has a bunch of accepted data types. NUMBER, NAN, ARRAY, STRING.
format only requires an array on the right side. So it's only one arg to check and that can only have one data type.
ah, I see - 1 check vs 2 checks
I would guess the overhead of format will cover the 2nd, but we can only test to be sure
Yeah. Depends all on how these functions are implemented.
than*
though ... it probably wont be noticable by this piece of text
Also >should
YAY
results:
format: 0.0016โ0.0018
- : 0.0015
close
yup!
the thing is, it -may- be different if the string is bigger in SQF ๐
the variable name affects it too
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUโฆ
is pretty adequate in SQF, too
even can provide somewhat reasoning to why format has to be slower:
https://github.com/X39/sqf-vm/blob/master/sqfvm-cpp/stringcmds.cpp#L70-L118
a format implementation could look like this and why this is slower then just creating a new string having room for both in the plus should be clear to anybody
than*
will keep reminding you.
i know
and i actually appreciate it
ohh ... just noticed my format implementation is kinda broken ...
arma format has a 8k (iirc) char limit
I will do this then that = one and the other after
I would rather do this than that = I prefer one to the other
haaah I always think of this video when someone write mimimi ^^
wait, 8K? you're sure it's not 1K like diag_log?
assumption of mine is fixed buffer sizes
somebody just wrote
char formatbuffer[1024*8];```
It's 8192, alganthe.
numberArrayToHexString [128,128,128] -> 0.0058ms
Commys script -> 0.0071ms
BIS_fnc_colorRGBtoHTML -> 0.0554ms
ยฏ_(ใ)_/ยฏ
BIS_fnc_colorRGBtoHTML also takes alpha in consideration (I mean, ignores it)
some stupid podcast with 69 (huehue) views, you can safely ban
I don't want to click on it
numberArrayToHexString
You're terrible with these names, Dedmen.
LMS_fnc_ConvertArrayOfColourNumbersToHexadecimalStringToHtmlLikeFormat?
HTML like?
Topic: Support Modules vs Multiplayer/Dedicated Server.
I have put Support Requester and Support Provider modules like in Jester's video (https://www.youtube.com/watch?v=uTVhTWPdg1M). The difference was that I haven't used the Artillery support, but the Transport one, so I have an ability to call evac/transport chopper. I've synched the Requester module to the RTO unit and the Provider to helicopter of my choice. Synced both Support modules and it works perfectly fine when I preview the mission in the editor. However, when I try to run the game in multiplayer/dedicated server the support request icon/option doesn't show up when I select the RTO slot. How to diagnose and fix what's happening here?
Maybe the module doesn't work in MP.
setCurrentChannel 5; is that correct? because is not working for me
it seems to be that yes
@ember oak , you may want to accomplish something but going at it wrong; what exactly do you want to do?
@winter rose check pm
Do anyone know a script to close all doors with the nearestObjects? or if that is too hard just close all doors of the map.
https://www.google.com/search?q=arma+3+script+close+door Oh look.
https://forums.bohemia.net/forums/topic/147634-scripting-door-closing/ This google thing is amazing! More people should learn that it exists! It could make things so much easier
https://www.reddit.com/r/armadev/comments/3mc9ig/how_do_i_close_these_doors_on_mission_start/
If you wanna call me stupid you can just go ahead and say it, because I am not that stupid to not use google and test those scripts only to figure it out that it does not work or do what I want and come here to ask some one to give me the script or some other option.
You could atleast say that you tried it and it didn't work. Because if you ask people to give you a script to close doors. You should expect them to do that. And which is also what I did. I even showed you how I taught myself about how to do that. So that you can teach yourself next time and don't have to ask around.
How should I read your mind over the internet and know that you alread tried all this?
It sounded very much like you didn't even think of googling for it
I think it's worse than calling one stupid, it's calling one lazy.
So it doesn't work. Which map? Modded maps/buildings might be different than vanilla
Altis, vanila assets and only CBA instaled
Just checked what google told me. I'm standing in the middle of Chalkeia on Altis and that code does open and close all doors in a 1km radius around me without any problems.
sooo..... ยฏ_(ใ)_/ยฏ
what was the one you use? i tested all the ones in the topic and replaced with player for the test
0 = [getpos doorcloser,1000] spawn {
sleep 1;
{
private "_b";
_b = _x;
for "_i" from 0 to 7 do {
_b animate ["door_" + str _i + "_rot",0]
};
} foreach (nearestObjects [MissionAirportArea, [], 100])
}
That worked, i had to change the nearobjects to nearestObjects
How would i go about finding duplicates of a word in a string?
Since find returns the index number in the string right?
yeah. And find only returns the first occurance. You could.. After you find the first occurence cut that off and then search again on the leftover string
STRING select ARRAY
Hm, alright. I'll explore some options. Thanks dedmen, commy
Dunno what the end goal is, but maybe this helps:
https://github.com/CBATeam/CBA_A3/blob/master/addons/strings/fnc_replace.sqf
@gleaming oyster https://github.com/CBATeam/CBA_A3/tree/master/addons/strings may already have what you're looking for when manipulatig strings.
End goal is just to see how many times a word repeats, i'll take a look at this.
Hey why are scripts called with null or 0 infront, ex: null = [myunit,1234] execVM "test.sqf"
That's only a thing in the editor. If you see it used like that anywhere else, it's just a bad copy paste.
The editor wants every statement in the main scope of a script to have no return value. There is no reason for this other than bad design by BI.
ah, thanks
I mainly do Java programming so SQF makes me want to tear my hair out more ofent then not
than*
That's how you end up when programing in Java ๐
Let's ask this here: how to learn to like programming?
To me it feels like sitting alone in front of screen, blindly staring at that cold, lifeless machine and getting frustrated because it doesn't work like I want (lol)
I'd like to work with people, not with machines
Do I have any hope?
work with documentation and code written by other people and teach yourself
machines were also built by people
Learning is not the problem, the problem is that I don't like it
I don't get kicks when I get my code to work, I get kicks when I'm being human to someone... And yes, medicine is my dream career, but it has the drawback of not allowing me to work remotely which option I'd really like to have
The best thing about computers is that they never complain and don't have their own will or needs.
The best thing about computers is they do exactly what you tell them to
Yes.
The worst thing about computers is they do exactly what you tell them to
They don't correct themselves for minor mistakes you make by infering some goals of what you're trying to do.
Sitting down to code feels like entering a graveyard for me... I'm just staring at something that's cold and dead to me lol
I wish I would learn to like coding
You don't have the freedom to change want you want, free will is a lie.
Aside from tricking your brain with rewards from sugar pills or drug injections I guess.
I don't believe in free will either ๐
See? This is why I don't like people. I say something that should be controversial and then they agree.
x)
You could try to make something nice and useful, and then shill for it everywhere, so people thank you for your cool new feature.
If you don't seem to like coding. Then maybe that's just not supposed to be
like me
make something that takes you something like 3 months then shill it for the next year or so ๐
speaking of which commy, who's tasked to rewrite cook off before the tonk updoot?
ยฏ_(ใ)_/ยฏ
I still have to fix the arsenal cam over water but honestly it's so niche I might not even do it
it's such a pita
I've been thinking about industrial engineering too (which is focused on managing and leading high technology organizations in local uni)
But could you do it remote? Dunno
doubt it
The reason I'd like to have a remote job is that I'd really like to move from Finland to eg. Spain because of the warmth and sun... I suffer from severish depression during Finnish winters that are dark and cold
This is the best country in the world, we just have shitty climate three quarters of the year ๐
dude
Doc just put me on vitamin D test, will take it tomorrow
finland is dark, even if you eat and live healthily you need vitamin D supplements
Yes, I'll know soon how much I need to take it
The thing just is that a pretty big chunk of the health benefits of vitamin D seem to be related to the lifestyle that causes higher vitamin D levels than the actual level of the vitamin itself (even though it does matter too, for sure)
Uhm, offtopic?
Oh yes, let's move to, uhm, #offtopic_arma ? #general_chat_arma ?
is it possilbe to have a Website in a Dialog?
This is the closet thing: https://community.bistudio.com/wiki/htmlLoad
Or do you mean a hotlink?
this should prob be in the ask questions chat but is there anyone who could help me with the KP fuel consumption script it keeps throwing me the error "error generic error" i dont fully understand how arma is coded so it makes no sense to me.
Post the script, post the line it errors, someone will probably help. This channel is the right one for this kind of thing.
thats just it idk what line of the code its talking about when it throws the error
Check the rpt file. It should state which line.
ok
%LOCALAPPDATA%\Arma 3
ok i just relised i said the wrong script its the one by shiragami that throws that error. my bad :-:
/*
Author: Shiragami aka Skullfox
Description:
Changes the fuel consumption of the vehicle
Parameter(s):
0: Vehicle
Returns:
nothing
*/
_vehicle = _this;
[_vehicle ] spawn{
_vehicle = _this select 0;
while { alive _vehicle} do {
_tick = _vehicle getVariable ["fox_fuel_settings_tick", 1.5 ];
if (isengineon _vehicle) then {
comment "Data from config";
_rate = _vehicle getVariable ["fox_fuel_settings_rate", 0.00010 ];
_loadMultiplier = _vehicle getVariable ["fox_fuel_settings_loadMultiplier", 0.00005 ];
_tooFastRate =_vehicle getVariable ["fox_fuel_settings_tooFastRate", 0.00015 ];
_tooSlowRate = _vehicle getVariable ["fox_fuel_settings_tooSlowRate", 0.00005 ];
_crew = count( crew _vehicle);
_load = _crew * _loadMultiplier;
_speed = speed _vehicle;
_speedMult = 0;
if(_speed < 50 ) then { _speedMult = _tooSlowRate; };
if(_speed > 75 ) then { _speedMult = _tooFastRate; };
_realLoad = _rate + _load + _speedMult;
if (!isNil "FOX_FUEL_DEV") then {
hint format["Vehicle : %1 \n Crew : %2 \n Load : %3 \n Rate : %4 \n Speedload : %5 \n Realload : %6",_vehicle,_crew,_load,_rate,_speedMult,_realLoad];
diag_log format ["###FOX_FUEL_DEV DATA: _rate: %1 - _loadMultiplier: %2 - _tooFastRate: %3 - _tooSlowRate: %4 - _tick: %5", _rate,_loadMultiplier,_tooFastRate,_tooSlowRate,_tick ];
};
_vehicle setFuel ( (fuel _vehicle) - _realLoad);
};
sleep _tick;
};
};
i can only asume that it is throwing errors about line 27-30 or 45-47 but im not sure
Why are you not sure? Didn't look it up in the rpt?
The function header is a bit misleading. How do you execute this function? There is a potential problem with how the arguments are passed.
i have no clue and i cant find the rpt file. im not the best at scripting or that good when it comes to computers and finding files in the folders of games.
but ive been tring to trubleshoot this for the last month before comeing here
- Copy:
%LOCALAPPDATA%\Arma 3 - Press Win key
- Press ctrl + v
- Press enter
i feel stupid i even opend that folder and then just closed it like an idiot
btw you can get vehicle rpm/thrust values with https://community.bistudio.com/wiki/getSoundController
fuel consumption script based on just speed... is kinda wrong in general tbh ๐
Does anyone know a way to get the mission name in an SQF script?
Not the filename, but the Scenario Title that is set in Attributes -> Geneneral -> Presentation in the editor.
You can set it.
I don't know if it exists somehow in the missions namespace, prolly note.
not*
ARe you doing this in a way, where you don't already know the name of the mission?
It's a script for a mod that runs on every mission, our server has randomized file names. So the mission file name will be something like missionAW6FD.pbo so that isn't helpful at all.
set the mission name during runtime? No
Read: https://community.bistudio.com/wiki/Description.ext
I do not want to set the mission name during runtime, I want to get the mission name. Which is briefingName, in all my searching I couldn't find it, it was on the page.
is it possible to get the target position from the BI artillery dialog? like some onMapClick EH in its map control?
hello all, I'm rather new to mission making and a total newb to scripts and the community I play with already has a mission template for zeus, was wondering if there was a script I can add to a plane or heli so that whenever someone ejects they would spawn a parachute and would still have their current bag when they reach the ground, for paratroopers scenarios. ty in advanced for replies.
I googled and looked for the scripts but they're all for the Eden Editor which I can't touch, I'm looking for a script I can add as zeus while already midgame
is it possible to get the target position from the BI artillery dialog?
maybe something with:shownArtilleryComputerctrlEH (afaik idd is -1 for arty computer) andctrlMapScreenToWorldoronMapSingleClick๐ค
@fringe yoke not sure if this is the best way, but what you could do is set a public variable (Mission_Name = "missionAW6FD";) inside of the description.ext meaning manually do this in all of your mission files, just obviously change the string for each mission file. Then in an external script you could use the variable 'Mission_Name' to get the current mission files name.
He already found out that briefingName is the answer
ops, didn't read the second part
is there a way to make that has different things depending on who opens it
like if player 1 put a helmet in it player 2 could not see it
but player 1 still could
Probably.
Depending on what you're actually trying to do, as I can't really decipher it from the first post, it's either like 5 or up to a million lines of code.
im trying to make a box that works as a personal stash for players
just addWeaponCargo instead of addWeaponCargoGlobal
But why? That would only be interesting if the box would persist after disconnecting etc.
and the item will be local
Dedmen, but the item becomes global once you put it in by ingame inventory menu.
I'm thinking of createVehicleLocal.
Oh yeah.. That sounds much easier/better
Probably needs some method to delete them on dc, as I'm pretty sure these crates would get transfered to the server on dc.
The wiki doesn't say if they get transfered. If they do that should be written down. That's a kinda important info
It heavily depends on the type of object. I know that, at least a few versions back, vehicle vehicles became global once the owner dc'd.
This whole idea is kinda pointless if the boxes don't persist once you dc. And recreating boxes is a pain in the ass / impossible due to attachments etc.
<insert attachment sqf function rant thing here>
Yeah, been there a thousand times already. Dead horse.
but you didn't throw the completed solution into their face
There's none that satifies my autism. The moment they add it, I'll post this and a hundred other scripts.
You mean using intercept? What good would that do when no one is using it.
no
That's nice and all, but as long as it isn't in stable, no dice.
Also, I'd much rather have s/getUnitLoadout, but for boxes.
addWeaponWithAttachmentsCargoGlobal
WorldVisualWorld
Yeah. But wouldn't that be confusing. People might think you can use it to add items to a weapon that already is in cargo
(((triggered)))
but you create weapon with attachments first. And put the entire thing into cargo
addWeaponWithItemsCargo would also be shorter ^^
Lot's of cool stuff could be made, but never will, because the API is shit.
abstraction commy. abstraction. ๐
How'd that help?
It'll hide the shittyness behind a polished piece of glass
How would I go about making a dummy object such as a hat from being picked up, and preventing any actions from popping up on it. I've tried creating it as a simple object, disabling simulation on it, removing actions on it but nothing seems to work.
For some reason it still has the Take action on it.
what simple object did you try? from classname or model path?
Class name
classname can add stuff like actions and hidden selection textures
Ah really? Ill try with the model path, 1 second
It'll hide the shittyness behind a polished piece of glass
But we don't even have a turd stable enough to be polished. All we have is a pile of diarrhea.
Sure there are some undigested solid parts, but the bulk of it is slimey goo.
createSimpleObject ["Headgear_H_Cap_grn", AGLToASL (getPos player)];
createSimpleObject ["a3\weapons_f\dummycap.p3d", getPosWorld player];
What am I doing wrong here? The first one creates a dummy object, but I can't see it. The second one unsurprisingly doesn't create anything, not sure how I'm meant to put that into an actual hat class.
How do I turn that simple object into an actual hat though, like Headgear_H_Cap_grn for example. That dummycap.p3d seems to be the model used for all dummy caps, so I'm not sure how I make them different
???
sec+
Headgear_H_Cap_grn is a ground weapon holder (CfgVehicles). It uses a dummy model to display the model of the CfgWeapons class.
You need to use the model of the item (CfgWeapons) inside the cargo of that ground weapon holder.
And no leading slash. That was a mistake.
The first line simply creates the ground weapon holder, and as simple objects those probably don't display their cargo as proxies.
The second one is just an invisible dummy model.
Ah okay, I understand now. Cheers for explaining that, should be able to get it working now
Nice. Btw. AGLToASL (getPos player) is not format PosASL, because getPos reports AGLS, not AGL. It only happens to use the same z iff there is no object with pathway LOD below the object.
Just getPosASL
Ah okay, alright will do ๐
Would be sad if the item got stuck inside a rock, pier or the aircraft carrier.
That is true lol
How performance intensive are triggers? I've heard people say you should avoid using them, but I'm not sure whether its worth avoiding using them for something like messages for entering/exiting a specific zone
they check their condition every 0.5 seconds
If you need faster or slower then use script instead of trigger
if 0.5 is fine then just use triggers
Every trigger also is an entity on the map. It's like placing an ai, just to have a clunky interface of something that could easily be achieved by script.
I'd say place a marker and write the 4 lines of code for the zone into the init.sqf.
4 lines? So you would prefer just a simple while loop with a distance/inArea check for the marker?
Well, you would have way more control over what all it does.
Instead of checking all entities in an array, just check if the player is in that zone. And don't do anything on machines without interface.
And then you can also easily tweak those 0.5 s if you care, although two inArea checks per second are nothing.
Alright I think I might just do it that way instead. Considering I only want the message for entrance and exit of it, I'll just add in a couple of waitUntil's with a sleep for checking that
4 lines is not enough, sorry, but I'm thinking of something that is no more difficult than:
// init.sqf
if (hasInterface) then {
0 spawn {while {true} do {
waitUntil {
sleep 1;
player inArea "my_zone"
};
systemChat "entered zone";
waitUntil {
sleep 1;
!(player inArea "my_zone")
};
systemChat "left zone";
}};
};
I actually like "long" code. As in making each individual line not too long, breaking things down.
Hi, not sure where to ask this.
but is it possible to Broadcast/stream a spectator view from the server ? so u could link it to for instance to a website ?
I just put that 0 spawn {while {true} do { inside one, because it's essentially an automatism, and scrolling isn't as nice in discord as it is in a text editor,
Yeah I do too, was just kidding. By the way, is there any reason why you pass 0 to the spawned scope rather than an empty array? Is it slightly faster or
There's no reason to pass an array, and 0 is pretty much the simplest throwaway thing.
Literally null.
Preference I guess.
Fair enough
@fringe torrent Yes. Install a graphics card on your server. Then run the Arma 3 client on it and stream it somewhere with OBS or other software
wait, from the server?
You'd need a second instance of the game running as client @still forum
Ok thanx dedmen. Had hoped there was code or mod to do so.
Do i understand it right that a unit/ded body that got removeFromRemainsCollector will lie there till the mission is over?
wait, the garbage collector got fixed?
yes, for like 10 updates at least
Well it worked like i thought it should for my missions
hell BI removed groups from it and added a command to add them back...
so now groups don't auto delete after they're empty, unless that got fixed too.
Afaik they(groups) have a attribute for that now.