#arma3_scripting

1 messages · Page 178 of 1

tight cloak
#

i just want when an agent dies, an addaction is assigned to them

winter rose
#
  • agents returns a list of… Team Members
  • agent _teamMember returns the object the Team Member is
    like… yeah 😄
tight cloak
#

a very primtiive form of hunting as a side quest for some players

winter rose
#

btw, I believe addAction won't work on agents

south swan
tight cloak
winter rose
south swan
# tight cloak even on the corpses?
{agent _x addEventHandler ["Killed", {
  params ["_unit", "_killer", "_instigator", "_useEffects"];
  _unit addAction ["Hehe", {systemChat "It's already dead"}];

}];} forEach agents;```seems to work as intended ![blobdoggoshruggoogly](https://cdn.discordapp.com/emojis/748124048025714758.webp?size=128 "blobdoggoshruggoogly")
#

agent _x addAction ["added to alive agent", {systemChat "ohoho"}]; seems to work as well (at least on stationary agent) tanking

winter rose
south swan
#

the distance check seems to be borked on defaults, though

tight cloak
#

ahh. so just crank it up i guess

south swan
#

both on alive and dead agent 🤔

#

seemingly can be side-stepped by the non-default condition of "_this distance _originalTarget < 5" (non-default, but very popular 🤣 )

granite sky
novel mountain
#

Hi guys, got question. I am annoyed that my tank divisions AI dismount upon getting detracked. is there a way of stopping it from happening? So the crew always stays in the tank/APC even if the tracks are gone.
tried
this setUnloadInCombat [false, false];
did not work

novel mountain
#

hold up

#

they still get out

#

KK_fnc_allowCrewInImmobile = {
_this allowCrewInImmobile true;
{
_x disableAI "FSM";
_x setBehaviour "CARELESS";
} forEach crew _this;
};
//example
car call KK_fnc_allowCrewInImmobile;

#

i put it in tank execute/ did I mess up? @granite sky

#

also get error invalid number in expression

granite sky
#

I don't know your inputs.

#

You can't put comments in an editor box btw.

novel mountain
#

noticed.

novel mountain
#

tried the
{
_this allowCrewInImmobile true;
{
_x disableAI "FSM";
_x setBehaviour "CARELESS";
} forEach crew _this;
};

#

notin

#

As soon track is gone/they bail out

granite sky
#

allowCrewInImmobile works. We use it regularly.

#

So likely your code isn't being executed on the vehicle.

novel mountain
granite sky
#

I can't tell you what the first part should be.

novel mountain
#

or shut i put it on false?

granite sky
#

_vehicle/_this/this/whatever have no meaning without context.

#

There are a lot of different ways to run SQF code in Arma.

novel mountain
#

😭

#

i don ged id

#
  • monkey with hammer gift *
tulip ridge
#

Is there a way to get the unit from a weapon object?

E.g. looking at a unit's gun and running cursorObject returns NOID: modelName.p3d. objectParent cursorObject doesn't return the unit like I thought it might

granite sky
#

I doubt it. The weapon isn't really an object, just a model rendered as part of the unit.

#

kinda annoying behaviour from cursorObject.

meager granite
#

Anyone remembers any limitations on allLODs and selectionNames, can I rely on them to working right away (Init or frame later)?\

#

I think I recall there being something about it but I'm not sure. I want to go through all LODs and check if certain selection is there. Not sure if model streaming can affect that.

quaint oyster
#

isn't there a way to get the .p3d path of an object in game?

granite sky
#

getModelInfo?

quaint oyster
#

that was it, thanks

pallid palm
#

wow every thing is working so good, i wish i had something for you guys to fix,

#

ill have something soon i can feel it

#

lol

tulip ridge
little raptor
#

I think allLods is the same

meager granite
tulip ridge
tough parrot
#

How do getVariable and setVariable refer to objects passed as varspace? I thought it was a pointer. But I've seen code where a client is setting vars on vehicles that would be local to other clients.

tulip ridge
drowsy geyser
#

is it possible to find out what music/sound is played (ambience sound effect on a terrain) and stop it somehow?

queen cargo
#

anybody here by chance has something in hands which makes the mortar shells/artillery shells sound just like being placed by zeus?
my community just "raised" that concern to me and i dont want to dig through all that crap :3

fiery juniper
#

does anyone know how I would go about using a trigger to tell an ai squad to get in a heli and then have the heli take off and move to a position?

faint burrow
fiery juniper
faint burrow
#

As you wish -- you can use global vars instead.

fiery juniper
#

it's telling me it expects a bool. How do I assign the squad to the heli?

faint burrow
#

What does expect a bool?

fiery juniper
#

the trigger

faint burrow
#

Well, then write the condition, upon fulfillment of which an order will be given for AI squad to get in the heli.

fiery juniper
#

when I do I get an error

faint burrow
#

Then your condition is wrong, fix it.

fiery juniper
#

[_unitOne] allowGetIn true;

#

this is what I have

#

which is from the wiki

faint burrow
#

This is not a condition, condition should return bool value, true or false.

fiery juniper
#

then where do I put that?

faint burrow
fiery juniper
#

so wait

#

I have an area set to activate when the players get into an area

#

it's condition is set to true and is synced to the trigger next to a heli. That trigger's condition is true and the activation has that order for them to get in

#

so what am I missing?

faint burrow
#

Correct code I guess.

fiery juniper
#

is [_unitOne] allowGetIn true; not correct?

faint burrow
#

Yes, it's incorrect.

fiery juniper
#

what's wrong with it?

faint burrow
#

_unitOne is undefined.

fiery juniper
#

how do I define it?

candid narwhal
#

Greetings,
How would I go about extracting several arrays from a preprocessed File?

_content preprocessFile "myFile.sqf";

Puts everything in the file into _content...
Now I just struggle with accessing parts of what´s in the file.

Currently I am doing this:

private _configFile = preprocessFile format ["arsenal\configs\arsenal_%1.sqf", _arsenal];

And the contents of the arsenal_%1.sqf are:

_weapons = [
    //...
];

_backpacks = [
    //...
];

_magazines = [
    //...
];
//...

And I need to access these arrays / know what´s in them somehow.

granite sky
#

If that's what in it then just compile and execute it.

#

Well, I guess you'd have a local var problem, but that's easily resolved if they're your files.

#

actually if they're not declared private then you can just pre-declare those vars:
private ["_weapons", "_backpacks", "_magazines"];

#

And then read the values after the call compile.

faint burrow
fiery juniper
#

in the activation field?

candid narwhal
#

okay but what if in the function doing this:

private _configFile = preprocessFile format ["arsenal\configs\arsenal_%1.sqf", _arsenal];

I also want to do something like this:

private _allWeapons pushback //something from _configFile;
granite sky
#

So:

private ["_weapons", "_backpacks", "_magazines"];
call compile preprocessFile format ["arsenal\configs\arsenal_%1.sqf", _arsenal];
_allWeapons append _weapons;
candid narwhal
faint burrow
fiery juniper
#

yeah and it doesn't explain anything about the difference between the activation field and condition field

candid narwhal
fiery juniper
#

then where do I put it?

#

if not in the activation field

#

since condition requires a true or false

granite sky
#

It turns the string from preprocessFile into code and then calls it.

faint burrow
fiery juniper
#

so then if it's linked to the area trigger it should work?

candid narwhal
faint burrow
fiery juniper
#

doesn't seem like it

granite sky
#

Same as this:

private _weapons = [];
call {
  _weapons = ["aaa"];
};
_weapons;    // returns ["aaa"]
candid narwhal
#

I´ve never messed with the compileor preprocessFile commands before, so please forgive me if i am a bit daft

granite sky
#

ugh actually maybe I'm getting this backwards

#

Avoid doing this stuff intentionally most of the time :P

#

hmm no, does work.

candid narwhal
# granite sky Avoid doing this stuff intentionally most of the time :P

Well I am making a script that "creates" whitelisted Arsenals from "config files" so specific players can have specific Arsenals. And so my Friends can use the script whenever and just change Arsenals...

I much prefer the CfgFunctions approach instead of _fnc_someStuff = call compile preprocessFile "file.sqf"

candid narwhal
fiery juniper
#

anyone know why this isn't working and the squad is ignoring waypoints?

hans disableAI "MOVE";

#

then there's an area trigger with enableAI "MOVE";

#

the squad lead's variable is hans

#

I followed a tutorial from 2021 and it worked there. Is that too old?

granite sky
#

Uh, what are you expecting it to do?

#

_unit disableAI "MOVE" should prevent a unit from moving or turning.

crude pebble
#

Hey I need some help with a script that adds a nuke

granite sky
#

The squad shouldn't be following waypoints if the leader can't move. Probably.

crude pebble
#

how do I add the W48 155mm shell to the 2S9?

#

nvm I figured it out

fiery juniper
#

But it doesn’t work

granite sky
#

I still don't know what you're expecting and how that compares to what you're seeing.

fiery juniper
#

I want them to stop moving

#

But they don’t

warm hedge
#

You may have some AI Mods then. Or some other Mods

surreal plume
#

Is anyone able to help me with this? i'm trying to save an object variable through the ALIVE namespace save and then load it in a new session to maintain loot. However this doesnt appear to work?

Saving code:

private _object = _this select 0; 
if (isNil "_object") exitWith { systemChat "Error: Object not found!"; };

private _jna_dataList = _object getVariable ["jna_dataList", []]; 


["jna_dataList", _jna_dataList] call ALiVE_fnc_ProfileNameSpaceSave;

loading code:

private _object = _this select 0; 

private _value = ["jna_dataList"] call ALiVE_fnc_ProfileNameSpaceLoad;

if (!isNil "_value") then {
    _object setVariable ["jna_dataList", _value, true];
};

#

at the moment i am initiating them both by doing addActions in the object init

warm hedge
#

How are you sure it's not working?

blissful scarab
#

Question:

#

Zero sewerslide planes.

#

Possible, yay or nay

tranquil nymph
#

if you haven't already, check bis_fnc_projectile

tulip ridge
blissful scarab
#

I mean, I know they aren't a base game thing

#

But I figured maybe I can set them to find the players grid position and just fly straight for it

tranquil nymph
#

that's what handles the zeus mortars, sound file paths will be in there

tulip ridge
#

Oh you mean aircraft

blissful scarab
#

Yeah

#

I meant the Zero as in

#

Japanese Zero

#

Fighter plane

tulip ridge
blissful scarab
#

I have no idea what any of the stuff in the description says lmfao

sudden bear
#

Hello, I have a question if anyone has any idea how to fix this. I've spotted a bug with BIS_fnc_unitCaptureFiring: if any plane or helicopter has two seats, the capture of the pilot's gun is correct but doesn't react at all. Only the copilot's gun seems to work.

#

For exemple the MI-48 Kajman.

#

This is my script : _V1movedata = ... ;
_V1pewdata = ... ;
_V1dothings = [v1, _V1movedata] spawn BIS_fnc_UnitPlay;[v1, _V1pewdata] spawn BIS_fnc_UnitPlayFiring;

charred monolith
flint topaz
#

Something something voodoo magic

autumn terrace
#

what's the main difference between BIS_fnc_unitCapture and BIS_fnc_unitCaptureSimple?

#

why use one over the other?

proven charm
#

its in the wiki but wiki isnt in very good order

autumn terrace
#

Hence why I ask. Also why is even BIS_fnc_unitCaptureFire a separate function?

proven charm
#

dunno

charred monolith
#

I may speculate, but Separating Movement and Firing, enables more flexible scripts.

#

And to not have insane amount of data also. Maybe they didn't want all of the data of a moving unit, that doesn't move just that it's fires

autumn terrace
#

Idk the way I see it it's more harm than good. unitCapture doesn't include unitCaptureFiring, forcing me to stack functions.

#

Really annoying.

pure hawk
#

I wanna create an optional task to avoid killing civilians how can I do that?

hushed turtle
autumn terrace
autumn terrace
hushed turtle
#

Thanks then, so I don't have to find out hard way too 😀

#

But this is weird, disableAI does what is says, it disables AI

pure hawk
#

I wanna attach it to a trigger so that when I mistakenly kill any civilian during my operation I will fail the optional task

hushed turtle
#

How could AI with disabled movement move? It has movement disabled, literally. Only explanation I have is that those mods re-enable it

autumn terrace
#

unit AI isn't one system, it's multiple systems intertwined

hushed turtle
#

Ok

#

Which brings up question - how they move them then? 😀

hushed turtle
pure hawk
#

what about this one. I tried to use it but It missed something I guess
({side _x == civilian && !alive _x} count allUnits) > 0;

pure hawk
autumn terrace
hushed turtle
#

I thought allUnits returns only alive units

hushed turtle
#

If you want to check if any civilians are alive then I would do (count units civilian) > 0

pure hawk
#

like that?

hushed turtle
#

Yeah, but this only makes sense of there was only one civilian, since this condition returns true as long as at least one is alive.

#

So might need to adjust 0 to something larger

#

And just for your information trigger area does not matter when you remove this from condition

pure hawk
#

yeah I know I just used it to try something in the beginning

#

But the task hasn't failed yet!

#

It didn't work

hushed turtle
#

If there was at least one civilian alive when scenario started, then this trigger fired right at the start of scenario

pure hawk
#

Now I have more than 5 and when I start my mission, The trigger gets active before I even kill any civilian

hushed turtle
#

(count units civilian) > 0 this condition would have to be used right before mission ends

#

Maybe if player is supposed to go somewhere to end mission you could use trigger, which would be set to be activated by player being present in the area and trigger condition would be this && (count units civilian) > 0

#

then this would fire when you enter the trigger area, while at least one civ is alive

#

but this is not going to fail the task

#

Trigger with condition (count units civilian) < 5 fires when there are less then 5 civilians alive, which you could use to fail the task

#

But this would be better to do with event handler like Texas was suggesting

#

And fail task by event handler when any of the civs die

pure hawk
#

thank you, bro 🥰

#

Finally I did it

#

It didn't work in the beginning for a glitch or something.
Idk but it works now thank you again

warped basin
#

Hello,
I want to spawn an NPC at a certain position depending on the building type. So I want to use modelToWorld but I don't know how to get the position relative to the building where I want my NPC to be placed?
do you have any idea?
Thanks !

warped basin
#

I success to have position with this and playing with _offset:

_offset = [2.35,5.5,-2.72];  
_worldPos = cursorObject modelToWorld _offset;
npc setPos _worldPos;

I'm trying now to get the dir

dire island
#

is there any way of just straight dumping the entire contents of a text file (or sqf file) into a string variable? What I have right now is:
example.sqf:

maybe with some linebreaks,
maybe with some "quotes" in the text that I'm gonna have to escape,
and so on and so forth";```
Ideally, what I'd like to have is
``example.txt``:
```a bunch of text,
maybe with some linebreaks,
maybe with some "quotes" in the text that I'm gonna have to escape,
and so on and so forth```
Specifically, it'd be of enormous help to not have to go through the text and escape every quote.
proven charm
tulip ridge
buoyant hound
#

There i add code for adding 1 inv item to ai clothes on initserver

Then i want to complete
Assigned Task for pickup it
Any guide?

I try it on trig cond but task wont complate
It have any prob?

#
[player, "ItemMap"] call BIS_fnc_hasItem;
faint burrow
#

What are the trigger settings?

buoyant hound
#

None
Cond
[player, "ItemMap"] call BIS_fnc_hasItem;
On act task comp order that tested before

faint burrow
#

Check using debug console if your condition really works.

#

I read somewhere that BIS_fnc_hasItem is buggy.

granite sky
#

There are simple alternatives too. "ItemMap" in items player if it's in inventory, or player getSlotItemName 608 == "ItemMap" if it's equipped.

faint burrow
#

Let's compare:

(player getSlotItemName 608 == "ItemMap") or { "ItemMap" in (items player) } // length is 77
[player, "ItemMap"] call BIS_fnc_hasItem // 41

Where is simple?

granite sky
#

In this case it sounds like you know which one of the two you want.

#

Normally you'd just use the getSlotItemName one.

faint burrow
#

Map can appear anywhere when you pick it up.

#

So BIS_fnc_hasItem is a more universal solution. The only question is if it's really bugged or I'm wrong.

hallow mortar
#

I've never heard of hasItem being buggy, but it is performance-intensive because of the depth of the search it performs. If you need to check very frequently (e.g. each frame) then you should try to find a narrower check you can use.

faint burrow
#

Sure, but triggers don't check each frame.

granite sky
#

Looks like BIS_fnc_hasItem does a recursive string search on getItemLoadout, so it should be reliable, just slow.

buoyant hound
#

In sp that cond worked good but not on mp

faint burrow
#

Then the trigger settings is incorrect.

#

Post screenshot.

buoyant hound
#

In sp mode its same setting as mp

#

Just not work on mp

faint burrow
#

Good. Screenshot?

buoyant hound
#

I will take it

faint burrow
#
  • Make the trigger to be non server.
  • Change condition to
!(thisTrigger getVariable ["mapIsTaken", false]) and { [player, "ItemMap"] call BIS_fnc_hasItem }
  • Change "On activation" code to
thisTrigger setVariable ["mapIsTaken", true, isMultiplayer];

if (!isMultiplayer or { isServer }) then {
    [...] call BIS_fnc_taskSetState;
} else {
    [...] remoteExecCall ["BIS_fnc_taskSetState", 2];
};
dire island
#

So, I got your help a couple of days ago, and your solution worked fine for # firstText otherText, converting it to [h1]firstText[/h1] otherText. However, with multiple occurrences, it captures the first occurrence of # and the last occurrence of \n, so the output becomes

otherText
# secondText[/h1]
otherOtherText```instead of the expected ```[h1]firstText[/h1]
otherText
[h1]secondText[/h1]
otherOtherText``` 
I guess I'm looking for "match any character any number of times except for a line break". I've tried to use lookahead, but can still only get it to capture the last instance of the final delimiter (linebreak, in this case).
faint burrow
#

I guess the issue is that there are different linebreaks in your text: \n, \r\n, etc.

#

Try this regex: "# (.+)(\n|\r|\r\n)/g".

dire island
# faint burrow Try this regex: `"# (.+)(\n|\r|\r\n)/g"`.

I've tried that exact solution, and it still matches on the last linebreak. I've tried converting the text to have identical linebreaks all over (_input = loadFile "input.txt" splitString toString [13,10] joinString endl;), but it still matches on the final occurrence.
It seems to be the expected behaviour, if we assume that Arma 3:s regex parses treats linebreaks as any other character, because regex101.com matches the first and last double asterisk, like so:

faint burrow
#

Add ? after +.

#

Probably this is a bug in A3.

dire island
faint burrow
#

Sublime Text also replaces correctly using # (.+)(\n|\r|\r\n) regex.

dire island
#

if a3 doesn't treat linebreaks as actual linebreaks but just special characters, it seems to work as you'd expect. (which is still a bit iffy, but it did lead me to your solution that works for a bunch of other use cases, so you solved like 5 problems in one, thanks 👍 )

exotic gyro
#

So, I've noticed Arma Man has air resistance when you fling him.

...Does anyone know how much?

split ruin
#

where can I see what exactly single player save save (global variables, objects, date, time etc) ?

lime rapids
lime rapids
exotic gyro
exotic gyro
#

arma man is not a physX object

lime rapids
#

i couldve sworn units were phsyx objects as well as vehicles?

exotic gyro
#

nay

split ruin
#

@lime rapids what it saves, not where 🤓

tulip ridge
lime rapids
exotic gyro
lime rapids
exotic gyro
#

I don't think it matters, though

lime rapids
#

yeah seems setmass does not affect it

exotic gyro
#

(Because arma man doesn't actually have that mass)

lime rapids
#

so does setmass just affect stamina for a unit then and nothing else if it isnt a phsyx object?

exotic gyro
#

I think it does nothing for a unit?

#

In any case, some test code if you want to jump off of some things. I'm pretty sure this is the right concept, but my drag coefficient is wrong.

lastVelocity = 0;
onEachFrame{
    private _dragCoef = 0.00429677;
    
    private _velocity = velocity player;
    private _speed = vectorMagnitude _velocity;
    private _acceleration = (lastVelocity - _speed) / diag_deltaTime;
    lastVelocity = _speed;
    hintSilent str _acceleration;
    private _resistanceVelocity = ( (_velocity vectorMultiply _velocity) vectorMultiply (-_dragCoef/2));
    
    _velocity = _velocity vectorAdd (_resistanceVelocity vectorMultiply diag_deltaTime);
    player setVelocity _velocity;
    

};
little raptor
little raptor
exotic gyro
#

this is me just trying to "counteract" it

little raptor
#

You can use setVelocityTransformation instead

exotic gyro
#

Oh no, I'm trying to counteract it and allow gravity

#

I'm flinging a man accurately

#

(with the potential for organic interruption)

little raptor
#

iirc men do collide when they have velocity, even if you use setVelocityTransformation

exotic gyro
#

I also mean like, him getting shot or slamming into a tree etc

#

I'm teaching AI to jump, you see

#

but like, stupidly

#

Worst case I just adapt my missile guidance script to harold (harold is my test dummy)

gilded vault
#

Does anyone have any idea how to detect the opening of a specific door or set of doors on a map object? I'm trying to create ready or not-like traps where the opening of a door acts as the trigger to an explosive, but I can't figure out how to detect when the door opens.

granite sky
#

I don't think there are any events. You'd probably need to poll animationSourcePhase

buoyant hound
#

Hey
I want to show a cinematic intro
That player are in first person

The eye close and open effect is what i need..
Any guid?

warm hedge
#

Do you mean black out/in

buoyant hound
# warm hedge Do you mean black out/in

Some thing like fade out and in
Close eye and open
Like when an explode happend and you get dammage and close eye and after few sec open it
Slow and natural

broken pivot
#

Hey people and good morning, Im into developing a old idea

But small steps first I want to show the return value in a hint/systemchat so I can be sure whats going on (what my return value exactly is)

Thats what I have so far:

_position = nearestLocation [getPos player, "",20];
systemChat _position;

I expect to get the cords here

buoyant hound
warm hedge
broken pivot
#

Ouch

#

So the first line doesent work as well, am I getting you right? (language barrier)

warm hedge
#

No. systemChat doesn't take a location

broken pivot
#

But isnt _position the way to execute the return value of "nearestLocation"? sry for basic questions

warm hedge
#

That's not the question/issue

#

systemChat just doesn't work like that and will return an error

broken pivot
#

Copy confirm
Ive also tried with "hint". It issued me in the same way haha
So how am I able to check whats my current return value?

warm hedge
#

Use systemChat str brabra

broken pivot
#

Can you explain me how it works?

So I would do systemChat str _position;

warm hedge
#

Yes

broken pivot
warm hedge
#

Yes

broken pivot
#

Thanks brother. Im into reading then

broken pivot
#

Bro I totally dont need this hahaha, love moments like this

What I want to return is the Numbers of players in a called area so I
can adjust the difficulty of spawning AI automaticly by detecting the
player count

Thats what Ive did now. But Im hanging on how to define the position

_Position = _this;
_Area = _Position nearEntities [player, 20];
systemChat str _position;
broken pivot
#

But I have the problem that _this isnt detected as the point where the script is getting executed from

In my case a simple object with addAction command:

_this addAction ["Verteidigen", "MissionsGenerator\TrenchComplex\Verteidigen.sqf"];

->

execVM "MissionsGenerator\PlayerScan.sqf";

->

_Position = _this;
_Area = _Position nearEntities [player, 20];
systemChat str _position;

The issue is in the last instance where no usable position for "nearEntities" is found
So how can I give him the correct input?

hallow mortar
#

2 issues:

  • according to the code posted, you're not passing a position to the execVM as an argument, so _this will contain nothing. The game doesn't magically know what information you want to pass to be included in _this, you have to tell it.
  • your syntax for nearEntities is wrong
broken pivot
#

Thats what Im finding out at the moment slowly

_Position = getPos player;
_PlayerScan = _Position nearEntities [player, 20];
systemChat str _PlayerScan;

Thats my current attempt, but the value of "_Position" are cords

hallow mortar
broken pivot
#

Thats the Syntax Im tryna use

#

Haha lol I love it

warm hedge
#

Is there a reason to have two script files just to run some nearEntities

hallow mortar
#

Right, so read that list of parameters and compare them to what you actually have in those positions

broken pivot
broken pivot
hallow mortar
#

execVM creates a new separate scheduler thread. You won't get a useful return by doing that.

broken pivot
#

Is call better in my case?

hallow mortar
#

Yes but for this tiny piece of code you might as well just write it in place

warm hedge
#

Just run nearEntities etc directly from addAction will do already

#

Which is cleaner

broken pivot
#

Copy confirm

#

Im into restructure.
Im placing down the PlayerScan in the actual defending script.
The addAction command is stored in the entity init like this:

_this addAction ["Verteidigen", "MissionsGenerator\TrenchComplex\Verteidigen.sqf"];

In that way I can still execute the command in a zeus mission live

The final defend script looks now like this:

//------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------PlayerCount------------------------------------EBER------//
//------------------------------------------------------------------------------------------------------------//
_Position = getPos player;
_PlayerScan = _Position nearEntities [player, 20];
systemChat str _PlayerScan;
warm hedge
hallow mortar
#

Look at ALL the parameters in syntax 2 for nearEntities.

broken pivot
#

So I need above see level, right?

hallow mortar
#

First parameter (left argument) is a position or object. You are providing a position. ✅
Second parameter (right argument, first element) is a string or array of strings. You are providing the return from player - an object. ❌
Third parameter (right argument, second element) is a number. You are providing a number. ✅

#

getPos returns a 3D position and there are 3 coordinates in that array.

broken pivot
#

Oh your right... Just was blind

broken pivot
hallow mortar
#

getPos also isn't really the correct command to use, because the position format it returns is AGLS, while nearEntities requires AGL. This difference won't cause a script error, but it could cause your vertical positioning to be wrong.
It is possible to get the position in the correct format, but you can skip that: nearEntities accepts an object for the position parameter, so just provide the player directly.

broken pivot
#

So my position value needs to be relative to the ground? So I need getPosATL?
Btw the return value of _PlayerScan is equal []

hallow mortar
#

It needs to be relative to the ground, but AGL is not the same as ATL. Click on one of the position formats mentioned on the wiki page to see all the different formats.

And like I just said, you can simply use the player object directly, and not worry about getting the position yourself.

broken pivot
#

So I do it like

_PlayerScan = player nearEntities ["player", 20];
systemChat str _PlayerScan;

But my return stay []

hallow mortar
#

Well, you're looking for objects of the type "player", but this isn't an object class that exists in the game

broken pivot
#

Damn... Bruh. I feel cheated. Ouch. haha how dumm I feel now. learning.exe -> saved process

hallow mortar
#

Player units aren't a unique kind of object. Their object class, their type, is still "B_Soldier_F" or whatever.

broken pivot
#

So in my case
"BWA3_Rifleman_Tropen" they are all the same kind of unit. What they are need to be, right?

#

Now Ive got the return value "D" thats quite random, can you explain me why its not my player name or a number?
Its just "D" lol. Ill translate it now into a number with the count command

hallow mortar
#

You could search for that class, but if there happened to be an AI unit nearby of the same class, or if you wanted to make a player use a different class, you'd have problems.
Watch this:

private _nearPlayers = allPlayers select { (alive _x) && { (_x distance player) < 20 } };```
broken pivot
#

Ok study time
Bro I need to fully understand "private" btw. Im still kinda unsure in usage

Ive found out today that == means is equal to
But what does && mean? Is there a diffrence to just &? Like force and force force?
So is it just a priority thing?

hallow mortar
# broken pivot Now Ive got the return value **"D"** thats quite random, can you explain me why ...

String representation of an object reference. Object references aren't human-readable, so when outputting them to a string, the game has to come up with something to show you. If the object doesn't have an Editor variable name, then it shows some auto-generated information, like its group ID and position within the group, if it's a unit. If it does have an Editor variable name, that variable name is shown.
Your player unit probably has the variable name D.

hallow mortar
broken pivot
broken pivot
hallow mortar
#

Btw, as you've just discovered, all the solutions we've discussed so far will also return the player who activated the action. If you do want that, then that's fine - but it is possible to filter them out if that's what you need.

broken pivot
#

Now we are at the point Im hanging on since Ive seen this
the first time. Why isnt 33 overwritten by 42 with the Global command?
I thought the global things are the most outer scopes and automaticly the "highest" so
they cant be overwritten by something lower or am I completly wrong with the
scope topic?

hallow mortar
#

Global scope doesn't mean it can't be overwritten. It means it's available to all scripts - not limited to a particular script's scope.

broken pivot
hallow mortar
broken pivot
#

Okay its getting wild haha

hallow mortar
#

That example you screenshotted is talking about the difference between global (scope) and global (networking).
A global scope variable is available to all scripts on the current machine. That example is talking about how to make it available to all scripts on every machine.

broken pivot
#

Thats the anwser haha
Its also what I will need in the future i gues

#

Btw Ive did something like that:

private _nearPlayers = str allPlayers select { (alive _x) && { (_x distance player) < 20 } };
_PlayerScan = player nearEntities [_nearPlayers, 20];
systemChat str _PlayerScan;

I tried to use str for the first time. Did Ive done it in the right way?

hallow mortar
#

That's probably going to do str allPlayers first and then try to do the select on the resulting string. You might need some () to force the correct order of operations.

#

But also that is really not the way to make this code work

broken pivot
#
private _nearPlayers = str (allPlayers select { (alive _x) && { (_x distance player) < 20 } };);

No detection in the return value

hallow mortar
#

Let's break down what you're doing:

  • you get all the nearby living players
  • you convert that array of objects to a string
  • then you try to use that string (which does not contain an object type) as the type parameter for nearEntities....to get all the nearby players
broken pivot
#

Yes

hallow mortar
#

Well, doing that won't work, because that string is completely invalid for nearEntities. It is a literal text representation of an array of object references - but what you need is a string object type, or an array of string object types.

#

But more importantly, why?

broken pivot
#

The moment I went in silence I realized that I did the exact same shit before

hallow mortar
#

allPlayers select ... gives you an array of nearby living players. Why are you trying to then run it through nearEntities?

broken pivot
broken pivot
dusk gust
#

nearEntities is used to get entities in a radius around the given object with the types and distance you provide

player nearEntities ["Man", 1000];

Will return an array of objects that are of type "Man" within 1000 meters of the player.

hallow mortar
#

allPlayers select ... gives you an array of nearby living players. So what do you need to do, to find out how many living players are nearby?
just count that array

broken pivot
#

Ouuu
So your going in with allPlayers select fill filter here

#
//------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------PlayerCount------------------------------------EBER------//
//------------------------------------------------------------------------------------------------------------//

private _PlayerScan = allPlayers select { (alive _x) && { (_x distance player) < 20 } };
_PlayerCount = count _PlayerScan;
systemChat str _PlayerCount;

So now Im happy with the knowlegde and results.
Ive got private a bit closer again but its still not completly fine

hallow mortar
#

Btw, is it actually important to only count nearby players? If you just need the number of players in the mission, this can be even simpler

broken pivot
#

Yes but No

#

Thats also a question Ive asked myself,
"Do I need this?" I decided for yes because its in all cases more dynamic
And also the learning is always important

#

I now need to go on and find out how removeAction works so the players
cant execute it 50 times because they think nothing happens

#

Btw, can you give me a tip how to set a "local variable"
to the object its executed? Because I gues its not the best way to always
strugle with _this
Because its wont work with the addAction thing:

_this addAction ["Verteidigen", "MissionsGenerator\TrenchComplex\Verteidigen.sqf","",1];
_this removeAction 1;
hallow mortar
#

You're sort of on the right track with wanting to set a variable on the object. This is a good way to store action IDs. The command for this is setVariable.

#

HOWEVER

broken pivot
#

So I gave the priority "1" so its on first position, but the ID to remove it is "0"??

hallow mortar
#

Priority and ID aren't the same thing

broken pivot
#

Ohhh

#

Copy confirm

hallow mortar
#

ID is a unique, sequentially-generated...ID...used to refer to the action later. Priority is just... priority. It's how much importance the game gives to the action when showing it in the menu. It's not unique and isn't used for anything else.

hallow mortar
# hallow mortar HOWEVER

Action IDs are machine-specific and different (or nonexistent) on different machines, partly because the commands involved are all Local Effect: they only do stuff on the machine where they're executed.

broken pivot
hallow mortar
#

No, because that just saves a variable with an empty string, which isn't helpful. You need to save the return from addAction (the ID).

#

But there's more, so just hold on a minute while I type

broken pivot
#

Cheers

hallow mortar
#

You need to execute addAction on all machines, and removeAction on all machines.
The object init field is executed on all machines, including on new machines when they JIP. Helpful? Kind of...but it also means machines that join after the action is removed, will also add it again for themselves.
So instead, you'll want to use some check to make the code only execute on one machine (if isServer then probably) and use remoteExec to tell other machines to do stuff with safer JIP handling.
Done? No. We need to do stuff on the other machines using the returns from their local executions of addAction. But remoteExec doesn't support doing that directly.
So instead we enter the magical world of functions.
A function is a saved script, packaged into a single name. I'll post a link after this message. This lets us make a complete script and remoteExec that to be executed locally, not just a single command, so we can do more complex stuff, like working with the return from addAction.
Here's what we do:

  • function 1 adds the action and stores the ID, locally on each machine
  • function 2 retrieves the ID from the variable saved on the object, and removes that action, locally on each machine
broken pivot
#

JIP = Join in Progress, right?

hallow mortar
hallow mortar
broken pivot
#

I kinda know about functions

#

Its a bit rusty but Ive got a self writen explanation in my archiv lemme check

I explained it in the past with "Like a variable connected to a script"
Its also connected to the description.ext and I need files for it.

It look like:

Beispiel:
(muss in description.ext eingepflegt werden)

class CfgFunctions
    {
    class EBER                        //TAG         (Vorname)
        {                
        class Scripts                     //Category    (1. Ordner des Pfades)
            {
            file = "Scripts\Ordner1\Ordner2";    //Atribut    (bestimmt Pfad)
            class szene1_Gruppe_I_4    {};        //Function    (Dateiname des Skriptes) (ohne fn_) (ohne Dateityp)
            };
        };
    
    class nächsteFunktion
        {
        class Scripts
            {
            file = "Scripts\Ordner1\Ordner2";
            class szene1_Gruppe_O_6 {};        //Am Besten in camelCase oder snake_Case schreibweiße. Nicht in PascalCase
            };
        };
    };

Its getting executed by something like:

call EBER_fnc_szene1_Gruppe_I_4

are we talking about the same?

tender fossil
broken pivot
#

Notepad++

tender fossil
#

Ok, then nvm. Was going to suggest trying my Visual Studio Code extension that automates generating the Functions Library etc. but it's not available for Notepad++

hallow mortar
broken pivot
hallow mortar
#

order: String - function or command name

#

"order" as in "instruction", "the thing to be remotely executed"

broken pivot
#

Copy - So the thin I need to create first

hallow mortar
#

As I mentioned, this message contains almost the exact code you need to put in your 2 functions, and exactly how to remoteExec them. Just a couple of placeholder variable and function names and placeholder addAction content.
#arma3_scripting message

#

I need to go out now so good luck with this

broken pivot
#

Ill give it a try and let you know

#

Thanks for everything and for your great help. I enjoyed a lot

tough abyss
#

anyone know a lot about the arma commander mod ? need help

buoyant hound
#

Sound part not work but other parts done.
Any guide?

call{[kod,     
 "D",     
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",     
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",     
 "_this distance _target < 2",     
 "_caller distance _target < 2",     
 {},     
 {hint "D";},     
 {        
removeAllWeapons _caller;     
removeAllItems _caller;     
removeAllAssignedItems _caller;       
removeVest _caller;     
removeBackpack _caller;     
  
    
_caller addWeapon "rhs_weap_akms"; 
_caller addPrimaryWeaponItem "rhs_30Rnd_762x39mm_bakelite"; 
_caller addVest "V_Chestrig_oli"; 
_caller addBackpack "CUP_B_AlicePack_OD";  
 
 
for "_i" from 1 to 20 do {_caller addItemToVest "ACE_fieldDressing";}; 
for "_i" from 1 to 2 do {_caller addItemToVest "ACE_morphine";}; 
for "_i" from 1 to 4 do {_caller addItemToVest "30Rnd_762x39_Mag_F";}; 
for "_i" from 1 to 4 do {_caller addItemToBackpack "vn_m61_grenade_mag";};
_caller linkItem "ItemMap";    
_caller linkItem "ItemCompass";   
_caller linkItem "Itemwatch";   
hint "L";    
if isServer then {"gu" remoteExec ["playSound"]};     
},     
 {hint "L";   
 if isServer then {"l" remoteExec ["playSound"]};     
 },     
 [],     
 1,     
 1000,     
 false,     
 false,     
 true     
 ] remoteExec ["BIS_fnc_holdActionAdd",[0,-2] select isDedicated,true];}
stable dune
#

The client is not the server,
So you check the blocks play sound event.
You want to play the current sound for everyone or just for the caller?
If for everyone, just remove the isserver check .

buoyant hound
#

For client

#

But on mp ded server

#

Also what about play sound from objects? Like water or jungles

stable dune
#

Hold action is executed locally on client so just

playSound "alarm"

Will play sound locally on client who use action.

stable dune
buoyant hound
stable dune
#

It will play local on the client,
Use remoteexec if you want to broadcast that to other clients.

buoyant hound
#

If yes it not work , sound not played

tender fossil
stable dune
tender fossil
# buoyant hound Like what i send?

So probably something like sqf "alarm" remoteExec [say3D, -2, false]; (2 in targets would mean "execute on server only", while -2 inverts the choice meaning "execute on every client but not the server" which is what we want here)

buoyant hound
buoyant hound
stable dune
#
[player, ["alarm", 35, 1]] remoteExecCall ["say3D"];

So player who use action will be object that "say" your sound.
And no, you cannot use isServer check.
It will block because client is not server.
Just use remoteexec without check

stable dune
#

Referring earlier,
Can you do classed by one letter?
Should it be tag_l,
More that can use even use

class cfgSounds {
 class l {
  ...
obtuse crypt
#

Hello gents, I have question regarding time.

I am making mission that will be played on dedicated server and I want to track time after briefing (waiting on map), once we enter game.

I will need to refer to that time during mission, to check how much time is left till the end, or something specific to happen at specific time.

What would be the best thing to use as a got confused by time, uiTime, serverTime and diag_tickTime..

buoyant hound
stable dune
#

Remoteexec Will raise your event for every client.
And without remoteexec it will play sound on client where it's executed because it's event that have local effect

buoyant hound
stable dune
#

Yes.

buoyant hound
#

Hmm , no matter used in holdaction for dedicate?

#

No need any more change?

stable dune
stable dune
buoyant hound
#

Ok , thank for guiding bros
Best regards

buoyant hound
#

And for a pos sound like an generator
That need to play sound for every one i must use remoteexec?

#

To place code on init

tacit meadow
#

i'm using the set hostage box in 3den and i have a trigger that has the condition ['ENH_isHostage', false]) but for some reason when the hostage is free the trigger wont activate? It does activate if the value is set to true. Anyone know why? thanks!

obtuse crypt
tulip ridge
obtuse crypt
exotic gyro
#

isn't cba_missionTime usually better

tulip ridge
#

Yeah it is

#

Just because its synced between clients and server, time isn't

tulip ridge
obtuse crypt
obtuse crypt
exotic gyro
#

It's a number

tulip ridge
#

It's a thing from CBA, it's just a global variable with the time in seconds since mission start

exotic gyro
#

If you have cba loaded you use that global variable

obtuse crypt
#

Something like this would do it?


[] spawn {if (isServer) then {mission_start_time = cba_missionTime; while {true} do {elapsed_time_from_mission_start = cba_missionTime - mission_start_time;publicVariable "elapsed_time_from_mission_start";sleep 5;};};};

exotic gyro
#

uh

#

That elapsed time is just gonna be cba mission time

#

Because cba mission time is time since mission start

#

So I'm not sure what the point of that code would be

obtuse crypt
#

Ok let me clear it out. I have a fear that time will be counted while players are still on map (briefing) and not after I push it trough and that will break some of my stuff.

exotic gyro
#

It does not

#

Just use cba mission time

obtuse crypt
#

So I am trying to be sure, that time is going to be counted only and only when player is in game and he sees his gun in his hand.

#

Thank you a lot Jenna and Dart. You guys are great!

tulip ridge
#

Just in your condition, say like maybe a trigger, do:

CBA_missionTime > 600;
#

That would activate after 10 minutes have passed since the mission started

#

That's all you need

buoyant hound
#

Will this work and all players hear the alarm sound from speaker1 and 2 object?

CutText ["","blackin",2];
[Speaker1,Speaker2 ["Alarm",20,1]] remoteexeccall ["say3d"];
Sleep 2;
CutText ["","blackout",2];
Sleep 10;
[Speaker1,Speaker2 ["",20,1]] remoteexeccall ["say3d"];
#

Will be use in trigger on act with true cond.

stable dune
#

but if its global, you dont need use remoteexec, because you your trigger will activate on all clients

buoyant hound
# stable dune You want cuttext for everyone? if your trigger is only server [✔️ ] , then you n...

Its part of my intro
When players are move and enter trigger this code will run

Also before everything cinematic view will enable and players see blackin
Hear alarm and then blackout
Then cinematic view disable and they can keep move

disableUserInput true;
[0, 2, true, true] call BIS_fnc_cinemaBorder;
Sleep 1;
CutText ["","blackin",2];
[Speaker1,Speaker2 ["Alarm",20,1]] remoteexeccall ["say3d"];
Sleep 2;
CutText ["","blackout",2];
Sleep 1;
disableUserInput false;
[1, 2, true, true] call BIS_fnc_cinemaBorder;

Have it any problem?

stable dune
#

You don't need remoteexec say3d,
Just

[speaker1, speaker2] say3D "Alarm"

Because it's local and if you remoteexec it, it will be multiple executed from client to clients, so change remoteexec part

obtuse crypt
# tulip ridge Just in your condition, say like maybe a trigger, do: ```sqf CBA_missionTime > 6...

Another on same topic. What would be a better solution for my initServer.sqf?


mission_start_time = cba_missionTime;

//Safe Time
sleep 600;

["Move out!"] remoteExec ["hint"];

//Mission Duration
sleep 3600;

"EveryoneLost" call BIS_fnc_endMissionServer;

or maybe


mission_start_time = cba_missionTime;

//Safe Time
waitUntil {CBA_missionTime > 600;};

["Move out!"] remoteExec ["hint"];

//Mission Duration
waitUntil {CBA_missionTime > 3600;};

"EveryoneLost" call BIS_fnc_endMissionServer;

tulip ridge
#

Yeah
But you also don't need the mission_start_time

#

You don't use it there at all, and it would also always just be 0

obtuse crypt
tulip ridge
#

It's going to essentially be the same

obtuse crypt
tulip ridge
#

It's going to essentially be the same

obtuse crypt
halcyon creek
#

Memory is failing me here, If I want to trigger a waypoint when a specific unit is dead the trigger activation would be ```sqf
!alive UNITNAME

#

For example
#0 LOAD
#1 HOLD
#2 MOVE < Trigger Activation
#3 TRANSPORT UNLOAD

#

Also would It be smarter to also giving the unit a variable name and doing a move in cargo in its INIT? less chance of arma being glitchy with Units getting in vehicles?

dire island
#

Am I losing my mind? I could swear I have gotten this to work previously, and it is basically the exact code from the wiki (https://community.bistudio.com/wiki/getVariable), but, why does the following work:

hint _output;```
while the following doesn't
```_output = missionNamespace getVariable ("_input" + str 0);
hint _output;```
?
granite sky
#

you mean "_input" + str 0 on the second one, I think.

dire island
#

That's a typo in my question, not in the script. "_input" + str 0 is what's not working.

stable dune
dire island
#

missimissionNamespace?

granite sky
#

Can we have some real code that actually declares _input0?

dire island
#

_input0 = "test", for sake of argument.

granite sky
#

I don't think locals are in missionNamespace.

#

That would be localNamespace?

dire island
#

I have tried localNamespace and player, and neither of those work either.

granite sky
#

I dunno, I never considered using getVariable on locals.

#

It doesn't make any sense to do so.

#

Maybe they don't exist in any referenceable namespace.

dire island
#

yeah, turning them into globals worked. Cheers! 👍

halcyon creek
#

Right delving down a rabbit hole, checked above and cant seem to get it to work, im now trying the trigger with the following
Condition ```
!alive gospandicp_1 && gospandicp_2 && gospandicp_3 && gospandicp_4 && gospandicp_5 && gospandicp_6 && gospandicp_7 && gospandicp_8;

Activation
```sqf
axeman_1 sideRadio "Norseman 1, This is Axeman 1 Checkpoint is clear, move out when ready.";
norseman_1 sideRadio "Received, Norseman 1 & 2 are moving.";
axeman_1 sideRadio "Copy that, we will monitor your advance and join when close, Out.";

But its throwing an error

#

ahhh do I have to do each separately?

hallow mortar
#

Yes, each alive check has to be done separately (though you could condense it with findIf).
You also have another problem:
https://community.bistudio.com/wiki/sideRadio
sideRadio is for sending audio messages by classname, not for sending freeform text messages. You're probably looking for sideChat.

#
([gospandicp_1, gospandicp_2, ...] findIf {alive _x}) < 0```
(`findIf` returns -1 if none of the elements in the array satisfy the condition, so if none of the specified units are alive, we get -1 and activate the trigger)
halcyon creek
#

You are entirely correct sideChat is what Im looking for

hollow basalt
#

hey rq was curious what does "simulationStep" do in cfgAmmo?

granite sky
hollow basalt
halcyon creek
#

trying to teleport an enemy group to a location, trigger is BLUFOR present and code is ```sqf
{
gosptowndefence moveTo (getMarkerPos "GospandiTownWarning");
hint "Teleporting Enemy";
};

The hint is just for debugging purposes, Idealy Id like to set up a few empty markers and get it to randomise between them, say enemytown1 - enemytown 5 for example, but I cant even seem to get them to move as a group to the one marker with that code, anyone see something glaringly obvious?
granite sky
#

moveTo is a low-level move command for units.

#

It doesn't teleport and it doesn't work on groups.

#

Hell, it doesn't usually work on units :P

#

If you want a group to move, then use move or waypoints. If you want to teleport them then do setPosATL on each unit.

halcyon creek
#

Will give this a try in the morning!

west portal
#

If I'm spawning civilians through the Civilian Presence module, how could I check their side? This is what I've got so far to check if a player killed a civilian:

addMissionEventHandler ["EntityKilled", 
{ 
 params ["_killed", "_killer", "_instigator"]; 
    if (isNull _instigator) then {
    _instigator = UAVControl vehicle _killer select 0
    };
    if (isNull _instigator) then {
        _instigator = _killer
    };
    if ((isPlayer _instigator) && (side group _killed == civilian)) then {
        civDead = civDead + 1; 
        _instigator sideChat "No! I killed a civilian!";
    };
}];```
west portal
#

Is there a way to check the agent's side?

#
_sideID = getNumber (configFile >> "CfgVehicles" >> typeOf _killed >> "side");
    if (_sideID == 3) then {
        civDead = civDead + 1;
    };```
Well. I came up with this. Does this hit fps much in the missioneventhandler?
dusk gust
#

Basically more of a "Pick your poison" in this case

west portal
#

faction seems less complex though. I'll try that

granite sky
#

Those GIAS errors are typically when you mess up the syntax in a way that the interpreter can't fathom.

#

It won't be simply from writing side _killed, regardless of what _killed is.

edgy dune
#

what is the command to get a launchers attachments like primaryWeaponItems/secondaryWeaponItems ?

meager granite
edgy dune
#

ty

glossy trench
#

So anyone know how to make it so objects that are present in a scenario eventually despawn after a certain amount of time? Globally?

grizzled cliff
#

I went from student to teachers assistant today in a class. 😛

wicked sparrow
#

Does someone know why some objects are immune to "setObjectScale" when hostes on a dedicated server? I tried to set the scale in the attributes, everything working fine when locally hosted. But the second I put the mission on a dedicated server it breaks and goes back to normal scale. Same problem when executing it via a command in the object cmd. Can someone help?

zealous solstice
#

swot 😄

flint topaz
#

singleplayer and multiplayer have different rules on setObjectScale and how it behaves

#

object: Object - must be either an attached object or Simple Object - see Example 3

#

alternative as stated here is simple object

wicked sparrow
quasi gale
#

Hi, I have a question about Arma 3 and their running system. I was trying to make a Realistic Stamina script with the hopes of 4 levels of speed from Sprint, jog, light jog, walk.

I was hoping that the script would trigger the player speeds based on their fatigue.

For whatever reason, the running is only 2 levels (sprint and jog. I've tried everything but can't get it to work.

Is it possible with Arma scripts or am I wasting my time. I am very new to scripting, but I wanted to learn and give it my best shot.

wicked sparrow
#

Thanks for the insight, so basically to fix it I just need to attach them to eachother and then it should work right?

flint topaz
#

not to eachother

#

place a "holder" object it can be anything, just needs to be showing it's model, simulated and preferably somewhere nearby the objects you are attaching to it

#

then attach all the ones you want to upscale to this object using this init code within the object you want upscaled

#
[this,holder] call BIS_fnc_attachToRelative;
this setObjectScale 5;
#

example ^

wicked sparrow
# quasi gale Hi, I have a question about Arma 3 and their running system. I was trying to mak...

You could try it with a animation check and due to in which category they are set the speed to what you want. Take a look at my mod to get a better Idea on how I managed to get somthing simular to that working. https://github.com/MissHeda/Adjustable-Walk-Speed-Rework

GitHub

Contribute to MissHeda/Adjustable-Walk-Speed-Rework development by creating an account on GitHub.

wicked sparrow
finite sail
finite sail
#

webpage wont load

#

oh scratch that

#

its just slow

edgy dune
#

2 part question, I thought there was an event handler for when an attachment on a gun changed like optic/muzzle device etc but I cant seem to find it
and part 2, would said event handler fire off when in arsenal? mainly in single player where time is paused (from wat I know)

granite sky
#

The vanilla arsenal does change the player's items live, so it should work.

#

Assuming that it ever does :P

edgy dune
#

idk why I missed the 2.18 addition to the slottedItemChange eh, I guess I was reading to fast

mortal sapphire
#

Also, yes, it fires in arsenal

edgy dune
#

Wat else is hidden kekega

mortal sapphire
#

Wouldn't you like to know 👀

#

Only other ones that I am aware of for muzzle events are the MagazineUnloaded and WeaponChanged (both of which I may use for the TCP shotgun)

#

I was thinking of trying to do my own version of RHS' bipod slot grip class changing using SlotItemChanged at some point for the VK78

edgy dune
halcyon creek
#

Cant figure out why this isnt working, Trigger Activation is None - Present
Condition !alive gosptown_1 && !alive gosptown_2 && !alive gosptown_3 && !alive gosptown_4 && !alive gosptown_5 && !alive gosptown_6 && !alive gosptown_7 && !alive gosptown_8 && !alive gosptown_9 && !alive gosptown_10 && !alive gosptown_11 && !alive gosptown_12;
Activation

null=[]spawn {

"miltown" setMarkerColor "ColorBLUFOR";
"GospandiTownWarning" setMarkerType "Flag_USA";

axeman_1 sideChat "CLEAR! CEASE FIRING";
sleep 2;
norseman_1 sideChat "Odin this is Norseman 1, Gospandi is cleared";
sleep 2;
officer1 sideChat "Copy that Norseman, Axeman 1 this is Odin Actual, Charlie Mike.";
sleep 3;
axeman_1 sideChat "Copy that Odin Actual, Continuing Mission, Out.";

obj3 setTaskState "Succeeded";
["TaskSucceeded", ["", "Windfall Stage 2 : Assist in the capture of  Gospandi"]] call BIS_fnc_showNotification;
obj4 setTaskState "Assigned";   
player setCurrentTask Obj4;  
["TaskAssigned", ["", "Windfall Stage 3 : Clear Weapons Cache"]] call BIS_fnc_showNotification;

};

It is Identical to a trigger that I had set up with a different type of Unit with different names but for whatever reason this one isnt firing once all units are dead

willow hound
#

You can execute that condition in the debug console to check its current status at any time. Try doing that to figure out if the condition is working as expected.

halcyon creek
#

Good shout

tulip ridge
hallow mortar
#

findIf is slightly faster for this because it doesn't always have to iterate over the entire array (#arma3_scripting message)

tulip ridge
#

Ah yeah forgot that findIf exits once true

sand summit
#

does anyone know what terminal velocity is in arma?

warm hedge
#

Do you mean 9.8 or?

exotic gyro
hasty gate
#

Hi, just a question, did anything change in the scripting framework? because I'm getting now an error

private _invDisplay = findDisplay 602;
_invDisplay displayAddEventHandler ["MouseButtonClick", ...

_invDisplay displayAddEventHandler ["MouseButtonClic>
15:05:28 Error position: <displayAddEventHandler ["MouseButtonClic>
15:05:28 Error Foreign error: Unknown enum value: "MouseButtonClick"

I'm pretty sure it worked fine in the past

little raptor
#

It only works on some controls

#

See the wiki

hasty gate
#

I see now, thank you

lime rapids
#

is there a method to use halt or terminate without assigning a script handle in an execvm statement inside of executed file / code?

#

i suppose im asking if one can assign a script handle post execution of script\

faint burrow
#
terminate _thisScript;
lime rapids
gleaming onyx
#

I've been struggling to create a script which will make a enemy AI plane "drop" the infantry as paratroopers... aaaand its chaos
anyone who can help me? or even better, suggest how I, as simple as possible, can make AI planes drop paratroopers

lime rapids
buoyant hound
#
Call{[kod,     
 "D",      "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",      "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",     
 "_this distance _target < 2",     
 "_caller distance _target < 2",     
 {},     
 {},     
 {},  
 "Sound" remoteExec ["playSound"];,     
 [],     
 1,     
 1000,     
 false,     
 false,     
 true     
 ] remoteExec ["BIS_fnc_holdActionAdd",[0,-2] select isDedicated,true];}

When a player use this holdaction on server ,all players will hear Sound?

tulip ridge
#

Just do:

[
    kod, "D",
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
    "_this distance _target < 2",
    "_caller distance _target < 2",
    {},
    {},
    {},
    { "Sound" remoteExec ["playSound"]; },
    [],
    1,
    1000,
    false,
    false,
    true
] remoteExec ["BIS_fnc_holdActionAdd", [0, -2] select isDedicated, true];
sharp ocean
#

does anyone have any idea on how to make a script to change pylons of helicopter using add action
i am trying to have set presets E.G. Escort - (just rocket pods), AT - (hellfires) recon - (hellfires+rocket pods)
I have seen that the setpylon command is there but im using RHS helicopters so I dont know how that would work, any help would be appreciated.

empty pilot
#

Why wiki is down

hallow mortar
#

Because some unpleasant person is DDoSing the BI servers

empty pilot
#

it been like this for 2 hours

#

i don't think this is an ddos...

hallow mortar
#

Well......it is. It's been ongoing for the last few days.

empty pilot
#

okay since now i can

#

i can't access the wiki for scripting

#

i think this is the only place i can ask this

#

i wanna check real player side even while the player is dead

#

like something other then side

hallow mortar
#

If you want to get the side of a dead unit, the best way is to check the side of its group. The dead unit itself changes to Civilian, but the group's side doesn't change.

empty pilot
#

so i have entitiykilled event on and i have checker for side players

#

and as you said it shows civilan cause the enitity is already dead....

#

what i have something like if!(side _killer == side _killed)

hallow mortar
#

Like I said, check the side of the group.

empty pilot
#

so i wanna change the side method cause i think maybe there is another method.

#

ummm

hallow mortar
#
if (side group _killer != side group _killed)```
empty pilot
#

so like group _killer ?

#

okay so that will return real group ?

winter rose
#

that returns the side of the group and not the side of the unit

empty pilot
#

Okay i see

#

does that effects if all the group members are dead ? will it change the side ?

winter rose
#

that only works on unit's death and some time after that, afeter a certain time dead units get ungrouped and all you can do is check faction (or config)

hallow mortar
#

This is apparently in an entityKilled EH so I would expect it to work fine

#

You can't really trust config sides because a unit can be created on, or switched to, any side, regardless of its config

winter rose
#

yep
on death is ok, later, not guaranteed

buoyant hound
tulip ridge
split ruin
#

there was a way to see script commands in the game, does anyone know how ?

split ruin
#

@tulip ridge very funny biki is down, I know without checking

tulip ridge
#

You can also read the command name in the link.

tulip ridge
#

There, saved you the 10 seconds.

split ruin
#

@tulip ridge the whole evening I am backing up this 😆

#

BI decide to kill arma to make room for this creature called reforg but without me

pallid palm
#

Dam i don't have anything to fix,,,, You guys fixed me up so good,,, Everything works perfect

#

i soon will have something to fix i can feel it lol

split ruin
#

@tulip ridge and how u use this command, I am too dumb to understand? ok I used it, now I need 90000+ days to sort out the mega array it spat

pallid palm
#

lol

crude barn
#

How would a get a flat area thats also near a road?

granite sky
#

I believe there's a command called isFlatEmpty but apparently the biki fell over. Also nearRoads.

bold token
#

^

#

you can check if nearRoads empty or not (as it returns an array), and then run a isFlatEmpty on that position

#

might also want to use isOnRoad if you dont want postions on the road itself

charred monolith
#

Hi ! I have a weird problem where this script works in solo and hosted Multiplayer, but not on dedicated.
When on dedicated it creates a generic Error expression while it works perfectly in solo and Hosted.

AR_isPhase1 is stored inside the description.ext and is set to true.

There is the error :

Error in expression <ssionConfigValue ["AR_isPhase1",false]) != "true"))then{
  _array = ["ar_p2_head>
Error position: <!= "true"))then{
  _array = ["ar_p2_head>
 Error Generic error in expression

there is the code it is executed on the init of an object:

if(isServer)then{
 private _array = [];
 if(((getMissionConfigValue ["AR_isPhase1",false]) != "true"))then{
  _array = ["ar_p2_headgear_v1","ar_p2_headgear_v2"];
 }else{
   _array = ["ar_p1_headgear_v1","ar_p1_headgear_v2"];
 };
private _Dir = vectorDir this;
private _Up = vectorUp this;
private _pos = getPosATL this;
deleteVehicle this;
private _helmet = (selectRandom _array) createVehicle _pos;
_helmet setPosATL _pos;
_helmet setVectorDirAndUp [_Dir,_Up];
};
hallow mortar
#

You're trying to use == to compare a boolean (true/false) to a string ("true"). == cannot compare different types.

#

If the config value "AR_isPhase1" actually contains a string, then the default value you're using with getMissionConfigValue is wrong - should be "false" instead, I guess.
If the config value actually contains a bool, then you can't compare it to "true" - and you don't need to, because == returns a bool, and you aready have a bool, so just use the returned config value directly.

charred monolith
#

It's like it encapsulate the value inside a string. So I have to test it with a string.

hallow mortar
#

Then you need to fix the default value to also be a string, otherwise there will be an error if the default value ends up being used

astral bone
#

dumb question, probably asked a million times already. Is the bistudio wiki down?

astral bone
#

ah oki

#

Thankies ^.^

hallow mortar
#

btw, config doesn't actually support bools, which is why it's being interpreted as a string.
The usual convention is to use numbers instead in this case, 0 for false and 1 for true. This will allow you to do this neat trick:

_array = [["ar_p2_headgear_v1","ar_p2_headgear_v2"], ["ar_p1_headgear_v1","ar_p1_headgear_v2"]] select (getMissionConfigValue ["AR_isPhase1",false]);```
charred monolith
astral bone
#

I just needa know the params for addAction- I think there was one for JIP?

charred monolith
hallow mortar
charred monolith
#

oh ok. I'll try with 0 and 1 then. I'll get back to you with the result. Thanks for the help

hallow mortar
charred monolith
#

So I don't have the generic expression Error anymore but I have a new error :

Cannot create non-ai vehicle ar_p2_headgear_v2

Code :

if(isServer)then{
private _helmetArray = [];
_helmetArray = (([["ar_p1_headgear_v1","ar_p1_headgear_v2"],["ar_p2_headgear_v1","ar_p2_headgear_v2"]]) select (getMissionConfigValue ["AR_isPhase1",1]));
private _Dir = vectorDir this;
private _Up = vectorUp this;
private _pos = getPosATL this;
deleteVehicle this;
private _helmet = (selectRandom _helmetArray) createVehicle _pos;
_helmet setPosATL _pos;
_helmet setVectorDirAndUp [_Dir,_Up];
};

I still have this weird behavior where on solo and Hosted it works but not on dedicated.

hallow mortar
#

Are the helmet classes you're using the classnames for the equippable inventory items, or for static props/placeable containers?
If it's for the actual inventory item then you can't createVehicle it because helmets are weapons (non-unique proxy things, essentially stored as strings) not real objects.

#

You could create a groundWeaponHolder_Scripted and store a helmet inside it (for an item you can pick up) or use createSimpleObject with the helmet's p3d path instead (for a non-interactive model)

#

You can simplify your helmet array selection code btw, you don't need all those () or to predefine the variable. This is all you need:

private _helmetArray = [["ar_p1_headgear_v1","ar_p1_headgear_v2"],["ar_p2_headgear_v1","ar_p2_headgear_v2"]] select (getMissionConfigValue ["AR_isPhase1",1]);```
#

(Actually you probably don't even need that last set of () )

charred monolith
hallow mortar
#

Does it actually work or does it just not show the error?

charred monolith
#

yeah work perfectly in solo and hosted, I even check the RPT for any error, there is none.

hallow mortar
#

That is interesting

#

But we should still determine whether these helmet classes are actually valid for createVehicle, because it absolutely could cause odd behaviour if they're not

#

head to the Config Viewer from the Tools menu and see if those classnames appear in CfgVehicles. I suggest using Leopard20's Advanced Developer Tools to get the better config viewer, if you don't already.

charred monolith
#

yep they are registered inside CfgVehicles

#

configFile >> "CfgVehicles" >> "ar_p2_headgear_v1"

hallow mortar
#

btw, I think your helmet arrays are backwards. It won't cause an error, but logically, in the current configuration you'll get Phase 1 helmets if isPhase1 is set to 0 (false, i.e. not Phase 1).

#

that's probably my fault for writing it that way in the example

charred monolith
#

yeah its backward anyway it's phase 1 or phase 2, so I put 0 for Phase 1 and 1 for Phase 2

hallow mortar
#

You might want to adjust the config value name to reflect that then, because currently it implies the opposite

#

Anyway, about this error, I don't know. I don't see anything in this code that's DS-specific, and if that really is a valid vehicle class then it shouldn't cause any problems.

charred monolith
buoyant hound
#

Anyone can guide about changing between phases in mission (intro,mission,outro)?

ornate whale
lime rapids
#

is there a command to test performance impact when running code in ms?

little raptor
#

The debug console has a speedometer icon that measures code performance

lime rapids
#

ah ok

little raptor
#

But don't use it with a code that spawns/execVMs stuff

little raptor
#

Yes

finite bone
#

Is the entire wiki archived under web.archive or is there a backup mirror/local git version of the commands 😄 ?

lime rapids
finite bone
#

I know, just asking if someone at some point decided to archive the commands and here we are now solely relying on it 😄

lime rapids
#

ngl a downloadable version of the entire biki would be useful as hell for times like this or slow internet regardless of how much space it would fill up

#

or a paperback legallydistinctkekw

finite bone
#

Just put it in a git repo - clearly git never has had a problem kmao

hallow mortar
#

The current one is a little old but BI does maintain a downloadable version of the wiki

lime rapids
charred monolith
graceful kelp
#

anyone know why the "selectWeapon" works for me on virtual map but not altis

#

its the only variabel i can find in if it works or not

granite sky
#

There is another variable :P

graceful kelp
granite sky
#

selectWeapon works fine on Altis.

graceful kelp
#

im just saying in my mod, that uses it, it only works on virtual map

formal stirrup
#

anyone got the 3 ammo eventhandlers on hand, cant look on the wiki for obv reasons

granite sky
#

I'm not sure those were even in the wiki.

#

config stuff was kinda thin.

formal stirrup
#

they were listed at the bottom of the EH page

formal stirrup
#

Incredible

#

huge thanks

granite sky
#

Search doesn't work but there's a link to the EH page from the intro to scripting.

snow sonnet
#
_vehicleClass = "B_MRAP_01_hmg_F";
_position = player getRelPos [30, 0];
_group = createGroup [west, true];

_vehicle1 = createVehicle [_vehicleClass, [0,0,0], [], 0, "CAN_COLLIDE"];
_group createVehicleCrew _vehicle1;
_group addVehicle _vehicle1;

_vehicle1 setPos _position;

_vehicle2 = createVehicle [_vehicleClass, [0,0,0], [], 0, "CAN_COLLIDE"];
_group createVehicleCrew _vehicle2;
_group addVehicle _vehicle2;

_formationPos = formationPosition effectiveCommander _vehicle2;
_vehicle2 setPos _formationPos;

When this script is executed, _vehicle2 will move on top of _vehicle1.
When _vehicleClass is changed to “B_MBT_01_cannon_F”, _vehicle2 moves to the same location as the formation position.

I think it's a issue that the result changes between an wheeled vehicle and a tank, Is there any way to move _vehicle2 to the formation position?

frank plinth
south swan
#

init fields don't support comments blobdoggoshruggoogly

south swan
#

o=[this,1000] execVM "Amb_battle.sqf";

frank plinth
south swan
#

this -> is the part that doesn't compute blobdoggoshruggoogly

granite sky
#

yeah not sure where you got that from. It doesn't look like any part of SQF.

frank plinth
south swan
#

yes, just don't paste non-sqf stuff there blobdoggoshruggoogly

#

just 0=[this,1000] execVM "Amb_battle.sqf";

granite sky
#

Well, it might not be in the right field but it's a code field :P

split ruin
#

only this [this,1000] execVM "Amb_battle.sqf"

frank plinth
frank plinth
split ruin
#

this is the correct syntax but what u have in "Amb_battle.sqf" idk

south swan
#

0= part is unnecessary but syntactycally sound and doesn't break anything blobdoggoshruggoogly

frank plinth
#

I'll test it now

steep verge
#

Gentleman I am having a pretty hard time to fix an issue. I've got two scripts - the first one fires the second one which monitors spawned squads for particular parameters. It should run every 60 seconds with sleep, but i get the "suspended not allowed in this context" error. I've tried it also with waitUntil, but sadly with no luck.

#
            if (_debugEnabled) then {
                systemChat "[DEBUG] Squad has surrendered.";
            };
            break; // Stop monitoring after surrender
        };
        _surrenderChance = _surrenderChance + 5;
    } else {
        if (_debugEnabled) then {
            systemChat "[DEBUG] Squad is above threshold. No surrender check.";
        };
    };
    
    if (_currentSquadSize == 0) exitWith {
        systemChat "[DEBUG] Squad monitoring terminated: no survivors.";
        false
    };
    
    sleep 60; // Replace waitUntil with sleep to avoid suspended error
};
#

Here is a little code snippet if someone would mind care to take a look.

#

Any advice is greatly appreciated

hallow mortar
#

Both waitUntil and sleep use suspension so swapping them will make no difference

#

the issue is that you're in an Unscheduled context (code executed now this frame, everything else waits for it) and suspending is not allowed because it would freeze the game

#

You need to use spawn to create a Scheduled thread

steep verge
#

Thank you very much for the response!

#

I am gonna try it 🙂

granite sky
#

I wonder if it worked in any older version of A3.

charred monolith
#

I have a quick question, it seems that limitSpeed doesn't work. I propably don't know how to use it but it doesn't seems that complex.
I have a vanilla quad and I put this inside :

this limitSpeed 25;

But my quad goes past that speed.

south swan
#

ffur2007slx2_5
(A3 1.24)To clarify, limitSpeed only do effect on non-player controlled AI units, it has continuous effect and AI won’t break through the speed limitation until one is contacted, engaged or regrouped.

granite sky
#

It does work very well on AI vehicles, IME. I use it for convoy spacing.

charred monolith
granite sky
#

No non-janky way, maybe.

#

Local setVelocity monitor would probably work well enough.

charred monolith
proven charm
#

group speed "LIMITED" / "FULL" not working?

granite sky
#

Player waypoints are purely advisory, aren't they?

#

setCruiseControl is at least supposed to work.

proven charm
#

ya probably doesnt work with player but AI waypoints, atleast i thought they did 🙂

granite sky
#

yeah but the meaning of LIMITED is sometimes not very useful.

#

If you have a single vehicle and you want it not to bomb around at full speed, then sure.

sharp torrent
#

Can someone remind me, which namespace is for a server [mission duration only, that will not send players data, but store variables for scripts on server + only an admin / mission script would be able to overwrite them, via setVariable]?
Because website is down, when I am available [these ddos kids... We NEED a mod to ban them automatically when they try to join any server, no matter which game. Also a police to arrest them... :D].

granite sky
#

localNamespace probably fine too.

#

Note that missionNamespace doesn't broadcast automatically either. Difference is that you can broadcast to it from clients.

south swan
#

i mean, if something/somebody can push a variable onto a server it's probably capable of pushing a code to run on the server as well blobdoggoshruggoogly

granite sky
#

Well, there is CfgRemoteExec.

#

but yeah, not much point locking down one without the other.

sharp torrent
frank plinth
#

@south swan @split ruin

split ruin
#

@frank plinth I just pointed the right syntax, I have no idea what is in the sqf you run bro or if you fill the right type parameters in the array

frank plinth
steep verge
#

What am i doing wrong with the syntax here gentleman, as it keeps saying that i am missing a semicolon here? [] spawn { private _squadUnits = _this select 0; [_squadUnits] call Nat_SimpleSurrender_fnc_squadSurrenderLogic; } spawn { private _squadUnits = _x; [_squadUnits] call Nat_SimpleSurrender_fnc_squadSurrenderLogic; }; }; } forEach _currentSquads;

fleet sand
steep verge
#

Thank you good sir.

granite sky
#

If you needed the spawn for some reason then:

{
  _x spawn {
    [_this] call Nat_SimpleSurrender_fnc_squadSurrenderLogic;
  };
} forEach _currentSquads;
#

If you don't need the spawn then don't :P

steep verge
#

well i understood it in that way that i need to spawn this function to use properly "sleep"

#

as else i get the suspended not allowed error

fleet sand
granite sky
#

Yeah, fair enough.

steep verge
#

but i am pretty bad in programming, sqf particular, so sorry in advance

#

still learning the ropes

granite sky
#

It depends where you're running the code from.

steep verge
#

So i have two scripts and a simple eden module.

#

The one scripts monitors all opfor squads currently spawned in game, and updates every 5 mins

#

Then passes those squads to another script, which monitors every squad on particular parameters as squad size, leader courage etc.

granite sky
#

How are you executing the first script?

#

Because that one should really be running as scheduled code.

steep verge
#
    private _opforSquads = [];
    {
        private _grp = group _x;
        if (side _grp == east && {!(_grp in _opforSquads)}) then {
            _opforSquads pushBack _grp;
        };
    } forEach allUnits;
    _opforSquads
};

if (isNil "monitoredSquads") then { monitoredSquads = []; };

while {true} do {
    private _currentSquads = [] call _getOpforSquads;
    systemChat format ["[DEBUG] Found %1 OPFOR squads.", count _currentSquads];
    
    {
        if (!(_x in monitoredSquads)) then {
            private _squadUnits = units _x;
            systemChat format ["[DEBUG] Monitoring new squad: %1", _squadUnits];
            monitoredSquads pushBack _x;
            
            [] spawn {
                private _squad = _this select 0;
                systemChat format ["[DEBUG] Starting surrender logic for squad: %1", _squad];
                [_squad] call Nat_SimpleSurrender_fnc_squadSurrenderLogic;
            } _squadUnits;
        };
    } forEach _currentSquads;
    
    waitUntil {sleep 300; false};
};
#

This is my whole first script. It's currently bugged. And yes i know its a mess.

#

This is the one that should monitor all east opfor squads and pass it to the second script, which monitors the parameters.

granite sky
#

Yes, but how are you executing that script?

steep verge
#

It's executed at mission start from a .pbo

#

If this is the correct answer

#

xD

south swan
#

handwaving emoji

#

init.sqf? Init field of some object on map? Init field of the entire mission? Some event handler?

#

trigger?

#

CfgFunctions entry with onInit or whatever the correct flag is?

steep verge
#

oh yeah cfgFunctions in the config.cpp of the module

#

So it executes it when the module is placed

#
    class Nat_SimpleSurrender {
        class Functions {
            file = "NatSimpleSurrender\functions";
            class monitorOpforSquads {};
            class squadSurrenderLogic {};
        };
    };
};
#

Or i am still wrong here?

granite sky
#

There's no preInit or postInit in there.

#

So I guess it's a module hook. I don't know shit about modules so I'm outta here :P

steep verge
#

I mean the script is executed 100% upon module placement. When the module is not present the script won't run.

#

The problem with the first script is i am getting an error that a semicolon is missing at line 25, so it's some kind of syntax error i guess. But i cant figure what.

edgy dune
#

for Extended_FiredBIS_Eventhandlers I sometimes see stuff like onRespawn="true"; is there a list of what else besides onRespawn can exist?

south swan
#
[] spawn {
            ...
} _squadUnits;```is not a thing
granite sky
#

Yeah it's a lot easier for everyone if you just paste the script you're actually using rather than trying to abstract it :P

#

The spawn there is wrong too. Not passing anything in.

south swan
#

i mean, you can't paste it if it's abstracted into 5 different places already 🤣

steep verge
south swan
#

triggers upon module placement
how?

steep verge
#

via cfgPatches if i understand correctly, which is placed in this config.cpp

hallow mortar
#

The problem is what artemoz said. #arma3_scripting message
The spawn that would call squadSurrenderLogic has a problem with its structure as described, so it's causing an error and bailing out instead of executing fully.
plus the issue John mentioned where it doesn't have any arguments passed into it, so all those variables used in it are undefined

granite sky
#

Not really sure what it should be because I don't know what _squadUnits is for there.

#

It sounds like the function should just be called once per squad?

south swan
#

i mean, by cursory glance at BIS_fnc_moduleInit module functions are supposed to handle a bunch of modes, most of which do get its function call-ed from within the EH code or something blobdoggoshruggoogly Reference some of the vanilla modules, like BIS_fnc_moduleGrenade or BIS_fnc_moduleTracers probably

#

also hey, nice typo 🤣 in moduleInit sqf //--- Set default variables _logic setvariable ["bis_fnc_initModules_priroty",abs _functionPriority];

granite sky
#

Is that one of those typos where it's spelt the same way everywhere

south swan
#

although it seems to be called by the same "bis_fnc_initModules_priroty" name elsewhere (i.e. in initModules)

winter briar
#

How many days has the wiki been down ?

granite sky
#

Only a couple.

#

Apparently BI finally shored up the Reforger backend servers, so now the DoSers are hitting all the other services.

south swan
#

less than one full day continuously, i suppose? And what feels like a week or two of periodically blobdoggoshruggoogly

granite sky
#

Well, it was never exactly a 99.9% uptime service :P

grizzled cliff
#

also might get to teach a couple of classes

#

lol

grizzled lagoon
#

Hi, I have a question about optimizing the network on my server. Do remoteExec calls from one player to another first go through the server or is the request sent directly between players ?

granite sky
#

Through the server.

#

Nothing is p2p in A3.

grizzled lagoon
#

Okay, i have little problem :/
Server can't keep up, too many incoming network messages. Remaining in queue: 150147

#

Do you have any optimization tips ?

granite sky
#

Don't send a bucketload of shit from the client? :P

grizzled lagoon
#

Okay, I'll stop asking the player every 1ms if they're okay, especially when there are 100 players on the server blobcloseenjoy

granite sky
#

What does "okay" mean in context?

#

Often with published variables you want to only publish changes, so constructs like this are legitimate:
if (player getVariable "myVar" != _newVal) then { player setVariable ["myVar", _newVal, true] };

#

If it wasn't a published variable then you'd just set the thing regardless.

grizzled lagoon
#

That was a joke. I was asking because I'm trying to help a friend optimize his server, as he runs into this problem when he reaches around 100 players.

I know that excessive use of publicVariable and remoteExec is probably the cause, but he also has a heavy modpack and even a small loop could be the reason for this issue :/

granite sky
#

Yeah, it's difficult to tell in that case. Could be any mod doing one dumb thing.

grizzled lagoon
#

Yes :/

granite sky
#

Some mods are known-garbage, so you could try pasting the list into #server_admins and see what people think.

grizzled lagoon
#

Ok, thanks i look that

granite sky
#

diag_activeSQFscripts is probably the only useful thing you can do with script, but depending on how code is executing it may not show up.

#

Spawn, yes. eachFrame EH, nope. CBA stuff, nope.

grizzled lagoon
#

Yes, I also checked with ScriptProfiler but I'm looking for which function is making numerous network requests, not just RAM & CPU performance :/

cedar kindle
#

there's no bis_fnc_projectile @tranquil nymph ?

granite sky
#

ArmaScriptProfiler does actually record network activity to some degree, when it's working.

#

Like we could tell that ACRE was sending 16MB of data to each new client :P

grizzled lagoon
#

Oh, I didn't know that, In which tab can I see the network usage ?

granite sky
#

Dunno, it's been a while. The trace file I have doesn't even open in the current version.

#

Ah, you might need -profilerEnableNetwork in the command line.

grizzled lagoon
#

Ok thanks I'll check it out

rocky cairn
#

I'm trying to run this code in a script "marker setmarkerpos getpos runner;" marker and runner are both set in the editor however it says that marker is an undefined variable

cedar kindle
#

try "marker" setMarkerPos (getPos runner)

#

markers must be in quotes (unless it's a string variable)

rocky cairn
#

Worked perfectly, thank you so much.

pallid palm
#

this is my RPT file after you guys helped me get all my stuff correct

gentle zenith
#

Strange issue here, players on my server are able to retexture their clothing to predefined textures, however, a small number of players don't ever see themselves in the new texture.

Other players can see them retextured, I've used the same script for 10 years but this problem has only recently appeared.

I texture with the following basic code (added the 4 local lines recently attempting to fix, but doesn't)

            player setObjectTextureGlobal [1,_texture];
            player setObjectTextureGlobal [2,_texture];
            player setObjectTextureGlobal [3,_texture];
            (backpackContainer player) setObjectTextureGlobal [0,_texture];

            _texture spawn {

                sleep 0.5;
                player setObjectTexture [0, _this];
                player setObjectTexture [1, _this];
                player setObjectTexture [2, _this];
                player setObjectTexture [3, _this];
            };```
#

Worth mentioning, their backpack retextures just fine to the new texture and this issue occurs in all uniforms

granite sky
#

Reminds me of an issue we had with some GM vehicles. It's probably a Arma bug but we never had a reliable replication.

dusk gust
#

I have noticed in rare occasions, if you setObjectTexture outside of the range of textures it supports, it can cause a similar issue. Might not be what you're looking for, however worth trying

Ex.

getObjectTextures player; // ["",""]

player setObjectTexture [0,_texture];
player setObjectTexture [1,_texture];
player setObjectTexture [2,_texture];// This can rarely reset the 0 index texture for some reason?
granite sky
#

Oh, that's fun.

#

Like a low-level indexing wraparound.

dusk gust
#

Seemed like it at the time, yeah

#

Though I am on profiling, it might differ on stable.

granite sky
#

The GM vehicle case I saw was setting a lot of textures on the vehicle. Maybe it was off by a couple.

#

@gentle zenith Try checking count getObjectTextures player first and ensuring you don't go past the total.

#

I'm getting 1-3 for various uniforms.

dusk gust
gentle zenith
frank plinth
warm hedge
#

How about to just say what is not really working, or error, or how do you call it

#

Instead of posting this everywhere

granite sky
#

I ran the script directly and it worked. I'm not sure what the instructions mean because a trigger doesn't have an init box.

buoyant hound
warm hedge
#

How about to tell us more info more than a sorry

frank plinth
frank plinth
buoyant hound
halcyon creek
#

So this should work as far as I can see, but for whatever reason my screen fades out but not back in, any ideas?

if (isServer) then { 
 
[0,"BLACK",5,0] call BIS_fnc_fadeEffect; 
obj1 setTaskState "Succeeded";

["TaskSucceeded", ["Preparation", "Move to Checkpoint Delta"]] call BIS_fnc_showNotification;

obj2 setTaskState "Assigned";
["TaskAssigned", ["Checkpoint Delta", "Man the Checkpoint"]] call BIS_fnc_showNotification;

checkpointtriggeractivated = true;

[parseText "<t font='PuristaBold' size='1.6'>1 hour later...</t>", true, nil, 7, 0.7, 0] spawn BIS_fnc_textTiles;

[1,"BLACK",5,0] call BIS_fnc_fadeEffect;

};

Im also trying to get a show/hide module to work with the checkpointtriggeractivated = true; but that doesnt seem to fire, its set to false in the Init, the module works when not associated to the variable but wont with the trigger

vocal chasm
#

so i got this code from gunther

this addMPEventHandler ["MPHit", {    params ["_unit", "_causedBy", "_damage", "_instigator"]; 
    if !(_instigator in allplayers) exitWith {false}; 
    private _hitCount = (_unit getVariable ["you_hitCount", 0])+1; 
    _unit setVariable ["you_hitCount", _hitCount]; 
    if (_hitCount >1) then { 
        _unit removeMPEventHandler ["MPHit", _thisEventHandler];  
        _unit spawn { 
            private _emitter = "#particlesource" createVehicle position _this; 
            _emitter setParticleClass "MediumDestructionFire"; 
            sleep ((round random 3) +3); 
            "HelicopterExploSmall" createVehicle position _this; 
            { 
            deleteVehicle _x; 
            } forEach [_emitter, _this]; 
        } 
    } 
}];

and wanted to use it within zeus. Having converted simpler scripts, I thought it would be as easy as this:

_this [addMPEventHandler ["MPHit", {    params ["_unit", "_causedBy", "_damage", "_instigator"]; 
    if !(_instigator in allplayers) exitWith {false}; 
    private _hitCount = (_unit getVariable ["you_hitCount", 0])+1; 
    _unit setVariable ["you_hitCount", _hitCount]; 
    if (_hitCount >1) then { 
        _unit removeMPEventHandler ["MPHit", _thisEventHandler];  
        _unit spawn { 
            private _emitter = "#particlesource" createVehicle position _this; 
            _emitter setParticleClass "MediumDestructionFire"; 
            sleep ((round random 3) +3); 
            "HelicopterExploSmall" createVehicle position _this; 
            { 
            deleteVehicle _x; 
            } forEach [_emitter, _this]; 
        } 
    } 
}]];

yet it doesnt work, anybody know why and how it would work?

granite sky
formal stirrup
#

Im super confused, BIS_fnc_returnConfigEntry returns the correct value when the attribute exists, but if default value is used it returns an "array" yet I cant assign said array to anything because it says it doesnt exist?

#

if I directly systemchat the function it shows the array

#

but I cant select values of it or assign it to a variable???

granite sky
#

Show how you're calling it.

formal stirrup
#

private _vehBase = [configFile >> "CfgVehicles" >> (typeOf _veh) >> "liftVehicleBase",""] call BIS_fnc_returnConfigEntry;

#

systemchat str [configFile >> "CfgVehicles" >> (typeOf _veh) >> "liftVehicleBase",""] call BIS_fnc_returnConfigEntry; this works though

granite sky
#

Uh, returnConfigEntry takes three parameters?

formal stirrup
#

...

#

god damnit

#

thank you

paper condor
#

can anyone tell me how do i sit on chairs?

#

the scripting is confusing me a bit

next kraken
#

how would i remoteExec a script please ?

winter rose
#

(more details…?)

next kraken
#

erm....what do you need to know? i have a script: timer.sqf and if i execute it in the debug console it works, but only there. what does execute global exactly do?

#

only execute global makes it work. id need to execute it globally to have it working correctly

winter rose
#

do you execute it multiple times or should it be one time?

next kraken
#

only one time, but in dedicated server environment

winter rose
#
[["my", "arguments"], "timer.sqf"] remoteExec ["execVM"];
```should do 😉
next kraken
#

what is my for ^^ ?!

fleet sand
#

if your timer.sqf takes any arguments it would be like that if not you dont need them.

next kraken
#

ok thx !

fleet sand
# next kraken ok thx !

Here is a simple example:

//timer.sqf
params ["_arg1","_arg2"];

systemChat format ["%1, %2", _arg1,_arg2];


//somewhere else.
["This is my arg 1","This is arg 2"] execVM "timer.sqf";

if you want to remoteExec to each client it would be like this:
Good check to have

[["This is my arg 1", "This is arg 2"], "timer.sqf"] remoteExec ["execVM",[0,-2] select isDedicated];

Also i would recommend you to look at few of these links to help you understand locality.
https://community.bistudio.com/wiki/Arma_3:_Remote_Execution
https://community.bistudio.com/wiki/remoteExec
https://community.bistudio.com/wiki/Multiplayer_Scripting
https://www.youtube.com/watch?v=-hz0SoS95VY&t=477s

tulip ridge
tulip ridge
formal stirrup
tulip ridge
#

Why
It's easier to just do it as you're writing

formal stirrup
#

¯_(ツ)_/¯

paper condor
tulip ridge
#

Yeah
Has been a thing for years

frank plinth
granite sky
#

Not if you paste it into the debug console, no...

#

But for practical use, that would be a reasonable approach.

#

The object you pass in is only used as a position.

frank plinth
granite sky
#

If you don't execute it then it won't do anything.

frank plinth
paper condor
tulip ridge
#

Yeah

buoyant hound
#

Hey , any guid about new hint methods?
Like when you complate task hint pushed left from right side and after show message pushed back to right

warm hedge
#

What "new hint"?

buoyant hound
#

Like animated hint

#

Or flash

warm hedge
#

What I mean is we're not aware of such new feature. Images or videos might help to recognize

hallow mortar
quaint ivy
#

Hey guys, I'm having a problem with unit/group sides that someone might be able to help me with. I've made a script to spawn ambient patrols and vehicles which works well. A friend wants to use it to spawn bluefor and opfor units in the same squad in a survival scenario, however the units end up shooting each other even though they are in the same group. How can I work around this issue?

meager granite
#
_unit = _group createUnit ...;
[_unit] joinSilent _group;
gleaming onyx
#

Can someone show me a working Description.ext or a Init.sqf that has the prompts for a working spawn and mission?
With working spawn I mean, there is no "respawn disabled".
Thanks in advance, your are great

proven charm
still forum
#

@grizzled cliff so you finally experienced how my informatics lessons were for the last 4 years ^^

royal quartz
#

hey guys, just a quick question, im wondering if its possible to remove existing markers on the map for say houses. (I dont think so but worth an ask).

granite sky
#

Oh, that's the names though, not houses.

royal quartz
#

dam yeah. A friend was looking to delete a town with hide map objects and remove it from the map too.

ornate whale
# buoyant hound Mp

One way could be to simply start the mission and play some intro scene (either playable or not), then black out the screen, silence the music, and move players to another position, then do your briefing with voice lines or plain text on the screen, or even show something on the map. You can use commands like: say, playSound, cutText, forceMap. But all these things are not particularly easy, since you have to synchronize everything and deal with late joining players.

Generally, you need to learn how to do cutscenes (work with camera and animations), work with map and markers, play sounds and show texts, teleport players around or switch playable units and synchronize everything, so that it does not break in a network game. But it depends on what you want to achieve.

For inspiration:
https://youtu.be/5mgM4Qxkh_w?si=ov4ZLJALX9fsA-dR
https://community.bistudio.com/wiki/Category:Function_Group:_Map_and_Markers
https://community.bistudio.com/wiki/Category:Command_Group:_Map
https://community.bistudio.com/wiki/Category:Function_Group:_Briefing

warm hedge
#

createVehicle a smokegrenade ammo

tulip ridge
#

No, you carry the magazine in your inventory, which creates the ammo class

#

For vanilla classes, the classes are usually the same iirc

#

They're different classes

warm hedge
#

What you carry in your inventory is a part of CfgMagazines. What you throw is CfgAmmo, which you can use createVehicle to do anything

#

Of course not. Follow the syntax

#

type there is a string

gleaming onyx
sand summit
#

is there a reason a hint or systemChat in a switch case wouldn't show up in a singleplayer session? trying to test with error messages isn't working properly the one time i try it pensive_cry

#

i am dumb and it is case sensitive, nevermind

warm hedge
#

What is case sensitive?

sand summit
#

rather, strings used as cases for a switch

warm hedge
#

Ah so switch case

#

Indeed that are sensitive

sand summit
#

i'm trying to reply in agreement but my messages are getting automodded

warm hedge
#

I know what you're trying to say 🤣

sand summit
#

im crying

warm hedge
#

fing- word was censored

sand summit
#

WHY

#

brb wife needs help

queen cargo
#

mhh ... maybe i should visit the university from time to time then ... however, that entire talk should be held at #offtopic_arma

#

@tranquil nymph sadly that function is not existing ...
or do i have to place down the zeus module for that (which would then come to the question what magic that is)

buoyant hound
#

Do i can use keyframe animation to make a suicide attack?
Will triggers work as normally?
Like this and obj name in this list then set dammage vehicle?
I need it to capture intro

#

A car move and hit gate then explode

proven charm
sand summit
#

could someone sanity check me? this is coming back as undefined no matter how i try it, and i've done every method i can think of.

_Sound = createSoundSource [(player getVariable colSoundPack), position player, [], 0];
#

it's intended to allow the player to do an action that sets the variable colSoundPack in the player's namespace, then feed that variable into the createSoundSource.

hallow mortar
#

getVariable takes "string" for the variable name

sand summit
#

so i need it in quotes?

#

i swear, i need to stop spending more than 4 hours looking at code processors

#

that fixed it uwu

pallid palm
#

lol

warm fern
#

Hi guys!

I am editing KP_Lib to suite my own preferences and I'm having issue getting the systemChat player death messages to globally execute on all machines. It works just fine when I run it in client-side-multiplayer. However, when i ran it on the dedicated server, it near always failed to send any messages except twice. I will have to post the code in a screenshot, as I don't have Nitro and the code block is too long, my apologies.

#

Are you implying I need to just put [_msg] remoteExec ["systemChat"]; instead of [_msg] remoteExec ["systemChat", 0, true];?

pallid palm
#
" Pilot  Huey  Moving To  Extraction  ExLZ " remoteExec ["systemChat"];
#

oh you want the server to exec it

pallid palm
#

yes EH would be better

warm fern
#

I do want to get into event handlers, but am a bit ignorant with them.