#arma3_scripting

1 messages ยท Page 71 of 1

granite sky
#

getPos [pos, dir]

sullen sigil
#

i think this might just be my schizophrenia again though

sullen sigil
granite sky
#

Normally prefer the vector stuff but that one is sometimes a shortcut.

sullen sigil
#

vector stuff probably more reliable isn't it?

#

oh probably faster too according to wiki

agile pumice
#

etc, selectionPosition [wheel_1_1_axis, "Memory"]

granite sky
#

well, fewer commands is faster in general.

digital hollow
#

Why use many command, when few command do trick.

agile pumice
#

sorry, missed the quotes around the name

smoky osprey
#

Hey I need some advice how we could achieve something. So you know how there is kill/score tracking in ArmA? The problem is, at the end of the mission it shows you all your kills, and if you look at someone via Steam, it shows you their score. This happens even if the scoreboard button in-game is disabled.

I am wondering if there is some way to disable this for co-op? We got an issue in our group where some people just end up basically kill-chasing for that score.

little raptor
granite sky
#

@smoky ospreyhttps://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleScore

sullen sigil
#

likely no faster than just vector math

little raptor
#

getPos is slower than those commands

#

it has nothing to do with vector

#

also that's for the getPos obj variant

sullen sigil
#

yes, will be using obj

#

to get initial position

little raptor
#

never use getPos and setPos for that

sullen sigil
#

yes i know

#

hence why im using vector now

little raptor
#

tho getPos is fine if you actually need the AGLS

sullen sigil
#

i know

granite sky
#

origin getPos [distance, direction] form is fine though.

#

It doesn't do anything with Z. IIRC it just sets it to zero.

little raptor
#

yeah

sullen sigil
granite sky
#

(even if input z is non-zero)

modern meteor
#

Trying to move my AI team via map click but they are not moving.

openMap [true,false]; 
addMissionEventHandler ["MapSingleClick", {
params ["_units", "_pos", "_alt", "_shift"];
{_x moveTo _pos} forEach units group player -[player];
openMap [false,false]; // Close map
removeMissionEventHandler ["MapSingleClick", _thisEventHandler];
}];

What am I doing wrong?

little raptor
fleet sand
little raptor
#

that's worse meowsweats

#

you add an EH every time the user opens the map

fleet sand
little raptor
#

well do you even want to always have the click option available when you open the map?

#

e.g what if you want to click on the map to place a marker?

fleet sand
#

What about removing it after the action something like:

addMissionEventHandler ['Map',{
    params ["_mapIsOpened", "_mapIsForced"];
    if(_mapIsOpened) then {
         addMissionEventHandler ["MapSingleClick", { 
            params ["_units", "_pos", "_alt", "_shift"]; 
            {_x domove _pos} forEach units group player -[player];
            removeMissionEventHandler ["MapSingleClick", _thisEventHandler];
        }];
    };
}];```
modern meteor
#

My script removes the EH after use, no?

modern meteor
little raptor
fleet sand
#
addMissionEventHandler ['Map',{
    params ["_mapIsOpened", "_mapIsForced"];
    if(_mapIsOpened) then {
        if(!isNil _eh) exitWith {};
        private _eh = addMissionEventHandler ["MapSingleClick", { 
            params ["_units", "_pos", "_alt", "_shift"]; 
            {_x domove _pos} forEach units group player -[player];
            removeMissionEventHandler ["MapSingleClick", _thisEventHandler];
        }];
    };
}];
``` ?
little raptor
#
if (missionNamespace getVariable ["my_map_EH", -1] >= 0) exitWith {};
my_map_EH = addMissionEventHandler ['Map',{
    params ["_mapIsOpened", "_mapIsForced"];
    if(_mapIsOpened && {missionNamespace getVariable ["my_mapClick_EH", -1] < 0}) then {
         my_mapClick_EH = addMissionEventHandler ["MapSingleClick", { 
            params ["_units", "_pos", "_alt", "_shift"]; 
            {_x domove _pos} forEach units group player -[player];
            removeMissionEventHandler ["MapSingleClick", _thisEventHandler];
        }];
    };
}];
little raptor
#

you could also do it with isNil but with global var

fleet sand
little raptor
#

yes but you should also make sure Map EH is not duplicated either

fleet sand
#

i got it. nvm

tough abyss
#

^ rhs uses different mem points for wheels

sullen sigil
#

r.e HitPart eh:

The event will not fire if the shooter is not local, even if the target itself is local.
does this mean that the eh needs to be added on all player machines? i.e if you have object local to server, you would need to use addeventhandler on all players? thonk

#

what a stupid question addeventhandler is local effect
i suppose i need to find a different method of registering damage to an object that cant take any ๐Ÿค”

wind sapphire
#

Take a look at the HandleDamage event handler which is global.

granite sky
#

It is not.

#

It's global-argument but only triggers when the attached object is local.

#

Now dammaged is actually global-argument for some reason.

sullen sigil
#

so long as anyone can shoot it locality-wise and have it fire it should be good ๐Ÿค”

#

But as it's a static object dammaged may not work thonk

granite sky
#

likely, yeah

sullen sigil
#

wait all players aren't local to server are they

#

and only local to themselves right

#

i feel like thats something i shouldve checked prior

granite sky
#

After a few frames, yes :P

sullen sigil
#

yes to which ๐Ÿ™ƒ

granite sky
#

Player objects are created on the server initially and then locality-switched to the client.

sullen sigil
#

ah

blazing zodiac
#

Is it possible to stop propagation of vanilla keypress events without making their keys not bindable for other actions? For example, if you used:

private _display = findDisplay 46;
_display displayAddEventHandler ["KeyDown", { 
    params ["_displayOrControl", "_key", "_shift", "_ctrl", "_alt"]; 

    if (_key in (actionKeys "personView")) exitWith { true; };
}];

Then if you had any other actions bound to the same keys as toggle person view (personView) they would also stop being propagated. Is there an equivalent to the above for addUserActionEventHandler since that's tied to a specific action and not just a keybind that could potentially be shared with other actions? Something along the lines of:

addUserActionEventHandler ["personView", "Activate", { true; }];

The goal here is to completely eliminate the command menu so other alternative methods of that are also welcome!

granite sky
#

I forget what happens on a respawn. I seem to remember it was unexpected.

sullen sigil
#

Either way not consistent enough for simulation of hp system :p

#

"simulation of hp system" number go down more with larger ammo caliber

hallow mortar
#

HandleDamage is a good candidate if you want to record the damage amount, because you can save the damage and then immediately nullify it. Using an allowDamage false object and a hit/hitPart EH would not let you do that because it would never take any theoretical damage to record.

sullen sigil
#

neither dammaged or handledamage fire for it notlikemeowcry

#

neither does hit eh

little raptor
#

inputAction too but not sure about that one

hallow mortar
nocturne bluff
#

BECAUSE STANDARDLIATION WHY

sullen sigil
#

add a hitpart eh through a fired eh? meowsweats

hallow mortar
#

I'm not saying it's a great idea, but the alternative seems to be finding a different object that has the simulation you need

acoustic yew
#

Ello, sorry for interjecting. I am using onMapSingleClick to add a waypoint for a unit but when I don't want to add a waypoint and wanna click on the map it will still do the waypoint code. How do I disable it? I want to enable onMapSingleClick when I want and disable it after use.

sullen sigil
hallow mortar
#

Projectile hitPart EH has a different params layout

sullen sigil
#

oh right

#

duh

hallow mortar
sullen sigil
#

forgot theres two

acoustic yew
#

Oh there are two?

#

I can't find the documentation

hallow mortar
#

It's linked from the onMapSingleClick page with a note saying to use it instead :U

acoustic yew
#

Ah

#

Uh, can you tell me how I would disable this event? I haven't worked with eventHandler for quite a lot of time

acoustic yew
#

thanks

modern meteor
#

How can I select a squad unit via script in a way that it gets highlighted in the units bar?

granite sky
#

groupSelectUnit

modern meteor
#

tyvm

fleet sand
#

Quick Question guys how would you move Object up and down with SetVelocityTransform. Better Question how to make it when object reaches pos 2 to invert direction of travel but keep rotation ?

acoustic yew
#

can someone check my code?

            curatorName addEventHandler [
                "MapSingleClick", {
                    _pos = _this select 0; 
                    _wp = convoyGroup addWaypoint [_pos, 0];
                    _wp setWaypointType "MOVE";
                    _wp setWaypointBehaviour "CARELESS";
                    _wp setWaypointCombatMode "YELLOW";
                    };
                    /*if (isNull _mainMarker) then {
                        deleteMarker _mainMarker
                    };*/
                    _marker = createMarker ["transportMarker", _pos];
                    _mainMarker = _marker setMarkerType 'hd_dot_noshadow';
                    openMap false;
                ];```
hallow mortar
acoustic yew
#

dw about curatorName

#

it'll provide player value, its part of my module mod

hallow mortar
#

Well, it won't do anything in that configuration, because addMissionEventHandler doesn't have a left argument

acoustic yew
#

uhh

#
curatorName addEventHandler ["MapSingleClick", {
    _pos = _this select 0; 
    _wp = convoyGroup addWaypoint [_pos, 0];
    _wp setWaypointType "MOVE";
    _wp setWaypointBehaviour "CARELESS";
    _wp setWaypointCombatMode "YELLOW";
    if (isNull _mainMarker) then {
        deleteMarker _mainMarker;
    };
    _marker = createMarker ["transportMarker", _pos];
    _mainMarker = _marker setMarkerType 'hd_dot_noshadow';
    openMap false;
}];
#

what about this?

hallow mortar
#

MapSingleClick is a mission EH, which means you use addMissionEventHandler to add it, not addEventHandler

tough abyss
#

If it's the memory lod, then there is a mask for it.
Like wheel_X_Y_axis , which is a config entry

acoustic yew
#

OH

hallow mortar
#

and addMissionEventHandler doesn't have a left argument

acoustic yew
#

EH = EventHandler lmao

#
curatorName addMissionEventHandler [
                "MapSingleClick", {
                    _pos = _this select 0; 
                    _wp = convoyGroup addWaypoint [_pos, 0];
                    _wp setWaypointType "MOVE";
                    _wp setWaypointBehaviour "CARELESS";
                    //_wp setWaypointCombatMode "YELLOW";
                    };
                    /*if (isNull _mainMarker) then {
                        deleteMarker _mainMarker
                    };*/
                    _marker = createMarker ["transportMarker", _pos];
                    _mainMarker = _marker setMarkerType 'hd_dot_noshadow';
                    openMap false;
                ];```
#

11:43pm coding session

hallow mortar
#

addMissionEventHandler doesn't have a left argument

acoustic yew
tough abyss
#

But the numbers can still start at 0 or 1.

hallow mortar
#

Arguments are the instructions you pass to the command. The whole array of event handler name, code etc. is one argument. It's the right argument, because it goes on the right side of the command. You are trying to pass curatorName as the left argument, as if the command was a binary (two-argument) command, but it isn't, it's unary (one argument) which means it only listens to the instructions on the right side. As per its documented syntax.

acoustic yew
#

uh

#

so if I do fancyLeftArgument = curatorName addMissionEventHandler... is it gonna work? :D

hallow mortar
#

No, that's not how it works

acoustic yew
#

;-;

hallow mortar
#

fancyLeftArgument = ... is just saving the output (if it had any) as a variable called fancyLeftArgument. It doesn't make any difference to how the command works.

acoustic yew
#

hmmmm

#

do u know how to fix it? :D

hallow mortar
acoustic yew
#

ah ok

#

_id is something special or can be anything?

hallow mortar
#

_id = ... is saving the output, what the command returns, to a variable called _id. As the page mentions, the return value is the numerical ID of the EH that was just created. This is for use later if you want to remove it.

acoustic yew
#

yeah

#

so just a quick question

#
removeEventHandler ["MapSingleClick", {hint "Removed!"; removeMissionEventHandler ["MapSingleClick", _id];}];```
#

this will work right (_id)

tough abyss
#

Like the Puma , which uses 0 for the Umlenkrolle (eng?)

hallow mortar
#

Maybe, depending on scope. _id is a local variable, meaning it's saved in the current script scope and isn't available in other scopes. So if you save it as a local variable in this script, then try to do the removal in a different scope...you can't, you need to use a global variable, or pass the ID as an argument if the new scope is spawned/called from the first.

#

Also that code doesn't actually make any sense.

acoustic yew
#

ye ik i wont use _id but yk this syntax is correct right?

hallow mortar
#

You can't use removeEventHandler to remove mission EHs, and the second parameter for removeEventHandler is.....not code

hallow mortar
#

Yes, but look at the code you posted. From the beginning.

acoustic yew
#

ohhhh

#

oopsie

#
removeMissionEventHandler ["MapSingleClick", _id];```
#

what about this?

hallow mortar
#

That appears correct

acoustic yew
#

yay

#

now about adding it

#
            _id = addMissionEventHandler [
                "MapSingleClick", {
                    _pos = _this select 0; 
                    _wp = convoyGroup addWaypoint [_pos, 0];
                    _wp setWaypointType "MOVE";
                    _wp setWaypointBehaviour "CARELESS";
                    //_wp setWaypointCombatMode "YELLOW";
                    /*if (isNull _mainMarker) then {
                        deleteMarker _mainMarker
                    };*/
                    _marker = createMarker ["transportMarker", _pos];
                    _mainMarker = _marker setMarkerType 'hd_dot_noshadow';
                    openMap false;
                    };
                ];```
hallow mortar
#

You don't want a ; after the last }. ; means "end of instruction" but that's not, it's still inside the parameter array

acoustic yew
#

oh okay

#

that's all?

#
_id = addMissionEventHandler [
                "MapSingleClick", {
                    _pos = _this select 0; 
                    _wp = convoyGroup addWaypoint [_pos, 0];
                    _wp setWaypointType "MOVE";
                    _wp setWaypointBehaviour "CARELESS";
                    //_wp setWaypointCombatMode "YELLOW";
                    /*if (isNull _mainMarker) then {
                        deleteMarker _mainMarker
                    };*/
                    _marker = createMarker ["transportMarker", _pos];
                    _mainMarker = _marker setMarkerType 'hd_dot_noshadow';
                    openMap false;
                    }
                ];```
hallow mortar
#

setMarkerType doesn't return anything, so trying to save its return value as _mainMarker doesn't do anything

#

The EH syntax looks right though.

acoustic yew
#

dw about those I will use it later

#
_id = addMissionEventHandler [
                "MapSingleClick", {
                    _pos = _this select 0; 
                    _wp = convoyGroup addWaypoint [_pos, 0];
                    _wp setWaypointType "MOVE";
                    _wp setWaypointBehaviour "CARELESS";
                    _wp setWaypointCombatMode "YELLOW";
                    if (isNull _marker) then {
                        deleteMarker _marker
                    };
                    _marker = createMarker ["transportMarker", _pos];
                    _marker setMarkerType 'hd_dot_noshadow';
                    openMap false;
                    }
                ];
            removeMissionEventHandler ["MapSingleClick", _id];```
hallow mortar
#

I assume there will be other code between the addition and removal, and you're not planning to add it and then instantly remove it

acoustic yew
#

uhh I might put a 1 second sleep

hallow mortar
#

That's...a pretty short window for the player to click

acoustic yew
#
// Add your custom action code here
            leader convoyGroup sideChat moveReply;
            openMap true;
            sleep 0.1;
            if (count waypoints convoyGroup > 0) then {
                {
                    deleteWaypoint((waypoints convoyGroup) select 0);
                }
                forEach waypoints convoyGroup;
            };

            sleep 0.1;
            _id = addMissionEventHandler [
                "MapSingleClick", {
                    _pos = _this select 0; 
                    _wp = convoyGroup addWaypoint [_pos, 0];
                    _wp setWaypointType "MOVE";
                    _wp setWaypointBehaviour "CARELESS";
                    _wp setWaypointCombatMode "YELLOW";
                    if (isNull _marker) then {
                        deleteMarker _marker
                    };
                    _marker = createMarker ["transportMarker", _pos];
                    _marker setMarkerType 'hd_dot_noshadow';
                    openMap false;
                    }
                ];
                sleep 0.4;
            removeMissionEventHandler ["MapSingleClick", _id];```
#

this

hallow mortar
#
if (isNull _marker) then {
  deleteMarker _marker
};```
This doesn't make any sense. If `_marker` is null, you can't delete it because it already doesn't exist.
acoustic yew
#

Oh ye this was a bit of confusion, should I use !isNull or isNull?

#

I want to check if _marker is available and if it is then delete it and carry on if not then carry on.

hallow mortar
#

In theory !isNull, but on closer inspection, _marker is not defined in this scope, so that won't really work anyway

#

_marker is a local variable which only relates to the current scope (in this case, the current instance of the EH code). It is a separate and unique instance of _marker with no connection to any other local variables in other scopes with the same name.

acoustic yew
#

so shall I make it notlocal object?

#
// Add your custom action code here
            leader convoyGroup sideChat moveReply;
            openMap true;
            sleep 0.1;
            if (count waypoints convoyGroup > 0) then {
                {
                    deleteWaypoint((waypoints convoyGroup) select 0);
                }
                forEach waypoints convoyGroup;
            };

            sleep 0.1;
            mapSingleClickEvent = addMissionEventHandler [
                "MapSingleClick", {
                    _pos = _this select 0; 
                    _wp = convoyGroup addWaypoint [_pos, 0];
                    _wp setWaypointType "MOVE";
                    _wp setWaypointBehaviour "CARELESS";
                    _wp setWaypointCombatMode "YELLOW";
                    if (isNull marker) then {
                        deleteMarker marker
                    };
                    marker = createMarker ["transportMarker", _pos];
                    marker setMarkerType 'hd_dot_noshadow';
                    openMap false;
                    }];
                sleep 0.4;
            removeMissionEventHandler ["MapSingleClick", mapSingleClickEvent];
hallow mortar
#

Kind of, but like that it won't work the first time it runs, because marker has never been defined at all, and isNull still needs to refer to a defined variable even if it contains null. Actually, a marker variable would never contain null anyway because markers are referred to by their string names, not as objects. Even if the marker was deleted, variables used to refer to it would still contain its string name, since that's...just a string.

#

In other words, use isNil instead

acoustic yew
#

ok

hallow mortar
#

Probably use a more unique name than just marker though, lord knows what other mods or scripts might also try to use a global var called marker. Put your name on it.

acoustic yew
#

haha

#

I am just testing stuff rn

#

Creative stuff wont come out at 12:12 am

hallow mortar
#

So, the other issue I was getting at before is that you're adding the mapclick EH, and then removing it 0.4 seconds later

acoustic yew
#

ye

hallow mortar
#

Why?

acoustic yew
#

uh cuz its work is done

hallow mortar
#

I mean, assuming the player actually clicked on anything in that 0.4 seconds, sure

acoustic yew
#

Okay I wanna clear this one as well, I don't want player to click on map and waypoint of convoy to flipoff

acoustic yew
#
// Add your custom action code here
            leader convoyGroup sideChat moveReply;
            openMap true;
            sleep 0.1;
            if (count waypoints convoyGroup > 0) then {
                {
                    deleteWaypoint((waypoints convoyGroup) select 0);
                }
                forEach waypoints convoyGroup;
            };

            sleep 0.1;
            mapSingleClickEvent = addMissionEventHandler [
                "MapSingleClick", {
                    _pos = _this select 0; 
                    _wp = convoyGroup addWaypoint [_pos, 0];
                    _wp setWaypointType "MOVE";
                    _wp setWaypointBehaviour "CARELESS";
                    _wp setWaypointCombatMode "YELLOW";
                    if (isNull tMarker) then {
                        deleteMarker tMarker
                    };
                    tMarker = createMarker ["transportMarker", _pos];
                    tMarker setMarkerType 'hd_dot_noshadow';
                    openMap false;
                    }];
                sleep 1;
            removeMissionEventHandler ["MapSingleClick", mapSingleClickEvent];```
hallow mortar
#

What this code does is open the map, and then for 1 second, the player has the ability to click on the map and cause that waypoint/marker stuff to happen. Once that 1 second has passed (say, if the player took longer than 1 second to figure out where to click) the opportunity goes away forever.

acoustic yew
#

ehh not for 1 second

#

oh wait...

hallow mortar
#

Are you thinking that the sleep happens after the player has clicked and activated the EH? Because it doesn't. It happens as soon as the EH is added.

acoustic yew
#

can I use waitUntil they put the waypoint and then remove it :)

hallow mortar
#

You don't need to, just put it inside the EH

acoustic yew
#

put what may I ask?

hallow mortar
#

removeMissionEventHandler

acoustic yew
#

so...

hallow mortar
#

Then you can also use the _thisEventHandler magic variable and not need to save the ID as a global var

#

It's not that complicated :|

acoustic yew
#

at 12:18 am it is very complicated

hallow mortar
#

You are going to make the EH remove itself when it activates

acoustic yew
#

yeah

hallow mortar
#

The EH code, with the waypoints and markers and stuff, is executed when the EH activates

acoustic yew
#

yeah

hallow mortar
#

So we are going to put the removal code inside that code

acoustic yew
#

1 second isnt enough time fr

hallow mortar
#

So that it happens when the EH activates as well

acoustic yew
#

:0

#

BRAIN WORKS

#
// Add your custom action code here
            leader convoyGroup sideChat moveReply;
            openMap true;
            sleep 0.1;
            if (count waypoints convoyGroup > 0) then {
                {
                    deleteWaypoint((waypoints convoyGroup) select 0);
                }
                forEach waypoints convoyGroup;
            };

            sleep 0.1;
            mapSingleClickEvent = addMissionEventHandler [
                "MapSingleClick", {
                    _pos = _this select 0; 
                    _wp = convoyGroup addWaypoint [_pos, 0];
                    _wp setWaypointType "MOVE";
                    _wp setWaypointBehaviour "CARELESS";
                    _wp setWaypointCombatMode "YELLOW";
                    if (isNull tMarker) then {
                        deleteMarker tMarker
                    };
                    tMarker = createMarker ["transportMarker", _pos];
                    tMarker setMarkerType 'hd_dot_noshadow';
                    openMap false;
                    removeMissionEventHandler ["MapSingleClick", mapSingleClickEvent];
                    }];```
hallow mortar
#

You don't need to save or reference mapSingleClickEvent, just use _thisEventHandler in the removal

acoustic yew
#

ah ok

hallow mortar
#

.......well, actually, probably do save it. You probably want to remove the EH if they close the map without doing anything, so you'll need to refer to it elsewhere.

acoustic yew
#

hmm okay

hallow mortar
#

You can also not remove it if they close the map, but then this EH will just be sitting there waiting to fire the next time they open the map

acoustic yew
#

hmm

#

i mean yeah but really dont wanna mess the wp when player mis-clicks on map fr

hallow mortar
#

You want to detect when the player clicks on the map. There is literally no way for you to detect if this was a misclick or not. Where they click is what they get.

acoustic yew
#

ya that's why Im happy removing EH lol

hallow mortar
#

Oh, you can use the alt syntax of openMap to prevent them from closing the map until they've done something

acoustic yew
#

oh..

hallow mortar
#

You're pretty much there and it's late, so I'm going to bed. Good luck.

acoustic yew
#

Uhhh

hallow mortar
#

okay

acoustic yew
#
// Add your custom action code here
            leader convoyGroup sideChat moveReply;
            openMap true;
            sleep 0.1;
            if (count waypoints convoyGroup > 0) then {
                {
                    deleteWaypoint((waypoints convoyGroup) select 0);
                }
                forEach waypoints convoyGroup;
            };

            sleep 0.1;
            mapSingleClickEvent = addMissionEventHandler [
                "MapSingleClick", {
                    _pos = _this select 0; 
                    _wp = convoyGroup addWaypoint [_pos, 0];
                    _wp setWaypointType "MOVE";
                    _wp setWaypointBehaviour "CARELESS";
                    _wp setWaypointCombatMode "YELLOW";
                    if (isNull tMarker) then {
                        deleteMarker tMarker
                    };
                    tMarker = createMarker ["transportMarker", _pos];
                    tMarker setMarkerType 'hd_dot_noshadow';
                    openMap false;
                    removeMissionEventHandler ["MapSingleClick", mapSingleClickEvent];
                    }];```
hallow mortar
#

You're still using isNull when you should be using isNil

acoustic yew
#

OHH

#

nil and nul

#

god

#

me

hallow mortar
#

Remember that isNil requires the variable name to be given as a string, since it's trying to check a variable that may not exist

acoustic yew
#

:0

#

got it

hallow mortar
#

openMap [true,true] will open the map and prevent the player from closing it until you close it with openMap false. Useful if you want to make sure they have definitely done something before you close it.

#

I'm actually going now.

acoustic yew
#

alr

#

tysm

#

Well...

hallow mortar
#

๐Ÿ˜ถ position is not the 0th item in _this for a mapSingleClick EH. Use select 1 instead.

acoustic yew
#

oof

#

Lmao when u get up please explain this select 0 and select 1 thing. I read the documentation but my wee brain cant understand lol

#

shit addwp will be 0 nvm

hallow mortar
#

In this context, _this contains an array of the information the EH gives you about its event. select is being used to get an element from this array, by its numerical index. Arrays are 0-indexed; the first element is index 0, the second is index 1.
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#MapSingleClick
This lists the returns from the EH in question, in order. You want position, which is the second element so select 1.

#

You can also use params as shown there to automatically parse the contents of _this into a set of named variables. (You don't need to do that here since you're only using one of them)

acoustic yew
#

:0

acoustic yew
#

ah...

#

Omg, tysm

#

This means a lot

warm swallow
#

So no ๐Ÿ˜ข

manic sigil
#
{
switch (_x) do
    {
    case 0: {_x = "We've connected with the southern AAF roadblock and tracked a group of rebels who had fled the valley."};
    case 1: {_x = "An insurgent logistics vehicle was secured, and documents pertaining to Ignite's mission were recovered"};
    case 2: {_x = "We cleared an FIA staging camp west of Kore and recovered some coded plans."};
    case 3: {_x = "That POW we captured in Topalia must be giving away some prime intel by now."};
    };
} foreach [_selection1,_selection2];

_selection1 and _selection2 are defined, in my test case as 0 and 1. However, they are not being over-written with the strings when I run this code - but no errors are thrown, either.

#

... I figured a far simpler solution, but I'm keeping this up because I'm curious if it could have worked.

manic flame
#

I have been wanting to do something really dumb.

So today I learnt all the basics of SQF programming and how the arma engine works. I did a few things like a guy that sells bananas to the player or a car that explodes upon entering it... used CBA and all the funny things.

I was wondering, how does the fire support BI function work? I cant seem to figure out the position.

I tried setting the position param to getPos car_bomb but it did nothing. I also tried car_bomb itself. But once again nothing happened.

Asides that, does the BI method track the vehicle position or only the logged position at the time of execution? (Say the vehicle is moving and artillery is falling behind it, following it)

manic flame
sweet salmon
#

Howdy all, is there a way to check if a player is in the ESC menu in multiplayer?

#

isGamePaused works great for single player, but i need an equivalent for multiplayer

stark fjord
manic sigil
#

Ah, so it works, but just immediately screws itself ๐Ÿ˜

manic flame
manic sigil
#

Makes sense.

manic flame
#

Check the wiki builtin methods, maybe you see it there.

sweet salmon
grand stratus
#

Does battleeye run on dedicated servers? E.g can I run a non-whitelisted extension on a dedicated server

acoustic yew
manic flame
#

Hoe safe is it to use profiles as data storage? Im looking to have persistent storage across server and client of things like money, but im unsure where i can store this. Do i need an external db?

granite sky
#

safe-ish. Some people's server management sucks and they break their profiles.

#

Not entirely sure how they do it but starting two copies of the server accidentally might be a factor.

#

@acoustic yew "SCALAR", but _x isEqualType 0 is usually better.

agile pumice
#

could do a find "wheel_"

manic flame
granite sky
#

Each machine has its own profile namespace.

manic flame
#

Are the profiles verified by the server though?

granite sky
#

Not sure what you mean.

agile pumice
#

and then use a split function to get all the numbers

manic flame
#

Essentially, as i said before, i want to check how safe it is to store important data persistently (or semi persistently)

Data like how much money a player has

#

And i was wondering if profile storage was a safe method, since it had been recommended when i was checking the BI db section

granite sky
#

With most mission designs you'd only store and manage that data from the server. Client profile wouldn't be used.

manic flame
#

Yeah thats the idea

#

But i have no idea what to use since everything seems to rely on the client

granite sky
#

Clients can't write to server profile namespace without remoteExec.

acoustic yew
#
        // ย Attribute values are saved in module's object space under their class names (Convoy Speed).
        _convoySpeedString = _logic getVariable["SDR_ConvoySpeed", -1]; // loads information from module to script.
        convoySpeed = [0] apply compile _convoySpeedString param[0, objNull, [objNull]]; // This converts string to usable function!```
#

like here

#

instead of objNull

granite sky
#

just put any number in there.

acoustic yew
#

like in objNull?

manic flame
granite sky
#

I don't know that thing.

#

Writing data to profilenamespace is just profilenamespace setVariable ["TAG_myDataName", _mydata]

manic flame
#

Wouldnt that store it for the client though?

granite sky
#

Depends where you ran it.

manic flame
#

I see

#

initServer.sqf would work as a 'global' / serverside execution?

#

I guess i can always throw it with remoteExec

granite sky
#

If you want something relatively secure then you should restrict client remoteExecs to calling specialised functions on the server.

#

And design your system around that.

tough abyss
#

IF the vehicle uses that mask. Mask could be "XY"

fair drum
#

and you should start with doing that from the get go cause its is annoying af to go back and convert it

acoustic yew
#

Can someone help me with getting the number typeName?

        // ย Attribute values are saved in module's object space under their class names (Convoy Speed).
        _convoySpeedString = _logic getVariable["SDR_ConvoySpeed", -1]; // loads information from module to script.
        convoySpeed = [0] apply compile _convoySpeedString; param[1, [], [[]]]; // This converts string to usable function!```
meager granite
acoustic yew
#

yep

#

its me again

meager granite
#

Is it ChatGPT again?

acoustic yew
#

no no

meager granite
acoustic yew
#

yes really

meager granite
#

Even your question feels like ChatGPT at this point. Are you an AI trained on contents of this channel?

acoustic yew
#

๐Ÿ˜ chatGPT spy

#

LMAO

#

but fr I did not take any code from gpt

meager granite
#

Seriously though, no personal offence, neither your question nor your code make any sense.

acoustic yew
#

I will explain

#

Im bad at explaining tbh

#
        // ย Attribute values are saved in module's object space under their class names (Convoy Speed).
        _convoySpeedString = _logic getVariable["SDR_ConvoySpeed", -1]; // loads information from module to script.
        convoySpeed = [0] apply compile _convoySpeedString; param[0, objNull, [objNull]]; // This converts string to usable function!```
#

Focus on objNull

#

That is typeName for getting an object name

#

I want to take Scalar value

#

idk how to

meager granite
#

You give it any value of needed type

acoustic yew
#

uhhh

meager granite
#

Unary param operates on _this btw

#

What are you trying to do anyway?

acoustic yew
acoustic yew
meager granite
#

What's with apply compile?

acoustic yew
#

it compiles a string to a code

meager granite
#

But why, if its a value (number)? Why compile it?

#

Are you trying to turn string number into a number?

acoustic yew
#

I think I tried parsing...

#

can I shove value from _x to x?

#

using parse

meager granite
#
_convoySpeed = _logic getVariable["SDR_ConvoySpeed", -1];
if(_convoySpeed isEqualType "") then {_convoySpeed = parseNumber _convoySpeed};
acoustic yew
#

:0

#

uh

acoustic yew
meager granite
#
_convoySpeed = _logic getVariable["SDR_ConvoySpeed", -1];
// Say _convoySpeed is "123" (String)
if(_convoySpeed isEqualType "") then {_convoySpeed = parseNumber _convoySpeed};
// _convoySpeed will be 123 (Number) here
#

You can later do

whateverGlobalVariableYouWant = _convoySpeed;
```or anything else you want to do with it
acoustic yew
#

I get that but I dont want _convoySpeed in local variable, so can I do...

_convoySpeed = _logic getVariable["SDR_ConvoySpeed", -1]; if(_convoySpeed isEqualType "") then {convoySpeed = parseNumber _convoySpeed};```
meager granite
#

Assign it into global variable later after you're done preparing it

acoustic yew
#

when its parsed isn't it prepared?

#

I cant plug it in to use it?

#

Never used parsing meowsweats

meager granite
acoustic yew
#

like _convoySpeed = convoySpeed ?

meager granite
#

The other way around

acoustic yew
#

ye

acoustic yew
#

bruh its 5 am ๐Ÿ˜‚

#

I hope this works

median nimbus
#

what would be the best way to achieve a light house (light beam rotates around the Z axis) effect to a prop? I'm thinking of using createSimpleObject with one of the volumelights in a3_data_f but i'm not sure how I would keep it rotating all the time

meager granite
#

Not sure about light itself, didn't play around with it too much, but rotation can be done by bounding an angle to serverTime in each frame handler

acoustic yew
#

coding for 18 hours yay

meager granite
#

I'd suggest having each client creating their own local light object and rotating it themselves

#

But you can locally change transformation of global objects through an attachTo hack

median nimbus
#

yea I was about to ask how performance intensive it would be in a mp scenario

meager granite
#

Shouldn't be that big of a deal if done right

median nimbus
meager granite
#

It can be synced for everyone if bound to serverTime

#

Since engine already ensures it is synchronised between all clients

#
createNewLightCone = {
    if(isNil"myLightCones") then {myLightCones = []};
    myLightCones pushBack createSimpleObject ["...model...", _this, true];
    if(isNil"myLightConesEachFrameEH") then {myLightConesEachFrameEH = addMissionEventHandler ["EachFrame", {
        {
            _x setDir (serverTime % 10 * 360);
        } forEach myLightCones;
    }]};
};
#

This is all it takes really

#

Can be structured better though, but you should get an idea

median nimbus
#

oh that helps a lot, many thanks

meager granite
#

serverTime % 10 * 360 turns server time into 0-360 angle through 10 seconds

#

_this should be ASL position that simple objects use

meager granite
acoustic yew
acoustic yew
#

idk why it wont work

#

I guess I need a code? idk tbh

meager granite
#

post code

acoustic yew
#

one sec

#
        // ย Attribute values are saved in module's object space under their class names (Convoy Speed).
        _convoySpeed = _logic getVariable["SDR_ConvoySpeed", -1];
        if(_convoySpeed isEqualType "") then {_convoySpeed = parseNumber _convoySpeed};```
meager granite
#

looks proper

acoustic yew
#

yeah

meager granite
#

Your error is with hint which you didn't post

acoustic yew
#

standby

acoustic yew
#

Uh wait

meager granite
#

You need to feed string into hint

#

Just do hint str anyVariableHere to turn it into a string

still forum
#

What GUI elements where?
If something break thats a bug that should be reported as a bug and fixed

little raptor
bronze mulch
#

Here to ask about multiplayer scripting now...... I decided to make the script server side as it seems easier to not handle server and client interaction. Also, It allows me to zeus in new anomaly and still run the scripts. Therefroe, this is what I come up with. The key condition added is the if statement followed by while{alive _self} do. This allows the detection if the player is turned around.

//this should be the object that follow this movement scheme
params [
    ["_self",objNull,[objNull]]
];
//Get position of the anomaly
private _pos = getPos _self;
private _posAGL = ASLToAGL _pos;
private _seen = false;

while {alive _self} do {
    //When it is not dead
    {
        if (
        _x == player
        && {_x distance _posAGL <= 2000}
        && {
            private _dir = _x getRelDir _pos;
            _dir <= 90 || {_dir >= 270}
        }
        ) then {
            //The player is looking at the general direction of the anomaly
            //Return the visibility between player and the anomaly
            _canSee = [objNull, "VIEW"] checkVisibility [eyePos player,eyePos _self];
            if (_canSee > 0) then {
                //Disable AI movement when it is seen by player
                _self disableAI "MOVE";
                _seen = true;
                systemChat "Disable AI MOVE";
            } else {
                //Enable AI movement when it is not seen by player
                if (_seen == false) then {
                    _self enableAI "MOVE";
                };
                systemChat "enableAI MOVE";
            };
        } else {
            //The player is not looking at the general direction of the anomaly
            //Enable AI movement when it is not seen by player
            if (_seen == false) then {
                _self enableAI "MOVE";
            };
            systemChat "enableAI MOVE";
        };
        if (_forEachIndex == 0) then {
            _seen = false;
        };
        systemChat format ["_forEachIndex: %1", _forEachIndex];
        //Repeat this for every player in the server
    } forEach units player;
}

However, this script doesn't work on multiplayer for some reason. The

systemChat format ["_forEachIndex: %1", _forEachIndex];
would return 0 every time indicating that it is only looping for a single player but the server had two in the game. Extending the script to multiplayer seems troublesome now.......

little raptor
#

In fact you're lucky it even runs once

bronze mulch
little raptor
#

If you ran it on dedicated server it wouldn't run

bronze mulch
#

Well...... it runs on dedicated server

#

only problem is it only check my eyes not others

little raptor
bronze mulch
#

Wait.... wha

winter rose
#

(also getPos is not getPosASL)

bronze mulch
#

W.... would forEach allPlayers work? or that's a client side and not for server side

little raptor
#

Well it's clearly chatGPT generated ๐Ÿ˜…

bronze mulch
#

Oh sadly no

#

It's written by me being very confused in multiplayer scripting

winter rose
bronze mulch
#

I did get this partly from the Zeus Enhanced mod as it includes a function to show if a player is visible to a location

little raptor
bronze mulch
#

It would work even players joined or disconnects? Like it would updates it self or I had to do the work.

little raptor
#

Yes it would update allPlayers

#

And your while needs a sleep...

bronze mulch
bronze mulch
little raptor
bronze mulch
#

Wait....... 3042_late

#

o.... oh right I don't translation Dum

#

well That's one less function to run for optimization

little raptor
#

You didn't answer the question tho

bronze mulch
#

It's positionAGL which can be used as parameters for distance

little raptor
#

...๐Ÿ˜‘

#

Now are you sure chatGPT didn't tell you that?!

bronze mulch
#

Yes because arma 3 wiki is on my left monitor

little raptor
#

Then how come you didn't see it returns positionAGLS? thonk

bronze mulch
#

Because I look at Syntax 2 instead of Syntax 1

winter rose
#

:angery:

agile flower
#

Hello gang - anyone know of a method to read the items in a crate?

items _crate and itemsWithMagazines _crate don't seem to work

little raptor
little raptor
#

I don't recall if there's an itemsCargo

bronze mulch
winter rose
#

glad you caught it - now on to fix ze issues! โœŠ

bronze mulch
#

I'm afraid this will be the only Arma 3 script I will ever make. But at least I can make it works blobcloseenjoy. Thanks for answering my silly questions.

agile flower
meager granite
#

Is there a way to turn off vehicle laser?

winter rose
meager granite
#

Removing and readding the weapon or magazine is what I thought of right away, gonna see if fire does anything ๐Ÿค”

meager granite
fleet sand
#

Quick Question how to move object back and forward with setVelocityTransformation ? I was able to make object go from pos 1 to pos 2 in time interval but how would i make it so when it reaches to pos 2 to flip direction of travel but keep rotation ?

winter rose
#

maths

coarse needle
#

Does AllCurators not work as intended? I have a script which should add all opfor units as editable for two zeus' using the AllCurators command. Only the first zeus gets the units under his control though.

digital hollow
#

does exitWith not work inside getOrDefaultCall?

granite sky
#

can't see why it wouldn't. Example?

digital hollow
#
myMap = createHashMap;
private _value = myMap getOrDefaultCall ["key", {
    if true exitWith {"value"}
}, true];
isNil "value" // true
still forum
#

might be

south swan
#

sounds wut

#
myMap = createHashMap;
private _value = myMap getOrDefaultCall ["key", {
    if true exitWith {"value"}
}, true];
[isNil "value", isNil "_value", myMap, _value, _totallyDoesntExist] // [true,true,[["key",<null>]],<null>,any]``` somehow `<null>` and `isNil` at the same time ![meowsweats](https://cdn.discordapp.com/emojis/707626030613135390.webp?size=128 "meowsweats")
restive hinge
#

I'm having this weird error trying to call a variable through params

// fn_spawnCache.sqf
params ["_cachePos"];
_cachePos = _this select 0;
_lootCache = "VirtualReammoBox_camonet_F" createVehicle getPosASL _cachePos;
// Some stuff happens
// init.sqf
// _locationPosition is a valid position. Trust me.
_housesArray = nearestObjects [_locationPosition, ["House"], 1000];
_randomHouse = selectRandom _housesArray;
_positionsArray = [_randomHouse] call BIS_fnc_buildingPositions;
_cachePos = selectRandom _positionsArray;
[_cachePos] execVM "scripts\fn_spawnCache.sqf";

It looks like _cachePos is undefined. Any hints would be appreciated!

south swan
#

inb4 randomly selected house doesn't have any buldingPositions defined blobcloseenjoy

restive hinge
#

Hm.

stark fjord
restive hinge
#

Is there any boolean function to fetch the nearest building with positions?

stark fjord
#

did you try giving fn_spawnCache just, known good position?

restive hinge
#

I'll try!

stark fjord
#

like [player] execVM "scripts\fn_spawnCache.sqf";

#

OH lol

#

i see what it is

restive hinge
nocturne bluff
#

Its helpful to post the script ;)

stark fjord
#
//Gets array of objects, ja?
_housesArray = nearestObjects [_locationPosition, ["House"], 1000];
//slects random object
_randomHouse = selectRandom _housesArray;
//Gets positions of said of said house
_positionsArray = [_randomHouse] call BIS_fnc_buildingPositions;

//Select random position
_cachePos = selectRandom _positionsArray;
//Pases position as in XYZ vector to spawnCache
[_cachePos] execVM "scripts\fn_spawnCache.sqf";


//FN_SpawnCache.sqf
//Grabs POSITION from params
params ["_cachePos"];
//Does same as above again
_cachePos = _this select 0;

//Grabs a ASL Position OF a position and tries to create va there
_lootCache = "VirtualReammoBox_camonet_F" createVehicle getPosASL _cachePos;
//Should be:
_lootCache = "VirtualReammoBox_camonet_F" createVehicle _cachePos;
restive hinge
#

So the getPos is a problem!

stark fjord
#

yes you were trying to getPos a position

restive hinge
#

As the _cachePos is already a position.

#

Darn it.

#

Thank you!~

#

Works like a charm!

manic flame
#

Hiya, is this how you use the params in addAction?

intel_1 addAction ["Search Intel", {
    hint format ["%1 Has found intel!", _this select 1 params ["_target", "_caller", "_actionId", "_arguments"]];
    removeAllActions _target;
}];
#

Essentially, I want to make an action that appears once, then after one of the players interacts with it, it completely disappears

#

I cant use holdAction because intel_1 is a dead unit

stark fjord
open fractal
#

"script" in this case meaning the code block you pass to the addaction

manic flame
#

btw, im looking to redistribute my scripts across folders, right now im using initServer.sqf but im pretty sure there's better ways

stark fjord
austere hawk
#

wheels axis for physx vehicles are stored in wheels class parameter center = "axis_memorypoint123456"; for each individual wheel class

little raptor
digital hollow
#

yeah, can be worked around for sure. was just unexpected.

manic flame
#

?

stark fjord
manic flame
#

yeah, its in description.ext

#

im asking for what path i have to use to write down my method

#

like the actual logic of it

#

as far as i know the classes define the paths for the functions

hallow mortar
#

That will be in <missionroot>\functions\Category\fn_add_intel_port.sqf, since it's from description.ext. But you can change that* by adding file = "your\folder\path"; to the category class

  • still inside mission root, you can't set it to arbitrary folders wherever
manic flame
#

im guessing this works?

stark fjord
#

after you've done that

class CfgFunctions
{
  class MyUniqueTag  //must be unique class, dont use something like BIS
  {  
    class script
    {
        file = "myFunFolder";
        class myAwesomeFunction1 {};
        class myAWesomeFunction2 {};
    };
    class myOtherScript
    {
        file = "myNotSoFunFolder";
        class myUnAwesomeFunction1 {};
        class myUnAwesomeFunction2 {file="fun.sqf"};
    };
};

Above stuff Would be in following folder structure
mission.sqm
description.ext
fun.sqf <-- this is file of myUnAwesomeFunction2
myFunFolder\fn_myAwesomeFunction1.sqf
myFunFolder\fn_myAwesomeFunction2.sqf
myNotSoFunFolder\fn_myUnAwesomeFunction1.sqf

hallow mortar
#

file = " ... " defines the folder for that category. Individual file names are detected automatically based on the function names you declare, you don't specify an sqf file in that.

#

Also, it's \ for file paths, not /

manic flame
#

thanks

#

are methods auto-executed or do I need to call them from the initServer regardless?

stark fjord
#

no, they are not

hallow mortar
stark fjord
#

but you can do this class myAwesomeFunction1 {postInit = 1;}; //This will auto exec it on post

#

or you could use preInit or bunch of other fun stuff.

manic flame
#

thanks!

#

just what I needed

stark fjord
#

mind you it will execute on all. So you have to do a check inside the script something like if (!isServer) exitWith{};

manic flame
#

Yep, i'll make sure

#

Its all working btw, the scripts work and the path is fine aswell

stark fjord
#

Also functions get tag appended to call them in other scripts you use (from example above) [] call MyUniqueTag_fnc_myAwesomeFunction

manic flame
# manic flame

Although, an unrelated problem (haha), the "_target" param returns an array, apparently.

#

Essentially im trying to remove the action from the dead body for all the clients. but ehh... having trouble.

stark fjord
#

When running it with postInit, it will execute with no parameters

hallow mortar
#

Order of precedence problem, removeAllActions is being evaluated before select

#

Add some ()

manic flame
manic flame
hallow mortar
#

Yep

stark fjord
#

3rd line in your script params[] will be usesless you wont get those params out

manic flame
#

by out you mean executed by for example another script?

#

in that case i'll remove it

stark fjord
#

if you would run [1,2,3,4] call TAG_fnc_add_intel_port you would get _target == 1, _caller == 2, _actionID ==3, _arguments == 4, but now you will get nils for most of these

manic flame
#

alrighty

#

i got all working

#

thanks yall

#

see you in 15 mins whenever my next confusing problem appears

stark fjord
#

are you doing this for multiplayer ?

manic flame
#

Yeah

#

it is meant for MP

stark fjord
#

Then the next confusing problem will appear when you try to play this mission with friend and both will be able to get intel ๐Ÿ˜›

manic flame
#

yeeeahhh that's why i kept asking to remove the action across all clients

#

any workarounds?

stark fjord
#

you will have to remoteExec the function since addAction and removeAllActions has only local effect

manic flame
#

i see, i could remoteExec it over at initServer.sqf?

#

something like this, i'd guess?

stark fjord
#

If you dont intend to remove intel_1 object thru out the whole mission, action will add just fine. If you remove it script will error out for someone who joins late and intel_1 is already gone.
you'd wanna add a check like if (isNull intel_1) exitWith {}
Next as script has local effect, you want to run it on ALL clients not server itself, as server has no GUI it cant see action so instead of if (!isServer) exitWith {} you want if (!hasInterface) exitWith {}

manic flame
#

yeah no, intel_1 will be persistent, although I will keep in mind the advice

stark fjord
#

the second part of the message still applies

manic flame
#

yes

#

Im looking at it rn

#

i applied it

#

i will now try it across MP with a friend and see how it goes

#

is there any other utilities to test across MP?

#

Would Zeus controlled units count as a client?

#

im guessing not

stark fjord
#

it will work as follows: For example your buddy goes there, sees action, collects intel, only HE gets those messages (you dont).
Then you go there, you see the action (Even tho it should be gone), you collect the intel (again), and only YOU see those messages.

#

if this is desired effect then it will work.

#

Same for the hint.

manic flame
#

oh uhm... I think we are on a different line then

#

the idea is to disable the action across all clients and hint across all clients

#

Player 1 -> finds intel
-> Hint is sent all clients
-> action is removed from all clients

stark fjord
#

i understand, i just told you what will happen with your current script ๐Ÿ˜›

manic flame
#

ahhh

#

so having changed it to !hasInterface should deal with it, right?

stark fjord
#

no

manic flame
#

if not i'll just consider making the unit be alive so i can do the hold action system and let it be

#

alright i guess i'll just make the unit alive

stark fjord
#

hold action will have same effect ๐Ÿ˜›
Why this is tricky is cause you have to tell all clients across the network that script is already executed, so all clients can remove action themselves. Same for messages you wanna display

manic flame
#

aaarghhh

#

i'll just drop a computer and good ol arma 3 intel system and call it a day

#

item pops

stark fjord
#

if you wanna avoid scripting, thats the best way of dealing with it.

manic flame
#

I just dont wanna get into messy networking

stark fjord
#

otherwise you are looking at something like this:
Client picks up intel with action -> addAction scrip uses remoteExec to tell server, to tell all clients to run a different script -> That script would display the messages to said clients, and remove action from intel_1 object (including the client that triggered the action)

manic flame
#

sounds like something i could work with

#

I'll try

manic sigil
#

Checking before i fully commit to using a mobile phone (new); you cant take a normal GPS object and track it as a separate entity or rename it, right?

little raptor
manic flame
manic sigil
#

Scenario is, players find an abandoned truck and search it for clues, finding a dashboard GPS that needs to be handed off to be decoded.

I previously just used a normal GPS, but all the players have one already and I cant figure out a way to cleanly divide 'GPS in my pocket already' from 'GPS in this truck's inventory'.

#

I replaced it with mobilePhone_new and rewrote the dialog, but im curious if there was a way I could make a clean distinction.

zealous lintel
#

Hey, can somebody please help me cracking this?

i want a sentry behind a searchlight to check 4 points while he is still alive

this is what i have and it gives error because it cannot be suspended, can somebody please help me fix it?

`SMK_fn_doWatchJedna = {
0 spawn {
SMK_svetloJednaG doTarget SMK_svetloJednaCil_1;
sleep 5;
SMK_svetloJednaG doTarget SMK_svetloJednaCil_2;
sleep 5;
SMK_svetloJednaG doTarget SMK_svetloJednaCil_3;
sleep 5;
SMK_svetloJednaG doTarget SMK_svetloJednaCil_4;
sleep 5;
} remoteExecCall ["spawn", 0, false];
};

while {true} do {
if (alive SMK_svetloJednaG) then {
[_this] call SMK_fn_doWatchJedna;
};
sleep 21; // Wait 21 seconds before checking again
};`

granite sky
#

Syntax is busted on the first part. Not even sure how it interprets that.

zealous lintel
#

when i only call for the function it works just fine i just need to loop it somehow

granite sky
#

Probably works:

SMK_fn_doWatchJedna = {
    SMK_svetloJednaG doTarget  SMK_svetloJednaCil_1;
    sleep 5;
    SMK_svetloJednaG doTarget  SMK_svetloJednaCil_2;
    sleep 5;
    SMK_svetloJednaG doTarget  SMK_svetloJednaCil_3;
    sleep 5;
    SMK_svetloJednaG doTarget  SMK_svetloJednaCil_4;
    sleep 5;
};

while {true} do {
    if (alive SMK_svetloJednaG) then {
        [] remoteExec ["SMK_fn_doWatchJedna", SMK_svetloJednaG];
    };
    sleep 21; // Wait 21 seconds before checking again
};
#

remoteExec (not -call) runs in scheduled anyway so you don't need a spawn. Function only needs to exec where your unit is local because doTarget is local-argument global-effect.

zealous lintel
#

it gives the same error which i didnt solve "Suspending not allowed in this context"

granite sky
#

Maybe quote which line it's complaining about :P

#

but I guess you're running the code in unscheduled in the first place.

#

probably simplest to just move everything to the local function.

#
SMK_fn_doWatchJedna = {
    while {alive SMK_svetloJednaG} do {
        SMK_svetloJednaG doTarget  SMK_svetloJednaCil_1;
        sleep 5;
        SMK_svetloJednaG doTarget  SMK_svetloJednaCil_2;
        sleep 5;
        SMK_svetloJednaG doTarget  SMK_svetloJednaCil_3;
        sleep 5;
        SMK_svetloJednaG doTarget  SMK_svetloJednaCil_4;
        sleep 5;
    };
};

if (alive SMK_svetloJednaG) then {
    [] remoteExec ["SMK_fn_doWatchJedna", SMK_svetloJednaG];
};
#

The if is probably redundant. Depends on setup.

#

Code assumes that the locality of the unit doesn't change.

zealous lintel
#

well bless you it works

#

ty very much

granite sky
#

Actually, can I sanity check where you're putting this code...

zealous lintel
#

well firstly into console just to get it working, from there i will manage im still not sure if i will put it into trigger or sqf i might add little bit of complexity to it

velvet merlin
#
Result:
0.0191 ms

Cycles:
10000/10000

Code:
for "_i" from 1 to 50 do 
{ 
    configFile >> "cfgVehicles" 
};


Result:
0.008 ms

Cycles:
10000/10000

Code:
private _test = configFile >> "cfgVehicles"; 
 
for "_i" from 1 to 50 do  
{  
    _test 
};```
#

initially i thought caching data read from config would useful

#

however when we tested with getText for simulation type, getVariable was slower

#

above though again seems to indicate at least certain parts of config access would make sense to cache if you do it very often/frequently

cosmic lichen
#

That code looks familiar ๐Ÿ˜„

granite sky
#

Not sure what you think that's demonstrating really, other than fewer commands => faster

#

configFile >> "thisDoesntExist" is only slightly quicker than configFile >> "cfgVehicles"

hallow mortar
#

MissileCore should detect the Vorona, and does in my usage

wind flax
#

Does anyone know what happened to the Server Transfer scripts (i.e redirectClientToServer)? All posts seem to be dead, not sure if anyone ended up polishing it or not

stark fjord
# manic flame Okayyy, here's the method i made. <@219852510955962368> `fn_clear_intel.sqf` ``...

Almost, but you need to do some more switcheroo like this:
fn_add_intel_port.sqf

//This script will execute on all clients because we used postInit=1 in CfgFunctions
//If something doesnt have interface (is not a player) we dont run this
if (!hasInterface) exitWith {};

intel_1 addAction ["Search Intel", {
  //Here we get action parameters
  params ["_target", "_caller", "_actionId", "_arguments"];
  //We remote execute script on all clients, even if self hosted, we pass it two params:
  //Who did the action, and what was action done on.
  //Here you could safely use [player, intel_1] instead
  [_caller, _target] remoteExec ["TAG_fnc_clear_intel", [0, -2] # isDedicated, true];
//Last true means that it will be sent to client, even if they join later/in progress
}];```
`fn_clear_intel.sqf`
```sqf
//This script will execute on all clients, because of remoteExec once one player does the action
//Grab parameters we gave it in remoteExec above (player and intel object)
params ["_caller", "_target"];
//Print the hint. Print all your other messages here too.
hint format ["%1 Has found intel!", _caller];
//Remove all actions from intel object
removeAllActions _target;```
sullen sigil
#

is there a limit to how far out position setting works? thonk

manic flame
#

thanks

#

what's with 0, -2?

stark fjord
# wind flax Does anyone know what happened to the Server Transfer scripts (i.e redirectClien...

Idk if it still works but this:
http://killzonekid.com/farewell-my-arma-friends/

If you are looking for something like Spotlight button to connect (middle button on main dashboard) you can use thishpp class CfgMainMenuSpotlight { class CoopCampaign { text = "Connect to my server"; textIsQuote = 0; picture = "\myAddon\picture.paa"; video = "\myAddon\video.ogv"; action = "connectToServer ['IP',PORT,'Password']"; actionText = "Connect to my server"; condition = "true"; }; };
https://community.bistudio.com/wiki/connectToServer
Has to be done via mod tho.

sullen sigil
stark fjord
# manic flame what's with 0, -2?

[0, -2] # isDedicated if server is dedicated, eg its running on its own box with no interface, it does not need to run this.
isDedicated will return true -> [0, -2] # true -> this will select -2 and remoteExec will not execute the script on server.
However if you are hosting from ingame, you are player and server at the same time, and you want this script to run on you also.
in that case isDedicated will return false, select 0th index in array, so 0 and remoteExec will run on all

warm swallow
#

Has anyone made a custom arma 3 lobby screen when you join a MP server?

coarse needle
#

Yeah well i dont have access to it right now ^^ Just thought it ask if there were any known issues.

wind flax
stark fjord
#

Then first link

fair drum
#

anyone got a better way to write this?

arsenal_whitelist_weapons_US = [
    "CUP_lmg_M249_ElcanM145_Laser",
    "CUP_arifle_mk18_tan_holo_laserflash",
    "CUP_lmg_Mk48_des_Aim_Laser",
    "CUP_arifle_Mk20_LeupoldMk4MRT",
    "CUP_arifle_mk18_tan_holo_laserflash",
    "CUP_arifle_mk18_tan_holo_laserflash",
    "CUP_arifle_mk18_m203_tan_holo_laserflash",
    "CUP_arifle_mk18_tan_holo_laserflash",
    "CUP_arifle_mk18_m203_tan_holo_laserflash",
    "CUP_arifle_mk18_tan_holo_laserflash"
];

arsenal_whitelist_acc_US = arsenal_whitelist_weapons_US apply {
    private _properties = configProperties [(configFile >> "CfgWeapons" >> _x >> "LinkedItems")];
    _properties apply {
        getText (_x >> "item");
    };
};
arsenal_whitelist_acc_US = flatten arsenal_whitelist_acc_US;
arsenal_whitelist_acc_US = arsenal_whitelist_acc_US arrayIntersect arsenal_whitelist_acc_US;

kinda heavy getting better
Execution Time: 0.0958 ms | Cycles: 10000/10000

meager granite
#

Skip on extra vars and functions

#

Also since this list seems to be static, just preload it once during mission loading

fair drum
#

yeah its gonna be only once anyways. just trying to reduce loadtime so I'm picking through stuff

sudden yacht
#

I looking for a way to create camera on users interface that takes up about half the screen? Help.

sudden yacht
#

I figured it out ๐Ÿ™‚

sudden yacht
#

Im trying to create to independent camera's. Both camera scripts work independently. However when added together... Only 1 of them works. Help. ```//FRONT LEFT WINDOW//
camera1 = "camera" camCreate [0, 0, 0];
camera1 camCommitPrepared 0;
camera1 camPrepareRelPos [0, -5, 10];
camera1 camPrepareFOV 1;
camera1 attachTo [car, [-0.79, 0.4, -0.4]];
camera1 cameraEffect ["internal", "back", "rttName1"];
if (!isPiPEnabled) exitWith { systemChat "PiP is not enabled in video options"; };

with uiNamespace do
{
private _ctrl = findDisplay 46 createDisplay "RscDisplayEmpty" ctrlCreate ["RscPicture", -1];
_ctrl ctrlSetPosition [safeZoneW * 0.205, safeZoneY, safeZoneW * 0.5, safeZoneH * 1];
_ctrl ctrlSetText "#(argb,512,512,1)r2t(rttName1,1.0)";
_ctrl ctrlCommit 0;
};

camera = "camera" camCreate [0, 0, 0];
camera camCommitPrepared 0;
camera camPrepareRelPos [0, -5, 10];
camera camPrepareFOV 1;
camera attachTo [car, [-0.9, 0.45, -0.4]];
camera setDir -90;
camera cameraEffect ["internal", "back", "rttName2"];
if (!isPiPEnabled) exitWith { systemChat "PiP is not enabled in video options"; };

with uiNamespace do
{
private _ctrl2 = findDisplay 46 createDisplay "RscDisplayEmpty" ctrlCreate ["RscPicture", -1];
_ctrl2 ctrlSetPosition [safeZoneW * -0.295, safeZoneY, safeZoneW * 0.5, safeZoneH * 1];
_ctrl2 ctrlSetText "#(argb,512,512,1)r2t(rttName2,1.0)";
_ctrl2 ctrlCommit 0;
};```

fair drum
sudden yacht
#

Yes. Updated. No luck.

fair drum
#

well when you do the first camera effect, you are moving your perspective to that camera, you then override that perspective the next time you use cameraEffect later

#

One cannot mix and match cameraEffect and can either have multiple r2t cameras or a single camera for the whole screen.

sudden yacht
#

updated, nodda.

#

Bear with me. Im an idiot

tough abyss
#

addCuratorEditableObjects only works on the server. maybe thats the issue.

#

as Quicksilver said...

velvet merlin
# granite sky configFile >> "thisDoesntExist" is only slightly quicker than configFile >> "cfg...

yeah that sample isnt really telling anything

we tried stuff like

_isTank = _vehicle getVariable "TEST_isTank";

if (isNil "_isTank") then {
 _isTank = _vehicle isKindOf "Tank";
 _vehicle setVariable ["TEST_isTank",_isTank];
};

or

_isTankSuper = (getText (configFile >> "cfgVehicles" >> (typeOf _vehicle) >> "super")) == 1;

the profiling via the console said direct sqf command is quicker than the getVariable access

granite sky
#

Well, the isKindOf one certainly isn't worth it.

#

Even if you did the setVariable on vehicle creation so that you didn't need the conditional lookup.

#

The getText one would be a small improvement but doesn't seem like a good tradeoff in code complexity.

#

I'd stick to caching stuff that's actually slow.

meager granite
#

@velvet merlin New getOrDefaultCall is a great feature to cache config stuff

#
someConfigPropertyCheckCache = createHashmap;
...
someConfigPropertyCheckCache getOrDefault [typeOf _this, {
    getText(configOf _this >> "simulation") == "UAVPilot" && (_this isKindOf "Whatever")
}, true];
#

Maybe also wrap that into a function but that's additional scope

#

Wrap into #define for additional drop of performance

#
#define MY_CONFIG_CHECK(VEH) someConfigPropertyCheckCache getOrDefault [typeOf VEH, {\
    getText(configOf VEH>> "simulation") == "UAVPilot" && (VEH isKindOf "Whatever")\
}, true]

MY_CONFIG_CHECK(player);
pulsar bluff
#

careful tho, in some uses its better performance to simply do the "getX (configfile ..."

sullen sigil
#

is there a way to find if something on screen is covered by part of a gui element (not including transparency)? sounds like it wouldnt be too performant if it is possible in a3

south swan
#

inb4 worldToScreen + ctrlAt

still forum
still forum
sullen sigil
#

or whatever the main screen number is

#

oh finddisplay exists amazing

#
onEachFrame {
    private _screenpos = worldToScreen ASLToAGL getPosASL jeffbezos;
    systemChat str ((findDisplay 1044) ctrlAt _screenpos);
};``` should work then? returning no control with ace goggles bits
little raptor
#

ACE goggles are not dialogs

#

They're cuts

sullen sigil
#

ah, how would I find the display for that? or is that not possible?

little raptor
#

It registers its display using setVariable

#

Find its name by checking its config or source on github

sullen sigil
#

I used findDisplay "RscACE_Goggles" with no dice either

slow brook
#

can someone poiint out what i've missed here?

// Log the shit that Zeus does...
// Zeus Logging
_zeus = ['adminZeus_1','adminZeus_2','z1_module','z2_module','z3_module','z4_module','z5_module','z6_module','z7_module','z8_module','z9_module'];

{
    _x addEventHandler ["CuratorObjectRegistered", { 
        params ["_curator"];
        private _scriptName = "Zeus Log";
        private _message = format ["%1 has become Zeus", profileName];
        [3,_message, _scriptName] execvm "scripts\performance\log.sqf";
    }];

    _x addEventHandler ["CuratorObjectPlaced", {
        params ["_curator", "_entity"];
        private _scriptName = "Zeus Log";
        private _message = format ["%1 has placed: %2", profileName, _entity];
        [3,_message, _scriptName] execvm "scripts\performance\log.sqf";
    }];

    _x addEventHandler ["CuratorObjectDeleted", {
        params ["_curator", "_entity"];
        private _scriptName = "Zeus Log";
        private _message = format ["%1 has deleted: %2", profileName, _entity];
        [3,_message, _scriptName] execvm "scripts\performance\log.sqf";
    }];
} foreach _zeus;
12:19:20 Error in expression <module','z8_module','z9_module'];

{
_x addEventHandler ["CuratorObjectRegistere>
12:19:20   Error position: <addEventHandler ["CuratorObjectRegistere>
12:19:20   Error addeventhandler: Type String, expected Object,Group
warm hedge
#

Well, literally the error says

#

Not sure what is the intention and what those _zeus array do so can't really say what to fix

slow brook
#

The zeus array is the named modules for gamemaster

warm hedge
#

So like adminZeus_1 is the name of the Game Master module and so forth?

slow brook
#

Yep

warm hedge
#

Then get rid of ' for those _zeuss

slow brook
#

oh right, just have it as [adminzeus,ect]

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
little raptor
sullen sigil
little raptor
#

Again it uses setVariable to register it on uiNamespace

#

Using its onLoad EH

sullen sigil
#

ya i was looking at the effects one, mb

#
onEachFrame {
    private _screenpos = worldToScreen ASLToAGL getPosASL jeffbezos;
    private _display = uiNamespace getVariable "ACE_Goggles_Display";
    systemChat str ((_display) ctrlAt _screenpos);
    systemChat str _screenpos;
};``` also isn't working though isn't throwing any errors, `_display` matches IDD and screenpos is changing when you look about, fails when object not on screen
little raptor
#

Yes you should check if screenPos is empty

sullen sigil
#

it's returning systemchats of expected coordinates and no control

little raptor
#

Does it even have any ctrls?

#

Did you check allControls?

sullen sigil
#

[Control #10650] returned by sqf private _display = uiNamespace getVariable "ACE_Goggles_Display"; allControls _display;

little raptor
#

Maybe it's in background and ctrlAt doesn't check background?

#

Check its config

sullen sigil
#

would be my guess -- how would I know from its config? not too well versed w/ gui bits

little raptor
#

See which class its defined in

sullen sigil
#

rsctitles

little raptor
#

Controls vs ControlsBackground

sullen sigil
#

oh

little raptor
#

Yeah. Dunno then

sullen sigil
#

probably more hassle than its worth rather than just putting icons across the whole screen rather than hiding hud outside of glasses

stark fjord
#

What are you trying to do tho?

sullen sigil
#

make a hud that doesnt appear over the ace goggles gui

#

hud part is easy thats just drawicon3d etc

zenith stump
#

Planning to do some small scale RP stuff with my friends.

I have few civilian vehicles on the map just driving around with waypoints, so that the roads aren't just empty of all traffic.

What would be the best way to make sure the cars driving around don't run out of fuel, but don't have too much either in case my players decide to... "borrow" one.

stark fjord
#
if (!isServer) exitWith {};
[this] spawn
{
    params["_vic"];
    while {alive _vic && local _vic} do
    {
       _vic setFuel 0.5;
       sleep 600;
   };
};```
little raptor
stark fjord
#

True, but if he has em set i guess that script would work. If player takes driver, script will end. Or vic gets destroyed

coarse needle
#

Allright

little raptor
stark fjord
#

I guess. But easier for non versed to just copy pasta into init. And then copy paste as many as you want.

#

I hope he wont have 50 of em.

little raptor
#

I would say it's equally easy to do this:

  1. Place all vehicles in a layer
  2. Do this:
{
   _x setFuel 1
} forEach getLayerObjects "layer"

In a loop
(Can't type or check bc I'm on mobile but I guess it's understandable)

hallow mortar
#

getMissionLayerEntities

south swan
zenith stump
#

It's just a small area. I have 4 cars following various waypoint i set to cycle. Idea being that they pass other vahicles occasionally.

south swan
#

oh, hey, we've invented Modules again ๐Ÿ™ƒ

zenith stump
coarse needle
south swan
coarse needle
#

Finally got to my PC :D

#

Fkin halloween

zenith stump
#

I guess I could also manually change the fuel of any vehicle they "borrow" as Zeus.

Would that make it simpler to make sure they don't run out of fuel while NPC's just drive around?

hallow mortar
#

Most of the solutions posted here are functional and pretty simple. They're just arguing about the most best way to do it. You can just pick whichever one you like, with only 4 cars it won't make much difference.

jaunty girder
#

Whitelist certain weapons

#

out of the ACE Arsenal

#

how would I go about doing this?

stark fjord
sullen sigil
stark fjord
#

Well... just check if the "ace_googles_display" ui var isnil. If it aint show, if it is dont show...
Or you wanna layer it underneath ace goggles?

sullen sigil
#

no as in
if you have goggles on it wont show on the goggles part, only the transparent part ๐Ÿ˜…

stark fjord
#

Ooh, so like scale it? To fit actual "cut out area"?

sullen sigil
#

errrr

#

ya

#

i think

winter rose
#

"behind" the goggles drawing

sullen sigil
#

like this where black boxes are bits of ace gui

#

but i cannot layer with drawIcon3D so it would just need to stop drawing if the object is under the gui

stark fjord
#

What if you make your own rsc?

sullen sigil
#

needs to be drawicon3d'd

stark fjord
#

God damn 3d.

sullen sigil
#

its not the end of the world if icons show through the gui tbh

#

was just wondering if its doable

stark fjord
#

I mean ace goggles just draw picture over whole screen and stretch ot to fit. So unless u check transparency of pic... idk

sullen sigil
#

its no big deal, more performant without meowheart

tough abyss
#

allMissionObjects "Man" includes rabbits, snake and fish

#

CAManBase, but whatever

coarse needle
#

Doesn't add rabbits snake and fish for me :D

stark fjord
#

Btw is nowdays any "clean" method for transforming players into ragdolls on demand.
By clean i mean without hitting them with heavy objects at high speed?

sullen sigil
#

BIN_fnc_setRagdoll exists but idk how clean it is

little raptor
sullen sigil
little raptor
#

Well that's the thing. It's just one texture

#

You have to calculate the black areas yourself

#

Per texture

#

And if they changed their textures your feature would break ๐Ÿคท

stark fjord
#

Also there is BIN_fnc_setRagdoll however it has evil little text in description

This content is exclusive to the Arma 3 Contact Expansion.

little raptor
#

Yes BIN functions are for Contact DLC

stark fjord
#

given the parameters it takes, it seems to be same exact function

#

with a check for typeof "Man"

little raptor
#

I doubt it uses addForce

#

it's much newer than contact DLC

south swan
#
// Exit if _unit is not a man
if(!(_unit isKindOf "Man"))exitWith{};

// Disable damage
private _damageState = isDamageAllowed _unit;
if(_damageState)then{_unit allowDamage false};

// Create collider and increase its mass
private _pos =  (AGLtoASL(_unit modelToWorldVisual (_unit selectionPosition _position))) ;
private _collider = "ObjectCollider_01_small_F" createVehicleLocal [0,0,0];
_collider setMass 10^10;
_collider setPosASL _pos;
_collider setVelocity _force;
``` ๐Ÿ™ƒ
#

copypasted from BIN_fnc_setRagdoll

winter rose
#

should be "CAManBase" ๐Ÿ˜ฌ

stark fjord
#

Even they use dirty trick ...

south swan
#

hey, what if you want to ragdoll a butterfly?

stark fjord
#

// Exit if _unit is not a man

little raptor
#

there was no other way back then

digital hollow
stark fjord
#

ill try it... as soon as 35 gb finishes downloading. But im already in a predicament if this will be good enough.
You see i have a monster and i want it to drag the player for certain distance and then toss them somewhere.
setForce will work fine for tossing... dragging will be a different bridge to cross.

digital hollow
#

lift player with (optionally invisible) rope

stark fjord
#

will that ragdolize them?

sullen sigil
#

is there a publicVariableServer for individual namespaces etc or do i need to getvar + setvar

stark fjord
#

i dont want them to be standing behind the monster with default arma "this is fine" expresion

hallow mortar
# stark fjord will that ragdolize them?

It won't start a ragdoll, and you can't move non-ragdoll players with ropes since they aren't PhysX. But you can ragdoll them (e.g. addForce), then attach the rope, and drag them while they're ragdolled

stark fjord
#

thanks, will try, also, how long will they stay flacid?

hallow mortar
#

I'm pretty sure they'll be limp as long as they're being moved around

stark fjord
#

cool. T. Hanks

hallow mortar
#

Alternatively, you can force them into a downed animation and attachTo them to the monster ๐Ÿคท

stark fjord
#

did that so far but it looks silly. Since monster jumps around quite a bit

#

ill try the rope (no, not like that). Might be just what im looking for.
For reference its a smoke monster from lost. So it tends to be quite jumpy and quite throwy from time to time, to physically break player and not outright kill them. With ACE breaks bones etc

drowsy geyser
#

Why is the ragdoll state not permanent?

#

What is the reason?

hallow mortar
#

Because people automatically recover from being ragdolled, since they have arms they can use to get back up

drowsy geyser
#

Well, it would be nice if we could control it somehow, imagine a player "fainting" midair and switching into a revive state, looks pretty annoying

tough abyss
#

Maybe they aren't spawned at that point

stark fjord
#

or have ragdoll fights or qwop

stark fjord
#

it just stand still until rope stretches enough to break

molten yacht
#

Hi, so I have this holdAction that when complete, calls execVM "script.sqf"

And in that script, I've got things like:

["tsk_getAirdrop","SUCCEEDED"] call BIS_fnc_taskSetState;
chemGet = true; 
publicVariable "chemGet";
jesterDummy setGroupId ["JESTER I/O NODE 451"]; 
jesterDummy sideChat "Sensors indicate you have opened the crate.";
sleep 2;
jesterDummy sideChat "The chemical detectors have been modified to seek out trace anomalous readings.";
sleep 2;
jesterDummy sideChat "Please take them with you.";
player createDiarySubject ["keyItems","Key Mission Items"] ;
player createDiaryRecord ["keyItems", ["Anomalous Detector", "You've been given a modified chemical detector. <br></br><br></br>Your friend says it's been modified to be helpful to you.<br></br><br></br>Show it briefly by holding <font color='#FFA600'>O</font>: Toggle it onscreen by double-tapping <font color='#FFA600'>O</font>."]];
systemChat "Key items listing updated.";

** I now understand that this will not properly give the task to all players because of locality issues and only the person triggering the holdAction getting the proper messages and diary record. **

How can I refactor this code to send the same messages to all players (co-op zeus mission) and add the same diary entry to all players?

winter rose
#

remoteExec

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
winter rose
#

what, @little raptor

little raptor
#

isn't what he posted the addAction code? meowsweats

molten yacht
# winter rose what is your holdAction code?

I admit I'm cheating and using eden enhanced, so the execVM is just in one of the boxes (on completed). But the proper invocation for this, I think, would be:

[
    airdropCrate,                        
    "Open Airdrop",                        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
    "_this distance _target < 3",            
    "_caller distance _target < 3",                
    {},
    {},
    { execVM "script.sqf" },
    {},                                                    
    [],                                                    
    3,                                                    
    0,                                                    
    true,        
    false    
] remoteExec ["BIS_fnc_holdActionAdd", 0, airdropCrate];
#

(ignore the incorrect icons, I just grabbed from the wiki real quick)

#

I have the good fortune to know that things like the global variable DO fire correctly for everyone in the mission

#

so the problem is my player createDiaryRecord

#

etc

winter rose
molten yacht
#

Everyone has the action, everyone can see SOME consequences of the action but not others

#

the chat messages from Jester don't work for anyone but the person touching the crate

#

same for the diary entry

#

because they're targeting player

#

instead of every hasInterface or something

#

I am 99.99% sure I know what is wrong, just not how to write it correctly

winter rose
#

yep
also, you don't want that action to be available once one person has activated it (I suppose)

molten yacht
#

I'm limited by not knowing the language too well

winter rose
#

wtf are those spaces/tabs

molten yacht
#

I'm unworried about the holdAction itself, since I'm using the editor plugin.

#

So should I just be calling the same script with remoteExec? it still feels wrong to use player here

stark fjord
molten yacht
#

yeah sorry about that

#

I was trying to slim it down for discord's width weirdness

winter rose
molten yacht
#

I'd like to do this in a "best practice" sorta way

#

instead of being An Shitter with bad code

stark fjord
#

dirty but easiest way would be to remoteExec every single one of the functions in your script. Except sleep and publicVariable.
and add !chemGet to condition, so action disappears once someone completed it.

molten yacht
#

You mean, remoteExec every sideChat and createDiaryRecord?

stark fjord
#

unless this is the place where chemGet is declared, in that case use !isNil "chemGet"

molten yacht
#

Also, is there a less dirty way that's worth pursuing in service of being a better scripter

stark fjord
#

create a function file, declare it via CfgFunctions inside description.ext, inside function file write part that would be executed on all clients.
Inside your action remoteExec that single function on all clients.

trim tree
#

why is it, that

playSound3D ["a3\missions_f_tank\data\sounds\powergenerator.wss", generator, false, [6516.65,20010.7,0], 5, 1, 0];

plays the sound as expected but

playSound3D ["a3\missions_f_tank\data\sounds\powergenerator.wss", generator, false, [6516.65,20010.7,0], 5, 1, 100];

does not? Only difference is the last parameter (being the distance) think_turtle

stark fjord
#

are you within 100 m of [6516.65,20010.7,0]?

trim tree
#

yes ^^ im within 1m ๐Ÿ˜„

stark fjord
#

Try position generator. Instead of hardcoded position. Or give it nil instead

trim tree
#

well, i used the log 3dPos to clipboard option, so unless that is not working correctly, it should be the same

#

Ok, found the issue

#

the 3dPos gave me the PositonATL where as playSound3D needs PostitonASL, and since i was 170m above water I didnt hear it ๐Ÿคฆโ€โ™‚๏ธ

#

thanks for the reminder ๐Ÿ™‚

lost glade
#

The talk feature does not work w me

tough abyss
#

"Animal" isKindOf "Man"
-> true

molten yacht
#

Thank you!

#

I did have another question

_heading = rad1 getDirVisual obj_laptopEnc; _heading = round _heading; _caller sideChat format["The transmission in the logs has a listed direction of roughly %1.",_heading];  tri01 = true;
#

This is intended to force players to triangulate a signal's position during the mission by giving them a compass heading

#

however, even though the targeted object was properly placed and named and worked in all the other scripts, in this script both of the triangulation computers gave the same heading that was also the wrong heading.

#

Any thoughts?

stark fjord
#

what would be rad1? and i assume obj_laptopEnc is an object?

molten yacht
#

yeah

#

I think

#

I just realized what I did wrong

#

I need to check

#

Ash you dumb bitch

#

I copied and pasted the laptop without changing rad1 to rad2

#

goddamnit

stark fjord
#

Also "PaperCar" isnt car at all ๐Ÿ˜ฆ

stark fjord
#

Okay, turns out you can tow "alive" player, if you nudge them a little bit with setVelocity. If player is standing on ground rope just breaks. However you cant tow a ragdoll / rope instantly snaps.

coarse needle
#

Interesting.

molten yacht
#

By the way, is there a better way to get a fake entity to speak than making some dude and dropping him off in the middle of the ocean so you can use him with

jesterDummy setGroupId ["JESTER I/O NODE 451"]; 
jesterDummy sideChat "Sensors indicate you have opened the crate.";
molten yacht
#

or is that actually the way to get a fake speaker

#

Also, missionNamespace is reset whenever the mission restarts, right?

#

I don't need to worry about carryover?

supple tusk
#

Sorry for the noob question but I'm trying to make an "elevator" for a mission I'm working on with scripts. currently I managed to get a teleportation script working to represent the transition from the bottom floor to top and I am currently trying to add some sound effects to go with it but I feel in way over my head. I've tried comprehending the forums but I don't understand any of what there talking about, if anyone can point me to a good source or can help me understand what Im doing wrong it would be greatly appreciated.

slim verge
#

i'm having some real issues getting an rsclistNbox to display a background colour, I've set the colour in the hpp definitions and also tried to set it in the script that uses it, is there an issue with listNboxes ??

sullen sigil
#

do you have a sound you want to play

supple tusk
#

I've been trying to play the base game "Alarm" sound effect

supple tusk
# fair drum what have you made so far

Currently I have a script that fades the screen to black, telepprts the player then fades back into focus. I'm trying to then add sound effects to it to make it sound like an elevator moving

fair drum
supple tusk
#

Gimme a sec and I can post it

#

Script currently on the button the players interact with

#

@fair drum script currently on the trigger attempting to play sound

stable dune
#

Hello,
Should default values in item config (CfgVehicles - - MyItem - attributes )
active when I'm not changing those?
Currenlty they doesn't.
Is there some line or something what I'm missing.
I have done attributes with this example

class CfgVehicles
{
    class B_Soldier_F;
    class MyEntity: B_Soldier_F // Your entity class
    {
        class Attributes // Entity attributes have no categories, they are all defined directly in class Attributes
        {
            class MyEntityAttribute
            {
                // ... attribute properties, see entity attributes
            };
        };
    };
};

So can I some way apply defaultValues of attributes, or do I have apply every attribute to save them.
In expression I have like in example.

expression = "_this setVariable ['%s',_value];"

And I getVariables which I have apply (changed) from attributes in editor.

novel basin
#

Hi
How Can i detecte when player aim with her weapons ?

stable dune
#

Aim down sight

novel basin
novel basin
still schooner
#

if (_weapon isKindOf ["Pistol"]) then { 
  _unit fire _weapon, round(random 3); 
};```
#

@warm hedge So the first code I just want to delay the reload animation speed

the second part is I want to make the unit with a pistol not fire only a single round, but consectively randomly between 1-3 rounds, for example when you are far away from AI it shoots once every like 5-10 seconds? but once you are closer it shoots consectively, thats what I am trying to achieve even if the AI is detecting far away

warm hedge
#

First part and second should work separately? Are not a part of one big code?

still schooner
#

yes should work seperate

#

or it can be togther idk im new to this scripting

warm hedge
#
  1. CBA_fnc_addEventHandler takes no such arguments, first should be string second should be code
  2. You can't make the reload animation slower or quicker
  3. Your second part does not do anything more like syntax error.
  4. Since I don't really know when/how the second part will happen, I really cannot answer this
south swan
#

inb4 chatgpt

still schooner
warm hedge
#

That won't do either

south swan
still schooner
#

aaahhh

still schooner
warm hedge
#

I'm not asking what it does, but when it does

still schooner
#

When the AI sees the enemy

warm hedge
#

Regardless if they aim at the enemy or not?

still schooner
#

they have to be aiming at the enemy

#

AI sees enemy, turns around to its position, aims, randomly fires 1 times, then maybe 2 times consecutively, then back to 1, idk how complex that would be.

warm hedge
#

Well, I actually don't know what is wrong with the current AI

still schooner
#

with pistols, they aim at you but shoot one time, long pause, shoot one time, long pause, shoot one time, its not really realistic

warm hedge
#

Well, it does it for me like only 0.5 seconds, but anyways I'll make one

#
this addEventHandler ["Fired",{
    params ["_unit","_weapon","_muzzle","_mode"] ;
    private _scripted = _unit getVariable ["_scripted",false] ;
    if (_weapon == handgunWeapon _unit and _unit ammo _muzzle != 0 and !_scripted) then {
        [_unit,_muzzle,_mode] spawn {
            params ["_unit","_muzzle","_mode"] ;
            for "_i" from 0 to 2 do {
                sleep ((random 0.05) + 0.10) ;
                _unit setVariable ["_scripted",true] ;
                _unit forceWeaponFire [_muzzle,_mode] ;
                _unit setVariable ["_scripted",false] ;
            } ;
        } ;
    } ;
}]```
modern meteor
#
waitUntil {_x distance _rearmtarget < 5 } forEach units group player - [player];

How can I check if my AI squad is in range of an object? The one above gives an error.

sharp parcel
#

Hi there, looking to build a FOB script but I am struggling to work out the array format [x, y, z] of every object. Is there a way I can build the FOB in the editor and then generate the position code from the editor? An example would be placing a 10m x 10 square Hesco barrier down and then placing 50mm raised on each corner of the barrier. I can build that in the editor but not sure how to write the code specific positioning.. example for my 50mm raised gun

south swan
sullen sigil
#

Does anybody have any stats for how much quicker a bunch of ifs are compared to switch true

winter rose
sullen sigil
#

Ah thanks

sullen sigil
#

Next question, is it possible to exceed 5 for playSound3D volume? Increasing gain on audio file causes it to lose quality too much

#

My explosion is too quiet ๐Ÿ˜ฆ

sullen sigil
#

i will calculate the delay due to the speed of sound and increase sfx volume for a split second then

hallow mortar
#

I'm not sure playSound3D is actually affected by the speed of sound

sullen sigil
#

it is

#

at least when ive been using it ๐Ÿคท

#

already did camera shake synchronised to when sound is heard so it's not far off

#

though it doesnt use the exact speed of sound

brisk lagoon
#

hey when I export a faction + images (to file) on ALiVE Orbat creator, where is the file located?

#

or is it copying to the clipboard and I did not understand it correctly

winter rose
#

see ALiVE documentation ๐Ÿ™‚

shut flower
#

Is there a pssibility to prevent someone from shooting at all? Even enableSimulation false allows the player to shoot.

prisma glen
#

is taking away their weapons or ammo not an option?

shut flower
#

not really

#

it would be worst scenario, but I don't want to do it

sharp parcel
#

using the boxloader mod.. I noticed I can only place down boxloader containers from the zeus function and I cannot find these containers in the editor, with all mods running. Has anyone else came up against this issue and found a fix to spawn boxloader containers outside of using zeus? cheers

jade abyss
#

Ability to move also?

sharp parcel
astral bone
#

I know there's an easier way to do this, and also I wanna sue lazy eval.

if((!((!(_turret_point isEqualTo objNull)) && (_turret_point in turret_points_all))) || (!(_turret_className isKindOf "AllVehicles")))exitWith{
#

if turret point is objNull, or if it isn't and it isn't in known turrets, or if the turret classname isn't a valid vehicle class, exit with.

#

Oh I think I wrote it wrong too- well, thus is why I hope to simplify it and am asking for help xD

#

if it's objNull, then no need to look in the turret points array, nor look at classname. If it's not objNull, then check if it is a valid turret spot, if it isn't, again, no need to look up the classname. If valid object, the look up the classname to ensure it's a valid vehicle.

#

Lmk if you can help, I'ma continue working on the rest of the code. :P
||Oh also, maybe a check for turret_points_all? or is that too much error checking redundancy? xD||

stark fjord
#

Now, i might be silly but sqf will evaluate all checks in if. Even if they are all and and first one fails.

If what i said above is true. Then best way would be to nest ifs

meager granite
#

Or if you have some code inside exitWith do a lazy eval condition:

    if(
           isNull _turret_point
        || {!(_turret_point in turret_points_all)}
        || {!(_turret_className isKindOf "AllVehicles")}
    ) exitWith {...code...};
#

Oh wait, you have different conditions in there, lemme fix

astral bone
#

also, wait a sec- I should be able to reduce it a tiny bit. When the className file is loaded, it goes through a thing to confirm it exists already. I could take the preset init's and combine into an array, and check className against that.
(I assume isKindOf basically goes through all of "AllVehicles" to see if it exists in there x3)

meager granite
#

It goes through all left operand parents to see if AllVehicles is one of them

astral bone
#

wait, if I give it "Akesm" (random letters) and see if it's kind of allVehicles- will it error or?

#

I like how I can test that

meager granite
#

The more I look at your original condition the more it confuses me

meager granite
#

Are you trying to check if your turret point exists in turret_points_all and of AllVehicles parent class?

astral bone
#

2 different variables

meager granite
#

Can you have _turret_point as null but some valid class in _turret_className at the same time?

astral bone
#

yes

#
params[
    ["_turret_point",objNull,[objNull]],["_turret_className","",[""]]
];
meager granite
#

Ok, both my conditions should work then

astral bone
#

function that spawns the turret then returns it. Spawning className at the turret point, correct position and direction, and- MAYBE a collision check? no idea how to do a collision check xD

meager granite
#

Depending on what you're checking against and how precise it should be

#

lineIntersectsSurfaces for precise checks, but its closly

#

otherwise you can do quicker bounding box checks

astral bone
#

could maybe also just sleep for a moment and see if it's dead :P

#

would be costly tho

#

no not costly, but yk

meager granite
#

My code snippet to check if position is inside entity bounding box

#

Can be optimized even more by caching inArea array

astral bone
#

well-

#

object bounding box or collision?

meager granite
#

Won't work for objects which have huge empty spaces in their bounding boxes

astral bone
meager granite
#

To check collision you'll need something more complex, yeah

astral bone
#

Mainly worried about-

meager granite
astral bone
#

Like, if the static gun in the first image spawns something it shouldn't, it might be able to jiggle around a bit before finding it's way out. But if the AA gun does-

#

I could maybe do a set up sorta thing-

meager granite
#

Check if static turret bounding box is not too big perhaps

astral bone
#

B/c I have those pads with names. So if static_weapon_point_light is given an AA gun heavy gun, it could deny it.

#

or I could just say yolo and deal with it if it breaks xD

#

If set up properly, it shouldn't spawn an AA gun in a small area, so :P

#

Yea, I think I will just trust it to be set up right. If someone puts a big turret in a small spot, then that's on them :P

astral bone
#

oh wait

still forum
#

Keep on scripting and someday your scripts will take over the world

astral bone
#

if only it was taking over the world by not slowing things down trying to make them better x3

#

does a million redundant checks, but also causes it to take forever to do them by mistake

#
if(isNull _turret_point || {!(_turret_point in turret_points_all)})exitWith{
    ["Invalid parameter, turret point is invalid. (%1 in turret_points_all == false)",str(_turret_point)] call BIS_fnc_error;
    objNull;
};
if!(_turret_className isKindOf "AllVehicles") exitWith {
    ["Invalid parameter, turret class not found. (%1 isKindOf ""AllVehicles"" == false)",str(_turret_className)] call BIS_fnc_error;
    objNull;
};

I think this is it.

#

Also, isNull, is that just "x isEqualTo [objNull/controlNull/scriptNull/etc]"? As in, universal null check sorta thing?

#

use it to check if it's null version of anything

#

I think you need the 2nd setVariable

#

think

#

I've seen people do the 2nd set so

still forum
#

You are sending the variable in its current state

#

The variable doesn't know it has been sent. The pushback won't know it should network sync. So it won't

#

If you change the value, you need to send again

astral bone
#

Yea, I was thinking that

#

Hmm- Should I look up the offset when spawning the turret or give the offset to the spawner function- Giving to spawner function might let it be faster, but also it'd make more sense if the offset was always used when spawning...

#

Oh also- heh- Should I make there be a way to do high/low weapons? If so, how would I say "This spot can have high or low, this can have only high" xD

meager granite
#

This is where ray cast would work

#

cast a ray to see if approximate low tripod barrel would be

#

You can also do that dynamically by checking barrel position of a gun you're spawning

astral bone
#

ray casting always is weird for me xD

#

oh, I know which guns would be high/low

#

But it'd be to check if the high/low can do there or if they'd just be hitting a wall :P

meager granite
#

The idea would be: Spawn simple object a a turret you want to place, find offsets of its barrel, cache the result for that model, delete simple object, cast a ray with barrel offset against the object you're trying to put your static weapon in, see if it hits the object.

#

Even more complex would be spawning your tower as a simple object too, casting there (so other objects aren't blocking your check cast ray on a real one), cache that too

astral bone
#

simpler way, although more complicated set up, might be to either make it part of the global object name or make a variable be set in the object's init field

#

I actually kinda like the name though-

#

"static_weapon_point_heavy" "static_weapon_point_heavy_high" "static_weapon_point_heavy_low"
any, only high versions, only low versions.

meager granite
#

Premade lists and setups are fine, but not flexiable because they require manual input work

astral bone
#

yea

meager granite
#

If you'll go down ray casting path, I think you need to check gunBeg and gunEnd of the turret config

astral bone
#

I might look into gunBeg for heavy weapons or something. So I can attach a light to them and have spot lights.

#

Maybe

tough abyss
#

I have something. Gimme a minute.

sullen sigil
#

is there any particular reason areas cant have rotation in more than one dimension? engine limitation or is there a trick im missing?

#

my problem is if i have an area on the deck of an aircraft carrier and then turn the carrier upside down, the area would be inside of the carrier thus making it unusable

brisk lagoon
#

I really need help because I am lost

#

I made a faction with ALiVE, I made the Cfgpatches file and everything needed

#

packed it into pbo, and it's an addons folder and I still can't see it in game

#

it worked yesterday and I have no idea what is wrong now

tough abyss
#

player addAction ["", {hint "You can't shoot"}, [], -99, false, true, "DefaultAction", "!commy_allowFire"];
commy_allowFire = false;

#

set to true to allow firing again

astral bone
#

would that be scripting?
Also, maybe it was cached into the game?

winter rose
#

that's mod-making, not scripting per se

astral bone
#

My own question. 1st, is there a way to scramble an array?