#arma3_scripting
1 messages · Page 457 of 1
so it detaches with but I am unsure why its not returning it.
{
detach _x;
} forEach attachedObjects player;
yes.. that code detaches it and doesn't return it...
"I attached the NPC to my Pelvis and everything was fine" 😮
Warning: 🔞 🚳
hmm
get it working 😄
"markertextsd12D22" setMarkerColor "ColorWhite";
"markertextsd12D22" setMarkerTypeLocal "KIA";
"markertextsd12D22" setMarkerText "Не входить! Ведётся военное положение!";```
private _marker = createMarkerLocal ["markertextsd12D22", player];
_marker setMarkerColorLocal "ColorWhite";
_marker setMarkerTypeLocal "KIA";
_marker setMarkerTextLocal "Какой-нить текст тут";
setMarkerText vs setMarkerTextLocal
Какая ето bуква
You didn't give me a b to copypaste :u
б Б < b
Какая ето буква
это*
lol
since Arma 2 I guess 😄
where you get that experience from tfar guys, Dedmen ? 😀
correct
no. I could choose Russian in school. And I did because I wanted to read the signs on cherno in DayZ
Электрозаводск = Powerstation 😃
Do Extended_PostInit_EventHandlers get run for every client that connects to the server?
for every client that has the eventhandler in his config
ok
Березино = Willowtree if i am not mistaken
Старый Собор 😄
Старый Собор = Old Market
березино - береза - birch
yeah
where all the birches are
Always wanted to continue learning it. But don't have time. So i'll probably stay at alphabet and a couple words :U
eta otschen kraciwui kniggi
😀
or kraciwaja kniga?
In class I got a very bad mark for singing a russian song. Now I'm humming it on my way to work
just like most other languages. Just small additional barrier cause of the alphabet
well yeah, japanese is hardest
😄
(probably)
🈵 🈚 🈹 🔣 🕉
omaewa mo shindeiru
NANI??!
Ohayo gozaimasu
kon ban wa
konnichi waaa
dat offtopic 😄
@meager heart do you write scripts in russian? do you know if russian variable names work in russia?
never tried tbh
I think it might be locale dependent. Russian letters might work in russia but not other countries. country specific scripts... wouldn't that be awesome?
private _scriptPath = localize "STR_scriptPath";
execVM (_scriptPath + "\myScript.sqf");
XD
you could already do that to dub in English or a different language ^^
russian variables don't work (just error)
._.
https://feedback.bistudio.com/T82940 The " Error: Object(4 : 13391) not found" spam in RPT. As I already suspected it seems that BI didn't fix the issue. Exactly as their changelog said. They fixed the "lag" caused by that, that afaik no one reported. But they didn't fix the actual issue it seems
after using "addMagazineTurret", how can i skip the reload process?
setWeaponReloadingTime seems to be a way, but is not really good
having a long reload time after spawning the unit might not be so bad after all 😃
Use infinity bullets lol
@still forum I actually asked a question here i think regarding the RPT causing lag due to filesize. I am so glad they fixed it
noLogs and SSD should be enough
very unlikely that they will
They should just change the reporting level of that stupid thing to debug and allow to be enabled if required by the CMD flag
I think we should all spam @lavish ocean with Object not found messages 😃
hue hue hue
a little background exe parsing your logs, automatically e-mailing one line of report 😄
How about one fixes the errors and drops the shitty mods?
If you read trough the report a way to reproduce it rapidly changing Gear on a unit . Make a loop with 100 itterations and your log gets spammed. So i agree maybe its caused by the mods but why does it happen when you changing backpacks too ?
This was the example given
for [{_i=0}, {_i<100}, {_i=_i+1}] do {
player addBackpackGlobal "B_TacticalPack_ocamo";
player addBackpackGlobal "B_TacticalPack_oli";
};
What kind of mission rapidly changes the gear like that?
Its a test
not that extensive, but zeus missions apply loadouts to freshly spawned units
at least my missions do that
That's silly. Might as well use diag_log and then complain about the rpt being big.
tf is a zeus mission?
That's also called zeus, yes. What about the mission part?
@little eagle What kind of mission rapidly changes the gear like that? Arsenal does it.
curator or what the plebs call it, zeus
not that fast of course. But even a hand full players setting up their equipment at mission start cause the problem
of course ><
😛
course means something. Ad of course means something completly different. wtf is this
1.70-1.80
-0.10 ?
ye they live underground normally
Why would I take ANYTHING written in a forum for granted?
Okey between 1.60 and 1.82m depending on stance
That's 10 people that have no clue talking about what I don't know either.
actually.. Between about 0.2 and 1.82m depending on stance
Yes, eating the dirt stance indicates your height :p
I want to add a man height at 100,200,300,400m to my debug reticle.
it depends on zoom and fov too 😛
Just place a vr block that has a defined size next to a unit that has no weapon equipped
1.8 for that then
alganthe, it will always be the same amount of milliradians.
No matter the fov.
1.8 it is.
I'm 1.90
on the battlefield, you're never standing still like a stick in the mud
so, 1.7 is a good measure for a stand-up position, even if you're 1.80
last time played battlefield long time ago 😄
is setCamUseTI usable in arma 3?
ty
0 spawn {
true setCamUseTi 0;
[player, "HAI 1.0 CAN HAS ? TI KTHXBYE", 80, nil, 270, 1] spawn BIS_fnc_establishingShot;
waitUntil {!isNil "BIS_fnc_establishingShot_playing" && {!BIS_fnc_establishingShot_playing}};
false setCamUseTi 0;
};
@molten folio
dat LOLCODE… I made a terrible mistake
@meager heart ty
not weaponLowered?
!weaponLowered if you prefer
I mean, a way to detect if the AI have the weapon lowered or raised (check the commets in the page)
nah, cant test it right now.
I may be able to, hold on
don't know what are you doing, but afaik ai's will keep weapons lowered only in safe behaviour, so maybe you can check behaviour, if it possible... 🤔
nop
if they are in "SAFE" mode but you lay down, they will do the same
and I just tested, still player only
AI some times walk with their weapons raised
it always returns false for AI.
oh well..
maybe parsing the anim name…?
stance _unit != "PRONE" + behaviour check 🤔
so why tf cant you use weaponLowered in this case again?
STANCE Amov: Sras - raised - aimed weapon ready for fire in horizontal position Slow - lowered - weapon in ready state, not aimed
Those names are not consistent for all animations. I wouldn't rely on them.
Can someone test if
seems to only work on players ?
I did - player only
well, for normal AI anims it should be fine?
I would toArray the anim name,
grab S position, the 3 letters after and check if they are ras or low
commy said it already, that animation state name, will change, Lou
that is anim name AinvPknlMstpsnonWnonDnon_medic_1
that is state on that anim amovpknlmstpsraswrfldnon_amovpknlmstpsnonwnondnon
and there you have X number of states
for 1 frame of animation
and funny thing that is will report only final state, not elements... if that make sense
🤔
grab S position, the 3 letters after
so that 3d letter could be anything
till anim done
BUT
you need not the last state ?
😕
well, go weaponDirection if you must then 😄
~~via animationState:
_animation = animationState _unit;
_weaponLowered = ("slow" in _animation && !("sras" in _animation));
```~~
Could you potentially do something with (animationState _unit find "sras" > -1)
↑ <string> in <string> seems not to be in Arma yes 😄
Yeah, have to use find
Good thing is that animationState already returns lowercase, so no need for a toLower
probably yes (about to find sras 😄), but idk is it reliable for different animations
not a 100% proof solution but will sure help 99.8 times
hence both check, "slow" and not "sras"
"Number: Delta Y, Text will move up or down depending on value (Optional)"
can some one add a note that the value of the number you set effets the speed that its moves
like
1 goes downwards fast
0.1 goes downwards really slow
1 = height of the monitor (or safeZoneH I don't remember)
make Duration ×10 and it will move at the same speed
it's an offset, so the more you set the further it will move
is it possilbe to add more functions to thissqf buttonSetAction [1009, "[] spawn AdminVehicleList"];
in the quotes?
Is that a trick question?
i looked at it doesnt help
Does that look like commas would make sense?
nvm
is it possilbe to add more functions to this
buttonSetAction [1009, "[] spawn AdminVehicleList; [] spawn anotherFunction; player setDamage 0"];
@molten folio
why button setaction at all ?
(_display displayCtrl _idc) ctrlAddEventhandler ["ButtonClick",{
[] spawn blah;
[] spawn blah;
}];
thanks @winter rose
Would BIS_fnc_addScriptedEventHandler be enough for mission like liberation or should we look into CBA custom event system?
What is the biggest advantage from using cba system? Better locality handling?
doesn't it depend on the event in question? i think the BIS stuff is limited to certain events. mostly end game and zeus stuff by the looks of the wiki
You can define your own events via bis function.
@astral tendon Done https://community.bistudio.com/wiki/BIS_fnc_dynamicText
Thanks
The listed events are events that are fired by various bis scripts.
i think i'm blind. can you point me to the function?
the one I named...
for eg. ```sqf
[true, "KPLIB_sector_capture", {hint "Sector captured" + _this select 0}] call BIS_fnc_addScriptedEventHandler;
And later you can fire it via:
[missionNamespace, "KPLIB_sector_capture", ["sector name"]] call BIS_fnc_callScriptedEventHandler;
I'm just wondering what is the advantage of CBA handlers.
we have default ownerchanged scripted EH for the sectors
Scripted event is always on the local machine, while cba has global, remote, target, server event etc.
I'm not using bis module for sectors @meager heart
Also, the overhead of scripted events is pretty bad from what I remember.
For CBA too or BIS stuff only?
I guess internaly it holds something like an array of handlers and searches for one with given name to be called?
Some overhead might be acceptable if it does not fire frequently.
It's a hash on a dummy "object".
Yeah, the functions are stored in an array.
Well, some CBA events fire every frame.
In medical and fatigue.
Ok, ty for info. I think I will go with bis events for now as I want to use it on things that dont fire "too much" eg. "sector captured", "player bought unit" etc.
Btw., you read what I wrote about the vectors and positions this morning?
Me? I was not asking about anything vector related recently. 😛
But I've read that 😄
Omg, oh well, someone did.
^^
I see BIS scripted events look almost the same way I wanted to implement this when I did not know there is their implementation of this.
https://community.bistudio.com/wiki/BIS_fnc_addScriptedEventHandler 🤔 never seen that before lol
So you actually can detect if arsenal is opened.
Couldn't you just see if the display is open?
absolute
?
!isNull (findDisplay _idd) ? 🤔
dont forget you need waitUntil and proly while for that.
I hope scripted EVH does it better, tho 😄
does it better what ? 🤔
Couldn't you just see if the display is open?
!isNull (findDisplay _idd)<
ez
is it working ? https://community.bistudio.com/wiki/BIS_fnc_neutralizeUnit 😀
soldiers are blown up by mine
vehicles are shelled by artillery
air units are hit by AA missile
underwater units are simply killed.
looks like nice function
works! 😄
But I dont actually see mines explosion or artillery coming
there is
would EH would be used to detect when a bullet hits anything, killed, hit, or deleted? im using the fired EH to attach a EH to the bullet ,this is what I got
_this addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
_projectile addEventHandler ["Deleted", {
params ["_entity"];
"Deleted EH fired" remoteExec ["hint"];
}];
_projectile addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
"Killed EH fired" remoteExec ["hint"];
}];
_projectile addEventHandler ["Hit", {
params ["_unit", "_source", "_damage", "_instigator"];
"hit EH fired" remoteExec ["hint"];
}];
}];
and no hints are made
when a bullet hits anything
probably only withhiteh
but when you add it to a unit and when unit is hit
also withfiredyou can wait untilisNullprojectile but that not when bullet will hit something (when EH was added in the right way)
Dude.
CfgAmmo objects don't support any eventhandlers.
Period.
Sorry, no patience today anymore.
its ok
Not your fault, I had to explain someone how an EOTech works.
nah np man, all cool
probably the worst is a ricochets or when projectile already penetrated some object... 😀
Is it possible to run a script once on server start?
init.sqf
if you do not want to add the script in every mission you could also make a mod which runs that script post or even pre init.
@little eagle Isn't that for the start of a mission?
I want a file that runs when a dedicated server is started
That is not how things work. If there is no mission loaded, technically there are no userscripts running.
so you pretty much just want a script to run once on misison start
Well, depends on what Brett wants to do.
There's always a way. I got groups renamed in the lobby.
The question was if it was possible, not feasible. But depending on what's to do here, it may be easy although obscure.
I am fine if I need to use a mod, but the thing I want to do takes upwards of 10 seconds.
and does not require a mission be loaded
Check put CfgFunctions preStart or if CBA, Extended_PreStart_EventHandlers.
That's some addon config classes that can get either a function to run or a config script at session start.
ah, can't believe I didn't check there. that should work. thanks.
It is very strangely named. "preStart", to me it seems like, a program cannot do anything "before started".
onGameBoot = 1;
or something is how I woulda shoulda coulda.
too bad there isn't something like postMissionInit and postClientInit / postServerInit
that would make a bit more sense
I know, just saying it would be nice to have more EHs with more intuitive names
True.
But it seems like the scripting community was/is just as bad as it as BI.
Or maybe it's consistency, consistency on a low level.
@fringe yoke If you have your mission on autostart you could use https://community.bistudio.com/wiki/serverTime to determine if the server just started or not
The server does not just run one mission
preStart looks like it should work, but I can't test atm
What are you doing? Keep in mind the mission namespace is whiped at mission start, so use ui namespace if this is for caching.
I am dumping an all in one config to disk
If you make it persistent and autoinit it will pick aossion though if correctly configured
But that would mean you'd either have to set one specific mission with the code to check if the server just started
Or have the code be in all missions
If the server is on auto start anyway, one could just set a flag in ui namespace to not do the same thing twice and use preInit. OPTiX, doesn't sound like a work around like that is needed here,
Much more reliable than serverTime guessing.
Posted it before knowing what he wanted to do 😅
Didn't know UI namespace persists over mission change
That's the point of it. And it's another horrible name.
It should be named caching namespace, because that's its main purpose really.
Or sessionNamespace.
I added that info to the wiki.
That's a a really terrible name then......
I would have NEVER expected uiNamespace to be session persistent
morning performance 🤔
So
would there be any performance improvement in sqf
I have an array with data for ai/groups
Which will be like [group,patroldistance,cachingdistance etc. etc.]
right now I do
_aiArray call cache;
_aiArray call patrol;
_aiArray call alter;
etc.
in all of those I use params
if I just use params before calling those and then
just call them with no parameters
It doesn't do those params commands and assign new variables, whcih are used in all of those
yes, params does local variables (_var)
So I'm wasting a lot of time doing the local variables
?
Like in every function
It just creates new local variables
Wasting precious fps
So my question is
Using an object and getVariable instead of that array. Would actually be a lot slower, right?
If I have an array and I lay out the data before hand
Then call all the functions
vs
I call the functions and lay the data needed out in every one of those
vs
https://community.bistudio.com/wiki/call
you can do
params ["_myVar1", "_myVar2"];
[_myVar1, _myVar2] call blah1;
[_myVar1, _myVar2] call blah2;
[_myVar1, _myVar2] call blah3;
I call the function and grab data from an object instead
I can just do
_aiArray params ['_cache','_patrol','_altert','_fight'];
call ai_patrol;
call ai_cache;
call ai_fight;
and those variables will be available in there anyway
This shoudl be faster then saving into a new namespace anyway?
Another thing
wouldn't it be even faster
if I have multiple arrays
and I use index
please, one big message
_aiArray params ['_cache','_patrol','_altert','_fight'];
[_cache, _patrol, _altert, _fight] call ai_patrol;
[_cache, _patrol, _altert, _fight] call ai_cache;
[_cache, _patrol, _altert, _fight] call ai_fight;
yeah
but
I don't even have to relay the variables to the function
If I already define them
_var1 = '5';
call {
systemChat _var1;
};
does this ↑ work?
Sure
so you're good to go with your solution
yeah
But
I'm contemplating getting variables from a new namespace I create.
The new namespace would be easer to access, but
_cache = aiNamespace getVariable ['ai_cache',[300,500]];
vs
_cache = aiArr_cache select _i;
What are you trying to do exactly ?
optimize
does it need optimising?
because if so, you will get more performance working on these:
https://community.bistudio.com/wiki/Code_Optimisation
I realized iterating through ~500 ai groups will take me ~2 seconds
but this is because my fps is ~50-100
Sometimes fps goes lower than that.
So at around 20 fps it takes like 8 seconds to iterate through 500 ai groups
And so on
@peak plover why not use missionNamespace on the server then? a public variable, no underscore, but without transmitting to the client
I was using a location for namespace
I don't see the point, but okay
_cache = cacheArr select _i;
_patrol = patrolArr select _i;
_fight = cacheArr select _i;
_alert = cacheArr select _i;
call ai_fight;
call ai_patrol;
call ai_cache;
vs
_aiArray params ['_cache','_patrol','_altert','_fight'];
call ai_patrol;
call ai_cache;
call ai_fight;
vs
_cache = _namespace getVariable 'ai_cache';
_patrol = _namespace getVariable 'ai_patrol';
_alert = _namespace getVariable 'ai_alert';
call ai_fight;
call ai_patrol;
call ai_cache;
#2.
Is it faster to have multiple arrays in 1 namespace containing all info and use iteration.
Or is it faster to have 1 array and keep all the data for a group in there
or is it faster to use a namespace
This is not premature 'tho
this is after the fact
That I'm being limited to ~200 groups to keep things running 'ok'
use solution #2 , and as I said:
does it need optimising?
because if so, you will get more performance working on these:
https://community.bistudio.com/wiki/Code_Optimisation
a poor var assignation is not going to save you 5 FPS.
also, use solution #2: params
It will if there's tons of data and tons of iterations that I need to do < 3 seconds
If it's more than 5 seconds, fast moving vehicles will cause players to see ai spawn in in front of them when uncaching etc.
even from switching from private [] to private _blah I saw like huge gains a while ago
Which one of these is correct syntax?
if (_isHQdeployed && _i == 1 && _extra == "") then {
or
if ( (_isHQdeployed && _i == 1) && (_extra == "") ) then {
The latter I assume?
All of them. since those are all and conditions all of them have to be true
grouping them results into the same result every time
all you can do is optimize the condition so it returns false earlier without the need to check all 3
Ah, I see it was a bad example, let me make a new one
(Haven't drunk my morning coffee yet lol)
if ( (_isHQdeployed == 1) && (_extra == "") ) then {
or
if ( _isHQdeployed == 1 && _extra == "" ) then {
both equivalent
I see, thanks! 😃
if you want to stop on the first encountered "false", you may want to use lazy evaluation like
if ( _isHQdeployed && { _i == 1 } && { _extra == "" }) then {
but on such small conditions it is not worth it
Yup
parenthesis are useful if you have an || (or) and you want a certain order to be evaluated
Alright. Thanks for the tip 👍
does the function getDamage exist ?
pretty weird that’s there is setDamage and getDammage
no, there was a typo which will not be corrected due to legacy reasons, there is
https://community.bistudio.com/wiki/getDammage
and its alias
https://community.bistudio.com/wiki/damage
alright thanks
I've asked this question before, but unfortunately wasn't able to figure out the issue. Does anyone know what could cause the 'Continue' button in a RscDisplayDebriefing to force the player out of the server fully compared to just the lobby role selection area? I'm calling this: ["Abort", true, false] call BIS_fnc_endMission;
Sometimes its fully out of the server, other times its just to the role selection screen. Not sure what causes either.
I don't know if this could be the cause.
if you use something else, does it work properly?
What do you mean by use something else?
["Abort", true, true] call BIS_fnc_endMission;
"EveryoneLost" call BIS_fnc_endMissionServer;
something like that
This is just per player, I don't want the mission to end for everyone. It's basically called in a script which is called when the player clicks the abort button in the escape menu. My way overrides the default Abort button and runs this custom script instead, which ends with ["Abort", true, false] call BIS_fnc_endMission;
Just very confused why it's only sometimes kicking them out fully
maybe this specific command is not the problem, it may be a global issue
@winter rose Figured out the issue. I was running a script that closed all open displays and I didn't exclude some important ones which seemed to cause this issue
👍 !
@peak plover yes params outside of calls is better.
and select is faster than getVariable.
@winter rose stop giving bad advice 🔨
what did I say again
advising him to take all parameters out. Then putting them back together and passing them as argument just to take them out again.
I'm confused… anyway
I reckoned that, thanks for confirming
But dedmen
What about 1 array per group
vs
10 big arrays and selecting _i to find info for certain group
again. getVariable is slower than select
No
I mean
_groupArray = [_group1data,_group2data];
vs
_group1data_1 = _data1 select _i;
_group1data_2 = _data2 select _i;
Hi gents, im trying to select a trigger via a name given to it as triggerText setTriggerText as the trigger is dynamically created and its variableName is not known. Is it possible to select a trigger near a marker (its spawned with same dimensions as a marker)?
_list = (getMarkerPos _mkr) nearObjects 1;
systemChat str(_list); systemChat str(_mkr);
_trigger = _list select 0;
if (typeOf _trigger == "EmptyDetector") then { systemChat format ["Deleted %1",_trigger];deleteVehicle _trigger;} else {systemChat format ["Tried to delete %1 but it wasn't a trigger ;(",_trigger];};
Ignore the shitty debugging, im just trying to see that it is returning the correct thing, but unfortunately it always returns https://i.imgur.com/YeRfC82.png "helipadempty.p3d" however when I do it as a player with:
_list = player nearObjects 1;
_trigger = _list select 0;
systemChat str(_trigger);
When im right ontop of the position, it returns the correct thing of <no shape>
you have to get the data out of both variants @peak plover
Big arrays don't have performance impact. select is constant time if you know the index that you want
So. Go for the route that needs less select's
Yes, but is it better to store a lot of data in multiple arrays or multiple smaller arrays in a big array?
Okay less selects is so much prettier too
"better".
with the big array you first have to get the small array out
and with multiple arrays the question is how do you get to them?`
Above you showed using getVariable to get the multiple smaller arrays.
and as I said getVariable is slower
gotcha
I'd say have one big array. With smaller inside.
And always make sure to modify by reference if you do lots of modification
public. Its multiplayer
for some clarity. https://i.imgur.com/TP7MkmS.png. The red one has a trigger created over it. I know the name of the red marker and the triggerText of the redMarker but I can't delete the trigger because I need to know its name
why are you only getting the first element that was found? What if the trigger is the second? you should check all elements that nearObjects returns and find the trigger
Well firstly when I increase the area doing it the first way, its not even detected unless its via "player". Secondly my theory was if the range was 1 and the trigger was spawned exactly on top of the marker, there was no way it could be anything but the trigger in element 1
So it's like clear squares mission/
Insurgency! :3
My advice is that having a trigger per square with house will cause lag
Don't do it
Create markers - > markers into array - > ```sqf
{
private ["_side","_marker"];
_side = nil;
_marker = _x;
_pos = getmarkerPos _marker;
{
if (position _x inArea _marker) exitWith {
if (side _x isEqualTo east) then {_side = 0;};
if (side _x isEqualTo resistance) then {_side = 0;};
if (side _x isEqualTo west) then {_side = 2;};
};
}count allunits;
if (!isNil "_side")then{
[_side,_marker]call {
params ["_side","_marker"];
private ["_side","_marker"];
if (_side isEqualTo 0) exitWith {
_marker setMarkerColor "ColorEAST";
_alpha = markerAlpha _marker;
_marker setMarkerAlpha 1;
_marker setMarkerAlphaLocal _Alpha;
};
if (_side isEqualTo 1) exitWith {
_marker setMarkerColor "ColorGUER";
_alpha = markerAlpha _marker;
_marker setMarkerAlpha 1;
_marker setMarkerAlphaLocal _Alpha;
};
if (_side isEqualTo 2) exitWith {
_marker setMarkerColor "ColorWEST";
_alpha = markerAlpha _marker;
_marker setMarkerAlpha 1;
_marker setMarkerAlphaLocal _Alpha;
};
};
};
true
} count ins_gridmarkers;
Yea essentially like Insurgency. Im making everything myself mostly out of learning and some more control of things
don't use triggers. Just store the list of markers and periodically go through all of them to check them
I made that a few years ago, use that for inspiration if you wanna
So at the moment, the player themselves checks if the square is clear and all that works just fine. I've got the enemy unit spawning/caching all made myself with no dramas (its probably kinda horrific but its pretty efficient)
Oh so it would be better to loop through the markers?
trigger per square <<<<<<<<<<<<<<<<<<<< markers in array and check them via inArea or sth like that
You can heavily optimize with findIf or such
LMAO, just realized I have params and private array 🤦🏻
was about to ask why both ~_~
Nah aha I didn't plan on it. So really quickly, how are you suggesting to loop through the markers to achieve the same effect that I have currently with my triggers that are spawned on the markers?
The triggers are much larger than the marker itself so it spawns the units for that marker way before the player is actually in it
Ohh, you use the triggers to spawn the units?
Yea yea. So basically what I need is, when the square is blue(or void of any hostiles anymore) to delete the trigger so the process I have doesn't then spawn more units
I've got all the bits im describing already except for the ability to delete the trigger
because I can't give the trigger a variable name (thanks arma) and don't know how to detect it any other way
once I can select it and delete it I can work it from there
just a nudge/some pseudo is awesome
create a location for every square (createLocation) On server or HC.
Create a marker and setVaraible to the location. (also save a variable that u can identify this location from normal locations)
loop through the PLAYERS (there are less players then grids) [bear in mind locations are only available to where they are created] {if headless client crashes everythign breaks}
https://community.bistudio.com/wiki/nearestLocations
if player has a location ~700 meters -> activate it (spawn ai) [you can add a setVariable (location) and onKilled EH for the ai to save the amount for that location]
Move activated location to separate array (you can check if the activated location has no players near it now(~1000m) and (delete) the units if no players at it.
For persistence you can have a function that creates a savable array from the locations and their variables or sth like that.
You can access the information like marker or alive units or whatever for that specific grid with _location getVariable ['insLoc_marker',''] etc.
Might not be the fastest, but quite easy to manage as opposed to arrays for everything. Location and setVariable is like Object Orientated Scripting. U can also delete a location and such and such
hmm, in the long term that does sound more ideal
Need to redo a fair chop of things, but im getting close on malden already to probably too many triggers and i've hit a wall a bit with my issue as above
Good food for thought and I think really the best way to do it. cheers @peak plover i'll need to rework things
Yeah, I loaded up a insurgency mission on takistan with all triggers and the performance was TERRIBLE
It goes great on Malden or smaller. Any bigger, yea performance really eats it
Another cool trick you can do is check if the locations have a location near them and spawn a vehicle or a bigger enemy force if there's a huge cluster of grids without any manual input on setting up cities etc.
Like here
debug circles
Oh yea fuark i didn't think of that benefit. I started to code my stuff around detecting nearby markers and stuff but its a bit messy
Don't worry if it's messy
Just make it work
And then iterate over your code and optimize
If you try to make it perfect first time around, you will never get anything done
I literally make some things and then realize I need more features or sth doesn't work as planned, So I just make a copy of the whole thing and start one over while using the original code as inspiration
Yea no nothing i would have got done if I tried it perfect
anyone know to use: https://community.bistudio.com/wiki/BIS_fnc_moduleCurator ?
@late gull every BIS_fnc_module* is a function that is called by an editor's module - in this case Curator module
yes, but isn't possible use it by code?
it is, but most likely not recommended
@peak plover thanks for your detailed writing about "locations". Might be useful for liberation rewrite. 😄 (using markers currently)
No problem ;)
Glad you find it useful!
hey @peak plover
_looping = true;
[_looping] spawn {
_looping = param [0];
waitUntil {PMF_GridsDone};
while {_looping} do {
{
_nearbyLocations = nearestLocations [position _x,["NameCity","NameVillage"],PMF_ActivationDistance];
{
PMF_ActivatedLocations pushBackUnique _x;
}forEach _nearbyLocations;
}forEach playableUnits;
{
//[str(_x)] call EO_Render; // Spawn the units
}forEach PMF_ActivatedLocations;
while {(count PMF_ActivatedLocations) > 0} do {
hintsilent format ["%1",PMF_ActivatedLocations];
};
};
};
This is the sort of track im on atm. Im confused as to having the reverse effect of players near location not locations near player
🤢
Im sorry @little eagle 😭 I said it wouldn't be neat 🤣
Alright done that, it didn't list that as an available location type
_nearbyLocations = nearestLocations [position _x,["Invisible"],PMF_ActivationDistance];
{
call {
private _isInsLoc = _x getVariable ['loc_isInsLoc',false];// this is set when location is created
if (!_isInsLoc) exitWith {};
private _isActive = _x getVariable ['loc_isActive',false];//
if (_isActive) exitWith {};
_x call PMB_fnc_activateLocation;
};
}forEach _nearbyLocations;
jesus christ.....
I'd do sth along those lines
Sometimes the magic is too magical even for me.
🤔 what did he mean by this
that we both got an aneurysm from reading this
🤔
gotta learn some how @lone glade thats why im here, unfucking my things 😃
Feel free to pitch in 😆
oh hell naw, i've already given enuff
at my level of knowledge, functional is better than the levels of optimization yourself or commy aim for in larger projects
I wonder why you wrap it in call {...}; in the forEach? Are doing it to use exitWith as "continue" that you can find in "normal' languages?
exitWith in loop scope "breaks" loop, doesn't it?
exitWith also breaks the loop without the call didn't read the code
in that case
It exits the call <code> block
Not the loop
It's to avoid if (then)
you use a call each loop, which is worse
and also doesn't make sense because it's less readable
^ true
So you kinda "emulated" continue.
a simple if would be better
It is worse?
you could use a switch
I guess it is less performant as it creates another scope.
I did a few tests once and I tried multiple conditons and if (cond)then {} etc.
And i got the fastest results by running the least amount of code everytime
call {
if (cond) exitwith{}
}
means it will only run the necessary checks
if i recall correctly if then else is slower than call if exitwith
in some cases
I didn't test it long enough to know EVERYTHING about it
But I just remembered that call exitwith is fastest way to do it in sqf.
Also I find switch hard to read.
call exitwith just makes sense to me 🤷🏻
this function:
https://github.com/alganthe/ACE3ganthe/blob/master/addons/arsenal/functions/fnc_fillRightPanel.sqf
takes 3ms to run
the calls to add the list entries (for 600+ items) take 147ms
@lone glade can u swtich the switch with call exitwith ? 🤔
if I want to make it slower and less readable sure 😄
I think my hand went through my skull after facepalming this hard
that's because the exitWith actually exits. The switch runs till the end
I have concluded the same. I'll use call exitwith until I can prove other methods faster 👆🏻
i'm fairly sure that should be the least of your worries right now
Also...
_nearbyLocations = nearestLocations [position _x,["Invisible"],PMF_ActivationDistance];
_nearbyLocations select {_x getVariable ['loc_isInsLoc',false] && {_x getVariable ['loc_isActive',false]} && {_x call PMB_fnc_activateLocation; false;}};
may not need the false at the end depending on what activateLocation returns
and a _newArr = before 2nd line
no
you are not using that. So why store it in a variable?
the fastest if is _cond && {<true code>}
I'm not sure actually. Only if-then-else vs. cond-&&-||
the difference in speed is so minimal it may as well not exist^
You're the one defending count vs. forEach, alganthe.
does a while loop wait for a ForEach loop to finish before continuing?
okay uh
the while loop executes it's code before continuing
because otherwise... How should it run faster than it... runs.
paradoxon
does a while loop wait for a ForEach loop to finish before continuing?
Code is executed from top to bottom.
yea I see the spectrum in what I just asked the moment I asked it and re-looked at my code... I did a silly...
😕
I don't see any benefit of using modelToWorld for spawning an object.
Its for a life server, im trying to work with custom house's and having troubles with spawning vehicles
Wait, spawning inside a house?
so the house is in a random position that you don't know. And you want to get the position of the garage to spawn the vehicle inside it?
I place the vehicle in the garage where it should spawn then log the position and the vehicle doesnt spawn in the position i had set
how are you spawning it?
Did you use getPos?
use NONE as special placement
I think it's a problem of using getPos returning AGLS when AGL is needed.
🤦
holy fucking shit
script. Not config.
you guys hardcode the pos of the garage
Its default altis life.
I think that's supposed to be a position relative to house
you sure? 270m in the air? 😄
6700 meters relative?
As I said. I don't care about life crap. You are asking a scripting question so I expect you to show me the script that has the issue
If that config is the issue. Then ask in a life forum. We don't know what that is
Yeah, should ask life devs how it works. It's not scripting.
Sounds like life yeah 😄
I've never worked with non vanilla house's to be honest. First time
They are not really different. Houses are houses
Interesting, don't see one message from you in the other discord 🤔
Honestly, they don't help much just get ignored half the time lol
Lets not claim things then
So you DM a few people instead of publicly just asking thousands that might help you like you did here?
I've publicly asked yes, but no response
@cold pebble your search is incorrect. You have to include the ID
1 sec
your discord searched for a from: without a name and some message containing "Drunken" and "Cheetah"
Well. His answer was correct. https://community.bistudio.com/wiki/vectorWorldToModel that's the way to do it
Last time I checked you weren't ignored at all ^_^
why are you asking on how to use modelToWorld after someone told you to use worldToModel?
I meant worldToModel by bad.. and I honestly forgot that guy even replied lol
...
Lifer problem solved. Next please.
Arma is rather trans friendly, then?
no. Men only.
There are some 3rd party womans. But they aren't as good as the vanilla men
my joke was centered about Arma not having woman
women*
are you trying to say my joke was bad?
and it does have a woman being represented
remember the skype call that last through LOW?
My Terrain When
no Arma doesn't even have woman. women would need multiple woman
no I don't. Me not played low
well you hear the voice of a woman through skype, meaning that arma has a woman
woooo man.
OFP had Angelina
ArmA 1 had the "the Thing" reporter
Arma 2 had grandmas and hookers (both?)
Arma 3 has LoW Skype chat
no Arma doesn't even have woman. women would need multiple woman
SET THEORY
The only thing I like even more than linear algebra.
What was the command to get the position of a memory point in a model? I thought there was one
selectionPosition
Hey, is there a simple way to transform an array into a string, without using the dirty way splitString & joinString ?
Also, if the goal is to create a string out of an array, how would splitString help if it does exactly the opposite???
transform an array into a string?.... str
aaaaaand he ruined it ^
Also, toString .
format ARRAY
no, toString doesn't do what you think it does @errant jasper
Well,depends on what the array actually is.
It doesn't convert an array of unicode code points to a string?
Maybe it's an array of ASCII codes.
true, but I doubt it
unless he wants to smash together each element and make a string out of it? 😛
Ahhh now I know what he meant
I think, he want just to string the array with all elements inside
lol
_array = [1,2,3];
_arrayAsString = "ARRAY";
There.
Put quote marks around it!
i mean transform this :
[0,0,0,0]
into :
"0,0,0,0"
"[1,2,3]"
@still forum 😆
[0,0,0,0] joinString ","
How is that dirty? That is as good as you can get with sqf.
i'm still failing to see what splitString has to do with this
And the fastest way too
And the fastest way too
naive
What's problem with joinString or str [1,2,3]
_data = [0,0,0,0];
_data = str _data splitString """[]" joinString "";
you got a " extra
That's just wrong.
🤦🏻
_data = [0,0,0,0];
_data = _data joinString ",";
splitStringToArrayString
@lone glade its not extra...
Brainfart
Yo dawg, I heard you like to join strings, so I split some strings for you to join.
This does the same thing, but with less digging holes to fill them up immediately after.
is enough
str _data splitString """[]" joinString ""; wao..
str _data select [1, count str _data -2]
I wrote "," and not "". Don't you see the comma?
Maybe discord eats commas now.
OpenOffice, which I am stuck with at work atm. ate my .xml doc.
Never trust computers.
I don't trust programs written by humans.
guys i'm trying to create a sort of battle royale game mode with no mods and i'm trying to make a script that makes a zone that gets smaller and killes everyone outside of it after a warning
i'm a bit new to scripting so i would appreciate the help.
I have an idea on how to implement this with as little effort as possible.
ive tried to do it with triggers only but it doesn't work out (to many triggers[150])
depends on how much you're willing to pay for it
haha, funny.
It's like 15 lines of code. If you pay for this, you're being ripped off.
Why do you want money all of the sudden, alganthe?
If this gave money, it would be work, and work is no fun.
I got a lil' bag of chocolate for ACE3 Arsenal commy, it all went downhill from there
yes
He's awesome.
most delicious chocolates EVER
dam commy2 a real community helper never thought that this community was this awesome
Is that how you write it?
swiss*
okay.
suisse if you meant to write it in french
🐸 🐌
Serenity, I'll just write something very basic but functional after dinner, and maybe you can expand on that later.
ill try ^^
what you get for winter?
but thanks man
it's discord ded
dinner I meant
no idea but i got nothing
I keep forgetting words or getting magic autocorrect
you mean discord is secretly modifying my messages to make me think my brain is focked?
e*
lies
c*
How do I check if a marker exists?
_marker in allMapMarkers but that seems crappy
Good enough.
https://community.bistudio.com/wiki/getMarkerPos
If a non-existing marker is referenced the values returned are [0,0,0].
what?
what?
no.
This will be better than triggers, believe me.
humanity is the wrong second thing
setMarkerType "ELLIPSE";
This errors, how the hell do I create a marker in this game? -.-
setMarkerShape
Shape, not Type
Silly me.
@sonic ocean Behold!
https://gist.github.com/commy2/cf987d99a6c43a0777369e8a9ff9d69b
Here it is. I made this also for you, @lone glade , I hope you like it.
that's 67 lines though.. not 15
you gotta remove some of these useless newlines to make the script faster
grr. Give or take 50 lines. What's that between friends?
Depends on what friends
This took me almost 15 minutes to make including testing. I am disappointed in myself.
[] spawn {
_title = 0;
if (true) then {_title = "test"};
hint str _title ; //works and show t"est"
};
[] spawn {
if (true) then {_title = "test"};
hint str _title ;// error undefined
};
Some one care to explain why this happens?
shrinking_matchzone! sounds dangerous 😄
Well, how is this trope named?
I have no idea, Arma is the only video game I played in the last 10 years.
local variables are defined in the current scope and visible in lower scopes
I am seting that at the if statment, so why is undefined?
Roque_THE_GAMER , check there examples https://community.bistudio.com/wiki/private 😀
because that's how scopes work
Roque, variables carry over into child scopes, but not parent scopes. It always matters which scope your variable belongs to.,
though, why can i edit it on a child scope?
Still waiting for alganthe's comment on my script.
Because variables carry over into child scopes which commy just said
Because the assignment operator without private does walk through all parent scopes and changes the variable if the identifier is already used in a parent scope.
Which is why assigment without private is a much more complicated endevour than assignment with private, even though it looks shorter written down as script.
I don't think PBUG did this first.
This same rule aplies to script load order?
what is "script load order"?
I don't understand either.
no. init.sqf always executes before postInit
Never check this, Dedmen.
yeah bad example
Could be world view altering.
it probably doesn't
Who knows, they're scheduled and we all love that.
@little eagle thnx man
Does it even work?
not tested it yet but i believe
Good answer.
@little eagle can this work on a server ?
lol
is has isServer inside it.. What do you think? 😄
let me be retarded
The only place this wouldn't work is in SP or local host when using savegames, because you said "no mods" and options are limited without recreating a whole scripting library.
and also one more retarded question how do i activate it
i feel bad
knowing nothing
Do you know what init.sqf means?
yes
Well, the script says in line one, "place me inside the init.sqf".
At least your replies are intelligible.
lol
Sometimes it's like talking to chimps.
i placed it but still does nothing do i need to set something in game?
🤔 That's weird.
Go to
%LOCALAPPDATA%\Arma 3
And search for the latest RPT file
Then open it with some editor and copy paste the contents to pastebin or something similar.
And then post the link here.
no arma 3 in there -_-
LPT: Use "Everything" search tool by Void Tools to find any file on your system instantaneously based on various criteria (e.g. ".rpt")
C:\Users\<user_name>\AppData\Local\Arma 3 < try this @sonic ocean
thnx
%localappdata%\Arma 3
That's what I posted, no?
I hope windows will appreciate your efforts and decide to find the files.
maybe he don't know where to put that... (%localappdata%\Arma 3 < that) 🤔
19:38:16 Error in expression < spawn ENGIMA_CIVILIANS_StartCivilians;
S>
19:38:16 Error position: <S>
19:38:16 Error Undefined variable in expression: s
19:38:16 File C:\Users\quint\OneDrive\Documents\Arma 3 - Other Profiles\Sgt-I%2eSerenity\missions\PVP.sara\Engima\Civilians\ConfigAndStart.sqf, line 27
19:38:16 Error in expression <ceCPR_probabilities = [40,40,15,70];
med1 additem "adv_aceCPR_AED";
med2 addi>
19:38:16 Error position: <med1 additem "adv_aceCPR_AED";
med2 addi>
19:38:16 Error Undefined variable in expression: med1
19:38:16 File C:\Users\quint\OneDrive\Documents\Arma 3 - Other Profiles\Sgt-I%2eSerenity\missions\PVP.sara\Scripts\ADVMEDICALSETTINS\case0.sqf, line 8
i do i didn't chow up please stop moking me
There's a script error in the mission. If the code I posted is written after this, then it's probably never executed or something.
k il set it front
it works now but i don't see anything on the map
no zone so i don't know if i'm inside it i just get killed
hmm, strange. It was supposed to show up as blue marker.
private _radius = 100;
private _position = [0445,0490,0];
Maybe increase the _radius? 100 meter is maybe too small and you missed it.
can i change the private position?
Sure. To whatever the center of the circle should be.
@little eagle can this be activated by a trigger so the script only runs when a trigger is activated
Sure, but it has to be a trigger that is executed everywhere.
why not in a certain area
Do i need to put it in a diffrend sqf file for the trigger activated
@little eagle
So last sunday we were talking about checking if units are around area. You said that checking with allUnits inAreaArray position "beats all".
I've checked that and it seems that using nearEntities is faster.
Am I missing something? 🤔
Also I don't get why The more units are found by count variant of nearEntities was consistently a liiiitle bit faster than findIf (I was using bis performance benchmark thingy but I've used it a lot of times to get average because it seemed to return inconsistent results.)nearEntities the slower count method will be.
yeah but nearEntities can check only sphere zone instead of inAreaArray that can check rectangle and ellipse
And number of allUnits when testing ?
It is in my gist. I've tested on single unit and 100
Yeah, fuck me, didn't see
looks like setAnimSpeedCoef in action 🤔
Am I missing something?
Well, everyone inside a vehicle or static weapon for starters.
@meager heart It's like road runner whenever you have it super high, your unit runs in place for a bit then ZOOOM
😉
@meager heart Its it exactly.
scriptName "fn_grantSuperpowers.sqf";
params["_unit",objNull];
_unit setAnimSpeedCoef 10;
better try this
0 spawn {
[
player,
"Maximum speed",
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\transport_ca.paa",
"\a3\ui_f\data\gui\cfg\Debriefing\enddefault_ca.paa",
"true",
"true",
{player setAnimSpeedCoef 1},
{
private _progress = param [4];
player setAnimSpeedCoef (linearConversion [0, 24, _progress, 1, 5]);
},
{player setAnimSpeedCoef 1},
{player setAnimSpeedCoef 1},
[],
10,
0,
false,
false
] call bis_fnc_holdActionAdd;
};
😄
pictures is a bit off...
@gleaming oyster
lol
what is the easiest way to check if vehicles are occupied by anybody (ai/player) ?
_occupied = count crew _veh > 0;
?
well yeah...
~~I wonder if this would be marginally faster ```sqf
private _occupied = (crew _veh isEqualTo []);
don't know... probably fullCrew kinda more reliable way
@ruby breach it will be faster. But return invalid results.. So it's kinda useless
why _shooter has any?
player addEventHandler ["HandleDamage",
{
params ["_unit","","","_source"];
private _shooter;
if((_source != _unit) && (side group _source == side group _unit) && (lifeState _unit == "INCAPACITATED")) then {
if(!(isPlayer _source) and ({_source in crew _x} count allUnitsUAV > 0)) then { //if UAV crew,
_shooter = (uavControl (objectParent _source)) select 0;
} else { //if just AI or team player
_shooter = _source;
};
[_unit, _shooter] remoteExecCall ["fnc_teamkill_Feed"];
};
}];
because that's not how private keyword works
it should actually be a syntax error.
private is a modifier to =. You don't have a =
also
if(!(isPlayer _source) and ({_source in crew _x} count allUnitsUAV > 0)) then {
_shooter = (uavControl (objectParent _source)) select 0;
} else {
_shooter = _source;
};
->
private _shooter = if(!(isPlayer _source) and ({_source in crew _x} count allUnitsUAV > 0)) then {
(uavControl (objectParent _source)) select 0;
} else {
_source;
};
thx 👍
Attachto to memorypoint, the object attached follow the memorypoint if memorypoint moved by an animation ?
nope
well, it does "follow it" but only like it would if you attached it via object center
Does this work?
{
_test1 = _x
{
if (_test1 == _x) then {
...
};
}foreach arr2;
}foreach arr1;
define "work"
yes. It doesn't crash the game and it's not a syntax error.
If you get the value return from the last forEach it crashes your script though
i dont use the bool outside the second foreach scope. and what exactly crashes this script?
nothing crashes that script
if you get the returned value from the last forEach it will crash I think
because the first forEach doesn't return anything. And the second...
now you changed the script..
Yeah to clarify. Sorry
yes that works. No it doesn't crash anything
good. thanks 😃
if you're asking if you can nest foreach then yes
It was more a question if it would work this way to bring the magic _x into the second foreach.
The array items are represented by the magic variable _x.
From the wiki 😄
Why does https://community.bistudio.com/wiki/forEach not list that. I could swear I saw that on there
I heard you liked foreach, so I put a foreach inside a foreach inside a foreach huehuehue:
https://github.com/acemod/ACE3/blob/master/addons/arsenal/functions/fnc_removeStat.sqf#L22
you must've misheard something
{
if (_x select 0 == _currentID) then {
_currentPage deleteAt _forEachIndex;
};
} foreach _currentPage;
That loop is bugged
lies
Example if it should delete every element like that. It would only delete half
after each you delete it skips one
again, big fat phony lies 😛
you can't have 2 stats with the same ID, you can't have 2 stats with the same ID in the same page
so that array can only contain the ID once?
da
Why are you not using find then :U
I wrote that whole API in a day, don't expect much from it 😄
I do though
uuurgh, fine, want me to replace it with find? I got an open PR where I could stash it
nods
shit, I was expecting you to never answer back, now I have to replace those 3 lines
wait, I can't count, that's 5, plus I have to find a snarky commit message.
"FFS these pesky furries"
@still forum It's not a syntax error, because it assumes private STRING or private ARRAY and the input is undefined. Since it's an eventhandler and therefore runs unscheduled, it fails silently.
_shooter = "_shooter";
private _shooter;
;~)
ah right
AH, I remembered why I didn't use find ded!
because there can be more than one? in which case it's still broken?
nope, because currentPage indexes are arrays not strings
nope
findIf then
oh shit you got me
Wait
THIS WAS MADE BEFORE FINDIF
because [ ["ID1"], ["ID2"] ] find "ID1" doesn't work duh
nope, still wrong