#arma3_scripting

1 messages Β· Page 121 of 1

left iron
#

and if i do selectRandom that makes it unable to return no value?

hallow mortar
#

selectRandom/Weighted selects one of the elements in the array you give it. It will only return nothing if the array you give it is empty.
The way it's implemented in the posted code, selectRandom can return nothing because it can receive an empty array from the previous stage. If it was just a defined array and selectRandom, then it would always return something.

spiral narwhal
#
private ["_dist"];

_dist = round(player distance (getMarkerPos "BPatrolPoint"));

[] spawn {
    waitUntil { (player distance (getMarkerPos "BPatrolPoint") < 15) || !alive player };

    if (player distance (getMarkerPos "BPatrolPoint") < 15) then {

        //Calculate reward 

        _reward = round(6.5 * _dist);

        deleteMarkerLocal "BPatrolPoint";

        [playerSide, "Base"] commandChat format ["You received %1 for patrolling! Your next point has been marked", _reward];

        life_patrol_in_progress = false;
    };
};

I keep on getting an error that that #_dist undefined variable in expression. What exactly have i done wrong? I tried both private and params for _dist at the beginning

winter rose
spiral narwhal
winter rose
#

[_dist] spawn {

granite sky
#

You'd have to pass the parameter into the spawn, like this:

[_dist] spawn {
  params ["_dist"];
  ...
};
spiral narwhal
#

ok thank you both, will try

#

thanks guys, it worked. i better stop coding at 3am πŸ˜…

winter rose
#

don't code while tired! indeed ^^

wet shadow
#

Hey people, quick question about the removeItem command. Empirical experience seems to be that items removed via this are taken in order uniform>vest>backpack. I was wondering if this is actually documented anywhere for a definitive answer?

proven charm
#

but it removes all items, why does the order matter?

#

did you mean removeItem?

wet shadow
#

Yes, removeItem, mistyped that. Order matters because of academic curiosity.

proven charm
#

ive been thinking the same, hopefully devs can shed some light on that one

formal stirrup
#

Considering the wiki does not state on the wiki, im not too sure. Give me about 5 minutes to do some testing

#

Can confirm it follows uniform -> Vest -> Backpack. I'll attempt to add a note to the wiki page about it

winter rose
formal stirrup
#

thanks lou

winter rose
#

added, thanks!

formal stirrup
#

cheers

proven charm
#
setObjectViewDistance -1
``` that doesn't reset it? like setViewDistance would do
agile pumice
#

okay so BIS_fnc_guiMessage just crashed my game

neon plaza
#

Good morning to everyone.

#

I am looking for someone to help with a script that will correct players that log on late using support roles. As of now the Issue Is that when the server first starts up, players that select the "Officer" role can use supports. That role has been linked to support request module In EDen editor. The Issue Is when new players connect to this role they no longer have access to It.

#

I found a script from 2014. The Issue with using this script Is when used It give ALL roles (Not just officer) the ability to use support functions.

#

I will place the line of code In here for someone to review. Thank you.

#

_this select 0 synchronizeObjectsAdd [SupportRequesterO];
SupportRequester synchronizeObjectsAdd [_this select 0];
BIS_supp_refresh = TRUE;
publicVariable "BIS_supp_refresh";
if (typeOf (_this select 0) isEqualTo "O_officer_F") then {
[_this select 0, ArtilleryRequester, ArtilleryProvider] call BIS_fnc_addSupportLink;
[_this select 0, CasRequester, CasProvider] call BIS_fnc_addSupportLink;
[_this select 0, TransportRequester, TransportProvider] call BIS_fnc_addSupportLink;
[_this select 0, AmmoRequester, AmmoProvider] call BIS_fnc_addSupportLink;
[_this select 0, HelicasRequester, HelicasProvider] call BIS_fnc_addSupportLink;
};

_this select 0 synchronizeObjectsAdd [SupportRequesterB];
SupportRequester synchronizeObjectsAdd [_this select 0];
BIS_supp_refresh = TRUE;
publicVariable "BIS_supp_refresh";
if (typeOf (_this select 0) isEqualTo "B_officer_F") then {
[_this select 0, ArtilleryRequester, ArtilleryProvider] call BIS_fnc_addSupportLink;
[_this select 0, CasRequester, CasProvider] call BIS_fnc_addSupportLink;
[_this select 0, TransportRequester, TransportProvider] call BIS_fnc_addSupportLink;
[_this select 0, AmmoRequester, AmmoProvider] call BIS_fnc_addSupportLink;
[_this select 0, HelicasRequester, HelicasProvider] call BIS_fnc_addSupportLink;
};

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
opal zephyr
#

you could try moving the code above the if statements into the if statements

fallen locust
#

you called it didnt you :P

native hemlock
#

Did you call it from unscheduled?

opal zephyr
#

For example, the first one has

_this select 0 synchronizeObjectsAdd [SupportRequesterO];
SupportRequester synchronizeObjectsAdd [_this select 0];
BIS_supp_refresh = TRUE;
publicVariable "BIS_supp_refresh";

Before the if statement that checks if the unit is an officer if (typeOf (_this select 0) isEqualTo "O_officer_F") then {
Im not 100% sure it will work, but you can try moving the above code into the if block, and the same with the second portion.

neon plaza
#

I will give this a try.

neon plaza
restive hinge
#

How can I get a config entry for a location?

// All below is fine
_sectorLocation = position _sector; 
systemChat str _sectorLocation;
_location = nearestLocation [_sectorLocation, "NameCity"];
_locationName = text _location;
systemChat str _locationName;

// This gives me an error:
_cfgPath = configFile >> "CfgWorlds" >> worldName >> "Names" >> configName (_location);
systemChat str _cfgPath;
opal zephyr
#

Whats the error it gives?

winter rose
#

configName takes a config, not a location πŸ™‚

restive hinge
winter rose
#

bingo ^^

restive hinge
#

I'm confused. Then how do I get the path for an entry? I suppose I can't use nearestLocation as it doesn't provide a way to get it's cfg name for an entry?

sullen sigil
#

does configOf take a location

#

i cant remember

winter rose
restive hinge
#

Lemme try, it says it takes an object

sullen sigil
#

thats not a location

restive hinge
#

Right

sullen sigil
#

why are location data types so scuffed in this game

winter rose
#

Β―_(ツ)_/Β―

sullen sigil
restive hinge
sullen sigil
#

lou is the biki

#

we just granted him sentience

neon plaza
#

@winter rose Having an Issue using the spectator module. I am trying to gather a script that can be Injected that will force Its operation when selected. Do you happen to know anything about this module?

winter rose
#

nope.

neon plaza
#

Alright thank you

#

@opal zephyr This Is an observe script I managed to gather from offline on a forum. Not sure If this should be placed In the Inti section of the module to help. Normally any other game mode will work with the spectator slot, but on warlords It keeps them on the black screen. I assume conflict with the coding somewhere.

#

// press number 5
// https://community.bistudio.com/wiki/DIK_KeyCodes

[]spawn{
waitUntil {!isNull (findDisplay 46)};
disableSerialization;
(findDisplay 46) displayAddEventHandler ["KeyDown", {
params ["_displayorcontrol", "_key", "_shift", "_ctrl", "_alt"];
if((_key isEqualto 0x06))exitWith {["Initialize", [player]] call BIS_fnc_EGSpectator;}
}];
};

// or
//player addAction ["Spectator", {["Initialize", [player]] call BIS_fnc_EGSpectator;}];

// press esc to exit

[] spawn {
while{true}do{
waitUntil {!isNull findDisplay 49};
["Terminate"] call BIS_fnc_EGSpectator;
uisleep 3;
};
};

winter rose
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
spiral narwhal
#

when it sayus client leaves the mission in MP

#

is that when the client goes to the lobby, or when the client disconnects from the server aPES_Think

sullen sigil
#

when they disconnect

#

its playerdisconnected

#

although actually

#

its probably player disconnected from mission

#

else disconnect handlers for code wouldnt cover lobby returns

little raptor
neon plaza
#

Anyone has a simple script for Halo drop with a timer?

#

Something a player can request and the option appears In the top left hand corner or maybe even attach to an object.

faint trout
#

Heya, does someone know if ace had an "Smoking Engine, when engine damaged" Feature around 2017 and is it still there? If no any other simple Ways to at such feature?

sullen sigil
#

thats a vehicle configuration thing

faint trout
sullen sigil
#

the answer to your first question is no

hallow mortar
#

Has anyone ever run into an issue where certain scripted UI things - specifically holdActions and showNotifications - become super laggy? For example, holdActions taking twice as long to complete as they should and having their progress circle update in chunks, rather than smoothly.
I've got a mission where they're normal, and a lightly modified copy of that mission where they're laggy, and I'm going slightly insane trying to figure out why, since none of the changes have anything to do with that, and it still happens even if I comment them all out

little raptor
#

can you try using the action in the first scenario after doing this?

for "_i" from 1 to 1000 do {
  [] spawn {while {true} do {for "_i" from 0 to 1e5 do {true}}};
}
hallow mortar
#

Scheduler crunch was on my mind, but I can't locate any change I made that actually added any more scheduled stuff

little raptor
#

which terrain do you use?

#

some are known to add many scheduled stuff

#

like cytech

hallow mortar
#

Livonia, for both versions of the mission

#

The only mod I have loaded is ADT

little raptor
#

run diag_activeScripts (or was it diag_activeSQFScripts?) to see what they are

neon plaza
#

This script did not work. Trying to accomplish 2 things with the script. 1) Players that rejoin the "Officer" slot will be able to use support roles. 2) Make It so that ONLY officers will activate this script. 3) Make It so that the officers can only call for support If they have a radio back pack on and equipped. Any feed back thank you. Line of code Is down below...

#

if (typeOf (_this select 0) isEqualTo "O_officer_F") then {_this select 0 synchronizeObjectsAdd [SupportRequesterO];
SupportRequester synchronizeObjectsAdd [_this select 0];
BIS_supp_refresh = TRUE;
publicVariable "BIS_supp_refresh";
[_this select 0, ArtilleryRequester, ArtilleryProvider] call BIS_fnc_addSupportLink;
[_this select 0, CasRequester, CasProvider] call BIS_fnc_addSupportLink;
[_this select 0, TransportRequester, TransportProvider] call BIS_fnc_addSupportLink;
[_this select 0, AmmoRequester, AmmoProvider] call BIS_fnc_addSupportLink;
[_this select 0, HelicasRequester, HelicasProvider] call BIS_fnc_addSupportLink;
};

if (typeOf (_this select 0) isEqualTo "B_officer_F") then {_this select 0 synchronizeObjectsAdd [SupportRequesterB];
SupportRequester synchronizeObjectsAdd [_this select 0];
BIS_supp_refresh = TRUE;
publicVariable "BIS_supp_refresh";
[_this select 0, ArtilleryRequester, ArtilleryProvider] call BIS_fnc_addSupportLink;
[_this select 0, CasRequester, CasProvider] call BIS_fnc_addSupportLink;
[_this select 0, TransportRequester, TransportProvider] call BIS_fnc_addSupportLink;
[_this select 0, AmmoRequester, AmmoProvider] call BIS_fnc_addSupportLink;
[_this select 0, HelicasRequester, HelicasProvider] call BIS_fnc_addSupportLink;
};

hallow mortar
little raptor
#

yeah I forgot which is which meowsweats

little raptor
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
hallow mortar
#
// OK
while {alive _this && f_var_coldBreathLoop} do {
  sleep (4*(1 - getFatigue _this) + random 1);
  if (vehicle _this == _this) then {
    // Code
  };
};
// ========
// NOT OK
while {alive _this && f_var_coldBreathLoop} do {
  if (vehicle _this == _this) then {
    sleep (4*(1 - getFatigue _this) + random 1);
    // Code
  };
};```
drowsy umbra
#

Trying to make mortars more effective in my coop mission - if a player loads a laser-guided mortar into an Mk6 ("8Rnd_82mm_Mo_LG") and it explodes on any tank or APC, I want to drop an armor-piercing round on top of that vehicle as well. Hoping to use eventHandlers to do this but I'm very new to them... any help would be appreciated

neon plaza
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
neon plaza
#

How do you use the !code

#

?

warm hedge
#

Not !code will do what it does

#

Write upper part of the bot said, you'll get bottom part of the bot

neon plaza
#

'''sqf
if (typeOf (_this select 0) isEqualTo "O_officer_F") then {_this select 0 synchronizeObjectsAdd [SupportRequesterO];
SupportRequester synchronizeObjectsAdd [_this select 0];
BIS_supp_refresh = TRUE;
publicVariable "BIS_supp_refresh";
[_this select 0, ArtilleryRequester, ArtilleryProvider] call BIS_fnc_addSupportLink;
[_this select 0, CasRequester, CasProvider] call BIS_fnc_addSupportLink;
[_this select 0, TransportRequester, TransportProvider] call BIS_fnc_addSupportLink;
[_this select 0, AmmoRequester, AmmoProvider] call BIS_fnc_addSupportLink;
[_this select 0, HelicasRequester, HelicasProvider] call BIS_fnc_addSupportLink;
};

#

Im not understanding. Doing something wrong here.

warm hedge
#
''' <- this is yours
neon plaza
winter rose
#
if (typeOf (_this select 0) isEqualTo "O_officer_F") then
{
  private _officer = _this select 0;
  _officer synchronizeObjectsAdd [SupportRequesterO];
  SupportRequester synchronizeObjectsAdd [_officer];
  BIS_supp_refresh = true;
  publicVariable "BIS_supp_refresh";
  [_officer, ArtilleryRequester, ArtilleryProvider] call BIS_fnc_addSupportLink;
  [_officer, CasRequester, CasProvider] call BIS_fnc_addSupportLink;
  [_officer, TransportRequester, TransportProvider] call BIS_fnc_addSupportLink;
  [_officer, AmmoRequester, AmmoProvider] call BIS_fnc_addSupportLink;
  [_officer, HelicasRequester, HelicasProvider] call BIS_fnc_addSupportLink;
};
neon plaza
#

if (typeOf (_this select 0) isEqualTo "O_officer_F") then {_this select 0 synchronizeObjectsAdd [SupportRequesterO];
SupportRequester synchronizeObjectsAdd [_this select 0];
BIS_supp_refresh = TRUE;
publicVariable "BIS_supp_refresh";
[_this select 0, ArtilleryRequester, ArtilleryProvider] call BIS_fnc_addSupportLink;
[_this select 0, CasRequester, CasProvider] call BIS_fnc_addSupportLink;
[_this select 0, TransportRequester, TransportProvider] call BIS_fnc_addSupportLink;
[_this select 0, AmmoRequester, AmmoProvider] call BIS_fnc_addSupportLink;
[_this select 0, HelicasRequester, HelicasProvider] call BIS_fnc_addSupportLink;
};

#

Ahhhhh

#

Thank you

#

So the red Is Incorrect?

warm hedge
#

Red?

neon plaza
#

Trying to figure out what Is wrong with this line of code.

#

I have been beating my brain In for hours.

warm hedge
#

How it is wrong? Errors?

neon plaza
#

Not functioning as required.

warm hedge
#

That doesn't tell us what is your need and how it doesn't work as intended

neon plaza
#

This script did not work. Trying to accomplish 2 things with the script. 1) Players that rejoin the "Officer" slot will be able to use support roles. 2) Make It so that ONLY officers will activate this script. 3) Make It so that the officers can only call for support If they have a radio back pack on and equipped.

#

Hell I could live without request 3.

#

I just need players to be able to connect to the role and have support option avlb.

warm hedge
#

How do you run this code?

neon plaza
#

Inti file

#

Someone explained Its where It would be placed.

warm hedge
#

The code has been placed into init.sqf directly?

neon plaza
#

Yes at the bottom.

warm hedge
#

This is why. The code doesn't recognize who is the player unit/role

neon plaza
#

Where would this needs to be placed? Or Is It a variable that needs to be named?

warm hedge
#

player is the command to get player unit

neon plaza
#

I figured that the "O_officer_F" role would work

#

Yes the players unit that they are playing as?

warm hedge
#

Pretty much player returns player unit object depends on the computer

neon plaza
#

It might explain why before the line of code gave EVERYONE the ability to call support roles.

#

All I did was move a part of the line of code upward.

#

What should be done Instead?

warm hedge
#

init.sqf does not have _this argument after all

manic sigil
# drowsy umbra Trying to make mortars more effective in my coop mission - if a player loads a l...

I put my best two braincells together on this and came up with... something. It's not exactly the cleanest, and I didn't test it with that exact ammo type, but with the vanilla Mk6 rounds, it would destroy a tank - given enough direct hits. Laser guided might help.

if (!isServer) exitWith {};
this addEventHandler ["Fired", 
{   
     params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
    if (_magazine != "8Rnd_82mm_Mo_LG") exitWith {};
    [_projectile] spawn 
    { 
        params ["_projectile"]; 
        private _list = [];
        
        while {count _list == 0} do 
        { 
            _list = position _projectile nearObjects ["tank",5]; 
            if (speed _projectile == 0) exitWith {}; 
        }; 
        if (count _list == 0) exitWith {};          
        private _pos = getpos _projectile;  
        private _vel = velocity _projectile;  
        private _dir = getdir _projectile;  
        _extraCharge = createVehicle ["Sh_125mm_HEAT", _Pos, [], 0, "CAN_COLLIDE"];   
        _extraCharge setvelocity _vel;   
        _extraCharge setdir _dir;  
    };  
}];
drowsy umbra
warm hedge
#

I'd suggest to use setProjectileOwner... or I don't recall name rn but so the scripted shell will be recognized by the game as someone's shot

drowsy umbra
# manic sigil I put my best two braincells together on this and came up with... *something*. I...

I came up with a solution that works (decently) for now thanks to this! Basically, if a laser guided mortar ends up landing a direct hit on <something>, an AT missile automatically spawns above the target and impacts exactly where the mortar hit, essentially making it an anti-tank mortar round.

this addEventHandler ["HitPart", {

_target = ((_this select 0) select 0);
_shellType = str (((_this select 0) select 6) select 4);
_hitPos = ((_this select 0) select 3);

hint str(((_this select 0) select 4));

if (_shellType isEqualTo str("M_Mo_82mm_AT_LG") && ((_this select 0) select 10)) then {

[west, "HQ"] sideChat "Hi there"; 

_missile = createVehicle ["M_Scalpel_AT", _target modelToWorld [0,0,1], [], 0, "CAN_COLLIDE"]; 
_missile setVectorDirAndUp [[0,0,-1], [0,1,0]];
_missile setMissileTargetPos _hitPos;
_missile setDamage 1;
};

}];```
manic sigil
plucky pewter
#

I'm having some trouble with the procedural texture function to provide real time camera feeds

#

When specifying width/height at the start, e.g. #(argb,W,H,mips), values of 8 for width and height (the default) produce the full camera image, as far as I can tell

#

But changing the width/height seems to have no effect on the image size or resolution.

warm hedge
#

What exactly you've done and your goal?

plucky pewter
# warm hedge What exactly you've done and your goal?

So, I probably need to rollback and the more I mess with things the more it is screwing up.

I was following this tutorial to create some cameras and display them to screens in game. https://www.youtube.com/watch?v=2PippMaKHGk
The tutorial worked pretty well, except for two parts: the first is that I can't seem to get the camera's field of view to rotate properly so I can aim it at a point of interest (it is fixed in position and rotation; I'm struggling to aim it in the editor)|

So this time we're looking at live camera feed and how to do it in ARMA. I recently showed to some people how I made a shoothouse with cameras and a fancy Captain Price desk where I can watch the live feed at.

Also, helmet mounted cameras are a bonus.

Chapters:
00:00 - Intro
00:06 - Setting up assets
01:17 - Camera lens reference points
02:33 ...

β–Ά Play video
#

The second problem I am having is that editing the procedural texture options often produces unintuitive or bizarre effects

#

Where say, changing the aspect ratio causes the picture to become a blurred mass of white and then disappear or something similar

warm hedge
plucky pewter
#

I figured

#

OK, the issue I am now having is that I cannot seem to pitch a camera down

#

OK, I figured this out. It seems if you want to change the pitch of a camera, you must use cameraSetDir; using setVectorDir will not take. Then you need to commit the changes using camCommit. You can set position normally but not pitch.

warm hedge
#

I forgot camSetDir is even a working command. A camera actually is just an object so vectorDir and Up can do it, unless camera related commands overwrite it

spiral narwhal
#

params["_nearbyVeh"]; 
 
_nearbyVeh = nearestObjects [player, ["Car", "Tank", "Air"], 5]; 

if isNil { _nearbyVeh } exitWith { hint "There are no vehicles nearby!" };

The goal of this code is to check to see if the player is near a car or anything.

So since nearestObjects [player, ["Car", "Tank", "Air"], 5]; returns [], is that why my code wouldn't be hinting?

If I run


if !isNil { _nearbyVeh } exitWith { hint "There are no vehicles nearby!" };

It will hint all the time, even when i am next to a vehicle.

How would i check if _nearbyVeh is empty or not?

warm hedge
#

count _nearbyVeh

#

An empty array is not nil, just it doesn't contain anything

#

Also that params usage does nothing

spiral narwhal
meager granite
#

Getting so used to getOrDefaultCall with hashmaps makes me wish for a getVariableCall for entities

warm hedge
#

Or getVariable ["var", 0, false, true]?

agile pumice
#

i did

meager granite
warm hedge
#

What you wish?

#

Was just a suggestion after your suggestion

agile pumice
#

i mean, i would expect it to either throw an error or not work, but not crash

warm hedge
#

Not sure which is smart to have another argument or diff command

agile pumice
#

apparantly it happen with the arsenal function too?

meager granite
#

Hmm, perhaps it could work by having a third argument as an indication that default value should be called if variable is not found?

warm hedge
#

Third as in #2 or #3? #2 is already occupied

meager granite
#

getVariable ["var", {123}] - return {123} code if "var" is not found
getVariable ["var", {123}, false] - call {123} if "var" is not found and just return it
getVariable ["var", {123}, true] - call {123} if "var" is not found, write into "var" and return it

warm hedge
#

Or wait

#

Misrecalled, third for getVar is not there

#

It's for set

meager granite
#

Did you think about broadcast for setVariable?

warm hedge
#

Yeah

warm hedge
#

Ticket please time I guess?

meager granite
#

Gonna make it now

warm hedge
#

Search before that tho

#

If there already is, bump it troll

meager granite
warm hedge
#

My cat... you're now green why not just do it yourself!!

meager granite
#

Commented with my proposal

velvet merlin
#

whats the most efficient way to find all enemies close to a group? nearEntities on each unit of the group and enemy state check?

proven charm
#

if you want speed you can loop through all the enemy groups and check only the leader distances to other leaders

velvet merlin
#

unlikely to be the most efficient way - especially if you have many groups

proven charm
#

but with nearEntities you may loop hundreds of entities while with group looping only tens of

velvet merlin
#

why hundreds? the engine pre-filters with the provided type first

proven charm
#

depends how many units you have, that was just an example

velvet merlin
#

best case would be to get access to the engine lists - but asking about whats available

proven charm
#

well you can of course use nearEntities but there are few similar commands and I dont know which one is the fastest

velvet merlin
#

i tried also with targetsQuery, targets with different setups

proven charm
#

like nearestObjects

velvet merlin
#

nearEntities with targetKnowledge check after seems most "efficient"

proven charm
#

so what are you trying to achieve here, if ok to ask?

proven charm
#

I mean what you do with all the enemies?

velvet merlin
#

determine a suitable spotter

proven charm
#

ic

#

doesn't sound speed critical script then

wind hedge
#

Is there any way to hide the binoculars while doing the binoculars animation? I want to use that pose for my "map in hand" script

warm hedge
#

No, it's not a script's responsibility

wind hedge
warm hedge
#

What I said, on the other words, it is an animation's responsibility

wind hedge
#
hideObject currentWeapon player
#

If only... πŸ˜…

wind hedge
warm hedge
#

If it is to tell other players β€œhey I'm watching a map” yeah I guess you can just use attachTo

wind hedge
little raptor
wind hedge
warm hedge
#

No

little raptor
#

why don't you just remove the binocs? and add them back again once they exit the anim?

wind hedge
little raptor
#

try using disableAI "ANIM" and disableAI "MOVE"

#

then do the anim player switchMove "anim"; player playMoveNow "anim"

wind hedge
#

Animation stays for a second and then goes back to normal

#

with just playmove "amovpercmstpsoptwbindnon" it stays longer but goes back to default again

little raptor
#

even with player disableAI "ALL"? meowsweats

wind hedge
little raptor
wind hedge
little raptor
#

you can also try:

player switchMove "amovpercmstpsoptwbindnon"; player playmoveNow "amovpercmstpsoptwbindnon"; onEachFrame {player playmoveNow "amovpercmstpsoptwbindnon";}
``` ![meowsweats](https://cdn.discordapp.com/emojis/707626030613135390.webp?size=128 "meowsweats")
wind hedge
little raptor
#

Was he supposed to?!

wind hedge
#

Without mods of course, the bino state when you press B is the closest I could find that lets you move and crouch like you are holding a map

little raptor
#

It's not possible

wind hedge
little raptor
#

Well you should really consider using mods with your missions. You can just make a shared mod that is used by all your missions. There are not a lot of things you can do with missions alone

silver pier
#

Can someone help me; _taskName = "Liberate Villages";
_villageName = "Pavlokhov";

if (!(taskState [_taskName, _villageName])) then {
taskSetState [_taskName, _villageName, true];

_liberatedVillages = 0;

{
    if (taskState [_taskName, _x]) then {
        _liberatedVillages = _liberatedVillages + 1;
    };
} forEach ["Pavlokhov", "Novoshny", "Solnevny"];

hint format ["%1 Villages Liberated! Move on.", _liberatedVillages];

if (_liberatedVillages == 3) then 
    hint "All villages liberated!";
};

};
its says : Missing ";" in line 5-6

warm hedge
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
silver pier
#

Ive got a problem it says missing ";"```sqf
_taskName = "Liberate Villages";
_villageName = "Pavlokhov";

if (!(taskState [_taskName, _villageName])) then {
taskSetState [_taskName, _villageName, true];

_liberatedVillages = 0;
{
    if (taskState [_taskName, _x]) then {
        _liberatedVillages = _liberatedVillages + 1;
    };
} forEach ["Pavlokhov", "Novoshny", "Solnevny"];

hint format ["%1 Villages Liberated! Move on.", _liberatedVillages];

};

warm hedge
#

taskSetState is not a command. setTaskState I assume

#

Syntax is invalid still though

silver pier
#

how do i correct it?

warm hedge
silver pier
#

I'm quite new to programming, so how do i fix that issue ? just replacing ? And what the task state would be Succeeded right ?

warm hedge
#

Uh so, let me ask one thing

#

Who wrote your script?

silver pier
#

Some lithuanian arma player

warm hedge
#

Then don't ask that player to write one. This script is not going to run anyways for various issues

silver pier
#

oof, thats bad. Could you guys help me make a new one then ?

warm hedge
#

Well, if we know what is your intention/things you need to prepare

#

Oh don't ask me to do so. It's 1AM already here

silver pier
silver pier
# warm hedge Well, if we know what is your intention/things you need to prepare

Sure let me explain : Its about a ukrainian special forces unit, who were told the task to liberate following three villages from occupants : "Pavlokhov", "Novoshny", "Solnevny". (thats the correct order). In these Villages are OPFOR Russian units placed and the have their ambient acitons going on until they spot the Ukrainian at the Village Entry (Probably a Trigger there). They open fire and a combat starts. When there are no OPFOR units left in the first villages area they'ill be assigned to recover from battle (Heal and stuff, just a hint though) And then when all are good to go again go to Novoshny, and execute the same actions. This Until 3/3 Towns have been cleared. The UAF Team consists of 7 Soldiers btw. When its finished, the mission ends.

tough abyss
#

How do I make ORBAT Groups for more than 3 divisions?

hallow mortar
#

More of an #arma3_config question but the short version is that it's like this:

class TopLevel1
{
  class T1SecondLevel1
  {
    class T1S1ThirdLevel1
    {
    };
  };
  class T1SecondLevel2
  {
  };
};
class TopLevel2
{
  class T2SecondLevel1
  {
  };
};```
The matching pairs of `{};` enclose all the things that are sub-classes (sub-units) of that class. Want something that comes from a new class instead of being a subclass of the current one? Close that class `};` and start a new one.
queen cargo
#

could be native code that is executed somewhere in em

neon plaza
#

if (typeOf (_this select 0) isEqualTo "O_officer_F") then {
_this select 0 synchronizeObjectsAdd [OpforCommander];
  OpforCommander synchronizeObjectsAdd [_this select 0];
  BIS_fnc_addRespawnPosition = TRUE;
  publicVariable "BIS_fnc_addRespawnPosition";
  [OpforCommander] call BIS_fnc_addRespawnPosition;
  
};

#

Trying to add a line of code to Initplayerlocal that will force the respawn module connected to certain roles to work.

cosmic lichen
#

BIS_fnc_addRespawnPosition = TRUE;
This won't work. You can't overwrite an existing function

#
if (typeOf player == "O_officer_F") then {
  [player, OpforCommander, "OPFOR Commander"] call BIS_fnc_addRespawnPosition;
};

This should do what you want.

neon plaza
cosmic lichen
#

initPlayerLocal.sqf

neon plaza
#

thank you.

neon plaza
#

Trying to avoid blue for spawning on It.

cosmic lichen
#

Every player of that type can spawn there

neon plaza
#

Just that faction? Alright thank you.

neon plaza
#

Once I disconnect from the server and rejoin the slot I no longer act as a spawn point.

#

When we first start the server everyone can spawn on the officer. Once a player leaves the slot It seems to desync the respawn module. A new player or same player will connect to the Officer slot and the respawning on that player no longer works.

molten yacht
#

I've got a script/addon that I'm working on and I'd like the keybind to specifically not work if the Zeus interface is up. How would I do that?

neon plaza
grizzled cliff
#

nothing more satisfying than something working right off the bat

#

:P

dreamy crown
#

Is there a reliable way of adding randomised damage level to buildings on mission start?

I've done it before a long time ago but I don't remember how I did it.

warm hedge
#

setDamage and random?

dreamy crown
#

It was using a game logic iirc

#

and on mission start, the code would run and apply a random level of damage to buildings within a specified radius.

#

Buildings, signs, trees etc

warm hedge
#

Game Logic is not really related with it. It does nothing but pretty much the source of a script

#

nearestTerrainObjects to get near terrain objects (well as the name implied), forEach to iterate them, setDamage or maybe setHit to apply damage

dreamy crown
#

Yeah I was told you could use anything as long as the code was in the init and a trigger was used.

warm hedge
#

Well besides that's true they are not the only way to execute scripts

dreamy crown
#

Aye

#

I know I made the mission and I saved it but I have hundreds of missions that I've made and just mashed the keyboard

grizzled cliff
#

god damn this is getting smexy

#

i need to eat something though cause im feeling light headed

sudden yacht
#

Question... How do i detect if a player is using a set CBRN uniforms????? Can i do this via a config path???

manic kettle
#

Compare to your defined classnames or I suppose you could do a config lookup comparison if it's from a specific mod

keen rain
#

So I'm building an underground bunker.
Out of curiosity, is there a way for objets placed to work "floating" ?

#

Like 1000m above ground?

hallow mortar
#

Most large structures don't have physics behaviour and can be placed at any altitude.
Physics objects also don't care and will be fine as long as they have something under them to stop them from falling.

#

If you're talking about units going into freefall when at high altitude, that's nothing to do with the objects. That's a property of the units themselves, and can be adjusted with the setUnitFreeFallHeight command.

whole karma
#

Can anyone help me with a vehicle spawning scipt

manic sigil
whole karma
# manic sigil What are you trying to achieve?

So in mike force there are dedicated spawns for vehicles. I want to add a vehicle spawn with a different vehicle that they don't have in the spawns. This is the code that they had attached to the spawn point when itriedto adjust it ['light_transport', 0] call vn_mf_fnc_veh_asset_3DEN_spawn_point

manic sigil
#

Are you creating your own spawn point, or adding to an existing one?

whole karma
whole karma
manic sigil
# whole karma if u have free time I could stream u my eden

I've done a little tinkering on modifying Mike Force, but I settled on simple addAction for spawning in vehicles - and in the latest version of the scenario, it's really only needed for the F-100 variants that aren't made available already.

Adding to the existing system is a chore and a bit beyond me, sorry XD

whole karma
keen rain
#

And can AIs targets units 1000m above them?

cursive tundra
#

hey, i wrote a script to get a mortar unit to fire on a random position in a trigger, however, when i call it, nothing happens except for the hint (which means at least im calling the function correctly i guess). Im not even getting an error message 😦 Does anyone know why that might be?

// your code here
params ["_mortar", "_target","_rounds"];
for "_i" from 1 to _rounds do {
_postarget = getMarkerPos "_target";
_trg = createTrigger ["EmptyDetector", _postarget];
_trg setTriggerArea [100, 100, 0, false];
_pos = _trg call BIS_fnc_randomPosTrigger;
_mortar doArtilleryFire [_pos, "8Rnd_82mm_Mo_shells", 1];
hint "Function was executed!";
};

Im calling it like this:

[Mortar01,FT01,8] call CBF_fnc_mortarFFE;

Edit:
Okay when im standing right next to the funny mortar man he say "Cannot execute, adjust coordinates." but it def is within range, if i get in i can reach the marked position easily

hallow mortar
# keen rain And can AIs targets units 1000m above them?

Probably, if they get line of sight or are otherwise made aware. They can certainly target vehicles at that range and use sniper rifles. Depending on the angle, they might not be able to actually hit anything - I don't think humans can aim directly up in Arma, and most vehicles can't either.
If you have a floor on your sky construct, it shouldn't be a problem.

hallow mortar
kindred zephyr
#

do they even acknowledge targets that are farther than 700m without being inside a vehicle?

hallow mortar
#

Also, you're creating a new trigger for every round fired, and never cleaning them up. Create one trigger at the start of each fire mission, and delete it afterwards.

hallow mortar
kindred zephyr
#

I dont think I've ever managed to make AI engage that far away vanilla wise, always assumed it was something regard cost of use of weapon something something and the fact that they cant land clear shots

#

launcher i have seen using the lock one ones

#

i gotta test now πŸ€”

hallow mortar
kindred zephyr
#

I tried using the marksman dlc weapons since I assumed that "reached farther" config wise but no luck

#

maybe they have to acknowledge the target to be able to engage it

#

sorry, cant english today

#

lol

cursive tundra
#
params ["_mortar", "_target","_rounds"];
_postarget = getMarkerPos _target;
_trg = createTrigger ["EmptyDetector", _postarget];
_trg setTriggerArea [100, 100, 0, false];
for "_i" from 1 to _rounds do {
_pos = _trg call BIS_fnc_randomPosTrigger;
_mortar doArtilleryFire [_pos, "8Rnd_82mm_Mo_shells", 1];
hint "Function was executed!";
};
deletevehicle _trg;

I switched it up to this, now hes complaining Error 0 Elements provided, 3 Expected in line 3 :/ does he not get the marker position or whats up?

hallow mortar
#

Markers are referred to by string names. Is FT01 a variable containing the marker's string name, or did you type FT01 in the marker's name field in the Editor? If it's the latter, change it to "FT01" in the function call

cursive tundra
#

FT01 is the global variable i gave to the marker in the editor - he is just firing one round instead of 8 now but at least he is doing it

hallow mortar
#

The marker "variable name" field in the Editor is not a global variable name, despite the caption. It's just a string, as used with marker commands. You can save it to a global variable, e.g. markerName = "my_marker_name"; but by default it's not, so you need to provide that as a "string" to marker commands.

cursive tundra
#

yeah, i did so now, poor guy now knows what hes shooting at at least - cant count tho.. is there a way to pause script execution in a function? when i tried the "concept" of the script in the console i made him sleep for 5 after each round, then he delivered them all.. doesnt work in the functions tho :/

hallow mortar
#

You can use sleep between rounds, you'll just want to spawn the function instead of call, to make sure it's running as a scheduled thread

cursive tundra
#

Works like a charm now! Thank you for helping me out πŸ˜„

abstract bay
#

I forgot that there is no patch so that I can do something like that with attachto 🫒

#

I'm thinking about it, I'd just like to do it for a multitude of vehicles

crude sky
#

If this is the wrong area then my apologies, but I figure because it deals with the debug console ingame it'll suffice.

I have a player who has disconnects, until he can solve them I need a way to teleport him somehwere on the map where he last was easily. Is there a suitable console command for this? I know, for instance, onMapSingleClick "vehicle player setPos _pos; onMapSingleClick '';" and derivatives of that, what I need is a console command to go teleport only a specific player (By name, ideally) where I click on the map

cursive tundra
#

Is there a way to get the relative direction of a marker to another marker? like in

_reldir = player getRelDir tank;

but instead of getting the relative direction of the tank you get the relative direction of a marker?

little raptor
heavy iris
#

How can I hide a model of a vehicle without affecting functionality? For the rest of the players, it should remain visible.

little raptor
crude sky
#

i'll try that out, thanks

#

That did it, perfect. Thank you

grizzled cliff
#
int player = invoke_raw("player");
int pos = invoke_raw("getpos", player);
#

=

limber panther
#

Hello πŸ‘‹
I have a script that works just fine, but i would like to improve it. It is written in initPlayerLocal.sqf: ```sqf
if (_key == DIK_RCONTROL && {vehicle player != player && { side player isEqualTo west } }) then {
createDialog "univrz";
};

meager granite
limber panther
#

How would that be possible?

meager granite
#

Another || for third class branch

#

If you want exact match, change isKindOf to == and to typeOf vehicle player

#
["class1", "class2", "class3", ...] findIf {vehicle player isKindOf _x} >= 0
["class1", "class2", "class3", ...] findIf {typeOf vehicle player == _x} >= 0

Or another way of doing it instead of lots of || checks

limber panther
#

I'll see what i can do, thank you.

restive vault
#

hey there, i have no exp. in scripting. I just want to run a recruit and a respawn skript i saw on youtube. What iam doning here wrong? For both i need this in the init.sqf: [] execVM "bon_recruit_units\init.sqf";
[] execVM "respawnmkr.sqf";] Now my Scenario is crashing.

meager granite
#

Crashing how? What's the message?

#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
restive vault
#

... i didnt save as .sqf after editing... well then, nevermind thx for fast response

neon plaza
#

Trying to use a spectate code to force the spectate module to start on a dedicated server.

#

// description.ext
respawn = 3;
respawnTemplates[] = { "MenuPosition", "Spectator" };
// initPlayerLocal.sqf
// --- Enable full spectator in respawn screen
{
    missionNamespace setVariable [_x, true];
} forEach [
    "BIS_respSpecAI",                    // Allow spectating of AI
    "BIS_respSpecAllowFreeCamera",        // Allow moving the camera independent from units (players)
    "BIS_respSpecAllow3PPCamera",        // Allow 3rd person camera
    "BIS_respSpecShowFocus",            // Show info about the selected unit (dissapears behind the respawn UI)
    "BIS_respSpecShowCameraButtons",    // Show buttons for switching between free camera, 1st and 3rd person view (partially overlayed by respawn UI)
    "BIS_respSpecShowControlsHelper",    // Show the controls tutorial box
    "BIS_respSpecShowHeader",            // Top bar of the spectator UI including mission time
    "BIS_respSpecLists"                    // Show list of available units and locations on the left hand side
];

serene sentinel
#
params ["_unit", "_container"];

private _weaponsConfig = configFile >> "CfgWeapons";
private _unitRifle = primaryWeapon _unit;
private _ARifle = ("toLowerANSI getText (_x / 'cursor') in ['arifle'] && {getNumber (_x /'type') in [1]} && {getNumber (_x /'scope') == 2}" configClasses (configFile /"cfgWeapons")) apply {configName _x};
private _ARifleinbox = (weaponCargo _container) arrayIntersect _ARifle;
private _compatibleMags = compatibleMagazines [_unitRifle, "this"];
private _compatibleMagsinbox = (magazineCargo _container) arrayIntersect _compatibleMags;
private _compatibleMagsArifleinbox = compatibleMagazines [_ARifleinbox, "this"];
private _compatibleMagsforArifleinbox = (magazineCargo _container) arrayIntersect _compatibleMagsArifleinbox;
private _rifleLoaded = count (primaryWeaponMagazine _unit) > 0;
private _amountofmags = {_x in _compatibleMags} count (magazines _unit + primaryWeaponMagazine _unit);

Error position: <compatibleMagazines [_ARifleinbox, "this>
Error Array type, expected String

Who can say what's wrong with it?

hallow mortar
#

_ARifleinbox contains an array, because that's what arrayIntersect returns. compatibleMagazines expects you to give it a classname string.

serene sentinel
#
private _ARifleinbox = (weaponCargo _container) select _ARifle;

@hallow mortar this way?

#

or selectrandom...

hallow mortar
#

I'm not really sure what you're trying to do overall, but you can't do...that.
_ARifle also contains an array - of Configs, I think string classnames - and you can't use that as the right-hand argument for select.

stuck rivet
#

killzonekid's camera follow script:

    _null = _this spawn {
        _missile = _this select 6;
        _cam = "camera" camCreate (position player); 
        _cam cameraEffect ["External", "Back"];
        waitUntil {
            if (isNull _missile) exitWith {true};
            _cam camSetTarget _missile;
            _cam camSetRelPos [0,-3,0];
            _cam camCommit 0;
        };
        sleep 0.4;      
        _cam cameraEffect ["Terminate", "Back"];
        camDestroy _cam;
    };
}];```

Gives me an error on line `_cam camCommit0;` saying "Error undefined behavior: waitUntil returned nil. True or false expected."

Any idea how I can fix this?
hallow mortar
#

I think adding false directly after the camCommit line will have the right effect.
If you're curious, this is caused by a change to how waitUntil works, presumably after the script was written. Previously, returning a non-bool value as the last result in the waitUntil check (or nothing, in this case), while not recommended, would effectively behave as if you'd returned false. Now that unsafe practice is handled with a script error.

stuck rivet
#

I get: Error camcommit: Type Bool, expected Number

hallow mortar
#

After the camCommit line, not after the command itself.

stuck rivet
#

also it seems the script doesn't work at all in multiplayer

#

oh ok thanks give me a moment

hallow mortar
#

No reason it shouldn't work in MP (for your missiles, not other people's). It won't work with vehicles, but that's not because of MP - it's because the Fired event handler must be added to the vehicle, not the gunner, if you want to detect vehicle weapons firing.

stuck rivet
#

turns out I was using this wrong, it works if I replace player with the custom object name defined in editor but not if I replace it with this

#

in multiplayer, that is

#

ok new problem in multiplayer, it shows the missile camera view to every player

hallow mortar
#

Where did you put the code?

#

(and what kind of weapon are you trying to work with?)

stuck rivet
#

onto the player character, trying to get it to work with manpads

hallow mortar
#

If you put it in an object init field, then this should work, because in that context, this contains a reference to the object the init field belongs to.

#

Do you want it to work for that specific unit only, or for any player who uses a MANPADS?

stuck rivet
#

i only want the player to which the script is assigned to see the view of the missile flying

hallow mortar
#

Right, but do you want that functionality to be available to all players for their own missiles, or just to one specific player?

stuck rivet
#

just that player

hallow mortar
#

Right, so:
Use this addEventHandler ...
Inside the EH, right before the _null = _this spawn { line, add

if (!(player == _this#0) or {!(_this#6 isKindOf "MissileBase")}) exitWith {};
#

The object init field means the event handler is added, and can fire, on every connected machine. This is fine, because the unit could change machine if people swap slots. However, that also means we need to ignore events where the unit is not the local player unit. And...we also need to check whether the unit is actually firing a missile, otherwise you'll get a cool camera every time you fire your gun.

stuck rivet
#

thanks, I can't test it now with another player, but it seems tobe working so far

shut reef
#

Does anyone know of a way to be in more places than one as far as the audio engine is concerned?
Like an audio version of remote cameras?

little raptor
#

wut?

hallow mortar
#

They want to be able to hear a live feed of audio from some other place, at the same time as the audio from where their main camera is currently located.
One of those things that's not a complicated concept, but is probably very complicated if not outright impossible in Arma.

sullen sigil
#

setposasl otherposition setposasl actualposition oneachframe πŸ˜„

hardy valve
#

Can someone assist me in a script to disable third person view in drones. Something simple

#

addEventHandler ["VisionModeChanged" worked when disabling thermals..

But I cant nail the right one for drone pilot. getinman doesnt seem to work

hallow mortar
#

There's no EH for camera mode specifically. You can use a User Action EH to detect the camera switch actions, or a KeyDown display EH that checks for whether the camera switch inputAction is being pressed and returns true if so.

#

KeyDown EH example:

(findDisplay 46) displayAddEventHandler ["keydown",{inputAction "tacticalView" > 0}];
(findDisplay 46) displayAddEventHandler ["keydown",{inputAction "personView" > 0}];```
(you would want to `&&` a check for whether a UAV is currently being controlled as well)
hardy valve
#

~~Dang alright, I would assume this is easily bypassed by changing key? ~~

NICE

#

Thanks!!!!!!!!

hallow mortar
hardy valve
#

Much appreciated I was looking for this

#

So a drone is essentially a remote controlled unit?

#

Makes sense now

wet tangle
#

Hey do you guys know if you can make a script to unban a specific player?

hallow mortar
hardy valve
#

I was always curious about that

hallow mortar
wet tangle
#

He did #exec unban and all that stuff

#

It's a dedicated server

hardy valve
#

Should be a list of UID somehwere on the system hosting

#

Banslist etc..

wet tangle
#

He can't find banlist.txt and stuff

hardy valve
#

Check battleye user folder

wet tangle
#

Where would that be found

#

Documents or the game directory?

hallow mortar
#

#exec unban "UID here" should work. Note that only the UID (numerical Steam ID) will work, you can't unban by name.

wet tangle
#

Does it need the quotes

hallow mortar
#

Yes

wet tangle
#

Yeah he tried that

#

Didn't work

#

Everytime I try to join it says "You were banned"

#

He even tried exec clearbans

hallow mortar
#

Was it a BattlEye ban or a normal ban?

wet tangle
hardy valve
#

On server

Profile > Users > HOST > bans.txt

wet tangle
#

He told me he banned me off the map

#

Like he pressed m and when to the playerlist

wet tangle
hallow mortar
#

Well if he did it it wasn't BattlEye

#

Did you try restarting the server after doing the unban?

wet tangle
#

Yes

hardy valve
#

Is it rented system

wet tangle
#

Yup

hardy valve
#

Inside the user profile on the server panel is where he needs to look

hallow mortar
wet tangle
hardy valve
#

All good try above it will work

wet tangle
#

Where's the user profile server panel

#

Is it in arma 3 or is it a file explorer thing

#

@hardy valve

topaz goblet
#

Anyone good at Arma 3 UnitCapture? Im trying to make a small cinematic. Figure as its sorta scripting that this is the chat for it.

topaz goblet
#

Really weird to explain, just help with creating cinematics using the script UnitPlay

#

And unit Capture

shut reef
empty leaf
#

Hey guys I am trying to edit a mod to have it create grenade launcher rounds casings when firing

I've narrowed down the area of the code to here:

Theres a check I can run ingame count ace_casings_casings which is not increasing when firing grenade launcher rounds.

#
if (!isNull objectParent _unit) exitWith {};

private _modelPath = GVAR(cachedCasings) get _ammo;

if (isNil "_modelPath") then {
    private _cartridge = getText (configFile >> "CfgAmmo" >> _ammo >> "cartridge");
    //Default cartridge is a 5.56mm model
    _modelPath = switch (_cartridge) do {
        case "FxCartridge_9mm":                 { "A3\Weapons_f\ammo\cartridge_small.p3d" };
        case "FxCartridge_65":                  { "A3\weapons_f\ammo\cartridge_65.p3d" };
        case "FxCartridge_762":                 { "A3\weapons_f\ammo\cartridge_762.p3d" };
        case "FxCartridge_762x39":              { "A3\weapons_f_enoch\ammo\cartridge_762x39.p3d" };
        case "FxCartridge_93x64_Ball":          { "A3\Weapons_F_Mark\Ammo\cartridge_93x64.p3d" };
        case "FxCartridge_338_Ball":            { "A3\Weapons_F_Mark\Ammo\cartridge_338_LM.p3d" };
        case "FxCartridge_338_NM":              { "A3\Weapons_F_Mark\Ammo\cartridge_338_NM.p3d" };
        case "FxCartridge_127":                 { "A3\weapons_f\ammo\cartridge_127.p3d" };
        case "FxCartridge_127x54":              { "A3\Weapons_F_Mark\Ammo\cartridge_127x54.p3d" };
        case "FxCartridge_slug":                { "A3\weapons_f\ammo\cartridge_slug.p3d" };
        case "FxCartridge_12Gauge_HE_lxWS":     { "lxWS\weapons_1_f_lxws\Ammo\cartridge_he_lxws.p3d" };
        case "FxCartridge_12Gauge_Slug_lxWS":   { "lxWS\weapons_1_f_lxws\Ammo\cartridge_slug_lxws.p3d" };
        case "FxCartridge_12Gauge_Smoke_lxWS":  { "lxWS\weapons_1_f_lxws\Ammo\cartridge_smoke_lxws.p3d" };
        case "FxCartridge_12Gauge_Pellet_lxWS": { "lxWS\weapons_1_f_lxws\Ammo\cartridge_pellet_lxws.p3d" };
        case "FxCartridge_9mm":                 { "A3\Weapons_f\ammo\cartridge_small.p3d" };
        case "":                                { "" };
        default { "A3\Weapons_f\ammo\cartridge.p3d" };
    };
    GVAR(cachedCasings) set [_ammo, _modelPath];
};
#

I'm wondering what it is about this logic that is stopping grenade launcher rounds from being excluded from this (the script defaults to using a 556 casing if it doesnt have anything else to choose

granite sky
#

case "": { "" };

#

Have you checked what value the grenade launcher has for cartridge?

warm hedge
#

Why you need to do this though?

empty leaf
empty leaf
warm hedge
empty leaf
#

I didn't write the orignal script, but I think that they are setup as exceptions as the
private _modelPath = GVAR(cachedCasings) get _ammo; uses the cached Casings. Im not sure

granite sky
#

Yeah, that's ACE's script.

empty leaf
#

heres me trying it ingame, if I just firing grenades the variable does not go up, only with rifle rounds

granite sky
#

I don't see why what you've changed wouldn't "work". Maybe hook FiredMan yourself and see what's happening.

empty leaf
#

ok good idea, i've never actually done that before. can i do that through the debug menu?

granite sky
#

blinks

warm hedge
#

Probably because 40mm HE doesn't even have cartridge model?

granite sky
#

You're messing with ACE and you never added an EH? :P

empty leaf
#

yeah I'm quite new to all this

#

apologies

granite sky
#
player addEventHandler ["FiredMan", {
  diag_log str _this;
}];
#

Should dump data to the RPT each time you fire.

empty leaf
#

amazing lad, thank you for that

granite sky
#

ACE is actually using CBA_addClassEventHandler so maybe there's some screwup there.

empty leaf
#

16:28:11 "[B Alpha 1-1:5 (gabes),""CUP_arifle_M4A1_M203_CCO_Laser"",""M203"",""Single"",""G_40mm_HEDP"",""CUP_1Rnd_HEDP_M203"",164151: ugl_slug.p3d,<NULL-object>]"

#

hmm wonder what the null object is

granite sky
#

That's the wrong ammunition.

#

G_40mm_HEDP, you changed G_40mm_HE

empty leaf
#

nah I editied grenadecore and it adds the paramater to a few different grenades

#

you can see here its ok

granite sky
#

Ok, restart the mission and try this one instead:

["CAManBase", "FiredMan", {
  diag_log str _this
}] call CBA_fnc_addClassEventHandler;
empty leaf
#

sorry

#

give me a sec

#

16:37:28 "[B Alpha 1-1:5 (gabes),""CUP_arifle_M4A1_M203_CCO_Laser"",""M203"",""Single"",""G_40mm_HEDP"",""CUP_1Rnd_HEDP_M203"",164377: ugl_slug.p3d,<NULL-object>]

jade imp
#

Would it be possible to make it so it only shows for units in the trigger?
We ran into an issue where it shows for everyone and if more than one person is in the trigger it repeats adding another action and clogging up the screen

granite sky
empty leaf
#

hm ok, i'll go back to them about it, cheers for the help around it

fair drum
jade imp
fair drum
jade imp
#

Anything else?

nocturne bluff
#

Nom

#

Nom

#

I want that for tracking units

velvet merlin
#

(getPosVisual (vehicle player)) vectorFromTo (getPosVisual _obj)

#

seems quite expensive going by profiling - any more efficient way for this?

#

// Get the 2D direction from player to object

jade acorn
#

how complicated would it be to make Arma save player-drawn lines? I swear there was a mod for it but now I can't find it and I'm pretty desperate to have this somehow implemented be it in a mission or as a separate addon.

hallow mortar
velvet merlin
#
private _elevationOffset = [_viewDir, _tDir] call SPE_fnc_get_elev_diff;

    SPE_fnc_get_elev_diff =
    {
        params ["_v1", "_v2"];

        private _computeTheta =
        {
            params ["_x", "_y", "_z"];

            if (vectorMagnitude [_x, _y, _z] == 0) exitWith
            {
                0
            };

            acos(_z / (sqrt(_x^2 + _y^2 + _z^2))) - 90
        };

        (_v2 call _computeTheta) - (_v1 call _computeTheta);
    };```
#
([_angle, _elevationOffset, _ww, _hh] call _fnc_get_marker_coords) params ["_xx", "_yy"];

            // Set the control square position
            _marker ctrlSetPosition [
                _xx,
                _yy,
                _ww,
                _hh
            ];```
#

its to determine the position of a control - the control indicates the relative position of a target to you in a top radar bar (like in OFP)

hallow mortar
#

Don't actually know if it would turn out faster, but that's the direction I'd take to test it

#

Also isn't there a top compass bar function that's Contact-exclusive for some reason? When are we getting that moved to platform :U

velvet merlin
#

yeah BI added that. i think its available to some tanks - not quite sure when

surreal gorge
#

does anyone have a script that lest you load a cargo box into a truck, like B_CargoNet_01_ammo_F into the back of B_Truck_Flatbed_F?

manic kettle
#

Lookup the boxloader mod

cosmic lichen
hallow mortar
fleet sand
#

Quick question if anybody knows how can i access the compass number on GPS so i can control it ?

bright trout
#

hi, wondering if i can talk to someone about some config.cpp functions for a faction. stuff related to giving specific identities to some units (ex. miller) and creating a new identity pool for generic units

hallow mortar
hallow mortar
fair drum
tall lark
#

is there a script to show how fast your Vehicle is going ?

winter rose
tall lark
hallow mortar
#

Should probably use eachFrame EH rather than onEachFrame, to avoid conflicts

tall lark
#

ok thanks guys just making a hpp for it πŸ™‚

hardy valve
#

What are gunbags? Are they backpacks? I cant seem to find the correct variable to delete them if a player spawns a specific bag

hallow mortar
#

Do you mean component bags for static weapons, or something else?

hardy valve
#

Yea exactly

#
private _backpacksToRemove = ["backpack to remove"];
while {true} do {
    {
        private _unit = _x;
        {
            if (backpack _unit in _backpacksToRemove) then {
                removeBackpack _unit;
            };
        } forEach allPlayers;
        sleep 1;
    } forEach allPlayers;
};```
#

I use this but for component bags it does nothing

#

I removed all the classes cause the list is super long

hallow mortar
#

Well, they are backpacks, so it should work. Bear in mind that in is case sensitive, so you'll need to either toLower everything or make doubleplus sure your classnames have the correct cases.

hardy valve
#

Yeah I went over them a bunch of times did backpack player; on debug etc.. the classes are correct for some reason its not doing anything. The strange part is it used to work

#

The others work fine, like remove weapons etc.. the pushback list for the arsenal hides specified classes.. it just wont remove the bag

hallow mortar
#

Why do you have two layers of forEach allPlayers btw?

hardy valve
#

wow....

#

thanks lol

#

Thats likely the mistake right there

tall lark
#

// Function to update the display
speedDisplayUpdate = {
    params ["_ctrl"];
    private _speed = round(speed vehicle player);

    if (_speed < 0) then {
        _ctrl ctrlSetText "Reversing";
    } else {
        _ctrl ctrlSetText format ["%1 MPH", _speed];
    };
};

// Function to create RscText control using the defined class
createRscTextControl = {
    params ["_display"];

    private _display = findDisplay _display;
    if (isNull _display) exitWith {};

    _textControl = _display ctrlCreate ["RscText", -1];
    _textControl ctrlSetPosition [0, 0];
    _textControl ctrlSetSize [0.3, 0.037];
    _textControl ctrlSetFont "PuristaMedium";
    _textControl ctrlSetSizeEx 0.03921;
    _textControl ctrlSetBackgroundColor [0, 0, 0, 0];
    _textControl ctrlSetTextColor [1, 1, 1, 1];
    _textControl ctrlSetText "";

    // Continuously update the display
    while {true} do {
        private _ctrl = _textControl;
        _ctrl call speedDisplayUpdate;
        uiSleep 1; // Adjust this delay as needed to control the update rate
    };
};

// Call the function to create RscText control on the display with ID 46
if (!isServer) then {
    [] spawn {
        waitUntil {!isNull (findDisplay 46)};
        createRscTextControl 46;
    };
};``` can not get a dialog to work with this what is wrong ?
hallow mortar
#

Where did you put this piece of code?

tall lark
#

i have maked a sqf in editer and a hpp to make it top center of the screen

hallow mortar
#

So you put this in the Editor mission init field?

tall lark
#

no maked a sqf file

#

and then using editer to test it

hallow mortar
#

Okay, "made an SQF in the Editor" confused me, because you can't make external SQF files in the Editor

tall lark
#

on crap sorry i worded wrong

hallow mortar
#

So, your dialog.hpp, I assume, contains the config classes for a dialog?
Config is different to SQF script and you can't really have both in same file. The dialog config needs to go in description.ext, which is a config file loaded before the mission initialisation phase. The SQF code does belong in a .sqf file, probably init.sqf.

#

Also, createRscTextControl 46 is wrong. You've made a function called createRscTextControl, but then you're trying to use it like it's a normal command instead of a function. You have to use it with call or spawn, the same as when you call speedDisplayUpdate.

#

BTW, it's good practice to prefix function names with fn_ or yourtag_fnc_ to clearly identify them as functions and avoid naming conflicts.

hardy valve
#

I've determined the issue is it is conflicting with this

while {true} do {
    {
        _unit = _x;
        if ((currentWeapon _unit) in _weaponsToRemove) then {
            _unit removeWeapon (currentWeapon _unit);
        } else {
            {
                if (_x in weapons _unit) then {
                    _unit removeWeapon _x;
                };
            } forEach _weaponsToRemove;
        };
    } forEach allUnits;
    sleep 1;
};```

Do I need to change something, if so what would that be. Im learning
warm hedge
#

I think recently introduced EH is good enough to do this job, no need to excessive while loop

hardy valve
#

So implementing this with an event handler is a better option? I'm not familiar with how to do that but I will research it

Also thanks for all your mods I love the arsenal extension etc...

#

In the meantime is there something I can adjust to not have compat issue with these 2?

hallow mortar
hardy valve
#

That makes sense.. The other scripts I use spawn with a waituntil for the arsenal. These ones were kind of just pasted

#

And its only these 2, where one doesnt work with the other

#

I appreciate the info

warm hedge
#

Also why I suggested EH is such loop is actually easy to consume spec, FPS, more like other scripts' process speed, if you have much of it. One example is, Warlords but in local hosted game, it can have a lot of "script lag (note, not FPS lag)" and pretty much scheduling these scripts is the reason

#

It's hard to explain why EH is always good to have, but basically it does it when it does, and doesn't do anything in other times

#

Meanwhile your scripts checks every second, every unit and its backpack or whatever

hardy valve
#

Right.. so better to not add an additional loop. With the event handler, should I use "post init"? I would do inventory opened but I think that would be exploitable

warm hedge
#

What I linked is the one

hardy valve
#

Oh sorry I clicked the lower embed and it took me to main site

hallow mortar
#

(That's SlotItemChanged if your browser failed the specific section target)

hardy valve
#

So now I can just add event handler to serverinit/ local init sqf's? Probably best to do server side?

warm hedge
#

One thing of downsides of EHs are - slightly hard to understand what it does and how to handle everything

#

Can't make a snippet right now, hey it's your job Nikko

hallow mortar
#

I'm not sure what the locality of SlotItemChanged is. It claims "global argument", but it seems like something that might only fire where the unit is local

warm hedge
#

I'd assume it happens on a computer where the unit is local, but might need to test and leave a note

hardy valve
#

Okay the current ones I use are ran in local sqf and they work fine I will place in same sqf as previous scripts

#

Thanks for the info

hallow mortar
#

This is one case where I'd suggest using Editor init fields. Because player units can not exist at mission start, and then be created later, and can change locality after being created, it's useful to add the EH at the time of creation (rather than mission start) and to add it on all machines.

For example, placing this in the Editor init field of every playable unit:

this addEventHandler ["SlotItemChanged",{
  params ["_unit"];
  if !(local _unit) exitWith {};
  // now check for illegal items and remove them
  if (backpack _unit in kcs_var_illegalBackpacks) then {
  };
  // ...
 }];```
hardy valve
#

You guys are awesome thanks. I will mess around with this.

In the future, I'd like to know how to implement EH's into mods, but I need to buy a 3d model first before I open that can of worms

gilded parcel
#

hello there, got a very newbie question as i am not very experienced in the scripting, i play with my friends a lot of Escape missions like the classic Escape Altis etc. and i was thinking of trying to expand the world by spawning more types of locations as the mission starts.
i have made a composition of objects but i am not sure if it is possible to make it spawn at random location as the mission starts? i was able to figure out to do that with one object, but not quite a composition. not sure if thats something doable through Larrows guide or not.
Thanks for answers πŸ™‚

agile flower
#

Hello all,

I'm stumped, so coming to ask here, but I'm looking for a way to close the ace arsenal on a player.
I.E I want to do an action, or a zeus self interact and it should close the ace arsenal for anyone who has it open.

I'm not sure if this is possible and I've no idea where to even start.

There's an eventhandler to pass the display ID on Ace Arsenal open.
I tried to closeDialog and closeDisplay on that, and it didnt work.
I also tried to find the ui element variable name with uinamespace getvariable "ace_arsenal_display" (total punt), and that also doesnt work

Any help would be appreciated
Thanks,

sullen sigil
#

ctrlParent ((findDisplay 1127001) displayCtrl 1001) closeDisplay 1

agile flower
#

I'll check this now

#

works - cheers

willow hound
#

Why not (findDisplay 1127001) closeDisplay 0? 🀨

agile flower
#

doesnt appear to work

willow hound
#

Weird

keen rain
#

@fair drum @hallow mortar
Asking you now since I'm genuinely curious.
I know we can make "Custom" buildings and stuff and I was wondering.
Can this also include scripts?

fair drum
#

Guess I'm not following what you're asking

keen rain
#

I make the building + script

#

Then save it on "Custom"

exotic mesa
#

Might work in editor, probably not in Zeus though

hallow mortar
#

If the script is in the building's init field, then it will be included when you place the composition in the Editor.
If you place it in Zeus, it can be included with the following caveats:

  • The mission or server's zeusCompositionScriptLevel config setting must be set to 2 (it is not, by default)
  • The init field will be executed only on the machine that placed the composition, not globally like a normal Editor init field.
keen rain
keen rain
keen stream
#

I wonder if I can create a server-sided mod that tells on slack that a scenario has started and frequently reports the progress.

mint goblet
#

Since slack has an api, why not?

#

Just do it! ;)

keen stream
#

( Maybe I don't have to )

mint goblet
#

Otherwise write your own extension

keen stream
#

writing things for Windows, not going to happen.

mint goblet
#

It's beautiful!

chrome hinge
#

What does this mean when using BIS_fnc_ambientAnim? What will happen if logic is created?

pliant stream
#

microsoft rabble rabble rabble..

hallow mortar
#

A Game Logic is a type of virtual entity that's used as a placeholder for various scripting stuff. It has a physical position but is invisible and invincible, and has no AI.
However, while it doesn't really do anything on its own, it does have a little bit of simulation cost, so it's best not to go overboard with creating too many of them.

#

Note also the reference to using a global command. This means that if you run the function on all machines, as many logics will be created as there are machines, because each machine is doing createUnit and creating a new logic (which is created for everyone and not just on that machine) for their copy of the function. So be careful to only execute the function on one machine.

chrome hinge
#

Alright, thanks

wind hedge
#
                private _friendlyGrenades = (player nearObjects ["GrenadeHand", 30]) select {
                    (getShotParents _x) params ["_vehicle", "_unit"];
                    side group _unit isEqualTo side group player
                };
                if (count _friendlyGrenades > 0) then {
                    {
                        private _dis = 30;
                        private _displayName = [getText (configFile >> "CfgAmmo" >> typeOf _x >> "displayname")];
                        private _pictureArr = [getText (configFile >> "CfgAmmo" >> typeOf _x >> "picture"),[1,1,1,1],.7,0];
                        private _pos = visiblePosition _x;
                        _pictureArr params ["_picture","_color","_size","_shadow"];
                        // drawIcon3D ["\A3\ui_f\data\map\markers\military\circle_CA.paa", [0.9,1,0,1], _pos, 1, 1, 0, "Grenade!"];
                        if ((lineIntersectsSurfaces [AGLToASL positionCameraToWorld [0,0,0], eyePos _x, player, _x, true, 1, "VIEW"] isEqualTo []) && {player distance _x < _dis}) then {
                            drawIcon3D [_picture, _color, _x, _size, _size, 0, format["%1 %2m %3", _displayName, ceil(player distance _x), _displayName], _shadow, .025, "PuristaMedium", "center", true];
                        };
                        nil;
                    } count _friendlyGrenades;
                };
keen stream
#

extDB2 could work, on the other side having phparma2serverstatus poll the server could work.

wind hedge
#

this sqf _displayName = [getText (configFile >> "cfgMagazines" >> _x >> "displayname")]; doesn't work because _x is an object, how could I make that work?

#

The script is run inside a sqf addMissionEventHandler ["EachFrame", {

#

the error is sqf Type Object, expected string for that _displayName line

hallow mortar
#

Use typeOf _x - or configOf if you want to save typing out some of the config path

wind hedge
warm hedge
#

It's CfgAmmo not CfgMagazines

hallow mortar
#

using configOf would've fixed that too :P

#

Though since it is CfgAmmo, it might not have a displayname or picture

#

...wait, did you change one of those messages? One says CfgMagazines and one says CfgAmmo

warm hedge
#

Well what Nikko said

hallow mortar
#

CfgAmmo items may not have a displayname or picture, since they can't normally be held in inventory

wind hedge
#

ok but this one does

warm hedge
#

"this one"?

wind hedge
# warm hedge "this one"?

The regular grenade, I know because it is displaying on the custom UI I have over there in the pic at the bottom center

#
_displayName = [getText (configFile >> "CfgAmmo" >> configOf _x >> "displayname")];``` now throws this error: Type config entry, expected string.
warm hedge
#

configOf already returns confg

#

Also yeah, as I said, what Nikko said. Usually CfgAmmo doesn't any text to describe what it is but in CfgMagazines

hallow mortar
#

configOf is not the same command as typeOf, you can't just swap it out directly in place, it works differently.
typeOf returns just the classname of the item and it's up to you to provide the rest of the config path.
configOf returns the full config path of the item, and if you also provide the full config path of the item, the game will get confused.

wind hedge
#

Ok got it, so in order to get the picture used for that nade and its name I need to do two separate commands?

warm hedge
#

What?

hallow mortar
#

if an item has a displayname, then the way to retrieve that regardless of which config the item belongs to, is getText (configOf _item >> "displayname");
But an item is not guaranteed to have a displayname, and if it doesn't then there's no command that can resolve that for you.
* same for picture

#

Reverse-associating an ammo type to its magazine is essentially impossible, because ammo types can appear in multiple magazines (not to mention submunition types...).
If displaynames and pictures aren't available (seems likely), then the best solution might be to simply determine whether it's a frag/smoke/chemlight, and display a generic name and icon based on that.

wind flax
#

Is it possible to unbind the scroll wheel from the Context Menu/disable the scroll/context menu entirely?

wind hedge
# hallow mortar Reverse-associating an ammo type to its magazine is essentially impossible, beca...

Managed to make it work with this fnc: ```sqf
VAL_fn_getDisplayName = {
private ["_suppliedtype","_type", "_cfg_type","_data", "_displayName"];
params ["_suppliedtype"];
if ((typeName _suppliedtype) == "OBJECT") then {
_type = (typeof _suppliedtype);
} else {
_type = _suppliedtype;
};

switch (true) do {
    case(isClass(configFile >> "CfgMagazines" >> _type)): {_cfg_type = "CfgMagazines"};
    case(isClass(configFile >> "CfgWeapons" >> _type)): {_cfg_type = "CfgWeapons"};
    case(isClass(configFile >> "CfgVehicles" >> _type)): {_cfg_type = "CfgVehicles"};
    case(isClass(configFile >> "CfgGlasses" >> _type)): {_cfg_type = "CfgGlasses"};
};
_displayName = getText (configFile >> _cfg_type >> _type >> "displayName");
_displayName

}; ```

#

It works with smoke grenades but not the regular hand grenades so those indeed don't have a displayname 🀣 🀣

drifting sky
#

Is there a method via scripting or otherwise to thin out all wooded areas across any map?

opal zephyr
#

yes

#

you can use nearestTerrainObjects to get the tree/bushes/etc and then put it into an array, and select randomly to delete

drifting sky
#

across the entire map?

opal zephyr
#

yup

#

you can use worldSize and the examples on that page for the position and radius required to cover the whole map

drifting sky
#

how will it affect performance on a multiplayer server?

opal zephyr
#

Well you would just be doing it once at the start right?

drifting sky
#

yes

opal zephyr
#

then it would be a small, maybe noticeable spike when it happens and that would be it

drifting sky
#

I'm wondering if transmitting potentally tens of thousands of deleted trees would be an issue

#

with each player joining

opal zephyr
#

ah, not sure, you would have to test it. But I dont think it will be a big deal

#

Here is a simple example of a script that will delete 50% of the trees and bushes on the map

_objects = nearestTerrainObjects [[worldSize/2, worldSize/2], ["BUSH","SMALL TREE","TREE"], sqrt 2 / 2 * worldSize, false, true];
for "_i" from 0 to ((count _objects)/2) do{
    deleteVehicle (selectRandom _objects);
};
#

apologies, deleteVehicle wont work, it needs to be hideObjectGlobal

drifting sky
#

would it work to use hideobject on each client presuming each client removes exactly the same treese?

opal zephyr
#

You would have to hide it manually for whenever someone joins, hideObjectGlobal takes care of all of it for you

drifting sky
#

I'm just wondering if it wouldn't be better for network congestion to have the clients each remove the trees on their own end.

mint goblet
#

well, i myself would have wrote the extension myself

opal zephyr
#

You could also throw these commands in too to make sure theyre truly disabled:

_objects = nearestTerrainObjects [[worldSize/2, worldSize/2], ["BUSH","SMALL TREE","TREE"], sqrt 2 / 2 * worldSize, false, true];
for "_i" from 0 to ((count _objects)/2) do{
    _o = selectRandom _objects;
    _o enableSimulationGlobal false; 
    _o allowDamage false;
    hideObjectGlobal _o;
};
opal zephyr
drifting sky
#

one thing we will need is to make sure the same treese are removed every time the game runs. Which means we'll need to sort out how to seed the random number generator before removing the trees.

opal zephyr
#

Oh you need it to be the same every time you launch the mission?

drifting sky
#

i wasn't going to pass an array, just have them do it randomly, but all with the same seed

#

yeah but it's not clear to me from reading the wiki how the seeding actually works.

If I were doing this elsewhere I would first set a seed, then call a bunch of random numbers, but I don't see how exactly to do the same thing in arma

opal zephyr
#

You could do it with a seed if you want, something simple would be to just delete every other entry from the first entry. And sort the array first

drifting sky
#

that could result in a really obvious checkerboard pattern

opal zephyr
#

the sort would be based on distance from the center of the map

#

its worth a try

drifting sky
#

Hmm... could do it that way. But I don't suppose you know how to seed the random generator.

opal zephyr
#

you could probably do it with a little bit of code

wind hedge
mint goblet
#

seems easier

wind hedge
molten yacht
#

I feel like I'm blind, is there a command to draw a line on the map as if a player had done so?

#

I just want to pre-mark sectors by script.

opal zephyr
granite sky
warm hedge
#

I can say that may work for that situation, but since that randomization is very bad...

#

We may want a perlin-driven ramdomization

drifting sky
#

So there's no way to set a seed, and then generate a bunch of random numbers using that seed, so that you get the same sequence every time?

warm hedge
#

I'm not saying there is zero way

#

I can suggest that 0 random 0 syntax, that isn't bad way IIRC. You can sum up (maybe with some coef per XYZ axes) positions and call it a random seed

drifting sky
#

Could I just start at 0 for seed, and increment it by 1 between each call?

warm hedge
#

Well your call

drifting sky
#

I just want to understand that will produce the same sequence every time the script is ran.

warm hedge
#

I know, and if both value is same, it should

#

So like my idea is _aSeedThatIsProducedFromAPosValues random 1 so it can produce same randomized 0-1 value, if the terrain object is not moved upon an update

drifting sky
#

I thought about that, but that won't appear any more or less random than just incrementing the seed by 1 in between each random call, right?

#

and in both cases, it should be repeatable

warm hedge
#

I don't know how it is randomized well. Only thing I know is I want to avoid Syntax 4

#

Maybe I'll try to visualize the syntax 3

molten yacht
opal zephyr
#

I havnt used it before, but that is what it says

#

The other draw functions need to be ran every frame, its possible drawLine does too, if thats the case then thats likely where the performance drop comes from

drifting sky
#

If nearestTerrainObjects is used without sorting, is it guaranteed to return the same list in the same order, given the same arguments, and the same objects present on the map?

warm hedge
#

I do still want to suggest sum position and call it a seed

#

If there is a concern, do worry after test - it's easy to try both method

drifting sky
#

yeah that might be a better option if it allows avoiding sorting the list

#

is hideobject reversable?

warm hedge
#

Yes

drifting sky
#

are objects that are hidden with hideobject continue to be simulated in any way while hidden? I.e., can things collide with them, can they take damage from weapons?

warm hedge
#

Collision is disabled. May have a damage from explosion

#

But not for bullets

drifting sky
#

do ai ignore them as if they aren't there?

#

I'm struggling to find a command to unhide an object

wispy ravine
#

Hey, is there a script to change the ammo type for a weapon? So example, if I have a AAF M2, can I change it from 12.7mm to like, 20mm? Asking cause I want to make a K-Car type vic for an op I'm doing and since theres isn't really a 20mm turret that can be used for it, wanna know if it was possible

vapid scarab
#

Does anyone know the display and control IDs for the minimap?
I want to add a drawIcon event handler to the minimap.

drifting sky
#

Is there any possiblity that the same (seed random num) call can produce a different number on different machines?

opal zephyr
drifting sky
#

Does anybody know of any reason why this idea wouldn't work well? Do you know of any reason why things could go wrong with the simulation?

To cull trees on each client and server separately to avoid network traffic.

warm hedge
granite sky
#

something like this?

{
  if (_forEachIndex random 1 > 0.5) then { _x hideObject true };
} forEach _trees;
drifting sky
#

what i've done is:

        if ((_seed random 1) < 0.5) then {
            _x hideObjectGlobal true;
        };```
warm hedge
#

Nothing seems very wrong

drifting sky
#

i presume there could be a diagonal pattern if trees are snapped to a grid or something

warm hedge
#

I'd suggest to multiply X and Y, maybe Z too with different prime numbers

granite sky
#

bear in mind that seeds >16m are going to alias.

warm hedge
#

That too

#

Maybe use mod too?

granite sky
#

The _forEachIndex one would be fine if Arma's seed hashing is good enough. It probably isn't though :P

sullen sigil
#

yes

#

what is somearray

#
{
  private _apple = _x;
  {
    systemChat str _apple;
    systemChat str _x;
  } forEach pears;
} forEach apples;```
#

should work fine

#

what is the point in that

#

just use str

#

shouldnt be

#

not finding the config then probs

#

most likely

drifting sky
#

Everything seems to be going fine with the tree thinning script you guys helped me with earlier. Just one other question. I want to make sure there's no circumstance in which an object could fail to be hidden with the hideobject command.

#

Also, with terrain objects returned by nearestTerrainObjects, is it possible to test for an exact kind of object? Say I wanted to remove a specific kind of tree.

keen stream
#

But my experience doesn't really allow the use of VS.

#

GCC or G++ will be just fine and dandy

heavy iris
#

Hello. How can I force this script to use the value sent to the chat when calculating the amount?

    [
        "d20",
        {
             _act = _this select 0;
            _r0 = round (random 20);
            _allR = _r0 + _act;
            _rD20 = format ["%1 ΡΠΎΠ²Π΅Ρ€ΡˆΠΈΠ» бросок %2 %3 %4 %5", name player, _r0, _act, "=", _allR];
            [_rD20] remoteExec ["systemChat"];
        }
    ],
heavy iris
warm hedge
#

Not quite sure your context. What is your first code, what is your second code, and what are the results?

heavy iris
warm hedge
#

Do... what

heavy iris
#

I want to enter a command and a number into the chat, based on which the final amount will be calculated

warm hedge
#

So uh, if somebody wrote !d20 5 in the chat, will return PLAYER ΡΠΎΠ²Π΅Ρ€ΡˆΠΈΠ» бросок 12 5 = 17?

#

I do not even see _r1 mention in your code though

heavy iris
#

Yes, but 5 is any number from the player, and 12 is a random number

heavy iris
warm hedge
#

And what is this code and how do you run

heavy iris
#

I tried to enter r1 instead of _act, I thought it would help

heavy iris
#

DnD system

warm hedge
#

I mean more context. Do you mean you run this on a HandleChatMessage MEH?

#

It is nearly impossible to suggest a fix when I only can assume

heavy iris
#

Used system

test_mission.vr\InitPlayerLocal.sqf

[] execVM "scripts\chat\init.sqf";

test_mission.VR\scripts\chat\init.sqf
Screen 1

test_mission.VR\scripts\chat\config.sqf

pvpfw_chatIntercept_debug = false;
pvpfw_chatIntercept_commandMarker = "!"; //Character at the front of the chat input to intercept it

test_mission.VR\scripts\chat\commands.sqf

pvpfw_chatIntercept_allCommands = 
[
    [
        "d20",
        {
            _r1 = (_this select 0);
            _r0 = round (random 20);
            _allR = _r0 + _r1;
            _rD20 = format ["%1 ΡΠΎΠ²Π΅Ρ€ΡˆΠΈΠ» бросок %2 %3 %4 %5", name player, _r0, _r1, "=", _allR];
            [_rD20] remoteExec ["systemChat"];
        }
    ],
];
heavy iris
warm hedge
#

Here?

#

Where is here?

heavy iris
#

I cut out the extra code

#

Let's make it easy.

            _r1 = (_this select 0);
            _r0 = round (random 20);
            _allR = _r0 + _r1;

How do I get _allR to count the sum of _r1 and _r0?

warm hedge
#

What is _this there after all

heavy iris
warm hedge
#

What?

heavy iris
#

"ΠšΠΎΡΡ‚Ρ‹Π»ΡŒ"

#

Temporary stub

warm hedge
#

Do you mean a string?

heavy iris
#

Yes

warm hedge
#

Then you are trying to + ing a String with a Number which is invalid

shut reef
still forum
#

no

drifting sky
#

Does anybody know if it is possible that spawned vehicles could collide with hidden objects, and cause the vehicles to explode?

proven charm
#

hidden objects should be passthrough

warm hedge
#

Almost certain that you can't hit a hidden object

drifting sky
#

is it possible there could be a small delay before those collisions wouldn't happen?

proven charm
#

well I had some problems with hidden objects collision but most of the time they work... or not

warm hedge
#

It probably is easier to answer a question: what makes this question

drifting sky
#

I've seen some vehicles exploding without apparent cause. Need to test if there are other reasons they could be exploding. I'm hoping it's not the hidden objects.

warm hedge
#

Is that vehicle exploded upon the spawn?

drifting sky
#

haven't been able to tell that yet. Just fielding this question to see if anybody has an idea while I investigate several other things.

proven charm
#

what kind of objects are you hiding?

heavy iris
#

New problem

    [
        "d20",
        {
        _r1 = _this select 0;
            _r0 = round (random 20);
        _arr = [[_r0, _r1]];
        _finalsum = count (_arr select 1);
            _rD20 = format ["%1 ΡΠΎΠ²Π΅Ρ€ΡˆΠΈΠ» бросок %2%3%4%5", name player, _r0, _r1, "=", _finalsum];
            [_rD20] remoteExec ["systemChat"];
        }
    ],
drifting sky
hallow mortar
#

If you're using the Hide Terrain Objects Editor module, then yes, there is a very brief period during mission initialisation where hidden objects still have collision and can collide with other objects

proven charm
#

so terrain objects, I hide a lot of those in my mission. and haven't noticed problems..

warm hedge
#

You can at least answer these:

  • Is the explosion happened before or after you hide
  • How do you run hide script
drifting sky
#

so far we've noticed explosiosn happening near the start of the mission, which is when terrain objects are also hidden. Since we're hiding a LOT of objects, I'm wondering if there's just a lag time before the collision system catches up to it.

The hide script is run on the server as well as on every client, using hideobject, on initialization. (We found this massively faster than using hideobjectglobal).

still forum
#

I don't understand what you are trying to do

#

what is inside _r1 ?

heavy iris
#

I need the sum of the random number and the number entered in the chat

#

_r1 - chat

#

_r0 - random

still forum
#

r1 is a string I assume

heavy iris
#

Yes

still forum
#

so parseNumber _r1 to turn it to a number, and then just + them together

proven charm
#

@drifting sky I'm personally using hideobjectglobal

drifting sky
#

we found to do the same thing with hideobject was somewhere around 100x faster.

warm hedge
proven charm
#

could be part of the problem though

cosmic lichen
#

Have you tried executing the script preInit?

drifting sky
# warm hedge I actually wanted how is your script called

well, we're making changes to a really complex mission that we've only just started to try to understand. By, how it's called, what do you mean exactly? In all other respects, the hiding script seems to be working perfectly. We're not sure that the vehicles are actually colliding with the hidden objects.

warm hedge
#

init.sqf or initPlayerLocal.sqf or... somehow

drifting sky
#

well, for the client, it's a chain of a bunch of functions that is originated by a remote execution.

warm hedge
#

Then how is that remoteExec ran

#

The reason that why I'm asking this is, I'm assuming that you're running the hide script in Scheduled environment

#

Which will not done everything in a frame

drifting sky
#

i put the hide stuff inside of an isnil {}

warm hedge
#

But where is your isNil

drifting sky
#

i'm trying to track that down exactly

warm hedge
#

Ehh...

drifting sky
#

it all seems to start on the server with a preinit function located in description.ext cfgfunctions

#

which in turn spawns another function, and I put the hide code at the end of that spawned function, inside of an isnil

warm hedge
#

So your preInit function runs a spawn, and the spawn has the bunch of codes, and the isNil is located on the very last line of the spawn?

drifting sky
#

but all this should happen well before any ai or vehicles are generated

drifting sky
warm hedge
#

Then don't wrap it in spawn

drifting sky
#

well, if it's all triggered in a preinit function, wont that mean that objects won't yet be initialized? I presume that means terrain objects as well.

#

I figured the spawn was to give the object initialization time to happen.

warm hedge
drifting sky
#

Yeah I'll look into this as a possiblity, but I don't think this is the case, because I think it's like a minute or two before any vehicles are spawned, but I'll put some kind of message in to find out when the hide objects section completes. Thanks for the idea.

warm hedge
#

Have you enabled Dynamic Simulation?

drifting sky
#

I do believe it is on

warm hedge
#

Could be one reason why it does happen afterwards

drifting sky
#

i'm having difficulty imagining how that would work

warm hedge
#

My theory:

  1. Terrain objects initialized
  2. The vehicle spawns
  3. Within a frame it can collide with a terrain object
  4. And afterwards the simulation has stopped due to DynSym
  5. DynSim enables the system when it decides to do
  6. Boom
#

I actually have zero clue how a Dynamic Simulation works though

drifting sky
#

I'll have to print some kind of message when vehicles are spawned to see if any of them are spawning before the hiding is done.

warm hedge
#

Honestly if this is a case, I'd suggest to disable Dynamic Simulation first

#

So you know the delay is caused by that or not

drifting sky
#

alright. thanks for you help.

mint goblet
#

may i ask why?

nocturne bluff
#

because microsoft is bad

velvet merlin
#

anyone profiled yet if a switch case with strings (up to 25 characters long) with 51 cases is in relevant ways slower than number based switch case? or are both way too low for the engine processing to matter?

winter rose
#

not afaik (and that's quite specific :D)

meager granite
#

Btw if you have this many cases, maybe using a hashmap could be faster

#
switchHashmap = createHashMapFromArray [
     ["string1", {call case1}]
    ,["string2", {call case2}]
    ,["string3", {call case3}]
];
args call (switchHashmap get "string1");
mint goblet
#

That might be true, but VS is great tho

lone glade
#

VS is a great tool and microsoft a very big company with a lot of different branches

#

it's stupid to not use a good tool because you despise the company as a whole.

mint goblet
#

^

velvet merlin
#

yeah good point. similiar question is true for hashmap. as its in engine, probably even less difference

meager granite
# velvet merlin anyone profiled yet if a switch case with strings (up to 25 characters long) wit...

Got curious and profiled it:

private _cases = 51; 
caseCode = {player}; 
caseDefault = {objNull}; 
 
switchHashMap = createHashMap;
private _str_cases = []; 
private _num_cases = []; 
private _exitwiths = [];
for "_i" from 1 to _cases do {
    _str_cases pushBack format ["case ""%1"": %2;", format ["string%1", _i], caseCode]; 
    _num_cases pushBack format ["case %1: %2;", _i, caseCode]; 
    _exitwiths pushBack format ["if(testnum == %1) exitWith %2;", _i, caseCode];
    switchHashMap set [format ["string%1", _i], caseCode]; 
}; 
_str_cases pushBack format ["default %1", caseDefault]; 
_num_cases pushBack format ["default %1", caseDefault];
_exitwiths pushBack format ["%1", str caseDefault select [1, count str caseDefault - 2]];
switchStrDo = compile (_str_cases joinString ""); 
switchNumDo = compile (_num_cases joinString ""); 
exitWithsCode = compile (_exitwiths joinString "");
 
testnum = 51; 
teststr = format ["string%1", testnum]; 
[ 
     "hashmap" 
    ,diag_codePerformance [{ 
        call (switchHashMap getOrDefault [_str, caseDefault]);         
    }] 
    ,"switch string" 
    ,diag_codePerformance [{ 
        switch teststr do switchStrDo; 
    }] 
    ,"switch number" 
    ,diag_codePerformance [{ 
        switch testnum do switchNumDo; 
    }]
    ,"if exitWith"
    ,diag_codePerformance [{ 
        call exitWithsCode;
    }]
];
#

=> ["hashmap",[0.00113407,100000],"switch string",[0.0079667,100000],"switch number",[0.00799422,100000]]

#

testnum = 1;
=>
["hashmap",[0.00112441,100000],"switch string",[0.00105729,100000],"switch number",[0.00103412,100000]]

#

switch has tiniest performance gain in its best case scenario

#

Massively worse in all other cases

#

πŸ‘†

velvet merlin
#

8x faster is quite significant. that said bit surprised it isnt more. probably the low amount of cases

meager granite
#

So in total, unless you're doing complex switch true do { case checks, hashmap is a better tool for code branching

#

Could hurt readability a bit though

#
fnc = {
    switch(_this) do {
        case "SOME_STATE": {123};
        case "OTHER_STATE": {321};
        default {555};
    };
};

vs

switchHashMap = createHashMapFromArray [
     ["SOME_STATE", {123}]
    ,["OTHER_STATE", {321}]
];
switchDefault = {555};

fnc = {
    switchHashMap getOrDefault [_this, switchDefault];
};
warm coral
#

question

#

im making a randomization script that randomizes a units uniform, vest, etc

#

however when doing it locally for some reason the grenades break

#

so im thinking of making everything remoteexec

#

will this have a big impact on frames?

cosmic lichen
#

@warm coral Without knowing your script we can't recommend anything

warm coral
#
(_this select 0) addBackpack (selectrandom [
        "UK3CB_B_Largepack", 
        "UK3CB_B_Largepack_Des", 
        "RD54_6B3", 
        "rhs_rd54",
        "rhs_rd54_vest",
        "rhs_sidor",
        "",
        "",
        "",
        "",
        "",
        ""
    ]);
#

i did it like this in an sqf

#

and did the same for headgear, facewear, uniforms, vests, weapons

cosmic lichen
#
private _unit = _this select 0;
private _backpack = selectRandom [
    "UK3CB_B_Largepack", 
    "UK3CB_B_Largepack_Des", 
    "RD54_6B3", 
    "rhs_rd54",
    "rhs_rd54_vest",
    "rhs_sidor",
    "",
    "",
    "",
    "",
    "",
    ""
];

[_unit, _backpack] remoteExec ["addBackpack", _unit];
#

This should make sure that the backpack is added where the unit is local

warm coral
#

got it

#

and im guessing this has little to no impact on performance yes?

cosmic lichen
#

No impact.

warm coral
#

amazing

#

thx a lot

hallow mortar
#

It might cause a brief hitch if you do a huge number of them at once, or if you're doing this constantly....but you shouldn't

warm coral
#

biggest spawnable squad is 8 men

#

so shouldnt be too bad i hope

hallow mortar
real tartan
#

is there an eventHandler that check if mine was triggered (training mine) ?

dapper pumice
#

does anyone know any script to disable teleporting units ability in zeus gamemaster?

real tartan
hallow mortar
#

Mines are actually ammo

#

Editor-placed mines start out as vehicles though, so if that's what you're using, you might need to do a little bit of stuff to wait until it's been replaced with its ammo counterpart

nocturne bluff
#

I use VS everyday ;)

shut reef
# still forum no

Why is it ignored anyway?
And if the param is ignored, why not just remove it?
Which reminds me... should still anotate the wiki page.

spare adder
#

Hello Folks, I am trying to make a campaign for some people and need an arsenal that has limited quantity. I have seen this done before with Antistasi, where people can add items to the box, but I am trying to make it so what is in the box already gets added to the arsenal.

I built out their inventories and don't want to have to make the players dig through the base arma inventory system for attachments and ammo. The only built in options I can find make it so there is unlimited stock in the arsenals. Is there a solution for this alredy? I am terrible at scripting.

wet shadow
fair drum
spare adder
#

Awesome, thank you!

clear island
#

How do I create the bat file to have the p drive?

fair drum
warm hedge
#

setVariable already can tell everyone the variable. No need to remoteExec'ing

granite sky
#

SQF threads that have slept (waited? not sure) longest get scheduler priority.

dapper pumice
granite sky
#

The curator interface is written in SQF and Arma UI config, I think, so in theory if you can find that part of the interface then you could override it with a mod.

molten yacht
#

So obviously drawline has to be executed every frame, is there no way to just draw a line once as if a given client had drawn it? Is it marker data under the hood, or what?

#

I'm wishing for a way to import more complex drawings into a scenario

#

or to save drawn lines for the next mission

granite sky
#

Those are markers.

#

If you check allMapMarkers then you can see the format of the user markers.

drifting sky
#

Is anybody able to tell me exactly what post and pre init are?

warm hedge
#

What makes your question?

drifting sky
#

the documentation only states that pre and post are relative to object initialization. Does that mean ALL objects including terrain objects?

warm hedge
#

Good question actually. I really don't know when terrain is initalized

#

I don't also know how to make sure/check. Maybe somebody knows.... Deed?

meager granite
#

Bet the terrain and its objects are always there

drifting sky
#

I'm looking at the initialization order https://community.bistudio.com/wiki/Initialisation_Order

I'm really confused about "Persistent functions are called "

First, is there a difference between things that are "executed" and things that are "called"? A difference other than whether they are "scripts" or "functions"?

Secondly, how can persistent functions be called before the mission has fully initialized? initPlayerLocal.sqf, and init.sqf haven't executed yet. I'm trying to figure out how that makes sense.

drifting sky
#

I've already read that. It didn't explain in any way that I understand why persistent functions are called where they are in the initialization order, as opposed to being called at the end of the initialization.

sharp grotto
#

"When a command or function is executed through remoteExec or remoteExecCall, it can be flagged as persistent. If it is flagged, the statement is stored in the JIP queue on the server (under its unique JIP ID). When a player joins a multiplayer session that has already started (JIP stands for Join-In-Progress), all entries stored in the JIP queue are executed on that player's machine. "

Also https://community.bistudio.com/wiki/Arma_3:_Functions_Library

drifting sky
#

Yes I understand that part. What I don't understand is how it makes any sense to execute JIP queue functions before the mission is initialized on the client.

meager granite
#

This is a fairly late in initialization order, you already have whole world setup and you can operate everything

drifting sky
#

All of these are yet to be initialized when functions in the JIP queue are called.

modules
initPlayerLocal.sqf
postinit functions
init.sqf

the only general mission code initialization that seems to happen before that is preinit, which if I understand correctly, happens before any objects have even been initialized.

edgy dune
#

Any recommendations detecting the opposite of LandedTouchDown eh where its the AI taking off?

drifting sky
#

also, the wiki page uses both "called" and "executed". I want to be sure I understand if there are differences between those temres besides whether the thing being "called" or "executed" is a script or function, or something else.

meager granite
meager granite
meager granite
#

Its a way to access objects before anything else scripted in the game does

drifting sky
meager granite
#

Probably before preinit since objects arrive from server anyway

#

and yes, setVariable with public flag is the same thing as publicVariable

drifting sky
#

On this page: https://community.bistudio.com/wiki/serverNamespace it says:

"This namespace is only available on the server for the server's uptime duration (same as uiNamespace). Server event handlers, which are available in server config, all use this namespace."

What event handlers are they talking about?

still forum
#

"which are available in server config"

drifting sky
#

Ah I was confused because the words event or handler weren't actually located anywhere on that page

drifting sky
#

I'm trying to imagine what other possible uses there might be for the servernamespace. Any insights into that?

keen stream
#

@mint goblet devops with a huge linux/bsd/solaris background during the day, arma addict during the night. So while I can find my way through a meriad of clouds and rest APIs, windows development still boggles me.

tall lark
#

is there away to add beacon lights to other cars ? ? unmoded

hasty pond
#

Any good way to get player's weapons for saving?

keen stream
#

?

hasty pond
#

I mean what's the best way to get player's primary weapon, secondary weapon and launcher?

proven charm
tall lark
proven charm
vapid scarab
#

What is a good empty/low-cost object to use for scripting?
Im making a custom marker script, and I want to use a object to mark the position. This lets me use mission objects like units or vehicles for markers, but I also want to use a "empty" object for a miscellaneous position mark. This also lets me register it in the zeus interface to move it manually.

winter rose
#

empty helipad πŸ˜„ like good ol' days

fair drum
#

My fav

vapid scarab
#

hmmmm. i dont why i didnt remember that one.

cosmic lichen
#

Is there a way to prevent mission parameters to be automatically initialized by BIS_fnc_initParams in singleplayer that I am not aware of?

winter rose
#

don't start the mission

winter rose
cosmic lichen
#

Always default values

winter rose
#

yes, this is on purpose?

#

you can still overwrite them later iirc

cosmic lichen
#

I am not saying it's broken. But since there is no native way of editing the values in singleplayer I wanna write my own system so the player can edit this settings

#

But as parameter initialization is forced it will execute functions in the parameters twice.

#

Which is problematic

winter rose
#

oh, I see
IDK if there is a #ifdef __SINGLEPLAYER__, if so you could wrap the options in description.ext

cosmic lichen
#

This is not the point

#

I wanna use the same set of parameters

#

I just wanna handle initialization differently in SP

#

I guess I'll make a ticket, the fix is easy and breaks nothing

winter rose
#

I get that
but you could have an alternative system with values but no method call or something (well unless it's revive settings and such vanilla stuff)

but yeah, a singleplayer button with "set mission parameters" would be nice :3

cosmic lichen
#

Vanilla stuff is indeed one problem.

hasty pond
#

Thank you!<3

limber panther
#

Hello, yesterday i wrote a script but it doesn't work. I tried several alternations but none of them helped. I believe i made 2 independent mistakes in there. Can someone help me fix it please? This is written in initPlayerLocal.sqf : ```sqf
player addAction ["Impound vehicle", {
params ["_target", "_caller", "_actionId", "_arguments"];
_impoundstart = player modelToWorld [0,0.2,0.7];
_impoundend = player modelToWorld [0,2.2,0.7];
_vozidlokodtahu = lineIntersectsObjs [_impoundstart, _impoundend, _caller];
if (_vozidlokodtahu isKindOf "LandVehicle" && {vehicle player == player}) then {hint "TEST It works!";} else {hint "TEST Impound failed!";};
}, nil, 1.5, false, true, "",
"_this getVariable ["fw_mohuodtahnout", false] == true",
3, false, "", ""];

#

when i replace condition for if with true and at the same time replace condition in addAction with just true then the function appears in game and gives me the hint "TEST it works!" But when i add back those conditions, one or the other or both of them, it doesn't work.

proven charm
#

@limber panther there are several things wrong with the script, here's a list of them, hope it helps: 1) lineIntersectsObjs returns array of objects but isKindOf wants only one object. 2) quotes around fw_mohuodtahnout should be ' because its inside " quotes 3) the fw_mohuodtahnout variable must be set true on the vehicle for the script to work

limber panther
proven charm
#

u should also cover the case of there being no objects found

little raptor
#

first you should fix the quotes

tall lark
#

thanks guys i got the speedo meter working

limber panther
#

@proven charm @little raptor thank you for your ideas, the variable is set the whole time, that's fine, for the array i actually forgot to include a line selecting 1 item so thanks for the tip and i did replace "" with ' '. Currently the script does show me the action properly but i am not getting any hint, something must still be wrong. Here's what it currently looks like: ```sqf
player addAction ["Impound vehicle", {
params ["_target", "_caller", "_actionId", "_arguments"];
_impoundstart = player modelToWorld [0,0.2,0.7];
_impoundend = player modelToWorld [0,2.2,0.7];
_detekovanavozidla = lineIntersectsObjs [_impoundstart, _impoundend, _caller];
_vozidlokodtahu = _detekovanavozidla select 0;
if (_vozidlokodtahu isKindOf "LandVehicle" && {vehicle player == player}) then {hint "TEST It works!";} else {hint "TEST Impound failed!";};
}, nil, 1.5, false, true, "",
"_this getVariable ['fw_mohuodtahnout', false] == true",
3, false, "", ""];

proven charm
#

make sure _detekovanavozidla has objects before proceeding: ```sqf
if(count _detekovanavozidla == 0) exitWith { hint "No objects there!"; };

limber panther
proven charm
#

right below lineIntersectsObjs

limber panther
limber panther
little raptor
#

you're providing AGL

#

also it's better to use lineIntersectsSurfaces instead

limber panther
#

omg you're right

little raptor
#

also I'm not sure what you're trying to do exactly

#

do you want to look at an object and "impound" it?

limber panther
#

i did that in the past already i completely forgot about that

proven charm
#

@limber panther glad to see your making progress. I have to go so good luck with the script πŸ™‚

limber panther
#

have a nice day

limber panther
# little raptor do you want to look at an object and "impound" it?

yes it's supposed to be a beginning of a much larger script, when a player (with set variable that permits him to do so) looks at a vehicle, he should be able to use addaction to activate script which should let him decide what to do with that particular vehicle that he's looking at, either delete it, impound it, or other, for starter i wanted to get this working so i placed there just hints to see if it works

little raptor
#

well what you do rn always shows the action. it's better to use something like cursorObject instead

#

also it would be nice to show the type of the vehicle to the user

#
player addAction ["Impound vehicle", {
  params ["_target", "_caller", "_actionId", "_arguments"]; 
  _vozidlokodtahu = cursorObject;
  if (_vozidlokodtahu isKindOf "LandVehicle" && {vehicle player == player}) then {hint "TEST It works!";} else {hint "TEST Impound failed!";};
}, nil, 1.5, false, true, "", 
toString {
  alive cursorObject && {
    _this getVariable ['fw_mohuodtahnout', false] && {
      _this setUserActionText [_actionId, format ["Impound Vehicle (%1)", getText (configOf cursorObject >> "displayName")]];
      true
    }
  }
}, 
3, false, "", ""];
#

also you should add a distance check too

limber panther
#

those are great ideas, thank you very much for your help

little raptor
#

it's probably better to use a function for that:

fn_canImpoundVehicle = {
  params ["_veh"];
  alive _veh && {_veh isKindOf "LandVehicle" && player distance _veh < sizeOf typeOf _veh / 2}
};

player addAction ["Impound vehicle", {
  params ["_target", "_caller", "_actionId", "_arguments"]; 
  _vozidlokodtahu = cursorObject;
  if ([_vozidlokodtahu] call fn_canImpoundVehicle && {vehicle player == player}) then {hint "TEST It works!";} else {hint "TEST Impound failed!";};
}, nil, 1.5, false, true, "", 
toString {
  [cursorObject] call fn_canImpoundVehicle && {
    _this getVariable ['fw_mohuodtahnout', false] && {
      _this setUserActionText [_actionId, format ["Impound Vehicle (%1)", getText (configOf cursorObject >> "displayName")]];
      true
    }
  }
}, 
3, false, "", ""];

limber panther
cobalt path
#

How does one make addaction that wont execute again?

_this addAction ["<t color='#FF0000'>Cool Action", 
{

params ["_target", "_caller", "_actionId", "_arguments"]; 
//A bunch of code
_this select 0 setVariable ["bs_break",false];
 
},  
[], 7, true, false, "", "_this == driver _target &&" + "!(_target getVariable['bs_break',false])"];

I kinda have code that I am pretty sure adds addaction every tim you enter the vehicle, and it starts to duplicate, I thought adding "!(_target getVariable['bs_break',false])" in a condition would prevent it from appearing again

limber panther
vital silo
#
_this addAction ["<t color='#FF0000'>Cool Action", 
{
  params ["_target", "_caller", "_actionId", "_arguments"]; 
  //A bunch of code
  
  _target removeAction _actionId; // Remove Action
},  
[], 7, true, false, "", "_this == driver _target"];
#

@cobalt path

little raptor
cobalt path
little raptor
#
if (_this getVariable ["M_ActionID", -1] >= 0) exitWith {};
_actionId = _this addAction ["<t color='#FF0000'>Cool Action", 
{

params ["_target", "_caller", "_actionId", "_arguments"]; 
//A bunch of code

},  
[], 7, true, false, "", "_this == driver _target"];
_this setVariable ["M_ActionID", _actionId];
cobalt path
little raptor
#

yeah

cobalt path
#

I am having trouble making this work

little raptor
cobalt path
#

Nvm I am figuring it out, I am replacing it with if else

crude sky
#

I'm trying to run a randomization uniform/headgear script on a unit's spawn, but to do so with a delay. It's for escape so I need escape's on-spawn scripts to kick in first.

I have the randomization script working fine. "(_this select 0) execVM ""\Africa_Mjanzi_INDFOR\kifonja_gear_randomizer_A.sqf"""; but I cannot get a waituntil or slee because suspending is not allowed.

is there no way to tell it to just wait a moment before activating? Right now it competes with the other escape script, so I get some of their on-spawn stuff but some of their on-spawn stuff doesn't kick in.

little raptor
#

put the sleep in the script itself

#

if you don't have access to the script, spawn the code

"_this spawn {sleep 1; (_this select 0) execVM ""\Africa_Mjanzi_INDFOR\kifonja_gear_randomizer_A.sqf""}"
crude sky
#

Alright, I'll give that a try. Thank you Leopard

cobalt path
#

I am getting an error "Error Foreign error: Unknown enum value: "Deleted"
blablabla line 78

The code is _uv80 addMPEventHandler ["Deleted", {.........

Am I missing smth? I am pretty sure there is an event handler parameter called "Deleted"

hallow mortar
cobalt path
#

Thanks

hallow mortar
#

No.
A normal event handler can be used in MP, as long as you're aware of its locality. You might remoteExec it if you wanted it to be added on all clients from a script that only runs on a single machine. But that doesn't give it the special properties of an MP event handler. The ones that are specifically designated as MP event handlers have special logic for their activation (see the descriptions on the page), and just using remoteExec to add an EH on all clients doesn't replicate that.

half sapphire
#

hey guys. is there a way to add a holdAction to a memory point? addaction has that. can't find a way to do it with holdaction.

hallow mortar
#

I don't know. It probably depends on the EH and which parts of the functionality you want to replicate. I don't think you could achieve everything like that.
It would probably be better to just understand the EH in question and be smart about how you add it and what it does.

hallow mortar
#

Trying to do it for projectiles is a bit dubious regardless because many types of projectiles have multiple local copies - it doesn't matter if one client deleted a bullet when everyone else still has theirs (and sending the _projectile object reference would be useless, because it'll be different on each client)

#

Also, for setVariable you need to specify a namespace and close that var name string