#arma3_scripting
1 messages · Page 632 of 1
Looking in the .rpt is a good way to debug.
Visual studio code has an extension that opens the latest rpt with ctrl shift r. Can recommend
I guess I should probably upgrade from notepad lol
Yeah visual studio code is very nice, poseidon too. Poseidon is less advanced but easier to use for beginner imo
If you would want it so people can't get killed if you run over them by a vehicle do you filter on the handledamage eventhandler on _projectile input?
Cause if they are driver of vehicle it doesn't kill the player.
When they switch to passenger seat and they still drive a player over it kills him.
When they switch to passenger seat and they still drive a player over it kills him.
How can they drive from the cargo seat?! 🤣
Well they speed the vehicle and switch seat, so the vehicle is still moving of the speed.
They switch seat right before they want to drive em over with it.
is there a case insensitive version of pushBackUnique for strings?
no, but you can build one
private _unique = [];
{
private _string = _x;
if (_unique findIf { _x == _string } == -1) then
{
_unique pushBack _string;
};
} forEach _stringArrays;
```@wild prairie (but maybe there is a better solution)
What is the practical reason for using netId and objectFromNetId? Instead of just using the object itself in the first case?
OK...I've got no error, but it isn't working...what's wrong?
uav1 setVariable ["confirm",false];
player addAction ["<t size='1.5' shadow='2' color='#00cc00'>CONFIRM TARGET</t>", {uav1 getVariable ["confirm",true],hint "TARGET CONFIRMED..GOING HOT!";player removeAction (_this select 2);}, [], 4, true, true, "", ""];
waitUntil{"confirm",true};
uav1 fireAtTarget [myNearestEnemy,"PylonMissile_1Rnd_LG_scalpel"];```
Just came in my mind, what about scriptResult SCRIPT
As a command
Anybody suggested that ever?
I use it together with lbSetData as that only accepts a String.
Right
y u ping meh :u
this channel is full of capable people too! if I can help, I do help, don't worry
@echo yew what are you trying to do here?
I want to set a var with random and unique number on 4 different object
oh
but the code is not really related
yes, you have to do a random on every line
Well you only make one random number.
Not sure what you mean by not working, but you never do uav1 setVariable ["confirm", true], I'm guessing that might be it.
Does that reply feature ping people? Somebody reply to this so I can see.
@echo yew btw, your random array should be min, mid, max not mid, min, max
wrong
private _num = round random [600,3000,10400]; // _num = 42 let's say
myobject1 setVariable ["Timer", serverTime + _num, true]; // serverTime + 42
myobject2 setVariable ["Timer", serverTime + _num, true]; // serverTime + 42
right
myobject1 setVariable ["Timer", serverTime + round random [600,3000,10400], true];
myobject2 setVariable ["Timer", serverTime + round random [600,3000,10400], true];
sample text
only if the tag (to the right on PC) is activated
Yea it pretty much pings you, very good.
@willow hound is not working in "not" firing the missile...
he he he, not this time!
Ah, I see. Even cooler!
Well, try changing uav1 getVariable ["confirm", true] to uav1 setVariable ["confirm", true].
nope..not doing anything..sorry
uav1 setVariable ["confirm", false];
player addAction ["<t size='1.5' shadow='2' color='#00cc00'>CONFIRM TARGET</t>", {uav1 setVariable ["confirm", true]; hint "TARGET CONFIRMED..GOING HOT!"; player removeAction (_this select 2);}, [], 4, true, true, "", ""];
waitUntil {uav1 getVariable ["confirm", false]};
That's better.
let me test this right now..report back ASAP..
@willow hound nope..I got this error:
21:47:33 Suspending not allowed in this context 21:47:33 Error in expression <true, true, "", ""]; waitUntil {uav1 getVariable ["confirm", false]}; uav1 f> 21:47:33 Error position: <getVariable ["confirm", false]}; uav1 f> 21:47:33 Error Generic error in expression
Uh yea
Suspending not allowed in this context
means you are using a sleep or waitUntil where you shouldn't
Just came in my mind, what about
scriptResult SCRIPT
@queen cargo
What is it supposed to return?
correct, it's weird
@winter rose I see...and how do I make the uav1 waiting for the addAction to fire?
Don't wait for it
Add a condition
Altho I didn't read your previous comments
Let me check
@little raptor I'm getting lost here..don't think I know how..
Aye, smartest solution up there 
@little raptor I try with that....no joy!
player addAction ["<t size='1.5' shadow='2' color='#00cc00'>CONFIRM TARGET</t>", { uav1 fireAtTarget [myNearestEnemy,"PylonMissile_1Rnd_LG_scalpel"];player removeAction (_this select 2);}, [], 4, true, true, "", ""];
What's myNearestEnemy
Maybe waitUntil tried to evaluate uav1, I'm not sure. Won't matter if you do as Leopard20 suggests.
laserTarget player;
@little raptor as asin11 sad...
Does that code work at all?
uav1 fireAtTarget [myNearestEnemy,"PylonMissile_1Rnd_LG_scalpel"];
Try it in the debug console
let me try...
Can you guarantee that the player has a laser target?
A laser target is created by a laser designator when it's on.
Also, isn't there a flag for addAction that can remove it automatically after completion? HoldAction has one. addAction must have one too
@little raptor would return whatever the spawn returned
Spawn returns handle
No, a new operator that extracts a value out of spawn
You mean like call?
Not on wiki at least.
holdActionAdd has, not addAction
private _handle = [] spawn { 1 };
waitUntil { scriptDone _handle; };
private _value = scriptResult _handle; // Returns 1 once the spawn finished```
This is essentially how it could work
this is the script working BEFORE I've tried to add the "confirm--target" part.. https://youtu.be/OBEpoVW6x5Q
and the whole script:
https://sqfbin.com/timevesoqawuberihefe
uav1 fireAtTarget [myNearestEnemy,"PylonMissile_1Rnd_LG_scalpel"];
not firing..but no errors...😫
You are modifying the "DESIGNATE" mode, correct?
yap
What does the DESIGNATE code look like right now?
zomg the indent
and the "virgin" one....
https://sqfbin.com/ayezunoziwiqasitelev
_drone is undefined inside the addAction scope.
also your links are content-identical
I'm sorry guys..it's my first few posts on discord..I'm trying😋
Don't worry, the original version of your code is in the very first sqfbin link you posted.
@queen cargo the handle is null in your example!
When a code is done, it's handle is deleted
that's an example, an idea
And you can't keep it (and its return value) in memory, because of unnecessary memory usage
(ofc not doable this way - not without heavy modification at least)
I guess this is becoming too hard for my "scripting-ability😂 ....
player addAction ["<t size='1.5' shadow='2' color='#00cc00'>CONFIRM TARGET</t>", {(_this # 3 # 0) fireAtTarget [(_this # 3 # 1), "PylonMissile_1Rnd_LG_scalpel"]; player removeAction (_this select 2);}, [_drone, myNearestEnemy], 4, true, true, "", ""];
```Now this might just work...
Originally,the script was this:
https://sqfbin.com/icaligajaqaloresobiy
then I added the addActions part...
Put only that (no setVariable, no waitUntil, no fireAtTarget) in between the two sleep statements.
@little raptor for starters, the handle is not null but a variant of scriptNull (a minor but Important difference)
And what I would like to have is simply a way to Also have an actual value inside of it if it does return a value, suspending the actual deletion of the handle or something like that
@willow hound nope..sorry..I got the addaction, but not firing..
where you put the addAction, add this:
Like that right?..just in case...
https://sqfbin.com/fiwoquqatitalenifuti
Because there's no waitUntil it probably fires after the "Missile fired" hint was displayed.
Yes, that's how I meant.
No that's wrong
How do you "quote" the messages?
No that's wrong
Your hint says missile fired when it adds the action
Next to where you can react to it, the popup at the top right of the message when you hover over it.
LOL...I'm such an idiot..thank you
Try again and wait longer, as we said, the hint now comes early.
(we can adjust that after we got it working in the first place)
Try again and wait longer, as we said, the hint now comes early.
@willow hound it doesn't necessarily come early. It's misplaced.
But yeah not the issue atm
Confirm..not firing
Are you sure you're using the right type of drone?
Maybe it doesn't have that pylon
where you put the addAction, add this:
systemChat str [_drone, myNearestEnemy]
It's time to debug
Better put it inside the addAction
Yea with (_this # 3 # 0) obviously
The drone work fine without the "confirm " part...
I'm gonna try to debug now...let me try!
player addAction ["<t size='1.5' shadow='2' color='#00cc00'>CONFIRM TARGET</t>", {systemChat str (_this # 3); (_this # 3 # 0) fireAtTarget [(_this # 3 # 1), "PylonMissile_1Rnd_LG_scalpel"]; player removeAction (_this select 2);}, [_drone, myNearestEnemy], 4, true, true, "", ""];
```Could be interesting 🙂
Yeah
systemChat say: [any,1a8df366b00# 178121: lasertgt.p3d]
Why Arma, why
What is the point of letting me pass arguments if they have to be global
not working..+ I've got an error:
22:55:30 Error in expression <ssile_1Rnd_LG_scalpel"];systemChat str [_drone, myNearestEnemy]; player removeAc>
22:55:30 Error position: <_drone, myNearestEnemy]; player removeAc>
22:55:30 Error Undefined variable in expression: _drone
Try what ansin11 wrote
I used this
the error doesnt match that snippet
ssile_1Rnd_LG_scalpel"];systemChat str [_drone, myNearestEnemy]; player removeAc
vs
ssile_1Rnd_LG_scalpel"]; player removeAc
ssile_1Rnd_LG_scalpel"];systemChat str [_drone, myNearestEnemy]; player removeAc is not in that code, copy paste my code (again) please.
I try..trow an error..sorry
It's important to use _this # 3 and stuff in that code, that's why it needs to be exactly that code.
sorry..I'm testing now...
this is the code I'm using
https://sqfbin.com/ujikiviqiqekojetuxen
..sorry..no errors, but missile not firing (hint "missile fire" is there though)
systemChat: [uav1,1a74920d600# 1781012:lasertgt.p3d]
Good, passing the arguments works. I was starting to doubt the fabric of reality.
😆
Unless something goes wrong with (_this # 3 # 0) fireAtTarget [(_this # 3 # 1), "PylonMissile_1Rnd_LG_scalpel"]; the missile should be fired though. The "Missile fired" hint currently means nothing. How long did you watch and wait?
MUCH longer than what it takes normally for the drone to fire with the old code..
Hmmm
Pretty much my last idea: Try this (hopefully fixed) version of your first approach.
_drone setVariable ["confirm", false];
player addAction ["<t size='1.5' shadow='2' color='#00cc00'>CONFIRM TARGET</t>", {(_this # 3) setVariable ["confirm", true]; hint "TARGET CONFIRMED..GOING HOT!"; player removeAction (_this select 2);}, _drone, 4, true, true, "", ""];
waitUntil {(_drone getVariable ["confirm", false])};
_drone fireAtTarget [myNearestEnemy, "PylonMissile_1Rnd_LG_scalpel"];
I'm testing it now..THANK YOU REGARDLESS..i's been an hour you're busting your ass for me..
sorry bud..still not firing. I'm gonna report the drone pilot for desertion...hahahaha
Ah, unfortunate. And weird. I would have started my own testing by now, but I'm not at home.
I'm making a little video to show you what's up...wait..
In your original original code you were using _weapon instead of "PylonMissile_1Rnd_LG_scalpel", I guess you can try that too, who knows.
let me try..could be..
IT'S FU**ING WORKING!!!!!!!!
There we go, finally. 🥳
AWESOME...it's finally FIRING the missile....now....is keeping firing until I stop lasing..even without me "confirming"😂 ..but that's another story.
spoked too soon...it IS firing, but now it doesn't wait for confirm-target. I'm giving up...once solved one problem, a new one pops-up..ARMAAAAA😩
Hard to tell, might be the AI firing on its own (which could possibly be avoided using setCombatMode or such), but that clip does not show any missile actually reaching its target, sounds like they hit something / explode somewhere else instead...
But I've done my duty for today, time to go to bed 😴
You went ABOVE your duty man...have a good night and thank you!
@serene quiver well now that you confirmed that the arguments were ok, you can ditch that command and use something rock solid.
try forceWeaponFire/fire and a fired event handler to setMissileTarget on the projectile.
I having trouble finding the correct way to set the mass of a vehicle. Can someone help?
What's wrong?
Well. I can't find a script that works.
To clarify. There's a vehicle that is weighted at 8k and I'm trying to change its weight to 1k.
Setmass doesn't work.
Well I'm sitting here with 2 other people. One of which is a coder. Used it the way BI instructs and a multitude of different configs.
configs?
the command is for ingame scripting
you can test it with the debug console
Heya everyone, can someone link me to a script that I can use with a trigger to full heal a player? (Locally).
Using ACE3 Medical system as well.
Edit: Found this, can someone confirm this is usable? {_x call ace_medical_treatment_fnc_fullHealLocal} foreach thislist
it only triggers once. so units entering after the first batch of units (thisList) won't be healed
Is there any good way to check whether or not an AI is glitched into a bilding or terrain object?
lineIntersectsSurfaces with GEOM and FIRE lods
But in Arma AI almost never get "glitched" into an object (they usually just walk through the object)
What would I use as begPosASL and endPosASL?
Hi, is someone comfortable with ace3 interaction?
Thanks leopard, with this
player addAction ["<t size='1.5' shadow='2' color='#00cc00'>CONFIRM TARGET</t>", {(_this # 3) setVariable ["confirm", true]; hint "TARGET CONFIRMED..GOING HOT!"; player removeAction (_this select 2);}, _drone, 4, true, true, "", ""];
waitUntil {(_drone getVariable ["confirm", false])};
_drone fireAtTarget [myNearestEnemy, "PylonMissile_1Rnd_LG_scalpel"];```
it does fire now...
but it keeps on firing after the first strike without waiting for confirmation...
let me make a little video..hold on...
here it is...
https://youtu.be/dI1rIBoZJq4
@vague geode try for beginPosASL: eyePos _unit (where _unit is what you're testing) and for endPosASL: getPos _unit [getDir _unit, 100]
(AGLToASL getPos* I believe, but yes)
no
you're both wrong
@vague geode
beg: unit modelToWorldWorld [0,0,0.05];
eng: eyePos unit
or the other way around (doesn't make much difference)
you can use modelToWorldWorld for the second one too
you can also adjust the front and back (y-coord in model space) a little bit.
@serene quiver even if it does, it's wasting performance (waitUntil)
both codes do the exact same thing (logically). so I'm not sure what's wrong.
as for why it keeps firing, that's what the command does. it's similar to the "Fire" command in the engage menu (key 3). the drone sees that target as enemy and won't stop firing until it's dead. so try the other command I mentioned.
also, where are you executing that code again?
Inside the "main" code block, in the
if (_drone getVariable "Mode" == "DESIGNATE") then part...
@serene quiver no I mean where do you execute that?
I feel dumb right now...LOL..
You meant if from debug console or within the mission?
nope that's fine
Hi all, how can I place a wapon and modify the rotation in x,y,z degrees?
I'm using "setdir" but only it rotates the "z" axis
@serene quiver try this:
player addAction ["<t size='1.5' shadow='2' color='#00cc00'>CONFIRM TARGET</t>", {
_drone = _this#3;
driver _drone forceWeaponFire (weaponState [_drone, [-1], "PylonMissile_1Rnd_LG_scalpel"] select [1,2]);
hint "TARGET CONFIRMED..GOING HOT!"; player removeAction _this#2
},
_drone, 4, true, true, "", ""];
and put this in the init field of the drone:
this addEventHandler ["Fired", {
_this#6 setMissileTarget myNearestEnemy
}]
let me try..report back ASAP
@light badge setVectorDirAndUp
Sorry...same as before: the drone fire...and keep firing...
it shouldn't
area you sure it's the same code?
Also, remove that waitUntil and fireAtTarget
just use that
this is the block of code I'm using....
https://sqfbin.com/unugoyunogususehuheb
with the
this addEventHandler ["Fired", { _this#6 setMissileTarget myNearestEnemy }] part in the drone init
WAIT..I reloaded the demomission...now is not firing at all..the addaction come on, but no joy...and keep circling...ARMAAAAAAAAAAA..
is there any multiplayer-friendly way to turn empty vehicle headlights?
@serene quiver this works for me:
player addAction ["<t size='1.5' shadow='2' color='#00cc00'>CONFIRM TARGET</t>", {
_drone = _this#3;
_drone doTarget myNearestEnemy;
_drone fireAtTarget [myNearestEnemy, "missiles_SCALPEL"];
hint "TARGET CONFIRMED..GOING HOT!"; player removeAction _this#2;
},
_drone, 4, true, true, "", ""];
let me try..
THERE WE GO!!!!!! AWESOME job mate.....it works like a charm. REALLY thank you and everybody else for helping me...due credits on the mission are MANDATORY.🥳
@serene quiver actually remove the doTarget line from my code because you're already doing it in your code
👍
also remove that fired EH
it's not needed
@serene quiver in case you're wondering what was wrong, you were not using the right weapon for the drone
as I mentioned the first time I noticed your issue
It is a matter of facts, the "PylonMissile_1Rnd_LG_scalpel" instead of the "missiles_SCALPEL" got there because since the type of weapon is declared in the radio trigger with
dronecas=[uav1,60,"missiles_SCALPEL","true"] execVM "dronecas.sqf"; for debug purposes it sneaked his way in.
Wrongly so I'll add..
PylonMissile_1Rnd_LG_scalpel
this is a magazine tho
yap..I messed up with the classnames..
I suspected that when I noticed it (1Rnd)
Good job spotting that..now is a beauty
@cunning oriole that's not a quese
you're just changing a variable in a certain player's variable space
which is called pvpQueue
I have a weird problem (or iam stupid)
_cheli = createVehicle ["BlackhawkWreck",_crashpos,[], 0, "can_collide"];
createSoundSource ["Sound_Fire", position _cheli, [], 0];
createSoundSource ["Sound_SmokeWreck1", position _cheli, [], 0];
If a move far away from that point and come back the sound is not playing anmyore 🤔
@cunning oriole I know what you mean
but that's not even a "list" (array)
anyway you should use an array
then use pushBack
then count the array
it gives the number of players in the queue
@cunning oriole something like:
array = [];
array pushBack player;
publicVariable "array"
but note that publicVariable is kind of slow for arrays (depends on the size of the array)
it won't be slow if you're dealing with a few players. so it's fine
@sharp grotto maybe the game deletes it? I don't see anything wrong
also I can't reproduce your problem
Ok. Thanks #mods i guess
hey guys what target in remote exec is just that client only? is it i just want that singular person to get that hint message or whatever
then you must pass it client's ID or that client's object (his player object typically)
ahhh erm ok im not that advanced unfortunately i thought it was just going to be a number like 0 being a server lol
its on a dedi thing yea
but i dont want all players to get it or im very stupid and overlooking something lol
["Message here"] remoteExec ["hint", allPlayers];```
like so?
if the script is executed on the client, just use the command and not a remoteExec.
if the script is executed on the server, use the targeted player unit as argument
i noticed sometimes when using
hint "message"; sometimes it would be broadcasted to other players also
and if it's not dedicated:
[{if (isServer) exitWith {}; hint "ABC"}] remoteExec ["call", 0];
but doesnt 0 execute globally across all clients?
I don't understand. didn't you want to send it to all clients?
no no just that 1 person who activated the remote exec
like an addaction
or trigger area
remoteExecutedOwner
oooo that sounds more like it
you can use -2 as target in RE to not target server machine "everyone but the server"
@copper raven never forget that a server can be a player too
was directed towards the code above, mb
anyway, a remoteExec 0 for a hint is not what will kill the server, at least I hope ^^
[0, -2] select isDedicated
remoteexec to those clients
will cope with player/server
thanks guys
that's interesting. I didn't know you can have negatives
heal_box addAction [
"<t color='#fb0000'>Heal Self</t>",
{
{
[_x] call ace_medical_treatment_fnc_fullHealLocal
}forEach [call BIS_fnc_listPlayers] select if (_x distance heal_box < 10) then {true}
}
];
This is a script that should heal all players that are 10 meters from the heal_box However, the function ace_medical_treatment_fnc_fullHealLocal is receiving arrays from _x instead of players. Any advice?
remove the [ ]
plus why use the BIS fnc when you have allPlayers?
allPlayers select {_x distance heal_box < 10}
and I'm not sure if you're providing the right arguments to the ace fnc. that's up to you
Heal Self
why does the box say heal self but heals others too?!
fullHealLocal runs locally (as the name says)
calling it on remote players won't be right
@cold mica this means:
[_x] remoteExec ["ace_medical_treatment_fnc_fullHealLocal", _x]
https://github.com/acemod/ACE3/blob/master/addons/medical_treatment/functions/fnc_fullHeal.sqf#L23 probably better to fire the event that way, incase there is any other functionality towards it. Or just use that function instead
allPlayers select {_x distance heal_box < 10}
or you could put the condition inside theforEachwhich makes it faster
which makes it faster not if many units get filtered out here, which is probably the case
yes, most people will be outside the heal_box range. Thank you for the help, I'm gonna try Leopard's suggestions first.
so you mean:
{
if (_x distance heal_box < 10) then {...}
} forEach allPlayers
is not faster?
but you run the loop once
still more commands to call
how about count?
&& {
}
depends on how much select is filtering out
performance really doesn't matter to that level, where such things would make sense to do
Error Undefined variable in expression: _patient
init.sqf
[] execVM "heal_range.sqf";
heal_box addAction [
"<t color='#fb0000'>Heal Nearby</t>",
{
{
[_x] call ace_medical_treatment_fnc_fullHeal
}forEach allPlayers select {_x distance heal_box < 10}
}
];```
Script has been updated, now it has a new error.
oh, I see. I didn't put anything for cursorObject
so put [_x, _x] instead
well, for the Local version of the script, it only needs one item
but yes, I will put what you suggested Leopard
the effect was local too right? so remote execing wouldn't help
RE is fine, but it's not supposed to be executed that way, there might be something else listening on that event for example
The script works perfectly now! Thank you Leopard, Dedmen, and sharp.!
heal_box addAction [
"<t color='#fb0000'>Heal Nearby</t>",
{
{
[_x,_x] call ace_medical_treatment_fnc_fullHeal
}forEach (allPlayers select {_x distance heal_box < 10})
}
];
Here is the working version for anyone searching this discord to find a heal script.
also your select is ran on the result of the forEach, precedence issue
@cold mica yeah put ( ) around that
(allPlayers select {_x distance heal_box < 10})
woops, thank you
no, not local effect
Are there any situations where an object can be removed from the game, and the "Deleted" event handler not called? Or is it safe to clean up resources using it.
Awesome, thanks guys. Using it to clear JIP queue entries when an object is deleted, because objects can only be used as the JIP ID for a single remoteExec, any subsequent remoteExec calls replace the first in the JIP queue
So need to use another style of ID, that gets cleared when the object is deleted. Deleted event handler is the simplest approach I can think of.
If it doesn't work due to some arma bug (who knows right?!) then you can check these objects periodically.

Like object is nulll - all right let's clear up the JIP queue
Yeah, there's a handful of approaches I came up with - a deleted event handler is just the simplest.
Next simplest I have is manually storing an array of JIP functions to call, their arguments and the object. When a player joins, custom JIP function fires, and runs all the functions where object isn't null.
I've found a bug which triggered the deleted event handler on player when he entered a vehicle for instance. It has been fixed already, but after things like this I'm always skeptical about all other serious event handlers 😄
(Bonus fact: 0002:1343:Test, 0002.0:1343:Blarg seem to be the same JIP key - as one overrides the other. Both are valid net IDs according the parser, I think :D)
(Both parse to 2:1343)
That's good to know - I guess it's safe enough to use in this instance.
But yeah, a little caution sounds good.
I'll bake in some bug-detection into the wrapper.
weird question
I'm using the "copy to SQF" module from achilles on a mission
what can I do to ensure it goes as fast as possible? does stuff like turning down graphics help?
Well, if it's unscheduled, no. If it's scheduled, it probably could help in the sense that the CPU will probably be doing less work. But I don't think it'll make much difference.
Also, this is not #arma3_scripting
wasn't sure where to go
though to post here because I though it was relative to sqfs cpu usage
well scheduled codes can go faster the fewer other codes are running.
does a zeus module count as scheduled?
The module itself? I don't think so.
A module is essentially just a function (or should I say an object+function)
I see
then I'll just have to wait for a while
a more relevant question
this function copied an sqf to my clipboard but in a single line
how can I automatically sort every ; to end a line?
was thinking of using the find and replace but how can I replace it with an end of line?
Use notepad++ or vscode
using notepad
got it, so it will be
;\n replacing every ;
right?
it worked thanks
And ditch notepad for good
no, notepad is not able to properly handle linebreaks, so use a proper editor which can, and you shouldn't have to worry about single line stuff anymore
scheduled code runs faster the higher your fps is, or if you are in a loading screen
True that too
\r\n in that order
I assume they will use scheduled code, as freezing your game for a while in MP is not a good idea
oof, I'm making this code especially so I can fix fps
run arma with -noSound and you get higher fps 😄
run arma with -server and you'll get even higher FPS 🤦♂️
Wait really?
was aware that running stuff on a self hosted server was better than straight singleplayer, I guess server is even better
yeah running the module script on a server with fps limit disabled might be very fast
but if you are running the script manually anyway
just run it in unscheduled 😄
in case it may interest you, its related to that issue I had not a long ago, me and a friend though of using the copy mission SQF module to copy the position of every object in the map, to then swap every createVehicle line with CreateSimpleObject line
so it would work like a replaceWithSimpleObject function but without the deleting part.
so you can cut the network traffic by half
if you want network traffic
do local only simple object and run script on every client
oh right
shouldnt cause any issue since its just static objects right?
yeah
if this whole process were to be made into a mod it would help a lot of people
Hm peeps how do I attach a number to a string?
As in if I have
_itemNr = 4; and _posStr = "spw_item_";
How can I make
spw_item_4
out of that?
_posStr + str _itemNr
Though you're better doing _posStr + (_itemNr toFixed 0)
+ puts two strings together
toFixed converts a number into a string, with the specified number of decimal places
(See wiki for more info)
Thank you very much
Aight, this is driving me crazy. I'm trying to get the diwako_dui_special_track variable working, but every time I put it in the init, I get general expression errors in just about everything loaded.
The current init line I have set up is missionNamespace setVariable ["diwako_dui_special_track", ["a", "b", "c"]];
(I have a, b, and c set as units out of my squad)
are you doing it as an array of strings or an array of objects? the github says it should be an array of objects
I'm doing it exactly as seen above
ok, well do it as an array of objects, because above you set it as an array of strings
which seems to be wrong
This is a bit embarrassing, but can you show me an example?
missionNamespace setVariable ["diwako_dui_special_track", [a, b, c]];
where a, b and c are variables referencing objects (which sounds like you have done that already)
putting them in "double quotes" or 'single quotes' makes it a string
Ah, that's something I feel like I should have known. Thanks
Yup, works as intended now. Thanks!
hi all, i'm trying to use "setVectorDirAndUp" to rotate weaponholder after using a "addWeaponWithAttachmentsCargoGlobal" command but I don't know how exactly works.
I saw community.studio.com page but it is not clear for me, can anyone explain me how the command setVectorDirAndUp works? because y just only want to rotate the weapon x=90º, y=0 and z=180
hint parseText "Text<br/><img size= ´10´image= `bild.jpg´ /><br/>Text";
I use these to let show an picture as hint, but its shows only the text! I know it had works moanth ago but not anymore! Is there something wrong?
Honestly with setVectorDirAndUp I think I just did trial and error until I finally got it the way I wanted. I don't think I ever fully understood it.
@light badge you want to make sure the variables are set between 0.0 and 1.0, lemme find an example where I rotated something 45^o
@cosmic lichen Thanks i try it!
@tough abyss https://community.bistudio.com/wiki/Structured_Text There are more examples
@light badge
frigpdg1 setVectorDirAndUp [[1,0,0], [0,0,1]];
This rotates something 90 to the right,
frigpdg2 setVectorDirAndUp [[-1,0,0], [0,0,1]];
would be to the left.
To get 90 degrees, try using 0,1,0 or something like that, just mess around with the first 3 numbers.
Those are 90 degrees, actually. 180 would be
frigpdg5 setVectorDirAndUp [[0,-1,0], [0,0,1]];
@drifting oasis https://community.bistudio.com/wiki/setVectorDirAndUp There is an image explaining the coordiante system. Take some time and look at it.
@drifting oasis thak you very much
Are variables set within the missionNameSpace persistent? Do they apply to JIP?
persistent
noyes
apply to JIP
with public flag yes
missionNameSpace setVariable ["ace_common_allowFadeMusic",false,true]; So this would apply to everyone in the mission, including JIP?
actually it is also persistent as long as the server (and thus the mission) is up
yes
Alright, thank you
When I run sqf private _assembledName = getText(configFile >> "CfgVehicles" >> typeOf _staticWeapon >> "DisplayName"); I get the display name localized in the language of the client it ran on, is there a way for me to get the English name?
logging purposes, I can use the classname then
it's safer yes
what can i make with oop/extensions in arma??
sorry, what is the question?
I'm not a programmer, so i am just curious of all scripts and post which talk about extensions. So, what uses has oop?
Also, how hard is it to learn from zero?
extensions allow you to do stuff that normally wouldn't be possible with plain sqf
OOP has plenty of "use", read more (or all) about it on https://en.wikipedia.org/wiki/Object-oriented_programming.
Extensions in Arma: https://community.bistudio.com/wiki/Extensions
Extensions are used to achieve things the SQF language itself can't do, prominent examples would be TFAR and ACRE: They need to connect to and exchange data with Teamspeak, which Arma itself does not support.
Hard to learn from zero? Probably. Most people working with Arma extensions likely have a solid understanding of how Arma and programming in general work.
would anyone happen to know how I can enable simulation on a large group of objects ? I've managed to get a single object to work. However, I don't want to have to go the unoptimized route of having each and every single object have it's own line to enable simulation.
(Essentially is there a way I can get a group of objects all under one variable).
Do they happen to be close together or of the same type?
Ty for the info! These links help me to understand a little more Arma but for now I'm gonna stick with scripts only.
Something like
{
_x enableSimulation false;
} forEach (nearestObjects [Object_in_Center, ["Type_Class_1", "Type_Class_2"], radiusFromCenter]);
```might work for you.
yep @willow hound thanks it works 😄
Ok..I have this
_video = ["Videos\loadin-bar_text.ogv"] spawn BIS_fnc_playVideo;
on top of my init.sqf, followed by
null = [] execVM "Scripts\StoryBoard.sqf";
How do I make the second line wait for the video to be finish?
Thanks all
..thanks..so it should be:
_video = ["Videos\loadin-bar_text.ogv"] spawn BIS_fnc_playVideo; _handle = [] execVM waitUntil {scriptDone _handle} null = [] execVM "Scripts\StoryBoard.sqf"; ?
please don't 😂 at me..hahah
your handle is supposed to be tied to the script you are executing
ok...but the script is executing AFTER the video call..
unless "_video = ["Videos\loadin-bar_text.ogv"] spawn BIS_fnc_playVideo;" is considered a script..
in that case, could be:
_handle = ["Videos\loadin-bar_text.ogv"] spawn BIS_fnc_playVideo;
waitUntil {scriptDone _handle}
null = [] execVM "Scripts\StoryBoard.sqf";```
?
I'm getting lost here..so how that should be?😋
_handle = ["Videos\loadin-bar_text.ogv"] spawn BIS_fnc_playVideo;
waitUntil {scriptDone _handle}
null = [] execVM "Scripts\StoryBoard.sqf";```
💯 👍
works like a charm..really thank you.
Pretty charming 
👍
hm. question. is there a more or less easy way to get the shortest path from point a to point b?
taking roads into consideration
reason is, i would like to plot a path on the map
@west grove https://community.bistudio.com/wiki/calculatePath maybe? 🙂
awesome. this looks good. i'll check it out
Evenin' everyone
Trying to set up a laptop object with an addaction to view the camera of a pre-placed UAV. What script command send a player directly into the gunner seat of a UAV? Tried assignAsGunner, moveInGunner, moveInTurret; no luck.
@tough abyss https://community.bistudio.com/wiki/remoteControl
Dont forget, remoteControl doesnt mean a unit's camera is changed. You need to change it separately which is given in an example.
Thanks!
When you are in first person into a Pawnee helicopter, you can't see lines draw with drawLine3D when looking through the front glass. Anyone also noticed that?
@little raptor I know this might be 4 days ago but I finally had someone test the sounds for me on a multiplayer server and they could not hear any of them
Even with the use of remoteexec
Do i maybe need to remote exec inside the sqf file h2 say3D ["pickup1", 150, 1]; Which is inside the sqf file which is executed by the AddAction
@topaz field say3D have local effect, may be if you try:[h2,["pickup1", 150, 1]] remoteExecCall ["say3D",-2];
@past tiger (again, ) a server can be a player
[h2,["pickup1", 150, 1]] remoteExecCall ["say3D",[0, -2] select isDedicated];
will work if the server is also player
@finite sail @warm blaze

oooo
[arrayFlatten2, true] getUnitLoadOut Player
to remove duplicates?
or is it doing that anyway?
Hi, is there a way to see all the building in a virtual arsenal or something like that ?
not in vanilla no
Okay, just found https://community.bistudio.com/wiki/Arma_3_CfgVehicles_Structures
in what way do you want to see them? you want to spawn them so you can run around them, or just see a picture?
Idealy I would have liked to run around to see if this is an open or a closed building, ie... some of the buildings doesn't have doors
but I guess the wiki will do
does the wiki show building insides?
nope
@finite sail use the existing way to remove duplicates, arrayIntersect
yep
flattening an array has nothing to do with duplicates, so makes no sense to add it onto there just because you need it for your specific usecase.
A removeDuplicates that doesn't copy the array would be useful though I guess
@compact maple Check this out https://steamcommunity.com/sharedfiles/filedetails/?id=2247376289
It allows you to quickly place all objects of selected category. That way you can quickly find the building you need.
Thanks! 🙂
Might be a strange question, but is there a way to get all variables attached to a display? You can setVariable and getVariable on a display, but you cant just use allVariables.
Might worth of a ticket
allVariables should work tho
Unfortunately, yeah lol
I'll fix it
Sweet, thank you very much ^^
Is it known that "Default" call BIS_fnc_exportGUIBaseClasses causes issues when exporting it directly in a mission? The inherited classes are used before the class is defined.. i.e ctrlDefault is defined almost 500 lines after its already used and so causes an error in the description.ext
I mean its an easy fix but others less experienced might not know what to do if its used.
uhm... allVariables control only works on Map display... not general controls 🤔
Kinda strange
Any control works for me using allVariables. Atleast it doesn't error out ```sqf
allVariables ((findDisplay 46) displayCtrl 114998)

it doesn't error out, but it'll return empty array if your control is not the old mission editor map control
I can't see it.
Actually that specific control seems to have two namespaces on it and some special handling.
I guess I'll just fix the command to work on all controls too
That would be amazing. Hopefully it doesn't take too much :)
Hi all, would be possible to launch a mission from the strategic map? I meant, starting a new map and everything, not just teleport and giving a task as you do normally...
@brave jungle you can now (maybe 2.02? not sure) use the import command instead of exporting guy classes to description.ext
The scenario will be: you're on stratis, go to strategic map, choose mission and mission start on Altis.Once done you go back to Stratis...
you can do that in singleplayer with a campaign
campaign of multiple missions.
via script you choose which mission runs next
yes sorry I meant in SP
There was this one Arma mod thing, that did Arma in space.
Where you could fly a plane high up and go to space
how would I do that?
that actually worked, by being a campaign. If you are high up, the mission just gets ended and you get to the next mission in the campaign.
But the next mission then is on a "space" terrain
You need to make a campaign...
That would be as a mod, I don't think you can do it as a workshop mission
you need to make a mod campaign pbo
Making a campaign is not a problem...my problem would be connecting all the different missions with the strategic map...
this is how you choose which mission runs next, based on edning type
Then you just do whatever in your mission, and via script do
https://community.bistudio.com/wiki/endMission
and depending on what end type you pass to endMission, will together with the description.ext above, decide what mission runs next
I think there are only the 7 ending types though?
but you can have 7 different followup missions, per mission.
@dusk gust

Ah okay yeah saw R3vo mentioned that, well even still the fnc export causes an error if not edited, just wanted to see if it was known about, I mean its not high priority, epically if "import" can be used. Thanks anyways 👍
nope, what I recall from last editing session its "unlimited".
I got all that,mate. What I really wish was possible was that the player can choose between multiple choices of mission;after he' done with 1 mission, he's teleported back to the board..choose another mission and rinse and repete..
you can have as many endings as you want now
What I really wish was possible was that the player can choose between multiple choices of mission;after he' done with 1 mission, he's teleported back to the board..choose another mission and rinse and repete..
yes, thats what i just told you
or atleast tried to
sorry man...I'm just brain-farthing...LOL..ok..so if I understand it correctly, I have to work with the endMission to get back on the board,right?
Thank you for fixing it @still forum Appreciate it immensely :)
yes
👍
Gotcha..
Hey guys. Apologies if I'm asking in the wrong place. But I'm having trouble with my spaghettis code running fine locally but won't work in a dedicated server environment. I would love to be able to just paste the code up here but well, since it's spaghettis and built base on somebody else's script. I'd be honest I have zero idea where to start debugging.
ouch 😄
you can paste the code in sqfbin.com and paste the link here of course, but if you don't know what is the issue, there is an issue in itself!
I can invite you to read https://community.bistudio.com/wiki/Multiplayer_Scripting, it may help 🙂
Undesrtood 😄 Perharps I'll get back when I managed to pin point the problem 😄 Many thanks for your help 😄
most of the time, it is because local script (e.g addAction) is added to player, and the script only runs on the server (where there may not be a player)
so, yes a good split between client/server can help 😉
drawLine3D it's not supposed to be used in a final mission/mod?
Why it even is?
its often used as a debug tool
which bug?
This one
When you are in first person into a Pawnee helicopter, you can't see lines draw with drawLine3D when looking through the front glass. Anyone also noticed that?
#arma3_scripting message
If you meant you can't see the line through a glass, it's more like feature/shader issue
oh apologies, I didn't meant to get into the middle of the conversation
Never mind, that's how the thing goes 🙂
no worries, you forcefully ended the previous conversation and started a new one. So all good
you made me feel bad now =)))

@little raptor but the hell cat helicopter don't have this problem, i believe other helis also don't have.
It's something that happens with the Pawnee
Hi, I would like to search objects on the map using nearestObjects as for center the center of the world, but I don't recall the command to get the center position
Thanks! 🙂
probably just a glass shader/ layer bug thing. reyhard would know 😄
@little raptor radius should be worldSize*sqrt(2)/2. You agree?
_worldCenter = getArray (configFile >> "CfgWorlds" >> worldName >> "centerPosition");
yes
if it is for a trigger/marker, make it square :p
no it is for nearestObjects
its not :b
or make a location that covers the entire map and use in
will just use that maths functions!
quick maffs
(BIS_fnc_worldArea is also a thing 😬)
@compact maple why nearestObjects btw?
I want to get any building of a certain classname on the map
wouldn't nearestTerrainObjects be faster?
Im switching to nearestTerrainObjects then 🙂
if you want houses, use nearestterrainobjects [["house"]
might want to add things like fuelstation and lighthouse to the array
when you have that array filter out elements that don't have buildingExit to get actual houses
I think if you want a certain classname you'd have to use nearestObjects
I believe nearestTerrainObjects usage then filter would be faster
yes
{
private _building_classname = _x select 0;
private _building_buyable = _x select 1;
private _center = getArray (configFile >> "CfgWorlds" >> worldName >> "centerPosition");
private _radius = worldSize * sqrt(2) / 2; // We also want the objets that are in the edges of the cercle!
private _buildings = nearestTerrainObjects [_center, [_building_classname], _radius];
{
_x setVariable ["building_buyable", _building_buyable, true];
} forEach _buildings;
} forEach _buildings_classname;
is what I have rn
discord indent is f*cked up lol
it doesnt take classnames
_building_classname
won't work
it takes type ?
This command matches objects using isKindOf comparison instead of direct class name == comparison
?
Also:
_center = [worldSize / 2, worldSize / 2];
_r = worldSize / sqrt 2;
the wiki doesn't say such thing
I will just try both, to see which is faster
This is what you use
you're using nearestTerrainObjects now
use nearrestterrainobjects, its way faster unless you want to find buildings placed in editor
Then I filter it with my own classname ?
I know
or, what i do is filter the returned array to get only those elements that have buildingexits
But leo/dedmen said it might be slower, I will just try both
they didn't you misunderstood
I might be missing something here but wouldn't it be better to execute nearestTerrainObjects once and then filter out the houses with the wrong classname instead the other way around?
do more work in engine, more better
yes, very much
just did a quick test, nearestTerrainObjects took 17546ms
and nearestObjects took 13392
nearestTerrainObjects took 17546ms
after filtering?
You win this time, @little raptor!!
well.......
🥇
Result:
57.6667 ms
Cycles:
18/10000
Code:
nearestterrainobjects [alpha_1, ["house"], 10000, false, true]
.
.
.
Result:
73.2143 ms
Cycles:
14/10000
Code:
nearestobjects [alpha_1, ["housebase"], 10000, true]
alpha_1 being me, in mission
that's not fair! you're sorting the nearestObjects results!
nearestobjects always sorts
the true was 2dmode
let me just edit the results for clarity
my bad
btw did you run the command once before testing?
in the nearestterrrainobjects searcn, iid usually add "fuelstation", "lighthouse", "hospital" to the search array
because the result is cached the second time
No I didnt
Tested on Altis (empty mission with just a player unit)
Result:
215 ms
Cycles:
5/10000
Code:
nearestTerrainObjects [ [worldSize/2, worldSize/2], ["house"], worldSize/sqrt 2, false, true] select {_x isKindOf "Land_i_House_Small_01_V2_F"}
Result:
178 ms
Cycles:
6/10000
Code:
nearestObjects [ [worldSize/2, worldSize/2], ["Land_i_House_Small_01_V2_F"], worldSize/sqrt 2, true]
+1 for very clean result presentation.
-1 for saying I'm wrong
@little raptor
may you try with```sqf
select { typeOf _x == "Land_i_House_Small_01_V2_F" }
// instead of
select { _x isKindOf "Land_i_House_Small_01_V2_F" }
last one slower. Ad they said they wanted same type, not same or subtype :u
I remember there was some script out there somewhere to scan buildings using intersects, to get more accurate bounding boxes. Anyone can recall it?
@austere granite Dunno the script, but the boundingBox command was updated at some point. Maybe you can get precise bounding boxes with it now.
Not what i meant. I found killzonekids selection scanning. Maybe I was misremembering because it was years ago
is there a way to find out the clientID used for remoteexec from a players name?
like
-get allPlayers
-store a value individual to each player
- remoteexec hint "hello there" after _value seconds for each indidual player
so player A gets 5 seconds delay, player B gets 20 seconds delay, all called from a centralised, serverside script
@spark turret server can do 'owner OBJECT' to get the network id of a player object.
ah thanks. i looked at it and wrongly read "returns owner of machine that runs this code"
Yeah but I was trying to get identical results (nearestObjects uses isKindOf)
I mean "internally"
no,
anyway I don't think you can get reproducible performance results with those commands (because of caching)
and you can see that the results were pretty close
the terrain one being slow mainly because of select
without select it was ~ 190 ms
agreed
i think, nto is quicker in the engine for large distances, but nearestobjects is better if you are looking for a single type of object that has a classname, nto gets roads, trees, pavements , other tricky things that nearestobjects dont get
both have their uses, i use both a lot for mission dynamics
https://community.bistudio.com/wiki/nearestObjects
This command also only finds objects that are entities. If you are looking for non-entity objects, see nearObjects, nearestObject.
what?
wasn't that nearEntities?
critically, nearestobjects finds object made by the mission, nearestterrainobjects ONLY finds stuff 'baked' into the terrain
i dont know the proper terminology for that
If it's entities only, then it won't return terrain objects, right? (but afaik it's not and it does return the objects)
right, entities are things added in script or edeneditor
thats the wierd thing, nearestobjects does return terrain objects like trees and bushes
so there is some overlap
Hey peeps, is there a command to get (as an example) 10 random numbers at once in an array?
Or do I just have to generate 10 the normal way
I don't think so
Oki
size it to 9
10
is size zero based?
So would that then fill the _x array with 9(or 10 depending on size) random numbers between 0 and 1 or?
if written correctly, yes
Ah nifty

we need iota
private _array = [];
_arr resize 10; // 10× nil
_arr = _arr apply { random 1 }; // 10× random 1
that
im trying to define a function through the description ext.
i followed the biki closely but if i try to call the functions, it always says they are undefined.
pls help
author = "IR0NSIGHT";
onLoadName = "Testing some stuff yah`know";
onLoadMission = "A group of weebs is tasked with infiltrating the christian values of America.";
//loadScreen = "images\loadScreen.paa";
class Header
{
gameType = Coop; // Game type
minPlayers = 1; // minimum number of players the mission supports
maxPlayers = 10; // maximum number of players the mission supports
};
class CfgFunctions
{
class IRN //my tag class
{
class myCategory {
class calcSoundPos {file = "WOLF_Modules\ambient_battle\fn_calcSoundPos.sqf";};
class testFunction {file = "WOLF_Modules\ambient_battle\fn_test.sqf";};
// class spawnSalvo {file = "WOLF_Modules\ambient_battle\IRN_spawnSalvo.sqf"};
// class remoteSound {file = "WOLF_Modules\ambient_battle\IRN_remoteSound.sqf"};
};
};
};
thats my description ext
try leading \ on the file
_sourcePos =[_x,_center,_dist,[0,0,0]] call IRN_fnc_calcSoundPos; //["_player","_center","_dist","_headPos"]
Thats the code to call it
will try dedmen
didnt work
try leading \ on the file
not necessary for mission functions
they are not mission functions
they are.
wuht
testing before i make it to a mod
you posted the whole mod files in there?
yeah for testing. dont wanna restart arma for each change
filePatching
enable -filePatching in launcher options
put Steamapps/common/Arma 3/WOLF_Modules/ambient_battle/... folder like that
maybe next time. never done it before
. dont wanna restart arma
you only need to restart the mission
game will load sqf files from that folder
no, the functions are in a mod normally.
lets get this test function working first
well you can create a folder with the same name as your mod in the mission folder
Are you sure you are not loading the mod pbo with the functions too? because if the mod defines them too, you can't overwrite them in mission
checked RPT for errors? file not found, compilation errors?
config in itself looks correct to me.
so I don't think there's an issue there
that leaves file not found, file fails to compile, description.ext not loaded
Hi there

Anyone got an Idea why this BIS_fnc_switchLights with ACE3s addAction is not working
High there Dedboi :3
https://paste2.org/Fhbpjf9y
_op1_exterior_lights undefined variable
I am really outta ideas by now.
It is called in init.sqf via if (isServer) then
But its defined right an the start
B I G OOF
local variables carry over to current script and lower
your action, is not your current script
its a piece of code, that you put somewhere to be executed some time later. When your variable is long gone
you need to pass parameters to the action
quite sure createAction has a option to do that for you
And here I thought the variable would be present of the server if the script is called via init
well they seem not needed
I can't see anything that needs a spawn in your spawn block
private["_op1_exterior_lights"]; don't do that, its bad for performance.
private _op1_exterior_lights = do that instead
I don't know if executing that only on server is right.
I don't think addActionToObject actually sends the action to other players via network
but that's probably what you wanted to have
@little raptor Thanks alot. I have tested it an it worked flawlessly.
Oh okay then you probably should not see the private line of that cram script I am trying to make xD
https://ace3mod.com/wiki/framework/interactionMenu-framework.html
Be aware that the functions modify the UI, and therefore need to be executed on client-side to take effect. ace wiki even says you need to run it client-side
but you run it server-side only
Thanks!!
I tried it in the play in Multiplayer via Eden, an it gave me the option as slotted player after I spawned, weird
yes, you are the server when you preview locally
Thank you alot. I will switch the script around a bit then and simply let the server execVM the stuff locally with player side Action of the object.
What object for example?
the tutorial for lightpoints on the biki has an error. it gives this example code:
private _lightpoint = "#lightpoint" createVehicleLocal player modelToWorld [0,2,1.5];
which throws "expected array got object"
code should be this:
private _lightpoint = "#lightpoint" createVehicleLocal (player modelToWorld [0,2,1.5]);
do i have to attach the light to some kind of object to give it movement? i tried "_lightpoint setVelocity _myVector" but it didnt move the light
Is that MP? How does it behave with createVehicle?
Either way the reason is probably Arma physics.
if you create stuff that collides with players collision model player takes damage
I mean you could disableCollisionWith or allowDamage, but other than that...
or possibly explain what exactly are you trying to do and perhaps there is a better way
Well player allowDamage false will certainly prevent the player from taking damage when sprinting into a table...
But other than that... This strikes me as an issue similar to that where two colliding vehicles have a chance to experience unplanned flight.
I don't.
Instead of createVehicleLocal you could try using createSimpleObject and the Simple Object framework, maybe that doesn't suffer from the same issue.
But I'm just guessing; I treat the Arma physics as an untouchable force of nature. You can not reason with them.
create vehicle local means the thing does not exist in server
and when it does not exist in server different things happen on both ends of the pipe
perhaps you are not doing the correct thing
what are you creating that much that it takes performance?
and if it takes performance (like runs on every player instead of just once) then its a problem of execution
so again
explain what you are trying to achieve and perhaps there is a right way to do it
that is quite a lot yes
Tried Simple Objects too?
let him finish first
why are they not just created in the editor?
since they got static locations
And did you try Simple Objects too when you searched for a way to improve performance?
It sounds like perhaps your scripts are running for each player
instead just once on the server
Is there a way for apply a NVG vision if you watch a player with
_unit switchCamera cameraview;
In theory you could use createSimpleObject together with the path to an object's .p3d
Can always treat those special objects differently.
I strongly feel this is not the right way to do things.

in that scope yes
well missions are not mean for large scale building either
but also you just might be running something silly in there that tanks it
instead of it being caused by the objects themselves
have you packed those 4000 objects into very small area?
are you using vanílla or modded objects?
To answer my own question. You can simply do this
pp_Color = ppEffectCreate ["ColorCorrections", 1502];
pp_Color ppEffectEnable true;
pp_Color ppEffectAdjust [1, 3, 0, [0, 0.1, 0, 0], [0, 2, 1, 0], [1, 1, 1, 0]];
pp_Color ppEffectCommit 0;
//Destroy NVG effect
ppEffectDestroy pp_Color;
Fullscreen NVG (Pilot helmet) comparison https://gyazo.com/80c63214ed372d21252e90ce02f8c14f
Script NVG https://gyazo.com/d1d6049d2148211feaae5f5c1a4a08d1
Rabitoooo 👀
https://community.bistudio.com/wiki/camUseNVG prolly doesnt do it for ya ? @sharp grotto
(prolly would not given the explanation on the wiki)
You cant use it while watching a player via _unit switchCamera cameraview;
guys, in an exitwith, can I have multiple lines of code?
{
diag_log "exited!";
_exitcount = _exitcount +1;
};
yes
thanks
signs I might be too tired....
22:58:27 Error Missing ;
22:58:27 File C:\Users\Paul\Documents\Arma 3 - Other Profiles\Tankbuster\mpmissions\COOP40_Authority.Tanoa\server\secondary_missions\do_barricadedefend.sqf..., line 1
line 1 lol
@finite sail What do you mean it will work if the serve is also a player. You mean the server is being hosted by a player?
How big is in the impact on networking performance between:
Is one favorable over the other?
setVariable ["test0",0,true];
setVariable ["test1",1,true];
setVariable ["test2",2,true];
setVariable ["test3",3,true];
and
setVariable ["test0123",[0,1,2,3],true];```
Well, the difference is "sending small amounts of data a lot of times" and "send a lot of data once".
And I would say that sending everything once is better, since in total it's less data to be send.
However if you change those variables (especially only one per time) a lot, it might be more useful to separate them.
Right, I thought this was going to be the answer. Especially as your last sentence applies to our case
It also depends on where you need to store it; if it's local it doesn't really matter. Although I would try to group stuff together anyway, since it will make your life easier with working the data.
ye i was just hoping that spamming one array instead of 4 seperate variables would have been more efficient on networking
add them to your stringtable...?
it is more efficient to have one variable being broadcasted, and if it only contains true/false the size is also manageable. But sending a lot of data (full objects, massive texts, etc.) when only a single bit changes becomes a burden.
in that case you shouldn't get the error(s)
btw... your issue is more #arma3_config than #arma3_scripting 🤔
might be better, since people who know more about configs / translations might not look here
Arrays are terrible on network traffic due to how they are implemented.. sadly
large arrays is bad.
But not sure if still better/on par with multiple small variables
thats correct
I'm actually very curious about this too.
One of the things I usually do is define the variables that I generally use together in a single array so that I could save/load them faster (hopefully).
But when you say sending arrays is slow it really makes me wonder if I'm doing the right thing.
not slow
it takes more traffic/space than it needs to
you probably don't care about network traffic with todays internet speeds
just look at arrays in mission.sqm
the Item1, Item2, Item3
Hi, if I return a value being in a for loop, it will instantly exit the loop ?
return a value being in a for loop
loops can only return values from their last iteration. (if defined)
it will instantly exit the loop
not sure what you mean
If you use exitWith, then yes.
loops can only return values from their last iteration. (if defined)
fnc = {
scopeName "foobar";
{
_x breakOut "foobar";
} count [1, 2, 3, 4, 5];
};
diag_log ([] call fnc); // 1```
it is the last iteration (you're ending it early)
in that way, there is no return in any language because they "just end early" 🤪
maybe he means break/breakWith.
I dunno.
Need context @compact maple
well your code is not even a loop. you just end it and jump to another code.
I stand by what I said.
for "_i" from 0 to 100 do {
if (true) exitWith {true};//or breakWith true
};
_a = [];
_a resize 10;
{
_forEachIndex;
} forEach _a;
now this is a loop that is running normally
well your code is not even a loop.
It is a very common forEach loop in arma 🤷
Also:
fnc = {
scopeName "foobar";
for "_i" from 0 to 100 do {
_i breakOut "foobar";
};
};
diag_log ([] call fnc); // still 1``` tho ... i think you kinda took my response wrong, did not wanted to blame you or something, just correct what you said there as it is indeed possible in arma
I know, but still what I'm trying to say is that it is not a real loop. you're returning the result from the "foobar" scope, not your loop scope. so technically it is not a loop.

for "_i" from 0 to 100 do {
breakWith _i;
};

problem with sqf tho is:
scopeName "0";
fnc = {
scopeName "A";
for "_i" from 0 to 100 do {
scopeName "B";
};
// scope "A" now has 100 passed over from "B"
};
[] call fnc;
// scope "0" now has 100 passed over from "A"```
aka: you always get the value from the lowest scope
if one is bored btw. he/she can explore the possibility of "out parameters" in SQF:
fnc = {
params ["_out_var"];
_out_var set [0, 12];
};
private _var = 0;
private _boxed_var = [_var]; // box variable
[_boxed_var] call fnc;
_var = _boxed_var select 0; // unbox variable
diag_log _var; // 12
I sometimes did that but directly with arrays yes, since they are modified by reference ^^
Found this in a mod
[_unitPosition, _cartridge, _unit, _weapon, _ammo, _magazine, _projectile, _vehicle] spawn {
params ["_unitPosition", "_cartridge", "_unit", "_weapon", "_ammo", "_magazine", "_projectile", "_vehicle"];
private ["_unitPosition", "_cartridge", "_unit", "_weapon", "_ammo", "_magazine", "_projectile", "_vehicle"];
...
Is this double definition good for anything?
Never, params already does what private does
This is why arma has bad performance 😄
Thanks for clarification, thought so, but wanted to go for sure
I'm playing cleaning maid because I am annoyed by my error riddled .rpt
we all have error riddled RPTs
think of it like this... an old car has oil under it's engine because there is oil IN it
arma RPTs are the same... when the RPT is empty, something is terribly wrong
or everything is perfect!
Must not be perfect, but when 10.000+ lines look like this
20:29:30 Trying to call remoteExec(Call) with a null-object as JIP ID
20:29:32 Trying to call remoteExec(Call) with a null-object as JIP ID
20:29:32 Trying to call remoteExec(Call) with a null-object as JIP ID
20:29:33 Trying to call remoteExec(Call) with a null-object as JIP ID
20:29:33 Trying to call remoteExec(Call) with a null-object as JIP ID
20:29:33 Trying to call remoteExec(Call) with a null-object as JIP ID
20:29:33 Trying to call remoteExec(Call) with a null-object as JIP ID
20:29:33 Cannot create non-ai vehicle hz_,
20:29:33 Cannot create non-ai vehicle ,
20:29:34 Trying to call remoteExec(Call) with a null-object as JIP ID
20:29:34 Trying to call remoteExec(Call) with a null-object as JIP ID
20:29:34 Cannot create non-ai vehicle hz_,
20:29:34 Cannot create non-ai vehicle ,
20:29:34 Trying to call remoteExec(Call) with a null-object as JIP ID
20:29:34 Trying to call remoteExec(Call) with a null-object as JIP ID
20:29:34 Cannot create non-ai vehicle hz_,
20:29:34 Cannot create non-ai vehicle ,
20:29:34 Trying to call remoteExec(Call) with a null-object as JIP ID
20:29:34 Trying to call remoteExec(Call) with a null-object as JIP ID
it is not good
I meant if your rpt is empty (except for vanilla stuff)
Ah 🙂
Id be looking closely at the 'cannot create non-ai vehicle'
thats usually a bad classname being given to createvehicle or createunit
often, a sneaky space sneakily sneaks into the classname
sneakily
I already have found the function responsible for that. Now I'll try my luck fixing it without braking anything.
without braking
Happy racing!
hehe
Sorry I had to leave.
@still forum Actually I wanted to return a value in a for loop like (its just an example)
for "_i" from 1 to 5 do {
if (_i >= 3) then {
_i
};
};
exitWith
every iteration of the loop always returns a value (inside the loop)
so.. no it won't exit
otherwise loops wouldn't loop
Okay, exitWith will leave the if statement ?
for "_i" from 1 to 5 do {
if (_i >= 3) then {
exitWith{}; //will exit the if statement?
};
};
no
for "_i" from 1 to 5 do {
if (_i >= 3) exitWith {//will exit the for loop and runs the following code
};
};
or
for "_i" from 1 to 5 do {
if (_i >= 3) then {
break; //or breakWith _i for example, if you want to return _i
};
}
Okay I got it! thanks
BREAKING 😆
break and breakWith are not in the stable build yet (dev only)
Mister Attorney please! This case has already been through trial! 🔨
you're late, it was 2 hours ago
as per Judge decision, getDammage objection is also overruled 👨⚖️
setDamnAge wen?
Question, does anybody know how is called that function from contact that allows objects to levitate?
Dunno, but you can create one yourself. It's not difficult
I did a function to get the closest door from the player in a building, do you see things that I should change?
params [
["_player", objNull, [objNull]],
["_building", objNull, [objNull]]
];
if (isNull _building || { isNull _player }) exitWith {};
private _doors = getNumber(configFile >> "CfgVehicles" >> (typeOf _building) >> "numberOfDoors");
if (_doors < 1) exitWith {};
/**
* Get the position (relative to the building then to the world) of the first door to use it in the for loop
*/
private _door_pos_1 = _building modelToWorld (_building selectionPosition "Door_1_trigger");
private _distance = (getPosATL _player) distance _door_pos_1;
/**
* Set the first door to be the closest one, and if a door is closer, override the variable
*/
private _closest_door = 1;
for "_i" from 1 to _doors do {
/**
* Get the door position relative to the building then to the world
*/
private _door_pos = _building modelToWorld (_building selectionPosition format["Door_%1_trigger", _i]);
if (((getPosATL _player) distance _door_pos) < _distance) then {
_distance = (getPosATL _player) distance _door_pos;
_closest_door = _i;
};
};
_closest_door
not all buildings have that Door_x_trigger selection
if (((getPosATL _player) distance _door_pos) < _distance)
probablyfaster tosortthan check manually
depends on the number of doors
private _distance = (getPosATL _player) distance _door_pos_1;
no need, it's a duplicate distance. you could just define_distance = 1e20;(infinity)
_closest_door = _i
usually doors are identified with their selectionName and not their number
during testing i noticed that my spawned light sources are only visible at below ~1.5 km.
is there a way to raise the distance the lights are calculated?
only raise the dynamic lights quality in video settings, note that the amount of lights in the scene play a role too
im on ultra. changing it to "low" did not affect the distance
then no dice I'm afraid, mods maybe
its doesn't affect the distance, it affects the number actually rendered
I think it'd hurt performance
so i tested some more. it seems at around 2km the light stops having "collision" with objects and only lights up the flat ground
which is why you can see it from a plane but not a nearby hill
is this im mp or sp?
sp
k
@little raptor Thanks for answering.
I should create an array with all the position, then sort it ascending, and select the 0 index ?
Actually I want the the id of the door because I want to manipulate it with animate
also, another mistake: getPosATL is in ATL format; modelToWorld is in AGL format
@compact maple
_arr = [];
_pos = getPosASL player;
for "_i" from 1 to _doors do {
_door_pos = _building modelToWorldWorld (_building selectionPosition format["Door_%1_trigger", _i]);
_arr pushBack [_pos distance _door_pos, _i];
};
_arr sort true;
_arr#0#1;
delete everything after (door < 1) exitWith and replace with this
I did check this page https://community.bistudio.com/wiki/Position
and on the first image, it says LAND > AGL = ATL, I thought it was the same format. thanks for pointing it out
will try your code in a sec
you can add privates if you want
depends where and how you plan to execute that code
private is only justified if you need to use a variable multiple time on different scopes?
but putting private _var inside a loop is definitely bad
okay good to know
to avoid overriding a variable you may have defined in an upper scope
I was mostly joking about adding one's privates somewhere 😁 but yeah I can get you
always, if you don't know what you are doing / where you are
otherwise, they become optional in a new scope
for example let's say you're calling that code from here:
_pos = getPosASL _someObject;
call MY_fnc_closestDoor;
_someObject setPosASL (_pos vectorAdd [0,0,1])
if _pos is not private inside the MY_fnc_closestDoor (as in the code I posted a few comments back), it will change _pos in this code, thus the result will be wrong
Oooh okay
params [
["_player", objNull, [objNull]],
["_building", objNull, [objNull]]
];
if (isNull _building || { isNull _player }) exitWith {};
private _doors = getNumber(configFile >> "CfgVehicles" >> (typeOf _building) >> "numberOfDoors");
if (_doors < 1) exitWith {};
private _distance = 1e20;
private _doors_arr = [];
private _player_pos = getPosASL _player;
for "_i" from 1 to _doors do {
_door_pos = _building modelToWorldWorld (_building selectionPosition format["Door_%1_trigger", _i]);
_doors_arr pushBack [_player_pos distance _door_pos, _i];
};
_doors_arr sort true;
_doors_arr select 0 select 1;
so here, the private is useless, right ?
distance is not used
but I wonder if not using private would add some scope lookup time, hopefully not of course
like I said, it depends what is calling this code
private _door_id = [_player, _building] call SRV_fnc_get_closest_door_from_player;
if (_door_id == 0) exitWith {};
_building animate [format["door_%1_rot", _door_id], 0];
_building setVariable [format["bis_disabled_Door_%1", _door_id], 1, true];
is calling it
if you're spawning it for example, it's useless
if that's all of it, then it's useless yes
have an example where its unnecessary? in your above example putting private on _door_pos would make your script faster
private doesn't make your code slower, it can only make it faster. So there is no performance reason to leave it away
yes, any idea how it could?
only place it does nothing, is if you have no parent variable scope. But there it just does nothing at all, it doesn't hurt
I don't know, but it definitely adds some delay:
_a = 1;
private _a = 1; (is slower
huh, makes no sense
all private does is disable lookup into parent variable scope.
if there is no parent, it makes no difference. If there is a parent, it makes stuff faster by not checking it
I mean by 0.0001-2 ms
thats probably measurement error
not a huge difference
Btw since the wiki page https://community.bistudio.com/wiki/Function is marked as very outdated and often misleading, any chance anyone knows a not-outdated source on info about functions in sqf?
hmm that's good to know
so if I use private in a loop it won't be slower?
yes
I was more thinking about inline functions that I can just call multiple times in one script 👀
I think this confused me:
https://community.bistudio.com/wiki/Code_Optimisation#private
only thing I can think of is
_var = 1;
loop
{
_var = stuff
}
if you use private there, every loop iteration will delete and recreate _var.
Whereas without, it will reuse the one in upper scope.
But not sure if recreating is actually slower there, as you'd overwise do atleast 2 hashtable lookups in both variable scopes
it is a bit slower (see above link)
at least in 1.82 when I tested
private ["_a", "_b", "_c", "_d"];
for "_i" from 1 to 10 do
{
_a = 1; _b = 2; _c = 3; _d = 4;
};
// 0.0195 ms
for "_i" from 1 to 10 do
{
private _a = 1; private _b = 2; private _c = 3; private _d = 4;
};
// 0.0235 ms
what the wiki says
yeah what I wrote above
That's the only case I can think of where private might be slower, but ONLY if you actually really put that variable directly in the parent scope, not multiple scopes away, and also not undefined in parent scope
but if you tell people "don't use private if you don't need it" they won't think of that very specific optimization and apply it
And if you don't do the private ["_a", "_b", "_c", "_d"];
then the second case will be faster
how can you see the time execution of a script btw ?
debug console, the speed dial button on bottom left
there's a speedometer button in debug console
you can also use the diag_codePerformance command
private can't make the code slower as it's not an SQF operator (not talking about private <array> ofc)
I used to think it was. now I get what it does (thanks to Dedmen)
even if it does, we're not running after 0,0000xxxx ms, are we?
It's a modifier or whatever it was called in SQF
private "_variable" // BAD
is an operator
private _variable // GOOD
it's a single thing, declaration of local variable with private modifier
not really
but if it is something you do a few thousand times, it could matter!
Premature Optimisation, etc 😛
yupp
its a keyword and its handled at compile time and generates a seperate variable assignment instruction.
Its actually a keyword/modifier to the = thing
Good evening people, I would like to know if it was possible to define variables in a player's inventory items?
uniform/vest/backpack (vehicles) yeah. items (weapons) no
Okay thanks
How precise serverTime is?
I mean wiki says it syncs each 5 minutes, but what kind of desync can it accumulate within that sync interval?
it may not help you, but I would guess the same precision as time - it depends on client's performance
Hey, i have a question. I have something like Real Life Role Play in Arma with my frieds, and i want to have that only one person can unlock (or lock) his own car (and only then someone else can enter the car). Can someone help me? (I know my English sucks
)
