#arma3_scripting

1 messages · Page 514 of 1

blissful sand
#

#followme -- if you have gif animations attached to the models and you control the timing on the frame rate would it not give you the ability to give the models more depth? and ease of creation I mean setting textures have always been static yes?

young current
#

wut?

#

what is it you want to do?

blissful sand
#

I want to create a zoo in arma and I want to use gif for the textures to give the animals more of a real look I am asking questions

pale sundial
#

@young current That leaveVehicle command looks like it works. I'll try it now in sequence but I think you may have just solved my problem!

young current
#

@blissful sand you cant use gifs as textures

blissful sand
#

thats what I am talking about -- the question is how does one do that ? now you know why I I am in the scripting room -- think of the quality of the animations and depth of range to do that -- and it makes no sense that it can not be done -- therein the next question where would one start to look it making it work in development

young current
#

its not doable in any performance friendly way

pale sundial
#

Ok, new problem: They get out of the helo and don't get back in, but now they don't board the boat. GIve me a moment to take a look at this.

young current
#

script doing it constantly on mulitple characters at once would start to clog down your framerate

winter rose
#

@blissful sand a local setObjectTexture in loops, yup

young current
#

also each frame needs to be its own textures and materials

#

I dont know what kind of depth you think you could get out of it, but I dont think such works in Armas engine

winter rose
#

@pale sundial assign the boat as the new vehicle?

#

@young current I think it would work, but each setObjectTexture is loaded in video RAM once and for all. If we are talking 5 frames it's ok, if we are talking about 30 frames × 10 different animals… ouch @blissful sand

young current
#

exactly what I meant above

#

@blissful sand do you have an example from some other game where this has been done and what it looks like?

pale sundial
#

currently the waypoint toget them into the boat is:

_wp2 = splashdown addWaypoint [getPos splashdown_boat,2];
[splashdown,3] setWaypointType "GETIN";
_wp2 waypointAttachVehicle splashdown_boat;

//splashdown setCurrentWaypoint [splashdown,3];

#

I'm thinking of uncommenting the setCurrrentWaypoint command and seeing if that fixes things.

#

And I've just seen from my own script that I never assigned them to the vehicle.

blissful sand
#

#followme -- just thinking out loud -- the entire idea comes from wanting to control the frame rate of each image vs an environment variable - as to the 30 frame a second --- in most objects they are symmetrical therein a 15 frame at half second clock and it is not effected if also there is the trigger control and zone code to make sure gif is paused until seen or in frame -- also size of the animated textures are not that large -- example the rabbit moves a set way -- so where is the hair movement or the eye blink for the rabbit ? or the rabbit eating or for that matter even sound he makes as he hops past you -- regarding some other game that is my point I have never seen in first person this is why I am asking and I I do know its not rocket science to add sprite animation tools the question is would not the zoo environment be a best example to display the effects as the animals are the ones with the widest range of motion -- maybe the need to think of a suit of clothing for the soldiers that blinked is another way to think about it -- we add lights to things and control them -- why can me not control the layering of skins of models on the fly? -- thanks for listen --

young current
#

the engine does not natively support textures with frames and that you can not change. so no real gifs can be used.

#

and you can not control tiny parts of the texture either as the models are not created that way

robust hollow
young current
#

yeah for what he wants it to do its not going to work

rugged tangle
#

anyone know of a quick way to check if a magazine is a rifle grenade round?

pale sundial
#

Ok, lets ask a quick stupid question and then I've got to go: If I want ot use assignedVehicle with a group how do I go about that? I've tried "_vehicle = assignedVehicle _group" and "_vehicle = assignedVehicle group _group" but it always throws the error that it's not expecting one. Don't tell me I have to do this for each person in said group.

young current
#

also @blissful sand if you have not looked into what the textures for animals look like, here is an example from the Arma 3 rabbit

pale sundial
#

Demon bunny.

young current
#

you would have to recreate this for each frame

#

it needs an unit

#

you can use the leader for example

pale sundial
#

Ah, fantastic. Cheers.

#

Ok then. Thanks chaps, I'll hopefully see you around.

rugged tangle
#

@young current I don't think that will help me? I'm trying to check which items in a player's inventory are rifle grenades

#

BIS_fnc_isThrowable will detect throwable grenades but what about rifle grenades 🤔

young current
#

you need to get the list of stuff the unit is carrying and check that array list against what you want to find

#

what do you want to do to them?

rugged tangle
#

I'd like to save every rifle grenade type the player has to an array

young current
#

what is the use of the array?

#

are you just counting how many there are or do you want to do something to the specific items

rugged tangle
#

It's an automatic resupply feature. At mission start everything significant in the player's inventory is saved and then the script determines what supplies to provide in a resupply crate

#

It doesn't know how to provide rifle grenades yet

young current
#

so you just need the count?

rugged tangle
#

No, the exact types

young current
#

As Arma does not have rigle grenades by default, are they just like any other magazine?

#

and what do you use to collect the other items

rugged tangle
#

Sorry, by rifle grenades I mean the standard 40mm/UGL rounds

#

That are in vanilla also

young current
#

ah ok.

rugged tangle
#

Maybe. I was thinking since there is no easy to way detect if it is an UGL round, maybe just delete the magazines and normal grenades from the array

#

That should leave only the UGL rounds I think

young current
#

you can test it against the UGL round classnames

rugged tangle
#

Yeah but with mods that's a pretty big list 😛

young current
#

I dont think there is any other way

#

for the engine a magazine is just a magazine

#

it does not separate them into rifle magazines and ugl magazines and so on

rugged tangle
#

Yeah

#

I think I will try with itemsWithMagazines and try deleting everything else from that

#

That should be possible maybe

young current
#

so you want just the grenades in the resupply thing?

rugged tangle
#

Everything else I already got figured out. Just the damn UGL rounds left

young current
#

I assume you have other types of magazines there?

#

how did you pick those?

rugged tangle
#

Just primaryWeaponMagazine

young current
#

it should already give you the grenade mags if the weapon has a launcher

#

and its loaded

rugged tangle
#

Yeah but what if the player has more rounds of different types in his inventory

#

It doesn't provide those

young current
#

ok so you want the rounds that particular weapon can use

#

and how many there are

rugged tangle
#

Yes

#

Example: Player has HE rounds in his launcher + smoke rounds in the inventory. Ideally I'd like both of those to be provided

young current
#

you should be able to read what magaziens the primary weapon can use from the weapon config on runtime and then compare those to what he has in inventory

#

if you want it to be as dynamic as possible

rugged tangle
#

{
    _type = _x call BIS_fnc_itemType;
    if (!(_x call BIS_fnc_isThrowable) && (_type select 1 != "Bullet")) then {
        uglrounds pushBackUnique _x;
    };
} forEach magazines player;```
#

this seems to work

#

@young current

still forum
#

uglrounds = (magazines player) select {!(_x call BIS_fnc_isThrowable) && ((_x call BIS_fnc_itemType) select 1 != "Bullet")};
but that has duplicates. Also global variables should have tags. So like zan_uglrounds to make sure that noone else overwrites your variables, because that's a hell to debug

rugged tangle
#

Yup, will tag it OFC. Just a rough sketch 👍

maiden warren
#

Cheers Connor that works perfectly but how would I add that code to the existing RscEdit?

#

Without the need to create a new one?

robust hollow
#

ud save the real text to a variable instead of a second rscedit, but im off my pc now so cant do an example for that.

dusky pier
#
waitUntil {...}; 
//command is like
onEachFrame
//?
languid tundra
#

certainly not

dusky pier
#

@languid tundra waitUntil is not cycle?

languid tundra
#

Well, the code given {...} is cycled until it returns true.

#

The code is executed in scheduled env. Hence, you can't exactly tell when the next cycle starts. It strongly depends on how large the queue is.

dusky pier
#

@languid tundra thank you!

finite cloud
#

What's the difference between enableFatigue and enableStamina?

winter rose
#

none, they are aliases now

finite cloud
#

Sweet, okay

#

Thanks!

astral tendon
astral dawn
#

@astral tendon
It uses https://community.bistudio.com/wiki/ctrlSetPosition internally... so whatever applies to the UI coordinate system should also apply here

#

[0.5, 0.5] should be the center of the screen

tender fossil
#

How to get cube root of a number? There's only sqrt command

astral dawn
#

Use the power operator 😄

#

|| 27 ^ (1/3) // Returns 3 ||
Or you can use log/exp commands if you are a math guru
|| exp(ln(27)/3); ||

tough abyss
#

I'm guessing this would work for detecting and removing grenades in inventory? call BIS_fnc_isThrowable Would I want foreach magazine player, or are grenades called something else?

tender fossil
#

Ah, you can use power like that?

#

That's nice

#

I mean, I know you can do that but didn't know SQF supports it

tough abyss
#

For a multiplayer game, is it possible to do an addAction on each unit so they can select a loadout, then remove the addAction option so they can only use it once?

astral dawn
#

Yeah I see no problem with that

tough abyss
#

do i just put the addAction on the unit itself though?

#

player addAction ["a useless action that does nothing", {}]; oh, I guess you can

astral dawn
#

yes when you add an action to player on player's computer, it just appears on this player's scroll men u

tough abyss
#

ok, that's what I was thinking

tough abyss
#
if (paramsarray select 9 == 1) then  {    
    {
    _type = _x call BIS_fnc_itemType;
    if (_x call BIS_fnc_isThrowable) then {
    _unit removeMagazine _x;}
    } forEach magazines _unit;
};
#

Looking at that script above, that ^ will remove throwable grenades but not UBGL grenades. What am I looking for to do that?

#

I want ALL grenades removed

astral dawn
#

What's the current good practice for initialization scripts in missions?
Is it possible that in MP player has spawned before server's init.sqf has finished running?
And should I therefore put my initialization into preinit?

robust hollow
#

if your server runs -autoinit and persistent=0 then no, the server init would most likely finish before any player connects, if not then it is possible i guess.
you can put ur server init wherever you want, unless it requires no players are connected it doesnt really matter does it?

astral dawn
#

I am just thinking, how do I not f*** up for sure with so many different situations like if the server starts with players already, or what if a player hosts it, or what if.... something else

#

So I thought maybe there are some basic rules I should follow

robust hollow
#

in ur server init set a variable at the end sqf missionNamespace setVariable ["tag_serverReady",true,true];and in the client init add a sqf waituntil {missionNameSpace getvariable ["tag_serverReady",false]}; or something like that.

It all depends on what ur mission inits actually do, for example one of my MP modes is designed for the server and client init to run at the same time for map voting purposes. It will specifically sit and wait for players to connect before proceeding.

astral dawn
#

Thx, thats a good idea
Maybe if I wrap all my init.sqf into isNil, it will solve this synchronization problem for me?
I'd use preinit but I think I can't access eden-placed resources (objects, markers) in it

robust hollow
#

run the code in preinit instead? preinit is unscheduled.

tough abyss
#

Any ideas on removing UBGL grenades? Or the launcher itself (without referring to a specific item)

robust hollow
#

@astral dawn yep it appears ur right on that one. postinit works but it is scheduled too so up to u really.

ruby breach
#

This should work @tough abyss (if non-vanilla and/or needed for other types of items, you can tweak the find) ```sqf
private _typesOfUGLs = magazines player select {_x find "UGL" > -1};
_typesOfUGLs = _typesOfUGLs arrayIntersect _typesOfUGLs;
_typesOfUGLs apply {player removeMagazines _x};

tough abyss
#

I want to make sure ALL grenades are removed, throwable and launched, using vanilla and RHS.

#

This works fine for throwable grenades but not UGLs

if (paramsarray select 9 == 1) then  {    
    {
    _type = _x call BIS_fnc_itemType;
    if (_x call BIS_fnc_isThrowable) then {
    _unit removeMagazine _x;}
    } forEach magazines _unit;
};```
ruby breach
#

Then just append the _x find "UGL" > -1 check to your existing loop

#

Also, your _type is completely unused, fwiw

tough abyss
#

oh yeah, I copied from an earlier post

ruby breach
#

There also may be a config you can query that'll return something unique for throwable and/or launched grenades, but I'm not sure offhand

tough abyss
#

I want em both gone if the option is ticked, so it doesn't matter to me right now

#

where would I append that UGL line?

#

as an "or" next to the BIS_fnc_isThrowable?

ruby breach
#

Would probably be a good place; since that's what's determining if you want to remove the magazine

tough abyss
#
if (paramsarray select 9 == 1) then  {    
    {
    if ((_x call BIS_fnc_isThrowable) or (_x find "UGL" > -1)) then {
    _unit removeMagazine _x;}
    } forEach magazines _unit;
};```
#

that didn't seem to work

ruby breach
#

That will work for UGL grenades from vanilla. No clue on RHS

tough abyss
#

I tested with vanilla and it left my UGL grenades in my inventory

robust hollow
ruby breach
#

Probably that magazines returns everything in lowercase; in which case you'd need to toUpper _x or look for "ugl" instead

tough abyss
#

so this is saying "if it's a magazine, but not a grenade or a bullet, then it's a UGL"?

robust hollow
#

pretty much yea

tough abyss
#

Ok, neat. I'm guessing because they're technically in a "magazine", finding one UGL round would return the whole stack of that type then

robust hollow
#

either that or gnashes check should work for vanilla mags but modded mags could possibly be missing UGL in their class name, this should catch them too.

tough abyss
#

I must be doing it wrong

if (paramsarray select 9 == 1) then  { 
_uglrounds = (magazines _unit) select {!(_x call BIS_fnc_isThrowable) && ((_x call BIS_fnc_itemType) select 1 != "Bullet")};   
    {
    if ((_x call BIS_fnc_isThrowable) or (_x find "UGL" > -1)) then {
    _unit removeMagazine _x;
    _unit removeMagazine _uglrounds;}
    } forEach magazines _unit;
};
ruby breach
#

_unit removeMagazine _uglrounds; Uhh, about that

#

Error: Type Array, expected String

tough abyss
#

Ohhh it's an array gotcha

#

So how do I run removeMagazine on each item in the array without a big clusterfuck of code?

#

or should I just run a forEach on it

ruby breach
#
private _ugls = (magazines _unit) select {!(_x call BIS_fnc_isThrowable) && ((_x call BIS_fnc_itemType) select 1 != "Bullet")}; 
private _handGrenades = (magazines _unit) select {_x call BIS_fnc_isThrowable};
private _allGrenades = _ugls + _handGrenades;
_allGrenades = _allGrenades  arrayIntersect _allGrenades;
_allGrenades apply {player removeMagazines _x};
tough abyss
#

Ohhhh okay, I see what you did there

#

I don't get the arrayIntersect though

ruby breach
#

It removes duplicates

#
_arr = [1,1,2,2,3,3];
_arr = _arr arrayIntersect _arr;
_arr //[1,2,3]
tough abyss
#

gotcha

#

Works, but it still leaves a grenade loaded in the launcher

#

I see setAmmo....

queen rain
#

guys i added trigger for rearm

#

but i dont wanna ream instantly so how i can slow that down ?

tough abyss
#

sleep

#

I'm pretty sure

#

I thought this would work, buuuuuut

private _ugls = (magazines _unit) select {!(_x call BIS_fnc_isThrowable) && ((_x call BIS_fnc_itemType) select 1 != "Bullet")}; 
private _handGrenades = (magazines _unit) select {_x call BIS_fnc_isThrowable};
private _currentMagazineDetail = (currentMagazineDetail _unit) select {!(_x call BIS_fnc_isThrowable) && ((_x call BIS_fnc_itemType) select 1 != "Bullet")}; 
private _allGrenades = _ugls + _handGrenades + _currentMagazineDetail;
_allGrenades = _allGrenades  arrayIntersect _allGrenades;
_allGrenades apply {player removeMagazines _x};
};
ruby breach
#

Yeah, no

tough abyss
#

haha

ruby breach
#

currentMagazineDetail's return value is gibberish to removeMagazines

tough abyss
#

Oh, have to parse it out first?

#

Oh shit yeah it returns a string

#

The display name for the magazine I guess

#

currentMagazine looks like a ringer

#

I tried the above script I posted with currentMagazine instead of currentMagazineDetail and it broke the whole thing apparently

tough abyss
#

Does this make sense? I want to make sure that OPFOR and BLUFOR aren't the same

_BLUFORfaction = paramsArray select 6;
if (paramsArray select 6 == 12) then {_BLUFORfaction = floor(random 11);};

_OPFORfaction = paramsArray select 7;
if (paramsArray select 7 == 12) then {while { _OPFORfaction == _BLUFORfaction } do {_OPFORfaction = floor(random 11);};};```
robust hollow
#

yea, makes sense

#

you may consider doing something like this instead though, just so you dont need to keep looping until they dont match.

_OPFORfaction = selectRandom([0,1,2,3,4,5,6,7,8,9,10,11]-[_BLUFORfaction]);

the odds of it being an issue are low but this avoids the need for it all together.

tough abyss
#

that makes sense

#

for removing multiple items, isn't there a way to stack things so I can add multiple items to one line, like

removeItems player "ACE_morphine", ACE_elasticbandage";

Do I make it an array right there like this?

removeItems player ["ACE_morphine", "ACE_elasticbandage"];
robust hollow
#

no... the wiki would say so if it did. wouldnt make sense to anyway, thats what things like foreach are made for.

tough abyss
#

I was just wondering if there was an easier way than adding 10 removeItem lines

robust hollow
#

a loop

tough abyss
#

So make an array than do a forEach on it

robust hollow
#
{player removeitems _x} foreach ["ACE_morphine", "ACE_elasticbandage"]```
tough abyss
#

Ohhh that's easier than what I had in mind, thanks man

#

doesn't seem to be working right

{_unit removeItems _x} foreach ["ACE_morphine", "ACE_elasticbandage","ACE_packingBandage","ACE_fieldDressing","ACE_tourniquet","ACE_quikclot","ACE_epinephrine"];

if (paramsarray select 11 == 0) then  { 
_unit additem "ACE_morphine";
for "_i" from 1 to 3 do { _unit additem "ACE_elasticBandage" }; 
for "_i" from 1 to 3 do { _unit additem "ACE_packingBandage" }; 
_unit additem "ACE_tourniquet";
};
#

for context

robust hollow
#

the whole thing or just the top loop?

tough abyss
#

neither really

robust hollow
#

is _unit defined?

tough abyss
#

yes

#

removeItem vs removeItems?

robust hollow
#

🤷 removeItem removes that specific item, removeItems "Removes all items with given template" so perhaps any items that inherit from the provided one? idk. try removeItem its what i would have used.

tough abyss
#

I just did, no luck, I'll try the line by line way

#

yeah, doing it line by line worked fine

robust hollow
#

🤔

tough abyss
#

I have these distances correct, checked in the console, but the removeAllActions doesn't seem to be firing:

//remove loadout switch if player moves too close to center of zone
_loadoutdist = _unit distance startingpos;
waitUntil {_loadoutdist < (zonesize select 0) - 15};
removeAllActions _unit;
robust hollow
#

you only check the distance once...

#

you need to do
waitUntil {(_unit distance startingpos) < (zonesize select 0) - 15};

tough abyss
#

Ohhh ok

astral dawn
#

Are you sure you didn't mess up locality of removeAllActions?

#

But most likely your code gets triggered before your actions is added as Connor said 😄

#

Also consider removing action by its id, not removing all of them, because some mods might add some actions to player

tough abyss
#

how do you get their ID?

astral dawn
#

Check addAction return value

tough abyss
#

The finishing touch: I need to make sure players are spawning inside of this boundary zone, not sure how to go about it

//move respawn points to opposing sides of battle zone
_bluespawn = startingpos getpos [zonesize select 0, random 360];
_dir = [_bluespawn, startingpos] call BIS_fnc_dirTo;
_dist = (zonesize select 0) * (2);
_redspawn = _bluespawn getPos [(_dist) - (10), _dir];

//move intial players spawns to same location
_emptyposwest = _bluespawn findEmptyPosition [2,20,"Man"];
_emptyposeast = _redspawn findEmptyPosition [2,20,"Man"];
{
    switch side group _x do {
    case west: {
        _x setPos _emptyposwest;
    };
    case east: {
        _x setPos _emptyposeast;
    };
};
#

If they're outside the zone for 10 seconds they get killed, and some people take a bit to load in

robust hollow
#

try using inArea?

tough abyss
#

haven't heard of that one, I'll go check it out

robust hollow
#

whats the point of the code block at the end?

#

looks like an error to me 🤔

tough abyss
#

how do you mean? It works whatever it is lol

robust hollow
#
    switch side group _x do {
    case west: {
        _x setPos _emptyposwest;
    };
    case east: {
        _x setPos _emptyposeast;
    };
};```
doesnt have a closing bracket for the block... unless there is more under that snippet
tough abyss
#

oh yeah, it's in a forEach loop

robust hollow
#

i see 👌

tough abyss
#

where would be the best place to use inArea? I figure something like

_emptyposwest = _bluespawn findEmptyPosition [2,20,"Man"];
if _emptyposwest !inArea playZone..... something something
#

How would I loop it to keep searching until inArea == true?

#
while {_emptyposwest inArea "playZone" == false} do _emptyposwest = _bluespawn findEmptyPosition [2,20,"Man"];
robust hollow
#

dont compare a bool to a bool.

#

not a constant bool atleast

#
private _position = [0,0,0];
for "_i" from 0 to 1 step 0 do {
    _position = _bluespawn findEmptyPosition [2,20,"Man"];
    if (_position inArea _zone) exitwith {};
};
#

i would do it in a for loop cause if ur running unscheduled while will exit anyway after 10000 iterations

tough abyss
#

does "step 0" reset it to keep going back to 0 until it exits?

robust hollow
#

kind of. at the end of the loop code it does _i = _i + _step basically. so this would do _i = 0 + 0

tough abyss
#

right

finite cloud
#

I successfully made my first thing today and even though it's totally not a big deal I'm super proud of myself 😄 I've been playing a lot of KP Liberation single-player when my unit's not doing anything, but managing AI squadmates is annoying and tedious, so I made a system that gives me a "Reinforce Squad" action when one or more of my AI squadmates goes down, and activating it respawns the fallen squadmates at the nearest valid spawn point and sends them trekking back to my location. I still need to implement some sort of refillable ticket system and/or maybe a cooldown timer so it can't be abused

astral dawn
#

Congradulations, you've made your first step!
Next step: crash your game by messing up #include path 😄

finite cloud
#

lmao

tough abyss
#

Something broke. My mission gets stuck on the loading screen:

//move respawn points to opposing sides of battle zone
_bluespawn = startingpos getpos [zonesize select 0, random 360];
_dir = [_bluespawn, startingpos] call BIS_fnc_dirTo;
_dist = (zonesize select 0) * (2);
_redspawn = _bluespawn getPos [(_dist) - (10), _dir];

//move intial players spawns to same location
_emptyposwest = _bluespawn findEmptyPosition [2,20,"Man"];
_emptyposeast = _redspawn findEmptyPosition [2,20,"Man"];
{
    switch side group _x do {
    case west: {
        private _positionwest = [0,0,0];
        for "_i" from 0 to 1 step 0 do {
        _positionwest = _emptyposwest findEmptyPosition [2,20,"Man"];
        if (_positionwest inArea boundaryTrigger) exitwith {};};
        _x setPos _positionwest;
    };
    case east: {
        private _positioneast = [0,0,0];
        for "_i" from 0 to 1 step 0 do {
        _positioneast = _emptyposeast findEmptyPosition [2,20,"Man"];
        if (_positioneast inArea boundaryTrigger) exitwith {};};
        _x setPos _positioneast;
    };
};
_rotation = [_x, startingpos] call BIS_fnc_dirTo;
_x setDir (getDir _x)+_rotation;
} forEach allUnits;```
finite cloud
#

It looks like there's an issue with your open/closing brackets

#

Wait nvm

#

The indentation in that paste is confusing

tough abyss
#

here's what I had: ```sqf
//move intial players spawns to same location
_emptyposwest = _bluespawn findEmptyPosition [2,20,"Man"];
_emptyposeast = _redspawn findEmptyPosition [2,20,"Man"];
{
switch side group _x do {
case west: {
_x setPos _emptyposwest;
};
case east: {
_x setPos _emptyposeast;
};
};

and here's what it got changed to:

```sqf
//move intial players spawns to same location
_emptyposwest = _bluespawn findEmptyPosition [2,20,"Man"];
_emptyposeast = _redspawn findEmptyPosition [2,20,"Man"];
{
    switch side group _x do {
    case west: {
        private _positionwest = [0,0,0];
        for "_i" from 0 to 1 step 0 do {
        _positionwest = _emptyposwest findEmptyPosition [2,20,"Man"];
        if (_positionwest inArea boundaryTrigger) exitwith {};};
        _x setPos _positionwest;
    };```
robust hollow
#

i reckon ur suck in the for loop

tough abyss
#

yeah that's what I assumed

finite cloud
#

Yeah step 0 is not going to advance the loop at all, what are you actually trying to do there?

robust hollow
#

it is supposed to exit once it finds a position inside the zone, which it apparently isnt finding.

finite cloud
#

Don't you need some sort of break equivalent to break out of the loop if you're not going to end it with the step/condition combo? (I'm brand new to SQF so I'm probably not being very helpful lol)

robust hollow
#

yea, exitWith

finite cloud
#

Oh, I see it now, my bad

robust hollow
#

exit the loop if the condition is met

tough abyss
#

gotta run out, I'll pester you guys about that when I return

steel acorn
#

does anyone know of a script for opening the nose or tail ramps on aircraft? specifically the c17, c5, c130 and russian and chinese equivalents

robust hollow
#

animateDoor would probably do it

steel acorn
#

how would that effect the other doors?

robust hollow
#

uhh, not at all if you dont specify them to be animated.

finite cloud
#

So I have kind of a general SQF question that tripped me up earlier. I have this function getNearestSpawn, that looks for objects that are designated as spawn points by the mission, builds an array of their positions, sorts them by distance to the player, and returns the first item in the array. But it's possible that this function could get called when there are no valid spawn points on the map, so in that case I was trying to just return false.

In another function, I tried to do a sanity check like this:

_spawnPos = [] call F_getNearestSpawn;

if (_spawnPos != false) then {
    // do the thing
};

But the script was never making it past that conditional even though _spawnPos had an actual value. I ended up changing it to if (count _spawnPos > 0) and that worked, but I'm wondering if there was something weird going on with type coercion with the != false check, or if there's a better way to do that sort of check than what I landed on?

robust hollow
#

https://community.bistudio.com/wiki/a_!%3D_b
!= doesnt compare boolean, and comparing boolean at all is kinda pointless unless both are dynamic

you would have wanted something like this so if it was an array it would continue as normal
if !(_spawnPos isEqualType []) exitWith {};

finite cloud
#

Ahhh, okay

tough abyss
#

is there an elegant way to move a unit forward 10m using setPos?

robust hollow
#

_unit setpos (_unit getPos [10,getDir _unit])

tough abyss
#

hm ok

steel acorn
#

whats this animate door script?

robust hollow
astral dawn
#

Is there some controls style like CT_CONTROLS_GROUP that shows shild controls that are outside of its box?

#

Or maybe there is a better way to achieve what I want to do?
I need to add some statics and buttons to map display. I construct the layout in Arma Dialog Creator, but it exports the whole dialog as... a dialog. I can't create it as display/dialog over map display because the dialog/display will intercept input to map. So to overcome this I inherit from exported dialog class by turning it into a control of CT_CONTROLS_GROUP style, with x=y=0, w=safezonew, h=safezoneh. Now it's a transparent group box with my UI elements where I need them. It still intercepts map mouse input... so I tried to disable it with ctrlEnable false, static elements look fine, but now buttons don't work 😖
Or maybe I overlooked some flag which makes this group box show everything that is outside of its box??

robust hollow
#

why dont you just add controls to the map display?

astral dawn
#

I was trying to find a way where I can easily redo these buttons in the Arma Dialog Creator without manually copy-pasting pieces of code

robust hollow
#

it would need to be by script, but it would work. alternatively you can do createDialog with the map display open.

astral dawn
#

So that I only need to copy the .h files

#

Yeah I know that adding plain controls to map display works... if only arma dialog creator could export individual group boxes 😄

#

But createDialog will also intercept mouse input from the map because it's drawn at the top of the map?

robust hollow
#

to come back to the initial question for a second, to my knowledge there is no way to show controls outside the boundaries of its parent control group.

astral dawn
#

Also I would be able to close it with esk?

robust hollow
#

you can set a keydown evh to block esc

astral dawn
#

Hmm... let me try...

robust hollow
#

_display displayAddEventHandler ["KeyDown",{_this#1 == 1}];

astral dawn
#

No... createDialog over map intercepts scroll, mouse clicks on the map, etc

robust hollow
#

what was the desire for showing controls outside the parent boundaries?

astral dawn
#

The idea was this:
I inherit from the class inherited from export result of dialog creator. Dialog creator positions all the controls relative to safezoneX/Y/W/H.
So I'd create a group box (because it supports controls class inside it) positioned at [0, 0] which occupies whole screen. So all positions from the exported dialog would match the positions that I need.

#

Actually this has a flaw... if I set the group box position to [0, 0] it won't show controls that are supposed to be above [0, 0] and to the left of [0, 0]. Damn xD

robust hollow
#

yea. as annoying as it is, scripted buttons are the easiest way to go imo

astral dawn
#

Maybe I can iterate through the exported class manually with ctrlCreate? I'd just need to tell it to grab control class not from mission config root, but from elsewhere?

robust hollow
#

that would work, sounds like a bit more effort but definitely possible 👍

wanton swallow
#

Hi all. There is a troubles in arma with displaying of remote objects (which was created on remote host): all modifications does applying on others hosts with big latency.
When host of object make position change of object or rotate it, other player see these only after several seconds...
How to fix this behavior and display all actions immediately? Like it works with guns and cars..

astral dawn
#

What do you mean Predator? What kind of objects?

robust hollow
#

sounds a bit like what happens with zeus objects. there is a slight delay between you moving an object and the new position/orientation broadcasting.

astral dawn
#

No @robust hollow it looks like ctrlCreate only accepts classes that are right in the root of config or mission config >_<
It looks like I will have to do it like this:
Check what config class given button/static inherits from (this resource must be in mission config) then use ctrlCreate on this config , then set other properties with ctrlSetXXX commands

robust hollow
#

oo yea i knew that, misunderstood what you said earlier 🤦

astral dawn
#

Unless there is a hidden way to tell ctrlCreate take config from elsewhere... 🤦

wanton swallow
#

@astral dawn any custom object like this...

#

Is it depends of object class and cfg?

#

Look on the picture. When host of the object order character to land this object on the ground and change object pos set[2, 0], then this host see result immediately.
But other player can to watch result after a several second. Object stands in the air.

tough abyss
#

@wanton swallow different objects have different network simulation frequency, i.e. some update more often then the other. I take it that this is not PhysX object, as it doesn’t fall down if you setPos above ground?

wanton swallow
#

@tough abyss it doesnt fall.

#

So which of all this conclusion

tough abyss
#

Then it is not meant to be updated frequently

wanton swallow
#

Must it object contain a correct config or what?

tough abyss
#

Hence network delay in updating

#

Yes

wanton swallow
#

Ok thank you

tough abyss
#

Try some vanilla assets some are PhysX and see if they work better

#

Then you can rip off config from those

cedar heart
#

i have a script :

_loot = nearestObject [bot, "WeaponHolderSimulated"];

while {primaryWeapon bot == "" && handgunWeapon bot == "" } do {
  sleep 2;
  bot doMove (getPosATL _loot); 
     waitUntil {bot distance _loot < 6};
          _box = (bot nearObjects ["WeaponHolderSimulated", 6]) select 0; 
         _boxContents = weaponCargo _box;
         _weapon = _boxContents select 0;          
         bot action ["TakeWeapon", _box, _weapon];
         sleep 2;
         bot action ["rearm", _box];
   sleep 5;
};```
the thing is if nearest Weapon Holder Simulated didn't exist (no container) unit start moving to nowhere and run far away on empty scenario, how can i make conditions right like if there is no weapon nearby?
queen cargo
#

uhm ... check if _loot is null or not?

#

like ... literraly do:

if isNull _loot exitWith { /* be done you foolish bot */ };```
cedar heart
#

yeah thank you it work )

queen cargo
#

in case somebody is bored, solve this in SQF:

But for multiples of three print “Fizz” instead of the number
and for the multiples of five print “Buzz”.
For numbers which are multiples of both three and five print “FizzBuzz”."```
queen cargo
little ether
#

Quick double check past you all to check I'm not crazy... this should work in an AI's INIT right? To make them permanently stand up?

_this setUnitPos "UP";

winter rose
#

nope; _thisthis @little ether

tough abyss
#

Is SQF very hard to learn?

queen cargo
#

not really

tough abyss
#

alright

#

is posting pics not allowed here?

winter rose
#

@queen cargo this?

for "_i" from 1 to 100 do {
    private _is3m = (_i % 3 == 0);
    private _is5m = (_i % 5 == 0);
    switch (true) do {
        case (_is3m && _is5m): { systemChat "FizzBuzz"; };
        case (_is5m): { systemChat "Buzz"; };
        case (_is3m): { systemChat "Fizz"; };
        default { systemChat str _i; }
    };
};
queen cargo
#

👍 😉

winter rose
#

I don't play the minify code challenge :p

#

@tough abyss not allowed indeed, but you can link to a hosting site as much as you like

ruby breach
#

Ahh, missed the last condition

tough abyss
#

ok ill look

#

because i started ydah

#

yday*

#

and am trying to make smth and idk if i have errors

tough abyss
#

Missing ; after _configs

tough abyss
#

thank u

austere granite
#

also after the addAction line

#

btw usually good to include linenumbers 😄

ruby breach
#

Even better to use pastebin and not pictures

austere granite
slim oyster
#

What is the effective difference between getClientState "BRIEFING READ" and getClientState "BRIEFING SHOWN", aka pressing the continue button in a MP briefing? It seems to propagate certain things like player gear state to other clients. Is there any good documentation of this around? I am attempting to propagate the client gear state to all other clients while in MP briefing.

tough abyss
#

Sorry for that, it was just a picture I had laying around

vapid drift
#

is it possible to make a static object affect a players camo level the way putting on a ghillie suit does? Or at least affect detection in a similar manner?

young current
#

no I dont think so

#

you can only block the line of sight

#

well trees/bushes and the sort do have a "see through value" that can be set in geometry lod named properties

tough abyss
#

for some reason my list is empty even though i have code to fill it with stuff

#

{
    _name = getText (_x >> "displayName");
    _classname = configName _x;
    _index = _ctrl lbAdd(_name);
    _ctrl lbSetData(_index, _classname);

} forEach _configs;
#

is smth wrong here

nocturne bluff
#

try it?

#

Run in the debug console without the controls stuff and you will find out

tough abyss
#

seems like the _name doesnt get the displayname

austere granite
#

_ctrl lbSetData(_index, _classname);

#

this is wrong

#

_ctrl lbSetData [_index, _classname];
All list arguments in arma use square bracket lists, not parentheses/tuples/whatever

tough abyss
#

oh thta must be it

austere granite
#

same thing with lbAdd, in normal languages you'd use func(args). In arma it's usually _target function [args]

tough abyss
#

alright thank u

velvet merlin
#

is there a way to read/intercept incoming chat messages?

still forum
#

incoming no

#

is written to the display from engine

velvet merlin
#

that display would only needed to be exposed (or more precisely its text control), no?

#

DisableChannel only works for player messages, doesnt?

still forum
#

I don't know if it's a normal text box control. I assume it's not

austere granite
#

its not

still forum
#

I guess there is a reason why everyone has been failing to do what you are asking.
We got chat message sent eventhandlers which are also quite the hack.

neon snow
#

I've set three jets to fly in formation, I've set their altitude to 2600. I've set to each flyinHeightASL 2600. Why are they flying up and down?

winter rose
#

they avoid birds

high marsh
#

@still forum Assuming they press enter and the dialog is closed, cant you say that the message has been sent? Seeing as how we have no control over lower level network stuff.

still forum
#

Yes

#

That's how the message sent eventhandler works

high marsh
#

Ok. Do you also in this set of ehs have something that can parse the text that is being entered?

still forum
#

yes.

high marsh
#

Woah. CBA?

still forum
#

yes...

high marsh
#

Yes!

neon snow
#

So no possibility to make those jets fly at constant altitude?

astral dawn
#

Im not an expert in this but you can pre-record vehicle movement

#

Wait, are they in same group actually?

neon snow
#

no

astral dawn
#

so... try make them join the same group?

#

and set behaviour to safe or careless

neon snow
#

will do

#

nope

#

they still fly up and down

neon snow
#

never actually seen that

high marsh
#

It's been in since tac ops

neon snow
#

will try that , much appreciated

vapid drift
#

@young current Do you know off hand where I find the "see through value" for the geometry lod?

young current
#

Arma3 named properties wikipage

#

lodDensityCoef migth be whats it called

winter rose
#

viewdensitycoef is what you want, it seems

burnt cobalt
#

does anyone know why this will only work in SP:

MCSS_Guided_BulletHandler = {
    private ["_var","_target"];
    _veh = _this select 0;
    _weapon = _this select 1;
    _ammo = _this select 4;
    _projectile = _this select 6;
    _var = _veh getvariable "MCSS_C2_REMOTE_HANDLE";
    _target = _var select 1;
    if (isNil {_target}) exitWith {};    
    _vel = velocity _projectile;
    _length = sqrt((_vel select 0)*(_vel select 0) + (_vel select 1)*(_vel select 1) + (_vel select 2)*(_vel select 2));     
    while {alive _projectile && alive _target} do 
    {
        _dir = getPosATL _projectile vectorFromTo (getPosATL _target);
        _vel =  [(_dir select 0) * _length, (_dir select 1) * _length, (_dir select 2) * _length];
        _projectile setVelocity _vel;
        sleep 0.1;
    };
};

_vehicle addEventHandler ["FIRED",{_this spawn MCSS_Guided_BulletHandler}];
vapid drift
#

ah there we go... another wiki page I need to book mark. Thanks

#

@young current viewdensitycoef is the winner

young current
#

ah was close

vapid drift
#

yup

#

we'll see how it goes now

winter rose
#

@burnt cobalt where do you set the addEventHandler?

burnt cobalt
#

i hope i understand you correctly - the machine executing the addEventhandler command is the server in MP

#

everything fires, but any commands addressing _projectile have no effect

#

@winter rose

winter rose
#

which… makes me think that I rely on it in some of my missions

burnt cobalt
#

hmm i'm confused. it seems that it does fire, if I include systemchats like (str _projectile) remoteExec ["systemChat",0] , I do get those messages on my client

#

it's just that setVelocity does not seem to have an effect

#

but I would think the EH fires

tough abyss
#

What projectile is?

burnt cobalt
#

In SP it works with any projectile, in this case it's an attack heli's MG

#

correction, it does not work well with missiles

tough abyss
#
NK_giveGun =
{
   removeAllWeapons player;

   _ctrl0 = (findDisplay 9998) displayCtrl 1500;
   if ( _ctrl0 lbText[lbCurSel _ctrl0] == "Mk18") then { player addWeapon "srifle_EBR_F"; _classname = "srifle_EBR_F"; };
   if ( _ctrl0 lbText[lbCurSel _ctrl0] == "MK-1") then { player addWeapon "srifle_DMR_03_F"; _classname = "srifle_DMR_03_F"; };
   if ( _ctrl0 lbText[lbCurSel _ctrl0] == "MXM") then { player addWeapon "arifle_MXM_khk_F"; _classname = "arifle_MXM_khk_F"; };

   if (player hasWeapon _classname) then {hint "Success!"; };
   closeDialog 9998;
};

I'm receiving a General error 😦 Anyone could help me out? sorry for bugging you all

#

ok fair enough xd

#

@burnt cobalt setVelocity works on local instance of object and some projectiles are local everywhere. Best thing is to replace fired projectile with custom of the same type then you get global object you can control from the same pc you created it on

burnt cobalt
#

i did try that before - somehow that made the bullet remove it's tracer and in MP the bullets went haywire

#

I will keep trying though - but I'm not just messing up locality or something?

tough abyss
#

Maybe you placed it backwards? You can’t see tracer if it is facing you

#

You need to store fired projectile type, world pos, vector dir and up and velocity and recreate it then set all that back, did you do that?

#

Did ya?

burnt cobalt
#

yes i did all of that

#

but still, what you say with the bullet ending up the wrong way makes sense with what I observed

#

which is weird because I though setVectorDirAndUp would prevent that

tough abyss
#

I'm having trouble firing this, syntax error? I cut out the identical middle cases to post

if (_loadoutParam >= 3) then
{
    switch (side group _unit) do {
    case west: {
        _unit setUnitLoadout (bluforloadout select 0);};
    case east: {
       _unit setUnitLoadout (opforloadout select 0);};
    };
    
    hint format ["removing weapons, %1",player ];
    removeAllWeapons _unit;
    
    switch (_loadoutParam) do {
    case 3: {
        _unit addMagazines ["16Rnd_9x21_Mag",10];
        _unit addWeapon "hgun_P07_F";
    };
    case 4: {
        _unit addMagazines ["6Rnd_45ACP_Cylinder",10];
        _unit addWeapon "hgun_Pistol_heavy_02_F";
    };
 
    case 10: {
        _unit addMagazines ["LOP_10rnd_77mm_mag",10];
        _unit addWeapon "LOP_Weap_LeeEnfield";
    };
    
    };
    [_unit] execVM "equipmentRestrictions.sqf";
};
[_unit] execVM "equipmentRestrictions.sqf";
astral dawn
#

How do I make static text with vertical scroll bar if not all text fits into the box?
I know groups control has vertical scroll bar. Is it the only way to get vertical scroll capability?

ruby breach
#

Not a syntax error, but hint format ["removing weapons, %1",player ]; is gonna be gibberish

tough abyss
#

I just wanted a hint to see if it was even firing

robust hollow
#

@astral dawn you can perhaps try adding a VScrollBar to the text control in the dialog config, however i dont believe it will work. I would go the control group method.

ruby breach
#

@tough abyss What does your RPT say?

astral dawn
#

Thanks Connor. Arma Dialog Creator doesn't have group control support >_< meaning I need to mess with inheritence again... why is all UI such a pain in this game...

tough abyss
#

@ruby breach not much

"28 C:\Users\Owner\Documents\Arma 3 - Other Profiles\Axebeard\mpmissions\ACTION_Arma(Altis)_v10.Altis\initServer.sqf"
15:34:21 "58 C:\Users\Owner\Documents\Arma 3 - Other Profiles\Axebeard\mpmissions\ACTION_Arma(Altis)_v10.Altis\initServer.sqf"
15:34:21 "1 C:\Users\Owner\Documents\Arma 3 - Other Profiles\Axebeard\mpmissions\ACTION_Arma(Altis)_v10.Altis\initPlayerLocal.sqf"
15:34:21 [ACE] (common) TRACE: 378476 Reading missionConfigFile params: _paramsArray=[0,99,74,5,0,0,12,12,3,0,0,1,0] z\ace\addons\common\functions\fnc_readSettingsFromParamsArray.sqf:23
15:34:21 [ACE] (common) TRACE: 378476 ace_setting: _title=Medical Level, _settingName=ace_medical_level, _settingValue=1 z\ace\addons\common\functions\fnc_readSettingsFromParamsArray.sqf:32
15:34:21 [ACE] (common) TRACE: 378476 setSettingMission from paramsArray: _settingName=ace_medical_level, _settingValue=1, _return=true z\ace\addons\common\functions\fnc_readSettingsFromParamsArray.sqf:65
15:34:21 [ACE] (common) TRACE: 378476 ace_setting: _title=ACE Prevent Instant Death, _settingName=ace_medical_preventinstadeath, _settingValue=0 z\ace\addons\common\functions\fnc_readSettingsFromParamsArray.sqf:32
15:34:21 [ACE] (common) TRACE: 378476 setSettingMission from paramsArray: _settingName=ace_medical_preventinstadeath, _settingValue=false, _return=true z\ace\addons\common\functions\fnc_readSettingsFromParamsArray.sqf:65
15:34:21 [ACE] (common) INFO: Settings initialized.
15:34:21 [ACE] (advanced_ballistics) INFO: Terrain already initialized [world: Altis]
15:34:21 [ACE] (common) INFO: 40 delayed functions running.
15:34:21 "2 C:\Users\Owner\Documents\Arma 3 - Other Profiles\Axebeard\mpmissions\ACTION_Arma(Altis)_v10.Altis\assignLoadouts.sqf"
15:34:22  Mission id: 8ef004ae64bcc5c39b62638a8d9bcc80b56d74a7
#

That's the only script it identified, is it trying to tell me it's running twice or something?
"2 C:\Users\Owner\Documents\Arma 3 - Other Profiles\Axebeard\mpmissions\ACTION_Arma(Altis)_v10.Altis\assignLoadouts.sqf"

#

actually I got it working, I had to call the script that sets the initial loadouts right at the top of the the one I posted. Weird because that's supposed to be happening earlier anyway

robust hollow
#

is it trying to tell me it's running twice or something?
no, thats this debug log from yesterday telling you what line it made it to in the file

diag_log format["%1 %2",__LINE__,__FILE__];
burnt cobalt
#

@tough abyss I got it! I think I'm overcomplicating it quite a bit but I made designated functions to add and remove the EH, run it on every machine, and exit if the vehicle is not local. Works both ways, but I did actually go back to the deleting/respawning of projectiles - the tracer really disappears no matter where I look - it's strange, but since the 'guided' velocity creates a weird flightpath for the projectile i i almost prefer it this way

tough abyss
#

Do tracers need to fly at certain speed? Since you alter velocity maybe this affects it

finite cloud
#

Ugh... I'm trying to make my first addon (as opposed to a mission) and I'm having a hell of a time getting literally anything working. This is what I have right now:

// config.cpp
class CfgPatches
{
    class AICnC
    {
        units[] = {};
        weapons[] = {};
        requiredAddons[] = {};
        author[] = { "Spectre" };
    };
};

class CfgFunctions
{
    class AICnCLaunch
    {
        class AICnC_Initialization
        {
            class Init
            {
                file = "init.sqf";
                postInit = 1;
            };
        };
    };
};
// init.sqf
[] spawn
{
    sleep 2;
    
    while { true } do
    {
        systemChat "Init is working!";

        sleep 10;
    };
};

Trying to test it out by either starting one of the showcase missions or running a mission from the editor but I'm never seeing the "Init is working" system chat. What am I missing here?

robust hollow
#

file = "init.sqf";
the file path should also have your addon prefix

finite cloud
#

Ahhh okay... how do I set the addon prefix? Is it just the name of the directory/PBO in addons?

robust hollow
#

it can be whatever you want. what tool are you using to pack ur pbo?

finite cloud
#

The one that comes with Arma 3 Tools, Addon Builder

robust hollow
#

in the options menu set "Addon prefix" to whatever you want. for this test i say just use AICnC. then ur init file path would be file="\AICnC\init.sqf";

finite cloud
#

Gotcha, I'll give that a shot. Thank you!

#

Still no dice unfortunately :/

tough abyss
#

I want my players to start in a safezone until the intro cam is done (because AI). I have all units set to allowDamage false in my initServer, is initPlayerLocal an ok place to set allowDamage true again?

#

Or otherwise, how could I do a countdown to trigger it

robust hollow
#

u need to set allowDamage false one each player individually when they load in, not once on the server

#

@finite cloud how are you loading ur mod?do u have the right filestructure? @mod\addons\every.pbo?

finite cloud
#

Yeah, exactly that. I just added it as a local mod in the Arma 3 launcher

robust hollow
finite cloud
#

Oh wow

#

With exactly the same code I posted above?

robust hollow
#

yep. only edit was fixing the filepath

finite cloud
#

Did you use something other than AICnC for the prefix?

robust hollow
#

no. i did exactly the same thing

#

if u want dm me ur pbo ill take a look at it

finite cloud
#

Well fuck me, I just changed the prefix to "test" and now it's working

robust hollow
#

🤔

finite cloud
#

I was worried about either a conflict with the CfgPatches class name or maybe just using capital letters so I figured I'd try that, before you answered my last

#

But no idea why AICnC worked for you but not for me

robust hollow
#

itl show a warning about duplicate class names.

finite cloud
#

Ahh okay, yeah I didn't get anything about that

#

Maybe it was just the act of deleting the old PBO and adding the new one that refreshed it or whatever

#

Idk, it works now so I'm happy, thank you so much!

robust hollow
#

👍

vapid drift
#

So I'm sort of looking for some advice on the logic here... in order to make the camo netting I've been working on function the way I want it to, I plan to have it switch the player to captive while they're within a certain range along with a sort of shot fired cooldown.
Is there a more efficient way of handling the shot cooldown than just using an eventlistener and starting a timer everytime the player fires a shot?

robust hollow
#

dont fully know what ur trying to do so not sure if this will apply to it or not but i usually do cooldowns just setting a variable.
eg: myCooldown = diag_tickTime + 15; // 15 second cooldown
and then check the variable anywhere else i need
if (myCooldown > diag_tickTime) exitWith {}; // not cooled down yet

vapid drift
#

I guess what I'm trying to figure out is a better way to initiate the cooldown than everytime the player fires a shot. It seems like that would unnecessarily gum up the works when you're not using the camo net

#

like I said though, I'm just looking at the logic of it all right now

robust hollow
#

would this be a spawned cooldown or something?

vapid drift
#

I'm not sure? I would think no... because then I could end up with hundreds or thousands running at once

#

I think the single variable you mentioned would be the best route and just resetting the count everytime

robust hollow
#

there is ways to avoid mass threads but anyway, still not sure im understanding the objective. im good for about 3 hours in the morning and then i progressively get dumber 😛

#

here is a way to prevent spawning loads of new threads:

// fire evh
terminate (missionNameSpace getVariable ["myThread",scriptNull]);
myThread = [] spawn {
    uisleep 15;

    /* stuff */
};
vapid drift
#

oh ok, I've never seen that before

torpid grail
#

Is there a way to get the "Ended" mission event to trigger? Or is there another way I can check when the mission ends? Because right now, no matter what I do the "Ended" event is never triggered

robust hollow
#

it should fire when you use endMission, BIS_fnc_endMission or the endmission cheat.

torpid grail
#

I tried that but it never fired, neither on the dedicated server nor on my local machine, even when I added the event handler mid-mission

#

The "EntityKilled" event works but for some reason the "Ended" one doesn't

robust hollow
#

this worked for me. the log is in my rpt. what are you trying to do with it?

addMissionEventHandler ["Ended",{
    diag_log format["Ended: %1",_this];
}];

endMission "loser";
torpid grail
#

Mine is just this:

addMissionEventHandler ["Ended", {
    diag_log "Mission ended";

    //timestamp
    TBT_const_extensionName callExtension ["missionEnded", [
        time
    ]];
}];

I'll try it one more time without the extension call and see if that is the problem

#

Same thing, nothing on the rpt log. I can see the extension being loaded and all the calls and I have the log of all the calls made to it but the "Ended" event handler never runs

robust hollow
#

would it be possible to call the extension before you end the mission?

#

or, is it ending from all players dead or something like that?

torpid grail
#

Yeah, as long as it is called consistently before the end of the mission I don't really care about losing those last few seconds of data. It'll spam the log file with errors but I'm just trying to get it to work now

#

I've ended the mission with the default scenario end zeus module and by using the Achilles "Execute Code" module and calling endMission and with both the Ended event didn't get triggered

robust hollow
#

zeus module works for me too.

#

which it should, it uses BIS_fnc_endMission

#

are you sure the eventhandler is even being set?

torpid grail
#

Pretty sure, here's what I'm running on postInit:

["ace_unconscious", {
    params ["_unit", "_isUnconscious"];
    private _unitID = _unit getVariable TBT_const_unitIDVarName;

    TBT_const_extensionName callExtension ["unconsciousStateChanged", [_unitID, _isUnconscious]];
}] call CBA_fnc_addEventHandler;

addMissionEventHandler ["EntityKilled", TBT_fnc_entityKilled];


addMissionEventHandler ["Ended", {
    diag_log "Mission ended";

    //timestamp
    TBT_const_extensionName callExtension ["missionEnded", [
        time
    ]];
}];

//WorldName, missionName
//No need for timestamp since it will be 0
TBT_const_extensionName callExtension ["missionStarted", [
    worldName,
    missionName
]];

[] spawn TBT_fnc_updateLoop;
robust hollow
#

not sure what to say about that tbh. only thing i can think of is a conflicting mod but that doesnt seem to make much sense either 😕

torpid grail
#

Yeah, I have no idea why it wouldn't work. Could it be that addons aren't allowed to register that event for some reason? I've just tested it in SP and it worked fine

#

I don't understand why it wouldn't work on a dedicated server

junior stone
#

does someone know how to block the tacticalview?
tried keydown and that works in some way...but if you bind the tacticalview to your mouse it will not block it

robust hollow
#

@junior stone

(findDisplay 46) displayAddEventHandler ["MouseButtonDown",{inputAction "TacticleView" > 0}];

have you tried something like this? it works for me.

junior stone
#

good idea

unborn ether
#

@robust hollow MouseButtonDown does not override mouse action. inputAction also do not recognize some complex binds like CTRL+SHIFT+whatever

#

This being and issue since forever

robust hollow
#

aww rip. just noticed it isnt even spelt right in the snippet i posted so dont know why it appeared as working. ah well 🤦

junior stone
#

yep that isnt working

#

sadly 😐

#

tried it

robust hollow
#

a far less desirable alternative is to spawn something like this

for "_" from 0 to 1 step 0 do {
    waitUntil {cameraView == "GROUP"};
    player switchCamera "EXTERNAL";
};

i dont know if tactical view is the only view to use the name "GROUP" though.

compact galleon
#

According to the WIKI, it is

#

well, "commander view"

junior stone
#

that would work

#

thx

tough abyss
#

can you pass a variable to something in description.ext, or have it read a variable? I have 2 endings "Opfor wins" and "Blufor wins" but I'd like to get it show the faction name I set earlier.

high marsh
#

@tough abyss CfgDebriefingSections allows you to insert variables to each debriefing section

#

There are preprocessor macros like __EXEC available as a part of your description.ext

tough abyss
#

neat thanks

azure portal
#

I'm getting a weird thing where a teleport script I wrote into an object init is only coming up as an option about 5m away from the object itself

#

Any ideas for how to fix it?

next scaffold
#

hey! Is there a way to force the player to only move his head (like he was holding alt) and then enable normal movement again?

compact galleon
#

@next scaffold You can use switchMove with an idle animation

next scaffold
#

I'm using that but the character is turning his entire body when looking around

tough abyss
#
NK_giveGun =
{
   removeAllWeapons player;

   _ctrl = (findDisplay 9998) displayCtrl 1500;
   _gun = _ctrl lbText[lbCurSel _ctrl];
   if ( _gun isEqualTo "Mk18") then { player addWeapon "srifle_EBR_F"; _classname = "srifle_EBR_F"; };
   if ( _gun isEqualTo "MK-1") then { player addWeapon "srifle_DMR_03_F"; _classname = "srifle_DMR_03_F"; };
   if ( _gun isEqualTo "MXM") then { player addWeapon "arifle_MXM_khk_F"; _classname = "arifle_MXM_khk_F"; };

   if (player hasWeapon _classname) then {hint "Success!"; };
   closeDialog 9998;
};

I get a generic error in expression. New to scripting so idk what i'm doing wrong, anyone could kindly help? thank u!

still forum
#

_classname is undefined

#

you are defining _classname inside the then {...} scope. And it then goes out of scope and disappears

#

Add a _classname = "" after your _gun definition

tough abyss
#

good point, I forgot abt that

#
_ctrl = (findDisplay 9998) displayCtrl 1500;
   _gun = _ctrl lbText[lbCurSel _ctrl];
   _classname = "";

According to in game, generic error is in this area

still forum
#

Also read the rest of the error message too

#

It says "got array expected number"

tough abyss
#

hm... now i gotta think how im gonna work this out, thanks a lot though

#

Read wiki <https://community.bistudio.com/wiki/lbText> waste of time, already told him before @still forum

still forum
#

how im gonna work this out The wiki tells you how. You just have to read

tough abyss
#

im sorry guys im new to scripting 😃

still forum
#

And you're never gonna stop being new if you don't start to read the wiki

tough abyss
#

I do read the wiki, just sometimes it's not directly clear to me

#

I got it right this time, sorry for any incovinience caused! 😃

queen cargo
tough abyss
#

[x] a = 11 b = -7

#

Did I pass?

queen cargo
#

@tough abyss that is actually a serious problem

tough abyss
#

No, people not reading wiki is

#

But if you are talking about people not being wired correctly for programming, what can you do, not everyone is Picasso

finite cloud
#

Do groups maintain any sort of list of units they know about? I know you can check _group knowsAbout _unit, but is there any way to retrieve an array of units that a particular group knows about without looping through every unit in the world and making that check?

astral dawn
#

Yes

#

targetsQuery is your friend

finite cloud
#

Yessssss thank you!

astral dawn
#

Be careful with the target age parameter
I found it more useful to query targets with any age, then filter out those are below threshold
If you ask this command to filter target age for you it does something wrong, don't remember what exactly

finite cloud
#

Gotcha

#

Does "age" in this case refer to how long the target has been alive, or how long the target has been known about?

astral dawn
#

Age is time since the target was last observed

finite cloud
#

Ahh okay

astral dawn
#

But t can be negative
But not lower than -1
-1 means the target is observed right now

finite cloud
#

Gotcha

astral dawn
#

Also side it returns is actually perceived side, so when AIs are not sure about unit's side they report civilian or unknown as I recall

finite cloud
#

Ooh okay, good to know

astral dawn
#

@tough abyss
b = 20
a is unknown
Because what if they were doing parallel assignment?? Doesnt compile xD

finite cloud
#

Is there any way to enable the multiplayer "Chat" command in a single-player mission? I'm using systemChat to log debug info and I'd like to be able to page up/down through the message history, but the "/" key doesn't work

Or maybe a better question: is there a better way to access the information I need than systemChatting everything? lol

digital hollow
#

diag_log

astral dawn
#

use program called snakeTail because it can live-update logs

#

that's how I do it

#

also consider installing Dedmen's armaDebugEngine... or how was it called.... to dump callstack/variable info on scripting errors

still forum
#

Notepad++ can also tail. I use BareTail for that tho

tough abyss
#

Why vectorUp of a bush is not normalised? vectormagnitude vectorup (nearestTerrainObjects [player, ["Tree","Bush"], 10] select 0); 1.23

queen cargo
#

why should it be?

tough abyss
#

same for vectorDir

#

because normally it is

mild pumice
#

Hi guys. Is there a more reliable way to save and load the inventory of a player when he joins/disconnects from the server, than getUnitLoadout and SetUnitLoadout ?

#

Because sometimes, getUnitLoadout between my client and the server, does not return the same result

robust hollow
#

cant say ive ever had that problem 🤔 if you feel better about it you can manually save a loadout with all the individual commands

mild pumice
#

well, actually my problem may not be related to getUnitLoadout.. I just tried to diag_log (getMagazineCargo backpackContainer unit) , and the output for client/server is different 😦

astral dawn
#

Which one is the correct then?

mild pumice
#

local

#

i put some magazines in a crate, then diag_log

#

the server still shows the mags in the backpack

robust hollow
#

is the server showing different items or no items?

#

so whats the difference between the two?

mild pumice
#

i have 0 mags in my backpack right now, logs are fine on the client (backpack empty), but the server still see the mags which i just put in a crate

tough abyss
#

How did you put the mags via inventory or script?

mild pumice
#
_who = if(isDedicated) then {"SERVER"} else {"PLAYER"};
diag_log format["%1 || inventory : %2",_who,(getMagazineCargo backpackContainer civ_6)];

exec global

tough abyss
#

Are you using mods?

mild pumice
#

i just right click on it

#

yes i have mods

tough abyss
#

What if you drag them

#

And how soon are you executing after you put them in container?

#

Does the server catch up eventually?

#

How many people on the server?

#

Maybe some mods spam network causing delay

#

What is FPS in the server?

mild pumice
#

same problem when i drag , i'm alone, it's a test server

#

1:10:45 "PLAYER || inventory : [[],[]]"
1:10:45 "SERVER || inventory : [[""RH_7Rnd_45cal_m1911""],[3]]"

tough abyss
#

Is it just backpack problem or any container?

#

Vest, uniform?

mild pumice
#

seems to happen only with backpacks

tough abyss
#

Are they mod backpacks?

mild pumice
#

nope : "B_Carryall_oli"

tough abyss
#

I will test tomo

astral dawn
#

Are you going to save loadout in server's profile namespace or on client's profile namespace?

#

If it's broken on server side then you could send player's gear to the server when he disconnects, the nserver will save it

mild pumice
#

you mean with onPlayerDisconnected ? because that's what i do, and it's serverside so it's broken

tough abyss
#

Does it happen if you drop mags on the floor?

mild pumice
#

yes , same problem on the floor 😦

astral dawn
#

oh wait, looks like there is no event handler that runs on player's computer when he leaves the game? then I'm wrong, sorry

mild pumice
#
player setUnitLoadout [[],[],[],["U_C_Poloshirt_redwhite",[]],[],["B_Carryall_oli",[["30Rnd_556x45_Stanag",3,7]]],"","",[],["","","","","",""]]
#

--> diag_log ok on both client / server (3 mags)

#

--> drop 3 mags on the floor

#

--> diag_log ok on client (no mags), broken on server (3mags)

#

logs are ok on server after i execute

player setUnitLoadout getUnitLoadout player
astral dawn
#

Damn I'm pretty sure my friend made a properly working loadout saving when player disconnects, in Antistasi mission...

#

I'll check it in a moment

#

No it also uses getUnitLoadout, run on the server 😦

ionic orchid
#

having no disconnect event on the client is what made me stop using disableUserInput during cutscenes

#

if the server craps out or kicked the player (I do that a lot for testing) then they're stuck

astral dawn
#

Haha
No disconnect event is a real trouble, I'm totally dissappointed now

#

Maybe you could make a fake one by attaching an event handler to some control or dialog?

ionic orchid
#

yeah I was thinking a loop running that looks for serverName or something similar

#

some test that only works when you're connected to a server

astral dawn
ionic orchid
#

Worth a try

robust hollow
#

well, there is the "Ended" mission event handler. you could also do an "Unload" event on display 46 but i wouldnt think you can communicate to the server when either of those fire.

wouldnt be the most reliable method anyway, if a client crashes the event wont run.

mild pumice
robust hollow
#

🤷 just tried exactly how you did it, worked fine.

mild pumice
#

😩

finite cloud
#

I'm having an issue or maybe just some confusion about file patching. I'm trying to set up my dev environment so I don't need to restart Arma every time I make a change.

So, I turned on the file patching parameter, set up my P drive, made a link between my Arma directory and my work directory, and I'm now using mikero's MakePbo instead of Addon Builder. Now when I change something in the source code, I can see the new version in the Functions viewer in-game, but even after restarting the mission the changes don't seem to be actually taking effect. Am I missing something or doing something wrong?

tough abyss
#

Tried recompile button in functions?

astral dawn
#

But he said even mission restart doesn't help 🤔
NVM

tough abyss
#

If the functions are in mod it won’t help

finite cloud
#

Hmm, the Recompile buttons are actually grayed out, I didn't notice those before

tough abyss
#

You have to enable recompile then

finite cloud
#

How do I do that for a mod?

astral dawn
#

also there is a recompile = 1; attribute in cfgFunctions?

finite cloud
#

I saw that, but I don't have a Description.ext because I'm building an addon :/

#

Oh! I'll give that a shot

astral dawn
#

I'm not sure cause never messed with addons

finite cloud
#

Woooooo that worked! Now I'm cooking with gas! Thanks 😄

burnt cobalt
#

Evening gents - how would I determine if a static weapon is a rocket/missile launcher?

astral dawn
#

With high probability you can't. Most likely you will have to just make an array of classnames(or better model names used by launchers).

#

I wanted to check for mortars once and found no way, had to make an array with class names

finite cloud
#

Does SQF have some sort of regex capability? You could check the config displayName for "launcher"

astral dawn
#

well there is a find command that works with strings...

burnt cobalt
#

argh

#

well there is configfile >> "CfgAmmo" >> _ammoType >> "effectsMissile"

#

maybe I can use that somehow, but I was hoping for something slicker - classnames are not going to be an option unfortunately unless I manage to gather every single classname in existance

queen cargo
#

@finite cloud you could implement one yourself 🤷‍♂️

tough abyss
#

I've got a in-editor trigger that works in single player and LAN to kill players who exit the area after a 10 second countdown, but it's not working on our dedicated server:

class Attributes
            {
                name="boundaryTrigger";
                condition="not(player in thislist)";
                onActivation=0 = [] spawn 
{_rad = triggerArea boundaryTrigger select 0;
damagePlayer = true;
for [ {_i=10} , {_i>=0} , {_i=_i-1} ] do {
    _str = str (format ["WARNING: %1", _i]);
    titleText [_str,"PLAIN"];
    titleFadeOut 0.5;
    sleep 1;
if (player distance boundaryTrigger < _rad) exitWith {damagePlayer=false};
};

if (damagePlayer) then 
    {player setDamage 1;[player] execVM "ACEdeath.sqf"; };
};;
                sizeA=50000;
                sizeB=50000;
                repeatable=1;
                activationBy="ANYPLAYER";
            };
            id=74;
            type="EmptyDetector";
        };

edited for clarity

burnt cobalt
#

for anyone concerned, I am not sure if this is reliable but this is the best I can do myself. does not differentiate between AT and AA:

#
isStaticMissileLauncher= {
    params ["_input"];
    private ["_magazineArray","_return"];
    if (typeName _input == "OBJECT") then {_input = typeOf _input};
    if !(_input isKindOf "STATICWEAPON") exitWith {false};
    _magazineArray = getArray (configfile >> "CfgVehicles" >> _input >> "Turrets" >> "MainTurret" >> "magazines");
    _return = false;
    {
        _ammo = (getText (configfile >> "CfgMagazines" >> _x >> "ammo"));
        _effects = toLower (getText (configfile >> "CfgAmmo" >> _ammo >> "effectsMissile"));
        if (["missile",_effects] call BIS_fnc_instring) exitWith {
            _return = true;
        };
    } foreach _magazineArray;
    _return
};
#

i thought there would be something easy and effective 😄

unborn ether
#
isStaticMissileLauncher= {
    params [
        ["_input",objNull,[objNull]]
    ];
    if (isNull _input) exitWith {false};
    private _type = typeOf _input;
    if !(_type isKindOf "STATICWEAPON") exitWith {false};
    private _magazineArray = getArray (configfile >> "CfgVehicles" >> _type >> "Turrets" >> "MainTurret" >> "magazines");
    private _return = false;
    {
        private _ammo = (getText (configfile >> "CfgMagazines" >> _x >> "ammo"));
        private _effects = toLower (getText (configfile >> "CfgAmmo" >> _ammo >> "effectsMissile"));
        if (_effects find "missile" > -1) exitWith {
            _return = true;
        };
    } foreach _magazineArray;
    _return
};
#

Also its better to use object isKindOf typeName instead of typeName isKindOf typeName its more reliable

#

When you have object ofc.

burnt cobalt
#

ha! thanks @unborn ether I did not know that find command either 😃

violet gull
#

RANDOM NOOB QUESTION: Is it possible that having:
execVM "MyScript.SQF" in the init.sqf can cause the script to execute every time a player connects? I'm almost positive it just runs once on loading a mission for the machine connecting/loading but I'm getting issues that seem to be caused by my scripts running multiple times. Just making sure I'm not retarded.

robust hollow
#

it just runs once on loading a mission for the machine connecting/loading
this is correct. init.sqf executes for only on the client loading in (and the server when it loads the mission), however to be clear that is every client, even jip. not just when the mission first loads.

violet gull
#

Yeah, that's what I thought. I have an issue where I have code that just stops working out of nowhere. Not sure if it's maybe cycle limit being reached in loop? I read that certain loops have a limit to how many cycles they can do before they end.

robust hollow
#

i think thats only the while loop if ran in unscheduled, which execvm is not.

violet gull
#

Even with eventHandlers, where they EH seems to just vanish from players. Seems to occur upon a player disconnecting.

#

Yeah in that case I'm not sure why a script would just stop working, aside from shit code breaking without errors

#

Oh well, thanks for the confirmations. ❤

wanton swallow
#

Hi. How to force character walk without run?
I try to use this:

_person forceWalk true;
_person allowSprint false;

He cant to sprint but can to run after several steps. I need to force him walk without run.

robust hollow
#

_person forceWalk true; alone works for me. do you know if there is a conflicting script enabling sprint?

wanton swallow
#

Character take some object in his hands and cant to sprint but can to run after several steps.
When he drop this object script do allowSprint true;

#

Cant sprint but can to run.

#

Description: Forces unit to walk even if run or sprint is selected.

#

I need persistent walk.

violet gull
#

Guy forceSpeed 3;

#

Or

#

Guy limitSpeed 3;

wanton swallow
#

@violet gull this dont work...

[_person] spawn {
    _prsn = _this # 0;
    _forceWalk = _prsn getVariable ["forceWalk", 0];
    diag_log "Start force speed";
    while{_forceWalk != 0} do {        
        _prsn forceSpeed 0.1;
        _forceWalk = _prsn getVariable ["forceWalk", 0];
        sleep 0.1;
    };
    diag_log "End force speed";
};
#

player can to run W
I need Ctrl+C mode

violet gull
#
[_person] spawn {
    _prsn = _this # 0;
    diag_log "Start force speed";
    while{!isForceWalk _prsn} do {        
        _prsn forceSpeed 0.1;
        sleep 0.2;
    };
    diag_log "End force speed";
};
#

_forceWalk is redundant, just use isForceWalk command

#

Returns true or false

#

Disable the unit's fatigue/stamina and forceSpeed to whatever too

wanton swallow
#

I dont use forceWalk on this character, why isForceWalk should to return true....

violet gull
#

If they go up hill, they will always walk (because Arma)

#

If you use forceWalk on a unit, isForceWalk will be true

#

Else false

wanton swallow
#

_prsn forceSpeed 0.1; dont produce forceWalk..

violet gull
#

Then use _prsn forceWalk true

#

If he doesn't walk, then something else is breaking it

#

Could be combat FSM, idk

#

_prsn DisableAI "FSM"

wanton swallow
#

In a first i tried to use forceWalk, after a several steps character start to run...

violet gull
#

_prsn forceSpeed 3;
_prsn forceWalk true;

#

Is it on a player or a unit?

#

It doesnt do anything for players

wanton swallow
#

forceWalk
Description: Forces unit to walk even if run or sprint is selected.

violet gull
#

Actually I think it does now

wanton swallow
#

for a player

#

I saw in some missions player force to walk

#

And cant to run

violet gull
#

To force a player to walk, you can do player forceWalk true;

#

But it is a client-side command

wanton swallow
#

Yes it is

violet gull
#

So server cannot execute on a client, unless you use remoteExec

wanton swallow
#

Why you talk about remoteExec. A question is "how to force player to walk"

#

forceSpeed
forceWalk
dont work 😦

violet gull
#

IDK I've used forceWalk in my own little scripts to make players walk when injured and I had no issues. 🤷

#

ForceWalk:
Description: Force player to walk.

Example:
player forceWalk true

#

If you type forceWalk in the editor in init of unit, click in the command, and press F1

wanton swallow
#

Forces unit to walk even if run or sprint is selected.

violet gull
#

It will show you that

#

Yup, it should

#

_prsn allowSprint false;

wanton swallow
#

I can to disable sprint, but how to disable run

violet gull
#

forceWalk should do exactly that

wanton swallow
#

Did you see desc of a command?

violet gull
#

IDK why it isn't working for you, that's weird.

wanton swallow
#

even if run is selected

#

You select run when push W second time after walk

violet gull
#

Ya don't say

#

And I'm telling you forceWalk makes that shit not matter, you are forced to walk and cannot move any faster than a walk lol

#

I just tested it in the editor and it worked

#

Try doing it without your loop, just execute the command and try running/sprinting. It should work. If not, a script or mod is breaking it.

wanton swallow
#

I tried it early. Character walk a several steps and then starts to run.

#

@violet gull yeah you right, in simple mission it's work correct.

tough abyss
#

@mild pumice yep broken as fuck

#

:shrug: just tried exactly how you did it, worked fine. you lie 👺 @robust hollow

still forum
#

🔥

robust hollow
#

noooo. i used the same bag, mags and log script.... didnt have the issue.

tough abyss
#

You use setunitloadout like he did? I dont think so because it is pretty much 100% repro

robust hollow
#

yes copied straight out of discord

tough abyss
#

what game version?

robust hollow
#

stable x64

tough abyss
#

what version number is it? @mild pumice is on 1.88.145285, I am on dev 1.91.145335

robust hollow
#

difference is i wasnt on the map he is on in his video, and i had no mods enabled.

#
Build: Stable
Version: 1.88.145285```
tough abyss
#

I guess we need second opinion

#

I tested on Altis

#

Don't think it matters, it is setUnitLoadout that is bugged

#

and doesnt matter if executed from client or server

#

It creates buggy backpack

#

but addBackpackGlobal doesnt

#

The fucking backpack if you drop it and pick up is still desynced with the server

robust hollow
#

weird 🤔

queen cargo
#

i kinda like that ||i just understood|| how ||spoilers|| actually are ||done in bbcode|| 😉
Spoiler Alert: ||use | |TEXT| | but leave the space inbetween those fancy vertical lines away ... cannot escape them sadly :(||
could come in handy

#

||you need to use two of em||

tough abyss
#

|| like this?||

queen cargo
#

||or /spoiler||

tough abyss
#

||Ok will now use for all my posts||

still forum
#

||noob||

#

Wait... Spoilers are broken in my webbrowser again. They worked yesterday

tough abyss
#

||redacted||

still forum
#

Okey CTRL+F5 fixes everything

cosmic orbit
#

I have a question about ACE fastroping and how i would go about applying it to a helicopter. Im currently trying to enable FRIES on konyo's 160th SOAR MH-47, seeing as it doesnt have support for fast roping by default. I tried adding it myself using this script in the init field;

[kyo_MH47E_base] call ace_fastroping_fnc_equipFRIES;

I have next to no experience with scripts, so i dont know what i am doing wrong. or if it even is possible.

still forum
#

is kyo_MH47E_base a variable pointing to the vehicle?

#

looks suspisciously like a classname..

wanton swallow
#

I create, dialog, wait until it appear, start a cycle of processing of messages:

disableSerialization;
createDialog "MyGUI";
waitUntil {!isNull (findDisplay 51111);};

while {alive player && dialog} do {    
    if (!dialog) exitWith {  /*action when exit!*/ };

    //--some actions--
};

The menu is displayed, some actions are executed, but when you press Esc, the dialog closes and the code inside exitWith is not executed.
Where is the mistake?

copper raven
#

&& dialog

wanton swallow
#

lol schoolboy error ))

robust hollow
#

might as well put that exit code after the loop

cosmic orbit
#

@still forum what should i have in its place, i just assumed i should put the classname, i am not very well versed in this at all

#

any help is appreciated

still forum
#

parameter is the helicopter object

cosmic orbit
#

where do i see the object name in the editor?

still forum
#

in init script it's just this

cosmic orbit
#

tried writing it like this

#

[_MH-47E (Hardcore)] call ace_fastroping_fnc_equipFRIES;

still forum
#

I just told you what to write

#

also if you want to write names. Names are text. Text in SQF is wrapped in quotation marks

#

"text"

cosmic orbit
#

can you write it so i can just paste it in, sorry if its annoying, but i dont get any part of this

winter rose
#

equip fries? Frenchness intensifies

cosmic orbit
#

xd

#

welp

#

it just said the vehicle isnt configured for ACE fastroping

#

so i guess it was in vain

#

thanks for the help

still forum
#

[this] call ace_fastroping_fnc_equipFRIES;

cosmic orbit
#

thanks a lot man

knotty sun
#

what would be the best type to use when collecting all Supply boxes in a mission? sqf allMissionObjects "Type"
Can't really find a list of available Types

winter rose
#

@knotty sun ReammoBox_F maybe

knotty sun
#

any crate in the category Supplies falls under that?

#

WIKI isn't too clear on that unfortunately

winter rose
#

regarding how it is arranged I say it should be that yup

knotty sun
#

that'd be amazing. Any chance it supports mods too or just vanilla crates?

#

supply crates from mods*

winter rose
#

I would say mods crates should inherit from it too, if they didn't mess up

knotty sun
#

hehe then i'll blame mod authors if it doesn't work 😄

winter rose
#

that's the way to go :p

still forum
#

Backpacks might inherit from that too tho

#

Ah no. Atleast my backpacks inherit from ReammoBox not the futura variant

knotty sun
#

It's fine @still forum I check for vehicleVarNames anyway. Read that AllMissionObjects is very heavy on the CPU so thought I'd limit it as much as possible without losing funtionality

tough abyss
#

and what does allmissionobjects return that entities doesnt?

#

dead weaponholders?

still forum
#

Could probably all be replaced by a CBA init EH 😄

tough abyss
#

entities return dead if needed

#

what is it a big sand box?

#

you clean up ruined buildings?

#

how

#

no what you do to them delete?

#

that is supposed to make it better?

#

why not replace with simple object

still forum
#

You should be able to just deleteVehicle craters and ruins. Atleast i've done that in the past

#

That makes sense tho 😄

tough abyss
#

Wait what ruins are we talking about, map or editor placed?

#

you can set pos map objects?

#

how do you move them

#

This is strange but then you have event handlers for that no need to allMissionObjects if you could just store the exact object in an array and then use that array

#

the ruin

#

there is EH

still forum
#

You ofc still need to check nearby players and such

#

but with EH you don't need to constantly call entities or allMissionObjects

#

The object itself notifies you when it spawns.
Instead of you constantly checking if anything has spawned

tough abyss
#

if you just hide ruin does it exist on JIP or also hidden?

#

then this would be my choice, hide and replace with simple object, ruins are great

#

gameplay

#

unless it is in some area no one ever going to go, then it wont hurt to keep it either way

#

There was a bug, when building was destroyed by script all JIP would see it being destroyed long after it was destroyed

#

without checking I would say it probably still there

#

hiding it and replacing was working fine AFAIK

#

by script

#

if it destroyed by game it syncs ok

digital jacinth
#

Anyone knows if there is ANY docu on the CfgUiGrids class for custom UI elements for the Layout Editor? I am resetting variables which arma writes into the profilenamespace, these are defined in a sub class of CfgUiGrids. It all works fine but after relaunching the game it takes the old values from before the reset and i am not sure from where arma takes the original values.

tough abyss
#

what is the class?

ruby breach
#

Just the first iteration of new NATO stealth tech

tough abyss
#

how do you spawn it

knotty sun
#

What's the most occurring way a small pbo with basically only scripts causes the server to crash with only "Fault Address: XXXXXXXXXXX unknown module"?

winter rose
knotty sun
#

eh you might have a point there. Not an include though, just call to a mod that doesn't run in init.sqf

#

thought it fell under #arma3_scripting since it's probably a scripting issue or config.cpp

#

@winter rose turns out it was the hpp class (...) { preStart = 1; }; in the config.cpp. Did I make an error or is there another line to use to ensure that the mod itself executes the (...) functions when the mission starts?

still forum
#

preStart is game start, not mission start

#

missionStart is preInit

knotty sun
#

which one comes first again?

still forum
#

do you have to start your game before you can start a mission?

knotty sun
#

yas

#

well I hope so

still forum
#

So which comes first then..

#

game start or mission start?

#

Egg or chicken?

knotty sun
#

Two different discussions and answers I'm afraid 😛

#

isn't MissionStart between pre- and postInit though?

#

nvm, upon

lusty canyon
#

is it possible to script a uav to have exclusive access to just one player? say u got 3 players on bluefor, each with a darter. how can you make them exclusive plus when a player opens the uav terminal ui they only see 1 uav?

knotty sun
#

@lusty canyon I think that only works if you keep the darter local to that player

still forum
#

Where is your previous message that you posted? wanted to look up context but seems to be gone

#

remoteExec to _milo and not to 0

knotty sun
#

because you didn't add it to the JIP stack?

#
[_milo, (getMarkerPos "mrk_WPMiloJr")] remoteExec ["doMove", 0,_milo];```
still forum
#

Doesn't matter if there is no jip tho

knotty sun
#

well he mentioned hosting dedicated

still forum
#

And.. You don't need that thing on JIP either..

knotty sun
#

so I guess the mission starts before he joins?

still forum
#

It's a AI command, doesn't need to be recalled on JIP

knotty sun
#

Hm that's true though

still forum
#

multiplayer editor it works too?

knotty sun
#

_fnc_addarsenal = {
    _obj addAction ["Open BIS Arsenal",["Open", true] spawn BIS_fnc_arsenal,[],1,false,false,"","",5];
};

[_obj,_fnc_addarsenal] remoteExec ["call",0,_obj]; // Alternatively "bis_fnc_call" ```

Unfortunately, this way the client on which it is executed, have no memory of the _obj. Is there a working alternative to ```sqf
remoteExec ["addAction",0,_obj];``` which doesn't allow a stack of JIP net IDs (e.g. multiple addactions)
still forum
#

you may want to execute ambientAnim serverside

#

The AI unit is serverside, that's why you remoteExec. But.. Why not ust execute that whole code serverside and get rid of all other remoteExec's?

#

it can be used for that

#

but you put 0 as target

#

which means execute everywhere

knotty sun
#

the _obj in my remoteExec ["call"], can I retrieve that in the client using _this since it gets sent alongside the _obj in the remoteExec params?

winter rose
#

if you set it in the left argument, yes

#

[_obj, "mySound"] remoteExecCall ["say"];
[[_obj, 1], "BIS_fnc_setDamage"] remoteExecCall ["call"]; // fake func for example

knotty sun
#

@winter rose the allMissionObjects "ReammoBox_F" works flawlessly for the small crates! Any chance you know which one I need to include the helicopter DLC containers too? I found Land_FlexibleTank_01_F but I think that only goes for the flexible tanks?

still forum
#

just look at inheritance in config viewer

knotty sun
#

well that is the weird thing; it inherits from the same object type but the script doesn't "see" them

finite cloud
#

If I'm comparing two objects (units in this case), is it okay to use == or do I need to use isEqualTo?

still forum
#

doesn't matter

finite cloud
#

Would someone be willing to look over my logic here just to make sure I'm not making any dumb/rookie mistakes?

params ["_group"];

private ["_targets", "_side"];

_targets = [];
_side = side _group;

while { true }
do {
    // Retrieve targets
    _oldTargets = +_targets;
    _targets = [];
    _newTargets = [];

    {
        _target = _x select 1;        // <OBJECT>
        _targetSide = _x select 2;    // <SIDE>
        _targetType = _x select 3;    // <STRING> class name
        _targetPos = _x select 4;    // <[x,y]>
        _targetKnowledge = leader _group knowsAbout _target;  // <NUMBER>

        if ([_side, _targetSide] call BIS_fnc_sideIsEnemy)
        then {
            _targets pushBack [_target, _targetType, _targetPos, _targetKnowledge];
        };
    } forEach (leader _group targetsQuery [
            objNull,            // Ignored target <OBJECT>
            sideUnknown,    // Filtered Side <SIDE>
            "",                // Filtered class name <STRING>
            [],                // Filtered position (200m tolerance) <[x,y]>
            0                // Max seconds since last seen <NUMBER> (0 = any)
        ]);
    
    // Check each target for newness
    {
        _maybeNew = _x;
        _isDuplicate = false;
        {
            _old = _x;
            if ((_maybeNew select 0) == (_old select 0))
            exitWith {
                _isDuplicate = true;
            };
        } forEach _oldTargets;

        if !(_isDuplicate)
        then {
            _newTargets pushBack _maybeNew;
        };
    } forEach _targets;

    // Report new targets
    if (count _newTargets > 0)
    then {
        {
            // TODO: Report the new targets to friendly units within comms range
            systemChat format ["New target found! %1 @ %2", _x select 0, _x select 3];
        } forEach _newTargets;
    };
};
still forum
#

stop using that private array crap and use the proper keyword

#

and use params instead of half a dozen of _x select

ruby breach
#
        if !(_isDuplicate)
        then {
            _newTargets pushBack _maybeNew;
        };
``` That spacing though
finite cloud
#

What's the proper keyword to use vs private? I'm not really sure why the private vars definitions, I've just seen other people do it, haha

ruby breach
#

private _var = val; should be used over private ["_var"]; _var = val;

still forum
#

And if you wanna use private. Then atleast do it completely. You private _targets and _side.
But what about _oldTargets, _newTargets, _target, _targetSide, _targetType and so on..

ruby breach
#

He copy-pasted the private keywords from something someone helped him with here iirc

finite cloud
#

So maybe I should back up here, what's the purpose of declaring private vars in a function anyway? If they're already local to the scope, what does it matter if they're public or private?

still forum
#

If you don't declare them private, then Arma will check if a variable with same name exists in a higher scope and overwrite that.
Meaning if you made a function that somebody else might call, you will overwrite his variables without telling him

finite cloud
#

Ahhh okay

still forum
#

Plus readability and performance bonus.
If you private it doesn't have to check if the variable already exists -> performance.
If you private you know that, that point is where the variable got created and that it doesn't exist prior to that -> readability

finite cloud
#

Gotcha, that makes sense

ruby breach
#

As for private keyword vs. private array, keyword is faster regardless of how many times you have to repeat it

still forum
#

keyword is free. private array is a command call

finite cloud
#

So, params vs select: Can I use params inside of any old array, not just a function declaration?

tough abyss
#

Keyword > command

still forum
#

Free vs not free == infinite% difference

#

Params takes an array as left side parameter.
If you don't supply it it automatically falls back to _this

#

so you can just _x params [...]

finite cloud
#

Ahhh nice, okay

tough abyss
#

// is faster than comment

finite cloud
#

Am I using any commands where I should be using keywords?

still forum
#

private is the only keyword

#

your duplicate remover is weird

finite cloud
#

Yeah, I wasn't sure how to do that. I was originally just doing _newTargets = _targets - _oldTargets, but the problem with that is that everything but the first parameter could be different between checks for the same unit

still forum
#
_newTargets = _targets select {
    private _newTarget = _x select 0;
    (_oldTargets findIf {_x select 0 == _newTarget}) == -1
}
finite cloud
#

@still forum Would you be willing to break that down for me? I'm looking at the wiki entries for select and findIf but I'm not 100% sure if I'm following

still forum
#

select copies over all values where the code returns true.
findIf returns the index of the first found element or -1 if it didn't find it

finite cloud
#

Ahhhh

#

Okay

still forum
#

So we are searching the first entry in _oldTargets that has the same object. And if we don't find any we return true, causing select to copy the current value to _newTargets.
If findIf finds the object, it returns something != -1 and the code will return false. Causing select to skip the value

finite cloud
#

So if the same value doesn't exist in _oldTargets, index == -1 returns true which adds the element in _targets to the new array

#

Got it

#

Thanks for your help!

knotty sun
#

how would I correctly initiate a nested array? It needs to store [ [ x, [y1, y2, y3], z ], [ x, [y1, y2, y3], z],...]. I currently use _array = []; _array pushBackUnique [x,y,z]; but the engine doesn't like inserting the 3-param element into it ```23:29:12 Error in expression < forEach _flags;

{
_saveData pushBack [typeOf _x,getPos _x,getDir _x];
} forEac>
23:29:12 Error position: <typeOf _x,getPos _x,getDir _x];
} forEac>
23:29:12 Error typeof: Type Array, expected Object```

ruby breach
#

That's not what it's complaining about

#

23:29:12 Error typeof: Type Array, expected Object

#

_x isn't an object and needs to be

knotty sun
#

oh it's not on about the array, but _x?

ruby breach
#

correct

knotty sun
#

aaaaah I see. I pushback one object, then pushback an entire array of 'em behind it. Should be appended then

finite cloud
#

@tough abyss The reason I used knowsAbout is because I'm going to pass that same value onto other friendly groups in the area with the reveal command

astral dawn
#

I'm doing the same as you actually, Spectre... be careful with knowsAbout because it only accepts local units

#

While it seems that these other commands accept units on all machines

finite cloud
#

Oooh, I didn't know that

astral dawn
#

Well, the unit who knowsAbout ... must be local

#

As on the wiki Multiplayer: who must be local, while target can be global.

finite cloud
#

I'm mainly doing this for the purpose of my own single player stuff, so it shouldn't be an issue at least for now, but I'll look into that eventually

astral dawn
#

Yeah then it's ok

still forum
#

and “targets” instead of “targetsQuery” target's doesn't return side, classname and pos. So he would have to get them seperately.

tough abyss
queen cargo
#

Lemme quote Ratatouille: Everyone can Cook
But not Everyone should

tough abyss
#

I doubt everyone can cook

still forum
#

hot water into pot. noodles into same pot. Done. You can cook.
Being able to cook doesn't mean being able to cook good.

tough abyss
#

Nah some people cannot even do that

still forum
#

Okey yeah if you are blind and can't speak and have no arms nor legs then yeah. You can't cook.

tough abyss
#

Or a spoiled brat that never had to do anything yourself

#

@queen cargo BTW I am not endorsing this retarded statement by Apple marketing

queen cargo
#

Expected that @tough abyss 😂

still forum
#

disableAI everything. Then move it into the animation locally.

#

what do you mean by "transfering"?

#

It's definitely possible, but you might have to do it manually then if that func doesn't work

young current
#

check the different animation commands, there are those that directly and immediately switch animations and those that allow the current animation to end and next one to begin after that.

#

Some animations are repeating and dont have any kind of blendind startup/end parts and some have those as separate animations

#

the all all animations

#

they all play the same

#

yes but all those animations are in the files

#

the functions are just to make their use simpler in some cases

#

and the functions use same script commands that can be used independently

#

you can check how the ambien anim function works in the ingame function viewer if you are interested in its behaviour

#

the functions use those same commands

#

playAction, playMove, switchMove etc

#

yes

#

functions are just ready made scripts

#

what animations are you trying to play?

winter rose
#

is the script executed where the unit is local then?

#

a simple call is enough, no remoteExec. but the script has to be run where the AI is local, most likely the server for an AI

young current
#

there is a separate function viewer too

#

there you go

#

need to make your own setup

winter rose
#
If you use it on 20 units, 20 additional units (logics) will be created.```
#

→ Functions Viewer

#

top-left: global config file

#

then functions ^_^

young current
#

no

#

each of the move/action commands behave differently

winter rose
#

switchMove ensures the animation is played, but without transition at all. Some animations have "begin" animation (such as salute, surrender etc.) while some only have the anim itself (e.g jump out of a vehicle)

knotty sun
#

the command AllPlayers, does it return a list of all players even for a server?

#

small issue of dead player being saved to a database 😄

still forum
#

yes. But as far as I heard at start of mission it lags a bit behind

winter rose
#

allPlayers - allDeadMen then maybe

tough abyss
#

if (!alive _x) then {dont save maybe?}

digital hollow
#

There are enough Dedmen to need a script command?!

knotty sun
#

oh no I'm not saving the players. I used _arraytoSave - playableUnits at first to prevent AI being in there, but turns out dead people aren't counted under that anymore 😛

#

allDead seems like a better choice since it includes destroyed vehicles too

knotty sun
#
nearestLocation [ any position, ""];
``` returns nothing if the position is inside a military base? 🤔
#

or in a town?

#

is there a function that returns a name like "Kostas" or something?

ruby breach
knotty sun
#

I'm using the text variant, but I get back ""

#

usually occurs in "unnamed" locations like military or something

#

maybe it's just a location without name? 🤔

verbal saddle
#

Are you sure its returning the military location?

west grove
#

oi fellas. i accidentally wrote my problem in config_editing

#

tl;dr is - i have created a rsc layer and now i can't delete it anymore

#

stuff like "cutRsc ["","PLAIN"]" etc. does nothing

#

tried a couple different things, but i simply cant figure out how to delete that layer

knotty sun
#

(Asaayu) I wouldn't know, I get nothing back 😛

tough abyss
#

how did you write it

#

cutRsc ["","PLAIN"] deletes only layer 0

west grove
#

i'm calling it via "([] call bis_fnc_rscLayer) cutrsc ["lxHI_RscSensor","plain",0,false];"

#

this starts up the rsc layer, which has:

#

onLoad="['Init',_this] call (uinamespace getvariable 'lxHI_fnc_showSensor')";

#

and now my script will loop through it, which is what i want... except that i can't seem to stop it

tough abyss
#

[] call bis_fnc_rscLayer should return reference

west grove
#

if i put it in the debug console, i get 6

tough abyss
#

try 6 cutRsc ["","PLAIN"] then

west grove
#

wiki for igui mentiones ""someLayer" cutRsc ["RscTitleDisplayEmpty", "PLAIN"];"

tough abyss
#

[] call bis_fnc_rscLayer will generate new later number each time you need to either name it or store the return value

west grove
#

ooooh yeah

#

i'm so stupid

tough abyss
#

allCutLayers

knotty sun
#

Can the server determine which unit an admin occupies? 🤔

tough abyss
#

admin owner _unit

west grove
#

thanks @tough abyss stuff works. now i can start doing some real progress again.

tough abyss
knotty sun
#

oohhh shiny, thanks @tough abyss

#

nearestObjects returns every object right? Is there a way to only include objects that aren't part of the map?

tough abyss
#

nearestObjects returns every object right? no

knotty sun
#

sorry, every object within given range

tough abyss
#

no

knotty sun
#

hm then I may be formulating it wrong. Anyhow, I use the nearestObjects and it returns buildings that pre-exist on the map. Is there a way to remove these from the array resulting from nearestObjects?

tough abyss
#

Use filter so that buildings are not in the list

#

or use filter to return only buildings so that you could subtract them from the first array

knotty sun
#

can I cross-refence with allMissionObjects and check whether what was found in the array is also in the allMissionObjects?

tough abyss
#

bottom line : use filter

#

arrayIntersect

knotty sun
#

wasn't sure whether to use that one or something get allMissionObjects to be the nearestObjects filter 🤔

tough abyss
#

there is also nearestTerrainObjects for map objects

knotty sun
#

hm so nearestObjects - nearestTerrainObjects would leave only objects placed in 3DEN or during the mission?

tough abyss
#

allMissionObjects will return that

#

it will not return map objects