#arma3_scripting

1 messages ยท Page 642 of 1

cerulean cloak
#

Also, is there anyway to loop a sound effect with playsound3d?

little raptor
#

it requires modding tho. so you can't use it in missions

cerulean cloak
#

Ah well, guess that's not happening

little raptor
#

but I recommend say3D instead of playSound3D because you can stop it by killing the source of the sound

cerulean cloak
#

Didn't actually think about that. I'll change over then.

little raptor
#

but remember that it requires a class defined in CfgSounds. It doesn't accept file paths. (this one doesn't need modding tho)

#

also, remember that a while loop without sleep keeps executing in the same frame multiple times (until it uses up all of its allowed execution time in the scheduler, which is 3ms). whenever you use time-variable while loops, make sure you add some delay to it (at least sleep 0.001)
you can also consider switching to waitUntil, which has a delay baked in. the difference is that the condition comes at the end:

while {condition} do {
  ...;
  sleep 0.001;
};
//the above loop is pretty much the same as:
waitUntil {
  ....;
  !condition;
};

but to be more precise, the above waitUntil is actually the exact equivalent of this:

while {
  ...;  
  condition;
} do {
  sleep 0.001;
};
waxen tendon
#
class CfgFunctions {
    class spawn {
        tag = "spawn";
        file = "fnc\spawn";

        class planes {
            file = "fnc\spawn\fn_planes.sqf";
        }
    }
}```
i call this as spawn\_fnc\_planes, does not work, how to fix?
little raptor
#

example:

class CfgFunctions {
    class spawn {
        tag = "spawn";
        class someCategory {
          file = "fnc\spawn";
          class planes {};
        };
     };
 };
waxen tendon
#

is it always that fixed number of path

#

or can i nest categories

little raptor
#

no you can't nest them inside the someCategory

#

that's where the functions go

waxen tendon
#

so all functions have a fixed number of parents

#

thats not very nice

#

@little raptor thanks!

little raptor
#

np

craggy lagoon
#

@little raptor I not able to make this work and I know it's because I don't know what I'm doing. All I'm essentially trying to do is create a Mortarman role. Just that person is able to shoot mortars no one else. I was going to a mix things up a bit with triggers but at this point if I could just limit mortar usage to that person I would be happy.

copper raven
#

Use getin event handler

#

And kick the player out if he's not allowed to use it

craggy lagoon
#

That's what Leopard20 said to do.

#

this addEventHandler ["GetIn", {
params ["_vehicle", "_role", "_unit", "_turret"];
moveOut _unit;
}];

#

but I can't figure out how to say what player can use it.

copper raven
#

well that's not it, that will never let anyone in

little raptor
little raptor
#

to get you started to make your own script

craggy lagoon
#

Sorry, scripting is not something that comes easy for me!!

#

With that you say to add the the init of the item what if the item isn't placed on the map. I just want it applied to all "B_T_Mortar_01_F".

little raptor
#

do you use CBA?

craggy lagoon
#

Yes

little raptor
#

@craggy lagoon

["B_T_Mortar_01_F", "GetIn", {
    params ["", "", "_unit", ""];
    if !(_unit getVariable ["IsMortarMan", false]) then {
      moveOut _unit;
    };
}] call CBA_fnc_addClassEventHandler;
craggy lagoon
#

Thank you so much for this, I will try to reverse engineer it and learn something.

#

It's late and I just realized I didn't ask where that bit of code goes. Should it be put in the init.sqf file?

little raptor
copper raven
#

initPlayerLocal.sqf would be the best

craggy lagoon
#

I will give it a shot. Thanks!!

#

@little raptor @copper raven Thank you both very much it's working, I can now go get some sleep!!!

languid oyster
#

I am trying to do a rescue function for incapacitated units in water. The AI medic is to drag the incapacitated unit to the shore, then drag him a few meter out of the water. To test it, I set up a scenario in the editor. 3 inf units, one of which is the player. The other two units stand close to one another. I point the cursor to one of the two units, then local execute this:

Swim_it = {
    params [["_medic", objNull], ["_victim", objNull]];
    diag_log formatText ["%1%2%3%4%5%6", time, "s  _medic: ", _medic, ", _victim: ", _victim];
    if (isNil "_medic" || isNil "_victim") exitWith {};

    _pos  = _medic modelToWorld [0, 1, 0];
    _victim setPos _pos;
    _victim setDir 180;
    _victim switchMove "AinjPpneMrunSnonWnonDb";     
    // _victim attachTo [_medic, [0, 1, 1.2]];

    while {player distance _medic > 10} do {
        _medic playMove "AswmPercMwlkSnonWnonDb";
        _azimuth = player getDir _medic;
        _medic setDir _azimuth;
        sleep 1;
    };

    while {player distance _medic > 5} do {
        _medic playMoveNow "AcinPknlMwlkSnonWnonDb"; 
        _azimuth = player getDir _medic;
        _medic setDir _azimuth;
        _pos  = _medic modelToWorld [0, -1, 0];
        sleep 1;
    };
    _medic switchMove ""; 
};
[cursorObject, (cursorObject nearEntities ["CAManBase", 10]) select 1] spawn Swim_it;

It works as intended. The unit homes in to me, switching the animations correctly, and moving correctly.
But when enabling the commented out attachTo row, the unit will still play animations correctly, but it will no longer move, once shifted from first to second animation. I tried all kinds of detach, reattach, switchmove, forcemove things, none of which worked. What am I doing wrong?

worthy temple
#

disregard last message. Turns out I should record the car rather than the driver's movement

fair drum
#

say i create 10 cars, how would I go about assigning them unique variables using the least amount of code?

little raptor
little raptor
#

and what kind of variables?

austere hawk
#

there is nothing to stop me from having a function call itself, right?

little raptor
#

no

#

unless it would loop forever

austere hawk
#

it only runs once

little raptor
#

So I assume you mean you have provided some condition in it to stop it from looping, right?

austere hawk
#

yeah, it calls itself with different parameter, that cause it to execute other branch

hollow lantern
#

I tried it with setWindDir even via debug console but there was no change in direction. I did a setWind [89.043, 10, true]; however once applied the chopper does not really land (wind seems to strong). unless I move him via ZEUS over the helipad. Weird

little raptor
#

got it. invalid path

fair drum
crude vigil
#

Without seeing use case, it is hard to understand what optimal solution you seek Im afraid

fair drum
#

yeah im just in theory mode right now. I'll probably have something when I get to it during the mission creation

languid oyster
#

@little raptor ๐Ÿ˜ฒ it works.

#

So next time some unit does not move, I will disable it's movement and - BANG - problem solved

little raptor
finite sail
#

hmmmm

languid oyster
#

@little raptor You might not have said it, but logic says..... oh, I'll no longer talk

still forum
#

Due to what inconsider a but, = will copy.
But you can circumvent that by using missionNamespace setVariable. That will do by reference and not cause a copy

little raptor
#

store them in an array

#
switch (_something) do {
  case _something1: _fnc1;
  case _something2: _fnc2;
  case _something3: _fnc3;
};

is the same as:

_fncs = [
_fnc1,
_fnc2,
_fnc3
];
_somethings = [_something1, _something2, _something3];
call (_fncs select (_somethings find _something))
#

if you store both arrays only once, it can be several times faster than the switch

#

in fact, if you expect _somethings to be all numbers, you could choose those numbers such that they would correspond to array indices. (so you can simply use: call (_fncs select _something)). this makes it even faster.

finite sail
#

guys.. perhaps more a mission design question... AI helos landing on rooftops.. a recipe for disaster and frustration? technically, it's a case of finding a buildingpos on a roof, putting a invisi helipad there nad giving the heli a land wp?

oblique arrow
#

sounds like something that should be 'pre-recorded' rather than being left to the AI to do I'd say

finite sail
#

yeah, I dont know if I can do unitcapture because the building is dynamically chosen

oblique arrow
#

Hmm

#

make multiple unitcaptures and play the right one depending on building type?

finite sail
#

might be the gjost hotel, might be the altis airport terminal, might be a barracks, might be office building in georgetown

oblique arrow
#

But ye leaving it to the AI sounds like a recipe for disaster

finite sail
#

it does rather, doesnt it lol

oblique arrow
#

Yeah heh

finite sail
#

ok, well testing the AI landing will only take a few minutes to code up, lets try that first

#

if i come back grumpy, you'll know it didnt work

oblique arrow
#

heh good luck

finite sail
#

hehe

#

thx

craggy lagoon
#

I'm now able to lock down my mortars to where just my mortarmen are able to use them but now the next issue has shown up. When the players pull the tripod and tube bags from the arsenal and then assemble them, they have full ammo. How could this be set zero ammo so they are forced to bring and load ammo?

craggy lagoon
#

Will that just delete the ammo again if the tube is rebuilt? Or would it just be done the first time it's assembled?

little raptor
#

you attach it to the unit

#

so every time a unit assembles a static weapon, its ammo and magazines will be removed

craggy lagoon
#

Ok, thanks let me see what I can do.

craggy lagoon
# little raptor https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#WeaponAssembled

Can you tell me if I'm on the right track? I was able to put the removeMagazine command in the init of the weapon and it did pull out the ammo. Just can't get it to go when I assemble the weapon.
player addEventHandler ["WeaponAssembled", {
this removeMagazine "NDS_M_6Rnd_60mm_HE";
this removeMagazine "NDS_M_6Rnd_60mm_HE";
this removeMagazine "NDS_M_6Rnd_60mm_HE_0";
this removeMagazine "NDS_M_6Rnd_60mm_HE_0";
this removeMagazine "NDS_M_6Rnd_60mm_ILLUM";
this removeMagazine "NDS_M_6Rnd_60mm_SMOKE";
this removeMagazine "NDS_M_6Rnd_60mm_SMOKE";
}];

wet copper
#

@hollow lantern Setting the Headwind / Hoping Helos land into the headwind (without scripts):

"This is not an exact science though . . . "

This only affects a general headwind at the start of the mission (further 'Forecast' manipulations of the Wind Attribute may change the direction for later in the mission) and not for any individual helipads throughout the mission, for that, you need scripts . . .

1st thing (and this stumped me for quite awhile) : if you are using ACE, the 1st thing is to go into Eden Editor Settings > Addon Options > ACE Weather > and untick the 'Wind Simulation (map based). This 'enabled' appears to override any Environment Attributes wind settings (it is using the 'map's wind', which may be good for variable changing winds for sniper missions, ect).

Now you can go back into your Environment Attributes > Wind and setup the direction you need for your headwind (you do need some amount of wind for the helo to realize the headwind's direction. Setting Zero wind may let the helo land according to its approach vector, but it isn't guaranteed . . . test, test, test).

[ My first 'help answer' to The Community . . . ]

winter rose
supple cove
#

Will setDamage on structures sync across the server?

winter rose
supple cove
#

Oh, this explains a lot actually

winter rose
#

you can remoteExec it ๐Ÿ™‚

#

(I think?)

#

yeah no, sorry

supple cove
#

Yea... but there is a problem with people joining after

#

My bet is to make a list of structures modified and sync them manually

winter rose
#

what I did is an initPlayerLocal.sqf that damaged objects by their position yes

#

but yeah I recently did a test with a friend, I made a building invincible but only on my side (server)
he did bomb it, and I could walk around like a ghost in a destroyed building to him ๐Ÿ˜

supple cove
#

๐Ÿ˜‚ Here we were repairing destroyed buildings, but people who joined after would'nt see neither de wrecks nor anything, just ghosts doing ghost stuff

#

Funny enough, small objects are not local to the player

#

the server does make an effort to sync them

hollow lantern
wet copper
#

@hollow lantern
No, the helo 'reads' the headwind at the time of landing . . . reread my prior answer, I've edited it.
For testing, I put down a windsock for 'visually' seeing the wind direction and if the sock isn't fluttering, then I don't have enough wind set in the editor . . .

hollow lantern
#

ah

dusk badger
#

Does anyone has a unit init script were when dead this unit will spawn after some time on that position?

fair drum
#

can I turn placed civilian units in editor into agents?

#

or should I just turn off most of their AI

little raptor
#

Agents are more performance friendly than normal AI
But they're dumb

#

So they won't react to fires and stuff

#

So disabling the normal AI stuff is probably better

#

You can disable a couple of their "intelligence", such as, CHECKVISIBILITY, for better performance

craggy lagoon
#

@little raptor Ok, I've got it working now thanks. But it's doing exactly what I was afraid of. On the initial build of the mortar it's clearing the ammo (Good thing) this forces the player to load ammo that they've carried over. But if all rounds aren't used up and the mortar is disassembled then reassembled it clears the ammo again. I don't know if it can be done but I just want it to clear the ammo on the initial build of mortar. All other times it can keep what's been loaded into it.

#
_staticWeapon = NDS_M224_mortar;
this addEventHandler ["WeaponAssembled", {  
    params ["", "_staticWeapon"];  
_staticWeapon removeMagazine "NDS_M_6Rnd_60mm_HE";  
_staticWeapon removeMagazine "NDS_M_6Rnd_60mm_HE";  
_staticWeapon removeMagazine "NDS_M_6Rnd_60mm_HE_0";  
_staticWeapon removeMagazine "NDS_M_6Rnd_60mm_HE_0";  
_staticWeapon removeMagazine "NDS_M_6Rnd_60mm_ILLUM";  
_staticWeapon removeMagazine "NDS_M_6Rnd_60mm_SMOKE";  
_staticWeapon removeMagazine "NDS_M_6Rnd_60mm_SMOKE";  
}];
#

There is the code that I was able to get working.

little raptor
# craggy lagoon ```sqf _staticWeapon = NDS_M224_mortar; this addEventHandler ["WeaponAssembled",...
  1. When you post code here, please add syntax highlighting. (see the pinned messages)
  2. No need to use multiple removeMagazine commands. The command removeMagazines can remove all magazines of a certain type.
  3. No need to copy paste a command multiple times. Learn how to use forEach
    for example this is your above code after applying the above notes:
this addEventHandler ["WeaponAssembled", {
    params ["", "_staticWeapon"];
    {
      _staticWeapon removeMagazines _x;
    } forEach ["NDS_M_6Rnd_60mm_HE", "NDS_M_6Rnd_60mm_HE_0", "NDS_M_6Rnd_60mm_ILLUM", "NDS_M_6Rnd_60mm_SMOKE"];
}];

Now to the actual question:
What you ask is a bit complicated. But I think you might be able to get it working using these:

  1. a weaponAssembled EH (which you already use, but needs a bit modification)
  2. a disassembled EH to detect when the weapon gets disassembled (which you should add to the weapon when it's assembled)
    https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Disassembled
    alternatively, you can use WeaponDisassembled
    https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#WeaponDisassembled
  3. a take event handler to detect when a weapon part is taken from a container: (Which you add to all players)
    https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Take

as for the process:
when the weapon is disassembled, you can detect the container to which the static weapon parts are added.
use a setVariable on the container to store the mags.
when a unit takes one of the parts from this container, transfer this variable to the unit.
and finally, when the weapon gets assembled by the unit, read the variable and add the mags to the static weapon.

craggy lagoon
#

I'm sorry about that and I've fixed it.

little raptor
#

no worries! ๐Ÿ™‚

craggy lagoon
#

Thank you so much for your help with this. I'll give that a shot.

austere hawk
little raptor
#

I think the vehicle doesn't need to be ๐Ÿค”
I'm not sure

winter rose
#

I would say no, only the unit

austere hawk
#

i mean the soldier - he needs to be local, right?

little raptor
#

yeah

#

these commands always confused me! ๐Ÿ˜„

winter rose
#

how?

little raptor
#

which one should be local?!
I always have to think about how the command works to guess that

#

for example, you can't put a remote unit in a vehicle

austere hawk
#

i mean, it could also be a requirement that both are local ^^ which is kind of a happy coincidence if it happens

little raptor
#

but you can put a unit in a remote vehicle
that was how I guessed this one at least

#

that would make it unusable in most situations! ๐Ÿ˜„

agile pumice
#

Question regarding this waituntil block. Its returning a nil during usage of a script and I'm curious to know if I can just return true at the end of the loop to stop the error from appearing? (true or false expected)

    waitUntil {
       
        //First, handle skipping frames on an interval
        if (_interval != 0 && _skippedFrames < _interval) exitWith {_skippedFrames = _skippedFrames + 1; false}; //Check and handle if frame should be skipped
        if (_interval != 0) then {_skippedFrames = 0;}; //Reset skipped frame counter on recording a frame
        //Next, check if the bullet still exists
        if (!alive _projectile) exitWith {true};
        //Finally, handle the duration and distance checks
        if (_maxDuration != -1 && ((diag_tickTime - _startTime) >= _maxDuration)) exitWith {true}; //Break loop if duration for tracking has been exceeded
        if (_maxDistance != -1 && ((_initialPos distance _projectile) >= _maxDistance)) exitWith {true}; //Break loop if distance for tracking has been exceeded
       
        //Now, checks have all been run, so let's do the actual bullet tracking stuff
        _positions set [count _positions, [position _projectile, (velocity _projectile) distance [0,0,0]]];
        _unit setVariable [format["hyp_var_tracer_projectile_%1", _projIndex], _positions];
    };
little raptor
#

waitUntil {...;true} exits the loop after the first iteration

agile pumice
#

which should be fine fora function being definied in an init.sqf right?

little raptor
#

what you're returning is the result of setVariable, which is nothing

little raptor
#

if so you must return false at the end

agile pumice
#

its part of a function defined in the init.sqf

#

the function being spawned during the fired event handler

little raptor
#

that doesn't answer my question

#

but based on your code, you should return false at the end

agile pumice
#

yeah I think false would work better than true

#

to answer your question, the loop doesn't run indefinitely

#

or atleast I don't think it does

little raptor
#

in other words, your loop won't continure

#

so you must return false

#

what I was asking was whether you wanted it to terminate due to a condition

agile pumice
#

well better meaning working and worse meaning not working

little raptor
#

which I noticed you already did

#

if (!alive _projectile) exitWith {true};

agile pumice
#

eventually the projectile dies right? so It will return true eventually

little raptor
#

yes

#

it gets deleted

#

but same difference

agile pumice
#

yeah

#

will be returning false then

oblique arrow
finite sail
#

AI

#

i couldnt fly that well, lol

oblique arrow
#

huh, surprisingly good

finite sail
#

the landing position was a buildingpos that is outdoors and above 4m, placed a helipad there, told pilot to landat

oblique arrow
#

I mean its a bit slow and I wouldnt want to be in the heli doing that, but could be worse

finite sail
#

oh yeah

#

not all of the roof positions my routine choses were quite so successful, that vid is one run out of 4

#

but im going to provide a hand picked position on the roof, not far from the one you see there and give that to the pilot

#

you cant see it there, because that was localhost, but on client machines, the doors open as the aircraft makes its final

oblique arrow
#

Huh nifty

finite sail
#

yes, im happy with it, the actual piloting is from an existing script from the mission.. always good to reuse

oblique arrow
#

Yep

austere hawk
#

getting a "missing ]" error (line10 it says), but i dont see it. Also, does this construct make sense?

private _veh = _this select 0; 
private _closeIt = _this select 1;

if (NOT(_veh isEqualType objNull) OR {_veh isEqualTo objNull}) exitWith {false;};

if(!local _veh) exitWith {
    if (_isServer) then {
        [_veh,_closeIt] remoteExecCall ["k40_fnc_close_ramp", (owner _veh)];
    } else {
        [_veh,_closeIt] remoteExecCall ["k40_fnc_close_ramp", (clientOwner _veh)];
    };
};
finite sail
#

clientowner doesnt take a param

still forum
#

isNull _veh
params ["_veh", "_closeIt"]

Where does _isServer variable come from?
Why not just _target = if isServer then owner veh else clientOwner veh.

clientOwner _veh is not a thing even, see wiki.

#

Lazy eval on your or is bad. As you expect that check to basically always run

#

The type check you can do with params anyway

#

And why even remoteExec to owner?

#

You can just use the vehicle as target. See wiki.

austere hawk
#

thanks. I think i got stuck with the "owner id" in my head and forgot about the rest

still forum
#
params [["_veh", objNull, [objNull]], "_closeIt"];

if (isNull _veh) exitWith {false};

[_veh,_closeIt] remoteExecCall ["k40_fnc_close_ramp", _veh];
#

It can be so simple

austere hawk
#

does remote-exec-ing even if it procuce no overhead vs just doing it locally right away?

#

the function is calling itself there, so !local is needed (forgot to mention)

#

or does it not matter if the one where vehicle is local does remoteExec it on himself?

still forum
#

procuce?
Even if what?

#

remoteExec to local is like a call

austere hawk
#

so it doesnt need to bargain with the server first to check if everything is green? ok

still forum
#

No

austere hawk
#

ok then i might as well just remoteExecCall directly from the userAction statement in config

distant oyster
#

is there an efficient way to check if a unit's inventory was modified?

little raptor
#

nope. but I think I made a ticket for it once.

#

apparently I didn't! ๐Ÿ˜„

distant oyster
#

Yep would be very nice to see!

autumn swift
#

For CfgDisabledCommands I want to try and disable certain commands for security purposes, but I'm worried that I might accidently block a command that is used by a default ingame mechanic. Is there a list somewhere of commands that are REQUIRED to be enabled on the client side in order for the game to function?

robust hollow
#

the only command i recall having issues with blocking was hint. that had some weird side effects. possibly createAgent too. what commands are you wanting to disable?

austere hawk
#

_HPs = [_path, 0] call BIS_fnc_returnChildren;
I want to get all the names of the subclasses behind _path, but instead it returns the full path to each subclass. Is there a function that does what i want?

winter rose
robust hollow
#

apply*

austere hawk
#

ah, apply ... i was a bit confused there ๐Ÿ˜„ thanks

winter rose
robust hollow
#

sqf'ing while tired is dangerous ๐Ÿ˜›

winter rose
#

imagine while driving ๐Ÿ˜ฎ

#

I am wikiing hard as of now ^^

supple cove
#

can I pack a script as an addon?

winter rose
#

yes

#

(if it's yours)

supple cove
#

yea, i was trying to search how to do it, could you point me in some direction?

#

I'm trying to make it easier to make updates to some friends trough workshop

winter rose
#

I think you should define your code in CfgFunctions, but for the addon-making part it would be #arma3_config I think

supple cove
#

I... dont know anything about this part.. will ask there, just need a starting point, ty!

wheat geyser
#

Are Event Handlers "MP-safe"? Especially only locally executed ones?

#

I.e. adding a "Killed" EH to a vehicle on all Machines. A Client enters an empty vehicle, making it locally to them instead of the server. The Client loses connection while the vehicle gets destroyed. Does the EH fire anywhere?

copper raven
#

it would fire on server

wheat geyser
#

That would be the preferred scenario, yes

#

Have you tried it?

#

That they added those super-ineffective "MP Event Handlers" kinda made me suspicious

copper raven
#

"The Client loses connection while the vehicle gets destroyed" can't really happen, if that client owns the vehicle, any damage dealt while it's connection is lost wouldn't be done unless it's resumed. If client fully disconnects, ownership is passed to the server, and 0 damage gets done

wheat geyser
#

Mhh, I don't really know anything about Arma's Lag Compensation/DMG handling in MP

#

Is the Client in control of the DMG values of every local vehicle?

#

If so, the Server would've to wait for a "kill confirmation" before the Server could update his game status

#

However you wouldn't want too long of a delay for that because that's obviously very frustrating.

#

Remembering OFP's clunky position updates, those were easily longer than a whole second

#

Just to be clear, I'm talking about package loss/disconnection scenario here.

copper raven
#

Is the Client in control of the DMG values of every local vehicle?
damage values are calculated on the machine that shot the projectile

wheat geyser
#

So in principle after a timeout the Server fetches the locality over the vehicle from the Client and then updates the game state, especially executing all Event Handlers (locally on the Server)?

copper raven
#

yes

#

e.g x shoots at y vehicle owned by z, z disconnects, x shoots again, y is destroyed, killed eh is fired on server (if it was added)

wheat geyser
#

Yes, this makes sense, ty

#

I just hope this also works in case a Client loses a connection i.e. not disconnecting deliberately

#

If losing connection = disconnecting in "every" aspect, than everything should be fine

copper raven
#

if a client loses connection and reconnects without being kicked off due to timeout, everything will just be delayed, damage dealt, etc, everything will still eventually fire on the same client.

wheat geyser
#

Ok nice, thanks, that actually are very important infos and good news

wild prairie
#

This might be more of a #arma3_gui thing, but since it involves scripting, eh.
I'm looking to set the color of the text on the right side of a ListBox (set using lbSetTextRight).Tried lbSetColorRight, but no joy. Does such a thing as lbSetTextColorRight exist?

copper raven
#

you can probably only set it via config

copper raven
#

you can probably save the color values into parsingNameSpace(best way), then retrieve them in config for example, the values in the array are evaluated when you create the dialog iirc, so it might work. Not at pc to test if it's possible

austere hawk
#

is a local Area Trigger somehow in anyway better or worse (in terms of performance) than just doing a waitUntil { sleep 0.5 bla nearEntities bla } for the same area ?

copper raven
#

afaik they're unscheduled, so i'd stick with them(i don't use them :D)

little raptor
#

hmm, I thought they're scheduled as well.

#

at least according to one of my tests a couple of years ago

#

I'm not sure atm

#

ok test completed!

#

they're not scheduled

austere hawk
#

and for the noobs - that means what for performance?
Not intending to run heavy calculations per trigger/waitUntil, but there are a bunch being present constantly throughout the session

little raptor
#

Not intending to run heavy calculations per trigger
you can measure the code performance

#

if the total (for all triggers) is below 1-2 ms, it should be safe enough to use triggers

austere hawk
#

its not intensive - well guess thats relative... checking for presence of any enemy unit inside maybe 500m radius , with 30of these running or so. To get true performance i would have to first create a realistic scenario with vehicles, units and buildings all over the map - i'm not there yet

little raptor
#

. checking for presence of any enemy unit inside maybe 500m radius , with 30of these running or so
depends on the number of units. but probably not that intensive (~0.002 ms per unit)

#

of course when 30 triggers check this, it could be a bit worse

#

so roughly ~0.06 ms per unit

austere hawk
#

i dont need to find all units, the check can stop after the first inside the area

little raptor
#

if all triggers run at the same time
I'm not sure if the game does anything to minimize the number of triggers that run at the same time

austere hawk
#

though i guess i could cycle the triggers on / off periodically per area -
Or move the trigger around like the Eye of sauron ...

little raptor
#

ok, then it probably is safe

austere hawk
#

checking every 0.5s is totally overkill anyway. every 30s per area would be completely fine for example.

little raptor
#

that's a bit too high tho! ๐Ÿ˜„

#

a plane for example, could pass thru your trigger without ever triggering it
or even a heli
anything that moves faster than 1000/30 m/s (33.3 m/s)

austere hawk
#

ground units are the important bit. Air units i can put on a constant watch list (there are propably only a hand full present anyway)

little raptor
#

still, 30s is too big.

#

1-3 is good

austere hawk
#

everyone who is fast gets spotted by AI quickly. Its the sneaky boys that i have to check for, so they dont sneak into an empty outpost (that only gets filled when somebody is detected)

#

im planning to let AI do the observing, triggers / equivalent will be only safety net

umbral nimbus
#

Anyone has ever made ground vehicles work properky with UnitRecord?

#

like wheels animating and such

little raptor
#

what's unitRecord?!

#

you mean unitCapture?

#

if so, it simply records the position, velocity and orientation of the vehicle

umbral nimbus
#

yeah srry

little raptor
#

it's only useful for air units

umbral nimbus
#

I know

#

hence my question

#

Did anyone ever make it function for ground vehicles somehow?

little raptor
#

dunno

#

I saw some variants for infantry units before

umbral nimbus
#

ok

#

so setDriveOnPath is my best bet?

little raptor
#

probably yes

umbral nimbus
#

alright

little raptor
#

I think to get the wheels to animate you need the anim source

high marsh
#

thought that was PhysX driven?

#

the wheels

little raptor
#

they are.
but there might be a way to animate them using animateSource or animate
I've never done it so I'm not sure

warm hedge
#

I don't think you can animate an actual vehicle's (I mean not a Simple Object) engine-driven animations such like suspensions by any means possible

little raptor
#

yeah that one is absolutely not possible! ๐Ÿ˜„
I was hoping there was a way to animate the wheels alone

umbral nimbus
#

ok

high marsh
#

What, you mean I cant have animate lift on my fancy cars? ๐Ÿ™‚

warm hedge
#

engine-driven animations
I don't mean so

little raptor
umbral nimbus
#

ok

#

I've got to say setDriveOnPath works quiet well when you just use a lot of positions in short intervals.
You can navigate through narrow alleys and such

little raptor
#

it's because the leader will give them orders in that case.

but you don't need it for agents

unreal scroll
#

Is there a way to open an AI vehicle inventory with a script command, as we do from Actions - Open inventory menu?
I've tried Gear command in all combinations, but all I could get is the opening my vehicle inventory:
vehicle _unit action ["Gear",vehicle _unit];

little raptor
unreal scroll
#

Sad... Thank.

little raptor
unreal scroll
#

Of course

little raptor
#

it's not optimal but doable

austere hawk
#

is there an easy command to get the passenger of a specific cargo seat index (not a turret)?
locked trice over the command page - closes thing i see is fullCrew which i then would have to dissect

still forum
#

See "see also" on cargoIndex page?
If it exists, it probably should be there

unreal scroll
#

@austere hawk getCargoIndex

austere hawk
#

thats not it max, i want to get the inverse

#

unit from an index

still forum
#

Is there nothing listed in the see also? Then there probably is no easy way

austere hawk
#

the search doesnt show me a cargoIndex page

still forum
austere hawk
#

unless you mean getCargoIndex

still forum
#

Yes that.
And yeah there's nothing listed

little raptor
#

@unreal scroll
you have to use a helper unit:

params ["_unit"];
private _veh = vehicle _unit;
private _helper = (createGroup [side group _unit, true]) createUnit ["B_Soldier_VR_F", [0,0,0], [], 0, "NONE"];
_helper attachTo [_veh, [0,0,0]];
_helper allowDamage false;
_helper setCaptive true;
_helper hideObjectGlobal true;
_helper disableAI "ALL";
_helper setUnitLoadout getUnitLoadout _unit;
_helper action ["Gear", _veh];
[
    "CheckInv", "onEachFrame", {
        if (_this findIf {!alive _x} != -1 || {
            _disp = uiNamespace getVariable ["RscDisplayInventory", displayNull];
            _disp setVariable ["invParams", _this];
            _disp displayAddEventHandler ["unload", {
                (_this#0 getVariable ["invParams", []]) params ["_unit", "_helper"];
                _unit setUnitLoadout getUnitLoadout _helper;
                _group = group _helper;
                deleteVehicle _helper;
                deleteGroup _group;
            }];
            true
        }) exitWith {
            ["CheckInv", "onEachFrame"] call BIS_fnc_removeStackedEventHandler; 
        };
    }, [_unit, _helper, _veh]
] call BIS_fnc_addStackedEventHandler;
#

works as it is. just use [_unit] call _that_function

#

@still forum can you fix that command if I make a feature request? (using action ["Gear" to open the inventory of a crew member)

austere hawk
#

getting a "missing ;" in line 12 - i dont see it. Maybe something else is wrong?
Want to kick out all cargo units of specific indices

params ["_veh","_ids_cLock"];

private _crew = fullCrew [_veh, "cargo", false];
private _i=-2;

{ // get rid of passengers that occupy any index inside _ids_cLock
    _veh lockCargo [_x, false];
    _i = _x;
    _i = _crew findIf {_i isEqualTo (_x select 2)};
    
    if (_i > -1) then { //cargoindex occupied
        _unit = (_crew select _i) _select 0;
        if (NOT (isNull _unit)) then {
            if ((!alive _unit) OR {lifeState _unit isEqualTo "INCAPACITATED"}) then{ 
                [_veh,_unit,true] remoteExecCall ["k40_fnc_eject",_unit]; //eject unit on client where unit is local
            } else {
                [_veh,_unit,false] remoteExecCall ["k40_fnc_eject",_unit];
            };
        };
    };
} forEach _ids_cLock;
File scripts\test.sqf..., line 12
Error in expression <> -1) then { 
_unit = (_crew select _i) _select 0;
if (NOT (isNull _unit)) then >
  Error position: <_select 0;
if (NOT (isNull _unit)) then >
  Error Missing ;
File scripts\test.sqf..., line 12
little raptor
#

@austere hawk _select

exotic flax
#

_unit = (_crew select _i) **_select** 0;

austere hawk
#

๐Ÿ˜ฉ thanks

little raptor
austere hawk
#

propably, though 11 vs 10 vs 9 vs 4 just never gets in my head so i opt to be safe than sorry

dusty depot
#
_unit addEventHandler ["Fired", {
    params ["_unit"];
    if (side _unit == civilian) then {
        _group = createGroup east;
        [_unit] joinSilent _group;
        ["crime"] remoteExec ["systemChat"];
    };
}];
#

i wanna make civilians become opfor when they shoot

#

but the civilians become opfor don't shoot bluefor guys even they are in east side.

#

what is wrong with my code?

unreal scroll
#

As I remember, there is an engine limitation - you can't actually change the side of spawned units.
it is better to recreate them, using the appropriate soldier.

dusty depot
#

thank you

#

it behaves like this

little raptor
#

it makes them enemy to everyone

#

that's how you get punished for TK and stuff

still forum
little raptor
#

_unit action ["gear", player]

#

opens the unit's inventory and you can modify it (e.g. give him your backpack)

#

now you can make it MP safe, if that's your concern

#

I'm not sure how it behaves in MP

still forum
still forum
little raptor
austere hawk
#

short answer - it evolved a bit before i got it right

#

and its executed maybe 2x per mission so ๐Ÿคทโ€โ™‚๏ธ

still forum
little raptor
#

yes

still forum
#

That might be a bug then

little raptor
#

for example I can't use that command to change my gear in a vehicle

#

simple repro:
get in a vehicle and use:

player action ["gear", vehicle player]
proper sail
#

Is it bad coding practice to call a function without any arguments?
i.e.

#
call function;```
little raptor
#

if you do that, it uses the arguments from its "parent" function

proper sail
#

yes i know but they dont get used

little raptor
#

it's not a bad practice

proper sail
#

Alright so 0 call or [] call is not preferred in any way?

#

purely a style question

little raptor
#

no,
but

call function

is preferred over:

_this call function;
still forum
#

Well for one it's slower.
And also why would you pass invalid parameters to a function?

proper sail
#

alright thanks leopard

still forum
#

I would call passing parameters to a function that doesn't take any parameters to be bad practice

proper sail
#

yes

finite sail
#

guys, if im standing on the roof of a building at the position I want to place a helipad (for a heli to land here later)

#

provided im actially looking at the buiilding too

#

cursorObject worldToModel (getpos player)

#

is that right?

little raptor
#

no

little raptor
#

I mean what's the point of that worldToModel?

#

you want to make it compatible with all objects created later?

finite sail
#

ok, so im on the roof of the barracks building... and I want to get the best place for the helo to land to work on ALL barracks

little raptor
#

use this then:

#
cursorObject worldToModel ASLtoAGL getPosASL player
finite sail
#

ah yesm that will get the roadway lod?

little raptor
#

no

#

it gets the exact position where you are

#

relative to the model

#

the other command however was wrong

finite sail
#

the pos of the player is at his feet yes?

little raptor
#

yes

#

remember not to use the getPos command if the height matters to you

#

or just don't use it at all

#

it's slower too

finite sail
#

especially when not standing on the ground....

little raptor
#

the only reason you might wanna use it is if you want to get the height to the next roadway LOD that is below a unit

finite sail
#

im going to createvehicle an empty helipad there and have the heli land on it

#

dont know if you saw my vid yesterday... had some success with ai pilots doing that

little raptor
#

use setPosASL and modelToWorldWorld

finite sail
#

*copy pasting this to my notes

#

ok, just to clarify

#

cursorObject worldToModel ASLtoAGL getPosASL player

#

will give me an [x,y,z]

#

I then

_myhp setposASL (_mybarracksbuilding modeltoworldworld [x,y,z]);```
little raptor
#

createVehicle ["Land_HelipadEmpty_F", [x,y,z], 0,[], "NONE"]
or just [0,0,0]
doesn't much matter either way
also missing a ;
also please add syntax highlighting

finite sail
#

yes, the semicolon ๐Ÿ™‚

little raptor
#

also, if your code is expected to be scheduled, I recommend an isNil around it
but doesn't matter much for a helipad ๐Ÿ˜„

finite sail
#

there... thats it?

#

it is sche'd

#

excellent, thanks mate

#

merry christmas to ya ๐Ÿ™‚

little raptor
#

thanks,
you mean happy new year?! ๐Ÿ˜„

finite sail
#

thats for christmas 2021... im want to get in early

#

because i like you xx

real tartan
#

how to check if Waypoint is done ?

finite sail
#

I thought there is a waypointDone command...

#

might work for you

still forum
finite sail
#

the helo flew to 000, checking my code now

finite sail
#

Leo

#

we'll gloss over what happened to the guys who got out of the port side of the helo ๐Ÿ™‚

#

tested on different barracks.. 6 runs, only 1 ended in fiery OPFOR goodness

#

which is a better success rate than if I was flying ๐Ÿ™‚

#

am testing setting the dir of the helipad to the same as the building... see if that influences the dir the helo comes in at when given the landat

little raptor
#

world position is a bit ambiguous here.

#

you might think it's the same as getPosWorld, but it's not

#

world Pos == AGL pos from a model perspective! ยฏ_(ใƒ„)_/ยฏ

#

Which is why there's a worldWorld variant for model commands

still forum
#

World pos is usually ASL...
Why does a command that says world not use world reeeeee

little raptor
finite sail
#

ah ok, thanks

#

setwinddor getdir mybarracks

#

or similar

little raptor
finite sail
#

there isnt... its a secondary mission that hapopen 1 at a time

#

but yes, good point

hollow lantern
#

share the results if that works great Tankbuster, currently doing a scripted approach of the thing and it is well not ready for Hollywood I can tell you that

hollow lantern
#

I'm currently trying to figure out, if a vehicle weapon in a vehicle is part of the parent class "CannonCore". So far I tried it with BIS_fnc_returnParent but also tried this approach:

            private _aircraftWeapons = _aircraft weaponsTurret [0];
            {
                if (  (_x in ([configFile >> "CfgWeapons" >> "CannonCore", 4] call BIS_fnc_returnChildren)) ) then 
                {
                    hint "OK cool 66"
                }

            } forEach _aircraftWeapons;``` But it seems like I can't get it to work.  Is there another way I could try?
#

rhs_weap_M230 as example would be _x

winter rose
#

you lost XP in the stat: indent

oblique arrow
hollow lantern
#

yeah copied from my test.sqf which is a temp file where sometimes formatting is not present :( You can kill me for that later lmao

oblique arrow
hollow lantern
#

and thanks @winter rose the simple solution just cut it again lol

regal night
#

Anyone know of any simple melee scripts? I'm looking for something that can be used when unarmed and is just a simple punch that does low damage. I've looked at other scripts like mocap, largo, and Improved melee system. But I don't want something that is an insta kill. Not finding any very good tutorials either.

winter rose
regal night
#

I saw a forum on that. I also found a list of animations and tried following a tutorial, long story short, it didn't work.

dusty badger
#

So this will sound pretty vague but does anyone know of any dynamic class restriction scripts? If that makes any sense. Im looking to restrict player arsenal access in an arbitrary way, rather than by what class/slot they choose.

#

For example I would want equipment for riflemen restricted to people with riflemen permissions, rather than people who are playing the rifleman class.

oblique arrow
#

Maybe you can open different arsenals depending on the guys permission?

#

I dont know if there's a way to give a certain arsenal a variable name and then open that specific one remotely

dusty badger
#

Yeah that would be the idea, I have a couple ideas on how to write this myself but I am looking for scripts that may already exist just in case I can save myself the time.

#

I know ace3 lets you remove virtual items from its arsenal framework, although I dont know if its a local effect or not

#

My goal here would be to enforce player equipment restrictions in a way that is flexible, and can meet the demands of any tactical situation. Kind of like where a commander can decide how many and what sort of units they want, and then create or assign roles to players. And all live in the mission.

pliant stream
winter rose
pliant stream
#

ah the zombie attack... it's possible that very early on it used grenade throw but it definitely doesn't now. the zombies have custom attack animations as well

real tartan
#

is there a way to lift a downed helicopter via chinook ? I don't know if it is hardcoded via config or can be mass of cargo set via script ?

oblique arrow
#

mmh

winter rose
#

setMass? ^^

oblique arrow
#

^ if that fancy stuff doesnt work you could also attachTo the heli wreck to a liftable object

winter rose
#

@winged basin so, locations locations

winged basin
#

@winter rose i cant put pics inside those channels right?

winter rose
#

nope, can't

winged basin
#

damn okey

winter rose
#

1/ grab your location with nearestLocation
2/ delete it with deleteLocation (may not be possible with terrain locations)

winged basin
#

Does it work in Eden editor with the debug console ?

winter rose
#

it should yes

winged basin
#

it shows up an error "invalid number"

winged basin
#

i found like the exact loacation of the village name (shouldnt i be able to delete it with that then) ?

robust hollow
little raptor
little raptor
#

you might be able to "paint" over that tho (with an icon or marker), if you want to remove it so badly

winged basin
#

ye i mean it says "This area is currently under construction" and its pretty big tho

#

i had smth coming up in sidechat :Namecitycapital at 15770,18400(This area is currently under construction)-27.2623m Location Mount at 15570,18560()-259.438m Location Mount at 15280,18310()-500.212m

little raptor
winged basin
#

thanks man much appreciated

#

i'll see if any of those work or not

copper raven
proven vortex
#

I'm using custom textures made in Photoshop for each panel, wouldn't using that just slap the texture over the whole vehicle weirdly though?

#

As there is different logo's/icons etc put in certain places

copper raven
#

no, it's the same thing

proven vortex
#

ah alright then i've never tried it before i'll give it a go thanks

little raptor
proven vortex
#

ah right sorry, I did check before hand but I must have clicked on the wrong channel by mistake my bad

real tartan
#

I am trying to slingload cargo (downed helicopter with default mass 10000) via huron (max cargo mass 12000).
canSlingLoad return false. even when I setMass of cargo to 1000. I also tried enableRopeAttach set to true, but not working either
any ideas ?

winter rose
real tartan
# winter rose I believe it also requires a config entry, so maybe it is not possible without a...

I even tried to create helper (canSlingLoad return true) and attach cargo to helper, but ropes snaps. how to ignore weight of attached object? disable simulation ?

    private _helper = createVehicle ["C_Quadbike_01_F", [0,0,0], [], 0, "NONE"];
    _helper allowDamage false;
    _helper hideObjectGlobal true;
    _helper setMass [0, 0];
    // _helper enableSimulationGlobal true;
    _helper enableRopeAttach true;
    // _helper disableCollisionWith _cargo;
    _helper setPos (getPos _cargo);

    _cargo attachTo [_helper, [0,0,0]];
winter rose
#

if a config entry is needed, helpers are more likely configured not to be sling-loadable

real tartan
#

C_Quadbike_01_F is slingloadable, helicopter slings, but when try to pull it breaks rope

winter rose
#

without mods?

real tartan
#

yes

winter rose
#

don't hide it?

willow hound
winter rose
#

the ropes must snap because hideObject on a non-attached object disables its simulation afaik

real tartan
#

ok, so I get it to work without hideObject, so I need to fiddle with simulation

ebon citrus
#

@real tartan just set the texture to a 0 alpha one. You'll still have a shadow, but meh

#

You can also bypass the slingloading configs by creating the ropes yourself

real tartan
brave jungle
#

how can I insert a string onto a new line in rscEditMulti?

ebon citrus
#

Do note that whatever youre sling loading has to be physics enabled

robust hollow
brave jungle
#

Yeah just stumbled upon it myself, ty

#

saw this example: sqf _ctrl = findDisplay 46 ctrlCreate ["RscTextMulti", -1]; _ctrl ctrlSetPosition [0,0,1,1]; _ctrl ctrlCommit 0; _ctrl ctrlSetText format ["line1%1line2%1line3", endl];

little raptor
#

@real tartan the best solution is to create your own helper object (if you're working on a mod and not a mission)

rotund folio
#

hi guys, i would like know if an altis IDMAP existe. I would like know if its possible too creat a dirt script. in theory, the game knows where the character / vehicle is on the map. therefore it is possible to load a texture when we arrive in a zone if this one is realized as being earth, water or sand thanks to an IDMAP. it is theory of course. it is still necessary that this IDMAP exists. It is possible to load a texture linked to damage, for what not lands?

distant oyster
#

does saveGame do anything in MP? hosted and dedicated? And does the "Save" option in the escape menu have any effect in hosted MP?

rotund folio
#

I have other Thiory

glacial lagoon
#

Short question: Is it possible to let a vehicle shoot without an unit inside?

little raptor
#

No. You need a unit to operate a weapon

copper raven
#

i mean you can just spawn an AI in it, and order it to shoot where you want it to

little raptor
#

yeah, and the unit must be in the correct seat (e.g. you cant fire the minigun of a littlebird from the copilot seat)

worn forge
#

Looking for a fresh perspective on a problem I've been trying to solve through different methods for some time now; on our server we would like to enforce that multi-pilot CAS vehicles require a full crew before they can be operated. The only vehicle this really applies to is the Blackfoot helicopter. The most obvious method, an eachFrame missionEventHandler with a condition that sets engineOn false does not work because the player can simply hold down the shift key to keep the engine on. Any suggestions?

willow hound
#

Check every 30 seconds or so (every frame seems a bit excessive) if the requirements are met, if not, remove the fuel. Since this might well crash the aircraft if it is airborne, maybe reset it to its spawnpoint or to a safe-ish position on the ground below.

exotic flax
#

although I would only do that when within a certain range of the spawn area, so that it won't crash or TP back to base when someone dies or disconnects

willow hound
#

Could also just remove all weapon systems when your requirements are not met, allowing people to fly from base to base on their own but not allowing them to engage targets on their own.

real tartan
little raptor
#

but I think it's better to just remove the texture:

{_helper setObjectTexture [_forEachIndex, ""]} forEach getObjectTextures _helper
#

(might not work on the stable build due to a recent "bug")

real tartan
little raptor
#

are you making a mission?

#

if it's a mod you can make your own helper object

real tartan
#

making a mission

hollow thistle
worn forge
#

I've gone the setfuel route but of course the buggers just wheel a fuel truck up to the chopper.

willow hound
#

@worn forge I think removing the weapons when single-crewing is a good balance for our servers.

worn forge
#

Except I really don't want them flying solo.

silk ravine
#

Hi there folks,

I know there is the ACEX fortify framework, but as far as I can read and see this only works based on WEST, EAST, INDEPENDENT and CIVILIAN.
Is there a way to only allow a specific player object f.e. eod1 to place whatever is defined within the classname parameters?

hollow lantern
#

according to the addAction wiki, if I have a simple params in my script that would get the variables from sqf [Vulture21CR, Vulture21VHC, 1200, [1159.28,11927.1,0]] execVM "itsAebian\KI_airSupport.sqf"; Then I assume this code will not work correctly?

this addAction["Scramble [Base] Apache Support","itsAebian\KI_airSupport.sqf", [Vulture21CR, Vulture21VHC, 1200, [1159.28,11927.1,0]]];```
Apparently it seems that the variables will not pass correctly to the script.  Hence I get errors. 

What would be the best way to do this instead?
winter rose
#

@hollow lantern it works
simply, arguments are target, caller, actionId, [arguments]

hollow lantern
#

well apparently my script fails at recognizing the group as group when I call the script via addAction

#

when calling the script directly everything works

winter rose
#

something must be done wrong then

#

โ†’ with addAction, the first three params are target, caller, actionId then your arguments in an array

#

so you would need to adapt your script for addAction

hollow lantern
#

hmmm would it be wise to just add this in the init.sqf:

KI_fnc_baseAirSupport = {
  [Vulture21CR, Vulture21VHC, 1200, [1159.28,11927.1,0]] execVM "itsAebian\KI_airSupport.sqf";
};``` and then just call the function instead via the addAction?
winter rose
#

declare a CfgFunctions then

hollow lantern
#

ok

winter rose
#

or directly write this execVM in the addAction? ๐Ÿค” why not

hollow lantern
#

well if that would work, I always thought that that would require me to use call instead.
[options] call compile "script.sqf"
instead of just script.sqf. And from my understanding call is unscheduled which should be avoided where possible

winter rose
#

nope, nope.
first, it would have to be sqf call compile preprocessFileLineNumbers "file.sqf"; second, call is unscheduled only if the parent scope is unscheduled (addAction scope is scheduled)

if you only want this execVM to happen, use execVM
if you have to do it more than once, it is better to declare a function otherwise the file is read and compiled every execution

#

that's about it ๐Ÿ™‚

hollow lantern
#

ah that makes sense, thanks for this lecture.

winter rose
#

sorry if it sounds a bit too abrupt ๐Ÿ˜ฌ

hollow lantern
#

no worries, I don't need 5000 lines of handbook lol

viral basin
#

Hey there, we're currently trying to spawn some animals with the headless client. After joining the server, for some of us the animals are frozen or bugged into the ground. We tried using createAgent and createUnit but nothing really worked for us. Maybe its the headless client? Must it be executed on the server?

hollow lantern
#

how did you create the animals? Or to be exact, where?
Normally you could do something like this:

if (isHC) then
{
// code to be executed on the HC
};```
viral basin
#

its in the init script from our HC framework. (its a server-side mod). We disabled the AI using the BIS_fnc_animalBehaviour_disable variable on the agent and various disableAI features except "ANIM" for the moves. Then the animals are commanded with "setDestination" to a random position. But they're totally stuck. Maybe its something with JIP?

hollow lantern
#

ANIM only affects animation. If the units don't move to the desired point, have you maybe disabled PATH too?

viral basin
#

No, only FSM and we set the behaviour to CARELESS.

hollow lantern
#

Hmm, then sorry maybe someone else has an Idea,

copper raven
#

pretty sure someone had the exact same issue, don't think they found a fix for it

viral basin
#

okay, thank you all for your help anyway. mayhaps we get a fix soon :S

oblique arrow
crude needle
viral basin
little raptor
brave jungle
# worn forge Looking for a fresh perspective on a problem I've been trying to solve through d...

not sure if you're still after ideas on this, maybe force the player out of the driver slot instead with a message saying it needs to be fully manned? https://community.bistudio.com/wiki/moveOut could help here, maybe something like:

_heli addEventHandler ["getIn", {
  params ["_vehicle", "_role", "_unit", "_turret"];
moveOut _unit;
hintC "You must have a fully crewed aircraft before flying!";

}];```
Could also look at others like forcing the eject action on the player
#

Note the getIn Event: "It can be assigned to a remote vehicle but will only fire on the PC where the actual addEventHandler command was executed"

worn forge
#

Hi Curious, I've tried that approach as well, but the problem there of course is that how do you get both players into the craft to pass that exception.

brave jungle
#

I'd have delay

#

so have a condition that times out after X amount of time

#

if the condition is not met within say 30 seconds then kick em out

worn forge
#

So they can get in, power up, but then get kicked out if another player doesn't get in within the delay.

brave jungle
#

you could also add the fuel concept here too

#

two secs:

worn forge
#

I think the fuel concept is probably the most consistent. It'd mean tracking the fuel state and saving it separately so that when two players are present, it "regains" its fuel from the saved state, and if crew=1, a perFrameHandler setFuel=0

brave jungle
#



_heli addEventHandler ["getIn", {
  params ["_vehicle", "_role", "_unit", "_turret"];
_fullCrew = false;
_timer = 0;
_vehicle setFuel 0;
[_vehicle] spawn {
  if (((driver (vehicle player)) isEqualTo player) and ((gunner (vehicle player)) isEqualTo player)) then { _fullCrew = true } else { _fullCrew = false; }; 
  if ((_timer == 30) or (_fullCrew)) exitWith {_timer};
  _timer = _timer + 1; sleep 1;
 };

waitUntil {(_timer == 30) or (_fullCrew)};

if (_timer == 30) then {
  moveOut _unit;
  hintC "You must have a fully crewed aircraft before flying!";
} else {
  _vehicle setFuel 1;
};
}];
};
#

that obvs untested

#

but something like this might work

#

that way youre not adding an onEachFrame etc

#

and the code only starts when it is needed

#

fullCrew _this select 0 - select 0 is the passed _vehicle argument into the spawn, can't remember if this is passed later in the scope, someone could probably tell you if this is required though

winter rose
brave jungle
#

so it does

winter rose
#

spanky spanky

brave jungle
#

lesson 101, click the wiki don't just search to see if it exists

#

There is a super dirty fix ๐Ÿ˜„

#

anyhow good luck back to my own stuff ๐Ÿ˜›

worn forge
#

My next solution attempt:

fullCrewEH = addMissionEventHandler ["EachFrame", {
    if ( (typeOf vehicle player) in fullCrewVehicles ) then
    {    if ( playerIsZeus || {count crew vehicle player > 1} ) then
        {    if ( fuel vehicle player == 0 ) then
            {    [vehicle player, (vehicle player) getVariable ['fuel', 1]] remoteExecCall ["setFuel", vehicle player]; };
        }
        else
        {    if ( isTouchingGround vehicle player && {fuel vehicle player > 0} ) then
            {    (vehicle player) setVariable ['fuel', fuel vehicle player, true];
                [vehicle player, 0] remoteExecCall ["setFuel", vehicle player];
            };
        };
    };
}];
#

Even though it's a pfh it shouldn't have much of an impact on performance as the majority of vehicles are not in fullCrewVehicles array, so it'll just get kicked out as false

winter rose
#

you really don't need an EachFrame EH here ^^

so:
if someone gets it, start 30s timer
if the crew is full, stop the counter
if someone gets out, restart the timer?

worn forge
#

I don't need it, but I don't think it's disadvantageous to use it. In the 30 sec timer, the solo pilot has already spooled up and flown off, or has the fuel truck parked nearby so it's refueled. Meaning the bird will crash. With an eachFrame it's never gonna get the gas it needs to start up.

winter rose
#

you can keep the fuel @ zero until everyone is boarded, too

brave jungle
#

does buttonSetAction not take variables? I know its in SQS format...

_ctrl_init_reset_button buttonSetAction "_ctrl_init_edit ctrlSetText _ctrl_init_edit_text_default;";
#

all my variables exist

#

Made sure ๐Ÿ˜„

#

but button doesn't set the control _ctrl_init_edit to the text _ctrl_init_edit_text_default

little raptor
brave jungle
#

i'll do number 2 ๐Ÿ˜„

#

ty

little raptor
#

np

brave jungle
#

okay new problem ๐Ÿ˜„

_ctrl_init_reset_button ctrlAddEventHandler ["ButtonClick", format ["%1 ctrlSetText %2", _ctrl_init_edit, _ctrl_init_edit_text]];

Getting error saying type any expected control, because the control _ctrl_init_edit (control #1402) is being passed as a string. How to get around this?

winter rose
#

don't use format ๐Ÿ˜ฌ

brave jungle
#

but it wont work at all otherwise ๐Ÿค”

winter rose
#

so you prefer not working and a script error ? wow ๐Ÿ˜œ

brave jungle
#

it doesn't pick up the variable in the EH

winter rose
#

use set/getVariable to set/get the values on the dialog/button itself

brave jungle
#

but thats another step I gotta do now PES_Hands

#

alright will try

#

what a fun new years im having so far kekw

brave jungle
#
_ctrl_initPlayerLocal_reset_button setVariable ["_ctrl_initPlayerLocal_reset_button_Text_Variable", _ctrl_initPlayerLocal_edit_text];
_ctrl_initPlayerLocal_reset_button setVariable ["_ctrl_initPlayerLocal_edit_Variable", _ctrl_initPlayerLocal_edit];

_ctrl_initPlayerLocal_reset_button ctrlAddEventHandler ["ButtonClick", {
params ["_control"]; 
  _editbox = _control getVariable '_ctrl_initPlayerServer_edit_Variable'; 
  _text = _control getVariable '_ctrl_initPlayerServer_reset_button_Text_Variable'; 
  _editbox ctrlSetText _text;
}];
```Like so?
robust hollow
#

yea. or you can use displayCtrl if those controls use idcs

#

a little less work, same outcome.

brave jungle
#

๐Ÿ‘

fair drum
#

so remember in the first mission in the East Wind campaign where your character walks on rails and all you can do is look around? how did they go about doing that?

still forum
#

Animation

lucid junco
#

Anyone knows the code to detect if any vehicle (driver probably) of specific side knows about player? knowsabout itself doesnt works for vehicles for me

#

i need something like " if (any vehicle side west knowsabout player > 0) then {code}

winter rose
exotic flax
#
_vehicle = "";
_unit = player;
if (driver _vehicle knowsAbout _unit > 0) then {
   // yup, the driver/group knows about the player
};
#

problem is that a vehicle on it's own has no "knowledge", so you you could loop over all units in a side, check if they are in the crew of a vehicle (driver, commander, gunner) and check if they know about the player

#

or loop over all groups per side, and check if they are in a vehicle

winter rose
#

@lucid junco โ†‘

lucid junco
#

i see..... I just need to check for all vehicles on the map with as much universal syntax as possible lol. Struggling to figure it out ๐Ÿ˜„ New year haha

winter rose
#

don't drink and code! :p

lucid junco
#

wish i would be drinking lol ๐Ÿ˜„

exotic flax
#

tbf... all AI units will know about players, even when at the other side of the terrain. Although range and visibility will lower the value (and some other variables).
In case you want a global script; I would either do it per vehicle:

  • get AI in vehicles, and check for player within specific range
    Or check per player:
  • for each player, check for all AI in vehicles within range
lucid junco
#

yea, i wont give up I promise. thx guys ๐Ÿ˜„ and Happy new year

exotic flax
#

If you ask the right things you'll get the right answers.
And otherwise we'll try to help you out finding it ๐Ÿ˜‰

lucid junco
#
  
//I feel bit embarrassed now lol
};
} foreach vehicles;```
winter rose
#

dat indent o_o

#

SPANKY

winter rose
#

that's for any
if any driver knows, the if is true.

lucid junco
#

you are best! Luv ya muhehe ๐Ÿ˜„

drifting sky
#

Is anybody able to explain why the "sleep" command does not always work in the function "func_killed_event". The delay before the body is deleted appears random, and much less than 300 seconds, sometimes as few as 2 or 3 seconds. Later in the game, the delay appears to disappear completely. sqf _unit addMPEventHandler ["MPKilled", {_this spawn func_killed_event;}]; function: ```sqf

func_killed_event = {
private [
"_killed",
"_killer",
"_killed_side",
"_killer_side",
"_funds"
];
_killed = _this select 0;
_killer = _this select 1;
_killed_side = _killed getVariable "MY_SIDE";
_killer_side = _killer getVariable "MY_SIDE";
if (
(!isNil "_killed_side")
&& (!isNil "_killer_side")
)then {
_killed_group = _killed getVariable "MY_GROUP";
_killer_group = _killer getVariable "MY_GROUP";
if (_killed_side != _killer_side) then {
_funds = _killer_group getVariable "FUNDS";
_funds = _funds + 1;
_killer_group setVariable ["FUNDS",_funds];
if (_killer_group == (group player)) then {
player sideChat format["funds: %1",_funds]
};
};
switch (_killed_side) do {
case WEST: { west_losses = west_losses + 1; };
case EAST: { east_losses = east_losses + 1; };
};
hint format["west losses: %1\neast losses %2",west_losses,east_losses];
};
sleep 300;
deleteVehicle _killed;
};```

#

I don't see how most of the code in that function could be affecting the problem, but I included it just in case.

#

could it somehow be because I forgot to make "_killed_group" and "_killer_group" private?

brave jungle
#

see pinned on sqf highlighting ๐Ÿ˜„

#

Makes it easier for others to read it

#

has to be that at the top

drifting sky
#

you mean the top of the message, or the top fo the code block?

brave jungle
#
_unit addMPEventHandler ["MPKilled", {_this spawn func_killed_event;}];


func_killed_event = {
    private [
        "_killed",
        "_killer",
        "_killed_side",
        "_killer_side",
        "_funds"
    ];
    _killed = _this select 0;
    _killer = _this select 1;
    _killed_side = _killed getVariable "MY_SIDE";
    _killer_side = _killer getVariable "MY_SIDE";
    if (
        (!isNil "_killed_side") 
        && (!isNil "_killer_side")
    )then {
        _killed_group = _killed getVariable "MY_GROUP";
        _killer_group = _killer getVariable "MY_GROUP";
        if (_killed_side != _killer_side) then {
            _funds = _killer_group getVariable "FUNDS";
            _funds = _funds + 1;
            _killer_group setVariable ["FUNDS",_funds];
            if (_killer_group == (group player)) then {
                player sideChat format["funds: %1",_funds]
            };
        };
        switch (_killed_side) do {
            case WEST: { west_losses = west_losses + 1; };
            case EAST: { east_losses = east_losses + 1; };
        };    
        hint format["west losses: %1\neast losses %2",west_losses,east_losses];
    };
    sleep 300;
    deleteVehicle _killed;
};
#

dw

#

I've done it

#

right i'll re-read two mins

#

its your exec

little raptor
brave jungle
#

use spawn instead of call

little raptor
drifting sky
#

I am using spawn

brave jungle
#

oh so he does missed the top one

little raptor
#

what top one?!

#

the code seems correct to me

brave jungle
#

the bit at the top of the code block I copied/pasted - completely glossed over it

drifting sky
#

I was under the impression that in this context, sleep should always wait at least 300 seconds.

#

But it is sort of random and sometimes there is no delay at all

little raptor
#

are you still making this for A2?!

drifting sky
#

yes.

little raptor
#

your code doesn't throw any errors does it?

drifting sky
#

no code errors

#

is there any context in which sleep doesn't work correctly inside of spawned code?

brave jungle
#

Well if it was arma 3, i'd say do a canSuspend check

#

but that isn't gonna happen now ๐Ÿ˜„

little raptor
#

it's spawned so no need

brave jungle
#

just to double check though

#

its acting like it isn't

#

if its only 2 or 3 seconds

#

unless im mistaken, I have just woken up ๐Ÿ˜„

verbal saddle
#

It might also be an issue where something else is cleaning up the bodies before your code waits the 5 minutes.

drifting sky
#

sometimes there is a delay of minutes

#

other times the body is deleted right away

little raptor
drifting sky
#

and everything in between

#

I'll try to check if anything else is deleting the bodies, by removing my deletevehicle and see if the bodies still disappear

#

though it'll be about 5 minutes before I'll be sure

#

But since bodies don't delete in my other missions

#

I don't think there's interference from anywhere else

verbal saddle
#

I'd suggest adding an output after your sleep to make sure it's this code block executing when the bodies are deleted.

drifting sky
#

good thinking

#

does A2OA ever delete bodies automatically?? Without having set up any garbage collectors or anything?

#

or any other modules

little raptor
drifting sky
#

Shit, the body still deleted... something else is deleting my bodies.

brave jungle
#

oh no ๐Ÿ˜„

drifting sky
#

I have a hunch it might have been the HAC ai commander mod

#

even though it shouldn't have been active

brave jungle
#

been years since I even went on arma2OA, if its default arma 2OA then I think u have to setup the cleanup, or add ur own

#

might be that then ๐Ÿ‘

drifting sky
#

Thanks for reminding me to check other mods/scripts for the problem

#

hopefully that was it

drifting sky
#

hmm... bodies still being deleted. Does enabling respawn in MP cause bodies to be deleted?

robust hollow
#

in a3 player bodies delete on respawn with certain respawn types i believe. could that possibly apply here?

drifting sky
#

I'm thinking it is related to that. But why are non-player ai's being deleted as well?

little raptor
#

maybe the game has an auto cleanup system of its own. If you spawn a lot of AI I suppose it would make sense. ๐Ÿค”

#

I mean the game probably doesn't want 1000 dead bodies lying around

#

I'm not sure tho. Maybe try a clean mission see if it is the case

drifting sky
#

I don't see any reference to an automatic body deletion system

#

on google

pliant stream
drifting sky
#

nobody is disconnecting

pliant stream
#

sometimes if the player disconnects very quickly after dying, the server also deletes the body

#

alright

drifting sky
#

and ai are being deleted as well

#

non-playable ai

pliant stream
#

i think there might have been some cleanup also based on the value of the items on the body

drifting sky
#

what do you mean

#

is it possible that just attaching a MPkilled event handler somehow could cause bodies to delete automatically?

#

I just tested another mission which uses the same kind of respawn, but does NOT use MPkilled event handlers. Bodies are NOT being automatically deleted in that mission.

pliant stream
#

try giving the bodies the weapon M24 and see if they still disappear

drifting sky
#

By the way, I noticed that in the problem mission, bodies are being "hidden", rather than just deleted

pliant stream
#

yeah

drifting sky
#

But not in the other mission

#

I can only think that MPkilled has undocumented functionality to delete bodies. But if that's the case, am I really the first one to notice?

pliant stream
#

no i don't think that has anything to do with it at all

#

are you saying that's the only difference between the two missions?

drifting sky
#

I'm switching to using the regular killed event to see if it resolves the problem

#

but in the meantime, do certain islands possibly auto delete bodies???

pliant stream
#

no that's not it either

#

you're using the engine respawn right?

drifting sky
#

yes

#

in both missions

#

same type of respawn

pliant stream
#

well the engine has this cleanup queue where it puts dead bodies on respawn

drifting sky
#

and also spawning in ai randomly

#

in the other mission, my body is not deleted after i respawn

#

in this mission, player and non-player ai bodies are all being deleted

#

switching to "killed" event did not solve the problem

pliant stream
#

what sort of gear do these bodies have on them?

drifting sky
#

all kinds

pliant stream
#

there is a value calculation done based on the gear, with less valuable bodies being deleted earlier

drifting sky
#

from basic m16s to m107 m240, etc, etc

pliant stream
#

the values are a bit unintuitive

drifting sky
#

why are they being deleted in this mission and not the other one?

pliant stream
#

M24, bizon, MP5SD, SVD, LeeEnfield have the highest value

#

you should also try counting the number of bodies that are present at any one time

#

the max size of the cleanup queue is controlled by a config value

drifting sky
#

i've seen bodies delete when there are <10 bodies in the world

pliant stream
#

yeah

#

the current value is 5

drifting sky
#

what current value?

pliant stream
#

config maxAddedBodies

drifting sky
#

where is that located?

pliant stream
#

some ca addon

#

couldn't say exactly... but i can tell you that you can't change it with just a mission

#

if you have one mission not deleting any bodies though, it seems like there might be a way to sidestep it

#

in the mission which doesn't delete any, can you count how many player bodies you're actually seeing at one time?

drifting sky
#

I've made a lot of mp missions, and as far as I'm aware, this is the only one that has unintended deletion of bodies

#

Does the game treat ai bodies that are spawned in differently than ones that were placed in the mission editor?

exotic flax
drifting sky
#

what is 3den?

robust hollow
#

a3 editor

pliant stream
#

he's in A2

exotic flax
#

check if the module is placed (or add it with proper settings)

pliant stream
#

hah of course there's some scripted garbage collector too...

drifting sky
#

i don't think it's the garbage collector. 1) I've not put any modules of any kind in this mission. 2) bodies are being deleted from right under my nose, and the wiki says it doesn't if player is within 500 meters.

#

Unless just turning on respawn in mp creates some super aggressive garbage collector

pliant stream
#

well the engine does have some dead body garbage collection related to respawn

exotic flax
#

no idea how Arma 2 handled it... it's been 7 years since I touched it...

drifting sky
#

Untelo, are you sure? I"m finding absolutely no reference to that online.

#

Plus units that don't respawn are also being deleted

pliant stream
#

well you can always go from one working mission to the broken one in incremental steps until it starts breaking and that might allow you to find the thing breaking it

drifting sky
#

I'm going to try turning off respawn, and see if that stops bodies from being deleted

pliant stream
#

yes i am sure. it's possible there is some other logic unrelated to respawn as well though

exotic flax
#

I just remember that A2 was terrible with garbage collection (as in; non-existing) and I always used custom scripts for it to prevent the server from crashing

drifting sky
#

yeah exactly, so I'm really surprised bodies are being removed unintentionally

exotic flax
#

sounds like a script/mod which is doing it for you, just in a bad way

pliant stream
#

it might be that you've just somehow triggered a usually dormant engine gc behaviour

drifting sky
#

It's not a script, i've searched every script in this mission, and the only reference to deletevehicle or hidebody is one command which is commented out

#

I don't think it's a mod, because all the mods currently active are ones I always use

#

and besides i'm not having the problem in the other mission

pliant stream
#

go step by step from working mission A to broken mission B

#

once it breaks you'll know which change broke it

drifting sky
#

I wonder if the problem is that this mission has respawns AND playable ai

pliant stream
#

could be. try and find out

drifting sky
#

whereas the other mission did not have playable ai

#

however, does it make sense that even non-playable ai would also be deleted in this other mission?

pliant stream
#

anything is possible with this can of spaghetti of an engine

drifting sky
#

Looks like turning off respawns did stop the bodies being deleted. Now I need to figure out how to turn respawns on and turn garbage collector off

pliant stream
#

are the bodies changing ownership?

#

is anyone disconnecting? are you using setOwner ?

drifting sky
#

no one is disconnectiong. not using setowner

#

turning off respawns stopped the bodies from being removed

#

So there must be some undocumented garbage collector that is activated when there are respawns + playable ai

#

now i've got to figure out how to turn it off

pliant stream
#

you're not using some headless client or something are you?

drifting sky
#

what is a headless client

pliant stream
#

okay, you'd know if you were

#

did you try giving them M24s?

drifting sky
#

no, but they have virtually every other type of weapon.

pliant stream
#

yeah well there is a big difference

drifting sky
#

what, is that the one gun that will stop a body being deleted?

pliant stream
#

it's one of the 5 guns

#

you can give them bizon or MP5SD too if you like

#

the 5 i listed earlier have a value of 1000 which prevents their cleanup entirely

#

M107 for example by comparison has a value of 4

#

don't ask me why, but that's how it is

#

you can check with getNumber (configFile >> "CfgWeapons" >> "M107" >> "value")

drifting sky
#

i'll try the mp5sd since it's already part of my mission

#

It appears the mp5sd guy is not being deleted

pliant stream
#

okay, seems like it's the value based GC then

drifting sky
#

do you know any way to turn it off?

pliant stream
#

not using respawn

drifting sky
#

I'll have to look up how to do mp respawns via script

real tartan
#

can someone point me solution how to "map attached objects to source object" and then re-attach them after new source object is created ?

#
{
  // save attached object offset code here

  detach _x;
  deleteVehicle _x;
}
forEach attachedObjects _source;
deleteVehicle _source;

// create new source and create new attached objects
austere hawk
#

why the hell does BIS_fnc_markerToTrigger do the opposite it says on the tin? thonk

little raptor
little raptor
real tartan
willow hound
little raptor
#

in the exact position they were? or in relative position?

real tartan
little raptor
#

@willow hound you're doing the opposite thing

#

right @real tartan ?

#

you want to delete the object to which other objects are attached

#

not the attached objects?

real tartan
#

that is right, I want to replace source and re-attach attached objects

willow hound
#

I just modified the code M1keSK had posted ๐Ÿคทโ€โ™‚๏ธ

little raptor
#

it's simple:

private _attachedObjs = [];
{
  _attachedObjs pushBack [_x, _source worldToModel ASLtoAGL getPosASL _x];
} forEach attachedObjects _source;

deleteVehicle _source;

{
  _x#0 attachTo [_newSource, _x#1];
} forEach _attachedObjs;
copper raven
#

doesn't he want to reattach the same objects?(without creating new ones)

little raptor
#

if you attach the objects yourself you can save the position and the selection

little raptor
real tartan
little raptor
#

you said you didn't want them recreated

real tartan
#

this part of code says it

detach _x;
deleteVehicle _x;
little raptor
#

otherwise what ansin11 wrote was almost ok

#

also, does the relative position matter?

#

and do you attach the objects yourself?

real tartan
real tartan
real tartan
little raptor
real tartan
little raptor
#

then save the positions yourself

_x setVariable ["AttachedPos", [_pos, _selection]];
_x attachTo [_source, _pos, _selection];

and use ansin11's code:

private _attachedObjs = [];
{
  (_x getVariable ["AttachedPos", []]) params [["_pos", [0,0,0]], ["_selection", ""]];
  _attachedObjs pushBack [typeOf _x, _pos, _selection];
  detach _x;
  deleteVehicle _x;
} forEach attachedObjects _source;
deleteVehicle _source;

private _newSource = ...;
{
  _x params ["_type", "_pos", "_selection"];
  _x = _type createVehicle [0,0,0];
  _x attachTo [_newSource, _pos, _selection];
  _x setVariable ["AttachedPos", [_pos, _selection]];
} forEach _attachedObjs;
#

you might also want to consider making it MP safe

frail egret
#

Hey guys, I'm just doing some testing with a small function I'm working on. I have a LaserDesignator equipped and its lasing the target. The function spawns a cruise missile over head, but instead of tracking to the target, it goes to a random point.

_tgt = laserTarget player;

_missile setMissileTarget _tgt;```

Any idea what's causing it to not track my laser?
copper raven
#

you need to make sure all the conditions are satisfied before you run that command, e.g making sure target is within missile's cone, etc.

frail egret
#

Okay, so I'm lasing it too close then I guess

#

Or rather I'm spawning the missile too close and its going dumb.

fluid wolf
#

I'm having an issue with... some math? I have an equation made to calculate a velocity, and it works fine when I solve it or calc it from any website, google gives me the answer I'm looking for when I put it in, but Arma is going WAY off target.

#

Does Arma run calculations differently than normal?

willow hound
#

Code?

fluid wolf
#

_firevelocity = [(random [-10, 0, 10]), 500 , ((0.0017141388998353 * (_3DDistance * _3DDistance)) + (5.7972119770232 * (_3DDistance)) + 20399.157846253)

willow hound
#

To quote Dedmen:

bla bla when using scalar key bla bla link to wikipedia floating point precision

#

That might have something to do with it at least.
Floating point precision that is.

real tartan
#

looking for filter drivable vehicles from vehicles variable because it also return static objects

fluid wolf
#

what do you mean floating point precision, exactly?

real tartan
willow hound
fluid wolf
#

That I can do

fluid wolf
#

...wait

#

OH, hold on, I might have switched my x and y and that would explain a LOT

austere hawk
#

if i _obj setVariable ["A",1]; deleteVehicle _obj; , then variable A will be deleted and removed from memory automatically, correct?

willow hound
#

Hopefully.

#

Might be possible to test it using an array because those are a reference type, but not sure.
It would be a bit of an oversight if the object varspace didn't die with the object, so I think chances are high that BI took good care of that.

fluid wolf
#

YEP. I found the issue. Was calculating the distance from the distance instead of the speed from the distance. My X and Y were backwards. Oops!

#

thanks for making me see thato ne

willow hound
#

Good, good.

little raptor
austere hawk
#

good, just wanted to be absolutely sure

real tartan
#

_curator addCuratorEditableObjects [allMines, false]; does not work, alternatives ?

fair drum
#

how do you guys like to do "version control" for multiple people collabing on a mission with the editor?

willow hound
#

GitHub?

still forum
#

Git with editor doesn't really work when people work in parallel

#

You can only have one person work on the git repo at a time.
In SVN you would "lock" the file to prevent issues.
In git world, you just have to talk to others and make sure they aren't editing while you are editing

#

It's possible to make a mergable mission.sqm format though with programming stuffz, but I haven't seen anyone do that yet.
Besides me and some others talking about it in discord a year ago

willow hound
oblique arrow
#

Atleast I think it was Zen

still forum
#

But no 3den attributes

austere hawk
#

if server does
player setVariable ["myMap", createHashMapFromArray [["a",1], ["b",2], ["c",3]],false];
how would i later make this variable available to a HC that may join at some point?

#

do i retrieve the hasmpa ref via getvariable and then setvariable again?

still forum
#

[player, ["myMap", player getVariable "myMap"]] remoteExec ["setVariable", HC]

#

Yes

#

But keep in mind that it will transfer the whole Hashmap everytime you do that

#

Btw would be happy if someone can test that out.
I only tested publicVariable to server

austere hawk
#

transfer as in deep copy and not as reference?

still forum
#

Yes

austere hawk
#

so if i _myMap set ["z", 4]; on server at some point after that, it wont affect HC

still forum
#

You can't reference over network

#

It's same as Arrays

austere hawk
#

i remember people mentioning sleeping long time is bad for scheduler. Would this do any good? Or would it just add even more bad stuff?

sleep 120;
//vs.
_t = 120;
waitUntil {
    sleep 1;
    _t = _t-1;
    if (_t<= 0) exitWith {true};
    false;
};
spark sun
#

scheduler is bad prefer unscheduler

austere hawk
#

im asking how to perform long sleep period for loops in scheduled. Cant use unscheduled for endless loops, can you?

spark sun
#

yes you can

austere hawk
#

*with sleep

winter rose
spark sun
#

call it recursively or use a PFH

little raptor
#

Some people don't know what they're talking about. Use the long sleep.

spark sun
#

Agree

winter rose
austere hawk
#

then where does this come from (the "long sleep bad") ? Any validity, or just BS?

winter rose
#

seems bs, IDK where you heard it ๐Ÿคทโ€โ™‚๏ธ

spark sun
#

It is bad to spawn a code taking longtime because it could never end

winter rose
#

if the code needs sleeping, it simply needs to sleep? I don't see what's "bad" in it

austere hawk
#

i think the argument went that if you have lots of loops and all sleep for long time, then the ones you want to have loop on short cycle somehow everything slowed down. Idk.

winter rose
#

a lot of scripts is mostly the issue

little raptor
#

yep

#

the scheduler is "serialized". one code at a time, and each on can only run for 3 ms.

winter rose
#

the scheduler can wait, it doesn't hurt it
you can have one script waiting 1000s
but on the other hand, try having 1000 scripts waiting 1sโ€ฆ most of them will wait for more than that

little raptor
#

the scheduler can wait, it doesn't hurt it
basically when you "sleep" in a scheduler, the script passes its "turn" over to the next script.
If you don't use sleep and use that other method, the script would still execute and consume some of that 3 ms

austere hawk
#

yeah, i didnt feel like this was actually in any way efficient - but i was going by what i heard. Glad i dont have to do that (would seem like major optimisation problem if its somehow worked better that way)

winter rose
#

indeed ๐Ÿ˜„

austere hawk
#

"if you have lots of sleep ing loops, use a HC, call him "waiter" and..."

winter rose
#

HCs should be Workers, not Waiters :p

austere hawk
#

offload all the sleeping to a HC, and run that HC on a phone or smartTV or something

winter rose
#

sleeping is not a load really
having multiple scripts is

austere hawk
#

๐Ÿ˜‰

little raptor
#

Tip of the day:
This is something a lot of beginners do:

[] spawn {
  _handle = [] spawn SomeFunction;
  waitUntil {scriptDone _handle};
  ...//other stuff
};

meowsweats
I hope you haven't done it yet!

but in case someone does that, here's how you do it properly:

[] spawn {
  [] call SomeFunction;
  ...//other stuff
};

because:

Where code starts scheduled
code executed with call from a scheduled environment
https://community.bistudio.com/wiki/Scheduler
long story short, don't ever mistakenly assume that call is unscheduled.

austere hawk
#

nope

little raptor
#

awesome! ๐Ÿ˜„

winter rose
#

waitUntil { sleep 1; scriptDone _handle } of course ๐Ÿ˜›

austere hawk
little raptor
#

actually this is my question too. if an object changes locality, do its (local) vars transfer too?

winter rose
#

unsure about the "cool" no ๐Ÿ˜ฌ

spark sun
#

yea could be bad also ^^

austere hawk
#

then all clients would know that the server calls them names via object variables

still forum
spark sun
still forum
winter rose
still forum
still forum
little raptor
#

I noticed it in a couple of popular SW mods too

still forum
#

The owner of the object can be long gone (disconnect, crash) before the server grabs ownership as fallback.
The old owner can't be able to transfer variables of that object, after he's already gone

open star
#

Would I be able to in-game reset my Zeus? I died and when I try to access Zeus I just get the pings

#

I don't want to have to restart the mission just to get it back, is there something I could write into the console?

little raptor
open star
#

I can't access zeus to even assign it.

little raptor
#

assign it with code meowfacepalm

open star
#

Ahh, yeah that would make sense, well I don't know if my "body" still exists to unassign it though as the server does a cleanup

#

Would th emodule still be there though if the body isn't?

little raptor
#

that's what event handlers are for

open star
#

Because right now the Zeus Module is connected to my SteamID not a body.

little raptor
#

@open star see:
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#MPRespawn
to reassing the curator, you have to do something like:

_curator = getAssignedCuratorLogic _corpse;
unassignCurator _curator;
_curator setVariable ["Owner", getPlayerUID _unit, true];
_unit assignCurator _curator;

I'm not that familiar with zeus but I think this will take care of it

#

just add it to that event handler

#

apparently both of those commands have to be executed on the server

open star
#

Aye I can do that, woudl it change if it weren't connected to a body though, like I said it was attached via SteamID

still forum
#

The vanilla thingy is just bugged-ish

little raptor
open star
#

Yeah I usually use the ACE Respawn and it usually keeps the module intact with my ID

still forum
#

You don't need to change the Owner of you assign anyway

#

And the owner won't have changed anyway

little raptor
#

right

#

I just copied it from one of my codes
it reassigns the curator to a new unit

fair drum
#

I'm struggling with fullCrew atm. I want to pull all of the unit variables out of the array of arrays.

params ["_vehicle"];

private _cargo = fullCrew [_vehicle, "cargo", false];  // [[a,b,c],[a,b,c],[a,b,c]] want all a's

private _crew = [];

{
    _index = _x select 0;
    {
        _crew pushBackUnique _x;
    } forEach _index;
} forEach _cargo;

should I attempt something different?

open star
#

Well I'm not pinging Zeus but I can't get Zeus open ahh xd

little raptor
#

did you try that on the server?

open star
#

Yeah, did a Remote Execution.

still forum
little raptor
little raptor
#

I mean what

open star
#

Oh, Server Exec from the Console

little raptor
#

no I mean what did you execute?

open star
#

Oh I remove some of your code to get it off the player because the body doesn't exist anymore just unassigned it and reassigned it.

little raptor
#

can't you just paste it here?!

open star
#

Oh yeah that might be a good idea sorry I just woke up mate.

fair drum
open star
#
unassignCurator player; 
_curator setVariable ["Owner", getPlayerUID _unit, true]; 
_unit assignCurator player;```
#

I don't know what the code markdown for discord is

winter rose
#

```sqf

open star
#

Yep just clicked pins.

little raptor
#

_unit and _curator are not defined

fair drum
#

quickest fingers in the west lou coming in

open star
#

Lou is always watching me.

little raptor
#

_unit assignCurator player;
what?!

#

player is not zeus

#

player is an infantry object

#

zeus is a module

open star
#

Yes and like I said the body or corpse doesn't exist anymore.

#

Let alone the Module is done with the Owner being my SteamID

#

It's never connected to anything.

little raptor
#

did you by any chance store the module in a variable?

#

if not just search for it

open star
#

No, it's a module in the world

#

I might still have the MPMission I hope I can show you, I guess I'm confused at the moment.

little raptor
open star
#

Oh I know exactly where it's at in the world but there are a total of 5

#

So I just have to find the one with my owner ID?

little raptor
#

yes

open star
#

I'm going to start keeping variables on my modules.

winter rose
#

just don't die :p

open star
#

Ha, AI loves shooting me through trees though annnd using Shilkas

#

:)

#

Which is actually the scary part, walked into a town and got blown into nothing by a Shilka at 30m