#arma3_scripting
1 messages Β· Page 46 of 1
I get the "just learn SQF yourself" approach, but I have tried that, and don't see myself getting to that point in useful time
do you code at all outside of SQF?
I did C and Python for school, I know a little C#
I'm probably going to do IT in college as well
are you in high school?
I graduate this year
i would focus your attention on schooling, and if you want a side coding project that involves arma, I would be doing reforger to learn for the next installment
its mainly in C# style
the next arma game, god willing, should be out when you have some really good experience in college and it will be a breeze for you
π well okay
I have looked at Enfusion engine and, there is just simply not enough documentation for someone like me to get started
And I just enjoy Arma 3
yup, its in its growing pains.
learn some sqf, build some things and create a small portfolio of stuff.
its not too bad, and its mostly fully documented now
I'm wanting to learn SQF but, I just can't find a good youtube series to guide me through it
i've read the BiWiki but, have a hard time really translating that unlike youtube videos
well start here then. get an idea and people can walk you through it. start small
something simple like, how do I create a teleporter
I also see the difference between Modding and Mission Making
Do i need knowledge of mission making to make mods? vice versa?
depends how deep. model making, textures, stuff like that is its own separate entity. mission making/ai mods/gameplay mods/user experience are more along sqf
Yeah that's what I mean, where do I even start to learn
probably start with mission making. as you want specific things to happen that you can't do with the editor, come here and you can get help
im going to bed now though. feel free to message me later
You could have invisible characters lying around
If you throw that into a good linter it should show the invalid character
You can also manually check using notepad++ by selecting the show hidden characters option (or something like that)
Happened to me a lot while copy pasting code from the web, ended up typing the whole code because those invisible characters can drive you crazy
Hey! I'm wondering why enableSimulationGlobal does not work in a trigger?
I'm trying to toggle the simulation of units and vehicles based on the proximity of players, but the command above does nothing. I executed it only on the server as mentioned on the biki page for it. I also tried running the local variant, enableSimulation, and remoteExec'd it on the server and on every client, also did not do anything. The trigger I'm using is fine, I tested it with hints. I'm using setTriggerStatements and forEach with the above commands.
I also tried these commands with a single unit, to make sure that the problem doesn't lie within the units being passed within the triggers area. Also didn't work.
Any clues why these commands do not do anything within my script?
Uh, do you have any case where enableSimulation(Global) works on the objects in question at all?
Yes, if I execute enableSimulationGlobal on the single unit I mentioned above while the mission is running, it works just fine.
But I'm doing that manually via the debug console. It does not work via script.
I also wrote a little in-file-function called fn_toggleSimulation to check if that might help in any case. When calling the function manually while the mission is running, it works just fine. When calling the function in my script (within the trigger statements), nothing happens.
how could this line be changed to work in both dedi/SP ? [_obj,_vel] remoteExec ["setvelocity", _obj];
If it has to be executed on server & clients:
[_obj, vel] remoteExec ["setVelocity", 0]
If it has to be executed only on server:
[_obj, _vel] remoteExec ["setVelocity", 2]
Making it work in both doesn't really come from something in the line itself, but where it's placed. Is it placed somewhere that will be only executed on one machine, or somewhere that will be executed on all machines? If it's somewhere that will be only executed on one machine, no change is required and it will work fine.
Using _obj as the target parameter in this case is exactly correct, because setVelocity is a Local Argument command and so must be executed where the object is local.
it's run in server
Then that's fine and it will work in both contexts without changes.
If it was somewhere that was executed on multiple machines, then the command would be remoteExec'd more than once. In this case that wouldn't actually break anything as long as all machines executed it at the same time, since setVelocity applies a fixed velocity and it wouldn't multiply, but it would be a waste of network traffic. The trick is to make the remoteExec only be sent from one machine. If it wasn't possible to move it to an inherently server-only or one-client-only place, an if isServer check would've taken care of it.
it's just that it wont work, the plane is not getting velocity
this works though: _veh setvelocity [100 * (sin _dir), 100 * (cos _dir), 0];
I take it you've confirmed that _obj and _vel do actually contain the proper values at the time of execution?
yep since that other line works
I don't see how the one thing implies the other, since neither _obj nor _vel are used in that line
setObjectVelocity =
{
params ["_obj","_vel"];
// diag_log format ["SETTING VEL %1 %2", _obj, _vel];
[_obj,_vel] remoteExecCall ["setVelocity", _obj];
};
[_veh,[100 * (sin _dir), 100 * (cos _dir), 0]] call setObjectVelocity;```
that's my code, which doesnt work
Isn't there a built-in command for setting an objects velocity already?
Yes, setVelocity, which is being used here
oic, my bad
I'm not exactly sure why it's being wrapped in a function that contains only setVelocity, the function layer could really be skipped here, but I don't think that's the problem
unless the function actually contains other things. That should probably be mentioned if so, because they could be breaking stuff.
i just like to code like that..
nope
Well, it's silly. A function that contains one short command is pointless, you might as well just do the command on its own. In fact I suggest you try it, to remove all possible sources of problems.
or at least uncomment the diag_log so we can prove the values are correct at time of execution
i need the function on couple of places, that's why the function
I already tried this and it works: #arma3_scripting message
If this is all the function contains, you do not, in fact, need it. It doesn't do anything that can only be got through a function, nor does it save any useful amount of space or performance.
I understand that that works. I still want to know if the values as used by the command are correct at the time it is executed. The thing you have proved works is not the same thing as the thing we are trying to test.
You've proven that the value you want to use is the right value. What we're trying to prove now is that the command actually uses that value.
the diag_log in that function shows the variables should be ok SETTING VEL B Alpha 3-2:1 [97.0578,-24.0787,0]
OK.
So your earlier message implied it works in SP but not MP, or vice versa. Is that true, and if so, which way around is it?
testing in SP, doesnt work
Well, I just tested that exact code in SP (with a fixed velocity value rather than that maths thing because my test vic wasn't moving) and it worked
ok, this should be something simple but the remoteExec part just doesn't seem to work
http://makearmanotwar.com/entry/UOn7vyv01J I found this recently. How does it work, does it work?
Sometimes you might want to use a seemingly useless wrapper function like that though, especially if you want to have a centralized entry point for doing other stuff (e.g. logging) when the actual command is called. Not the most common use case but I've seen code like that in SQF too and it has actually been useful in some corner cases
If so, I might want to create a planet or something for fun, how would I do that
I am literally using the exact code you posted, including remoteExec, and it works.
That's a very large question. I don't think anyone's likely to know off the top of their heads. You could try downloading it and seeing if it has any documentation.
If the exact code you posted isn't the exact code you're using, please let me know before we go any further.
ok im using IFA planes so maybe its issue with those
setVelocityModelSpace?
shouldnt be the issue π€
Are these the same planes that were previously causing problems because they're airplane and not airplaneX?
I feel like not being a PhysX simulated object is quite likely to be the source of a problem like this. Try it with a vanilla aircraft.
no, but for your own sake
Also, I'm taking it on faith that the code you posted is the code you're using.
If, for some reason, it is not, be aware that setDir resets the object's velocity, so if you're doing setDir immediately after this and have simply forgotten to mention that, that's the problem.
no setdir..
it's not attached to something, is it? xD
. . .
or sleep 0.1 π
before the function call that is
You were doing this in an init script and trying to apply velocity when nothing is being simulated because the mission hasn't started yet, I'm guessing
not in init script π
well its in the beginning of the mission but happens throughout the mission... must IFA planes issue
How would that be an IFA planes issue? The sleep is happening before you try to do anything to the plane, it wouldn't change anything outside of init
You should test the original code with a vanilla aircraft
^ this
because it seems the plane ignores the first call to setVelocity
Yes but if that was a problem with the plane, the sleep wouldn't fix it
We use this code to spawn planes from a lot of modsets, works fine:
private _plane = createVehicle [_planeType, _spawnPos, [], 0, "FLY"]; // FLY forces 100m alt
private _targDir = _spawnPos getDir _targetPos;
_plane setDir _targDir;
_plane setPosATL _spawnPos; // setPosATL kills velocity
_plane setVelocityModelSpace [0, 100, 0];
could it be possible there is IFA script that does setvelocity [0,0,0] ?
Of course because createVehicle with "FLY" gives them some velocity anyway it might not be obvious when it's not working :P
can you please test it with a vanilla plane
i can but g2g now will be back later. thx for all the help guys π
I strongly suspect that this script is actually being run during init, and that is what's causing the problem. That's what makes sense with the sleep fixing it.
The timing issues with non-local vehicles get really weird though. setPosATL works globally, setVelocity needs to be local, but setPosATL will reset velocity. Imagine how that works out.
Safest approach is to run all the commands locally if there's any local-only command in there.
the thing with vanilla planes is that bis_fnc_spawnvehicle gives them speed while IFA planes wont get the launch speed, which is why I'm dealing with this stuff in the first place
Don't use BIS_fnc_spawnVehicle :P
I just set up an Eden Editor trigger and used enableSimulationGlobal in its statements. It worked. I still have no clue why the script isn't working.
_trigger setTriggerArea [1800, 1800, 0, false];
_trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true];
_trigger setTriggerStatements ["this", "_testUnit enableSimulationGlobal true" ,"_testUnit enableSimulationGlobal false"];```
The trigger creation looks like this. `_testUnit` is simply a unit I created prior to the trigger creation for testing purposes. Any clue what I am doing wrong, so that `enableSimulationGlobal` doesn't do anything?
Already tried to schedule the code using `sleep 3` just to be sure, also didn't help.
code inside trigger statements doesn't know anything about _testUnit, it's local to wherever it was created
_testUnit has been created directly prior to the trigger. How do I pass variables to the trigger statements?
https://community.bistudio.com/wiki/Variables#Scopes
In this case you probably want to make it a global variable.
or setVariable it onto something (i.e. the trigger itself) π€·ββοΈ
But enableSimulationGlobal requires execution by the server, so I don't find it practical to stream the _testUnit variable to any other than the server.
global variable scope isn't the same as global/public variable locality
I guess I can just put it into the serverNamespace then?
global variable scope isn't the same as global/public variable locality
A global variable is not automatically broadcast to other machines, only if you use publicVariable or the public flag in setVariable. Without that, it's available to all scripts on the current machine, but still only on the current machine
Got you, will check on that in a second, thanks in advance
Oh my god, it's finally working. I was really confused until now, since I exec'd enableSimulationGlobal on the server and also defined the _testUnit on the server. But yeah, I kinda forgot that setTriggerStatements can have its own scope, my bad. @hallow mortar @south swan Thank you so much!
Hey!
I've got two arrays, one containing a list of items, and the other containing another list of items. Some of these items are identical, some of them are not. Is there a way of checking which items are the same in these arrays?
It's something like this, only a larger version. I've looked at the array section here (https://community.bistudio.com/wiki/Array) and can't make too much sense of it myself, unfortunately.
I was thinking something using arrayIntersect, possibly like this:
_list1 = ["ItemWatch","ItemCompass","ItemMap","ToolKit","B_UavTerminal","tf_microdagr","ItemcTab","ItemAndroid","ItemMicroDAGR"];
_list2 = ["ItemCompass","ItemGPS","B_UavTerminal","ItemMap","tf_microdagr","ItemAndroid","ItemMicroDAGR"];
_list1 arrayIntersect _list2;
Ideally, it should find the inverse of this, where it would detect the Toolkit and cTab, but I can't find anything on doing the inverse of intersect.
Any help is appreciated π
arrayIntersect returns an array
Is there a way of checking which items are the same in these arrays?
Yes, arrayIntersect. But I think you were actually asking to find which ones are not the same in both arrays. In that case, you can use the-operator: https://community.bistudio.com/wiki/Operators#Array_Operators
Ah, I had apparently completely skipped that part in my search haha. Thank you! π
Anyone got some leads / links on how to change the main menu when my mod is loaded? Just need a thread I can pick up and star reading
?
ok, I asked chatGPT-3 lol, I got this:
To change the background of the main menu in Arma 3, you can follow these steps:
Open the Arma 3 game directory. You can find it by right-clicking on the game in Steam, selecting "Properties," and then "Local Files."
Navigate to the "SteamApps/Common/Arma 3/@your_mod_folder/Splash" folder.
Find the "loadscreen.jpg" file and replace it with the image you want to use as your background. The recommended dimensions for this image are 1920x1080 pixels.
Save the changes and restart the game to see the new background.
Note: If you don't have a custom mod folder, you can create one by navigating to the Arma 3 directory, right-clicking in the window, and selecting "New Folder." Name the folder "@your_mod_folder" (without the quotes).
ask the wiki instead π
https://community.bistudio.com/wiki/Arma_3:_Main_Menu
although, that may not exactly be for what you are looking
basically, mod RscDisplayMain π (if you want to change big things and not just the scene behind)
LOL, thank you Lou! Yeah I'd prefer the wiki, this is just the lead I needed
ChatGPT is a chatbot, not a research tool or reference library. It's designed to give answers that seem like a human would give them; being right is secondary and it often has no way of knowing the answer, but will confidently give a wrong one anyway. It should not be used to give guidance on how to do basically anything, but especially SQF and Arma modding, which is an obscure subject that's not covered in a very AI-accessible way.
@ Lou, is there any chance we could have a "don't use AI-generated script" thing put in the pins or in the code bot response?
Chill buddy, I know, I use chat gpt like google, you will get some stuff that might point you in the right direction but won't be the actual answer you are looking for
With the advantage that there is less reading
Google tried to use ChatGPT like Google and it gave them a wrong answer. So...you know.
And for the record, I'm not being un-chill. But you're not the first person to come in with a ChatGPT-generated wrong answer and some of them have tried to actually use the code it generated. People assuming ChatGPT can do anything they ask, and is inherently trustworthy, is a growing problem that I think we need to get ahead of.
I know, chill.... And I didn't present the answer as "HEYYY this is the answer" I presented it as "this is the first lead I got".
As far as using the code it generates, anyone who has written more than 3 lines of code knows to test code before implementing it into a project.
So it's good for pseudo-code and general pointers in the direction you want to go, but fundamentally untrustworthy
It's a tool, if you understand the limitations of it then it is a very practical tool
Yes, and most people don't, which is the problem
i messed around with chat gpt on arma and while i mostly gets the end result, it does it in a really round about/inefficient way and I have to correct it
i have a problem with one of my scrips. I have a script that gives me a markername but as string. Now i want to setVariable to the Marker, but the name is a string and setVariable doesnt like that. how can i format the string to Marker or general to object?
what situation requires this?
in one of my scripts i want to add Variables to that marker to be able to read them later
I don't know if there's an easier way to do this with markers but you can make a hashmap using the marker name as a key
for now iΒ΄m creating an array that holds all the attributes but it would be way faster using the getVariable
is it just one marker or multiple values for multiple markers?
multiple values for multiple markes which frequently change
missionNameSpace setVariable [_markerName, _value];
what you mean setVariable doesn't like that?
if you have multiple markers with corresponding values I would suggest using a hashmap
i did it like that: ```sqf
_markername setVariable ["Atributename", attributvalue];
but since my _markername is formated as a string, setVariable wants an object, varspace but no string
use mission name space
// create hashmap
MC_MarkerMap = createHashMap;
// create/update entry
MC_MarkerMap set [_markername, _value];
// retrieve value
_value = MC_MarkerMap get [_markername, _defaultValue];
missionNameSpace setVariable [format ["marker_%1", _markerName], _value];
why? Im using same methode to add Variables to squads and itΒ΄s working fine:
_grp setVariable ["Atributename", attributvalue];
because you can't set a variable to a string
squads work because its a group
but isnΒ΄t a marker basically an object?
setVariable uses a "varspace" which is a namespace, object, or group. A marker is none of those.
hence missionNameSpace
markers are referenced by strings
how can i apply multiply different values for different attributes of that marker?
you can use an array
π
// create/update entry
MC_MarkerMap set [_markername, [_value1, _value2]];
but remember, there are plenty of getters for markers. make sure you look at them all
you might not need to do any of this
this does seem like diagnosing a solution rather than the base issue
thank you but the Attributs are for an City Sytem IΒ΄m building. You place a marker in the editor and my script Identifies that as a city and when troops go there the area can be captured and defended. and someting like the status (empty, blufor captured...) is stored in an array for now but i would like to move it for simplicity
I think the hashmap method would be cleanest
So im able to make make a System that sends Troops, tanks and transport to citys and Simulating a battlefield just but placing 5 markers in the editor.
i think you can nest a hashmap in a hashmap if you're feeling devious
i like hashmaps :)
iΒ΄ve never used hashmaps before so i have to look into that at first
but i could really use some help there, if someone wants to joint me in my crazy project i would welcome that very much π
Can I make a tank stick to a landing craft unit the landing craft opens its gate?
Like i have a small boat, tank on-top of the boat, go to shoreline, drop off tank
sure
Will there be a memory leak if you do not unsubscribe from events (HandleDamage for example) before the unit gets killed/destroyed and garbage collected? Single-player mission
no
Hey! I'm having trouble with this array again, sorry for the hassle! π
_allowed = [a very long string];
[missionNamespace, "arsenalClosed", {
hint "Player closed the Arsenal";
_fixed = getUnitLoadout player;
{
if (_x in _allowed == true) then {
}
else {
_fixed deleteAt (_fixed find _x);
};
} forEach _fixed;
player setUnitLoadout _fixed;
}] call BIS_fnc_addScriptedEventHandler;```
this is the rough way it's working so far, but it doesn't find anything in _fixed.
I think I've found why, but I'm not sure on how to fix it.
https://cdn.discordapp.com/attachments/783324536656363541/1073391398692343858/image.png
This seems to detect nothing, and I believe it's because the array of the loadout is technically stored inside of another array, which I gathered from the double '[' at the start. (Please correct me if this is wrong, you'd save me a lot of time π)
If anyone knows, or has an idea on how to get around this I'd really appreciate it π
variable _allowed is undefined inside the eventhandler
you need to pass it through, local variables go away
Ahh, that should have been something I picked up on, but that solves that issue at least π
It seems to still have trouble detecting the items that aren't in the _allowed array though
- look at the wiki. getUnitLoadout returns an array of arrays. and yet your _allowed array is an array of strings
if (someCondition == true)is nonsense. just useif (_someCondition)andif (!_someCondition)- you can get the iteration index of forEach using the
_forEachIndexvar - even if all above were correct, you're using deleteAt which modifies the array, so your forEach will skip the next element
Hmm, alright. How would one go about editing this? It seems like a different array entirely (which, I assume, it is).
I had forgotten about 2, actually haha. It would definitely slim the script down, so I'll change over to that.
and for 3 and 4, my original script looked more like this
_current = getUnitLoadout player;
_fixed = getUnitLoadout player;
{
//same forEach loop as before
} forEach _current;
player setUnitLoadout _fixed;```
But I thought that there was no point in using _current and _fixed if they had the same value. Would you recommend going back to that?
How can I attachTo a static turret to an object but still have the gunner be "damageable"?
Some is strange when I do this, because the gunner animation, for a third person watching, on a dedicated server is choppy
If I'm the gunner, it looks fine
and the gunner is invincible, or rather, it's like he is not even there.
How do I get a list of only the AI units in a vehicle?
So I need to get a list of the crew then, use isPlayer to transform the list into one with only AI in it
Whatβs the best practice to filter a list like that?
I tried using this a while back and it worked perfectly, other than that, I'm not too sure, sorry [turret, Object] call Bis_fnc_attachToRelative;
select
Lou with the save, as always
Yeah that's what I'm using but Arma is being goofy
It might be that your turret's gunner slightly intersects some hitbox, but I'm not too sure on what your setup looks like haha. I used this to attach guns to civilian boats back then
that's because the attached object inherits the simulation rate of its parent
I'm using a sandbagwall, the simulation is enabled on it
perhaps I should change to a invisible vehicle?
A simpler version of this might be using crew instead of fullCrew, depending on how much detail you need about each unit
_passengers = crew vehicleName;
{
if (isPlayer _x) then {
_passengers deleteAt _forEachIndex;
};
}
forEach _passengers;```
This leaves you with an array of the remaining crew members, excluding any players.
And now for the fun moment when someone comes along and does the same thing I've just done, but in 2 lines
a sandbag is a suuuper slow simulation rate
Running in seconds per frame
don't delete in an array on which you iterate!
private _aiInVehicle = crew theVehicle select { not isPlayer _x };
And there it is π
I have to ask, why the private, followed by a local variable?
because if an underscored variable is named the same in an above/below scope and it is not private'd, conflicts may arise
in general, always private
Oh, see I'd been told they did the same thing haha. Clearly that's not the case π
Good to know π
not the same no
you cannot private noUnderscoreVar for example
I'd imagine privating a global variable would serve no purpose anyway. Kind of takes away the "global" part.
See https://community.bistudio.com/wiki/Variables#Local_Variables_Scope for a nice graph!
Do you have any suggestions for an object to use in its place? This is the position:
https://imgur.com/ARXiJfG
Is this a do-for loop
Use Lou's instead, I can promise it's higher quality π
I actually had a same issue recently, ended up using Leaflet_05_F because its simulated each frame
I don't think there is a good invisible each frame simulated entity to attach objects to, couldn't find one
Is there is such entity, please let me know
Don't mind me, just saving this for future use
π
Didn't some used the empty can object for such stuff ? 
Yeah, anything with simulation = "thingX"; works
Leaflet just looks more generic and unassuming
One could also make a new vehicle and change the sim type in the config.
Thanks, I'll try that
Actually it might not fit you as well because object IS simulated, its a physical entity π€
Yeah, disabling simulation on leaflet stops simulation of attached entities too, so not a solution for you
but the leaflet can have its simulation enabled, it's not an issue
it doesn't seem to bounce around
Not sure if it reacts to explosions or vehicles nearby, might need some testing
Just attached leaflet to sandbag wall and then static weapon to leaflet
Now static weapon fires twice quicker
classic arma
but yeah, it's fine. I just shot it a bunch and threw grenades at it
at least in SP
Yeah, old bug with entity getting simulated twice a frame because of attachment chain
I remember people used to abuse it back in OA Wasteland days, attached harrier to ammo truck, then lifted ammo truck with a helicopter.
You ended up with harrier that got insta-rearmed because of ammo truck nearby and also simulated twice for double rearm\reload speed
couldn't fly with it of course, just bomb under yourself with helicopter aiming it
I wonder if I can use that on actual playable units to simulate pervitin.
Can do that with setAnimSpeedCoef 2
It shouldn't reset in vanilla, must be a mod
I tried looping it constantly. to keep setting it to a higher value, but i mean... that's going to cause major lag in MP
You can add per frame handling to set it to your coef to override mods
Doubt it sends any network message by itself
Not sure if its even MP-synced, wiki article says "effect local"
Likely safe to each frame it
i would need to execute it on each client targeting the guy that took meth
each frame
else the animations would look weird
You don't need to broadcast anything each frame, launch a routine everywhere once
You only need it on the client that took the "pervitin"
but look at the last two comments on the wiki
like, all clients will need to also call guy_who_took_perveitin setAnimSpeedCoef 2
constantly (because of the mod)
I bet it's enhanced movement rework.
Oof, you're right
"Must be executed on all clients to work properly in MP (otherwise only movement speed is adjusted, not animation itself)"
Tell clients to do that once instead of broadcasting the change each frame
Yes
do_meth_on_unit = {
params ["_unit", "_until"];
// Removing old EH if previous didn't finish before new one
if(_unit getVariable ["meth_eh", -1] >= 0) then {
removeMissionEventHandler ["meth_eh", _unit getVariable "meth_eh"];
};
// New EH
_unit setVariable ["meth_eh", addMissionEventHandler ["EachFrame", {call meth_each_frame}, _this]];
};
meth_each_frame = {
_thisArgs params ["_unit", "_until"];
if(time < _until) then {
_unit setAnimSpeedCoef 2;
} else {
_unit setAnimSpeedCoef 1;
// Remove EH and JIP
removeMissionEventHandler [_thisEvent, _thisEventHandler];
if(local _unit) then {remoteExec ["", _unit];};
// Remove EH index in case removeAllMissionEventHandlers will be used
_unit setVariable ["meth_eh", nil];
}
};
// Meth player for 10 seconds (JIP-compatible)
[player, time + 10] remoteExecCall ["do_meth_on_unit", 0, player];
```didn't test but should be something like this
How does select work?
bis_fnc_do_meth_on_unit πππ
Read all about it: https://community.bistudio.com/wiki/select
What is the use of the Functions Library ?
found a link for you: https://community.bistudio.com/wiki/Arma_3:_Functions_Library
Simple Task vs Task Framework? The BiWiki seems to suggest they are used together, at the same time one is supposed to replace another..
Hi there is possible to save money from HG Simple Shops script via iniDBI2?
Simple task is engine-level data type, framework is a framework built around it and commands that operate simple tasks.
If you know what you're doing, framework isn't needed or you build your own.
I assume for most missions the Task Framework does just fine?
I don't use it, no idea how good it is
Ok. I mean I am new and so I donβt really want to write my own Mp-synchronized task system
So you just use the engine types and handle synchronization yourself?
Yes
This is one of those "if you need to ask you shouldnt be doing it" things. best bet to interact with the Tasks system is just BIS_fnc_setTask and BIS_fnc_deleteTask
@tough abyss you'll find your the free time evaporating long before needing to replace the built in tasks stuff π debugging, workarounds, edge cases may take up the majority of your dev time
it seems setVelocityModelSpace works better than setVelocity on IFA planes. haven't yet seen that one fail when using remoteExec
what do you mean? does the command not run?
yesterday i tried to get this working: ```sqf
setObjectVelocity =
{
params ["_obj","_vel"];
[_obj,_vel] remoteExecCall ["setVelocity", _obj];
};```
when ran with IFA planes it didn't always work, but I solved it by adding sleep 0.1 before calling setObjectVelocity
why do you remoteExec it tho?
setVelocity needs local argument
I seem to recall it was global 
La-Ge
did you check if it's because it's changing locality then?
no 
why would it change? i apply the velocity on server where it's created
it was just a guess
try a helper function to check why it doesn't work
e.g.
fnc_test = { // define this on server too
params ["_veh", "_vel"];
systemChat str [velocity _veh, local _veh];
_veh setVelocity _vel;
};
[_veh, _vel] remoteExecCall ["fnc_test", 2];
i will keep that in mind, thx! π
though in SP, aren't all vehicles local to player?
well i'm running the mission from eden multiplayer mode
you should ask @velvet merlin if they do something to their planes and if that's why setVelocity doesn't work
ok π
I remember IFA having some kind of anti-physx-bullshit script
Like if a vehicle suddenly gained a lot of speed (due to Arma physics), it stops it and resets speed
Maybe related to that
while the speed limiter EH is also on planes (shouldnt), function only works for cars and tanks
you can verify via:
LIB_System_Tanks_f_SpeedLimiter_Active = false;
(limits to 110% max speed as ppl were abusing a PX glitch to gain more by swinging left and right)
the other is antiflip to avoid PX sky rocketing - but thats not active on planes either
@proven charm all planes affected?
not sure, tested with random planes.
dunno, yesterday nothing seemed to work today everything π
is there a way to make a vehicle invisible while still allowing it to move?
Okay, they react to UnitPlay and UnitFiring.
I assumed it'd act the same since the article says it acts exactly like HideObject in singleplayer
haven't tested it though
Now the question is how to hide all the weapons and the rotors on the Kajmn
hideObject is local and hideObjectGlobal is global π
just don't forget to hide the crew as well. People flying in Crazy Frog pose with extra low sync rate are only funny for the first couple of minutes :3
ring ding ding ding ding, ding
Already done. The idea is to bypass UnitPlayFiring's unwilingness to fire modded missiles by using an invisible Kajman with an RHS Hind attached to it. The only problem so far is getting the animations done, but with the Kajman's rotor still remaining I could feasibly just remove the Hind's rotors.
oh dear god it actually worked
Okay so doing AttachTo without adding offset (aligning the models in the editor) means the engines can function
for cinematic/gameplay purposes the Kajman's own rotor is not noticeable, though I assume I could hide it anyway
the fact that the weapon mounts are not hidden is actually really good, since you can have them fire without it looking weird.
Hi, there is possible to save money from HG Simple Shops script by iniDBI2?
ask the developers
or just look into the source code, and see what it does
how do you decide the group side when using createVehicle & createVehicleCrew ?
wdym? neither of those commands take sides
that's the problem π
I expect the group is created on the default side of the vehicle's faction. If you want to change it you'll have to do...whatever is normally done for changing a group's side, after creation.
the game takes the side and crew from the config
createVehicleCrew returns the group, you can joinSilent units afterwards π€·ββοΈ
no. just don't change the group's side
create the crew manually
then move them into the vehicle
ok
well, that's not exactly trivial with FFV, diving config for dontCreateAI and all the shenanigans
changing the side has its own problems too
Rating triggers off the original side at least sometimes, so you want to disable that.
creates a group if one is needed (otherwise uses group vehicle)
so i'm guessing you are fine with creating a single unit of the side you want, moving into driver seat (or other), and usingcreateVehicleCrewto finalize it
i was interested of the meaning of this wiki page message: "creates a group if one is needed (otherwise uses group vehicle)" how do you do that?
_grp addVehicle _vehicle; ?
most likely what sharp sent. "If there is somebody inside the vehicle already - join newly created crew to their group"
There are a few question marks there if using a group of a different side from the standard vehicle crew.
Given that creating a unit in a group doesn't switch the side. Only joining does.
If you create a blufor guy in a redfor group they'll shoot each other.
so what? Some monstrosity using multiple fullCrew calls or manual config diving?
We do the manual config diving but it's very error-prone.
This function is fine though IIRC: https://community.bistudio.com/wiki/BIS_fnc_vehicleCrewTurrets
or createVehicleCrew and then manually move remove vanilla crew and replace with manually spawned crewmen of proper side? :3
Sounds worse :P
maybe driver + createVehicleCrew is smart enough to handle the groups correctly though. Haven't tried it.
i'm already using joinSilent to make like res switch to west so why not...
fullCrew might also give enough information. Unclear.
There's some variance with both these functions and mod vehicles with how "showAsCargo" is handled with turret seats too.
that would work if you want go through the trouble
i have a question about creating an object. Normally this syntax works fine if i put it in a gamelogic in it's INIT:
dynamicAirport1 = "Dynamic_Airport_01_F" createVehicle position this;
If i put the same syntax in a trigger in it's OnActivation it will not work.
Any clue why that is like that?
i guess the "this" variable is not defined/invalid in trigger act field
yeah, only thisList:
https://community.bistudio.com/wiki/setTriggerStatements
thisTrigger for position
i see your points. Ok let's put that aside for a moment.
I have doubts that a dynamic_Airport_01_F can be created after map has loaded.
Let's say i run the game and go into console. If i type for example:
dynamicAirport1 = "Dynamic_Airport_01_F" createVehicle position player;
it should create it like any other vehicle
i will test one more time maybe i have a stupid typo.
guys forget it. I was super dump. Thank you. It was a stupid typo i had since yesterday...
and your hint with thisTrigger is helpful. I did not know about it. Thanks π
Hello i have a problem with buildings placed on the map.
When server starts i set some variables on several houses (for example "bis_disabled_Door_X" to lock doors, or "owner" which is the steamID of the player allowed to open doors of this house, and few others).
But sometimes, it happens randomly that a player don't have these variables set on the house, so he can open every doors, and do some actions that he shouldn't have access to.
I was told it's because of map object streaming : these objects are not always the same between each players, so they don't have the same variables.
If setting variables on map objects is not reliable, what is the solution ?
The only way i found, is having a global hashMap with positions as keys and variables as values, and every 5-10 mins, check for all elements of the hashMap if the nearestObject of its position has all its variables set...
you can try a loop that runs each frame (or less often), checks if the cursorObject is a house that should be locked, and locks it if the variable is not set
it should be more reliable than checking many objects in longer periods
if there are many of these houses use a hashmap to store them using this method:
https://community.bistudio.com/wiki/HashMap#Unsupported_Key_Types
otherwise an array is enough
the loop code will look something like this
_house = cursorObject;
if (!isNull _house && {[myMap, _house] call MY_fnc_inhashmap && {isNil {_house getVariable "bis_disabled_Door_X"}}}) then { // only check if one variable is set; if not, others are not set either
// lock again by setting all variables
//...
};
the hashmap values may be which doors to lock (if the variables are not the same)
be sure to measure the code performance if you intend to run it every frame to make sure it won't affect FPS
yes. it will be the same as Reforger. that's the whole point of Reforger. "Road to Arma 4"
Does someone know the reason why
_d = findDisplay 316000;
_ctrls = [];
_ctrls resize 10;
_ctrls apply {
_d ctrlCreate ["RscText", -1];
};
_ctrls
``` doesn't work while
```sqf
_d = findDisplay 316000;
_ctrls = [];
for "_i" from 0 to 9 do {
_ctrls pushBack (_d ctrlCreate ["RscText", -1]);
};
_ctrls
``` does?
the first one executes ctrlCreate for every element and throws away the result?
if _ctrls is the last line in your function, remove it. The function will return the result of apply, which is your mapped array.
Is there a difference in performance between:
private _one = param [0, ..];
private _two = param [1, ..];
and
params [ ["_one", ..], ["_two", ..] ];
UPDATE: benchmarking revealed that the second option is roughly twice as fast.
Hey, sorry I know this is the wrong chat but I think I've got an error in my aircraft config
Can someone help?
I don't actually know if it's the config but it's the only thing I can think that's wrong with my plane
the whole point of reforger is to outsource playable content development to modders
probably a wise move
So I have this basic setup, I don't think i am understanding how the task modules work
I have a trigger which is activated when the mission starts (just a variable set in init.sqf)
The trigger is synced to a create task module, which does create the task succesfully.
I am expecting the set task state module to set the task to assigned (and show a notification), but it does not seem to activate
the task is synced to the prowler as well as the target is to synced objects
Am I doing something wrong?
does anyone know why they created yet another homemade script language instead of implementing for example a subset of a more common language?
@candid narwhal
Fairly new to this, but...
How do i make this look better AND why is it stuck at the first index of CHANNEL_COLOR
CHANNEL_COLOR = [ //Your channel colours!!!MUST BE DEFINED!!!
[0.8,0.9,0,1],
[1,1,0,1],
[1,1,1,1],
[0.5,1,1,1],
[0.5,0.5,1,1]
];
if isServer then{
{ _y = _x;
{[_y,true,[],_x] call RADIO}forEach CHANNEL_COLOR
}forEach CHANNELS
};
This is using the Radio.sqf with inputsalong the lines of:
Create channel: ["Channel 1",true,[player],[1,0,0,1]] call RADIO //Creates new channel named "Channel 1" with the colour RED and adds the player to it
so: Name - addPlayer(?) - Player - RGB
Is this your script?
The snipped yes, the Radio.sqf no
Top is yours you mean?
yeah
Okay, what is RADIO and CHANNELS?
i can post the entire init but that has alot of not my script in it.
RADIO is a function from the Radio.sqf and CHANNELS is an Array of strings / names
Create channel: ["Channel 1",true,[player],[1,0,0,1]] call RADIO //Creates new channel named "Channel 1" with the colour RED and adds the player to it```Is this actual line of the `radio.sqf` that is meant to run?
MosesUK is the auther of the Radio.sqf and most of the init.
this is a github link to the sqf: https://gist.github.com/MosesUK/989dc76a911e0b40fd97
I'm barely seeing the reason why you say βonly the first iteration does soβ
no its the function with params on how to use it. Sorry if iΒ΄m making little sense. New to this and sleep deprived.
Okay I think I get the situation
the problem is that this:
if isServer then{
{ _y = _x;
{[_y,true,[],_x] call RADIO}forEach CHANNEL_COLOR
}forEach CHANNELS
};
Only makes one colour
Because you cannot make the same channel over and over again
{
_x params ["_name","_color"];
[_name,true,[],_color] call RADIO;
} forEach [
["Channel A",[1,0,0,1]],
["Channel B",[0,1,0,1]],
];```
This should be fine
is it making the same channel over and over again?
When launching it created my five channels but only gives them 1 color
Yes. It creates multiple channels properly. But it iterates for EVERY colors you defined
Let me elaborate, your code does make channel A properly. It tries to create with the color A, but tries to use color B as well which obviously fail, C, D, so on. Then the channel iteration proceeds, with color A, B, C...
OHHH! That does make sense! thx alot for explaining
It is because you used a forEach in a forEach, for such purpose one forEach is enough
Copy that! IΒ΄ll make sure to avoid that mistake from now on
Obviously you can always learn from a mistace
As long as you want to learn, it is not really a mistake
^^
i tried to implement this and it told me "Undefined variable in _x
what i did:
if isServer then{
_x params ["_name","_color"];
[_name,true,[],_color] call RADIO;
} forEach [
["Air",[1,0,0,1]],
["Ground",[0,1,0,1]],
["Arty",[0,0,1,1]],
["SpeerOne",[1,1,0,1]],
["Highfather",[0,1,1,1]]
];
I thought _x is a fancy thing thatΒ΄s always nice and local but i broke it.
I might be too tired rn to learn using params and nesting things. If itΒ΄s something smple iΒ΄m not seeing i guess i have to do some reading on params
Because you tried to pass forEach code into if statement
if (isServer) then {
{} forEach;
};```
So thatΒ΄s illegal. Got it, thx!
Implemented it this way now:
if (isServer) then {
{_x params ["_name","_color"];
[_name,true,[],_color] call RADIO;
} forEach[
["Air",[1,0,0,1]],
["Ground",[0,1,0,1]],
["Arty",[0,0,1,1]],
["SpeerOne",[1,1,0,1]],
["Highfather",[0,1,1,1]]
]
};
It works but:
Air is Green (Should be red right) and it only creates up to Arty.
I gotta say i like params already, just gotta get more conftable with it and everything else
okay just tested it a little more and there is some black magic:
Air
Ground
Arty
Kinda randomly assign R-G-B to each other. Sometimes Air is red, sometimes Arty (but this is honestly funny)
I assume this is because of params doing _namesfirst and then _color or is my theory false ?
I fixed it, was Human error.
THX for everything POLPOX!
IΒ΄ll probably show up here far more often in the next couple of months since i am getting into scripting and mission creation for Arma 3. Very Glad the community is nice!
what are some big differences between Mission event handler EntityKilled and the standard Killed EH? if the unit is local to the server wouldnt Killed act the same as EntityKilled ?
The most important difference is that one is a mission EH and one is a per-unit EH. Mission EHs are added to the whole mission, so entityKilled will trigger whenever any entity is killed. Normal killed will only trigger when the specific unit it was added to is killed.
Another difference is that EntityKilled triggers for entities, but killed can trigger for non-entity objects too
Syncing to the prowler means nothing
Tasks can only be synced to triggers
Ah okay so since I only really care about units, I can just use EntityKilled
Yes
what would be a non entity? like houses?
Yeah
Cool thx
Hello, is any ways to prevent ctrlCreate command on display?
no. why would you want to tho?
There is a bug in the Arma: I have placed a Helicopter 3.5km far away from a AA vehicle, AA vehicle has a gunner with radar on, heli is in radar range but its not getting added to possible targets of the AA crew until a Player will enter that vehicle and move turret a little bit
I"m using: u1 nearTargets 7000 to check if heli is inside targets
Is there a way to detect all explosions within a given area?
found this thing but tbh not sure it will work {_x inArea thisTrigger} count allMissionObjects "#explosion" > 0
I want to add a marker to the map wherever explosion happens
extra π€ Seems to work on my machine, though. B_APC_Tracked_01_AA_F named u1 in [0,0,0] of VR map with only AI gunner inside and "Emission Control" set to "Active", O_Heli_Light_02_dynamicLoadout_F named u2 in [0,3500,150]. u1 nearTargets 7000 shows the Orca roughly a second into mission.
although the difference may be caused by me being of 2.13 dev build
(please don't start with "it's a bug", ask first what it might be)
view distance may play a role here too
on my machine view distance only changes the shooting, not detection, though. At least when both vehicles are on the same client π€
although i seem to remember something funny about AA being able to fire guns up to 4x the draw distance (if it's short enough) and rockets only going up to 1x. Or something like that.
Target heli is in object view distance range
try 4.5km on a normal map like Stratis
Stratis, same Cheetah at the airbase strip, same heli 5.5 km to the south (at 150 meters height). ~3 seconds until Orca shows in u1 nearTargets 7000
doesn't shoot as its missiles seem to have 4.5 km lock distance, but tracks with the turret
is the Orca in the same faction as the vehicle or a different faction? I'm testing when both AA and Heli is in Green faction
works but it's very slow
B_Heli_Light_01_F in blue/blue gets detected at roughly 5 seconds π€·ββοΈ
if your trigger area is circular you can use nearestObjects
if not use a combination of nearestObjects and inArea
and/or inAreaArray because why not
well doesn't work for me, but let me try without any mods
Yep that's what I did
while {true} do
{
{
_exp = _x;
_shouldSpawnMarker = count (_exp nearObjects ["Marker", 10]) < 1;
if (_shouldSpawnMarker) then
{
_markerName = format ["%1",random 10000];
_marker = createMarker [_markerName, _exp];
_marker setMarkerShape "ICON";
_marker setMarkerType format ["Contact_pencilTask%1",1 + ([1, 2] call BIS_fnc_randomInt)]
}
}
forEach (Center nearObjects ["#explosion", 3000]);
sleep 0.001;
}```
Now the problem is that sometimes it spawns multiple markers for a single exposion. Seems like this line does not work:
`_shouldSpawnMarker = count (_exp nearObjects ["Marker", 10]) < 1;`
you can use (FiredMan on men) + (Explosive on projectiles) event handlers
will this work with MLRS? I'm investigating different MLRSs spread
MLRS?
hmm yeah that might work too, thx
different MLRSs spread
you can also visualize the projectile paths
yeah I think I used to mess around with tracers
does anyone know if this is the right way to fetch nearest markers? _exp nearObjects ["Marker", 10]
_exp nearObjects ["Marker", 10]
markers are not objects
#badideas "just detect big craters and slap markers on them periodically"
_markerIDx = 0;
while {true} do
{
{
_exp = _x;
_shouldSpawnMarker = _x getVariable ["marker", ""] == "";
if (_shouldSpawnMarker) then
{
_markerName = format ["exp_marker_%1",_markerIDx ];
_markerIDx = _markerIDx + 1;
_marker = createMarker [_markerName, _exp];
_x setVariable ["marker", _markerName];
_marker setMarkerShape "ICON";
_marker setMarkerType format ["Contact_pencilTask%1",1 + ([1, 2] call BIS_fnc_randomInt)]
}
}
forEach (Center nearObjects ["#explosion", 3000]);
sleep 0.001;
}
will fix your duplicate marker problem
oh cool, thx.
So if I do getVatiable I have to omit the _ prefix?
that's for local variables. setVariable and getVariable don't create local vars
getVariable ["marker" vs _marker = createMarker
both marker and _marker reference the same variable in this case right?
well, player serVariable ["_kek", "kek"] worked for me, π€·ββοΈ
yes. I didn't say it doesn't
sorry then, misread on me
you can even put spaces and other invalid chars. e.g player setVariable ["Β―\_(γ)_/Β―", "kek"]
so we assign a variable to the explosion and the next time we run our check we check for the var, clever
inb4 emoji-keyed hashmap 
thank you Leopard π
sleep 0.001;
is this the correct way to skip 1 frame or is there something more clean?
Doesnt work for me, I have Heli in Green faction, Cheetah (green faction) on Airstrip, distance between them ~ 3500m, they are in object view distance, radar is on, all ai skill is set to 1, all mods disabled
(vehicle u1) setVehicleRadar 1;
{
u1 setSkill [_x,1];
} foreach [
"general",
"courage",
"aimingAccuracy",
"aimingShake",
"aimingSpeed",
"commanding",
"endurance",
"spotDistance",
"spotTime",
"reloadSpeed"
];
helka in ((u1 nearTargets 7000) apply { _x # 4; });
no that won't guarantee 1 frame delay
but if you don't have many scripts running it will
you can use an eachFrame event handler
onEachFrame {
{
_exp = _x;
_shouldSpawnMarker = _x getVariable ["marker", ""] == "";
if (_shouldSpawnMarker) then
{
_markerName = format ["exp_marker_%1",_markerIDx ];
_markerIDx = _markerIDx + 1;
_marker = createMarker [_markerName, _exp];
_x setVariable ["marker", _markerName];
_marker setMarkerShape "ICON";
_marker setMarkerType format ["Contact_pencilTask%1",1 + ([1, 2] call BIS_fnc_randomInt)]
}
}
forEach (Center nearObjects ["#explosion", 3000]);
}
p.s: this might reduce your FPS
also that's for testing only. don't use onEachFrame for actual use
Wild guess. Maybe there is a requirement to have engine on and AI doesn't turn it on so you need player to turn the turret and enable the engine?
seems to behave same(-ish) on current release version for me. Doesn't seem to detect green-on-green until i get in the vehicle for a second π€·ββοΈ
doesn't seem to be present in current dev, maybe linked to https://forums.bohemia.net/forums/topic/140837-development-branch-changelog/?do=findComment&comment=3471113 /https://feedback.bistudio.com/T166838. Or some other fix π€·ββοΈ
I have made video: https://www.youtube.com/watch?v=1-jsbY_Alzk
Shit internet right now, try force enabling the engine?
seems to reproduce on RC as well. Maybe really affected by that ticket
I have just tested with (vehicle u1) engineOn true; added, the same result
just player getting into gunner or commander position and ejecting right away seems to detect the heli. Forcing engine on doesn't.
yep
anyway, fixed/changed in dev, i don't see any reason to dig further
do you know by a chance when its going to be released?
no idea. Another half a year if the gap between 2.10 and 2.12 is an example to follow
also, blue-on-red seems to work at 5+km on RC, so two reasons to not dig further :3
I do not understand what βtargetβ is for the task, i assumed βsynchronized objectβ is the prowler where the task is set to
Nothing
testVar = 777;
hint str (missionnamespace getVariable "testVar");
honestly I dunno why use missionnameSpace Setvariable
to send variable over net?
setVariable is for:
- if you want to set the variable in a namespace other than missionNamespace
- if you are currently not operating in the missionNamespace and want to set a variable in it
- if you want to broadcast the variable (note that
publicVariablecan also do this)
setVariable is also useful if you want to work with procedurally-generated variable names, since it uses a string for the variable name
oh yeah i've done that sometimes. Not being in missionNamespace
am i wrong with the assumption that variable "this" refers to the waypoint?
i tried using like see in the image and just delete the _veh (just as example)
or is there any other way of how to identify a waypoint's owner?
like network owner or group?
Does anyone know of any existing scripts that prevent helicopters from being fully destroyed? (i.e, allow component damage but prevent hull from going <10%?). I've got to imagine something like that exists but I haven't seen anything.
HandleDamage Eventhandler can do it
Yes, that assumption is wrong. In waypoint statements, this is the leader of the group the WP belongs to.
Wish append returned left array instead of Nothing 
So instead of
private _wanted_array1 = _something1 call functionReturnsArray;
_wanted_array1 append [1,2,3];
private _wanted_array2 = _something2 call functionReturnsArray;
_wanted_array2 append [3,2,1];
```I could've had
```sqf
private _wanted_array1 = _something1 call functionReturnsArray append [1,2,3];
private _wanted_array2 = _something2 call functionReturnsArray append [3,2,1];
```so much prettier
i mean i guess + works in that case
private _wanted_array1 = _something1 call functionReturnsArray; _wanted_array1 append [1,2,3];
private _wanted_array2 = _something2 call functionReturnsArray; _wanted_array2 append [3,2,1];
```is still meh
Sure, but its an extra array
@jaunty zephyr because its not that hard to create one
that is a reason not to avoid creating it, not a reason to prefer it
existing languages have all sorts of supporting software... IDEs, linters, whatnot
well ... then lets say it like so:
what alternatives but LUA are out there supporting what you want to have?
I personally hate LUAs syntax ... and the other ones which are out there are not as popular
thus the best would be to create some script language that is kinda like c++
or to take one of the unknown
in the end you would have to pay for using the lang
which is why i'd want to avoid inventing my own stuff -- so as not to miss out on the goddness that exists
but theres heaps of general purpose languages
group would do fine. But i might make something out of NikkoJT's message.
Thank you! so it looks like i overcomplicated this.
still - smells heavily of not-invented-here syndrome
thank you for your input. I made it work what i wanted to do with this syntax:
private _veh = vehicle this;
[_veh, TanoaAirportRoot, 1000] execVM "disablecollision.sqf";
It will disable the collision for the plane when landed with foreach "plane" inisde the specified area.
what was the workaround for props/objects damaging the player after detaching
like <prop> attachto player, then "detach prop", player walks near it and takes damage
Based on this: <#arma3_scripting message> I think you might need to reset the object's velocity to 0
Wondering what would be the absolute quickest way to find out if position is visible on the map control or not? Any ideas?
Hello, I have a couple sounds im trying to play on a vehicle via a useraction, The sounds play fine when i execute the script on myself, However the statement section seems to not work, Any solutions?
original code below
[_this, selectRandom ["sound01","sound02","sound03","sound04"], 500] call CBA_fnc_globalSay3d;
Then the vehicle
class O_Heli_Light_02_unarmed_F_sound: O_Heli_Light_02_unarmed_F
{
class UserActions
{
class vulture
{
displayName="Play Sounds";
position="pilotview";
radius=5;
onlyforplayer=0;
shortcut="User19";
condition="isEngineOn this and player == currentPilot this;";
statement="[_this, selectRandom ["sound01","sound02","sound03","sound04"], 500] call CBA_fnc_globalSay3d;, 500] call CBA_fnc_globalSay3d;";
};
};
};
statementusesthisfor the vehicle and not_this- You need double quotes because your quotes are inside string (or single quite)
- You have ; after globalSay3d
- You have globalSay3d twice
ah hold on im sorry, it pasted weird.
statement="[this, selectRandom ['vulture_droid01','vulture_droid02','vulture_droid03','vulture_droid04'], 500] call CBA_fnc_globalSay3d;";
This is the statement. not sure why it did that
The _this was the issue, Is there any reason i should remove the ; after the GS3D? or does it really not effect anything
You pasted your code twice first time and there is extra ; in the middle of it
call CBA_fnc_globalSay3d;, 500
Last statement doesn't have to have ; so it doesn't matter in your second statement paste
So all good

So I tried doing
private _wts = _map ctrlMapWorldToScreen _x;
call {
if(_wts # 0 < _map_x) exitWith {};
if(_wts # 1 < _map_y) exitWith {};
if(_wts # 0 > _map_x2) exitWith {};
if(_wts # 1 > _map_y2) exitWith {};
```checks before drawing the icon (_x), for 100 icons this ends up 2 times slower than just straight doing `drawIcon`
Quicker only in few cases with <10 icons out of 100 visible
Seems to be usual SQF story, its quicker to run heavy engine command than a several simple commands
if(_wts # 0 > _map_x && {_wts # 0 < _map_x2 && {_wts # 1 > _map_y && {_wts # 1 < _map_y2}}}) then {
```saves a bit, yet with almost no icons visible its barely better than to just cram all arrays into `drawIcon`
If all icons are visible, boundary checks make it all twice slower
Here comes the dreaming, a new DrawIcon type!
<DrawIcon> = createDrawIcon <HashMap>;
deleteDrawIcon <DrawIcon>;
Null = drawIconNull;
isNull <DrawIcon>;
<DrawIcon> setDrawIconProperties <HashMap>;
<HashMap> = getDrawIconProperties <DrawIcon>;
<Control> ctrlMapAddDrawIcon <DrawIcon>;
<Control> ctrlMapRemoveDrawIcon <DrawIcon>;
<Array> = ctrlMapAllDrawIcons <Control>;
Hashmaps to avoid having myriad of scripting commands to change things one by one
private _my_icon = createDrawIcon createHashMapFromArray [
["texture", "file.paa"]
,["width", 24]
,["height", 24]
,["shadow", 2]
];
...
_my_icon setDrawIconProperties createHashMapFromArray [
["position", getPos player]
,["direction", getDir player]
];
Not sure if specialised commands are worse than creating a hashmap to say update icon position each frame π€
</dream-mode>
Back to trying to squeeze few microseconds out of heavy map drawing routine
If a While loop condition flips, does the loop end immediately, or will it continue until the end?
I've made one conditional on a helicopter being alive and running a looping flight path, but I'm having trouble breaking out of it once the helo is down.
What do you mean by "the end"? Loops by definition don't have an end, and only exit when the condition is no longer true
'The end' being the bottom of the do {...} code, where it would jump back to the top.
The condition is only checked once per iteration of the loop.
check condition > do code > check condition > do code > ...```
The loop will only discover that the condition is no longer true, when it checks the condition. Since it doesn't check the condition partway through the loop, it can't exit partway. If you want to have another check halfway, you need to add an `if (condition) exitWith {}` inside the code.
Dang, that's what I was afraid of :/
Alright... think I can wrangle something together and still avoid making a trigger.
i get an error message with one of my eventhandlers.
i put this code in OnActivation of a "land" waypoint:
private _veh = vehicle this;
hint str _veh;
[_veh, TanoaAirportRoot, 1000] execVM "disablecollision.sqf";
_veh addEventHandler ["LandedStopped", {
params ["_veh","dynamicairport1"];
hint "plane landed and stopped";
}];
the hint "plane landed and stopped" is shown. I know that the eventhandler is exectuted, but the error message appears.
Is it not possible to use local variables in eventhandlers in general? is it something that should be avoided even though the code works?
"_dynamicairport1"?
params can only create local variables. You're trying to do a global dynamicairport1
Do:
while {true} do {
if(condition) exitWith {};
if(something) then {
if(condition2) exitWith {break;};
};
};
I think your best bet there is to utilise inAreaArray as a pre-filter.
So don't check whether each point is in the draw area, but whether it could be. Leave the detail clipping to the engine.
Good idea, gonna try it
There's a useful trick with _arrayOfPositions inAreaArray where the Z coord can be anything as long as it's a number, so you can use that as an index to arbitrary data.
it worked thanks.
General question:
if i have a object named globally dynamicairport1 and i just want a local variable of this i can simple use _dynamicaiport1?
so i dont need to put for example:
private _dynamicairport1= dynamicairport1
No, they're different variables so you need the latter.
understood thank you
I just wish there was an nearestPositionArray command to match, because I could easily get 20x speedups for a lot of routines with that and Z coord abuse.
Lets nag dedmen 
Since you cannot use sleep inside of remoteExec, what else could be used to get the same effect?
{
_array = someLocalArray;
if (_array isNotEqualTo []) then {
hint "Array is not empty";
sleep 10;
someCode;
};
} remoteExec ["call", someUnit];```
Here's an extremely simplified exec I have and all I'd need is for ``someCode`` to be ran after a short delay from the hint, only if the condition checked within the exec returns true.
Hi guys, got a question here. Is it possible to change Blackfish interior?
https://community.bistudio.com/wiki/createTrigger
The locality flag is the "Server Only" attribute?
You should make this code into a function https://community.bistudio.com/wiki/Arma_3:_Functions_Library and then remoteExec that, instead of sending a huge chunk of code over the network. Functions are executed in a scheduled environment when remoteExec'd, so suspension is allowed.
"Functions are executed in the scheduled environment; suspension is allowed."
My aim is to make the script work on its own in a single file, such as init.sqf.
For what reason?
Even if you really insist on not using cfgFunctions, you can define functions without it, e.g. tag_fnc_someFunction = { <code here> }; and as long as that definition is run on the target machine (which it will be, if it's in init.sqf) you can remoteExec it.
Has anyone here ever wished for more sides, to be able to have many different "teams" against each other in a game?
I have a working solution for that!
Try spawning it:
[] spawn {
{
_array = someLocalArray;
if (_array isNotEqualTo []) then {
hint "Array is not empty";
sleep 10;
someCode;
};
} remoteExec ["call", someUnit];
};
Spill it!
is there something like function aimedAtTarget which works for a position instead of target unit/obj?
you mean like cursorTarget / cursorObject?
no, a function which will tell me how well unit is aimed at a position
Probably not, since units don't really aim at positions
AI or Player?
why not? you can command suppressive fire at a position
AI
guessing here.. targetKnowledge?
I think no, it only accepts obj as arg
I messed around with that a bit to no avail, but I'll look more into it later. Although then again when I tested that method I was simply using the execute code module on local, which did work for previous tests.
Oh, I see everyone is anxious to know!
Apologies for the suspense, currently working, but trying to organize it real quick so I can share it here.
It's a method that utilizes a few event handlers and a couple of custom loops.
what part of it?
how do i get two or more notifications displayed like in the pic here: https://community.bistudio.com/wiki/Arma_3:_Notification ?
mainly the seats and the interior floor
you might be able to create new objects and attach them at the correct spot
other than that no
thx, i tried it from 6-99. 0 works
Okay, folks, here is all the code needed to start a group vs group vs group (etc) game:
3 way conflict?
Infinite-way conflict!
Isnt there only opfor, blufor, independent and civilian teams?
This method blatantly ignores side limitation.
In my mission, (AI battle royale with 4-man teams), all units are Civilians
https://discordapp.com/channels/105462288051380224/105462984087728128/1074392906514841772 @proven charm @meager granite
Can someone help me make this script work in MP?
player addAction["Go Green", {_this select 0 setObjectTexture [0, "#(argb,8,8,3)color(0.25,0.5,0.25,1,CA)"];_this select 0 setObjectTexture [1, "#(argb,8,8,3)color(0.25,0.5,0.25,1,CA)"];}]
where do you run it?
I'm trying to run it on a dedicated server
It is in an Init
you mean object init?
Yes
then why do you use player?
What should I be using instead?
is that supposed to add the action to the player?
It is supposed to add a scroll wheel action to players
then put it in initPlayerLocal.sqf
How would I do that?
make a file called initPlayerLocal.sqf in your mission root folder and put this in it
params ["_player"];
_player addAction ["Go Green", {
params ["_obj"];
_obj setObjectTextureGlobal [0, "#(argb,8,8,3)color(0.25,0.5,0.25,1,CA)"];
_obj setObjectTextureGlobal [1, "#(argb,8,8,3)color(0.25,0.5,0.25,1,CA)"];
}]
Alright
And then I just go into the mission, check it works and then export?
@little raptor It works on my machine, but not on the server.
are you sure you're actually using that script? did you remove your old one?
I removed the old one, yes
try the edited one
My problem is that the action doesn't even appear in the scroll wheel menu.
then you've not set up the file correctly
did you enable file extensions in explorer?
Wait, yes I did
The script works perfectly fine on my machine, just not on the server even with the initPlayerLocal.sqf file
what about with the new edited one?
Same
Someone help me with my brackets n shit
call{({ alive _x} count units W1G1 ==0) && ({alive _x} count units W1G2 ==0)} && ({alive _x} count units W1G3 ==0)}
that's throwing up an error and I know I messed up the bracket placement I just can't figure out where
[W1G1, W1G2, W1G3] findIf {units _x findIf {alive _x} != -1} == -1
Neither version of the script has worked on the server so far.
I don't see any reason why they shouldn't
My only guess is the player part of the script.
test the new version
do you see the message "running"?
if not you're doing something wrong
else yes, that would be the problem
Oh, I didn't notice that you edited the script.
@little raptor Okay, so the .sqf is working, as I saw a "running" message when I loaded into the server. So at this point, I am pretty sure it is the player part.
what kind of respawn system do you use?
Just a regular respawn, nothing special.
10 second delay and players can select where they respawn.
put the script in onPlayerRespawn.sqf too
does "object" in sqf scripting have the same meaning as in object oriented programming?
or does it just mean physical game object?
Alright, I'll do that and then try the script tomorrow.
no
technically it's an OOP object under the hood
but no
Wow. That's much simpler. Thank you. Awesome
it also runs faster, because it stops checking all units as soon as it finds an alive unit
I've tried looking my issue up, and so far it seems like the problem with my script is the player part, but I don't know what to put in that's place.
like I said just put in it onPlayerRespawn.sqf. there's nothing you can put instead of player
Alright. If I remember you tomorrow, I'll ping you and tell you the result after I test it tomorrow.
I made some changes to make it work in onplayerrespawn too
if all fails you can just resort to this:
[] spawn {
while {true} do {
if (!isNull player && player getVariable ["LocDem_actionID", -1] < 0) then {
_id = player addAction ["Go Green", {
params ["_obj"];
_obj setObjectTextureGlobal [0, "#(argb,8,8,3)color(0.25,0.5,0.25,1,CA)"];
_obj setObjectTextureGlobal [1, "#(argb,8,8,3)color(0.25,0.5,0.25,1,CA)"];
}];
player setVariable ["LocDem_actionID", _id]
};
sleep 1;
};
}
(in initPlayerLocal.sqf)
What would that do?
constantly checks if the action is added to the current player. if not, adds it
Alright, I'll try it tomorrow.
Alright.
waitUntil loop version:
[] spawn {
waitUntil {
if (!isNull player && player getVariable ["LocDem_actionID", -1] < 0) then {
_id = player addAction ["Go Green", {
params ["_obj"];
_obj setObjectTextureGlobal [0, "#(argb,8,8,3)color(0.25,0.5,0.25,1,CA)"];
_obj setObjectTextureGlobal [1, "#(argb,8,8,3)color(0.25,0.5,0.25,1,CA)"];
}];
player setVariable ["LocDem_actionID", _id]
};
sleep 1;
false;
};
}
!(isNil "undefinedVariable");
just put a false at the end...
@little raptor oh! Edited now, thanks!
How can I make vehicles respawn with their crews?
Hi, I'm fairly new to Arma 3 and the Eden Editor in general. I would like to know how I can make vehicles respawn with their crew inside once it's destroyed or disabled.
I know how to use the vehicle respawn module, but it only respawns the vehicle not the crew. I know I need to use a script for that, but I have no idea how to do one that allows that.
Does anyone know how to make this possible? Maybe I could join a discord server where people know more about that stuff, but I have no idea which one to join.
Hello, I'm new to arma scripting.
Can someone help me out with the syntax and tell me why this code is not running?
My problem is most likely being caused by the currentElements of the foreach loops
while {true} do {
{
if (side _x == opfor || side _x == independent) then
{
private _enemyUnit = _x;
{
if (_x == blufor && {(_x distance2D _enemyUnit) > 50}) then
{
_enemyUnit hideObject true;
} else {
_enemyUnit hideObject false;
}
} forEach allUnits; // allPlayers
}
} forEach allUnits;
}
This is the same as above but maybe it is easier to understand what I'm trying to do:
while {true} do {
{
if (side _x == opfor || side _x == independent) then
{
{
if (_y == blufor && {(_y distance2D _x) > 50}) then
{
_x hideObject true;
} else {
_x hideObject false;
}
} forEach allPlayers;
}
} forEach allUnits;
}
if (_x == blufor in line 7 of first version is a typo, you need to check side _x against the side, like in line 2. Also, https://community.bistudio.com/wiki/units can take side.
Thank you! Works great now!
You should probably add a sleep in there somewhere, otherwise this loop will run multiple times per frame and tie up the scheduler
It's actually not working now... I must be doing something wrong. Debugging right now.
Cool, but I don't know how to implement it.
I mean, the file containing the script must be a .sqf I suppose. Also, even if I can copy paste it, I don't know exactly what I need to write and in the editor itself.
I tried but I got an error of saying something like "you can't put sleep here"
it was at the end of the while loop\
That means you're running it unscheduled, which means it has a maximum of 10,000 iterations. Since you're iterating multiple times per frame, that limit will expire quickly.
Use spawn to create the loop in a scheduled thread where you can use suspension.
@hallow mortar Is this what you meant?
_handle = 0 spawn {
while {true} do {
{
if (side _x == opfor || side _x == independent) then
{
_y = _x;
{
if (side _x == blufor && {(_x distance2D _y) > 50}) then
{
_y hideObject true;
} else {
_y hideObject false;
}
} forEach allUnits;
}
} forEach allUnits;
sleep 2;
}
};
The code isn't returning an error, but somewhere something is wrong because it's not hiding the units and I have no idea where.
the code doesn't make any sense anyway
let's say I have a single blufor guy and 2 opfor guys
now if the blufor guy is farther than 50m to one but closer than 50 to the other, he first gets hidden, then unhidden
essentially undoing everything
inb4 sqf [] spawn { while {true} do { private _blu = units blufor; { private _y = _x; private _nobodyClose = (_blu findIf {_x distance2d _y < 50}) == -1; _y hideObject _nobodyClose; } forEach (units opfor + units independent) sleep 2; }; };
needs a loop too
This is what I'm trying to achieve
I know what you want to do. I just meant the execution is wrong
doing it like that will work
What do I need to change to correct this behavior
see artemoz's code
Oh I absolutely skipped over that haha
Thank you @south swan !
I'll look into it now
tho probably using nearEntities could end up being faster
if there are many of them
{
if (side _x == blufor && {(_x distance2D _y) > 50}) then
{
_y hideObject true;
} else {
_y hideObject false;
}
} forEach allUnits; ```
this effectively only checks the distance to the last blufor unit
```sqf
_y hideObject true;
{
_y hideObject false;
break;
} forEach allUnits;
this would work for intended logic
or inAreaArray. Or some other shenanigan
no inAreaArray would make things worse in some cases
huh
i wonder how fast is https://community.bistudio.com/wiki/findNearestEnemy π€
although it seems to only work on known targets 
Ayy, managed to get my script working on the dedicated server
So after finally getting around to test it, nope, that doesn't solve the issue. There can, especially with a big modlist, still be a loading screen on top of it, when it gets created.
Maybe looking into checking if both the loading screen is gone and the display is there someday.
Thanks, expected it to be something like this.
Try it!
setUnitRank sets a rating of 0, instead of trying to calculate what to actually add to the rating to make it 0 again.
I've seen the calculation before, but this method does the job. It -sets- instead of -adds-
Its just _unit addRaing -rating _unit
Thought setUnitRank had other effects I didn't know of
Anyway thanks for sharing
Well, I suppose that would do it, then
Looks way simpler than the other thing I read
Or just _unit addRating 1e6 and you never have to worry about it
More stuff I've never heard of π
I got an interesting question. Is there a way to prevent ACE3's Personal Aid Kit from resetting the Stamina through scripting?
In my initPlayerLocal.sqf I have this set of code:
player enableStamina false;
player forceWalk false;
and in my onPlayerRespawn.sqf I have the same thing.
But if I Zeus heal someone or if someone uses a PAK back at base, stamina turns back on.
I thought about just running a loop to constantly 'disable' stamina but worry about performance.
Does Zeus heal cause the unit being healed to do the healing animation?
Nah. We also use ACE Medical.
I'd really hate to script it to just have a sleep loop (cause of performance) so if there is a better way, I'd love to hear it :P
Or is the method of
waitUntil {(!isNull Player) and (alive Player)};
while {true} do
{
player enableStamina false;
sleep 1;
};
The only possible way?
player spawn {
waitUntil
{
if ((damage _this) isEqualTo 0) then
{
_this enableStamina false;
_this forceWalk false;
};
sleep 1;
false;
};
};
waitUntil checks every frame (50-60x per second) and while {} do checks thousands of times per second, so waitUntil loops should generally be more efficient on CPU.
What that does is checks for when the player is healed (damage = 0), then disables stamina only when HP is at 100.
However, it will try to apply it as long as you remain at 100HP
Maybe there's something else to add.
Nested waitUntil:
player spawn {
waitUntil
{
waitUntil
{
sleep 1;
((damage _this) isEqualTo 0);
};
_this enableStamina false;
_this forceWalk false;
sleep 1;
false;
};
};

Nah, I think that would still apply it as long as you're at 100 HP, as well
At least it wouldn't apply it while you're under 100 HP
Yeah I'm trying to think of how to do it without turning this into a giant block of code
xD
Perhaps using the dammaged event handler could do it, somehow.
or HandleHeal
Here's your two lines of code plugged in to HandleHeal, modified from a version that heals someone who self-meds to 100 HP:
player addEventHandler ["HandleHeal", {
_this spawn {
params ["_injured", "_healer"];
private _damage = damage _injured;
waitUntil { damage _injured != _damage };
if (damage _injured > _damage) then {
_injured enableStamina false;
_injured forceWalk false;
};
};
}];
But if i remember correctly damage with ace medical gonna return always 0 
Oh
That was my thought since it uses its own system for damage.
meybe this
// initplayerlocal
fnc_setStaminaOFF = {
[] spawn {
waitUntil {
sleep 3;
isStaminaEnabled player
};
player enableStamina false;
call fnc_setStaminaOFF;
};
};
call fnc_setStaminaOFF;
still not best solution and coding xD
well my code its super basic function and should be fine 
is there anything like pass by reference in arma? If I getvariable something then modify it, do I need to setvariable to update it?
or can I edit it at the source and not have to worry about it
I think the easier question would be: what data types are NOT passed by reference
getVariable only passes a value, not a ref. = does
Ok so Leopard20 that trigger condition you made is awesome and works perfectly for me, now I just need to know how to make it activate when say, 3 units remain in each group instead of 0? [W1G1, W1G2, W1G3] findIf {units _x findIf {alive _x} != -1} == -1
I tried changing those numbers to 3 but nothing is happening
0 would work fine in any other circumstance except in my mission the AI are attacking across open ground against entrenched enemies and I'm using LAMBS danger AI so half the guys retreat off into the wild blue yonder when their friends die lol, therefor I'm gonna need the trigger to spawn the next attacking wave when some of the first wave is still alive
Anyone want to help me solve an arma problem? Unloading vehicle cargo on a ship deck. The internal system uses terrain position
- using "detach" instead of "objnull setvehiclecargo <cargo>" causes issues with parent vehicle mass ( the added mass is only removed when using setvehiclecargo )
- while using setvehiclecargo adds internal scripting, like on ship deck, the cargo will receive a parachute on detach due to height above terrain level
Gday all, hoping someone can help, i have made a basic mobile vehicle respawn (where players can respawn at a vehicle) for warlords, however when the vehicle is destroyed players are still able to respawn at the vehicle, below is the code ive done however players can still respawn at the destroyed vehicle, no errors or anything, basically when its destroyed i just want the spawn to stop, until it respawns and the script starts again. (i got this script from a yt video by Gunter Severloh)
{
//moves base marker in the editor to position of vehicle every 5 seconds
"respawn_east" setmarkerpos getpos rhq;
sleep 5;
};```
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
Guess you can try deleteMarker after the while so it will remove the marker after it is gone
thanks for that, ill give it a crack
Nope, not quite, any other suggestions?
How'd you do that?
{
//moves base marker in the editor to position of vehicle every 5 seconds
"respawn_east" setmarkerpos getpos rhq;
sleep 5;
};```
Unless it is meant to be somewhere else  you could say sql is like a foreign language to me...
I said after not before
Sorry mate i dont understand exactly where it needs to go, ive never really done this before, how would i do that?
while {alive rhq} do
{
//moves base marker in the editor to position of vehicle every 5 seconds
"respawn_east" setmarkerpos getpos rhq;
sleep 5;
};
deleteMarker "respawn_east";```
O wait error there
Fixed
Yep that worked, except now once it respawns the marker doesnt return, know an easy fix for that too? π€£
tried a few different combos myself and nothing
variable of the newly spawned vehicle needs to be rhq
Yeah that is,
...though i thought they kept variable names through respawn
unless when it respawns, it deletes the variable?
yeah, im using the ingame vehicle respawner
axtually did you try remove the deletemarker
as in remove from the script or another that brings it back like createMarker?
remove it from the script
it then goes back to allowing to respawn at dead vehicle
what about when its respawned
no marker, just the vehicle, its like rather than delete the marker it should mark it as inactive for sometime, and i just make that the same time as whats set for the vehicle to respawn
or just create a new marker at the vehicle everytime it dies and respawns
where are you running the script btw
in the mission folder within mpmissions, as a .sqf thats started from initserver.sqf
can you check if init stuff is run when the vehicle respawns or if theres anything like that in the module im not on my pc
so just stick systemChat "balls" in the init then have the module respawn the vehicle and see if it chats balls again
if so you can just run that script in the init of the vehicle
if not then let me know and i will write a solution
Yeah balls appears about 5 seconds after the vehicle is destroyed, when it respawns, and is destroyed again, it no longer shows
So it only appears upon one respawn?
Yep,
uh, odd.
regardless:
while {true} do {
sleep 5;
switch (true) do {
case (alive rhq): {/*update pos*/};
case (!alive rhq): {/*disable*/};
default {continue};
};
};```
thats going to be riddled with syntax errors and stuff so correct it etc as im on mobile and havent touched arma in 2 weeks
but that should roughly do what you need
wot, just use if?
needs to be disabled if not alive
if alive rhq then { stuff...; continue };
... disable
?
that's exactly what that switch does
oh yeah
while {true} do {
sleep 5;
if (alive rhq) then {/*update pos*/; continue;};
/*disable*/
};``` @fair obsidian
It checks every frame at best case scenario.
And no, a while with sleep or uiSleep will perform just fine (which is the case in your code)
{
//moves base marker in the editor to position of vehicle every 5 seconds
"respawn_east" setmarkerpos getpos rhq;
sleep 5;
if (alive rhq) then {/*update pos*/; continue;};
/*disable*/
};```
Like this? back to square one, respawn at dead vehicle,
keep in mind this is pretty much my first go at putting a script that isnt a two liner haha,
Legend for helping out though, really appreciate it, been trying to get this going for two days now
no what i sent is the entire script
change the /**/ bits to the bits to enable disable respectively etc
You can't do it with findIf anymore. You need count
[W1G1, W1G2, W1G3] findIf {{alive _x} count units _x != 3} == -1
It means all groups have exactly 3 alive members (no more, no less)
For fewer, use >= 3
For more, use <= 3
didn't work, no doubt its me doing something wrong though not you, no errors popping up its just you can still spawn at the destroyed vehicle, ive made sure im still editing the sql for that mission of course
At this stage im ready to pay someone lol, driving me insane,
what would you put in the updatepos part exactly?
setmarkerpos getpos bit
how do I get multiple notifications shown like in the picture here: https://community.bistudio.com/wiki/Arma_3:_Notification , or is it false advertisement? π
The game automatically shows multiple (up to 2) notifications when 2 task states change at once
I'm using BIS_fnc_showNotification, it only shows one (at a time)
Does unitName hideObject true hide the unit in Multiplayer for everybody or just the player/unit which has it in their INIT field?
I want to make a unit completely invisible for Zeus and visible for everyone else.
use hideObjectGlobal for MP
As I said, I want to make a unit completely invisible for Zeus and visible for everyone else. hideObjectGlobal would make it invisible for everybody.
oh sorry, in that case use hideObject in zeus machine
Using an init field doesn't mean it will only be executed on that unit's machine - init fields are executed on all machines
Q: about setVariable public true, that broadcasts one time only, and during JIP?
What does the biki say?
clarifying the and is persistent, that is the JIP part?
i.e. if client were to make local updates post-facto
Pretty sure local updates are not added to the jip queue
that and the variable is broadcast globally is a one time thing
thanks...
why doesn't this remove the corpses instantly? corpseManagerMode = 1; corpseLimit = 2; corpseRemovalMinTime = 100; corpseRemovalMaxTime = 0;
i have only one corpse but cant get the max to work
you have mintime set as 100 so it will wait 100s anyway no?
and I don't think you can do that instantly, there has to be a delay to have the engine process that someone died
yes but shouldn't the max apply and not min?
it will check for min first
well almost instantly
wiki says its the corpseLimit that determines which one is used, min or max
An easy way to prove whether or not the min value is affecting it would be to try it with a lower min value
Alternatively, you can use an entityKilled mission EH to immediately delete corpses, without regard for what the corpse manager wants to do
i tried everything, the min value is the only thing I got working
heyo, im planning to make a persistent mission where there would theoretically be a lot of save data. I am thinking of saving things like so to the profilenamespace and loading/placing the data on server start
[
[
[factionID, "Faction Name", "Cash", [RepresetativesSteamID], [memberSteamID], ["Licenses"]],
[factionID2, "Faction Name2", "Cash", [RepresetativesSteamID], [memberSteamID], ["Licenses"]],
[etc]
],
[
[factionID, HQPosATL, [ [ObjectClass, 3D ATL Cords], [ObjectClass, 3D ATL Cords], [VehicleClass, 3D ATL Cords] ]],
[factionID2, HQPosATL2, [ [ObjectClass, 3D ATL Cords], [ObjectClass, 3D ATL Cords], [VehicleClass, 3D ATL Cords] ]],
[etc]
]
]
There may be a lot of data and more than just the faction stuff shown here, is this a good or even OK idea? am I going about it correctly?
the structure is up to you
but save them in missionProfileNamespace
[ObjectClass, 3D ATL Cords]
you might want to save vectorDir and up as well
didnt think about that, thank you. and thanks, ill save them there instead
how would I get the variable name of an object?
I already have the object, it should/will have a unique variable name assigned to it at some other point, how could I grab that?
https://community.bistudio.com/wiki/vehicleVarName if the variable name was set in editor or with setVehicleVarName. If it was not - i can only think of full search in allVariables missionNamespace (or whatever other namespace you store your variables in) π€·ββοΈ
something like sqf private _all = allVariables missionNamespace; private _id = _all findIf { private _cur = missionNamespace getVariable _x; //_cur isEqualType cursorObject && {_cur isEqualTo cursorObject} _cur isEqualTo cursorObject }; _all select _id 
it should/will have a unique variable name assigned to it
no?
why would you want a variable name if you already have the object?!
because you can have dynamically created objects
@boreal parcel netId and BIS_fnc_netId return unique ID of existing objects
i guess it's linked to
heyo, im planning to make a persistent mission where there would theoretically be a lot of save data. I am thinking of saving things like so to the profilenamespace and loading/placing the data on server start
which also seems to exclude netId(-ish) solutions as they aren't exactly mission-restart-persistent
well, then you have a bigger problem to solve: you have persistent IDs and non-persistent objects. How do you sync them?
so you need to either setVehicleVarName whenever you assign a persistent variable name to a thing, or do some other ugly workaround π€·ββοΈ
i.e. full namespace search. Or setVariable on the object itself.
which is not how you do persistent missions
you only save specific objects which you already have the variable for
and when you read them back from the save you just create them and assign the variable
well, you can serialize objects and restore them
and 99% of times you don't need variables for each one in the first place
they just go in arrays and stuff
I feel we need more information about the mission set up. Is the mission defined in editor? Then you can get IDs of existing objects using netID (or its single-player version). If instead you are creating the scene procedurally (thin objects) then you need to generate unique IDs yourself. There is probably a function for that.
well, when some script has an array of vehicles it goes over - it needs to get serialized for storage as well in a way that links with specific vehicles 
although that needs extra coding anyways and can get by with netId now that i think about it. Nobody cares about new ones, it's enough that old saved ones match.
isEqualTo already has isEqualType integrated into it, no need to do it twice
I havent gotten to setting the variable yet, but I was planning to do it via script likely with setVehicleVarName
each HQ object would have a variable name that includes the unique ID for the faction it is part of, a way of differentiating teams I guess?
plus the HQ objects are going to be able to be dynamically created, kinda like liberations FOB system
the uniqueID is going to be for the individual "factions" players will create and build the base around the HQ with
the only thing getting unique variables is a single HQ per faction
and I would use Nearest Entities or something of the like to grab all objects/structures within a radius of the HQ (filtered by a custom array)
In that case setVariable / getVariable should be enough
ah I was thinking that you needed to provide a string the getVariable, looking at the docs now though am I correct in assuming I can provide the object and it will give me the variable?
such as missionNamespace getVariable _obj
yes, it's _value = _object getVariable ["variable_name", FALLBACK_VALUE]
attempts to retrieve "variable_name" from _object, and if it can't find one, returns FALLBACK_VALUE
oh, I am stupid. I honestly forgot you can set a value to the variable. I was planning to set the variable like "PMC_HQ_UniqueID"
thank you for providing the example otherwise I never would have thought of that
The persistent save system I wrote for my community does just this using near objects. Then I save the classname,location ATL, vector, inventory information. I use inidbi2 which works well enough. Obviously people have done it using profile namespace if you prefer that.
Good luck!
I save information to the object itself using setVariable. Rather than rely on the varName. Up to you of course how to implement, offering an alternative
yep this is what im going to be doing now, hadnt thought of that.
that is exactly what im going to be doing but with profile namespace
another question, is there a way create multiple respawn points that only certain players can respawn on based on their SteamID?
https://community.bistudio.com/wiki/BIS_fnc_addRespawnPosition
Target would be player. Then do your own scripts to check for ID
I'm guessing it works this way, havent tested.
thanks, ill probably report back my solution once finished incase people of the future may need it
Lots of questions here today lol, another one:
My thoughts here are this should check if the first index of every array is equal to the provided faction ID (both strings), and if so it stops looping through after appending a provided int to index 5.
Does this look correct?
Factions apply { if ((_x select 0) isEqualTo _factionID) exitWith { (_x select 4) append _memberID; }; };
looks fine to me. To make it slightly more efficient you could probably use forEach instead. Or even better, convert Factions to a HashMap. Zero access instead of having to loop over the elements.
There arent many good langs
Hashmap is definitely way to go here
LUA is disgusting so
That's a good idea, ill be doing that tomorrow as its getting late though.
better than sqf
I am trying to save missions on the server. I have been using the serverNamespace to save it but I do not like that the serverNamespace is saved in a binary file. Is there a way to
- Save variables on the server (so it can persist through any mission)
- Save variables in a editable, unbinarized text file
- Save the text file on the server only (no
profileNamespacefor example)
if LUA is not nice enough - why not implement, say, a subset of python, javascript or the like? is there something that makes those languages inherently bad for game scripting?
INIDBI2 Lastest Version : 2.06 by Code34 Direct Download from Dropbox Direct Download from Armaholic Github: https://github.com/code34/inidbi2 Steamworkshop: https://steamcommunity.com/sharedfiles/filedetails/?id=1768992669 Like to Donate ? Donate with paypal inidbi2 is a rebuild from scratch of ...
It saves variables to a text file in the mod directory
I did see this. For something that claims to save data without a database, it seems to have a database.
Well, moreso that it doesn't use outside programs, like mariaDB.
I can guarantee you it works, use it myself.
In your experience, how do you write data to the database? Is there a way to output the data, edit it manually, then write the entire data back into iniDBI2?
It's all plain text file. No binarizing unless you turn it on
you want something that is declrative.
I would like an example, yes :)
In my opinion anyway.
It works very similarly to a hashmap. In this case line 1 [base#0] denotes a player base on the map. Then under that i have variables specifying the classname, position, vector directions, inventory, etc. I do this for a bunch of objects
since when is sqf declarative?
Be aware theres an character limit for each variable (I think 4k? dont recall), which is why i split it up this way instead of having one big variable for all my objects
:D ok, my bad
Interesting, thanks for the example. This might be what I am looking for.
a subset of python, javascript or the like?
well @jaunty zephyr ... wasnt there something planned with java where the entire arma community seemed to fight against so fucking hard that you got the feeling they all hate java?
can agree with @nocturne bluff here btw. SQF > LUA
dont know, i wasnt part of the community back then :)
Java is terrible tho.
well
for now, i will continue with OOS
and see where the track leads me (and sooner or later you will also hop onto the boat MUHAAHAHHAHA)
i know
still better then SQF
java syntax is fucking retarded
C# for life, but thats a whole other discussion ;)
java is terrible but sqf is terribler
well, sqf syntax makes sense, not java's
what in java doesn't make sense to you
that everything is centered around nouns, it's just fucking stupid
nouns? i do not rly understand
that's the biggest problem? doesn't exactly seem earth shattering to me
if you want to hate @lone glade then hate it for being 100% data oriented OOP
and that most java programmers tend to make more objects in more complicated ways then every body else
yeah, "let's write something in 100lines that we could do in 10"
hell ... how i hate those 20 different frameworks where i have to write the code that is supposed to be executed in the end of a function at the very begining just because the begining is in a context where you do not want blabla because of fuck you
that's really a problem with the programmers, rather than the language isn't it
yup
although i agree java is overly verbose
kind of tries to be a low and high level language at the same time it's a bit strange
personally my biggest gripes with java are type erasure, checked exceptions and the division of integral and object types
yah, java is a bit over-the-top for the casual scripter
java is ez. just like pretty much every programming lang. is ...
it is heavily OOP thought thus not something for everybody
in the end, there are ton of concepts you have to understand to get really good at java which is where most people fail (me too but mainly because i never had the interest in java that much ... just rly have to use it due to study and back in the days where i played minecraft to mod for it)
but the libraries ... HELL ... i hate them
code organization is the most important shit and if your code looks like a bunch of nonsense then its all worthless
java is just like any other OOP language, if you understand OOP the language doesn't matter
@pliant stream ha ha ... there are things like annotations that wont make it that "simple"
also java uses different kidn of encapsulation
we could continue forever like this
on another subject, someone mentioned about SQF statements being atomic is this true
you better make em atomic
could happen (rare) that your code gets fucked up if you dont
yeah that's what i want to avoid i need either a way to execute a block of code synchronously without being interrupted by the scheduler, or mutexes
ha ha XD
ye
and after that you want that you can code in c++ directly
possible thought but requires thinking in different ways
also can cause lag
if it takes too long
but ... possible
in synchronus space
there's no way to create events in the scheduled environment that fire unscheduled is there
