#arma3_scripting
1 messages ยท Page 490 of 1
PussyublicVariable ๐ค
PubicVariable
stealing my ideas even though I don't tell anyone about them
Just mentioned Altis loading screen hint saying: "Once upon a time I was living in a fire-breathing volcano"
Someone got tired of writing those hints? ๐
alright so im trying to edit a public script to add items to the ground instead of a players inventory if the inventory is full. The base script is: /* Harvest the good shit by GolovaRaoul */ private ["_player","_weed"]; switch (true) do { disableUserInput true; _weed = nearestObject [player, "CUP_p_fiberPlant_EP1"]; deleteVehicle _weed; systemChat "Started Harvesting the Good Shit Man"; if(vehicle player != player) exitWith {}; for "_i" from 0 to 2 do { player playMove "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon"; waitUntil{animationState player != "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";}; sleep 2.5; }; systemChat "You hands are all sticky, but you harvested some good shit man! Go sell the money at Trader City!"; disableUserInput false; player addItem "CUP_Item_Money" exitWith{}; };๏ปฟ
I am replaceing player addItem "CUP_Item_money" with if (player canAdd "ITEMNAMEHERE") then { player additem "ITEMNAMEHERE"; } else { _hemp = "groundweaponGolder createVehicle position player; _hemp addMagazineCargo "ITEMNAMEHERE"; _Hemp setPosATL getPosATL player; };
However, after making that edit, the script no longer runs, and i have no idea why
i of course replaced "ITEMNAMEHERE" with my correct class
No longer runs as in errors out, nothing happens, added just to player but not ground?
nothing happens
addMagazineCargo takes array instead of class name
And use addMagazineCargoGlobal instead
^ im assuming thats the issue. Will test and let you know
switch (true) do {....not a single case or even default...} ๐ค
^ i noticed that too. But it was the base script so i dunno
That is one fucked up base script, I suggest you forget what you saw ASAP and never ever use scripts from that guy ever again
In this case using case is a real case.
disableUserInput, so user friendly ๐
cant let them look around when harvesting that sweet mary jane lmao
also if you need place some items on the surface (not in the air above) use "WeaponHolderSimulated"...
There is setPosATL getPosATL and player already should be on surface
exitWith is not a stand alone operator and even if it was, there is semicolon is missing after player addItem, so it is not real script, he probably collaged it together with no clue
He probably replaced his attempt with original addItem line and forgot semicolon
Oh an btw disableUserInput sometimes glitch out not giving controls back even if false was done. Seem to mostly happen when your PC lags a bit.
maybe that was the plan ๐
aslo that uber script has errors, maybe you can try -showScriptErrors startup param...
That param being client or serversided? Im assuming client seeing how it relates to on-screen?
Im assuming client seeing how it relates to on-screen? ty for the repeat ๐ was just double checking
aslo that uber script has errors, maybe you can try -showScriptErrors startup param... Error: Word aslo, expected also
i don't have that param for discord...
meh, casuals
Yeah, also having a game logic and setting it's owner to hc to remoteExec ['function',headless_object];
Could someone help me with this?
" alarmH = nil;
this addaction ["ALARM ON", {if(isnil "alarmH") then {alarmH = createSoundSource ["AlarmC_sound", position player, [], 0];};}];
this addaction ["ALARM OFF", {if(!isnil "alarmH") then {deleteVehicle alarmH; alarmH = nil;};}];}"; "
https://gyazo.com/9505e337837804f0c50f6cc0087e11a0
โ
Im trying to look up a guide for a custom alarm to use via scroll wheel but my luck is running out. >.>
for that kind of "on/off" ^ switch things you can use one addAction and change the text with setUserActionText
also what you did there is not "MP friendly"... ๐
action_id = this addAction ["ALARM ON", {
params ["_target", "_caller", "_id"];
private _alarm = missionNamespace getVariable ["var_alarmSource", objNull];
if (isNull _alarm) then {
private _source = createSoundSource ["Sound_Alarm", _target getPos [0, 0], [], 0];
missionNamespace setVariable ["var_alarmSource", _source, true];
[_target, [_id, "ALARM OFF"]] remoteExec ["setUserActionText"];
} else {
deleteVehicle _alarm;
missionNamespace setVariable ["var_alarmSource", objNull, true];
[_target, [_id, "ALARM ON"]] remoteExec ["setUserActionText"];
};
}];
```something like this ^ @grizzled rain
probably dude is gone already... ๐
๐คท
say3D but will need config
anyone know how i can get a script to call on all vics of a certain type
Whatโs vics?
^
Victims?
vehicles
@tough abyss https://community.bistudio.com/wiki/playSound ?
No shit! ๐
get all vehicles with vehicles then filter your type with select and isKindOf
any way i can do it based off of vehicle id
trying to remove ammo from a heli on mission start
and its not for a scenario
{if (typeOf _x == "victypeโ) then {...whatever}} forEach vehicles; @marble basalt
noice
having issues getting the helis ID anyone know how
what "ID" ?
the name i need to pull to have the script effect all of the helis of that type
like B_heli_transport_01_F
but doesnt seem to be working
@tough abyss what does _x standfor
ok
are you sure you have vehicles of EXACTLY that type?
not %100 but pretty sure
type in the name and thats only one i can see in editor
or atleast of the heli im useing
also you can > <something> isKindOf "helicopter"
heres what i got
if (isDedicated) then {
{if (typeOf _x == "CUP_B_UH1Y_Gunship_Fโ) then {removeMagazinesTurret ["CUP_PylonPod_7Rnd_Rocket_FFAR_M",[-1]]}} forEach vehicles;
}
else {
};
ok so how can i do this
In my showDialog.sqf I have a waitUntil statement that is polling for a variable. When using closeDialog 1 to close this Dialog and open another afterwards the waitUntil logic is still polling. When spamming to open the mentioned Dialog I'd expect the polling logic to stack so I'd see like 5-6x times the amount of messages appearing (debug message of the waitUntil code). So a waitUntil will only die out if the condition goes true? Even when the scope is killed (which I thought closeDialog 1 would do)?
Killed dialog != killed scope
I see
Have a check inside waitUntil for this dialog to end
Do you have display as variable in that thread?
Ehm yea I stored it in a private
do waitUntil {something || isNull _display};
Otherwise somehow terminate the thread if dialog is closed through onUnload event
So when closing the display isNull _display yields true?
When you open the dialog, save its display in variable and then do isNull _display check to see if dialog associated with your script thread was closed.
Alternatively save your script thread into some display variable and then terminate it when dialog closes, this might be simplier actually
u mean
_myDisplay setVariable ["waitUntilCode", _waitUntilCode]
and then using it within
waitUntil { call _myDisplay getVarible "waitUntilCode" }
Not really
How do you start your script thread when dialog opens?
execVM \ spawn in onLoad event I assume?
by call
From where?
spawn in onLoad event?
nah in the chaining of initPlayerLocal.sqf
So you do createDialog 'something' and then spawn after it?
Aw shucks, need to get off right now.
Anyway, you either check inside your spawn script that dialog was closed with isNull check
Or assign your spawned script to display with variable and then terminate it when display closes on onUnload event
createDialog 'whatever';
0 spawn {
_display = findDisplay 12345;
waitUntil {!alive player || isNull _display};
if(isNull _display) exitWith {};
// something else here
};
createDialog 'whatever';
0 spawn {
_display = findDisplay 12345;
_display setVariable ["script", _thisScript];
_display displayAddEventHandler ["Unload", {
terminate (_this select 0 getVariable ["script", scriptNull]);
}];
waitUntil {!alive player};
// something else here
};
And i'm off
Two ways to approach this
And instead of displayAddEventHandler you can do some call on onUnload in display config too
_x removeMagazinesTurret ... @marble basalt read wiki
Thank you! @meager heart Do you know if theres and guide? for doing this? Haha
Is there any difference between [_x] call X11_fnc_myFunction and _x call X11_fnc_myFunction
Because when it comes to CBA_Hash I have to use [] it seems because the values disappear if not
Same as the difference between [x] and x
hm that makes a bit sense since a CBA hash is a helluva nested array
Yeah. CBA hash takes an array. And for params to properly take that out it might have to be inside a nested array like [[x]]
Alright thx - that produced so much bugs for me ๐ฆ
is it save to always use [] ๐ also for only one arg
no
If the function properly uses params. Then [] or not doesn't matter in most cases
But it's best to always look at the function header and check what arguments it expects
if it doesn't have a proper header, throw it away
Is there somewhere to look for default arma stringtable values?
Well. you can look into the Arma stringtables
is there somewhere in game? or just in the game files?
I was hoping for an online resource
language_f.pbo
Ah fuck ...
params ["_profile"]
This is how I declared my params for a 1 arg funciton
this is wrong right?
If I want to have calls without []
What is the way to have a single argument func parameter
When I dont want it to trim an given array
is there a way at all? or do I have to make sure to give an array argument with [] around?
Oh I thought there was to add custom sound and such that can be played via scroll wheel from an object
Just use _this
ah this is actually the param array right?
@frigid raven exactly what you asking about > https://community.bistudio.com/wiki/params
Dedmen's comment there
yea but how to properly avoid the CBA Hash being trimmed? Type contraint on array?
So it knows - the argument value is actually an array and there doesnt need to be... ehm trimmed to the first index-value ?
params [["_cbaHash", EMPTY_HASH, []]]
Will this be a way ? Gonna try it out now anyways
Well... Read my comment https://community.bistudio.com/wiki/params ?
That way will only work if you pass a nested array
meh sorry I was triggered to try out stuff before reaching your comment :/
Now I get it tho
follow the white rabbit Dedmen's comments
What is the action name for tailhook?
check BIS_fnc_AircraftTailhook from inside, maybe you will find something there ๐ค
OK thanks ๐
probably hardcoded...
Turns out that is a custom action
You can trigger tons of things using the action command. You just need to find out the name of the action and it's parameters.
Which are mostly undocumented
BIS_fnc_AircraftTailhookAi < has all of the animations
@meager heart yep, that was my issue, I didnt know about that func and I just wanted for the AI to extend its tailhook
๐คท
Thank you ๐
Does anyone happen to know of an easing script? For camera or for control movement
uhh
This?
Also camera has camCommit
Shouldn't that work as easing?
camCommit with 5 seconds and change the direction and commit again at 2.5
something like that
I was looking for something done via scripting, not in the editor
Hello fellow scripters!
In my course of developing my eXperience Modย I made a tracking shot script, which creates smooth curves out of 3 or more Waypoints.
...
ENGINE Fixed: Attenuation for transport internal sound yeah bitches! Sounds good ๐๐
Pun intended
using the value returned by surfaceNormal would it be possible to determine which direction the slope of a terrain goes?
like determining which way is 'up' on the side of a hill or something
Hello!
I try to make a soldier constantly shoot at a pop-up target (at a firing range). I put
"while {alive this} do {this doSuppressiveFire scheibe; sleep 10;};"
in his init field but it returns "undifined variable" and he does nothing - how to fix that? (scheibe is the variable name I gave to the target)
what is the name that it says isn't defined?
this
also I don't think you can use sleep in a unit init field
@runic surge
_sn = surfaceNormal getPosWorld player;
_dir = (_sn select 0) atan2 (_sn select 1);
if(_dir < 0) then {_dir = _dir + 360};
hintSilent str _dir;
thanks @meager granite
I don't get how you can figure that out so easily
I'll test that
atan2 is a way to go to calculate angles, applicable in lots of places
You can do that through vector* commands too but I think it will be bit more lengthy
@meager granite That link should help, thanks!
Is setVariable/getVariable the same as in the editor typing a string into Variable text field?
set/get variable, sets gets variable on object/namespace/location...
If you type some name into variable in editor it is kinda an equivalent to doing ```sqf
missionNamespace setVariable ["typedVariable", <this_object>];
What is the canonical event when a player finally spawn first time in a mission?
Besides "Respawn" if sb. wants to mention that
Is there a script that would allow me to walk up to letโs say a supply crate and choose units that I need?
like adding units to your group?
Let me explain. Iโm doing a police style mission with tasks that will randomly pop up, each one is different, I need the ability to pick the guys I need for the task. For example if Iโm at the police HQ And a riot gets called in I need to choose the number of swat members that I need! Or for a search and rescue I need helo pilots and ground searchers
if you need an example script tho
think that is what you want eh? see how others did it
yea the yellow is definitely missing
yes thatโs perfect! I saw it before on a creative server and couldnโt find it thanks!
} forEach (SpawningHeli + SpawningPlane + SpawningCar);
OR
} forEach SpawningHeli + SpawningPlane + SpawningCar;?
They're Arrays ^
Another thing Iโm trying to figure out. I downloaded a few good police and gun mods for my mission and they have sirens and lights is there a way I can have all ai react to them by either pulling over and if thatโs to complex, then just stopping
From an approach i'm thinking of would be quite complex.
Either one is ok @drowsy axle binary op foreach is lower precedence than + https://community.bistudio.com/wiki/SQF_syntax#Rules_of_Precedence
Okay
@tough abyss would the IF statement at the bottom work? ```sqf
CAP_Helicopter_Classnames = [
"RHS_AH64D_wd"
];
SpawningHeli = false;
for [{i=0}, {!isNil ("Helicopter" + str _i)}, {_i = _i + 1}] do {
private _Helicopter_obj = missionNamespace getVariable ("Helicopter_" + str _i);
CAP_Helicopter_Vars pushBack _Helicopter_obj;
private _Helicopter = (CAP_Helicopter_Classnames select _i) createVehicle [
((getposATL _Helicopter_obj) select 0),
((getposATL _Helicopter_obj) select 1),
((getposATL _Helicopter_obj) select 2) + 0.2
];
_Helicopter setDir (getDir _Helicopter_obj);
_Helicopter setposATL [
((getposATL _Helicopter_obj) select 0),
((getposATL _Helicopter_obj) select 1),
((getposATL _Helicopter_obj) select 2) + 0.2
];
if (isNil ("Helicopter_" + str _i)) then {
hint "Helicopter Spawning is Finished";
SpawningHeli = true;
};
};```
Yeah you need brackets there, isNil is Unary, so it has prio over +
MP you?? no, but I might PM you.
I don't know how to express this feeling in SQF.
Depends on if the variable with name "Helicopter_<value of _i>" is undefined or not
Okay and when it becomes undefined it's true.
But your if statement is outside of loop so _i in str _i is undefined
If _i is undefined, str _i is undefined , adding to undefined makes result undefined, and isNil undefined is also undefined. if (undefined) will not execute at all
Enable errors
Right i get that logic now
if (isNil _i) then {
hint "Car Spawning is Finished";
SpawningCar = true;
};```
isNil "_i"
But I donโt think you can test if car spawned this way as it makes no sense
Also you asked only about bottom if statement but your whole code above it is broken in more places than you can count, so ๐คทโโ๏ธ
๐
so i was doing _HP_classes = [configFile >> "CfgVehicles" >> _vclass >> "HitPoints", 0] call BIS_fnc_returnChildren; in the hopes to get the names of the sub-classes as string. Instead i got the paths (e.g. bin\config.bin/CfgVehicles/myTank/HitPoints/HitHull)
What can i use instead to get just the string names of the child classes instead of the path?
configProperties maybe
so editing the server.cfg, looking at onHackedData, would adding this code both show the hint and kick the player after 60s?
_steam = parseText "<t color='#db0f26'>Steam Mod Collection: </t><a href='redacted'>redacted</a>";
_att = format["WARNING %1!",name player];
_text1 = parseText "<t color='#db0f26'>You seem to have some data that is modified in some way!</t>";
_text2 = parseText "<t color='#db0f26'>Make sure to use A3Launcher to download the correct mods, or use steam workshop to download them directly!</t>";
_att hintC [_text1,_text2, _steam, _discord];
sleep 60;
kick (_this select 0)";```
does selectRandom reliably produce a 50/50 result or nah
i imagine it does
as it iterates more
i just want to be sure
if you need 50% chances you can just if (random 1 >= 0.5) then { or if (random 100 >= 50) then {
i don't need EXACT 50/50
i'm just trying to pit semi-even number of players against each other for one last battle
exact split isn't necessary for me
also, this is going to sound hilariously noobish, but i'm having a brainfart -- how do i add a value to an array? I.E -- i have a position, i want to add 200m of altitude to said position
well, add 200 to the Z value
vectorAdd [0,0,200]
vectoradd works in this case? nice
i knew of that command i just didn't know if that was what i wanted
arigatou
@wide hamlet no
Try configName on each result @austere hawk
@tough abyss so how can i show a custom notification when they have unsigneddata/hackeddata while still kicking them
You canโt
@tough abyss thanks that does the trick. configProperties (with isClass filter) also just returns the path, just as the function does
no way at all? Fuck ight
btw if you trying to get the hit points better just > https://community.bistudio.com/wiki/getAllHitPointsDamage @austere hawk
i must get both, in correct order and with correct inheritance -> config level
that command also contains hitpoints from Turrets for example, also reflectors and so on
"true" configClasses (configFile >> "CfgVehicles" >> _class >> "HitPoints") apply {configName _x}
iirc there could/will be missing points ๐ค
_HP_classes=[];
{ //forEACH
_HP_classes append [configName (_x)]; //extract config names from path
} forEach _HP_paths;``` - thats what i have now. Yes, it just extracts hitpoints in main vehicle class - which is exactly what i need
is there any good guide out there that explains all the commands and concepts regarding vectors?
So my group and I have been getting a lot of great usage out of the Liberty, but there aren't ways to really store vehicles on it properly. When you unload them from a blackfish, they tend to spawn inside of the ocean, so we're making a script using worldtomodel that will put the vehicles back onto the ship. Its working out pretty well so far using hold-actions, but I wonder if there's a better way.
@tough abyss yes selectRandom is supposed to be uniform distribution. If you don't want that you can use selectRandomWeighted
@tame lion the BI wiki has all the commands and explains what they do
@tough abyss Marshalls, actually
Sorry, to clarify, I was more so looking for an explanation of how to do vector style scripting. I know its all involved in finding the relation of positional/rotational/speed of objects, but I'm not sure how to use that in scripting. I guess what im really asking for is a good math lesson lol
@tough abyss We put them inside of the giant hangar. You can fit 2 rhinos, 4 marshalls and like 30 infantry in there and we put the blackfish on the aft deck
Yeah, we've repeatedly gotten the blackfish to land back on the ship no problem but we can't jsut get the APcs back on
We do aircraft carriers sometimes, we even have the funky LHD mod. But sometimes the liberty has a really cool feeling to it. We'll see what happens with holdactions
Is there a way to set target(cursor) for player?
you mean. Move the players cursor? Via script?
Not really. You can use setDir to rotate the player. But you can't really move.....
Okey I think there is a script command to move the mouse around
with that and a ton of math you could probably do it
Sorry my bad, I should say cursorTarget. In other words to make player lock target
Well. As I said. Use script commands to move the mouse cursor of the player such that it aims onto that target. And then you can use disableUserInput to disable all input of the player so that he can't move away by himself
@still forum Noo ๐ I mean to lock target with scripts so it looks like this :
https://imgur.com/a/rMJMieq
Oh.. cursorTarget returns that thing? ๐ฎ
https://community.bistudio.com/wiki/lockCameraTo Didn't try that
https://community.bistudio.com/wiki/doTarget (Probably only AI stuff)
https://community.bistudio.com/wiki/setPilotCameraTarget
Yeah tried them none work unfortunately :/ setPilotCameraTarget is only for PilotCamera
use action to cause the "switch target" action and repeat till cursorTarget returns what you want ๐
thats one way ;d
Wut? How do you move mouse by script that is not a cursor on the control @still forum ?
Wait. Letme look it up ๐
Ahhhhh... Derp
ACE uses setVectorDir to rotate the player.
There was a ACE Pull Request that wanted to add a "mouse movement" Extension which was never merged
I mean you can replace player with AI brain and order it to aim somewhere then put player back but this is just ๐คฎ
setMousePosition ๐ค
so uh yesterday i was getting the paths unexpectandly and wanted just the class name
Today i thought i'd just use the paths i already got to extract some of the data. Seems i dont know how to use the path correctly
private _vclass= "Base_chassis";
private _HP_paths = [configFile >> "CfgVehicles" >> _vclass >> "HitPoints", 0] call BIS_fnc_returnChildren;
private _y = _HP_paths select 0;
// example: _y = bin\config.bin/CfgVehicles/Base_chassis/HitPoints/HitHull
private _param_name= "EVDS_hittype";
private _retrieve= (_y >> _param_name)call BIS_fnc_GetCfgData;
diag_log ["retrieved hittype first",_retrieve];
if (isNil "_retrieve") then {
diag_log ["Param first Nil, retrieved hittype second",_retrieve];
_retrieve= [_y,_param_name,false] call BIS_fnc_returnConfigEntry;
};```
returns 'any' for both logs
you can use
```sqf
```
For proper syntax highlight
now in color
so _retrieve is any but _y is not?
BIS_fnc_getCfgData geturns nil if the config entry doesn't exist
like if your _y class doesn't have a EVDS_hittype entry
And the second log has to be nil. As your isNil check makes sure of that
you probably want to switch the diag_log and the BIS_fnc_returnConfigEntry lines
@still forum would you possibly know what is the action name for switching target ? I can't find it
oops yeah, that was just my error condensing this for here
it's probably not documented yeah... I'll see what I can do
grabs shovel and pickaxe
๐
ok... turns out the parameter in the config was actually missing/ was under false name...
There is a "lockTarget" action apparently.... somewhere.. I've striked it with the pickaxe but I don't really have it yet. I'll keep digging
You are really great at it ๐
LockTargets or UALockTargets or LockTarget or UALockTarget
I don't think that'll work ๐ค
How do you do it? Maybe I could try aswell
What do you mean?
The digging ๐
No you can't
the one with fire?
Is this correct syntax? (Note: Arma 2: OA)
if (!(vehicle player isKindOf "Air")) then {
Thanks @cedar kindle ๐
Is there a script that will open a bar gate when you get a certain distance from it?
U can do it via trigger
How do I do that? Iโm still pretty new to this stuff.
Do you know how to put trigger down in editor?
Yes
I believe I would have to give the bar gate a โ variable nameโ then put the name in the trigger, right?
Make trigger repeatable and put open animation in activation and close animation in deactivation
So like โGATE1 openanimationโ?
No GATE1 animateSource ["whatevertheanimationname", 1]
And then 0 instead of 1 to close
Ohhh, ok thanks.
Another question that I have is how to I do sequences of animations. I know {Soldier1 playmove โacts_navigatingchopper_inโ } but I want him to do โchopper outโ ?
Hi guys. Can I trigger a script when changing weapons somehow? Dont think theres an eventhandler for that
@nocturne basalt
while{alive player} do
{
_primary = primaryWeapon player;
if !(primaryWeapon player isEqualTo _primary) then
{
//primary weapon has changed
};
};
Ok ty. Yeah I knew I could use an infinate loop for it. Just wondered if it was possible to save CPU by only running when it happens
Instead of constantly checking
Unless you want to check once a switch weapon action is pressed
Add some suspension, it shouldn't be so taxing. Unless you have 100+ of these. This could run on the client
waitUntil, same thing
waitUntil {
_primary = primaryWeapon player;
if !(primaryWeapon player isEqualTo _primary) then {
//code
};
alive player;
};
What do you need weapon change event for?
We made a left handed melee weapon that is actually a facewear object. Want to be able to "hide" it when changing weapons
Or delete it
And then spawn it when changing back
Why not just make it a weapon?
Pretty sure you could config to hide it during animation
Not 100% but I think you can do tonnes of shit with animations
Perhaps the Anim EHs will work for you.
^ Possibly, but you'd need to check for rifle, pistol, and launcher anim. Plus modded weapons might have custom anims
That sounds much more tricky
I mean just use that as a check frequency, not look at the animations.
I use it for stuff like checking if a group has gone into combat mode.
got another error i dont quite get what is actually wrong
https://pastebin.com/p5FvQVK9
around line 47 is the error.
private _index;
_index = _gvar findIf {_x select>
Error position: <_index;
_index = _gvar findIf {_x select>
Error exitwith: Undefined variable in expression: _index
File \EVDS_main\Scripts\cfgcache_init_delayed.sqf [EVDS_fnc_cfgcache_init_delayed], line 47```
How can index not be defined? I just dont see it
I think it's _x that is undefined.
but _x is part of the findIf thing, at least should be
oh, sorry. my bad
Yes, _x is a magic variable in findif for the currently evaluated element.
but i'm somehow suspecting that its got something to do with the findif thing that is not working as i think it does
try defining _index, set it to nil
private _index = nil;
Oh, nevermind. Hold on. write private before your find if definition
_gvar = missionNamespace getVariable [_varstr,false];
bool ^
_index = bool findIf {(_x select 0) isEqualTo _class};
but bool only if it doesnt find the variable
and that is checked with isEqualtype []
at least that's what i want to happen - the error could also be in there
is it [[]] or [] ?
the _varstr global variable content?
_gvar is just array or nested aka [[],[]] ?
its different stages of arrays nested unsymmetrically
look at line 6 the example for "_content"
the variable i try to retrieve is an array of multiple _content's gvar=[_content1, _content2, _content3,...];
_content* = [<string>, <array with lots of sub arrays>, <array with strings>]
also
private _index;
_index = _gvar findIf {(_x select 0) isEqualTo _class};
``` >
```sqf
private _index = _gvar findIf {(_x select 0) isEqualTo _class};
^ was what I was saying earlier
ah, yeah, the little things^^
ill post a rpt log with the diag_logs enabled, hold on
also
private ["_time","_gvar"];
``` >
```sqf
private _time = 3*(random 100)/100;
private _gvar = missionNamespace getVariable [_varstr,false];
thanks, appreciate the little pointers. It's 5am code...
arma is rebelling, refuses to alt tab properly for some reason ... need a reboot
๐
๐ค weird... i dont get the error anymore...
idk if you removed > private _index; but i guess that was the problem ๐คท
yea i moved it in front of the findif _index
That was at least part of your problem then, private _index; will error
so private _variable only if you add a value in the same line ?
Correct. Otherwise private "_index";
ah, ok
no, syntax is private var or private array
private <STRING>, private <ARRAY> or private <VARIABLE> = <VALUE>
seems i just stumble from one error to another... sigh...
it's another function (though similar) , i'm looking into it currently
alright, another error, same function as previous - but caused by different input. Log is on the bottom
https://pastebin.com/sJ1NAH5t
Error in expression <;isEqualTo _class};
if (_index == -1) exitWith {
_gvar = missionNamespace get>
Error position: <exitWith {
_gvar = missionNamespace get>
Error exitwith: Type Array, expected code
File \EVDS_main\Scripts\cfgcache_init_delayed.sqf [EVDS_fnc_cfgcache_init_delayed], line 48
oh wait... i see it. exitWith cant have else
exitwith is pointless there anyway
It would defeat its purpose if it had one
yeah
"just let me add a diag_log so i see if it doesnt exit as planned"... is how i got there i guess
_wp =(group _TeamLeader) addWaypoint [position MissionArea, 1];
_wp setWaypointType "Move";
_wp setWaypointCompletionRadius 100;
_wp setWaypointStatements ["true", "{ unassignVehicle _x; moveOut _x} forEach (units group this); deleteWaypoint [group this, currentWaypoint (group this)]"];
The waypoint never finish, the group is inside of a vehicle but they are not driving, I missed something?
And the group is in a distance less than 100 of the waypoint area.
alright
am i a fucktard
_firstShot = {showCinemaBorder true;
_cameraOne cameraEffect ["internal", "BACK"];
_cameraOne camCommand "inertia on";
_cameraOne camPrepareTarget [5103.57,4552.96,70.666];
_cameraOne camPrepareFOV 0.75;
_cameraOne camCommitPrepared 0;
_cameraOne camPreparePos [4570.37,4810.58,14.549];
_cameraOne camPrepareTarget [5103.57,4552.96,70.666];
_cameraOne camPrepareFOV 0.75;
_cameraOne camCommitPrepared 10;
};
waitUntil {scriptDone _firstShot};```
screaming that 'waitUntil` has a generic error in its expression
really making me think
yes i know the waituntil would fire immediately if it worked
_firstShot is just code. scriptDone is expecting a script handle from spawn or execVM
ah
well
i did try using
_memeTimer = time + 10;
waitUntil { time > _memeTimer};```
and that also gave me an error which is confusing because i uh
i use it in other parts of my mission
_firstShot = {
/* code here */
};
waitUntil {scriptDone _firstShot};
you sure nothing is missed here ? ๐
shh
i mean though tbf ```sqf
_firstShot = [_cameraOne] spawn {showCinemaBorder true;
params ["_cameraOne"];
_cameraOne cameraEffect ["internal", "BACK"];
_cameraOne camCommand "inertia on";
_cameraOne camPrepareTarget [5103.57,4552.96,70.666];
_cameraOne camPrepareFOV 0.75;
_cameraOne camCommitPrepared 0;
_cameraOne camPreparePos [4570.37,4810.58,14.549];
_cameraOne camPrepareTarget [5103.57,4552.96,70.666];
_cameraOne camPrepareFOV 0.75;
_cameraOne camCommitPrepared 10;
};
waitUntil {scriptDone _firstShot};
doesn't work either
maybe _cameraOne does not exist ๐ค
ah
that's not full file
here
_cameraOne = "camera" camCreate [4586.29,4859.84,3.10599];
_firstShot = [_cameraOne] spawn {showCinemaBorder true;
params ["_cameraOne"];
_cameraOne cameraEffect ["internal", "BACK"];
_cameraOne camCommand "inertia on";
_cameraOne camPrepareTarget [5103.57,4552.96,70.666];
_cameraOne camPrepareFOV 0.75;
_cameraOne camCommitPrepared 0;
_cameraOne camPreparePos [4570.37,4810.58,14.549];
_cameraOne camPrepareTarget [5103.57,4552.96,70.666];
_cameraOne camPrepareFOV 0.75;
_cameraOne camCommitPrepared 10;
};
waitUntil {scriptDone _firstShot};
// End of camera shots
cutText [" ", "BLACK IN", 3];
_cameraOne = "camera" camCreate (getpos player);
_cameraOne cameraeffect ["terminate", "back"];
camDestroy _cameraOne;
"dynamicBlur" ppEffectEnable true;
"dynamicBlur" ppEffectAdjust [100];
"dynamicBlur" ppEffectCommit 0;
"dynamicBlur" ppEffectAdjust [0.0];
"dynamicBlur" ppEffectCommit 4;```
no matter what i try with waitUntil i am always getting a generic error in expression
another issue near or at a findIf statement, other function :/
https://pastebin.com/NH8xxDNu (log with input at bottom)
generic expression error line 29
_index = _gvar findIf {(_x select 0) isEqualTo _class};
if (_debu>
Error position: <select 0) isEqualTo _class};
if (_debu>
Error Generic error in expression```
i'm not sure if findIf even supports nested arrays...
i was expecting it to just go through the first layer...
findIf = new?
march 2018 https://community.bistudio.com/wiki/findIf
ah
yeah
so you think its findIf's limitations?
gimme few minutes @austere hawk
โค
okay .. forget it
arma denies to run without steam having installed it proper ...
and steam can fuck off
because i cannot just free magical GBs on my SSD
however ... to debug this, execute this:
[[1, 2, 3], [4, 5, 6], [7, 8, 9]] findIf { systemChat str _x; false; }```
and tell me what it actually outputted
@austere hawk
will try
[["A"], ["B", "C"]] findIf {_x select 0 isEqualTo "A"} != -1 // true
["A", ["B", "C"]] findIf {_x isEqualTo "A"} != -1 // true
[[1, 2, 3], [4, 5, 6], [7, 8, 9]] findIf { systemChat str (_x select 0); false; }```
what is this doing?
should print 1, 4, 8
1
4
7
[[1, 2, 3], [4, 5, 6], [7, 8, 9]] findIf { (_x select 2) == 5 }```
should return 1
and as it does, as expected, nested arrays work in findIf
chances are, your actual _gvar content is the problem
yeah... no troubles there ^
so you may want to add some debug capability to it
eg. systemChat str _x; after the findIf {
i guess that's what you're doing there
["A", [1,2,3,4]] findIf {_x select 0 isEqualTo "A"} != -1
```and thats why those errors there @austere hawk
you can see the gvar content in the log at the bottom ... that big lump of data on the bottom
see @meager heart msg
yeah
["V_T_IMP_Chim_APC_stan_MB000_imp",[["HitTank01","fuel","HitTank01",100,0.05,0.05 .... < that is your variable
no, that should only be one element of gvar
[content1, content2, content3]
what you quoted is equivalent to content1
then fallback to what i said
private _index = _gvar findIf {systemChat str _x; (_x select 0) isEqualTo _class};
though ...
private _index = _gvar findIf {systemChat typeName _x; (_x select 0) isEqualTo _class};``` should be enough
chances are, it will print for the last element right before the error not some array
i see it already in the log now, first element is in in array itself, which shouldnt be
[[content1], content2] instead of [content1, content2]
thanks you two
๐คท
๐
ok, i was wrong again, it was actually [content1, bi,ts,of,con,ten,t2]... ๐
lol
is there any way to increase the duration of which BIS_fnc_typeText stays on screen?
ah, guess i should use typeText2
_if typeText is so good then why isn't there a typeText 2?
afaik nope, but you can edit the original thingy or just make your own version...
hrmn
["<t align = 'center' valign = 'center' shadow = '1' font='EtelkaMonospaceProBold' size = '0.7'>R E C L A I M Y O U R S K I E S.</t>"]``` doesn't vertically align like expected(?)
https://pastebin.com/89M89KUd < did that long time ago but afaik still works without troubles, that is just "custom" version of that typetext thingy... just edit it how you want...
text blocks there exactly the same as in the original >
private _scriptLoading = [
[[localize "STR_outro_loading","<t align='left' shadow ='1' size ='0.85' font='PuristaMedium'>%1</t><br/>"]],
0.015 * CTRL_W_X, 0.015 * CTRL_H_Y
] spawn SL_fnc_typeTextX;
@tough abyss
noice
i'm ripping apart typeText right now
working it to my needs
really enjoying how safeZoneX + safeZoneW / 2, safeZoneY + safeZoneH / 2, isn't returning the center of my screen
not at all
that's a pretty neat little snippet honestly
good morning buds
๐
@tough abyss pls link or repo to the script. Gonna need that in the future ๐
They're nested Quik. Maybe that the cause?
Although it's by index and not necessarily by number?
or even the data itself
hmm
Why do you event only need from 0 to 3
you can just do for loop and make a 2nd array
@nocturne basalt CBA has a weaponChanged eventhandler.
@austere hawk https://pastebin.com/p5FvQVK9 Line 46. That's not how the private keyword works. private is a keyword manipulating the behaviour of the = operator. Without = it just tries to call the private command.
You need to private _index = _gvar...
It's complaining about it being nil because it is. You are trying to call the private command with a nil variable
Also why are you mixing private ARRAY and private keyword?
Just be consistent and use the keyword (Because it's way more performant)
if (_index < 0) exitWith { //index =-1 if not found -> add to gvar You write as a comment what you meant to do. But you do something different.
If you want to check if the index is -1. Then you should do if (_index == -1) exitWith {
@tough abyss read the full error message. It is always telling you "generic error" but it is almost always also telling you what's wrong. In your case it probably says "can't suspend in unscheduled environment"
@austere hawk https://discordapp.com/channels/105462288051380224/105462984087728128/497545576385216512
Your array is invalid. Second element is a string, not an array. And string select 0 doesn't work.
Here is your Array properly formatted. You can clearly see what's wrong there
@tough abyss <array> select [<start>,<end>] doesnt work with array data types?
https://community.bistudio.com/wiki/select see Alt syntax 4.
@tough abyss https://github.com/auQuiksilver/Apex-Framework/blob/master/Apex_framework.terrain/code/functions/fn_AIGetKnownEnemies.sqf#L22 Such optimizations only have a miniscule effect. And as you are running in scheduled your script is being slowed down by the scheduling code anyway so much that this won't do anything for you. It only messes up readability by alot
https://github.com/auQuiksilver/Apex-Framework/blob/master/Apex_framework.terrain/code/functions/fn_AIGetKnownEnemies.sqf#L77-L79 Did you know you can put multiple conditions into the same if statement?
Did you know you can lazy eval in the same if statement?
if (alive _x) then {
if (local _x) then {
if ((side _x) isEqualTo _side) then {
turns into
if (alive _x && {local _x && {(side _x) isEqualTo _side}}) then {
Also you put true/false into variables for what I guess performance reasons. And then don't use it https://github.com/auQuiksilver/Apex-Framework/blob/master/Apex_framework.terrain/code/functions/fn_AIGetKnownEnemies.sqf#L159
https://github.com/auQuiksilver/Apex-Framework/blob/master/Apex_framework.terrain/code/functions/fn_AIGetKnownEnemies.sqf#L185-L186 You know that you can use params and leave elements empty?
These are some of the reasons why I have to keep every SQF beginner as far away from your scripts as possible. They are just teaching too much crap to people
Like...
https://github.com/auQuiksilver/Apex-Framework/blob/master/Apex_framework.terrain/code/functions/fn_AIGetKnownEnemies.sqf#L194-L198
wtf? Just put it into a single if statement. And you've already saved 10x as much performance as with the _true/_false crap
It is enough to wrap consecutive expressions in code tags individually
If you wanna argue readability. You can also format them properly if you want.
if ( alive _x &&
{local _x &&
{(side _x) isEqualTo _side}}
) then {
also tried to understand this part... but was no luck https://github.com/auQuiksilver/Apex-Framework/blob/master/Apex_framework.terrain/code/functions/fn_AIGetKnownEnemies.sqf#L278-L283
A && {B && {C}} should in theory be faster then A && {B} && {C} for A := false, B := true/false, C := true/false
It depends on what you are doing. But the second one is definetely faster if A is false. Because the second && doesn't need to be evaluated
@still forum awesome thanks
@meager heart
If
Vehicle is alive and
vehicle is a vehicle and
vehicle is not a soldier and
vehicle is less than _radius away from _position and
vehicle is not already in list of vehicles (Hint... We have pushBackUnique for that.. You don't need to manually do that) abd
vehicle is not in the Air, not flying.
Then put it into _vehicles list.
Btw.. We have select CODE for that..
I'll make it more readable for you
based @still forum
{
_vehicle = _x select 2;
if (alive _vehicle) then {
if (_vehicle isKindOf 'AllVehicles') then {
if (!(_vehicle isKindOf 'CAManBase')) then {
if ((_vehicle distance2D _position) < _radius) then {
if (!(_vehicle in _vehicles)) then {
if (isTouchingGround _vehicle) then {
_vehicles pushBack _vehicle;
};
};
};
};
};
};
} forEach _targetsKnowledge;
->
private _targetVehicles = _targetsKnowledge apply {_x select 2}; //Filter out the vehicle's from the Arrays (That is what "_vehicle = _x select 2"; does in the original script)
_vehicles = _targetVehicles select {
alive _x &&
{isTouchingGround _vehicle && //Notice how I reordered the condition after the execution time they need.
{_vehicle isKindOf 'AllVehicles' && //Only vehicles
{!(_vehicle isKindOf 'CAManBase') && //Exclude Humans
{(_vehicle distance2D _position) < _radius //Is in range
}}}}
};
_vehicles = _vehicles arrayIntersect _vehicles; //Remove possible duplicates
Or alternatively (I prefer this. But Quiksilver does even the minimalistist and least useful microoptimizations so I guess he wants best performance and not readability)
private _targetVehicles = _targetsKnowledge apply {_x select 2}; //Filter out the vehicle's from the Arrays
_vehicles = _targetVehicles select {
alive _x &&
{isTouchingGround _vehicle} && //Exclude flying air vehicles
{_vehicle isKindOf 'AllVehicles'} && //Only vehicles
{!(_vehicle isKindOf 'CAManBase')} && //Exclude Humans
{(_vehicle distance2D _position) < _radius} //Is in range
};
_vehicles = _vehicles arrayIntersect _vehicles; //Remove possible duplicates
is it really need that "allvehicles" there ? ๐ค
I don't know what _targetKnowledge contains. There might be buildings in there. Or rocks/trees/street signs n stuff.
In that case it would really be needed. But if it only contains vehicles/units then it's useless
kk
But if you go by the name
https://community.bistudio.com/wiki/targetKnowledge
That shouldn't return static objects
And should also not contain duplicates.
@queen cargo yes, it is faster in practice too, someone should add this to biki
Not clear enough
Should be emphasised
If speed is a factor the it should be nested all the time
Other examples not needed
Other examples are needed to show why they are bad
Actually.. That example doesn't even work
class CfgRespawnPositions
{
class tanoa
{
west_hq[] = {west,{2104.49,3426.79,0},"HQ"};
};
};
Say I have a config like this, how would I get all of the positions inside the class tanoa?
But 99% of them are not nested, should be at least balanced
true || {{false} || {false}}
The {false} || {false} is syntax error
Can you do a test?
true && {true && {true}}
vs
true && true && true
I guess the first one is slower because it has the additional overhead of calling the code conditions
0.023 vs 0.014 for me
Yeah see. If the conditions are mostly true, the second variant is better
What matters most is that you know what your code is doing. If it's just a check to prevent a rarely occurring thing. Lazy-eval might not be the best choice
The text is fine on biki just need to emphasise that if you go for lazy eval it should be nested for better performance
@high marsh
https://community.bistudio.com/wiki/configClasses
_arrayOfSubclasses = "isArray _x" configClasses (configFile >> "CfgRespawnPositions" >> "tanoa");
{
_content = getArray _x;
_position = _content select 1;
} forEach _arrayOfSubclasses;
Excellent, thank you. Had a brain fart.
Ah now I understood what you meant. Yeah. IF lazy eval then also nested yeah
Lazy-eval might not be the best choice I think it already says that
https://github.com/auQuiksilver/Apex-Framework/blob/master/Apex_framework.terrain/code/functions/fn_AIGetKnownEnemies.sqf#L304
Quiksilver doesn't know how to use params to leave elements out.
https://github.com/auQuiksilver/Apex-Framework/blob/master/Apex_framework.terrain/code/functions/fn_AIGetKnownEnemies.sqf#L323
Quiksilver apparently knows how to use params to leave elements out.
What now? ๐ค
https://github.com/auQuiksilver/Apex-Framework/blob/master/Apex_framework.terrain/code/functions/fn_AIGetKnownEnemies.sqf#L327-L328 These assignments are useless. Because the variable is always overwritten in line https://github.com/auQuiksilver/Apex-Framework/blob/master/Apex_framework.terrain/code/functions/fn_AIGetKnownEnemies.sqf#L332-L333 before it's being used
https://github.com/auQuiksilver/Apex-Framework/blob/master/Apex_framework.terrain/code/functions/fn_AIGetKnownEnemies.sqf#L379-L382 Calling objectParent 5 times? I thought you were trying to optimize performance?
Also isKindOf check should be more expensive than isTouchingGround. Always order from least expensive to most expensive check
Because having done all the heavy checks is useless if the last check is a very simple check and returns false.
Overwritten under condition
Never used if condition doesn't return true
https://github.com/auQuiksilver/Apex-Framework/blob/master/Apex_framework.terrain/code/functions/fn_AIGetKnownEnemies.sqf#L398 Quiksilver apparently knows how lazy-eval works. But what about the line above and below?
Also select should be used here. "Why" you ask? because a single select call replaces your 3x if, 3x then, 1x pushBack multiplied by the number of elements in the array you are iterating over.. Which is quite alot of CPU time.
Another feature that would make it desirable
But I don't think they'd detect this example. Of a variable being assigned, but in a too high scope where it's always reassigned before being used
https://github.com/auQuiksilver/Apex-Framework/blob/master/Apex_framework.terrain/code/functions/fn_AIGetKnownEnemies.sqf#L430 Again. You want to be as performant as possible? why then put the useless FALSE into there? One more command call, one more GameData/GameValue allocation.
setVariable detects that you have a third parameter and then also has to pull it out of the array and check it.
Quite alot of needlessly wasted time
@meager heart wanna know what part of Code I myself can't understand?
I just can't make any sense out of this "code"
This is my initial persistent testing. I am trying to execute "saveProfileNamespace only on server" from user action on object (bis_fnc_holdActionAdd executed on every machine). When I reload my mission, change is not saved on server's profile (dedicated server). Here is very simple test mission: http://701sog.cz/public/save.VR.zip . It contain 3 boxes. On each I change color and save it to server profileNamespace.
[0,1,_side] call (missionNamespace getVariable 'QS_fnc_AIGetKnownEnemies') Wat? You are already in mission namespace? Why do you call getVariable?
[0,1,_side] call QS_fnc_AIGetKnownEnemies ?!
@real tartan are you sure that the server's profile file has write access and such?
Ded, doesn't work. Configlcasses doesn't even pickup tanoa as having any arrays
Ah duh.
yeah they are not classes
^ that
@real tartan the holdAction code doesn't execute on the server
it executes where you execute the action
remoteExec ["bis_fnc_holdActionAdd", 0, true];
I can read
Wow much bully Ded.
Doesn't change my statement
@high marsh better store them manually without configs...
If you want to set the var on the server. You have to remoteExec the setVariable onto the server.
But you cannot remoteExec the getVariable part so that's gonna be a little inconvenient
@meager heart I want to be able to throw new positions in there without manually writing static data. I also want to make it easier for the end user to change htem
@high marsh
configProperties [configFile >> "CfgRespawnPositions" >> "tanoa", "isArray _x"]
You donโt want to remoteExec persistent function call to all on an object unconditionally. Use object instead of true, this way if object is deleted so is persistent call
if he uses a object instead of true. Only that object will get the action
He probably wants the action to show up for every player though
Wut?
How do you scratch on mobile
๐ค Interesting. Thought you can use true as Target..
~~scratch~~
@high marsh oh.. it is framework, i thought you was making mission there... then gl ๐
Thanks.
@real tartan your ] remoteExec ["bis_fnc_holdActionAdd", 0, true]; makes sure that the action is added for every client. But it has absolutely nothing to do with the code inside the action. That code is still locally executed. Thus not on server
then I need to cuddle setVariable into function and remoteExec that function inside bis_fnc_holdActionAdd
and remoteExec it only for server
Alright, so I got this working now. However, in the config west is indicated as a string?
I expected it to be not a string?
Every "invalid" config value automatically get's wrapped as a string because otherwise it would be a syntax error
Okay. That makes more sense
You can't just write scripts into config if that's what you expect
configs aren't scripts
understood.
@still forum http://701sog.cz/public/save.VR.zip (updated)
_s = [[format["a3f_save_%1", _target], _color_new], "save.sqf"] remoteExec ["BIS_fnc_execVM", 2];
color did not changed after mission restart
thinking: loading wrong profileNamespace for initial state | profileNamespace not saving | setObjectTextureGlobal bug
loading wrong profileNamespace for initial state I already told you that, that was the case with your old script
_color_old = profileNamespace getVariable [format["a3f_save_%1", _target], "white"]; There. That code runs clientside
your serverside profileNamespace variable won't magically appear in every clients profileNamespace
just move the whole code to the server instead of just the save part
_color_old = [[format["a3f_save_%1", _target], "white"], "load.sqf"] remoteExec ["BIS_fnc_execVM", 2];
load.sqf
diag_log format ["load.sqf | _variable: %1 | _defaultValue: %2", _variable, _defaultValue];
if !(isServer) exitWith { diag_log format ["load.sqf | load only from server"]; };
profileNamespace getVariable [_variable, _defaultValue];```
I already told you that, that doesn't work
why don't you just do what I recommend you to do?
I am on learning curve. Don't tell me solutions, that way I feel like to go here to get work done for me.
I want some more "general solution" rather than solving problem with current script
And I did, load.sqf worked nicely
@still forum thank you! I appreciate your input
Problem is that remoteExec cannot return results back. So either you build something where you execute something on the server, then the server executes something back on you.
Or you just do everything on the server if possible
remoteExec - Return Value: Anything - Nil in case of error. String otherwise. If JIP is not requested this is an empty string, if JIP is requested, it is the JIP ID. See the topic Function for more information.
It returns the JIPID which you can see in the last example
Can anyone tell me if this following line is correct?
publicVariable "activatedAbort";
activatedAbort = false;
this addAction ["Upload Abort Codes", {activatedAbort = true; if (isServer) then {activatedAbort = true; publicVariable "activatedAbort"};}];```
Trying to put an addAction on a laptop which changes a variable to activate another trigger. At first i didn't make it a publicVariable, so it would only activate the trigger for the player that used the addAction, but i want it to trigger for everyone
publicVariable "activatedAbort";
activatedAbort = false;
Don't you want to swap these?
activatedAbort = true; if (isServer) then {activatedAbort = true; publicVariable "activatedAbort"}; ifServer will never be true unless self hosted multiplayer
Also use Tags on your global variables
i don't know if i wanna swap there... i'm a terrible scripting noob ๐
Well... You know what publicVariable does? or not
Yeah. But if you set the variable after sending it to the clients
you throw warm air at the clients. And then take your potato out of the fridge
You probably donโt want to let others upload codes if someone already did
The clients won't get hit by a potato that way
yeah could probably do that by removing the addAction after it's been used
The action condition should rely on the activatedAbort value? If it is false, show, if true, hide
activatedAbort = false;
publicVariable "activatedAbort";
this addAction ["Upload Abort Codes", {activatedAbort = true; publicVariable "activatedAbort"},nil,1,false,true];```
Otherwise you have to remoteExec remove so it could get ugly fast
oh wait, that's not removing it
it's just "close the action menu after the action is used"
I donโt know if you are putting the whole code you posted in init or only part of it, because it makes huge difference what is going to happen
if (isNil "activatedAbort") then { activatedAbort = false; };
this addAction ["Upload Abort Codes", { missionNamespace setVariable ["activatedAbort", true, true]; }];
Someone suggested that on Reddit ๐
i think i will just disable JIP for the mission ๐
dont have to hassle with that
In MP you should do the logic in one place - server
i don't wanna mention all the other spaghetti triggers i used in this effect :p
First i have a trigger that launches a SCUD missile, that enables a new objective to upload abort codes. At the same time, i start another trigger with a condition triggerActivated trgLaunch && !triggerActivated trgStartAbort; and a 600 seconds timeout that will trigger another trigger with the Lose Mission statement ๐
I also just realized while i wrote that there's nothing stopping the player from going to the laptop and uploading the abort codes before the missile is launched
oh wait, no i did think of that. The missile launch is triggered by blufor presence when they approach the SCUD. And the laptop is in that trigger zone
hello, im looking for a way to find all units available to a faction.
currently i use _availablegroups = ("true" configClasses (configfile >> "CfgGroups" >> _strside >> _faction >> _category)) apply {configName _x};
this finds me all groupclasses. for some reason i cant figure ot a way to get to an array of all units....
ideally by air,man,car...
i think this should give me all blu_f Men? _availablemen = "(configname (_x >> 'vehicleclass') == 'men') && ((_x >> 'faction') == 'BLU_F') " configClasses (configFile >> "CfgVehicles");
you need getText there ๐ค
getText (_x >> 'vehicleClass') == 'Men'
getText (_x >> 'faction') == 'BLU_F'
hmm i tried with configname, slipped me in the code above (added it)
that returns me an empty array though
gettext indeed returns something
but thats an array of long paths now
"(
getText (_x >> 'vehicleClass') == 'Men' && {getText (_x >> 'faction') == 'BLU_F'}
)" configClasses (configFile >> "CfgVehicles") apply {configName _x}
```something like that ^
ah got it
availablemen = ("(gettext (_x >> 'vehicleclass') == 'Men') && (gettext (_x >> 'faction') == 'BLU_F') " configClasses (configFile >> "CfgVehicles")) apply {configName _x};
yep i kept forgetting code either on the one side or the other ^^ thanks
@still forum correct, I had to spawn my script which is fine because I don't need to return any variables and I don't need to watch for it to be done
i think i need to do this in a different wa. all the mods use their own variety of classes there.
how can i ask for parents, such as "Land" "Man"
excellent thanks
otherwise id have an issue because RHS seems to use a different vehicleclass for every camo pattern
Is there a specific command to make a single UAV crew? I want to make the driver from diferent side than the gunner.
createUnit B_UAV_F for example, iirc @astral tendon
Did not find anything about B_UAV_F in Biki and google
Find it about B_UAV_AI though, I will see what I can get from that.
What would be the way to remove icon from listnbox item? Setting "" with lnbSetPicture doesn't do anything, having thin invisible line as new picture add some padding before the text. What else can be done?
Setting invalid texture seems to remove the icon but create an error message
Thin vertical invisible line as picture seems to be the only solution here
2x64 of invisible pixels, no noticable padding compared to no picture
lnbDeleteColumn?
Delete entire column?
set empty texture
something something ca_empty.paa or something
Unless the indenting is a problem for you, I think for that what i always used to do wwas just set empty pictures by default, so at least they would be aligned
Yes, picture has to be thin to look like there is no picture though.
Yes entire column with pictures in it
Can you create column back in place of it later though?
Is this for some engine called control?
Ignore me, l donโt understand what your doing
Hi guys, someone knows how to use setVectorDirAndUp correctly ? At the moment, i'm using setDir, setPosATL and modelToWorld to spawn something at a specific spot in a house, but it doesn't work in every case
https://i.imgur.com/hFqfJll.jpg
If you want to spawn something inside the house it is better to have relative coordinates, so you can attach it to these coords, set orientation then detach it
Quit arma like 3 years ago but hopefully my old script file is helpful here.
Attatch:
_vehicle = "classnameofitemhere" createVehicle position player;
_vehicle attachTo [player, [3, 3, 3]];```
Detatch
```sqf
{ detach _x; } forEach attachedObjects player;
a Noob question: does mods have to be run as servermod to hit the "isDedicated"-conditions?
No
ok good ty. having some issues with ryan zombies having big conflicts with cars. Just wanted to scratch that theory real quick.
'Ryan Zombies' i know some of the exile boys have fixes for that if you can't figure it out.
Good luck tho, i have never used it.
ye they pointed me towards the rz. And I noticed pretty fast that they are probably right. Need to find the cause my self though. Guessing on the caralarm feature. Thanks! :p
@tough abyss @narrow musk thanks guys https://i.imgur.com/PZhqMNZ.jpg ๐
groan ok nvm... found the issue myself
when magic variables turn out to be not to be quite as magical, but instead produce errors because you nested them >.<
You can nest them
i get errors with (simplified)
{
//do stuff with _x
_somevariable = _someVariableUpperCase apply {tolower _x};
} forEach _arr1;
i get errors with (simplified)
{
//do stuff with _x
_somevariable = _someVariableUpperCase apply {tolower _x};
} forEach _arr1;
{{{systemchat _x} foreach _x} foreach _x} foreach [...]
{{{systemchat _x} foreach _x} foreach _x} foreach [...]
{{{systemchat _x} foreach _x} foreach _x} foreach [...]
maybe if they are supposed to be the same, but in this case it's not
_x in my _arr1 is a config
_somevariableUpperCase contains strings
result:
Error tolower: Type Config entry, expected String
Post simplified example that is real code and you will see it works
i can post full example that makes you see it doesnt work
Error tolower: Type Config entry, expected String that means _somevariableUpperCase doesn't contain strings
Works for me
_x input from a {}forEach _configPaths
{
_param_name= "EVDS_AffectedHitPointSelections";
_retrieve= (_x >> _param_name)call BIS_fnc_GetCfgData;
if (isNil "_retrieve") then {
_retrieve= [(_x),_param_name,false] call BIS_fnc_returnConfigEntry;
};
if (NOT(_retrieve isEqualType [])) then {
diag_log ["EVDS ERROR: Config problem: Parameter ",_param_name," of hitpoint",(_HP_classes select _forEachIndex)," from vehicle ", _vclass ,"not found in config. Fix config! Assuming None[]"];
_retrieve = [];
};
//convert all to lower case
diag_log ["EVDS CfgCache Veh: retrieve of EVDS_AffectedHitPointSelections before applying tolower:",_retrieve];
diag_log ["EVDS CfgCache Veh: _HP_data before pushback of retrieve affectedHPsel",_HP_data];
if (count _retrieve > 0) then {
_retrieve = _retrieve apply (tolower _x);
};
//these are just the classes, we need to aquire the IDs after this whole loop -> See line ~340
_HP_data pushBack [_retrieve,"TODO-ID-Placeholder"]; //affectedHPsel[] to first element of index 5
}forEach _configPaths;
diag_log lines from rpt
diag_log ["EVDS CfgCache Veh: retrieve of EVDS_AffectedHitPointSelections before applying tolower:",_retrieve];
diag_log ["EVDS CfgCache Veh: _HP_data before pushback of retrieve affectedHPsel",_HP_data];
line with apply is where i get the error
your rpt lines are wrong
oops yeah because i took them from the script, not the config...
Ahhh
_retrieve apply (tolower _x);
apply doesn't take string on right side
wrong braces
See. That's why you always copy-paste your script. And don't write something similar.
https://discordapp.com/channels/105462288051380224/105462984087728128/497835136201654292 you fixed your mistake while writing down the sample code for us
fuck me... i could have sworn that where curly brackets but i'm already seeing blurry
lesson learned
wear glasses
because it already errored before toLower could run
i was getting mixxed errors - generic expression error and also "got code expected string" at some point while trying to debug and fumbling around like a fool
too late
use a proper IDE with a linter. For example VSCode
I think Golias' SQF Linter should detect that
Apply mother***r apply, why donโt you apply?
exactly... i wanted to be snazzy like all the cool dudes and use apply instead of a for 0 to igoplaces
Premature optimisation
apply is the right tool for the job here though
wouldn't call "taking the right tool" a optimization
yeah, it occured to me, which is why i wanted to use it. But i was in the believe (first mistake...) that you cant nest two magic variable using things
but i forgot that when trying apply the first time (here)...
but real question now - you said foreach can be nested no problem
{
{
// how do i use the _x from the outer loop in this nested one ?
}forEach _arrC
}forEach _arrP;
{
private _outsideX = _x;
{
// use _outsideX and _x
}forEach _arrC
}forEach _arrP;
ok... yeah... makes sense
Is there a way to disable control of a UAV driver?
ok maybe really dumb but general question - how do i best live code precompiled functions?
way i do it now is stupid time wasting i suspect -> write the .sqf functions, define in cfgFunctions , pack addon, launch game and mission, fail, repeat.
Go to debug console.
functionName = {code};
Execute. Try. Fail? edit code in debug console and execute again to replace function. Try again.
the functions are too many and too complex to be comfortably edited in debug console
If you'd use the CBA system you could recompile all functions with a single click. But that might be too much work
enable filePatching. Let your scripts be loaded that way. Then you only have to restart the mission to make it recompile I think
so i need to replace all the TAG_fnc_myfunction with discrete path values to the .sqf files?
no
Setup your p-drive for filePatching
it will automatically load the scripts from there instead of your pbo
just like with models/textures and so on
You can disconnect player driver from UAV @astral tendon
How?
p-drive is set up, anything else for filepatching to do with it? Launching A3 with filepatch tag, ok i have that
Not sure how to have it load scripts from P drive instead of my @modfolder - does that do it automatically?
also, how to specify what i want filepatched and which not? I dont want other addons (e.g. large models) to load from P-drive, takes ages (compared to binarized ones)
BackFromUAV https://community.bistudio.com/wiki/Arma_3_Actions#BackFromUAV @astral tendon
Arma tries to load everything from Arma directory first. And if it doesn't exist it takes it from pbo
so if you have a file in x\stuff\file.sqf inside your PBO. And also Arma 3\x\stuff\file.sqf. It will take the one from Arma folder
so in that example you have a x folder next to your arma3.exe
so i can just put it(that folder) directly in the arma folder and skip P drive? ok that i like
pop quiz:
what's the best way to get a vehicle to move like it's being piloted
but keep it local
X-drivers music
2Fast2Arma
hey can you add reactions to my messages? Or do they disappear when you try?
I mean that @unborn ether guy :u
I know that you can ๐
Your messages are so advanced, so my screen shakes when i try so ๐
Ahh. So we solved the mistery. You can detect if people have blocked you that way
๐ I didn't
oh darn, my secret life people sniffer is now public...
a function can spawn itself, right?
Yes. Beware recursion
You should google recursion
^^^ this ๐
Only in a while true
๐ฟ
any idea why i get spammed Attempt to override final function - lega_fnc_gangmanagement_server_fetchgangs with a compileFinaled pvar on the server ?
You're broadcasting it while its already defined on client
is it possible to make players move while BIS_fnc_cinemaBorder is in effect?
Create overlay yourself
Does anyone know why this doesn't work?
while {ctrlShown _RscSlider_1900} do {
systemChat "123";
};
Undefined control?
Nope
while {ctrlShown(findDisplay 0 displayCtrl 999 getVariable '_comb#101')} do {
This one doesn't work aswell
Do systemchat str _rscslider_1900 just before the loop
What number?
Ok and systemchat str ctrlShown _RscSlider_1900; ?
returns true
Its like the while loop doesn't even check it just skips it
really weird
That is some sorcery
hello again. i have an issue with UAVs. when i spawn a group with BIS function using an array, i dont see UAVs flying.
i see that UAVs are being set up by the soldiers, but then the dont launch
Does anyone knows if the ballistic computer display scripting stuff is somewhere that we can access?
Alternatively: is there a way to get position data for the calculated impact point or the target lead indicator? Just so I can draw a 3d marker over that position.
afaik it's not possible. You can use a simple ballistic curve formula for calculating the solution manually, for A3 vanilla artillery however -> it doesnt have airfriction on the shells
if you want to also do it for stuff with airfriction things get more tricky
The reason why it shows up in the gunner camera seems to be because BIS hardcoded the ballistic computer to show up ONLY in gunner view. Meaning you can't get it even if you are in first person, but not in gunner view.
That is why I'm looking for way to get the CCIP data
That data has to exist as it is passed to the MFD HUD so it can be displayed if you had that configured
I'm looking for a way to get that in 3rd person
yeah no ballistic computer is like a black box - no way to access it, not even the outputs. Shitty system.
Just like the new radar. neat functionality but no way to access it in any way.
if there was a command like getCCIPpos [vehicle, weapon] and getTLIpos [vehicle, weapon] we could do a lot of fun stuff with it
sadly we are stuck having to script completely new system because bis does not give us any access to the data
but ccip is an entirely different system altogether, and not designed for very long range stuff (the longer the range, the higher the computational cost) - pretty sure there is some sort of cap put on how far and strong the curve can be for ccip
exactly... i#ve been moaning in the dev forum feedback for the radar on several occasions for exactly this reason (politely of course). Deaf ears.
such a waste of potential...
Does anyone know a way to get all the variables set on a object or namespace using setVariable?
@fringe yoke i think this is what you're looking for:
https://community.bistudio.com/wiki/allVariables
๐ Yeah that will do it, thanks!
note that it will only return the variable names, not their values
you'd have to take an extra step to do that
so for the custom vehicle damage system i work on i need a way to do a MP score system, as the system scripts damage, so everything that dies through the script is otherwise lost for the purpose of score (also for killed EH's)
My plan is to let mission creators/admins define a function name (via string in a global mission var) that gets executed remotely on server
private _scoreFNC = missionNamespace getVariable ["EVDS_score_fnc",""];
if (_scoreFNC != "") then {
[_victimvehicle,_instigator,"kill"] remoteExec [_scoreFNC,2];
};```
What happens when i pass the victim like that, that is already dead and might be deleted quite soon after? Is there a chance that the score function when executed will just end up with a non-existing object?
yeah. It could receive a nullObj
hm...
i could pass the classname of the unit instead... would lose some options of what is possible in the score function then though
instigator could also be dead by the time the vehicle explodes (after burning a while)... damn.
i'm trying take % from number. For example 10% from 6
6* 0.1 -> 0.6
heya guys
i tryed for this linearConversion ๐
Well technically you could
is there any way to return a true value if a player has disconnected in the past 5 minutes?
Hm
Well
I guess I can just use initPlayerLocal
and do some waitUntil
player based on what? generally you do a disconnect EH on the server, then keep an array of UID and servertime to see when someone disconnecte
basically, what i want to do is add support for if someone disconnects or is a JIP
i want them to be able to teleport to a command vehicle
but if they just die normally, they have to wait for logistics
and honestly, just adding a waituntil in initPlayerLocal will suit that need fine
i don't think it has any performance implications either
https://community.bistudio.com/wiki/createAgent
Can some one change or put a exemple to Arma 3? SoldierWB does not exist.
is there some particular faster/fastest way to count the number of occurances of different strings into a large array (100k to 1+m elements)
with as result an array like
[9999,"XXX"],
[1111,"YYY"],
[555,"AAA"],
...
]```
what about sort array, count array, take first element, remove -[element] to drop all its duplicates, count array to get the amount, repeat
Hello everyone,
I'm getting a 'Type Array, Expected Object' error with this script:
_car = _this;
while{alive _car} do {
if ((_car animationSourcePhase "light_source") == 0.75) then {
_car setHit ["Light_L",0];
_car setHit ["Light_R",0];
} else {
_car setHit ["Light_L",1];
_car setHit ["Light_R",1];
};
sleep 0.01;
};
would anyone happen to know why?
can i
switch (_true) do {
_write = _code + _here+ "?" ;
case (_condi1): {_result=_write + ".";};
case (_condi2): {_result=_write + "!";};
};
yes @austere hawk
@errant herald How is that being called? What is being passed? Do you understand what _this is?
@dusk sage I think I've got it
๐
Have you tried https://community.bistudio.com/wiki/BIS_fnc_consolidateArray @velvet merlin
ty. sounds about right. will check the implementation
paramsCheck(_this,isEqualType,[])
private _cnt = count _this;
private _cntNil = count (_this - _this);
private _ret = [];
{_ret append [[_x, _cnt - count (_this - [_x])]]} count (_this arrayIntersect _this);
if (_cntNil > 0) then {_ret pushBack [nil, _cntNil]};
_ret```
arrayIntersect makes this fast i'd assume. thus simple and elegant
I donโt know about million + elements but engine iteration will probably be faster than if you construct it in sqf
Hello, comrades! Does anyone know if battleye allows to whitelist logged admin to use console?
is there a function or command to return a true value when the player is able to see the world
@calm bloom #server_admins
thanks
๐
There is an event handler PlayerViewChanged I would expect it will be connected to what player sees. It is local to client.
Fired on player view change. Player view changes when player is changing body due toย teamSwitch, gets in out of a vehicle or operates UAV for example.
agreed
im not sure if this is possible, but im trying to make it where players are still able to move while BIS_fnc_cinemaBorder is in effect because normally it prevents all movement when it's activated, is there any way around this?
0 spawn {
("BIS_fnc_cinemaBorder" call BIS_fnc_rscLayer) cutRsc ["RscCinemaBorder", "PLAIN"];
playSound "border_in";
sleep 5;
("BIS_fnc_cinemaBorder" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
playSound "border_out";
};
```into debug console ^ @tough abyss
this is a good start, is there a way to give the borders a smooth transmition (sliding in and out of the screen)? @meager heart
yeah...
layer cutRsc [class, type, speed, showInMap] < speed there
more info > https://community.bistudio.com/wiki/cutRsc
thanks! i'll give it a shot
glhf
Is ther ea way to trigger action via script instead of button from inputAction list?: https://community.bistudio.com/wiki/inputAction/actions
You also don't need to use BIS_fnc_rscLayer, you can just supply that string as layerName in layerName cutRsc [class, type, speed, showInMap] , see alt. syntax #2 @tough abyss
Giving a number is just going to give rise to conflicts, and yes, he can
Unless that is a specific layer that already exists?
yep
Then again, I don't see why it wouldn't also still grab the layer
So it should be fine
first layer in allCutLayers is "" and reserved for usage in cut commands without layers names
im very new to this so pls correct me if i did something wrong,
i did some changes and did this instead (same effect as @languid forge 's code from earlier)
cutRsc ["RscCinemaBorder", "PLAIN", 1.8];
playSound "border_in";
sleep 5;
cutRsc ["RscCinemaBorder", "PLAIN", 1.8]; cutText ["", "PLAIN"];
playSound "border_out";
};```
still no smooth transition though
Supplying the layer name to cutRsc will create and or use that layer
Given that is it already a layer, it'll pick up the correct one
so with cutRsc i cant make the borders slide down like how BIS_fnc_cinemaBorder does it?
Can I simulate a key press?
ok what about this >
0 spawn {
disableSerialization;
"blake_cinemaBorder" cutRsc ["RscCinemaBorder", "PLAIN"];
private _borderDialog = uiNamespace getVariable "RscCinemaBorder";
private _borderTop = _borderDialog displayCtrl 100001;
private _borderBottom = _borderDialog displayCtrl 100002;
private _height = 0.125 * safeZoneH;
private _offset = 0.1;
showHUD false;
_borderTop ctrlSetPosition [safeZoneX - _offset, safeZoneY - _height - _offset, safeZoneW + 2 * _offset, _height + _offset];
_borderBottom ctrlSetPosition [safeZoneX - _offset, safeZoneY + safeZoneH, safeZoneW + 2 * _offset, _height + _offset];
{_x ctrlCommit 0} forEach [_borderTop, _borderBottom];
_borderTop ctrlSetPosition [safeZoneX - _offset, safeZoneY - _offset, safeZoneW + 2 * _offset, _height + _offset];
_borderBottom ctrlSetPosition [safeZoneX - _offset, safeZoneY + safeZoneH - _height, safeZoneW + 2 * _offset, _height + _offset];
{_x ctrlCommit 5} forEach [_borderTop, _borderBottom];
waitUntil {
sleep 1;
ctrlCommitted _borderTop &&
ctrlCommitted _borderBottom
};
sleep 5;
"blake_cinemaBorder" cutText ["", "PLAIN"];
playSound "border_out";
showHUD true;
};
```lets hope BoGuu will like that name > "blake_cinemaBorder" ๐
@tough abyss
No. A control button press, yes
@tough abyss what do you mean by that?
I mean exactly what I wrote, what is unclear?
@meager heart the borders slide in just the way i want it to however it does not slide out, also i love the layer name lmao
well... you can use ctrlSetPosition and "slide" them out ๐
for reference, im trying to mimic what halo does with the black bars and text on the bottom right
I dont understand what do you mean by "control button press"
You may call me stupid, I just dont get it
UI dialogs with button, you can press button by script, thatโs about the only time you could replace user interaction
Ok thank you, so basicly inputAction actions are untouchable by scripts(you can detect them but not execute)
Some of them could be called using action command, like Gear for example. But majority donโt have scripted action. And you asked about simulating key press and not wether or not there is a scripted way to launch some action, because as I was trying to explain, some actions can be scripted, most not.
Yes I know, I just asked about simulating key press as I asked about some actions earlier, few days ago. There is no way to to lock vehicle/target via script, and Dedmen was trying to help me finding action for that but he didnt find it. I thought today that if there is inputAction command than there is some command to inverse that and for example simulate the DIK Code press
You could do that via extension probably, send a key press to the system
Hi! I'm trying to center a RscText inside its control but it seems ST_CENTER is not changing the alignment :/
Unit inits start frist than the InitServer.sqf?
Way way before initserver
/\ I already read that, what part represent the unit init?
oh Objects not only units
I see,I was trying to make a fucntion to work as a normal script in InitServer.sqf and them make the unit call it.
If you add your function to cfgFunctions you can call it from unit init
Yeah, I was just jumping steps for laziness.
when scripting for a headless client, how do i reference the client internally? (similar to how player refers to the player on a regular client)
i know you can name the clients to reference them, but that doesn't help me with what im trying to do. I'm trying to make each of them display their current FPS on a map marker generated on their position with their names on them which updates every couple of seconds with their fps.
crash/shutdown the HC and have a looping batch script or sth to restart the HC exe if its down?
HC is using the same exe
It should be the same
I don't think arma client/server can tell other servers and clients to restart
well just duplicate the exe and use the second for HC startup
@tough abyss use .bat file.
taskkill /IM arma3server_x64.exe
you can rename your exe and kill HC process without server.
how to force-restart a headless client exe? make extension
@tough abyss I've tried using player in the HC scripting and it doesn't seem to work
Can a backback trigger a script when picked up or dropped?
Those eventhandlers must be set on the man right? Didnt work putting them on the backpack
Hello, i'd like to trigger a
{_x setdammage 1.0} foreach thislist;```
only to opfor player in the area of the trigget
I guess I'd need to change the thislist ?
or probably the foreach is not adapted to this situation
{_x setDamage 1.0} forEach (thisList select {side _x == opfor});
setMousePosition [0.5, 0.5]; should set the mouse in the middle of the screen? Shouldn't it ?
Since I got 3rd monitor it sets my cursor in lower right corner ๐ค
getMousePosition returns [0.5, 0.5] when cursor is in middle of the screen. ๐
(โฉ๏ฝ-ยด)โโโ๏พ.*๏ฝฅ๏ฝก๏พ
Is there anything wrong with? ```sqf
c_outpost_tel addAction ["Teleport: USS Freedom", {
hq sideChat format["%1, please wait 7 seconds for transportation..",name player];
[outpostTerm,3] call BIS_fnc_dataTerminalAnimate;
sleep 5;
[outpostTerm,0] call BIS_fnc_dataTerminalAnimate;
sleep 2.5;
player setPosATL (getPosATL c_freedom_obj);
}];``` As I seem to be having a locality issue. Works in SP.
Teleport
The side works and displays the correct name. (only for that person, no one else sees the sidechat).