#arma3_scripting

1 messages Β· Page 46 of 1

tough abyss
#

Well, that's kind of the situation I am in. I don't really participate in A3 communities much, but I play it a lot in my free time. So I don't really have a "supportive community" willing to work on a project.

#

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

fair drum
#

do you code at all outside of SQF?

tough abyss
#

I did C and Python for school, I know a little C#

#

I'm probably going to do IT in college as well

fair drum
#

are you in high school?

tough abyss
#

I graduate this year

fair drum
#

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

tough abyss
#

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

fair drum
#

its not too bad, and its mostly fully documented now

tough abyss
#

i've read the BiWiki but, have a hard time really translating that unlike youtube videos

fair drum
#

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

tough abyss
#

I also see the difference between Modding and Mission Making

#

Do i need knowledge of mission making to make mods? vice versa?

fair drum
#

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

tough abyss
fair drum
#

im going to bed now though. feel free to message me later

little raptor
#

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)

wind hedge
full sleet
#

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?

granite sky
#

Uh, do you have any case where enableSimulation(Global) works on the objects in question at all?

full sleet
#

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.

proven charm
#

how could this line be changed to work in both dedi/SP ? [_obj,_vel] remoteExec ["setvelocity", _obj];

full sleet
hallow mortar
#

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.

proven charm
#

it's run in server

hallow mortar
#

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.

proven charm
#

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];

hallow mortar
#

I take it you've confirmed that _obj and _vel do actually contain the proper values at the time of execution?

proven charm
#

yep since that other line works

hallow mortar
#

I don't see how the one thing implies the other, since neither _obj nor _vel are used in that line

proven charm
#
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

full sleet
#

Isn't there a built-in command for setting an objects velocity already?

hallow mortar
#

Yes, setVelocity, which is being used here

full sleet
#

oic, my bad

hallow mortar
#

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.

proven charm
#

i just like to code like that..

hallow mortar
#

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

proven charm
#

i need the function on couple of places, that's why the function

hallow mortar
hallow mortar
#

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.

proven charm
#

the diag_log in that function shows the variables should be ok SETTING VEL B Alpha 3-2:1 [97.0578,-24.0787,0]

hallow mortar
#

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?

proven charm
#

testing in SP, doesnt work

hallow mortar
#

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

proven charm
#

ok, this should be something simple but the remoteExec part just doesn't seem to work

unreal wind
tender fossil
unreal wind
#

If so, I might want to create a planet or something for fun, how would I do that

hallow mortar
hallow mortar
hallow mortar
proven charm
proven charm
hallow mortar
#

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.

winter rose
hallow mortar
#

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.

proven charm
#

no setdir..

digital hollow
#

it's not attached to something, is it? xD

proven charm
#

nope..

#

it seems adding sleep 2 fixes it

winter rose
#

. . .

proven charm
#

or sleep 0.1 πŸ™‚

proven charm
#

before the function call that is

hallow mortar
#

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

proven charm
#

not in init script πŸ™‚

#

well its in the beginning of the mission but happens throughout the mission... must IFA planes issue

hallow mortar
#

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

granite sky
#

^ this

proven charm
#

because it seems the plane ignores the first call to setVelocity

hallow mortar
#

Yes but if that was a problem with the plane, the sleep wouldn't fix it

granite sky
#

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];
proven charm
#

could it be possible there is IFA script that does setvelocity [0,0,0] ?

granite sky
#

Of course because createVehicle with "FLY" gives them some velocity anyway it might not be obvious when it's not working :P

hallow mortar
proven charm
#

i can but g2g now will be back later. thx for all the help guys πŸ™‚

hallow mortar
#

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.

granite sky
#

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.

proven charm
#

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

granite sky
#

Don't use BIS_fnc_spawnVehicle :P

full sleet
#
_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.
south swan
#

code inside trigger statements doesn't know anything about _testUnit, it's local to wherever it was created

full sleet
#

_testUnit has been created directly prior to the trigger. How do I pass variables to the trigger statements?

hallow mortar
south swan
#

or setVariable it onto something (i.e. the trigger itself) πŸ€·β€β™‚οΈ

full sleet
#

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.

hallow mortar
#

global variable scope isn't the same as global/public variable locality

full sleet
#

I guess I can just put it into the serverNamespace then?

hallow mortar
#

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

full sleet
#

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!

true frigate
#

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 πŸ™‚

hallow mortar
true frigate
somber radish
#

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).
winter rose
#

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)

somber radish
hallow mortar
#

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?

somber radish
#

With the advantage that there is less reading

hallow mortar
#

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.

somber radish
#

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

hallow mortar
#

Yes, and most people don't, which is the problem

fair drum
#

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

torpid mica
#

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?

torpid mica
#

in one of my scripts i want to add Variables to that marker to be able to read them later

open fractal
#

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

torpid mica
#

for now iΒ΄m creating an array that holds all the attributes but it would be way faster using the getVariable

open fractal
#

is it just one marker or multiple values for multiple markers?

torpid mica
#

multiple values for multiple markes which frequently change

open fractal
#
missionNameSpace setVariable [_markerName, _value];
fair drum
open fractal
#

if you have multiple markers with corresponding values I would suggest using a hashmap

torpid mica
fair drum
#

use mission name space

open fractal
#
// create hashmap
MC_MarkerMap = createHashMap;

// create/update entry
MC_MarkerMap set [_markername, _value];

// retrieve value
_value = MC_MarkerMap get [_markername, _defaultValue];
fair drum
#
missionNameSpace setVariable [format ["marker_%1", _markerName], _value];
torpid mica
fair drum
#

squads work because its a group

torpid mica
open fractal
#

setVariable uses a "varspace" which is a namespace, object, or group. A marker is none of those.

#

hence missionNameSpace

fair drum
torpid mica
open fractal
#

you can use an array

torpid mica
open fractal
#
// create/update entry
MC_MarkerMap set [_markername, [_value1, _value2]];
fair drum
#

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

open fractal
#

this does seem like diagnosing a solution rather than the base issue

torpid mica
open fractal
#

I think the hashmap method would be cleanest

torpid mica
open fractal
#

i think you can nest a hashmap in a hashmap if you're feeling devious

#

i like hashmaps :)

torpid mica
#

iΒ΄ve never used hashmaps before so i have to look into that at first

torpid mica
unreal wind
#

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

winter rose
#

sure

sharp fox
#

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

still forum
#

no

true frigate
#

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 πŸ™‚
still forum
#

you need to pass it through, local variables go away

true frigate
#

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

little raptor
# true frigate It seems to still have trouble detecting the items that aren't in the _allowed a...
  1. look at the wiki. getUnitLoadout returns an array of arrays. and yet your _allowed array is an array of strings
  2. if (someCondition == true) is nonsense. just use if (_someCondition) and if (!_someCondition)
  3. you can get the iteration index of forEach using the _forEachIndex var
  4. even if all above were correct, you're using deleteAt which modifies the array, so your forEach will skip the next element
true frigate
#

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?
agile cargo
#

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.

tough abyss
#

How do I get a list of only the AI units in a vehicle?

tough abyss
#

What’s the best practice to filter a list like that?

true frigate
true frigate
#

Lou with the save, as always

agile cargo
true frigate
#

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

winter rose
agile cargo
#

perhaps I should change to a invisible vehicle?

true frigate
true frigate
#

And now for the fun moment when someone comes along and does the same thing I've just done, but in 2 lines

winter rose
true frigate
#

Running in seconds per frame

winter rose
#
private _aiInVehicle = crew theVehicle select { not isPlayer _x };
true frigate
#

And there it is πŸ˜„

true frigate
winter rose
#

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

true frigate
#

Oh, see I'd been told they did the same thing haha. Clearly that's not the case πŸ‘€

#

Good to know πŸ™‚

winter rose
#

not the same no
you cannot private noUnderscoreVar for example

true frigate
#

I'd imagine privating a global variable would serve no purpose anyway. Kind of takes away the "global" part.

winter rose
agile cargo
true frigate
#

Use Lou's instead, I can promise it's higher quality πŸ˜„

meager granite
#

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

true frigate
#

πŸ˜„

sharp grotto
#

Didn't some used the empty can object for such stuff ? thonk

meager granite
#

Leaflet just looks more generic and unassuming

sharp grotto
#

One could also make a new vehicle and change the sim type in the config.

meager granite
#

Yeah, that will be a mod though

#

I need addon-less solutions

meager granite
#

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

agile cargo
#

but the leaflet can have its simulation enabled, it's not an issue

#

it doesn't seem to bounce around

meager granite
#

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

agile cargo
#

classic arma

#

but yeah, it's fine. I just shot it a bunch and threw grenades at it

#

at least in SP

meager granite
#

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

agile cargo
#

I wonder if I can use that on actual playable units to simulate pervitin.

meager granite
agile cargo
#

Yeah, but the issue is that it resets quickly

#

maybe it's some mod resetting it

meager granite
#

It shouldn't reset in vanilla, must be a mod

agile cargo
#

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

meager granite
#

You can add per frame handling to set it to your coef to override mods

meager granite
#

Not sure if its even MP-synced, wiki article says "effect local"

#

Likely safe to each frame it

agile cargo
#

i would need to execute it on each client targeting the guy that took meth

#

each frame

#

else the animations would look weird

meager granite
#

You don't need to broadcast anything each frame, launch a routine everywhere once

sharp grotto
#

You only need it on the client that took the "pervitin"

agile cargo
#

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.

sharp grotto
#

Oof, you're right
"Must be executed on all clients to work properly in MP (otherwise only movement speed is adjusted, not animation itself)"

meager granite
agile cargo
#

like at the moment the guy takes pervitin, start a PFH on each client

#

I suppose

meager granite
#

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
tough abyss
#

How does select work?

tough abyss
meager granite
tough abyss
#

What is the use of the Functions Library ?

proven charm
tough abyss
#

Simple Task vs Task Framework? The BiWiki seems to suggest they are used together, at the same time one is supposed to replace another..

wet hill
#

Hi there is possible to save money from HG Simple Shops script via iniDBI2?

meager granite
#

If you know what you're doing, framework isn't needed or you build your own.

tough abyss
meager granite
#

I don't use it, no idea how good it is

tough abyss
#

Ok. I mean I am new and so I don’t really want to write my own Mp-synchronized task system

tough abyss
meager granite
#

Yes

pulsar bluff
#

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

proven charm
#

it seems setVelocityModelSpace works better than setVelocity on IFA planes. haven't yet seen that one fail when using remoteExec

copper raven
proven charm
#

when ran with IFA planes it didn't always work, but I solved it by adding sleep 0.1 before calling setObjectVelocity

little raptor
#

why do you remoteExec it tho?

proven charm
#

setVelocity needs local argument

little raptor
#

I seem to recall it was global meowsweats

south swan
#

La-Ge

little raptor
proven charm
#

why would it change? i apply the velocity on server where it's created

little raptor
#

blobdoggoshruggoogly it was just a guess

proven charm
#

oh ok

#

from my understanding it shouldn't change because it's not player's plane

little raptor
#

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];
proven charm
#

i will keep that in mind, thx! πŸ™‚

#

though in SP, aren't all vehicles local to player?

little raptor
#

yes

#

it doesn't work in SP?

proven charm
#

well i'm running the mission from eden multiplayer mode

little raptor
#

blobdoggoshruggoogly you should ask @velvet merlin if they do something to their planes and if that's why setVelocity doesn't work

proven charm
#

ok πŸ™‚

meager granite
#

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

velvet merlin
#

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?

proven charm
#

dunno, yesterday nothing seemed to work today everything πŸ˜„

thick wedge
#

is there a way to make a vehicle invisible while still allowing it to move?

thick wedge
thick wedge
#

Now the question is how to hide all the weapons and the rotors on the Kajmn

stable dune
south swan
#

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

winter rose
#

ring ding ding ding ding, ding

thick wedge
#

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.

wet hill
#

Hi, there is possible to save money from HG Simple Shops script by iniDBI2?

copper raven
#

or just look into the source code, and see what it does

proven charm
#

how do you decide the group side when using createVehicle & createVehicleCrew ?

little raptor
proven charm
hallow mortar
#

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.

little raptor
#

the game takes the side and crew from the config

south swan
#

createVehicleCrew returns the group, you can joinSilent units afterwards πŸ€·β€β™‚οΈ

little raptor
#

no. just don't change the group's side

#

create the crew manually

#

then move them into the vehicle

proven charm
#

ok

south swan
#

well, that's not exactly trivial with FFV, diving config for dontCreateAI and all the shenanigans

little raptor
#

changing the side has its own problems too

granite sky
#

Rating triggers off the original side at least sometimes, so you want to disable that.

copper raven
#

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 using createVehicleCrew to finalize it

proven charm
#

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; ?

south swan
#

most likely what sharp sent. "If there is somebody inside the vehicle already - join newly created crew to their group"

granite sky
#

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.

south swan
#

so what? Some monstrosity using multiple fullCrew calls or manual config diving?

granite sky
#

We do the manual config diving but it's very error-prone.

south swan
#

or createVehicleCrew and then manually move remove vanilla crew and replace with manually spawned crewmen of proper side? :3

granite sky
#

Sounds worse :P

#

maybe driver + createVehicleCrew is smart enough to handle the groups correctly though. Haven't tried it.

proven charm
#

i'm already using joinSilent to make like res switch to west so why not...

granite sky
#

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.

proven charm
wanton tundra
#

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?

proven charm
#

i guess the "this" variable is not defined/invalid in trigger act field

granite sky
proven charm
#

thisTrigger for position

wanton tundra
#

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 πŸ™‚

mild pumice
#

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...

little raptor
#

it should be more reliable than checking many objects in longer periods

little raptor
#

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

little raptor
#

yes. it will be the same as Reforger. that's the whole point of Reforger. "Road to Arma 4"

distant oyster
#

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?
sharp fox
#

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.

distant oyster
#

ah of course. i'm getting rusty

#

thanks

sharp fox
#

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.

olive aspen
#

Hey, sorry I know this is the wrong chat but I think I've got an error in my aircraft config

#

Can someone help?

sharp grotto
olive aspen
#

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

pulsar bluff
#

the whole point of reforger is to outsource playable content development to modders

#

probably a wise move

tough abyss
#

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?

jaunty zephyr
#

does anyone know why they created yet another homemade script language instead of implementing for example a subset of a more common language?

white coral
#

@candid narwhal

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

warm hedge
#

Is this your script?

candid narwhal
#

The snipped yes, the Radio.sqf no

warm hedge
#

Top is yours you mean?

candid narwhal
#

yeah

warm hedge
#

Okay, what is RADIO and CHANNELS?

candid narwhal
#

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

warm hedge
#
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?
candid narwhal
warm hedge
#

I'm barely seeing the reason why you say β€œonly the first iteration does so”

candid narwhal
warm hedge
#

Okay I think I get the situation

candid narwhal
#

the problem is that this:

if isServer then{
        { _y = _x;
        {[_y,true,[],_x] call RADIO}forEach CHANNEL_COLOR
    }forEach CHANNELS
};

Only makes one colour

warm hedge
#

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
candid narwhal
#

is it making the same channel over and over again?
When launching it created my five channels but only gives them 1 color

warm hedge
#

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...

candid narwhal
warm hedge
#

It is because you used a forEach in a forEach, for such purpose one forEach is enough

candid narwhal
warm hedge
#

Obviously you can always learn from a mistace

#

As long as you want to learn, it is not really a mistake

tough abyss
candid narwhal
# warm hedge ```sqf { _x params ["_name","_color"]; [_name,true,[],_color] call RADIO...

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

warm hedge
#

Because you tried to pass forEach code into if statement

#
if (isServer) then {
  {} forEach;
};```
candid narwhal
#

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

candid narwhal
candid narwhal
edgy dune
#

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 ?

hallow mortar
#

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.

little raptor
little raptor
edgy dune
#

Ah okay so since I only really care about units, I can just use EntityKilled

little raptor
#

Yes

edgy dune
little raptor
#

Yeah

edgy dune
#

Cool thx

dusky pier
#

Hello, is any ways to prevent ctrlCreate command on display?

little raptor
#

no. why would you want to tho?

hasty gate
#

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

granite sky
#

SP, localhost or DS+client?

#

oh, player entering the AA vehicle? Never mind.

frozen seal
#

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

south swan
#

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

winter rose
south swan
#

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.

hasty gate
hasty gate
south swan
#

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

hasty gate
south swan
#

blue vs red

#

let me retest with the same faction then

south swan
#

B_Heli_Light_01_F in blue/blue gets detected at roughly 5 seconds πŸ€·β€β™‚οΈ

little raptor
#

if your trigger area is circular you can use nearestObjects

#

if not use a combination of nearestObjects and inArea

south swan
#

and/or inAreaArray because why not

hasty gate
frozen seal
# little raptor if your trigger area is circular you can use nearestObjects

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;`
little raptor
frozen seal
little raptor
#

MLRS?

frozen seal
#

grad, himars etc

little raptor
#

yeah it should

#

basically anything that explodes

frozen seal
#

hmm yeah that might work too, thx

little raptor
#

different MLRSs spread
you can also visualize the projectile paths

frozen seal
#

does anyone know if this is the right way to fetch nearest markers? _exp nearObjects ["Marker", 10]

little raptor
south swan
#

#badideas "just detect big craters and slap markers on them periodically"

little raptor
# frozen seal Yep that's what I did ``` while {true} do { { _exp = _x; ...
_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

frozen seal
little raptor
#

that's for local variables. setVariable and getVariable don't create local vars

frozen seal
#

getVariable ["marker" vs _marker = createMarker

#

both marker and _marker reference the same variable in this case right?

little raptor
#

no

#

_marker is a local var. marker is a variable that is set on the object

south swan
#

well, player serVariable ["_kek", "kek"] worked for me, πŸ€·β€β™‚οΈ

frozen seal
#

I'm blind, you also have SetVariable

#

I get it now

little raptor
south swan
#

sorry then, misread on me

little raptor
#

you can even put spaces and other invalid chars. e.g player setVariable ["Β―\_(ツ)_/Β―", "kek"]

frozen seal
#

so we assign a variable to the explosion and the next time we run our check we check for the var, clever

south swan
#

inb4 emoji-keyed hashmap notlikemeow

frozen seal
#

thank you Leopard πŸ™‚

#

sleep 0.001;
is this the correct way to skip 1 frame or is there something more clean?

hasty gate
# south swan `B_Heli_Light_01_F` in blue/blue gets detected at roughly 5 seconds πŸ€·β€β™‚οΈ

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; });

little raptor
#

but if you don't have many scripts running it will

#

you can use an eachFrame event handler

little raptor
# little raptor ```sqf _markerIDx = 0; while {true} do { { _exp = _x; _sho...
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

meager granite
south swan
meager granite
south swan
#

seems to reproduce on RC as well. Maybe really affected by that ticket

hasty gate
south swan
#

just player getting into gunner or commander position and ejecting right away seems to detect the heli. Forcing engine on doesn't.

south swan
#

anyway, fixed/changed in dev, i don't see any reason to dig further

hasty gate
south swan
#

no idea. Another half a year if the gap between 2.10 and 2.12 is an example to follow

south swan
#

also, blue-on-red seems to work at 5+km on RC, so two reasons to not dig further :3

tough abyss
proven charm
#

Nothing

#
testVar = 777; 
hint str (missionnamespace getVariable "testVar");
#

honestly I dunno why use missionnameSpace Setvariable

#

to send variable over net?

hallow mortar
#

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 publicVariable can 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

proven charm
wanton tundra
#

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?

pulsar bluff
#

like network owner or group?

eager prawn
#

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.

warm hedge
#

HandleDamage Eventhandler can do it

hallow mortar
meager granite
#

Wish append returned left array instead of Nothing notlikemeow

pulsar bluff
#

indeed

#

have tripped over that a few times

meager granite
#

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
pulsar bluff
#

i mean i guess + works in that case

meager granite
#
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
meager granite
queen cargo
#

@jaunty zephyr because its not that hard to create one

jaunty zephyr
#

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

queen cargo
#

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

jaunty zephyr
#

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

wanton tundra
wanton tundra
jaunty zephyr
#

still - smells heavily of not-invented-here syndrome

wanton tundra
#

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.

pulsar bluff
#

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

hallow mortar
meager granite
#

Wondering what would be the absolute quickest way to find out if position is visible on the map control or not? Any ideas?

formal stirrup
#

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;";
            };
        };
    };
meager granite
formal stirrup
#

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

meager granite
#

You pasted your code twice first time and there is extra ; in the middle of it

#

call CBA_fnc_globalSay3d;, 500

formal stirrup
#

ah

#

Thanks

meager granite
#

So all good

formal stirrup
meager granite
#

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

manic sigil
#

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.

hallow mortar
#

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

manic sigil
#

'The end' being the bottom of the do {...} code, where it would jump back to the top.

hallow mortar
#

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.
manic sigil
#

Dang, that's what I was afraid of :/

#

Alright... think I can wrangle something together and still avoid making a trigger.

wanton tundra
#

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?

manic sigil
#

"_dynamicairport1"?

hallow mortar
#

params can only create local variables. You're trying to do a global dynamicairport1

wanton tundra
#

ah ok...

#

let me try that

meager granite
granite sky
#

So don't check whether each point is in the draw area, but whether it could be. Leave the detail clipping to the engine.

meager granite
granite sky
#

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.

wanton tundra
#

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

granite sky
#

No, they're different variables so you need the latter.

wanton tundra
#

understood thank you

granite sky
#

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.

hollow plaza
#

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.
sweet trellis
#

Hi guys, got a question here. Is it possible to change Blackfish interior?

agile cargo
hallow mortar
meager granite
hollow plaza
hallow mortar
limber aurora
#

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!

limber aurora
hasty gate
#

is there something like function aimedAtTarget which works for a position instead of target unit/obj?

proven charm
hasty gate
hallow mortar
proven charm
#

AI or Player?

hasty gate
hasty gate
proven charm
#

guessing here.. targetKnowledge?

hasty gate
#

I think no, it only accepts obj as arg

hollow plaza
limber aurora
#

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.

proven charm
sweet trellis
little raptor
#

you might be able to create new objects and attach them at the correct spot

#

other than that no

sweet trellis
#

thx, i tried it from 6-99. 0 worksLUL

limber aurora
limber aurora
unreal wind
#

Isnt there only opfor, blufor, independent and civilian teams?

limber aurora
#

This method blatantly ignores side limitation.

#

In my mission, (AI battle royale with 4-man teams), all units are Civilians

unreal wind
#

Battle royale in arma

#

Yes please

wraith umbra
#

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)"];}]

wraith umbra
little raptor
#

I mean where do you execute it

#

init, etc.

wraith umbra
#

It is in an Init

little raptor
#

you mean object init?

wraith umbra
#

Yes

little raptor
#

then why do you use player?

wraith umbra
#

What should I be using instead?

little raptor
#

is that supposed to add the action to the player?

wraith umbra
#

It is supposed to add a scroll wheel action to players

little raptor
#

then put it in initPlayerLocal.sqf

wraith umbra
#

How would I do that?

little raptor
#

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)"];
}]
wraith umbra
#

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.

little raptor
wraith umbra
#

I removed the old one, yes

little raptor
#

try the edited one

wraith umbra
#

My problem is that the action doesn't even appear in the scroll wheel menu.

little raptor
#

then you've not set up the file correctly

#

did you enable file extensions in explorer?

wraith umbra
#

Wait, yes I did

#

The script works perfectly fine on my machine, just not on the server even with the initPlayerLocal.sqf file

little raptor
#

what about with the new edited one?

wraith umbra
#

Same

sterile arch
#

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

little raptor
wraith umbra
little raptor
#

I don't see any reason why they shouldn't

wraith umbra
#

My only guess is the player part of the script.

little raptor
#

test the new version

#

do you see the message "running"?

#

if not you're doing something wrong

little raptor
wraith umbra
#

Oh, I didn't notice that you edited the script.

wraith umbra
#

@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.

little raptor
#

what kind of respawn system do you use?

wraith umbra
#

Just a regular respawn, nothing special.

#

10 second delay and players can select where they respawn.

little raptor
past wagon
#

does "object" in sqf scripting have the same meaning as in object oriented programming?

#

or does it just mean physical game object?

wraith umbra
little raptor
#

technically it's an OOP object under the hood

#

but no

sterile arch
little raptor
wraith umbra
#

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.

little raptor
wraith umbra
#

Alright. If I remember you tomorrow, I'll ping you and tell you the result after I test it tomorrow.

little raptor
wraith umbra
#

Alright

#

Hopefully I can get this script to work before Friday.

little raptor
# wraith umbra Hopefully I can get this script to work before Friday.

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)

wraith umbra
#

What would that do?

little raptor
#

constantly checks if the action is added to the current player. if not, adds it

wraith umbra
#

Alright, I'll try it tomorrow.

little raptor
#

don't try that one just yet

#

like I said it's a last resort

wraith umbra
#

Alright.

limber aurora
# little raptor if all fails you can just resort to this: ```sqf [] spawn { while {true} do { ...

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;
  };
}
little raptor
#

!(isNil "undefinedVariable");
just put a false at the end... meowsweats

limber aurora
#

@little raptor oh! Edited now, thanks!

tight nova
#

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.

slow isle
#

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;
}
south swan
hallow mortar
#

You should probably add a sleep in there somewhere, otherwise this loop will run multiple times per frame and tie up the scheduler

slow isle
tight nova
#

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.

slow isle
#

it was at the end of the while loop\

hallow mortar
#

Use spawn to create the loop in a scheduled thread where you can use suspension.

slow isle
#

@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.

little raptor
#

essentially undoing everything

south swan
#

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; }; };

slow isle
little raptor
#

I know what you want to do. I just meant the execution is wrong

little raptor
slow isle
little raptor
#

see artemoz's code

slow isle
#

Thank you @south swan !

#

I'll look into it now

little raptor
#

if there are many of them

south swan
#
        { 
          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

little raptor
#

no inAreaArray would make things worse in some cases

south swan
#

huh

#

although it seems to only work on known targets notlikemeow

wraith umbra
#

Ayy, managed to get my script working on the dedicated server

shut reef
#

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.

meager granite
limber aurora
meager granite
#

I see what it does

#

Why setUnitRank instead of addRating?

limber aurora
#

I've seen the calculation before, but this method does the job. It -sets- instead of -adds-

meager granite
#

Its just _unit addRaing -rating _unit

#

Thought setUnitRank had other effects I didn't know of

#

Anyway thanks for sharing

limber aurora
#

Looks way simpler than the other thing I read

meager granite
#

Or just _unit addRating 1e6 and you never have to worry about it

limber aurora
#

More stuff I've never heard of πŸ˜…

brazen smelt
#

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.

limber aurora
#

Does Zeus heal cause the unit being healed to do the healing animation?

brazen smelt
#

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?

limber aurora
#
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;
    };
};
brazen smelt
limber aurora
#

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

brazen smelt
#

Yeah I'm trying to think of how to do it without turning this into a giant block of code

#

xD

limber aurora
#

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;
            };
    };
}];
golden cargo
limber aurora
#

Oh

brazen smelt
#

That was my thought since it uses its own system for damage.

golden cargo
#

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

brazen smelt
#

I thought about making a fnc to do it

golden cargo
brazen smelt
#

Sometimes the best way is the simplest way.

#

Basic or not xD

ocean folio
#

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

sharp fox
#

I think the easier question would be: what data types are NOT passed by reference

warm hedge
#

getVariable only passes a value, not a ref. = does

sterile arch
#

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

pulsar bluff
#

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
fair obsidian
#

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;
            };```
warm hedge
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
↓

// your code here
hint "good!";
warm hedge
#

Guess you can try deleteMarker after the while so it will remove the marker after it is gone

fair obsidian
#

Nope, not quite, any other suggestions?

warm hedge
#

How'd you do that?

fair obsidian
#
        {
        //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 ![thonk](https://cdn.discordapp.com/emojis/700311400152825906.webp?size=128 "thonk") you could say sql is like a foreign language to me...
warm hedge
#

I said after not before

fair obsidian
#

Sorry mate i dont understand exactly where it needs to go, ive never really done this before, how would i do that?

warm hedge
#
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

fair obsidian
#

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

sullen sigil
#

variable of the newly spawned vehicle needs to be rhq

fair obsidian
#

Yeah that is,

sullen sigil
#

...though i thought they kept variable names through respawn

fair obsidian
#

unless when it respawns, it deletes the variable?

#

yeah, im using the ingame vehicle respawner

sullen sigil
#

axtually did you try remove the deletemarker

fair obsidian
#

as in remove from the script or another that brings it back like createMarker?

sullen sigil
#

remove it from the script

fair obsidian
#

it then goes back to allowing to respawn at dead vehicle

sullen sigil
#

what about when its respawned

fair obsidian
#

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

sullen sigil
#

where are you running the script btw

fair obsidian
#

in the mission folder within mpmissions, as a .sqf thats started from initserver.sqf

sullen sigil
#

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

fair obsidian
#

Yeah balls appears about 5 seconds after the vehicle is destroyed, when it respawns, and is destroyed again, it no longer shows

sullen sigil
fair obsidian
#

Yep,

sullen sigil
#

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

sullen sigil
copper raven
#
if alive rhq then { stuff...; continue };
... disable

?

#

that's exactly what that switch does

sullen sigil
#

oh yeah

#
while {true} do {
sleep 5;
if (alive rhq) then {/*update pos*/; continue;};
/*disable*/
};``` @fair obsidian
little raptor
fair obsidian
# sullen sigil ```sqf while {true} do { sleep 5; if (alive rhq) then {/*update pos*/; continue;...
{
    //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
sullen sigil
#

no what i sent is the entire script

#

change the /**/ bits to the bits to enable disable respectively etc

little raptor
#
[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

fair obsidian
# sullen sigil no what i sent is the entire script

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?

sullen sigil
#

setmarkerpos getpos bit

proven charm
little raptor
proven charm
slow isle
#

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.

proven charm
slow isle
proven charm
hallow mortar
#

Using an init field doesn't mean it will only be executed on that unit's machine - init fields are executed on all machines

dreamy kestrel
#

Q: about setVariable public true, that broadcasts one time only, and during JIP?

dreamy kestrel
#

clarifying the and is persistent, that is the JIP part?
i.e. if client were to make local updates post-facto

cosmic lichen
#

Pretty sure local updates are not added to the jip queue

dreamy kestrel
#

thanks...

proven charm
#

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

jade acorn
#

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

proven charm
#

yes but shouldn't the max apply and not min?

jade acorn
#

it will check for min first

proven charm
#

well almost instantly

#

wiki says its the corpseLimit that determines which one is used, min or max

hallow mortar
#

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

proven charm
boreal parcel
#

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?

little raptor
#

[ObjectClass, 3D ATL Cords]
you might want to save vectorDir and up as well

boreal parcel
boreal parcel
#

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?

south swan
#

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 notlikemeow

winter rose
little raptor
sharp fox
#

because you can have dynamically created objects

#

@boreal parcel netId and BIS_fnc_netId return unique ID of existing objects

little raptor
#

wat?

#

ever heard of arrays?!

#

or other containers?

south swan
#

which also seems to exclude netId(-ish) solutions as they aren't exactly mission-restart-persistent

sharp fox
#

well, then you have a bigger problem to solve: you have persistent IDs and non-persistent objects. How do you sync them?

south swan
#

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.

little raptor
#

and when you read them back from the save you just create them and assign the variable

sharp fox
#

well, you can serialize objects and restore them

little raptor
#

and 99% of times you don't need variables for each one in the first place

#

they just go in arrays and stuff

sharp fox
#

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.

south swan
#

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 meowsweats

#

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.

still forum
boreal parcel
boreal parcel
#

plus the HQ objects are going to be able to be dynamically created, kinda like liberations FOB system

boreal parcel
boreal parcel
#

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)

sharp fox
boreal parcel
#

such as missionNamespace getVariable _obj

sharp fox
#

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

boreal parcel
#

thank you for providing the example otherwise I never would have thought of that

manic kettle
manic kettle
boreal parcel
boreal parcel
boreal parcel
#

another question, is there a way create multiple respawn points that only certain players can respawn on based on their SteamID?

manic kettle
#

I'm guessing it works this way, havent tested.

boreal parcel
#

thanks, ill probably report back my solution once finished incase people of the future may need it

boreal parcel
#

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; }; };
sharp fox
#

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.

nocturne bluff
#

There arent many good langs

manic kettle
#

Hashmap is definitely way to go here

nocturne bluff
#

LUA is disgusting so

boreal parcel
#

That's a good idea, ill be doing that tomorrow as its getting late though.

pliant stream
#

better than sqf

cold mica
#

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

  1. Save variables on the server (so it can persist through any mission)
  2. Save variables in a editable, unbinarized text file
  3. Save the text file on the server only (no profileNamespace for example)
jaunty zephyr
#

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?

nocturne bluff
#

I'd atucally rather do SQF then lua

#

;P

manic kettle
# cold mica I am trying to save missions on the server. I have been using the `serverNamespa...
#

It saves variables to a text file in the mod directory

cold mica
#

I did see this. For something that claims to save data without a database, it seems to have a database.

manic kettle
#

Well, moreso that it doesn't use outside programs, like mariaDB.

#

I can guarantee you it works, use it myself.

cold mica
#

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?

manic kettle
#

It's all plain text file. No binarizing unless you turn it on

nocturne bluff
#

you want something that is declrative.

manic kettle
#

There's a command to write to the file and load the file.

#

Want an example?

cold mica
#

I would like an example, yes :)

nocturne bluff
#

In my opinion anyway.

manic kettle
#

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

jaunty zephyr
#

since when is sqf declarative?

manic kettle
#

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

nocturne bluff
#

Did i say it was?

#

No

#

I said i'd rather work in SQF then LUA.

jaunty zephyr
#

:D ok, my bad

cold mica
#

Interesting, thanks for the example. This might be what I am looking for.

queen cargo
#

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

jaunty zephyr
#

dont know, i wasnt part of the community back then :)

nocturne bluff
#

Java is terrible tho.

queen cargo
#

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

lone glade
#

java syntax is fucking retarded

nocturne bluff
#

C# for life, but thats a whole other discussion ;)

pliant stream
#

java is terrible but sqf is terribler

lone glade
#

well, sqf syntax makes sense, not java's

pliant stream
#

what in java doesn't make sense to you

lone glade
#

that everything is centered around nouns, it's just fucking stupid

queen cargo
#

nouns? i do not rly understand

pliant stream
#

that's the biggest problem? doesn't exactly seem earth shattering to me

queen cargo
#

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

lone glade
#

yeah, "let's write something in 100lines that we could do in 10"

queen cargo
#

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

pliant stream
#

that's really a problem with the programmers, rather than the language isn't it

queen cargo
#

yup

pliant stream
#

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

jaunty zephyr
#

yah, java is a bit over-the-top for the casual scripter

queen cargo
#

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

pliant stream
#

java is just like any other OOP language, if you understand OOP the language doesn't matter

queen cargo
#

@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

pliant stream
#

on another subject, someone mentioned about SQF statements being atomic is this true

queen cargo
#

you better make em atomic

#

could happen (rare) that your code gets fucked up if you dont

pliant stream
#

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

queen cargo
#

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

pliant stream
#

there's no way to create events in the scheduled environment that fire unscheduled is there

queen cargo
#

draw3D just as lil example

#

check an array in there