#arma3_scripting
1 messages Β· Page 427 of 1
and most commands are the same
true, its just putting them together i have problems with.
Cache1MarkerPos = [getPos cache1, random 350, random 360] call BIS_fnc_relPos; "markertest" setmarkerpos Cache1MarkerPos
that seems to work just double checking
yup that works, not sure how its diffrent.
cheers
Hello
I'm having trouble with the Score in FFA gamemode.
I thought it was due to west setFriend [west, 0]; so I tried with player addrating -100000; but got the same result :
When I crash my own plane, the server gives me 5 points though it is a suicide... can someone help ?
Hello I'm making a PvP conquest mission and have icons showing above friendly players but they won't show when the player enters a vehicle I'm not sure how to do this any help would be great I can also link what I have so far
I may be wrong but I don't think you can get the exact world position of a player inside a vehicle and you'd have to use the vehicle itself to place an icon
again, probably wrong π
I want it to work like wasteland @halcyon crypt I'll link what I have so far a friend helped me with this https://pastebin.com/FWJTFJwE
can't you just take wasteland and check how they did it?
I'm new to making missions this is my 1st PvP mission I'm not sure how I would do that
Oh right thanks
that seems to be way more complex than it should've been I think
I'm a complete nub nub mate can you point me in the right direction to what I'm looking for in that lol
look for drawIcon3D and backtrack from there
drawIcon3D -> foreach drawPlayerIcons_array -> find all the places where drawPlayerIcons_array is modified -> etc -> etc ^^
Ok cheers mate
Have no clue how to add that to what I already have lol @halcyon crypt I'll have to do a lot more research thanks again for your help mate
what is the lastest and greates positional command ? , it seems Arma has developed a greater level of Aids in relation to float point problems from [0,0,0]
private _myArr = [1,2,3];
for '_i' from 1 to 10 do {
_myArr append _myArr;
};
Is this a bad way of repeating array
@peak plover beware! This keeps adding larger and larger arrays
Ahh right
And that's assuming the implementation can even handle same argument both sides.
Is there 'good' alternative?
yup, ran into this very stupid design not later than last week :D
[1,2,3] + [1,2,3], [1,2,3,1,2,3] + [1,2,3,1,2,3], etc π
Just use a different array with what you want to add
what exactly do you want to do?
So _addArray = [1,2,3]; _resultArray = []; .... add _addArray to _resultArray X times.
^
*add meaning append
_locArr append _loc;
yeah
or
for '_i' from 1 to 10 do {
_myArr append _i;
};
?
you would then end with a [1,2,3,4,5,6,7,8,9,10] array
I need to repeat the elements in the first array
private _loc = [1,2];
private _locArr = [];
// make location arr bigger
for '_i' from 0 to 10 do {
_locArr append _loc;
};
_locArr
then Muzzleflash's code it is
Yah
Another option may be not to remove elements from the array at all - if possible.
Actually
I found a better solution for my situation
I'll just check when array runs out and append once
per empty arr
Ahh I can use mod for selecting the array element
Don't even have to edit array
I'm doing custom sides and respawns for those sides
Amount of locations can be from 0 to any
amount of sides
0 to any
Well
not really 0
from 1 to any
sides from 2 to any
// // west and east vs resistance and civilian
// [['Good Guys',west,east],['Bad Guys',resistance,civilian]]
// [respawn_round_loc_1,respawn_round_loc_2]
I just mod the amount of locations
so no matter how many sides, they all get 1
do you want a random respawn location or always 1, 2, 3 then 1, etc. ?
In a row
1st side gets first 2nd gets second 3rd gets 1st
I'm making it so
Sides can be defined as single units
Or group
or whatever really
oh ok
[['Alpha','blu_1'],['Bravo','blu_2'],['Charlie','blu_3'],['Delta','blu_4']]
for ex.
4 squads
@errant jasper And that's assuming the implementation can even handle same argument both sides.
It doesn't even know if they are the same.
@still forum
More like whether it had a naive implementation like:
for (elem : source) target.add_back(elem)
which would 'never' terminate depending on implementation details.
E.g. if an iterator was used that did not get invalidated.
How can i turn a picture (Make it rotate / spin) in a dialog?
Example in Python:
mylist = [1,2,3]
for x in mylist:
mylist.append(x)
Nah. I think it copies with iterator range
allocate new buffer.
copy old content
copy over content to append
replace buffer in array object with new one.
@errant jasper sqf-vm dies when doing that π
Not sure about arma, but my sqf implementation gets fucked up because of using the size Parameter of the array in a for loop as upper limit
I think you should be okay, if you just read the size once
You would be
But I did not do because lazy
Home sweet home
Well.. The c branch won't get any more love anyways π€·ββοΈ
I Rly hate how that emojie works on my keyboard but not in discord π
I was a little confused X39
It is the other gender Variant
Yeah but why?
Reason is good enough with me
Why does event based code lead often to low coupling of components/code? I hear this often in game programming but I don't directly understand how the latter could result in from former
because itβs subscription based
the code that publishes doesnβt have to know about the one that subscribed and continues to function with or without it
Interesting, I've been doing that unintentionally I guess
So the data feeded to event is publisher and events are subscribers?
triggering an event is "publishing", attaching yourself to said event is subscribing
Yes, that's what I meant
Thanks! You're actually the first ones that gave me an answer π
i didn't ? π€
obsolete message: hey! @cedar kindle ^ helped (I don't know if you saw his messages)
@cedar kindle NO you didn't π
you asked why it was considered low coupling :p
first oneS
we both helped, we are the first oneSSS
it's because we are a priceless, helpful community π
π
hahaha sorry for the misunderstanding here m8 - you're welcome!
can someone have a look at this please im really stuck i nned the icon to show above friendly players in vehicles at the minute it only shows when they are on foot thanks in advance https://pastebin.com/259KYNqN
nearestObjects [position, types, radius, 2Dmode]
and you have _units = nearestObjects[(visiblePosition player),["Man"],500];
ok thanks @meager heart how do i get the class name for the ATV or is that what i put in
Right click on an object in Eden > Log > Copy class name.
got it mate thanks very much
is it possible to create a light source thats directional/conical like a flashlight? so far all the objects bleed light everywhere even through walls.
@lusty canyon https://community.bistudio.com/wiki/setLightAttenuation is the only thing i can think of
@subtle ore tried that but didnt give me what i wanted, some of the static camping gear props have a good light cone on them. is it possible to create them but only have the light source visible?
hideobjectglobal also makes the light invisible as well π
arma+lights does not allow very complex stuff
what are you trying to do exactly? might be other ways to do it
@young current I think the idea is to form a light that shines sort of like a flashlighgt in a circular pattern
is it possible to create a light source thats directional/conical like a flashlight? so far all the objects bleed light everywhere even through walls.
yeah i want to add a flashlight to the remote designator turret axis
When spawning objects (such as a carrier) server-side, if you teleport players to the position on the carrier shortly after, the carrier is missing or parts are missing. After a couple minutes, there is no issue. Is there a way to transmit the data to the clients immediately so it isn't an issue?
what kind of an object is this remote designator turret?
it's the ones you plop down on the ground and designate things in view
vanilla thing?
Yes
Lol
and I assume it has to move with it?
What has to movd with it?
yeah has to move wth it
so you want to create a spotlight?
There is no light
?
it's like a designator with a servo stand
flashlight
one of you should now do the talking
I'm sorry, i don'f mean to confuse.
np. It just gets confusing fast like that π
its slaved to the players crosshairs (lineintersect) so whatever the player looks at the turret also moves too, now i need a flashlight attached to its turret
so kinda like a spotlight
what if a take one of those camping prop torches and remove the model? will it still light up?
remove the model how?
like cfg model = "";
could be
Why not just create it based on model selection?
whats model selection?
Just like the player has selections for their hands, feet, etc . They're sort of like reference points. Although i believe some are used for hit detection, not sure though
its not the same
And you can add a ui event handler to check if the mouse is moving x and y
How do you mean?
Yes, i never implied it was attached to the player
ok so i can createvehicle "camping_torch_whatever" get the model selections then use hideselection on it so only the light source remains?
if it has hiddenselection
yeah flashlight should be attached to turret axis
which it may not have
You'd have to check with: selectionNames
ok ill try that, thanks
π€
π
How can i set a variable with defult value (ie if the variable gets changed and the code runs again whatever its set to latest is what it will be and not refresh with what ive called defult) what ive written makes little to no sese if someon gets what i want they are magician.
English?
set a variable with defult value or get a variable with defult value ?
Set a variable
You lose me after "the code runs again".
tbh i lost myself when i wrote it.
I mean.
if (isNil "_var") then {
_var = <default-value>;
};
Let me try again EXAMPLE code ```sqf
_round = 1
if (_round == 1) then {
bla bla bla
}
else
{
if (_round > 1) then {
.....
}
}
_round = _round + 1;
Is that part of a loop? Or is it a different script instance every time?
Nope¨
To init an extension from addon, you just put an extension in the pbo root?
What nope? Neither?
Its a function and NOT in a loop
So it's a different script instance every time.
Yes
You probably need a global variable then.
Wouldent this work ?``` if (isNil "_var") then {
code
}
else
{
if (_var > 1) then {
code
}
_var = _var +1;
OO no NVM it wouldent work
No.
crap
maybe varspace getVariable [name, defaultValue] and use switch, James Grimm ?
Dudes one question to anybody who works with callExtension: to init extension from pbo (addon) you just need to put it in the pbo root?
you can put it in any addon root or arma3 root directory.
@tough abyss thanks.
dudes
how can you get any unit to open the arsenal? (ai can be ordered to open arsenal by ammobox addaction, but they take forever to move next to the damn box)
["Open",cursortarget] spawn BIS_fnc_arsenal;
always just opens the arsenal for the player
The arsenal obviously only is a player thing and not for the ai.
like i said it does work on the ai but only through addaction
Please explain what the ai would do with the arsenal.
i just tested it a second ago, players can select items for the ai
I think:
Player edits own self -> Arsenal
Player edits ai loadout -> Arsenal
I believe it also has to do where it's executed local to
["AmmoboxInit",[<box>,(<allowAll>,<condition>)]] spawn BIS_fnc_arsenal;
fnc adds an action to the box, then you order your AI next to the box. player can then proceed to select whatever
what im asking is a way to bypass that altogether and just open the arsenal on whatever is cursortarget
Where's the addAction?
the action is on the box itself made by the fnc
Take a look at the function itself and it's valid parameters
the two you posted above are both biki examples
If it's not documented on the wiki, then it probably doesn't exist. Good luck working yourself through the arsenal functions, which is 3200 lines of horribleness.
["Open",[true,objnull,_entity]] call bis_fnc_arsenal;
3den does this, but who knows if that works ingame. Syntax is not documented in the functions header.
WOW, that works!
lol
the good thing also those params magically unlocked face/insignia stuff too
I just copy pasted this from the function that is used in the 3den config. Β―_(γ)_/Β―
BIS_fnc_3DENEntityMenu
Apparently in "Open" mode, arg[1,0] means fullArsenal, while [1,1] is the "cargo" and [1,2] is the "center".
Guess "center" means which unit is getting dressed up.
"Open" - Open the Arsenal
0 (Optional): BOOL - true to open full Arsenal, with all categories and items available (default: false)
1,0 is documented, the other two aren't.
cargo and center. Both OBJECT. cargo defaults to objNull and center defaults to player.
thanks for that one, next question : can you make a lamp object invisible but still keep the light source it emits?
i tried
{ _campLightStaticProp hideSelection [ _x , true ]; }foreach selectionNames _campLightStaticProp ;
but nothing happened
Pretty sure hideSelection only works on simple objects, and those don't emit light afaik.
"Land_PortableLight_single_F" makes a bright directional light cone, i want to use just the light. how to remove extract make model invis?
Never heard anyone do this, Probably not possible.
btw you can hide arsenal preload with loading screen
//--- That will hide arsenal preload
["LoadingScreen"] call BIS_fnc_startLoadingScreen;
//Preload arsenal
["Preload"] call BIS_fnc_arsenal;
/* add/remove items */
["Open",[false,_origin]] call bis_fnc_arsenal;
["LoadingScreen"] call BIS_fnc_endLoadingScreen;
that will auto open it...
_origin that is player
what happens if you just call the preload without a loading screen?
it will not work i think and then when you try open it /auto open it... first will be preload and after... arsenal
with that "hide trick" everything will looks just like normal mission start and arsenal will just open immediately with the action
I have "example mission" with the arsenal things ... can send it to you
nah all good thanks (im alergic to missions and cfg, i live in pure SQF land)
then glhf π
What happens to a function within CfgFunctions which has no tag but has preInit or postInit argument. Compiled without tag or just thrown away?
Is it possible to stop a specific weapon being holstered? like making it impossible for a certain weapon to actually be holstered
or at worst is there anyway to detect when a weapon gets holstereed? so I can then use the DropWeapon action?
@worn hatch primaryWeapon|secondaryWeapon|handgunWeapon against currentWeapon will allow you to compare what unit has in his hands and which is on the back.
how do i add a JIP to a custom radio channel? i have this in my initserver.sqf.
MB_AlphaChannel = radioChannelCreate [[0,0.165,0.439,1], "Alpha", "Alpha", []];
publicVariable "MB_AlphaChannel";
i have this in my init.sqf file but its not working
[player] remoteExec ["TLS_fnc_ChannelSettings", -2, false];
and this in my function after i do some player role detection
MB_AlphaChannel radioChannelAdd [_player];
how would you optimize a check on all vehicles avoiding them to flip over?
current approach for one vehicle
while {alive(_vehicle)} do
{
_vel = velocity _vehicle;
_dir = direction _vehicle;
_velocity = (_vel select 2);
sleep 0.25;
if ((vectorUp _vehicle select 2) < 0.55) then
{
_vehicle setVectorUp [(vectorUp _vehicle select 0) * 0.5,(vectorUp _vehicle select 1) * 0.5,0.60];
};
if ( (((_vel select 2) - _velocity > 4)) ) then
{
_vehicle setPos [ getPos _vehicle select 0,getPos _vehicle select 1,0.5];
_vehicle setVelocity [((_vel select 0)+(sin _dir)) * 0.5,((_vel select 1)+(cos _dir)) * 0.5,0];
};
};```
wondering if additional more simple checks when looping on all vehicles may be useful
@velvet merlin Maybe just stack the execution
@unborn ether Every function in CfgFunctions has a tag. There's no such thing as a function without tag.
Stop trying to hide your code. If someone wants to find out what your mission does, they will.
@exotic tinsel Check the RPT. radioChannelAdd has to run on the players machine, but you use remoteExec for some reason.
@velvet merlin I guess optimal way... Only run that script on the guy that owns the vehicle. aka the driver. So that one client can have at most one of these scripts running.
I think it's mainly for AI.
Should be times sin/cos _dir, not plus sin/cos _dir btw.
Anyone have any idea why when I create a dialog from initPlayerLocal and once the player is no longer null and the main display isnt null, when they click a button to close it a further loading screen displays for a few seconds?
Because there might be a loading screen after the main loading screen
Any mod can start/stop a loading screen whenever they want
For example MCC does that
This is a vanilla mission, my own one and I've got nothing that could cause one from what I see, so I'm very confused. It seems to only happen in multiplayer too
There's like 3 loading screens and the player or the mission display being not null doesn't mean all loading screens are done.
Is there a way I could wait until their all over?
CBA has a feature. But vanilla...
Make the screen black. Sleep 20 seconds. And then make the player see stuff again. And hope all loading screens went through in the 20 seconds
@compact galleon @little eagle @still forum ty
is local var assignment always slower?
Than what?
_vel = velocity _vehicle;
_dir = direction _vehicle;
_velocity = (_vel select 2);
should these be done or rather without local var assignment
If you use it more than once then use local var
also add private That makes it a little faster
^
Wait... wtf
_velocity = (_vel select 2);
if ( (((_vel select 2) - _velocity > 4)) ) then
aka
if ( (((_vel select 2) - (_vel select 2) > 4)) ) then
also WTF is up with your brackets?
if ((_vel select 2) - (_vel select 2) > 4) then
@velvet merlin that doesn't make sense.
x-x is never > 4
x-x is never > 4
Prove it.
Okey.. you're right.
Could happen if x is a special datatype that always returns a different value each time it's read
well the above code isnt mine.. and i havent used that yet
in the past i used this i believe
while {alive _vehicle} do
{
if ((vectorUp _vehicle select 2) < 0.5) then
{
_vehicle setVectorUp [vectorUp _vehicle select 0,vectorUp _vehicle select 1,(vectorUp _vehicle select 2) - 0.05];
};//... not enough,not even sure if it's correct.
sleep 0.05;
if (((velocity _vehicle select 2) > 5) && (sqrt(((velocity _vehicle select 0)^2) + ((velocity _vehicle select 1)^2)) < 20) && ((getPos _vehicle select 2) > 3)) then
{
_vehicle setVelocity [velocity _vehicle select 0,velocity _vehicle select 1,(velocity _vehicle select 2) * 0.5];
};
sleep 0.05;
};```
there is also this variant :P
while {alive _vehicle} do
{
if (((vectorUp _vehicle select 2) < (0.3)) or (((velocity _vehicle select 2) > 5) and ((getPos _vehicle select 2) > 4))) then
{
_vehicle setPos [getPos _vehicle select 0,getPos _vehicle select 1,0];
_vehicle setVelocity [(velocity _vehicle select 0) * 0.5,(velocity _vehicle select 1) * 0.5,(velocity _vehicle select 2) * 0.5];
};
sleep 0.1;
};```
vectorUp _vehicle select 2
See commy. Good example for why to set parens even if not needed
?
(0.3) Very bad example too.
Asplain.
vectorUp (_vehicle select 2) doesn't make sense. as _vehicle is an object. as checked before with alive _vehicle
Yes, it's a good idea to not set parenthesis if they break the code.
I don't get what you're saying.
Dunno. I skipped half of the conversation yesterday
Who was the guy against parens again?
Me.
Oh okey then.. @little eagle Hey you! Read above.
Just look at these examples here. So annoying to read.
mostly annoying because lack of proper indentation or line breaks or and/or and the selects everywhere.....
_vehicle setPos [getPos _vehicle select 0,getPos _vehicle select 1,0]; wow :U
Yeah, and or usage like this fucks hard with the brain.
I think I'm a fan of this:
getPosWorld _vehicle params ["_x", "_y"];
_vehicle setPosATL [_x, _y, 0];
_vehicle setVelocity [(velocity _vehicle select 0) * 0.5,(velocity _vehicle select 1) * 0.5,(velocity _vehicle select 2) * 0.5];
_vehicle setVelocity (velocity _vehicle vectorMultiply 0.5);
Though, this is an infinite loop for a vehicle. Vehicles change locality, but setVelocity is a command that requires the object to be local. So idk.
That's why I said. Run script on player. Only for vehicle that player drives if he drives one.
Locality and performance problems all solved
Still think it's for AI. But how do you guarantee that AI's vehicle stays in their hands?
Maybe don't care and just let semi working code run. It should do it's job 95% of the time.
AI's can flip vehicles?
ai need a script that checks if they flipped car or if they stuck their car
(vectorUp _vehicle select 2) < 0.5
Isn't 0.5 like 30 degrees? Would this trigger if the vehicle drives up or down a steep hill?
max is 1 min is -1
so 0.5 is like 45Β° up
No, it's a sine curve.
Not linear.
Ah, I think 0.5 means 60 degree here, so it should be fine.
How can i write a if ("True") run this code twice {//code}?
private _code = {player setdamage 0};
if (true) then {call _code;call _code;};
Thanks
That; or a for loop.
if (true) then
{
for "_i" from 0 to 1 do
{
// code
};
};```
But I'd assume call is faster than do
{code} forEach [1,2] :u
oooh
_lol = 0;
while { _lol < pi*2 } do
{
// code;
_lol = _lol + pi;
};```
winner winner param dinner
Got one more
if (true && _code) then _code
but _code needs to return true
lol
my else one can also be used with select I guess select looks weirder than apply
_code else _code select {isNil _x}
_lol = 0;
_code =
{
// code
_lol = _lol + 1;
_lol < 2;
};
while _code do _code;```
Now it's just getting ridiculous
Wait. I need a minute to understand that
actually, it's wrong
Do we have a do while loop i SQF?
No
bummer.
do _code while (true && _code && {false})
_lol = 0;
_code =
{
// code
_lol = _lol + 1;
_lol < 2;
};
while _code do {};```
there
Other one ran 3 times
retarded solution nr 29
_code = {ten_a = 2;false};
missionNamespace getVariable ['ten_nilvar',(call _code)];
ten_a // 2
So four * becomes **, wtf
In situations where you can add a handler via CBA_fnc_addClassEventHandler or in description.ext, which one is preferred?
mission specific
I would go for config
thank you
Depends on event. I've used fnc and description.ext. I feel like description is beter
@commy2 π©#9913 thanks again. the above code is from A1 and A2 days. anyhow vehicles can flip with players, AI or no one inside. also AI can also be local to the player if its in his group, right? (not sure about HC - maybe there too?)
@velvet merlin AFAIK AI is always local to the player if it's in his group
Not if the AI is leading the group
I mean, if the player is the leader
or if the group was manually transferred to the server
Can you force the change of ownership of AI that's member of your group?
Changes the ownership of a group (and all its units) to a given client. Group leader can't be a player. setGroupOwner
this command should not be used to transfer ownership of units with AI setOwner
Should not be used doesn't mean it doesn't work.
And what happens if group leader is a player with setGroupOwner
Nothing
Interesting
But if player doesn't lead group. Or if player joins the group afterwards while it's owned by the server...
If a player is the leader he gets ownership of the group
Can I use regexp in strings with SQF?
I was about to say that, lol
Hm, aight
Whatβs a reliable to get the local copy of a projectile across multiple machines? I have an event handler that takes the position and type of projectile and remoteexecs to the server, which then uses nearestObject to find the projectile. The server then does the same thing to the HC. Though Iβm not sure if this is the best way to go about this.
We were using a CRAM script that ran on a loop using nearestObjects to find projectiles within 2.5 km. So instead of doing that, Iβm trying to use eventhandlers to just add the projectile to an array, which would make that part of the loop infinitely faster.
Why not just use the fired eventhandler? It triggers for remote units and reports their projectiles too.
No need to send anything across the network.
Does it really? I was using Firedman. It sometimes didnβt even detect the weapon fire on HC, though. And I noticed that the projectile was null when it was on the server
Guided missiles are global objects anyway. I was looking moreso at things like an alamut or mortar. Is FiredMan known to be unreliable for remote units?
Don't know about firedMan. Always just used fired. Maybe there are differences.
Certain simulation types are not passed for remote units. They say objNull instead.
params ["_unit", "_weapon", "", "", "_ammo", "", "_projectile"];
// http://feedback.arma3.com/view.php?id=12340
if (isNull _projectile) then {
_projectile = nearestObject [_unit, _ammo];
};
This is the work around.
Yes, I noticed that.
And thatβs the issue Iβm having
Iβm just hoping for a better way to do it.
There is no better way.
And there is no need to transfer anything across the network with this way either.
I think Iβll try putting the event handler right on the HC again, this time using βFiredβ
π€
Exactly my reaction.
Pardon?
how can i get all dropped gear/weapons/equipments using https://community.bistudio.com/wiki/allMissionObjects
or similar command?
{ } forEach (allMissionObjects "GroundWeaponHolder");
great thanks G
also weaponsItemsCargo _holder;, jayTAC
strange i have some vests and guns on the ground in front of me but the resulting array is
[24c322acb80# 403457: dummyweapon.p3d REMOTE]
oh wait i think i have to do typeof
0 spawn
{
_detectedItems = [];
{
_detectedItems set [count _detectedItems, [weaponsItemsCargo _x]];
}
forEach (allMissionObjects "GroundWeaponHolder");
hintSilent str _detectedItems;
};
use pushBack over set [count
in total that script is exactly what apply was made for. So why not use it?
Β―_(γ)_/Β―
Hey guys i got a quick question, i got a function that return false or true. If i call this function like this _aRandomVar = call myfunc.
will _aRandomVar contain the return of the func ?
before:
0 spawn
{
_detectedItems = [];
{
_detectedItems set [count _detectedItems, [weaponsItemsCargo _x]];
}
forEach (allMissionObjects "GroundWeaponHolder");
hintSilent str _detectedItems;
};
after:
0 spawn {
hintSilent str (allMissionObjects "GroundWeaponHolder") apply {[weaponsItemsCargo _x]};
};
@compact maple eh.... yes.
thanks
Wiki has a note saying apply vs forEach is ~1.5% faster. Not sure how accurate that is
True
get's quickly irrelevant if you have code in it. especially something like set count bla
its on average 0.0022ms slower or something
exactly the time needed to increment and assign a variable
correct
here is the results
Result:
0.284898 ms
Cycles:
3391/10000
Code:
call
{
_detectedItems = [];
{
_detectedItems set [count _detectedItems, [weaponsItemsCargo _x]];
}
forEach (allMissionObjects "GroundWeaponHolder");
hintSilent str _detectedItems;
};
/**************************************************************************/
Result:
0.246351 ms
Cycles:
4231/10000
Code:
call {
hintSilent str (allMissionObjects "GroundWeaponHolder") apply {[weaponsItemsCargo _x]};
};
well ... there is the reason why empty apply vs empty foreach is slower
simply allocation
Wiki has a note saying apply vs forEach is ~1.5% faster. Not sure how accurate that is
yes? apply is faster
@meager heart most time is probably spent in the allMissionObjects there
should get more sleep
apply more sleep, X39 π
hmm, i have this kind of array: [['item1"],["item2],["item3"]]
i would like this array to be a basic array like ["item1","item2"].. i did deep in the wiki but i cant found what im looking for lol
Do an apply/ forEach and pushBack _x select 0 into a new array
@compact maple Check this out:
parseSimpleArray ("[" + (str _items splitString "[,]" joinString ",") + "]");
There, needed some parenthesis :~P
yw. I challenge anyone here to find something faster or shorter.
aha, good luck to them
[["broke"],["commy2, the poo fighters,"],["solution"]]
there you go @little eagle
Commas are not valid in classnames.
never was stated that they are class names
item1 clearly is a classname you dunce.
pff
πΏ
even if, putting that into a method to unpack stupid arrays will break
What?
/* magic method to "unpack" single item nested arrays ([[ITEM], [ITEM]]) */
...```
now call that with some random stuff you received from some random idiot and it will break
? He's working on weaponsItemsCargo if you payed any attention.
No you didn't.
[["broke"],["commy2, the poo fighter,"],["solution"]]
Duh, it also breaks when there any types that can't be serialized in the array.
yup
Any of your functions breaks if fed with illegal arguments.
That's literally saying nothing.
i call that broken
Because you're - again - completely wrong.
There are no cases where it fails when operating on weaponsItems.
i will now head back into my sqf-vm to re-implement the object type
You got your apply code backwards btw.
It's ARRAY apply CODE.
Not the other way around.
If that's in reference to the code posted above....
You can just remove the array in the apply code
instead of putting it into arrays and taking it out again.
Just don't do that
What's the generic version of player?
I'm trying to write a little script that will allow players to "recruit" local militia to join their group in just the simplest way possible.
Like, walk up to militiaman, have an addaction that allows the player to recruit it, but I don't know a generic way to have it be like... this player or some such thing.
player is... generic.. ?
Hmm... I'm phrasing this wrong.
the player is the local player that executes the script
if someone executes your addAction script. Then that guy is player
Anyone know why the Fired and FiredMan EHs don't fire for certain ammo types on remote units? It seems to work consistently when the EH is on the server though, but not from the HC.
@meager heart, can _unit be this?
HAha, not this, but this, sorry.
oh that one π
if i understand... you asking [this] joinSilent (group player); ? if that in this init then yes
I missed some fight here
couple
@strange urchin which weapons types are those ?
Thanks, @meager heart!
Why doesn't this work?
player addAction ["[this] joinSilent (group player)", {}];```
DEL-J, check this https://community.bistudio.com/wiki/addAction
I already have it open. I don't understand the syntax, I guess.
This is sitting in the init of the militia units.
It seems like it fired for vehicle weapons, and the CUP AK-74m. But other than that, it just wouldn't fire unless the EH was server-side.
this is undefined in that scope.
Will not work.
unless the EH was server-side
"Server side eventhandler" makes no sense to me.
I see. Sounds like an area we've tread recently. I'll look back at what we did yesterday or whenever that was.
@shadow sapphire
action_id = this addAction ["Join group", {
params ["_target", "_caller", "_ID"];
[_target] joinSilent (group _caller);
_target removeAction _ID;
}, [], 1, true, true, "", "_target distance2D _this <= 5"];
lgtm
I tried setting the event handler on the server, and I tried putting it on the HC. Whatβs not to understand about that?
@meager heart, worked like a charm.
nice
You have to add it on all machines. If you add it only on the server, it will never be executed on the headless client machine.
@unborn ether thanks dude thinking about it for my use I might be able to use just currentWeapon
How would adding the same event handler on the same unit to all machines help?
An eventhandler not added on the local machine will never be executed on the local machine.
If you only add an eventhandler on machine A, it will never be executed on machine B.
Server, client, hc. They're all the same in this regard. Doesn't matter.
I wish dialogs wouldn't stop rendering for a frame when it needs to load a .paa
That's great and all, but I added an event handler to machine B that used a remote unit from machine A. I expect it to fire on machine B.
And it should be executed.
The thing is that it did not get executed, depending on the weapon being used.
Well there are two possibilities. Either there is a bug that no one reported yet to my knowledge. Or you made a mistake.
Maybe make a as simple as possible repro, so someone else can confirm the potential bug.
How might I go about writing a tiny addaction to get information from civilians?
The script will go in their init.
Something like;
action_id = this addAction ["Question.", {hint format ["Hello."]}];```
But I'd like the hint they spit out to be like;
```I saw a some bad guys half a kilometer to the NorthWest.```
Or something like that, but based on where the enemies actually are. Something like getdistance and getdirection...
That's pretty neat... Not exactly what I wanted, maybe better than what I wanted, actually.
@ionic orchid If you have a static set of .paa you can cache them previously.
@unborn ether yeah, I'm trying to hide them in another interface so they are cached - but THAT interface then also doesn't render for a frame for the same reason
@ionic orchid Well you can do that on a background of findDisplay 46 while user is passing JIP
testing now where I can do a titleText "BLACK" and hide it all for a few frames on startup
Any explanation was made for diag_captureFrame in the past ?
People don't need to explain if everything is on the wiki
The wiki is how people do the explaining.
No but inside the GUI
Ingame documentation has many errors and can't really be fixed by the comm like the wiki.
i removed it from the other channel as i thought it went in here
I guess this is something for #arma3_scenario
I don't see scripting in there
ok lol
Yeah, just added the same event handler on the HC for all units. For infantry at least, FiredMan and Fired EHs only fired on units that were local to the HC
Yeah. Like addEventhandler wiki page says
I don't think it says anything about fired EH
enableDynamicSimulation need to be executed on each client ?
the one who owns the AI is enough I guess
π
πͺ
It says remoteControlled unit, not remote unit.
lol
Hi Guys,
I have a little problem with one of my scripts.
I am using CBA_fnc_globalSay3d to play a soundfile on a speific position and never had problems with it before, but now the file playes arround 5 times simultaneous.
This is my code.
{
If (_timer > 0) then {[[_caller, "chopping",180],"CBA_fnc_globalSay3d",true] call BIS_fnc_MP; _caller playmove "AinvPknlMstpSnonWnonDnon_medic4"; sleep 9;};
_x setdamage 1;
_x hideObjectGlobal True;
}```
any ideas?
afaik CBA_fnc_globalSay3d is deprecaited... BIS_fnc_MP is deprecated also...
use remoteExec for both ^
typeOf objNull what does this output?
OBJECT
typeof != typename @still forum
π
should be empty string i guess
that is what i guess too
but i cannot confirm it on my system as i got no arma installed as usual
_var = objNull; hint str (typeOf _var); //--- ""
" " or "" ? Really a space?
lol
fixed π
kk
Both return ""
error?
No error
kk
Just returns an empty string
ty
np
stuff like no error means that sqf-vm will output warnings all over those places π
Hey gents.
How do I make my dialog scale to the correct size for different ratios and UI sizes? On 16:9 and normal UI my dialog is centered, but different UI sizes throw it way off. Here are some of my basic defines:
#define dce_X 0
#define dce_Y 0
#define dce_H 1
#define dce_W 1
#define dce_BUTTON_H 0.05 * safezoneH
#define dce_BUTTON_W 0.06 * safezoneW
#define dce_SPACE 0.005 * safezoneW
#define dce_COL (dce_X + dce_SPACE)
#define dce_ROW (dce_Y + dce_SPACE)
#define dce_COLINC (dce_BUTTON_W + dce_SPACE)
#define dce_ROWINC (dce_BUTTON_H + dce_SPACE)
problem is in how you use it
0 & 1 are the left & right of the savezone
if you check out this img
you will see, that safezoneW is the FULL width of the center monitor in arma ui scale
thus your button_h, button_w, ... defines go rampage
in other words: you have to decide wether you want to stay in the safezone square in the middle
or you want the whole display as span range
in general, i would recommend you to use a separate tool
either the inteliJ plugin (https://github.com/kayler-renslow/arma-intellij-plugin/releases) which also contains a UI-Editor
or eg. my (no longer supported) ui-editor https://x39.io/projects?project=ArmA-UI-Editor
Thanks mate. I'll take a look at those tools
So to make a dialog standard in size, is it best to use static values instead of safezone values? Or is there some formula for detecting and adapting across all scales?
format ["%1 %% %1", 0] what does this output?
again, check the SafeZone wiki page
there are images that show what the 0-1 system will do for the different UI scales and monitor 16:9stuff
Thanks for the help mate
format ["%1 %% %1", 0] // 0 0
format ["%0"] // empty string
no error etc? @meager heart
yep, no errors
so more sqf-vm warnings
if (isNil '_res') then {0} else {_res}
Found this in a script, is there any point in the line?
somevarinfront = ...
that probably leading?
or any other value context*
what you see there is pretty much nothing but returning 0 in case _res is not set yet
the actual sense of that code is ... beyond me
as you have to set _res anyways and should never rely on upper scope variables outside of your function that may or may not be set
though ... there are even for that usecases
@carmine maple that is "fix" for undefined variable
quotes man ^
sqf-vm-cpp now can do format again β€ ty @meager heart
nice
ah ok thanks, its part of some quite old code, with many scripts π Have not see that kind of of style for setting an undefined var yet.
the c branch could do it the whole time though
but now taking care of more edge cases because ... they came in my mind
let me tell you something @carmine maple
if you got some legacy code that still is working, never EVER touch it
never
under any circumstances!
and if you have to touch it for whatever reason, rewrite it
i could use some help with adding JIPβs to custom radio channels. i have this in my initserver.sqf
MB_AlphaChannel = radioChannelCreate [[0,0.165,0.439,1], "Alpha", "Alpha", []];
publicVariable "MB_AlphaChannel";
And this in the init.sqf
[player] call TLS_fnc_ChannelSettings;
And this is in the function after some role detection logic.
MB_AlphaChannel radioChannelAdd [_player];
It works of course just for me when hosting server but no one else.
@queen cargo i dont have time to rewrite and recheck 450 different scripts though π
@exotic tinsel mb https://community.bistudio.com/wiki/radioChannelAdd also has to be executed serverside
try to execute it on server too
if it then works, check back on me
it works if i do this from the init.sqf but i think this is broadcasting everywhere for each JIP. ```sqf
[player] remoteExec ["TLS_fnc_ChannelSettings"];
thats wrong right?
yup
will be executed on every computer
could be correct way to do so though
never used that command
na its wrong, ill keep at it. trying to find syntax for executing this remotely to the server. ```sqf
MB_AlphaChannel radioChannelAdd [_player];
this worked
[player] call TLS_fnc_ChannelSettings;
[player] remoteExec ["TLS_fnc_ChannelSettings", 2];
how do i set it so that you cant hear or see other channel traffic if your in a diff custom radio channel?
toString [1, true, "something", {}, []]
what is the output of this?
toString [1, true, "something", {}, []] returns ""
Which aren't visible in hint or systemChat. Those just show " "
ok ...
diag_log or copyToClipboard return ""
toString [84];
toString [true];
toString [false];
toString ["something"];
toString [{}];
toString [[]];
toArray toString [84];
toArray toString [true];
toArray toString [false];
toArray toString ["something"];
toArray toString [{}];
toArray toString [[]];```
to get more info on this
diag_log toString [84];
diag_log toString [true];
diag_log toString [false];
diag_log toString ["something"];
diag_log toString [{}];
diag_log toString [[]];
diag_log str(toArray toString [84]);
diag_log str(toArray toString [true]);
diag_log str(toArray toString [false]);
diag_log str(toArray toString ["something"]);
diag_log str(toArray toString [{}]);
diag_log str(toArray toString [[]]);
``` returns ```
19:54:38 "T"
19:54:38 ""
19:54:38 ""
19:54:38 Bad conversion: scalar
19:54:38 ""
19:54:38 Bad conversion: scalar
19:54:38 ""
19:54:38 Bad conversion: scalar
19:54:38 ""
19:54:38 "[84]"
19:54:38 "[1]"
19:54:38 "[]"
19:54:38 Bad conversion: scalar
19:54:38 "[]"
19:54:38 Bad conversion: scalar
19:54:38 "[]"
19:54:38 Bad conversion: scalar
19:54:38 "[]"
ty @ruby breach
how can i remote execute this on the players client?
6 radioChannelRemove [_player];
is there away to tell if a zeus is remote controlling an AI?
If you look at the actual script for the module, I think there was a setVariable done on the unit to keep track of that sort of thing.
Or maybe it was commented out.
Uh.. Is there no vectorDivide command?
_vector vectorMultiply (1 / _divisor)
@carmine maple
Found this in a script, is there any point in the line?
It doesn't do anything on it's own, unless it's the last line and therefore the return value of the function.
@scarlet temple
You used CBA_fnc_globalSay3d which has global effects inside BIS_fnc_MP which broadcasts the function everywhere. So every connected clients sends the sound file to every connected client. 2^n sounds will be played where n is the number of dedicated clients. Either use say3D instead of a global variant or drop the BIS_fnc_MP.
@whole light If I try to center a control, I usually use 0.5 - width/2 as X and 0.5 - height/2 as Y.
@still forum @strange urchin Again, fired will trigger for remote units. AL EG. If this somehow doesn't work on headless clients, then make a repro, because it's a bug. Unless demonstrated I still believe he made a mistake, because I never heard of anyone else having this problem.
confused by https://community.bistudio.com/wiki/orderGetIn
is true => AI gets into a vehicle
and false => AI gets out
?
like this doesnt make sense, does it?
if (vehicle _obj != _obj) exitWith
{
unassignVehicle _obj;
[_obj] orderGetIn true;
};
{
unassignVehicle _x;
[_x] orderGetIn true;
} forEach (crew _obj);```
unassignVehicle => leave vehicle
orderGetIn true => get back in
or not?
@velvet merlin I wouldn't say so exactly
like "orderGetIn" to give the order, you are assigned to the vehicle (like for transportation) but you are ordered off ("false") for fighting and still assigned to it for long-distance
_unit assignVehicle _myCar; // tells the unit "this is the car you use when I order you to "getin"
_unit orderGetIn true; // "get in your assigned vehicle!"
waitUntil { _unit in _mycar; };
sleep 3;
_unit orderGetIn false; // "get out of your assigned vehicle!"
waitUntil { not _unit in _mycar; };
sleep 3;
_unit orderGetIn true; // "get in your assigned vehicle!"
@winter rose i can see your point. however is this what really happens with the given commands?
@velvet merlin Yes. orderGetIn will make the given unit move in or out of its assigned vehicle
but thats kind of the point. if the logic would be the other way round. you force it out but still keep it assigned to the vehicle
however the above is to remove the connection to the vehicle but order them in
@velvet merlin Didn't read your initial message. But no, that makes no sense
orderGetIn won't do anything if a vehicle isn't assigned
Unassigning a vehicle will make the unit get out on its own
@little eagle CBA_fnc_globalSay3d don't work global.. idk why.. but it isn't
but i ll test it again
playActionNow is mp synced ?
Wiki says Arguments Local, Effects Global, which means that you have to use it on a local unit and it will take effect on all machines.
Pretty sure the point of CBA_fnc_globalSay3d is that it works globally.
Dunno make sure to whitelist say3D in CfgRemoteExec if you're using that.
Is there a way to create an agent locally, like how createVehicleLocal works?
Counterpoint: rabbits.
You can't create local agents like rabbits, snakes and fish by command yourself.
Im making a clothing menu with a 3D preview of the player using an agent. But because this is going to be on multiplayer, I want it to be local. I guess I can just use createVehicleLocal
wait, it's SP only?
Sorry, corrected myself
you can't
Not sure if you can dress up the soldier if he is created as vehicle and not as person.
Just create him and ```sqf
[_unit,true] remoteExec ['hideObject'];
_center = (typeOf player) createVehicleLocal [0, 0, 0];
_center setPosATL (getPosATL _sphere);
_center setDir 0;
_center setUnitLoadout (getUnitLoadout player);
_center switchMove (animationState player);
_center switchAction "PlayerStand";
_center setFace (face player);
_center enableSimulation false;
Just tested it then, turns out you can. Now the only issue is the unit is stuck in a holding gun animation.
You'd also have to handle disconnection, as these objects are transfered to the server and become global objects if the player disconnects.
^
Nah I think I can just use createVehicleLocal now, just have the holding gun animation issue now
Pretty sure they can't be animated if they're not created as persons. And you didn't even listed to what I wrote about disconnection and CVL created objects becoming global.
Nice
@little eagle Sorry, misunderstood what you said. Didnt even know that was a thing, ill make sure they get properly deleted then
np. This should be a diclaimer on the CVL wiki page.
Yeah theres nothing about it on there
Explain me like I'm five: on which machines will initJIPcompatible.sqf execute when a player joins a mission?
All clients including headless?
all clients including headless
Thanks @lone glade π
Oh... It's not even available in Arma 3 (according to biki) π
Sigh
Is there any point in hiding server side functionality in addon when the mission and framework is open source and available on GitHub?
That's what I was thinking as well
Thanks for the confirmation π
Though, wouldn't it be easier for communities to make their own private edits if the server side functionality was already hidden in server addon?
Like just for convenience
Oh well, using Workshop mods with SteamCMD seems like a PITA anyways so I guess I'll just tell the hosts to do it themselves
yes. ofcause if you change serverside stuff you don't need to update clientside
Then the next stupid question: does the serverside addon have to be compiled into .pbo or can it include just pure source code like missions can?
@tender fossil No, you need to declare anything in config.cpp of an addon. CfgFunctions for example.
So I just declare stuff in config.cpp and using source code instead of pbo is fine?
@tender fossil config.cpp is a config of a pbo. You can't just throw SQF to the addon root.
So I can't place an addon folder with contents like this on server? https://github.com/RPFramework/RPFramework/tree/2c232d48001a83fa8f1702ba22ee53c5f6ecd150/%40RPF_Server/addons/rpf_server
@unborn ether
@tender fossil PBO the folder and then place it to a server addons folder.
Aight, I see. Thanks for info again @still forum @unborn ether π
Is filepatching a security risk @still forum ? Or why shouldn't I do it
Is there any resource so I can read more about the topic?
that's why I said "complicated"
It is not really a topic
once you understood how the arma filesystem works you'll understand that too
I see, thanks again π
i think (sorry if im wrong) but with file patching you can access all the files on the server even if they are not located within a pbo
^ That's my understanding of it, any data that is "unpacked"
yes that's trueish
"Trueish"
Stop inventing words Dedmen
trueble *
truebleh?
hmm π€
π€·
Hello can you somehow disable this? https://community.bistudio.com/wiki/ArmA:_Cheats
Maybe someone should add the ways to disable that to the wiki
No you can't disable it
but you can detect when someone is trying to do it. And handle him however you want
Trying to check if someone click shift -?
so in helicopters if u ctrl+right click it brings up a camera , and some of the helos have nvg and thermals where as some only have thermals. Is there a way to give that optic nvgs? I went ahead and used _this disableNVGEquipment false; but it doesnt work,and im gonna assume it doenst work because the vehicle config doesnt nvgs for the optics to begin with so theres nothing to enable/disable. So my question basicly is how do u add the nvg equipment to a helo?
something with cameraView and ppEffectCreate maybe π
I feel like theres a wasier way XD, if I could edit the config ik where it is,but I cant edit the config sooo rip
bis_fnc_initInspectable - is there a way to know if player actually inspected the leaflet?
If client sends remote execution request to server, does the function being called have to be defined on client as well?
Eg. My client is calling function serverDoSomething on server, but serverDoSomething is defined (compiled) on server only - would this work?
Excellent, thanks again π
@edgy dune currentVisionMode will help you detect any vision mode
@unborn ether would that let me change the vision mode?
or rather
is there something that does?>
@edgy dune Well, for vehicles theres only disableTIEquipment|disableNVGEquipment afaik. But if you are willing to disable TI in general, just make it this way:
if ((currentVisionMode player) isEqualTo 2) then {
85000 cutText [format [(localize 'STR_NOTF_BadVision'),(actionKeysNames ["nightVision",1] splitString '"' select 0)],"BLACK FADED"];
85000 cutFadeOut 99999999;
} else {
85000 cutText ["", "PLAIN"];
};
Place it in a while or whatever.
@edgy dune If commands above doesn't really disable the equipments, that might mean its scripted within vehicle, or badly composed?
cough cough
//--- Night vision
0 spawn {
private _color = ppEffectCreate ["ColorCorrections", 1999];
_color ppEffectEnable true;
_color ppEffectAdjust [1, 1, 0, [0.4, 1, 0.4, 0], [0.4, 1, 0.4, 0.0], [0.4, 1, 0.4, 1.0]];
_color ppEffectCommit 0;
private _blur = ppEffectCreate ["dynamicBlur", 505];
_blur ppEffectEnable true;
_blur ppEffectAdjust [.2];
_blur ppEffectCommit 0;
setAperture 0.1; //--- brightness
};
cheater
bulli
π
what does the 85000 and 99999999 mean?
it means "to the infinite and beyond" that this resource will occupy 85000 layer (layers have order) and fade out for duration of 9999999.
Not sure how you came to arrays, but ask Dedmen for that π
what?
some big number is the max amount of elements
atleast someone wrote that on wiki. Whether it's correct I dunno
But that has nothing to do with cutFadeOut
You cant edit configs?
nop
Which one?
well the helicopter that im taking about is in a mod so
oh that ones.
and I kinda dont wana touch the config cause well ive never done it π
yep
can i ask for help? i'm working on custom lobby dialog, find RscDisplayMultiplayerSetup in Addons\ui_f, but have a problem. Can't find place where script create this dialog, set player role's listbox and action on buttons.i have a little addon on my server with custom dialogs settings and main menu. But can't find lobby scripts to make it custom too π
there is no script that creates that dialog
there are no scripted actions on buttons
@verbal otter RscDisplayMultiplayerSetup dialog is handled by the engine itself. Occupied roles is some kind of RscListBox but its content is somewhat specific in the engine, as I found no way how to get/set anything from that. The most you can do is to move all the controls, respecting their IDCs and make it scripted with onLoad-like events.
@unborn ether, @still forum thank you! I need remove role selection, just select a side. Is possible to make automatic select role for player?Thank you again!
@verbal otter The thing I didn't achieve setting a role scripted, as lbSetCurSel actually just selected a listbox entry, but didn't take a role. That why I've said its somewhat specific. For me it looked like its some RscActiveText on top of listbox which is not activated like this.
@verbal otter Also there's no lbData, lbText or lbValue in each of entry afaik. So that gave me more questions.
@unborn ether thank you, mate!
I am hoping that someone will help me with this. I am new to coding but learning quickly.
What I am trying to do is make a white list for player slots where the slot can be defined and only the player listed came us that slot. if this could be done in the init section when placing players that would be great. If it has to be done to read a slotlist.sqf file that would work also. I have searched the intenet and have not found any code that I can understand. or detailed instructions on how to do this..
Please help me with this if possible.
if you want to do this check during slottingg (i.e. in the lobby) i would guess you need to do something we description.ext, since init.sqf isn't executed at this point
private _whitelist=["1234","1234"];
if(local player) then
{
if(!(getPlayerUID player in _whitelist)) exitWith
{
endMission "CONTINUE";
};
};
etc etc
yes it would be when they connect to the server to choose the player slot
I was hoping to name player slot officer1 and only a listed player uid could use that slot
office1 = "47585994383994940"
officer2 = "65473888475783858935"
and so on
if(local player) then
{
private _whitelist = ["47585994383994940","65473888475783858935"]; //these are player uids
private _uid = getPlayerUID player; //uid of connecting player
switch(roleDescription player) do
{
case "officer1":
{
if(!(_uid in _whitelist)) then
{
endMission "CONTINUE";
};
};
case "officer2":
{
if(!(_uid in _whitelist)) then
{
endMission "CONTINUE";
};
};
};
};
Ex
thank you so much I have been looking all over the place for this
No worries, I recommend you disect and study it. This isn't the only way of doing so and sometimes different techniques are handy to keep on your toolset
I want to clarify though: Role description is not unit variable
if(local player) then
{
private _whitelist = ["47585994383994940","65473888475783858935"]; //these are player uids
private _uid = getPlayerUID player; //uid of connecting player
switch(str player) do
{
case "officer1":
{
if(!(_uid in _whitelist)) then
{
endMission "CONTINUE";
};
};
case "officer2":
{
if(!(_uid in _whitelist)) then
{
endMission "CONTINUE";
};
};
};
};
Something along these lines would produce a similar result if a unit variable is set
playable unit init this setVariable ["var_slot",<number>]; and then getVariable and then switch it maybe ?
I have no idea what to do with that code
@meager heart Ehhhh....nah. I like this method because it's multi purpose
@broken kindle init.sqf or initplayerLocal, put it in a function if you feel.
The only reason why I changed it because a lot of people confuse "role description" versus "unit variable name"
Β―_(γ)_/Β―
I guess you could make dynamic and double check, but if you know what you're doing there is no need to. Only if you were to make something like that public
Question for long-time-scripting-veterans
Are there any definitive advantages to using SQS instead of SQF in ArmA 3? A friend told me SQS can do some things "better" than SQF in a more simplified way bypassing some aspects of the ArmA 3 engines newer features? Any thoughts?
@celest rivet Maybe you saw that already... http://killzonekid.com/arma-scripting-tutorials-sqf-sqs-and-script-scheduler/
@meager heart Thank you! I'm actually in the process of reviewing all of KK's blog posts but hadn't got to that one yet (only read about a quarter of them having started yesterday). I'm reading over it now
Is switch better than if then else?
@wispy kestrel It's not better, its different. If you talk about execution time, mostly the difference start showing up only on huge amounts of data.
Okay, thanks @unborn ether
What I'm doing wrong here? Does it need format command or sth?
[] call ["%1_INIT_server_initServer", MISSION_PREFIX]
[] call (format ["%1_INIT_server_initServer", MISSION_PREFIX])
Ah, I was using square brackets instead, so that's where it went wrong
Thanks π
call needs CODE and format reports STRING. This will error out.
missionNamespace getVariable format ["%1_INIT_server_initServer", MISSION_PREFIX]
Good evening guys! π Does somebody got an idea of how to use the custom-map-marker-drawing-function to create a scripted marker which is permanent and static, so it will not disappere once restarting the mission? Thanks for answers! π
So your example is correct @commy2 π©#9913 ...or?
@abstract shuttle External database probably best way, but also possible saving in profileNamespace
@meager heart Thanks for your answer! My actual problem is that I do not know how to create such a custum-made/drawn marker via script... I need to create a line following a street (for a quest system...) π¬
if(isServer) then
{
_mkr = createMarker["CookieTrail",[0,0,0]];
_mkr setMarkerType "hd_dot";
_mkr setMarkerText "Cookie Trail";
[_mkr] call mid_fnc_saveMkrToDB;
};
mid_fnc_saveMkrToDB:
params["_mkr"];
profileNamespace setVariable[(markerText _mkr),[markerPos _mkr,markerShape _mkr,markerSize _mkr,markerType _mkr],true];
saveProfileNamespace;
and then just use createMarker to re create the marker again upon start
That sounds great! I'll try it out π Thanks men! @subtle ore
Found something calles Polyline as well... Is there any possibility to use this command aswell?
"CookieTrail" setMarkerShape "POLYLINE";
And now as it is a polyline-marker... Where do I have to define each single polygon to draw just like in the drawPolygon command, Midnight already mentioned?
How would I go about fully adding weapon items/attachments to a groundweaponholder?
@warm gorge addItemCargoGlobal
SR_weaponHolder = "GroundWeaponHolder_Scripted" createVehicle (getPos player);
SR_weaponHolder addWeaponCargo [primaryWeapon player, 1];
{
SR_weaponHolder addItemCargo [_x, 1];
} forEach (primaryWeaponItems player);
This doesn't seem to add them to the weapon, just puts em around it. @subtle ore
Oh, to the weapon?
Yeah
Wait a sec, are you trying to add an attachment to the player's rifle?
No, trying to add an attachment to a weapon on the ground. Working on a weapon shop so I want to be able to dynamically switch out the attachments on the 3D preview
@warm gorge
_gwh = "groundweaponholder" createvehiclelocal [0,0,0];
if(_cfg == "CfgMagazines") then {_gwh addmagazineCargo [_item,1];};
if(_cfg == "CfgWeapons") then {_gwh addWeaponCargo [_item,1];};
if(_cfg == "CfgGlasses") then {_gwh addItemCargo [_item,1];};
That's how we done it...
Ummm...
First of all there isn't any declaration of _cfg, so that alone will not work
No, it's content binded for our server π
Then it doesn't apply here, I don't think you should be giving that as an example then.
Thought it will help... Sorry then...
I personally do understand it, just might be confusing for others
I appreciate it
Thats how im doing it though, however its not working as intended
No, it doesn't really make any sense.
if(_cfg == "CfgMagazines") ?
A config entry being equal to "CfgMagazines" ?
It is just a snippet. We use this in our script and it works fine...
Well what I am saying is even if it did work I don't think we're talking about the same thing
What's the actual difference between "GroundWeaponHolder_Scripted" and "GroundWeaponHolder" ?
It's sort of like doing:
{
if(_x isKindOf "ItemBase_F") then
{
_holder addItemCargoGlobal[_x,1];
};
} forEach _cfgList;
GroundWeaponHolder_Scripted - same as GroundWeaponHolder but will not be auto-deleted when empty
@warm gorge you can't add weapon with attachments in container, Dedmen was working on function for that, ask him...
Alright cheers
Hey #arma3_scripting , I have a question about Script Paths
For a .pbo-ed scenario, when I can loadFile "someText.txt"
Will it look in the .pbo itself first, then the Scripts folder of the arma installation path, then the arma install path itself?
And by extension, I can't alter the Scriptpath variable in a scenario pbo correct?
BTW typing #arma3_scripting doesn't notify people in the channel
I know, it only links the channel
If I did a (at)everyone, im sure a lot of people would be pissed
it's disabled anyway
point being, it's redundant π
anyway to answer your question, it looks in the mission root folder first
so just to be absolutely sure, If I have my scenario called 'firstMission.Altis.pbo' and I did a loadFile, It would look in this order?
./Arma 3/MPMissions/firstMission.Altis/ ./Arma 3/Scripts ./Arma 3/
yeah. im trying to work out how exactly i would load a file without knowing if it exists or not
if you have something like this https://imgur.com/a/PDyVr
then you'd simply say execVM "terminalUpload_ws.sqf"
or if it was in a sub folder then execVM "f/folder/file.sqf"
yeah, i got that in my mission already, I want to extend it outside the pbo file instead
with loadFile specifically you'll have to check the wiki
according to the wiki, they both have the same kind of script paths https://community.bistudio.com/wiki/Script_Path#Subfolder_reference
Hello people. Ive got a bunch of pictures in my mission fine how would the desicriptions includes look. would i have to include every singe picture in there? Simpley i want it to look in a folder for pictures please give an example.
_array1 = cursortarget getVariable ["Keys",[]]; //["000000","0000001"]
_array1 = _array1 set [0,-1];
cursortarget getVariable ["Keys",[]]; //[-1,"0000001"]
Is it a bug?
No, not a bug, reference type working as intended i believe
https://community.bistudio.com/wiki/getVariable take a look at example 3
I've seemed to not be able to even loadFIle outside of the editor's folder
Im so stupid, i needed to enable filepatching for it to work outside of the mission pbo, thank you @inner swallow
Ah π
I just tested, it won't check the scripts folder like it says on the wiki, I actually have to specify _z = loadFile 'scripts\myscript.file' instead of just myscript.file
Someone should probably edit the wiki
yeah, im saying it doesn't automatically look in a scripts folder itself
uhm. like how i wrote it earlier
ah
Like this, the wiki says it looks in this order
./Arma 3/MPMissions/firstMission.Altis/ ./Arma 3/Scripts ./Arma 3/
But it doesnt work as stated, I have to explicitly state that I want to look in the scripts folder, but what is really happening is that its going on to the 3rd option and looking for a subfolder named scripts in the arma root
Yeah, i understand now
probably mention it in #community_wiki
although if you have a BI account you should be able to make the changes yourself
@hushed minnow Not outside of PBO's without filePatching specifically enabled
yeah, i figured it out, and was trying to get someone to make a note of that on the wiki
how do i set call signs for a dedicated server? setting it in the squad properties doesn't work and neither does using the set call sign module. does anyone have a good how to guide?
when JIP logs on they do not have the callsign for their group i specified using set callsign module, has Alpha 1-2 instead of Bravo
Regarding that earlier discussion: which one of these is correct?
[] call (format ["%1_INIT_server_initServer", MISSION_PREFIX])
or
missionNamespace getVariable format ["%1_INIT_server_initServer", MISSION_PREFIX]
first one throws error and doesn't do anything.
second one doesn't do anything.
you have to combine both
oh, the second one is missing [] call lol
So I can leave the square brackets out?
call (missionNamespace getVariable format ["%1_INIT_server_initServer", MISSION_PREFIX])
Better now? π
now it has atleast potential to work
Does it need the outermost brackets btw?
Yeah, if it works that way, there's no problem... Better to use too many brackets than not enough π
Though, I always pass explicit arguments when calling other people code, to avoid leaking my own parameters and having them modify it.
yeah. Some people might modify _this by reference.. ugh
Yup. One time was enough to scar me for life.
I'd love if these people wouldn't exist.
Does it need the outermost brackets btw?
Yes.
Dedmen, to work around a function modifying _this by reference, you can replace:
call _func;
with
_this call _func
It's the only difference between the two syntaxes actually.
Also, imo, you should handle the args passed to your function in line 1 with params and never rely on _this further down in the code.
anyone know a good script for locking and unlocking ghosthawk door gunners? not finding much on the nets.
yeah, saw that, was hoping to find a built script. ill get started on a script
what would be a debug command to grab all the positions of roadsigns? such as this Land_SignRestrict_01_speedLimit_70_F, I have used the command before to get gas pump pos.
is it possible to script adding gearsets to the arsenal menu(save/load)
@lusty canyon yes.
nvm i ended up just using get/set loadout command.
next q: im trying to determine if a vehicle is a UAV, im looping through array allUnitsUAV .
is there a more efficient way to know if a vehicle is uav?
I donβt think that works like that lol
https://community.bistudio.com/wiki/shownUAVFeed
I believe this will work
Although idk of this also checks for panes