#arma3_scripting

1 messages Β· Page 87 of 1

exotic flax
#

although damage will already give you the total damage from 0 (healthy) to 1 (dead), without the use of an EH

fleet sand
# exotic flax although `damage` will already give you the total damage from 0 (healthy) to 1 (...

Now the problem is that Unit dies but LEG_doctorHealth variable still shows like 30 or 40

_doctor addEventHandler ["HandleDamage", {
    params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit"];
    _unit setVariable ["LEG_doctorHealth",((1 - damage _unit) * 100)];
    private _currentDmg = if (_hitIndex < 0) then {damage _unit} else {_unit getHitIndex _hitIndex};
    private _takenDmg = _damage - _currentDmg;
    _currentDmg + _takenDmg / 5;
    hintSilent format ["Current DMG: %1 \n Taken DMG: %2 \n Var DMG: %3",_currentDmg,_takenDmg,_unit getVariable "LEG_doctorHealth"];
}];
hallow mortar
#

so it will be whatever their health was before they got hit

winter rose
#

properly

#

what's your end goal: just displaying a life bar or still having this "4 hits dead" unit?

fleet sand
#

Well I would like to display a health bar but also i would like a variable like a number that if the number is higher the unit can take more dmg.

winter rose
#

I didn't understand that last part

fleet sand
#

Yea so variable to control how much dmg can unit take before it dies.

#

Example something like this:

LEG_HardnessToKill = 10;

this addEventHandler ["",{
    params ["_unit", "", "_damage", "", "", "", "", "", ""];
    _damage = _damage / LEG_HardnessToKill;
}];
winter rose
#

so you want a damage ratio modifier, ok

#

there is no "health bar" in Arma - you can die with 0.5 total damage for example
you can trick it with "if not alive then health = 0" but that doesn't make the life bar linear like any other game.

#

untested

this setVariable ["LEG_DamageRatio", 0.5]; // half the damage

this addEventHandler ["HandleDamage", {
    params ["_unit", "_selection", "_damage"];
    if (isNil { _unit getVariable "LEG_Damages" }) then { _unit setVariable ["LEG_Damages", createHashMap]; };
    private _damageHashMap = _unit getVariable "LEG_Damages";
    private _selectionDamage = _damageHashMap getOrDefault [_selection, 0, true];
    private _ratio = _unit getVariable ["LEG_DamageRatio", 1];
    if (_ratio != 1 && _selectionDamage < _damage) then
    {
        private _damageDiff = _damage - _selectionDamage;
        _damageDiff = _damageDiff * _ratio;
        _damage = _selectionDamage + _damageDiff;
    };
    _damageHashMap set [_selection, _damage];
    _damage;
}];
fleet sand
winter rose
#

fixed

fleet sand
# winter rose fixed

I don't know how to thank you enough. You gave me a grate idea. I made a bit more linear way for health bar to go down and also a way to Control Damage ratio modifier. Instead of getting dmg directly from a unit i can count a number of times unit got hit and base of that i can have linear and consistant way of control.
Code:

LEG_DoctorHitPoints = 100;

_doctor addMPEventHandler  ["MPHit",{
    params ["_unit", "_source", "_damage", "_instigator"];
    private _hits = _unit getVariable ["LEG_targetHit",0];
    _hits = _hits + 1;
    _unit setVariable ["LEG_targetHit",_hits];
    private _dmg = (_hits / LEG_DoctorHitPoints) * 100;
    private _health = 100 - _dmg;
    _unit setVariable ["LEG_health",_health];
    hintSilent format ["Total HitPoints: %1 \n Num Hits: %2 \n How mutch Damage: %3 \n Current Health: %4 %",LEG_DoctorHitPoints,_hits,_dmg,_health];
}];

_doctor addEventHandler ["HandleDamage",{
params ["_unit"];
if((_unit getVariable "LEG_health") isEqualTo 0) then {1}else {0};
}];```
viral spire
#

Hello scripters!

I come with a question!

Is it possible to call a faction from a mod at the server, or mission file, level that duplicates the faction to appear on a different side inside the zeus console without using custom units in something like ZEN?

Looking to make a blufor faction also spawnable as opfor without having to jump through hoops to spawn items for zeuses that may not be as technically skilled.

Is this a question better asked to config makers instead?

viral spire
tough abyss
#

do anyone have a script that makes ai fire and maneuvor or peel or flank whatever you wanna call it

supple cove
#

Is there an example somewhere on how to use the Arma 3 apex campaign lobby?

tough abyss
#

new to scripting every time i paste something into the init of units i get the init: error thingy can anyone help? if so ping me

winter rose
#

you will need to bring the error in

mortal roost
#

Hey there

Im attempting to patch a mod to allow a weapon to be put into the launcher slot instead of the rifle slot

I think I have made the CPP file correctly but I dont seem to be able to binarise it

Can anyone help?

#

Just to clarify Im trying to make the patch an independent mod

granite sky
#

Your class inheritance looks fucked up to the extent that I'm not sure what you're trying to do.

#

The intention is just to modify rhs_weap_m32_Base_F?

mortal roost
#

Classic

Thats what I get for copying some code and adapting it

Im trying to change the weapon type from 1 to 4

#

and yeah thats what Im trying to modify

winter rose
mortal roost
#

Sweet my bad I shall move this there

Thanks

little raptor
tough abyss
#

that is true and im a f*cking Ret@rd

#

thankyou good sir for pointing out what would be obvious to anyone who get enough sleep πŸ˜†

tough abyss
#

so the code im trying to excecute is this:
_squadLeader = leader group player;
_flankWaypoint1 = [getPos player, 100, 0] call BIS_fnc_findSafePos;
_flankWaypoint2 = [getPos player, 200, 0] call BIS_fnc_findSafePos;
_flankingBehavior = {
params ["_unit"];
_smokePosition = getPosATL _unit;
_smokePosition set [2, 5]; // Adjust the height of smoke grenades if needed
_unit addMagazine "SmokeShell";
_unit addMagazine "SmokeShell";
_unit throw [_smokePosition, "SmokeShell", 2];
_unit groupChat "Moving to flank!";
_unit setCurrentWaypoint [_flankWaypoint1, 0];
sleep 5;
_unit setCurrentWaypoint [_flankWaypoint2, 0];
};
_trigger = createTrigger ["EmptyDetector", [0, 0, 0], false];
_trigger setTriggerArea [200, 200, 0, false];
_trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true];
_trigger setTriggerStatements ["this", "call _flankingBehavior", ""];
_squadLeader addRadioItem ["Flank on Contact", {
_trigger execVM "flankScript.sqf";
hint "Flanking script executed!";
}];

from chat gbt it is props broken but i should atleast get the: hint "Flanking script executed!"; if its activated corretly so i could rule out wrongfull activation

#

so according to chat gbt im suppost to post this message: execVM "flankScript.sqf" in the ordinarry chat cinda like if you login as admin

#

but nothing happend

#

now i get an error where it says there was an error at line 21

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
hallow mortar
#

!quote 6

lyric schoonerBOT
tough abyss
#

fair

winter rose
#

and this, too

#

(thx NikkoJT)

tough abyss
#

yeah as i stated way earlier im like just started to even explore the possebilites of scripting so i essentially have no idea what im doing

granite sky
#

lol:

_unit throw [_smokePosition, "SmokeShell", 2];

hallow mortar
#

Unfortunately neither does ChatGPT.
The code it's generated here is structurally deeply flawed, contains commands that don't exist, and does many things that don't make any sense. It's not really a useful starting point - it needs to be completely redone.

I don't know exactly what you're trying to do here, but you could begin by going to the wiki and looking up every command ChatGPT tried to use here and seeing how they actually work (the ones that exist anyway). That might give you some initial clues.

tough abyss
#

i wanna see a squad taking contact 1 part of the squad is laying still in their start positions and another part is running like 100 meters to either side

#

essentially very basic peeling if you are familiar with that term

hallow mortar
#

Controlling individual AI behaviour, especially in combat, is one of the more complex...and annoying...aspects of Arma scripting. It's typically handled, in the rare cases it is handled, by mods made by teams of experienced authors. I would not recommend it for your first script.

granite sky
#

Even the "throw a smoke grenade at a position" part is extremely complex in Arma.

winter rose
tough abyss
#

okay i guess i have not encountered any ai mods that does this despite looking all over for them what i have tried:
vcom
lambs
dco
bcombat
asr ai
tcl also the newer revork whatever its called
immersive ai
cant find anything that remotely does what im looking for

hallow mortar
#

That may be because it's extremely difficult and potentially even impossible to make work reliably

tough abyss
#

goddamit arma

granite sky
#

That one sounds plausible but fiddly.

#

AI mods tend to go for sticking a black box on top of the black box rather than providing features for users.

#

which kinda makes sense given the lack of structure.

#

I think lambs does add a waypoint type or two.

shut carbon
#

sog AI has peeling but it's for your own squad I believe.

tough abyss
granite sky
#

It's a reaction to vanilla AI being... overly defensive but not actually good at using cover.

#

but yeah, you don't get a lot of input. Add AI mod, all behaviour changes to the mod author's preferences.

tough abyss
#

the closest i got was dco but it essentially was max like 20 meter flank witch really dosent matter when you engage from 200-500 meters out on average

granite sky
#

Vanilla AI has its own logic which splits off units to engage contacts, so you'd need to eliminate that first.

tough abyss
#

Using fired eh is there anyway to get the last position of the projectile or should I just get it's position when it's velocity is 0?

tough abyss
warm hedge
#

boo

gilded rampart
#

Mmm, the best rants are the ones where people have a totally incorrect understanding of the relationship between BIS/BISim and Arma/VBS. Never fails to entertain.

daring zinc
#

don't listen to him guise

#

i heard he's a paid shill

#

:P

velvet flicker
#

Is there a non pc crashing way to edit the height of all terrain nodes on the map?

#

I tried chunking it out and using 'spawn' to put the chunks in the scheduler but it still was gory

warm hedge
#

No

somber radish
#

Hey there, anyone have any codesnippets to make an ai man lean?

winter rose
#

no

somber radish
#

I am talking about the upper-body lean that happens when pressing q or e?

winter rose
#

yep - no

somber radish
#

Any way of controlling the upper body?

#

any leads?

#

nada?

winter rose
somber radish
#

oh ok

#

ait

#

thank you Lou!

upper marten
#

Hi can anyone help me with scripting the arma 3 spotter like in arma 2 OA that the spotter will said the distance of the enemy

rich bramble
#

@daring zinc I will never listen to you. You're just pushing your MACRO-ist agenda. ;)
[I love how this channel is 50% really in-depth discussion about SQF and 50% random rants]

warm hedge
#

reveal command?

#

I don't know what like in Arma 2 OA you mean

upper marten
#

yeah in arma 2 OA there is a mission that you are a sniper and you have a spotter and then when you hold right click on enemy the spotter will say the distance so you can adjust your zeroing

#

i think the spotter AI in arma 3 is broken or useless

warm hedge
#

That is not an AI, just a script

winter rose
upper marten
#

yeah the FNC_spotter but i think it is not working on current arma 3 :/

winter rose
#

why?

upper marten
#

i've tried that before and it doesnt work compared on arma 2.

winter rose
#

what have you tried, what code and where?

upper marten
#

[player, unitSpotter] call BIS_fnc_spotter;

#

that code i've binded it on my player init

#

and it doesnt work on arma 3

winter rose
#

cool, did you name a unit unitSpotter?

upper marten
#

i will try it again today

#

irenamed the object name of spotter and ive changed that unitSpotter

warm hedge
#

I don't call it is β€œit doesn't work”, it is a crash. Because it requires spawn, due to while and sleep ez fix

#

But anyways, it is legacy function indeed

winter rose
#

yep, no workies

warm hedge
#

I would say it is better to rewrite for A3, since it has a lot more advanced commands

upper marten
#

yeah i've read that one on the articles on Bohemia forum.

stark fjord
#

Didnt that function just print "Unit name: Range x m"

#

Measured from player. So basically just textified range finder

winter rose
warm hedge
#
private _fnc_spotter = {
    params ["_sniper","_spotter"] ;

    if (group _spotter == group _sniper) then {
        [_spotter] joinSilent grpNull ;    // force degroup
    } ;
    // keep the spotter silent
    _spotter setUnitCombatMode "BLUE" ;
    _spotter setBehaviour "STEALTH";
    (group _sniper) setVariable ["spotter",_spotter] ;
    (group _sniper) setVariable ["sniper",_sniper] ;

    (group _sniper) addEventHandler ["KnowsAboutChanged", {
        params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"] ;
        // if is enemy and you know where he is
        if (_newKnowsAbout == 4 and [side _group,side _targetUnit] call BIS_fnc_sideIsEnemy) then {
            private _spotter = _group getVariable ["spotter",objNull] ;
            private _sniper = _group getVariable ["sniper",objNull] ;
            private _targetName = getText (configOf _targetUnit >> "displayName") ;

            // report
            _spotter globalChat format [
                "%1 - bearing %2 - distance %3 m",
                _targetName,
                round (_sniper getRelDir _targetUnit),
                (round ((_sniper distance _targetUnit)/10)*10)    // 10 m precision
            ] ;
        } ;
    }];
} ;

// execution
[player,unitSpotter] call _fnc_spotter ;```Quick mockup. Lovely to execute this in unscheduled
stark fjord
little raptor
#

You can spot enemies yourself meowsweats

stark fjord
#

Realism πŸ˜‰

#

He wants the script like it was in a2

little raptor
#

I know but did that also just use the knowsAbout?

stark fjord
#

I dont remember exactly. Its been years. But i think you could range anything. So basically distance from eye position to cursor

#

(I could be wrong)

winter rose
stark fjord
#

"Lovely weather innit bruv?"

winter rose
#

"they say it's gonna stay like this for a while"

#

these things are like burnt in my memory, halp

warm hedge
#

Not happened yets

vocal mantle
#

I don't think the vast majority of people would enjoy VBS, even if it were <$100. It has different design goals. It would be an even more niche market.

slow brook
#

Hopefully someone can tell me where i'm going wrong here.

I'm spawning a group of men (section) and a vehicle with crew.

When they spawn I'm using the below to tell them to start patrolling in the area

// Section
[_grp, _townLoc, 700] call BIS_fnc_taskPatrol;

// Vehicle
[group _vehicle, _townLoc, 500] call BIS_fnc_taskPatrol;

For some reason I'm missing, this works for the Section, but the vehicle doesn't get any move orders assigned

#

for example

proven charm
#

_vehicle defined?

slow brook
#

Yes it's defined, otherwise it wouldn't spawn at all

hallow mortar
#

I don't think group works on vehicles

#

Try group (driver _vehicle)

slow brook
#

Good iea

proven charm
#

in this case it sounds like its not

slow brook
hallow mortar
#

Have a look at BIS_fnc_taskPatrol in the Functions Viewer and see if it has anything that might block it if a vehicle is involved. It might not support them properly and decide to exit instead of even trying.

hallow mortar
proven charm
#
hint format ["Debug: %1 %2", _vehicle, group _vehicle];
``` debug check
proven charm
#

it works on editor placed vehicles, just tested

slow brook
#

Yeah so it doesn't register the group.

proven charm
#

_vehicle is empty?

slow brook
#

No I got it

#

The driver is spawning outside the vehicle to start with then getting in

#

which is why the group is null whne checking

#

Right thanks for rubber ducking chaps πŸ˜„

still forum
#

Ask the server to give it to you

#

There is a script command that lists all players info

#

Maybe the cid is in there?

#

But that command might be server only,and i forgot the name

#

Can't set variable public param also take object?

#

Remote exec can take object as target i think

#

You can remoteExec the setvariable πŸ˜„

#

Ask server for cid if you do it more than a dozen times

#

RE is slightly less efficient. And object passing might fail if other player dies and respawns

#

Yeah sending reply back is annoying

#

That's why that userInfo command thing. Check if that's maybe available on clients

#

That would be best solution if it's avail

proven charm
#
remoteExecCall ["giveMePlayerList", 2]; // In client

giveMePlayerList = // In server
{
[plr1,plr2,plr3] remoteExecCall ["HereYouGo", client];
};

HereYouGo = // In client
{
 params ["_plrListFromServer"];
};
``` Something like that πŸ˜€
icy herald
#
Bohemia Interactive Forums

Page 16 of 16 - Poseidon: advanced text editor for Scripts & Configs - posted in ARMA 3 - COMMUNITY MADE UTILITIES:

i have a question. ive been using poseidon for awhile now no issues but i put a new windows on a new hdd, got everything working, poseidon is installed, yet it only runs if i open it. i cant open it by double clicking an SQF file anymore, it gives me an unspecified error. poseidon error: file path is what it looks like. i can access my SQFs manually if i open poseidon f...

granite sky
#

If you're using this a lot for some reason then you might want to setVariable the owner IDs on the player objects.

dreamy kestrel
#

Q: about structured text, it seems that the descriptionShort configuration for some classes has embedded i.e. "<br />", assuming that is intended for structured text. I'm not sure how consistent that is, number one; or whether there would be other structured elements. That being said, I wonder if we can reliable interpret that for use with a TOOLTIP (?).

dreamy kestrel
tribal sinew
#

Could be a stupid question but... is there any advantage of using remoteExec on hint instead of calling it for each player?

dreamy kestrel
tribal sinew
#

Oh, so you kinda need the sync part of remotexec in your case then?

dreamy kestrel
tribal sinew
#

My case is pretty basic - displaying dialogs via hints and adding some sound with playSound on top of that.

dreamy kestrel
#

depends on the dialog really. for most things like button presses, there is already sound. that's usually sufficient. the hint is the server to client feedback how the action was resolved.

#

anywho good luck good hunting.

tribal sinew
#

Gotcha, thanks

granite sky
#

How else would you be calling it for each player?

tribal sinew
#
{
   hint "";
} forEach allPlayers;
#

wouldnt work?

granite sky
#

No. hint only has local effect.

south swan
#

and on server with 70 players it would just show the hint only to you (but 70 times) blobdoggoshruggoogly

tribal sinew
#

Makes sense notlikemeow

#

what would I do without you guys

#

(the answer is not much)

queen cargo
#
"text" remoteExec ["hint", 0, false];```This will do the trick
dreamy kestrel
#

I think it's owner _player something like that when you want to target a client machine. only works on the server (2), however. in those scenarios I described in which only the manager(s) needs to see the hint.

#

of course 0 for ALL clients, but this may not be appropriate in your scenario. again, file under 'it depends'.

kindred tide
#

how is the array that the "crew" command returns sorted? is it in the same order as how they entered the vehicle?

kindred tide
#

looks like i have to keep record of it in my own variable

granite sky
#

I think it's in seat type order.

blazing zodiac
#

Anyone out there have any advice for the best way performance wise to set up functions? Like fnc_myFunc = compile preprocessFileLineNumbers "fnc\myFunc.sqf"; vs cfgFunctions or any other better way performance wise?

icy herald
rich bramble
#

@icy herald What's your timezone? Because if I'm not mistaken it's not exactly standard business hours at BI headquarters ;)

icy herald
#

Well, joker.... 🐐

blazing zodiac
#

Awesome thanks for the tip, this discord server is an incredible resource.

hallow spear
#

how can i add a countdown to when a player can exit the mission?

#

from the ESC menu

empty rivet
#

how do I edit arsenal restrictions for BluFor and OpFor for a warlords mission?

tough abyss
#

can you guys help me find a script that does when the group hears gunfire they will presue them im not really a fan of ai mods due to the exsessive preformance loss and breaking waypoints and sometimes buggy ai

winter rose
#

excellent joke aside, you can use the "FiredNear" event handler (it checks up to 70m distance) to then issue a move command to the group

tough abyss
#

is there a way to check for more than 70m? you can hear gunfire about 800 meters out just saying

winter rose
#

now do you really want all AI in a 800m radius converging to only one point

tough abyss
#

no like only 100 meters but it was a example

winter rose
#

then use the "FiredMan" EH on whatever unit should be tracked and grab all groups in a 100m radius

tough abyss
#

thankyou

sharp valve
sullen sigil
#

is there some sort of trick im missing for testing in MP surrounding lobbies/game ends or is it just a huge pain in the ass for testing? i.e restarting the mission, updating server mod, etc

proven charm
#

good tools

still forum
#

with filePatching you can skip the updating servermod part. or rather you can do it without repack/restart

#

if you want to test game ending, you probably are ending the mission so you need to restart it anyway

sullen sigil
#

How do I skip updating the server mod part of that? thonk

proven charm
#

with filepatching you can have the server mod files unpacked in arma dir

kindred lichen
#

It's so nice for finding niche stuff that's undocumented.

proven charm
#

I just create symbolic link from my mod folder to arma 3 root folder

kindred lichen
#

Just started, but it's my goto resource for overly specific problems where their solutions often only come from experience and is relatively obscure in documentation.

astral bone
#

I am suspicious... I ran my code and it worked first time... hmmmm

tranquil lintel
#

Is there a way to remove friction between the player and the ground, or at least keep some of the player's horizontal velocity while in the air once he hits the ground?

winter rose
tranquil lintel
vapid scarab
#

Whats the difference between CfgFunctions and compile preprocess...?

south swan
#

automatization, standardization, finalization (although that can be achieved by compileFinal) blobdoggoshruggoogly

still forum
vapid scarab
#

Lmao. So I'm building a framework for my unit. I assume the standard practice would be to run initialization code through compile pre...?

still forum
#

no

#

What are you trying to do

#

What do you mean by initialization code

#

What I understand as initialization code is preInit, and.. you don't run that through compile... Usually.. I don't know what you're trying to do there

vapid scarab
#

Initialize radios, loadouts, and a few other things.

still forum
#

that doesn't explain things

#

You want to create script functions?

#

So that you can call them

#

is there a reason why you do not want to use CfgFunctions?

vapid scarab
#

No. Im trying to learn best practice.

#

What would the use case for compile pre... be?

winter rose
#

CfgFunctions it is

winter rose
vapid scarab
#

Questions answered. Thank yall

sweet vessel
#

Im having a little trouble with unitplay. So i'm trying to make a helicopter crashlanding. But the moment i apply the damage via the script the unitplay just stops, and the helicopter falls out of the sky.

#

if i dont apply the damage, it goes on as normal and does the crashlanding

winter rose
#

as soon as the vehicle cannot move, the script stops yes.

sweet vessel
#

ignore the fool of a took that messed up the syntax on unitplay

#

it still ran, but ignored the true i gave in for stateIgnore

winter rose
#

hehehe
I even forgot it had this param!

pastel pier
#

Man selectBestPlaces is doing my head in. How can i make it show sources on the edge of a city or the edge of a tree line? I thought if i do half houses and half meadows it might work but ti's all over the place.

granite sky
#

No, it doesn't do that.

pastel pier
#

What do you mean. It seems perfect for that.

#

I can get hills so that vehicles actually can go to overwatch positions

granite sky
#

I guess it depends whether a single position can have non-zero values for both "houses" and "meadow" for example.

#

you could test with getAllEnvSoundControllers

pastel pier
#

ooooh i have seen that pass

molten yacht
#

Is there a way to instantly skip time / black out the sky

pastel pier
#

but not sure what that is

pastel pier
#

So i can get my formula from that?

granite sky
#

@molten yacht skiptime?

#

You can test whether it's possible to do what you want.

#

If a position at the edge of a city has houses 0.5 and meadows 0.5 then it's possible.

winter rose
granite sky
#

oh ffs, simple expressions don't support powers. Maybe impossible anyway then.

#

unless you can fudge it with envelope

pastel pier
#

So nobody has any real expierence with selectBestPlaces as a waypoint selector?

winter rose
#

"as a waypoint selector"?

pastel pier
#

To give purpose to you waypoints instead of them being random

winter rose
#

you will need to provide context here
a waypoint is not "random", it goes where you place it

hallow mortar
#

(whether the AI goes where you place the waypoint is different :U)

winter rose
#

that's another story πŸ˜„

molten yacht
winter rose
#

yup

molten yacht
#

cool, thanks

#

that's actually ideal

#

Do you need to unassign an item from a unit before removing it from the inventory?

winter rose
#

try and thou shalt see? πŸ˜„

#

(I think you don't need to unassign)

hallow mortar
#

You do need to unassign to remove something that's in an equipment slot

#

I'm guessing removeItem only looks at your cargo spaces, and things in your equipment slots aren't technically in your cargo spaces

molten yacht
#

noted, thanks

sudden yacht
#

How can I pause a key frame animation when it reaches the end?

hushed tendon
#

I'm working with moving a script I've been working on to a dedicated server and I'm having some trouble with locality. I've trimmed all my code down to obviously just the code I'm working with and it's working until the local part. It displays the "Running code for all players" part meaning the code is firing but I haven't been able to get the local code to run or at least it doesn't show being run cause the extra code I have in that section is placing markers on the map which works fine in SP but not in this MP environment. Anyone got a clue on what I'm doing wrong?

initServer.sqf

WAG_fnc_deployLootGenerationSystem = compileFinal preprocessFileLineNumbers "Functions\deployLootGenerationSystem.sqf";
[] spawn WAG_fnc_deployLootGenerationSystem;

deployLootGenerationSystem.sqf

while {true} do {
    "Running code for all players" remoteExec ["hint",0,true];

    // Trying to run code locally for player here
    { 
        hint "Running local code for player";
        systemChat "Running local code for player";
        
    } remoteExec ["spawn", 0];

    sleep LOOT_GENERATION_CHECK_TIME;
};
#

Been working on this for hours and still no clue on what to do

hushed tendon
#

wait

#

am I dumb?

winter rose
#

found it?

hushed tendon
#

no :(

winter rose
#

hint: 0 spawn {}

hushed tendon
#

yeah but I'm trying to find the documentation saying how to pass a variable for remoteExec with the code and failing atm

winter rose
#
{} remoteExec ["spawn", 0];    // wrong
[42, {}] remoteExec ["spawn"]; // correct
hushed tendon
#

oh

winter rose
#
[leftArg, rightArg] remoteExec ["command"];
ashen ridge
#

When a player is looking thought a weapon scope, can i run a comand to change his view to default and not scoped view?

hushed tendon
ashen ridge
#

Thanks.

crude crescent
#

I have a problem with attachTo .. i'm attaching a player to an object and i need to rotate the player. When attaching the player to an object that i spawned by my self i can rotate the player with setVectorDirAndUp but if the object was spawned by the mission its not working. Even if i execute setVectorDirAndUp server side. Am i doing anything wrong or am i missing something?

hushed tendon
molten yacht
#

is there any way to secretly kill the engine while making it look fine

#

on a car

#

hmm maybe I can just use the engine event handler to turn it off a second after it turns on?

winter rose
#

you can destroy it (will appear red in the UI)
you can set fuel to zero
maybe you can drown it, but IDK if it shows on the UI

hushed tendon
#

I'm so confused...

This works just fine with sending my player on a dedicated server to the debug corner but...

[0,{ 
    player setPos [0,0,0];
}] remoteExec ["spawn"];

...for some reason this is too much to ask for and returns an empty array :/

[0,{ 
    _buildings = nearestObjects [player, ["house"], LOOT_GENERATION_CHECK_DISTANCE];
    hint str _buildings; // Returns: []
}] remoteExec ["spawn"];
little raptor
winter rose
#

dang it
BI, always ruining things

winter rose
#

also, , 0 is not needed

hushed tendon
#

oh sorry I typed that out wrong it does have the second arg

winter rose
#

and is LOOT_GENERATION_CHECK_DISTANCE defined there?

hushed tendon
#

It should be as I define it in initServer.sqf just like the LOOT_GENERATION_CHECK_TIME in the code from earlier but I'll double check

molten yacht
#

I think this will work, more or less.... sqf (needs params); if (!(_this getVariable "activeEMP")) then { _this setVariable["activeEMP",true,true] // can set to false later _this addEventHandler ["Engine", {if((_this select 1)&&(_this activeEMP)) then { _this engineOn false; };}]; }; else { _this setVariable["activeEMP",false,true] }

#

"If you're not marked as EMPed, mark you as EMPed and add an event handler. If you are marked as EMPed, unmark you."

hushed tendon
winter rose
#

ta-daaa
you can still pass it as an argument

winter rose
#

and will somewhat error anyway ; else

fair drum
molten yacht
#

yeah I actually looked at it in vs code and now I have ```sqf

params ["_this"];
if (!(_this getVariable ["activeEMP",false])) then {
_this setVariable["activeEMP",true,true]; // can set to false later
_this addEventHandler ["Engine", {if((_this select 1) && (_this getVariable ["activeEMP",false])) then { _this engineOn false; };}]; }
else { _this setVariable["activeEMP",false,true] }

winter rose
molten yacht
#

yeah, nah

#

it's not

#

I was thinking about how to make it so

#

pondering how I would get driver _this and send a hint to only them

#

"The engine sputters and won't start."

hushed tendon
dreamy kestrel
#

Q: it is valid to include these such as they are?

#include "\a3\ui_f\hpp\definedikcodes.inc"
winter rose
#

no you might get pregnant

winter rose
#

what did I just say

dreamy kestrel
#

so many ways I could go with that one, but I digress πŸ˜‰

winter rose
#

I didn't even link it with DIK code indeed 😁

dreamy kestrel
#

ah okay I see what you did there πŸ˜›

winter rose
#

no joke, I didn't connect the dots myself πŸ˜„

molten yacht
#

Is there ANY mp friendly way to setScale on, say, a User Texture object?

#

I need to black out the sky in one area :P

hushed tendon
#

What I use to do that is BIS_fnc_replaceWithSimpleObject and then setscale on the returned object. It should work fine as it has for me but if you use it on like +50 objects some may not scale up. As for it wokring with a custom texture I have no clue

if(isServer)then{
    _tank = [tank] call BIS_fnc_replaceWithSimpleObject;
    _tank setObjectScale 100;
};
#

If I remember correctly that's how I do it

west hatch
#

heyo, i'm looking for some help in making a script in which a guy drops into an area (WWII) and has a small chance of loosing his equipment as a result of his drop. I've been hunting for something like this, but i can't find anything

little raptor
#

using createSimpleObject (set the local bool to true)

little raptor
west hatch
little raptor
#

... meowsweats
well how does the "dropping" work? at the start of the mission? using an action?

west hatch
#

so when a paratrooper lands on the ground, there could be a trigger that would run that said that there was a change his rifle, ammo, medical, or rations could be lost.

#

not sure really how to structure it but it would be a thing where i'd have to have all the class names for it

#

hell could even have either the backpack, vest, and helmet is lost

#

idk

little raptor
#

like have you put some units in the editor and they're falling, or do you want them to paradrop from a vehicle, or do players just select some action, e.g. "Halo jump" and they click on the map, then they start paradropping?
or have you figured out this part and you only need help with the "losing equipment" part?

west hatch
#

oh i have them jumping from a C-47. its the landing and losing the equipment part i'm stuck at.

#

@little raptor

little raptor
west hatch
pulsar bluff
#

can someone confirm that the "HitPart" event is not working on local unit when bullet is fired by remote unit

#

there was a change note saying it was functioning but ... from my testing on DS, DS-owned units firing bullets do not trigger on local unit with hitpart event added locally

#

Tweaked: HitPart events now fire for remote rifle bullets (not missiles, grenades or other projectile types)

little raptor
# west hatch ahhh perm since many of the guys will be dropping into flooded fields that could...

you can do something like this:

params ["_unit"];
waitUntil {getPos _unit#2 < 1};

private _loadout = getUnitLoadout;
private _weights = [-1, 2];
{
    _weights append [_forEachIndex, [3,1] select (_forEachIndex in [3,4,5])];
} forEach _loadout;
private _lostIndex = selectRandomWeighted _weights;
if (_lostIndex < 0) exitWith {};
private _item = _loadout#_lostIndex;
if (_item isEqualType "") exitWith {_loadout set [_lostIndex, ""]; _unit setUnitLoadout _loadout;};

if (_item isEqualTo []) exitWith {};
_weights = [];
{
    _weights append [_forEachIndex, [2,1] select (_x isEqualType [])];
} forEach _item;
private _lostSubIndex = selectRandomWeighted _weights;
private _lostSubItem = _item#_lostSubIndex;
if (_lostSubItem isEqualType []) then {_item set [_lostSubIndex, []]} else {_item set [_lostSubIndex, ""]};
_unit setUnitLoadout _loadout;
west hatch
#

this would be in the init?

#

@little raptor

little raptor
#

it should only run after the unit "jumps out". and it should be spawned/execVMed

west hatch
#

i don't fully understand

little raptor
#
params ["_unit"];
waitUntil {getPos _unit#2 < 1};
private _loadout = getUnitLoadout _unit;
private _weights = [-1, 2];

{
    _weights append [_forEachIndex, [3,1] select (_forEachIndex in [3,4,5])];
} forEach _loadout;
private _lostIndex = selectRandomWeighted _weights;
if (_lostIndex < 0) exitWith {};
private _item = _loadout#_lostIndex;
if (_item isEqualType "") exitWith {_loadout set [_lostIndex, ""]; _unit setUnitLoadout _loadout;};
if (_item isEqualTo []) exitWith {};
_weights = [-1, 1];
{
    _weights append [_forEachIndex, [2,1] select (_x isEqualType [])];
} forEach _item;
private _lostSubIndex = selectRandomWeighted _weights;

if (_lostSubIndex < 0 && {
    _lostSubIndex = floor random count _item;
    _lostIndex in [3,4,5] && {
        _loadout set [_lostIndex, []];
        _unit setUnitLoadout _loadout;
        true
    }
}) exitWith {
};

private _lostSubItem = _item#_lostSubIndex;
if (_lostSubItem isEqualType []) then {_item set [_lostSubIndex, []]} else {_item set [_lostSubIndex, ""]};

_unit setUnitLoadout _loadout;

that one also gets rid of backpacks/vests/etc.

west hatch
#

can i put it in a trigger? or the init.sqf?

little raptor
#

how do the units jump out?

#

by themselves?

#

using a code you put in trigger?

west hatch
#

ye players will jump out of the vehicle themselves

little raptor
sharp parcel
#

hi guys, I used to use a command in the debug console to see how many opfor AI players were spawned in an Area.. I can't seem to find the command and am searchinng the www.. Would anyone here know what I could use...? cheers

little raptor
#

or if no trigger then just units east

sharp parcel
#

cheers

little raptor
#

if you just want to know how many put count before it : count units east or count (units east inAreaArray trigger)

sharp parcel
#

@little raptor worked a treat, thank you

little raptor
#

you might want to copy it again

west hatch
#

awsome, thank you!

little raptor
west hatch
#

ye no, just the possiblity of the equipment, weapon, items, and/or backpack

#

i'll give it a go tomorrow after work

#

thank you again!

little raptor
# west hatch ye no, just the possiblity of the equipment, weapon, items, and/or backpack

this would suit your needs better then I guess:

params ["_unit"];
waitUntil {getPos _unit#2 < 1};
private _loadout = getUnitLoadout _unit;
private _weights = [-1, 2];

{
    if (count _x == 0) then {continue;};
    _weights append [_forEachIndex, ([3,1] select (_forEachIndex in [3,4,5]))];
} forEach _loadout;
private _lostIndex = selectRandomWeighted _weights;
if (isNil "_lostIndex" || {_lostIndex < 0}) exitWith {};
private _item = _loadout#_lostIndex;
if (_item isEqualType "") exitWith {_loadout set [_lostIndex, ""]; _unit setUnitLoadout _loadout;};
if (count _item == 0) exitWith {};


_weights = [];
if (_lostIndex in [3,4]) then {
    _item = _item param [1, []];
};
if (_lostIndex == 5) then {_weights append [-1, 1]; _item = _item param [1, []];};
{
    _weights append [_forEachIndex, [2,1] select (_x isEqualType [])];
} forEach _item;

private _lostSubIndex = selectRandomWeighted _weights;
 
if (_lostSubIndex < 0) exitWith {_loadout set [5, []]; _unit setUnitLoadout _loadout};

private _lostSubItem = _item#_lostSubIndex;
if (_lostSubItem isEqualType []) then {_item set [_lostSubIndex, []]} else {_item set [_lostSubIndex, ""]};
_unit setUnitLoadout _loadout;
still forum
sour drum
#

https://www.youtube.com/watch?v=Oe-didKJZrU 5:24, does anyone know of the script that could do this

During the final days of Reach the last remaining regiments of UNSC marines are tasked with the defense of evacuation sites as humanity loses their grip on the planet. Watch as the members of Ignis are blasted to pieces by plasma as they "hold the line"!

If you enjoy the video consider subscribing and sticking around for the next one!

Support ...

β–Ά Play video
warm hedge
#

Just setPos'ing a big object from far away?

sullen sigil
#

thats setvelocitytransformation
ive got a capital ships mod finished code-wise that does a similar thing without svt so it can be flown too, just needs a bunch of config before relesse

sour drum
#

alright i know nothing about scripting but ill try to do that stuff

warm hedge
#

Well, yeah I always forgot setVelocityTransformation since I know nothing about

sullen sigil
#

its a dreadful command for using

#

i hate it

proven charm
#

is there any known bug that causes empty vehicles left on map even when you have call to deletevehicle?

winter rose
proven charm
#

i dont know which one to hope, engine bug or my own doing

#

simple empty vehicles left on map, and IDK why my cleanup scripts dont deal with them (at the first place)

#

there used to be big problem with AI units not being deleted properly... but that should be fixed

proven charm
winter rose
#

will need repro, or at least code involved πŸ‘€

proven charm
#

yeah havent been able to repro yet

slow brook
#

Is there an easy way to select the index of the current iteration loop?

Ie
list = [1,2,3];
{
diag_log format ["Position currently: %1", INDEX]
} foreach list;

proven charm
upbeat hill
#

how would i make it so that my own animation only plays the animation on trigger

winter rose
#

sorry, meaning?

upbeat hill
#

so ive got an animation with the timeline and rich curve

#

and wish for this animation to only play on a trigger so once i walk into it

#

if that makes sense

astral bone
#

Do you think something running every frame, taking 0.00083 ms to run, is ok? πŸ˜…

#

I have an invincibility script but sometimes with some mods, I can still get injured. The mod has a "isInjured" function. I am wondering if doing an if check would be better done every so many frames, or if I could just do it every frame.

proven charm
#

if it has to be each frame use EachFrame EH

astral bone
#

yea ik

proven charm
#

doesnt allowDamage command work then?

astral bone
#

My issue is when I crash something, it can still damage me. Although- does that set allowDamage to true when I crash-?

#

Ok, I flew a helicopter into the ground and, no, b/c if it did, my script would detect damage allowed and then healed me x3

#
if(isDamageAllowed _x)then{
    _x allowDamage false;
    if(_x call ace_medical_ai_fnc_isinjured)then{
    ... ACE'S HEAL CODE ...
  };

};
proven charm
astral bone
#

I've had this for so long, idk if I wanna redo such a major portion of my code xD

#

right now atleast

little raptor
upbeat hill
#

oh ok

astral bone
#

I'm kinda proud of my invincible script too heh

little raptor
#

a loop may not "see" that you took damage. EH always does

astral bone
little raptor
astral bone
#

The melee system would ignore the damage allowed completely, thus the script was made.

astral bone
little raptor
#

that's not even a function think_turtle

astral bone
#
if(isDamageAllowed _x)then{
    _x allowDamage false;

};

if(_x call ace_medical_ai_fnc_isinjured)then{
  //... ACE'S HEAL CODE ...
};
#

I was wondering if I should do this instead basically

#
if(isNil "ratchet_InvincibleUnits")then{
    ratchet_InvincibleUnits = [];
    ratchet_InvincibleUnits_lastSystemTime = time;
    _id = addMissionEventHandler["EachFrame",{
         if(time > ratchet_InvincibleUnits_lastSystemTime)then{
            ratchet_InvincibleUnits_lastSystemTime = time;
            {
                if(isDamageAllowed _x)then{
                    _x allowDamage false;
                    if(_x call ace_medical_ai_fnc_isinjured)then{
                        // ACE HEAL //
                    };

                };
                _curShield = (_x getVariable [/*melee shield thingy*/,0]);
                if(typeName _curShield != "NUMBER")then{_curShield = 0;};
                if(_curShield < 900)then{
                        _x setVariable [/*melee shield thingy*/,1000,true];
                };
            }forEach ratchet_InvincibleUnits;
        };
    }];
};```
This is the code rn, pretty much.
#

Ah ok, so if something does 'setDamage' then there could be an issue. Although- uh- if something did setdamage I imagine it'd either be 1 or 0 if it uses setDamage directly xD

#

Maybe I could make a version 2.0 that uses event handlers

little raptor
#

or just the bit you said?

astral bone
little raptor
#

well just keep in mind that you have multiple "ratchet_InvincibleUnits". also it is only checking the if(isDamageAllowed _x)then{ bit

little raptor
#

so the function call is inside the if

#

a function call will definitely have a bigger overhead than 0.0008ms (at least on my PC)

#

but hopefully it will run once anyway (unless something else is messing with allowDamage)

tropic gull
#

Hey ho

I have created an arma 3 script. This is to be installed in the relevant screen called "Screen1". The problem here is that I get strange error messages (for Sleep 1; a ";" is missing) Does anyone have any ideas?

The Script:

[] spawn {
private _screen = screen1;
private _drone = vehicle player getVariable ["drone1", objNull];

while {true} do {
if (!isNull _drone) then {
_drone camSetTarget _screen;
_drone camCommand "cameraEffect" params ["Internal","Back"];
_drone camPrepareTarget _screen;
_drone camCommit _screen;
}

sleep 1; 

}
};

its for the Init in Screen1

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

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

don't forget a ; after while {} ;

proven charm
#

every }

#

;

#

at least in the code above, there's two ; missing

winter rose
#

ah yes, it's the if that is creating the error here

#

indentation

slow brook
#

Is there a way to load addon config settings from a .sqf / .ext file into your mission on startup?

proven charm
slow brook
#

So I can just do and it'll apply them?

// INIT.sqf
execvm 'scripts\settings.sqf'
proven charm
#

that depends on what you have in settings.sqf

#

and I think the path going to be something like execvm '\yourMod\scripts\settings.sqf'

slow brook
#


// ACE Advanced Ballistics
force ace_advanced_ballistics_ammoTemperatureEnabled = true;
force ace_advanced_ballistics_barrelLengthInfluenceEnabled = true;
force ace_advanced_ballistics_bulletTraceEnabled = true;
proven charm
#

i guess that works, havent see that force syntax before

slow brook
#

Force is the override client iirc

slow brook
#

It runs the SQF, but doesn't actually apply the settings

proven charm
#

I still dont know what that "force" is, it maybe undefined macro?

slow brook
#

It's fine, I know how to do it

exotic flax
#

You could just add a 'cba_settings.sqf' in the mission directory/PBO. CBA will pick that up automatically

#

Instead of changing the settings using the ingame settings menu, the mission maker can export all settings using the export funtion (described below) and paste them into the optional cba_settings.sqf file in the missions main folder. Settings that are defined using this method cannot be changed in the ingame settings menu.
see: https://github.com/CBATeam/CBA_A3/wiki/CBA-Settings-System#mission-settings

tulip ridge
#

What would be a good way to temporarily "disable" a vehicle?
Would stop it from moving/shooting for a given amount of time

Preferably would work for both player and ai controlled vehicles

tepid vigil
#

Am I doing something dumb? I consistently crash my game when running this function:

disableSerialization;

createDialog "FRLN_orderVehicleGUI";

lbAdd [71685, "Test1"];
lbAdd [71685, "Test2"];

private _descriptionControl = (findDisplay 71684) displayCtrl 71688;
_descriptionControl ctrlSetStructuredText parseText "Test description";

Edit: I was indeed doing something dumb... I forgot that I had the dialog call this function on load -> status access violation notlikemeow

tulip ridge
stable dune
#

Hello
What is the correct animation to pick up?
When I pick up an item from the ground, what is that animation, what does the player do?

granite sky
#

Spam-hinting animationState player can pick these up. otherwise logging with the AnimStateChanged EH.

stable dune
#

Damn, you are smart. That I will do. Thanks.

granite sky
#

Although that might be an action rather than a move so maybe it doesn't show.

stable dune
#

I will test out

winter rose
#

"PutDown" iirc

#

@stable dune ↑

molten yacht
#

any way to darken/tint an object

slow brook
#

Since EXTDB3 was abandoned years ago, are there any better / usable DB extension for MySQL?

molten yacht
#
{
_x unassignItem "ItemMap";
_x removeItem "ItemMap";
_x unassignItem "ItemGPS";
_x removeItem "ItemGPS"; } forEach player in thisList 
#

So

#

this is in a trigger

#

but that last syntax is a guess

#

How WOULD you write "For each unit in this list that is a player

warm hedge
#

You can use if in forEach

#

Also use unlinkItem command

molten yacht
#

if in foreach?

#

oh

#

if (isPlayer _x) then { _x unlinkItem "ItemMap";} ?

warm hedge
#

Why isPlayer?

#

Hm disregard. Would do

molten yacht
#

{if (isPlayer _x) {
_x unlinkItem "ItemMap";
_x unlinkItem "ItemGPS";}} forEach thisList; ```
#

Like so?

#

because I'm only teleporting players and I'm stealing their shit :P

warm hedge
#

You forgot then

molten yacht
#

oh

molten yacht
#

well I'm confused

#
_dest = getPosATL exit3;
{ _rndDest = [_dest select 0, _dest select 1, _dest select 2]; 
if (isPlayer _x) then {
_x playSoundUI ["SZap", 0.8,1,true]; 
_x setPos _rndDest;
_x unlinkItem "ItemMap";
_x unlinkItem "ItemGPS";};} forEach thisList; 
#

This gives a "missing ;"

#

I've tried removing or adding semicolons in places, but

#

it remains stubbornly so

#

wait nvm

#

bad code on the sound

#

ignore me

hallow mortar
#

What's the point of the _dest -> _rndDest transcription? You're just copying the exact values of _dest

molten yacht
#

I'm gonna change it in a second to randomize it

#

but first I need to figure out

#

how best to playSoundUI only on players who are teleported

hallow mortar
#

remoteExec with the player in question as the target

#

(make sure this code is only being executed on one machine)

molten yacht
#

server-side trigger

#

ohh, I see, remote exec's target could be _x

#

thanks!

#

["SZap", 0.8,1,true] remoteExec ["playSoundUI",_x]; I think??

hallow mortar
#

You need double [] on the argument.
With only one set, remoteExec will think you're sending an array of separate arguments, like you would for a binary (arg1 command arg2) command, and get confused

simple trout
hallow mortar
molten yacht
#

I see. Thanks!

pulsar pewter
#

Random question, but can anybody think of how I could set up an Event Handler so that an addAction gets added to a TFAR SATCOM Antenna from TFAR every time it gets deployed? (ref to it here: https://www.fkgaming.eu/guides/fng-guides/fng-arma-guides/beginners-guide-tfar-r22/#satcom)
If you're not familiar with it, it gets deployed via Ace Self-Interaction. I think an EH makes sense, because the idea is that the antenna would get picked up/deployed many times by my player, and I want it to have the addAction each time. I originally thought that a "WeaponAssembled" EH might work, but the SATCOM antenna is obviously not a static weapon...

molten yacht
#

You look through TFAR's eventhandlers?

#

Maybe there?

#

also, does anyone know if _variables are shared among the trigger

#

i.e. could _bingus be assigned in On Activation and then acted on in On Deactivation

molten yacht
#

hmmm

#

I am doing something wrong but it's hard to know what

#

Okay, this seems to at least not instantly error, time to test if it works

restive pike
#

hi im trying to have the cinema borders show then leave but when i run the script in execute code via zeus it starts the cinema bars fully showing and then leaving instead of them slowly appearing then leaving

Sleep 2;
[parseText "<t font='PuristaBold' size='2' color='#9da687'> Operation INSERT NAME  </t><br /> SECOND LINE HERE", true, nil, 10, 0.7, 0] spawn BIS_fnc_textTiles; 
Sleep 7;
[1,1,false] call BIS_fnc_cinemaBorder;```
#

almost like its skipping the first line

hallow mortar
# molten yacht hmmm

PlaySoundUI doesn't return anything in the current stable build, so you can't save its return to a variable (because there is no return). The number return, and stopSound, are on dev branch for release with the next update

molten yacht
#

oh

#

NEXT update

#

that explains it

molten yacht
#

What's the code to get an array of all Units inside of a trigger/marker area

stable dune
molten yacht
#

so if I wanted to hand the array to a function I wrote,

[true, true, (units inAreaArray domeTrigger] call { "REV_fn_fx_stripTeleport";};```
stable dune
still forum
still forum
molten yacht
#

HoldAction "On Completion" sqf [exit3, 2, (units inAreaArray domeTrigger)] call REV_fn_fx_stripTeleport;
And then the contents of stripTeleport.sqf in the proper folder like my other functions are: ```sqf

params ["_destination","_radius","_targets"];

_dest = getPosATL _destination;
{ _rndDest = _dest getPos [_radius * (1 - abs random [-1, 0, 1]), random 360];
if (isPlayer _x) then {
[["DSidle1", 0.8,1,true]] remoteExec ["playSoundUI",_x];
_x setPos _rndDest;
_x unlinkItem "ItemMap";
_x unlinkItem "ItemGPS";};} forEach _targets

#

actually let me relaunch the game just in case it's a caching issue???

stable dune
#
[exit3, 2, (allUnits inAreaArray domeTrigger)] call REV_fn_fx_stripTeleport;
molten yacht
#

oh

#

is it that simple

#

gdi

molten yacht
#

hmmmm

#

so can PlaySound3D not play sounds that are shortnamed?

proven charm
#

shortnamed?

molten yacht
#

the wiki seems to say that you have to spell out the whole path for even built-in sounds

#

whereas with PlaySound (2d version) you can just say the sound's classname

#

and playsoundUI will also just take a classname

slow brook
#

You can always stick it in a variable before the foreach and call it that way

molten yacht
#

i.e. [["DSidle1", 0.8,1,true]] remoteExec ["playSoundUI",_x];

proven charm
#

wiki says PlaySound3D wants filename, so..

molten yacht
#

yeah

#

weird

little raptor
#

Or a function

slow brook
molten yacht
#

....you have my immediate attention because I was actually really worried about that

#

but also, with playSound3D, how do you specify that soundPosition is blank while also setting volume/soundPitch

#

rather, how do you slip over an arg without setting it in any given function

little raptor
#

You can't

#

You must give it some value (see the wiki for default values)

molten yacht
#

....so you can never have a volume in playSound3D without setting soundPosition, which is a positionASL

slow brook
#

It's optional?, cant you just NIL it?

little raptor
#

no

molten yacht
#

:|

#

hate that

slow brook
#

meh, just pass in the randdest as the point then

molten yacht
#

I'm playing a sound with an invisible gamelogic as the source

#

(if that's a thing you can do)

#

(hope so)

slow brook
#
_gl = getpos gamelogic;

playSound3D ["SoundFile", gamelogic, false, _gl, 1, soundPitch, distance, offset, local]
molten yacht
#

yeah

#

fucked up but it'll do

south swan
#

*getPosASL

slow brook
#

doesn't really matter for game logic

#

Do you want all targets to go to the same location ?

molten yacht
#

yeah the script is intended to grab players from all over the AO and suddenly throw them out into a place where they're surrounded by shadowmen

little raptor
molten yacht
#

ASL or ATL? Which is faster

little raptor
#

Same speed

#

It doesn't matter if you call it once tho

slow brook
#
params ["_destination","_radius","_targets"];

{
  // Gives a random Destination using the point of reference, it will be outside of 100m but inside 3000m from the original point.
  _dest = [_destination, 100, 3000, 5] call bis_fnc_findsafepos
  if (isPlayer _x) then {
    [["DSidle1", 0.8,1,true]] remoteExec ["playSoundUI",_x];
    _x setPos _dest ;
    _x unlinkItem "ItemMap";
    _x unlinkItem "ItemGPS";
  };
} forEach _targets;
molten yacht
#

ah

#

that's way too big, they're all landing in this clearing

slow brook
#

reduce the size then /shrug πŸ˜„

molten yacht
#

heehoo spooki

slow brook
#

they won't spawn on top of each other this way

#

so [_destination, 1, 50, 5]

molten yacht
#

yeah

#

That's good to know. Thanks.

little raptor
molten yacht
#

what's the last arg in that

#

5

slow brook
#

min distance from an object

#

IE don't spawn inside a crate

restive pike
#

hi im trying to make a module that when you place it on an object it adds an ace interaction to that object. I've made the module part but im stuck with the scripting. Can anyone help with an idea of what the script should look like?

little raptor
#

It won't work in editor

restive pike
#

yeah the module is a zeus module

slow brook
restive pike
#

you place the module on an object and it would hopefully run the sqf

little raptor
restive pike
#

private _action =
{}; 
_action = {
"addPlayer",
"Add Player",
"\A3\ui_f\data\igui\cfg\actions\unloadVehicle_ca.paa",
{this call  ace_interact_menu_fnc_createAction},
{true},
{},
[]
};

[_pos, 0, ["ACE_MainActions"], _action] call  ace_interact_menu_fnc_addActionToObject;

If im understanding the wiki right?

brazen lagoon
#

does this exist? revive script that:

  • lets all ai go down before dying
  • has ai reviving both other ai and players
  • multiplayer compatible
  • hc compatible
brazen lagoon
#

yeah but someone in my unit explicitly cannot play with ace

#

might have to say sorry bro but we need this

exotic flax
#

ACE is not for everyone, especially since it adds a lot more than just medical stuff.

Although you can tweak the setting a lot, so you probably won't even notice the improvements (but can still use them if needed)

spark turret
#

you can always start deleting pbos from ace

#

ace is so omnipotent, it has killed all competition especially in medical

sullen sigil
#

they likely cannot play with ace due to not being able to run dlls
which medical does not use but other aspects do

opal zephyr
#

Could they delete the dll's? There isnt that many and if it doesnt impact basic ace functions or ace medical then it should be fine

#

Also could be beneficial to look into the root of whatever reason it is that they cant run dll's

still forum
#

Ace advanced ballistics needs one. But can be disabled.
The split lines thing may be needed, don't know if it has script fallback

opal zephyr
#

What do the dll's actually do in a arma mod sense?

proven charm
#

things not possible with SQF scripting

opal zephyr
#

Hm sounds like something fun to explore, thanks

granite sky
#

IIRC ballistics only uses the extension for performance.

#

Like you could do the same thing in SQF but it'd be painful when the bullets started flying.

#

ACE medical AI is pretty weak. It won't help anyone while there's fighting going on.

still forum
#

I don't think you can actually

#

You'll run into precision issues probably

#

I mean yeah ok you can and ignore that

brazen lagoon
#

like after clearing an objective

brazen lagoon
#

looks like advanced ballistics, artillery tables, break line, clipboard, fcs

#

acemod says "not possible"

wary needle
#
  addToTrophy = {
  params["_vehicle","_range"];
  _null = [_vehicle,_range]spawn {
        private["_vehicle","_range","_incoming","_target"];
    _vehicle = _this select 0;
    _range = _this select 1;
    while{alive _vehicle}do{
     
     _incoming = _vehicle nearObjects ["ShellBase",_range];
     
    
     _incoming = _incoming + (_vehicle nearObjects ["MissileBase",_range]);
     
     
     _incoming = _incoming + (_vehicle nearObjects ["RocketBase",_range]);
     
     
     
     while{count _incoming > 0} do{
        
        _target = _incoming select 0; 
        
    
        _fromTarget = _target getDir _vehicle; 
        
    
        _dirTarget = direction _target; 
        
    
        _targetZ = (getPosASL _target) select 2; 
        
    
        _vehicleZ = ((getPosASL _vehicle) select 2) + 1.8;
        
    
        _targetSlope = (_targetZ - _vehicleZ) / (_vehicle distance2D _target);
        

        if ((_dirTarget < _fromTarget + 30) && (_dirTarget > _fromTarget - 30) && (_targetSlope < 5.76) && (_targetSlope > -5.76)) then {
        
playSound3D ["A3\Sounds_F\sfx\blip1.wss", tank];
playSound3D ["A3\Sounds_F\sfx\blip1.wss", tank];
            "SmallSecondary" createVehicle (getPos _target); 
            
        
            deleteVehicle _target; 
            
        
            _incoming = _incoming - [_target]; 
            
        
            sleep 0.1; 
        };
     };
     
    
     if(count _incoming == 0)then{
     sleep 0.05; 
     };
    };
  };
 };
 call   addToTrophy;
#

im having issues getting this script to work.

#

im having some issues with varable locality _vehicle is not defined
but reading the code _vehicle = _this select 0. is _this not working as its staying inbeetween the brackets?

warm hedge
#

Because you have no array passed into the function

wary needle
#

can you explan simpler?

warm hedge
#

Even though this function itself does have a lot of flaws, you haven't passed any data upon the execution (last line)

wary needle
#

how would i do that

warm hedge
#

[yourVehicle, 100] call addToTrophy or whatever, I don't know what this fnc is

wary needle
#

what does the 100 mean?

warm hedge
#

IDK

#

Again I don't know what is your intention and what it does

wary needle
#

it works!!!!

#

active protection system

#

it only works the first time though

#

after that the missles stop getting shot down

vapid spoke
#

hey guys anyone know what the script they use on hearts and minds or antistasi for percipient save?

granite sky
#

Antistasi just writes arbitrary data to profileNamespace or missionProfileNamespace depending on whether you ticked the box.

limber panther
#

Hello!
I need a little hint. I would like to create an if ... then ... script and for the if condition i would like to have a few factors checked. I have 3 conditions and i want the whole result to be true only if all 3 of them are true. Normally i would use && but according to wiki that's for comparing 2 conditions, can i use it for 3 as well? like conditin1 && condition2 && condition3 ?

#

In other words, is this correct? ```sqf
if (_key == DIK_RCONTROL && {vehicle player == player} && {side group player isEqualTo west}) then {

};

winter rose
limber panther
winter rose
#

yep

if (_key == DIK_RCONTROL && { vehicle player == player && { side player isEqualTo west } }) then
limber panther
winter rose
#

I suppose so, if you set up the event properly yes

limber panther
#

wonderful, thank you @winter rose

ashen ridge
#

player can be null for a short time when the player dies and respawn?

winter rose
#

I don't know, but it should not matter

granite sky
#

It'll matter if you assume otherwise :P

#

I don't recall there being a null interval though. Maybe for one frame...

sullen sigil
#

Is there any way to replace double quotes with single ones in a string? Not quite able to figure it out :p

#

and/or just use single quotes within format :p
im just sticking to ctrl+h seeing as i'll need to do it at some point anyways

#

next question.
i have created a script that should generate every possible combination of stuff for config based off of an array of hashmaps. its working nearly fine, except the non required values are only generating individually and not together. it should be generating them as combinations -- i.e buts, butsss and buts_butsss but it is not doing the last one. I think the issue is at line 20 but am unsure how to fix it, advice would be helpful
https://sqfbin.com/nacisugaqecuyubahagu

#

(yes ive indented it properly lou)

fallen locust
#

Need help with chosing UI elemets? :)

createDialog "RscTestControlsGroupTooltip"
createDialog "RscTestControlStyles"
createDialog "RscTestControlTypes"
createDialog "RscTestObjectUI"

Have fun ;)

leaden ibex
granite sky
#

@sullen sigil I don't understand what you're trying to do there. buts_butsss is clearly impossible because the {_selections find _x == _i} part only ever includes each of them once, and in different passes?

#

but then why run the loop 17 times when there are only four combinations...

kindred tide
#

is there a reverse of compile command? something that converts code to string

warm hedge
#

Probably just str

kindred tide
#

oh i see

tough abyss
#

Is there a reason why SQF uses string variable names in for "_i" from 0 to 5 do? I can't think of any other languages that do that

warm hedge
#

String is to declare the variable

#

(In this context)

tough abyss
#

But why not for _i from 0 to 5 do

warm hedge
#

Other example: params ["_alpha","_bravo"];

#

tldr: it is what it is Β―_(ツ)_/Β―

tough abyss
#

No problem then

warm hedge
#

Actually SQF syntax is about two decades old. It is very hard to alter anything by now

sullen sigil
#

i.e i tried <= and < etc but never generated all 4 combinations πŸ™ƒ

slow brook
#

I take i that running this, and getting the return below means the map isn't setup properly?

_locations = nearestLocations [player,["NameLocal"],25000];
_location = selectrandom _locations;
_location

Location NameLocal at 533, 2396

warm hedge
#

What exactly you expect?

slow brook
#

Townname at grid?

#

IE

Location Asper at 111,223

#

throwing Text in front of _location gives me the name..

#

Hmm

proven charm
slow brook
#

Going to iterate through the CFG file instead

sullen sigil
#

In essence, I need the condition to select every combination through the for loop whilst also always having the required selections

warm hedge
#

@final radish πŸ‘‹ Are you looking for this channel?

final radish
# warm hedge <@203387872756105217> πŸ‘‹ Are you looking for this channel?

I was just reading through it, thanks again!

Spent the last several hours working on including a downing function into a damage handler script for my life server. Somehow, including hitBox as a parameter breaks the entire script without throwing a single error in the server or client rtp logs.

I don't really play Arma 3, I just am pretty experienced with C# which is essentially what the Arma SQF language is. So anyways, for the first time in years I was about to rip out some of my hair in frustration and give up lol

#

So anyways, my parameters look like this now.

params [
    ["_unit", objNull, [objNull]],
    ["_part", "", [""]],
    // ["_hitBox", "", [""]],
    ["_damage", 0, [0]],
    ["_source", objNull, [objNull]],
    ["_projectile", "", [""]],
    ["_index", 0, [0]]
];

In my case, since hitBox was breaking the params I wasn't able to track the rest of the parameters of my script.

hallow mortar
#

What is this params array used in, a handleDamage EH?

#

If so:

  • you don't need the type validation or default values; the EH will always provide the correct types and some value for all its params
  • you can't introduce an arbitrary new param in the middle. params interprets the params in order. The third param [in handleDamage] will always contain the damage value no matter what you call it, so trying to add hitBox there just makes hitBox contain the damage number and throws off every param after that.
proven charm
#

why am I getting so much junk with vehicles command that are not operable vehicles but walls, sandbags etc? is it because I used createVehicle to create them?

winter rose
#

you have to use setNoJunk on them first

#

otherwise no idea what you mean πŸ€·β€β™‚οΈ

proven charm
winter rose
#

ah, the vehicles command

#

afaik, it should return only drivable vehicles + weapon holders, but I may be wrong

#

an allVehicles could be nice if we need just a "all cars + bikes + helicopters + planes + drones" method

proven charm
#

yep

#

it doesnt return editor placed structures but it does return structures placed during the mission via createVehicle

#

or maybe not all strutures but things like portablehelipadlight_01_f.p3d & pallet_f.p3d

tribal sinew
#

Which event script should I ideally use to call setUnitLoadout? Can I use initserver.sqf or is there a more elegant one?

winter rose
#

depends

summer gale
#

its for players equipment.

tribal sinew
winter rose
#

who could have guessed setUnitLoadout was for equipment 😏
all joke aside though, what is the concern?
should the gear be set before the selection screen?
on mission start?
after mission has started?
why so many questions?
why do I add another one?

tribal sinew
#

Why are they all valid notlikemeow

#

It should be called before the briefing screen for sure.

winter rose
#

oh noes
anyway if you want gear set before mission starts, why not just use loadout editor in Eden Editor?

tribal sinew
#

Im guessing due to some randomization stuff but @summer gale go ahead on this answer.

winter rose
#

kicks AkcjaZnicz out of the server 😁

vapid scarab
vapid scarab
#

I.e. get all lamp objects and turn off lights

proven charm
limber panther
#

Hello!
I wrote a script but it doesn't work. I thought i made it right. Can someone help me identify, where is the problem?
after executing this: sqf ExecVm 'hadice\resp.sqf' i want this sqf file to run its code: sqf private _voj = _this select 1; removeBackpack _voj; _voj addBackpack "B_SCBA_01_F"; removeGoggles _voj; _voj addGoggles "G_RegulatorMask_F"; (backpackContainer _voj) setObjectTextureGlobal [2, "a3\supplies_f_enoch\bags\data\b_scba_01_co.paa"]; _voj addAction ["Drop respiration gear", { params ["_target", "_caller", "_actionId", "_arguments"]; removeBackpack _voj; removeGoggles _voj; }; ]; but in game nothing happens

vapid scarab
#

have you tried using 16? Remember that arma is wierd, vehicle is its word for a generic object.

proven charm
#

16 - TypeTempVehicle - temporary entity ?

#

gives empty array

vapid scarab
#

are there vehicles placed from editor and from zeus?

proven charm
#

none

vapid scarab
#

were you attempting to get all vehicles (actual vehicles) or buildings?

proven charm
#

actual vehicles

vapid scarab
#

so there are no vehicles placed, and the method that we think returns all (actual) vehicles didnt return anything?
PLACE SOME VEHICLES! Your soldiers need support

proven charm
#

no all vehs are created via script

vapid scarab
#

createVehicle?

proven charm
#

yes

vapid scarab
#

hmmmmm

proven charm
#

vehicles command gets those but also returns some junk

#

i can filter those out but im looking to optimize the code

tribal sinew
#

Asking just to be sure πŸ˜›

hallow mortar
#

setUnitLoadout is global effect

vapid scarab
#

different approach. Off the top of my head and as a guess: (as psuedo code)
_actualVehicles = vehicles select { _x isTypeOf [VEHICLE CLASS HERE] };

tribal sinew
proven charm
vapid scarab
hallow mortar
#

The whole point of vehicles is to detect actual vehicles. If it's returning non-actual-vehicles it may be worth making a bug report about that

proven charm
#

true

stable dune
tribal sinew
vapid scarab
hallow mortar
#

Fine.

The whole point of vehicles is to detect actual vehicles and a couple of other specific things that aren't actual vehicles. If it's returning all other non-actual-vehicles it may be worth making a bug report about that

limber panther
vapid scarab
# tribal sinew So executing it only on the server would be the best way here?

Yes.

I mention this as I have a specific scenario where this might be considered reasonable.
Alternatively, you can have the object owner handle the setUnitLoadout. So server handles calling it on AI, players client calls it on their player object. You would use remoteExec for this. Consider your design implementation before doing something like this.

tribal sinew
#

And Nikko too πŸ˜„

stable dune
vapid scarab
final radish
# hallow mortar What is this params array used in, a handleDamage EH?

Yep, only I made the EH a bit more complicated than it should be. So the type validation is intentional, I am planning on passing a value for a side ammunition type.
And interesting, I wasn't aware that there was a set order to params. In my other working scripts they seem to work fine and return expected values in any given order

hallow mortar
#

params are retrieved in the order they're passed, the names don't matter.

params ["_param1","_param2"];```
```sqf
private _param1 = _this select 0;
private _param2 = _this select 1;```
these are essentially the same
vapid scarab
# vapid scarab To start with, your probable issue is that you are selecting a null parameter. ...

Second, I strongly recommend using params ["_voj"] instead, as it more clearly defines what you are doing.
Edit: If _voj is a non-english word, then I may be wrong below here.
Lastly, I recommend not shorthanding variable names, as it makes it a little difficult for people to understand what they reading. _player or _unit is more descriptive and understandable than _voj.
(i dont mean to narc on you, just giving some tips)

hallow mortar
#

I'm pretty sure _voj is a readable name, it's just not in English

final radish
#

On a side note, there was an error being thrown that would have saved me so much time had it been logged in console instead of displaying on a screen that's covered up for several seconds before spawning into the server.

vapid scarab
#

both are valid. So long as get the order correctly, neither one makes a difference.

Its just that params ["_param1", ...] (i assume) is easier to read for most people. Consider having to select 10 parameters vs params 10 parameters.

#

And params also features data validation

final radish
vapid scarab
#

@limber panther does this select 0 fix the script?

hallow mortar
limber panther
#

@vapid scarab allright so simply changing 1 to 0 didn't make it working

#

let me explain a little bit what i'm trying to do

#

a player in the game presses button on the kyboard (i chose right control) and a dialog window opens up, in the dialog window player presses a button which executes the sqf ExecVm 'hadice\resp.sqf' and this sqf file should give the player a defined backpack, respirator and add an addaction on himself, this addaction will then be responsible for deleting the backpack and respirator previously given via the dialog window

stable dune
#

You can use

player execVM 'hadice\resp.sqf'

Then your player is used in your script.
If you do not use arguments. Your param select 0 is null,
So you need to use an argument when you execute the current script.

limber panther
#

@stable dune so replace sqf ExecVm 'hadice\resp.sqf' with sqf player execVM 'hadice\resp.sqf' and replace sqf _voj = select 0; with ```sqf
params ["_voj"];

stable dune
limber panther
stray jackal
#

You can also change _voj to player everywhere. Either or works

limber panther
winter rose
stable dune
#

Don't mess him head anymore πŸ˜…

winter rose
#

you did this!!1!1!

stray jackal
#

You're establishing the magic variable _this by passing it forward using Params.

#

Whatever you put before execvm is what your passing to the script

#

Params establishes this variable in the form of _this

proven charm
#

also params ["_voj"]; is same as _this params ["_voj"];

stray jackal
#

Magic variables are fun. They take time to understand, just trust us

stable dune
#

So now he have there

params ["_voj"];
_this params ["_voj"];
private _voj = _this select 0;
_voj = player;
_voj = _this;
limber panther
#

ok so i tested and it still doesn't work, let me paste here what i currently have:

#

on button click this script gets executed: sqf player ExecVm 'hadice\resp.sqf' and the sqf file contains this: ```sqf
private _voj = _this select 0;
removeBackpack _voj;
_voj addBackpack "B_SCBA_01_F";
removeGoggles _voj;
_voj addGoggles "G_RegulatorMask_F";
(backpackContainer _voj) setObjectTextureGlobal [2, "a3\supplies_f_enoch\bags\data\b_scba_01_co.paa"];
_voj addAction ["Drop respiration gear",
{ params ["_target", "_caller", "_actionId", "_arguments"];
removeBackpack _voj;
removeGoggles _voj;
};
];

winter rose
#

the code { } in addAction is not aware of the _voj variable

#

there is a matter of scope

limber panther
winter rose
#

that's normal
you should even have an error

limber panther
#

i didn't get any error

hallow mortar
#

You can't use _this select 0 with player execVM ... because in that format, _this is not an array

winter rose
#

player execVM "something.sqf

in something.sqf:

_this // it's player
player select 0 // error
params ["_voj"]; // takes the first array element or the argument if it's not an array
limber panther
winter rose
#

yep

#

hence params > _this select x (most of the time)

hallow mortar
#

_this select 0 would work if you were passing an array of arguments, e.g. [player] execVM ..., but if you're only passing a "naked" argument, it tries to select within that argument, not within the array of arguments - because select is used for selecting within things other than arrays, as well.
params is only used for parsing arrays, and is therefore smart enough to treat a non-array input as if it was a single-element array.

limber panther
#

great tips, thank you guys, so what i have now is following: sqf player ExecVm 'hadice\resp.sqf' and sqf params ["_voj"]; removeBackpack _voj; _voj addBackpack "B_SCBA_01_F"; removeGoggles _voj; _voj addGoggles "G_RegulatorMask_F"; (backpackContainer _voj) setObjectTextureGlobal [2, "a3\supplies_f_enoch\bags\data\b_scba_01_co.paa"]; _voj addAction ["Drop respiration gear", { params ["_target", "_caller", "_actionId", "_arguments"]; removeBackpack _voj; removeGoggles _voj; }; ]; and these curently finally work at least up to the point where it gets the texture however no addaction is added to the unit @winter rose already mentioned a possible problem there i think?

stable dune
#

My bad, I missed [ ] around the player so it's not the same.
But luckily ppl tell what is the difference between player execVM "script.sqf" and [player] execVM "script.sqf"

sullen sigil
stable dune
#

I need stop drinking

stable dune
limber panther
limber panther
#

so why is the addaction not being created? πŸ€”

stable dune
#

take ; before ] away

limber panther
#

ok, let me try πŸ™‚

hallow mortar
#

No, you're still trying to use _voj inside the addAction code, where it isn't defined

#
{ params ["_target", "_caller", "_actionId", "_arguments"]; 
   removeBackpack _target;
   removeGoggles _target;
}```
limber panther
#

and it finally works! i just spotted one little problem, on repeated use, the addaction stacks in the scroll menu, is there a way to delete the addaction after use?

limber panther
#

this way? ```sqf
_target removeAction _actionId

#

i'll test it

stable dune
#

Yes. Correct.

limber panther
#

thank you very much it works πŸ₯³

smoky hill
#

I want make a script that detect whether AI group low on ammo,if it is,then RTB for supply of call a supply logistic.But I don't know how to detect whether AI group low on ammo

#

Anyone know how to do that?

limber panther
#

prisoner, BAXENATOR, NikkoJT, Lou Montana, Capt Clueless and GC8 thank you all for helping me with this script ❀️

sullen sigil
# smoky hill Anyone know how to do that?
private _mygroup = yourgrouphere;
private _groupmagazinecount = (units _mygroup) apply {count (magazines _x)};
if ((_groupmagazinecount/count (units _mygroup)) < 3) then { //roughly less than 3 magazines on average per unit
  //do something...
};```
not exact but is the rough logic you want
smoky hill
#

thanks!

sullen sigil
#

no problemo, dont expect it to work first time

vapid scarab
#

So im trying to look into some custom squad marker drawing. I have seen the (from CBA) Extended_DisplayLoad_EventHandlers used. What is this and where do I find documentation on it?

sullen sigil
vapid scarab
sullen sigil
#

not as far as i could find

vapid scarab
#

Thanks for looking! I couldn't find anything myself.

sullen sigil
#

no worries; cba's wiki isnt anywhere near as useable as ace's

#

i mostly just use it for evading the scheduler 🀷

digital torrent
#

I am getting kicked out from official server when i try to put a civilian with the below code.
Message: remoteexec restriction #22
Anyone can help?

this setCaptive true;
this disableAI "MOVE";
this switchmove "Acts_AidlPsitMstpSsurWnonDnon01";

this addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
_killer globalChat format ["A civilian was killed by %1!", name _killer];
}];

[
this,
"Free Hostage",
"\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa",
"true",
"true",
{},
{},
{
(_this select 0) switchMove "Acts_AidlPsitMstpSsurWnonDnon_out";
(_this select 0) enableAI "MOVE";
(_this select 0) enableAI "AUTOTARGET";
(_this select 0) enableAI "ANIM";
(_this select 0) setBehaviour "COMBAT";
private _undercover2 = createGroup east;
[(_this select 0)] joinSilent _undercover2;
sleep 3;
(_this select 0) removeEventHandler ["Killed", 0];
(_this select 0) addMagazine "30Rnd_9x21_Mag";
(_this select 0) addMagazine "30Rnd_9x21_Mag";
(_this select 0) addMagazine "30Rnd_9x21_Mag";
(_this select 0) addWeapon "hgun_P07_snds_F";
(_this select 0) doFire (_this select 1);

  }, 

{},
[],
5,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd",[0,-2] select isDedicated,true];

granite sky
#

Just means that the server doesn't let you remoteExec BIS_fnc_holdActionAdd.

#

Probably the wrong place to ask why.

limber panther
#

Just as i thought i finally understand it, i made a script that doesn't work again. Although it looks identical as another similar script that works, this one doesn't. Anyone knows what could have gone wrong?

  • this script doesn't create the addaction on the given unit
params ["_voj"];
private _had1 = createVehicle ["LayFlatHose_01_CurveShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
private _had2 = createVehicle ["LayFlatHose_01_CurveShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
private _had3 = createVehicle ["LayFlatHose_01_StraightShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
_had1 attachto [_voj,[0.15,-0.21,1.21]]; 
_had1 setVectorDirAndUp [[0,-1,0], [-1,0,0]]; 
_had2 attachto [_voj,[0.15,-1.45,0.5]]; 
_had2 setVectorDirAndUp [[0,1,0], [-1,0,0]]; 
_had3 attachto [_voj,[0.15,-2.56,0.05]];
_voj setVariable ["fw_had1", _had1, true];
_voj setVariable ["fw_had2", _had2, true];
_voj setVariable ["fw_had3", _had3, true];
_voj addAction ["Drop flat hose standing", 
   { params ["_target", "_caller", "_actionId", "_arguments"]; 
   _had1A = _target getVariable ["fw_had1", []];
   _had2A = _target getVariable ["fw_had2", []];
   _had3A = _target getVariable ["fw_had3", []];
   deletevehicle _had1A;
   deletevehicle _had2A;
   deletevehicle _had3A;
   _target removeAction _actionId;
   }
];
granite sky
#

You have a bunch of missing semicolons in the addAction's script.

limber panther
#

this way? ⬆️

granite sky
#

yes.

limber panther
#

allright but that's not the source of the problem is it?

granite sky
#

Otherwise the code's probably not being called correctly.

#

But I don't know whether SQF ignores a garbage code object.

limber panther
vapid scarab
#

What is the difference between

loadout1 = [LOADOUT];
// and
_loadout1 = [LOADOUT];

More specifically, what does loadout1 do different to _loadout1?

sullen sigil
#

global vs local variable

#

where _loadout1 is local

vapid scarab
limber panther
#

let me show you

#

this one works perfectly: sqf params ["_voj"]; removeBackpack _voj; _voj addBackpack "B_SCBA_01_F"; removeGoggles _voj; _voj addGoggles "G_RegulatorMask_F"; (backpackContainer _voj) setObjectTextureGlobal [2, "a3\supplies_f_enoch\bags\data\b_scba_01_co.paa"]; _voj addAction ["Drop respiration gear", { params ["_target", "_caller", "_actionId", "_arguments"]; removeBackpack _target; removeGoggles _target; _target removeAction _actionId } ]; and this one doesn't work: ```sqf
params ["_voj"];
private _had1 = createVehicle ["LayFlatHose_01_CurveShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
private _had2 = createVehicle ["LayFlatHose_01_CurveShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
private _had3 = createVehicle ["LayFlatHose_01_StraightShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
_had1 attachto [_voj,[0.15,-0.21,1.21]];
_had1 setVectorDirAndUp [[0,-1,0], [-1,0,0]];
_had2 attachto [_voj,[0.15,-1.45,0.5]];
_had2 setVectorDirAndUp [[0,1,0], [-1,0,0]];
_had3 attachto [_voj,[0.15,-2.56,0.05]];
_voj setVariable ["fw_had1", _had1, true];
_voj setVariable ["fw_had2", _had2, true];
_voj setVariable ["fw_had3", _had3, true];
_voj addAction ["Drop flat hose standing",
{ params ["_target", "_caller", "_actionId", "_arguments"];
_had1A = _target getVariable ["fw_had1", []];
_had2A = _target getVariable ["fw_had2", []];
_had3A = _target getVariable ["fw_had3", []];
deletevehicle _had1A;
deletevehicle _had2A;
deletevehicle _had3A;
_target removeAction _actionId;
}
];

#

i feel like it's the same case and it looks the same to me

vapid scarab
#

But is the new function being executed on the server?

#

Or on the client?

limber panther
#

this is the first one (working one): sqf player ExecVm 'hadice\resp.sqf' and this is the second one (the broken one): ```sqf
player ExecVm 'hadice\had_s.sqf'

granite sky
#

shrugs

#

The code works.

vapid scarab
#

It looks like it should work. Lets try this anyway:

_addActionParams = ...;
[_voj, _addActionParams] remoteExec ["addAction", _voj];
#

Replace the addaction line with this

granite sky
#

For what it's worth, without the semicolons it simply doesn't run. So if you didn't actually bother testing it then you really wasted some time.

vapid scarab
granite sky
#

Original paste had a lot of missing semicolons in the addAction code.

sullen sigil
#

never used execvm in my life, never will. cba events system πŸ—Ώ

limber panther
granite sky
#

Apparently it does.

sullen sigil
#

best it stops it tbh

granite sky
#

It's fairly logical because it'll fail to create the code object, and then you have an invalid parameter to the addAction.

sullen sigil
#

help i cannot find the code object in eden

limber panther
#

anyways

#

my apologies John and Bax and thanks again for your significant help

sullen sigil
#

broken code =/= code that doesnt do what you want

granite sky
#

Also there's code that'll fail on execution and code that'll fail to even parse.

tough abyss
#

who's know what this ?

granite sky
#

For example if you try to use a global variable that doesn't exist, that'll parse fine (and hence create a valid code object) but fail on execution.

vapid scarab
limber panther
#

i'll tryto remember it for next time

sullen sigil
#

tl;dr do not use the scheduler (spawn etc)

#

...unless you're leopard

little raptor
sullen sigil
#

i know πŸ™‚

little raptor
sullen sigil
#

i do not know aside from nothing being flawless

#

i tend to rarely use waituntilandexecute anyways

little raptor
#

then what do you use instead of spawn?

sullen sigil
#

pfh for how often i want it to check then delete if necessary πŸ™‚

#

/waitandexecute loop

little raptor
#

same difference

sullen sigil
#

que

stable dune
# limber panther i tested that before you sent that message, yeah it works now, sorry about that,...

Don't know did anyone mentanion that you can use _arguments in addAction, so you don't need setVariable and getVariable if you want you could do

params ["_voj"];
private _had1 = createVehicle ["LayFlatHose_01_CurveShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
private _had2 = createVehicle ["LayFlatHose_01_CurveShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
private _had3 = createVehicle ["LayFlatHose_01_StraightShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
_had1 attachto [_voj,[0.15,-0.21,1.21]]; 
_had1 setVectorDirAndUp [[0,-1,0], [-1,0,0]]; 
_had2 attachto [_voj,[0.15,-1.45,0.5]]; 
_had2 setVectorDirAndUp [[0,1,0], [-1,0,0]]; 
_had3 attachto [_voj,[0.15,-2.56,0.05]];
_actionParams = [_had1, _had2, _had3];
_voj addAction ["Drop flat hose standing", 
   { params ["_target", "_caller", "_actionId", "_arguments"]; 
   _arguments params ["_had1", "_had2", "_had3"];
   deletevehicle _had1;
   deletevehicle _had2;
   deletevehicle _had3;
   _target removeAction _actionId;
   },
   _actionParams
];
sullen sigil
#

does isNil not return false if variable is not nil? thonk

hallow mortar
#

It's supposed to

limber panther
sullen sigil
winter rose
sullen sigil
#

..........

#

yes

#

thank you lou

#

i always do that

little raptor
# sullen sigil que

first of all, when you push a new waitAndExecute, you force CBA to sort the array
second of all, every code is run in a forEach, adding its own overhead. there's also overhead in constantly calling the condition and the code
third of all, waitAndExecute runs unscheduled, which reduces performance without care

so yes, spawn is still useful. just not when you want to time things accurately

sullen sigil
#

yes, i know it's still useful -- i use it in my undercover mod for the main loop -- but in 9 times out of 10 it is not

little raptor
#

9 out of 10 it is

sullen sigil
#

agree to disagree

smoky hill
#

Is there a extension for FSM on VS code?

torpid palm
#

I hope this is a simple fix to an issue i've been trying to figure out...

I am trying to set up a unitcapture scene where i have a squad of soldiers moving in a tactical wedge. I can record and playback everything just fine. But I cant seem to figure out how to get all the soldiers to move cohesively together. They never start together, which is causing them to not move like a group of soldiers would if they were moving in a tactial wedge.

any ideas?

digital torrent
granite sky
#

@torpid palm You mean like the leader starts moving a bit earlier?

torpid palm
granite sky
#

I guess you could give them all doStop orders and then individual doMove orders, but I don't think this guarantees starting times either, because it has to wait for the pathfinding.

torpid palm
#

im using unitCapture

#

They aren't sync'd or moving as AI

#

What i could be trying to do could very well be outside of the scope of what the engine allows for but im not too sure

#

been stuck on this for about two weeks now lol

granite sky
#

You mean the unitCapture data is synchronised but somehow it isn't on playback?

torpid palm
#

yeaaaah? I suppose that would be the best way to explain it. Let me see if I can record it rq

#

can't get the clip unfortunately.

I guess im going to just start back from zero. It has to be something that I'm doing wrong on the recording

winter rose
#

that's not a script error.

vapid scarab
#

Is there a CBA macro for #if and #ifdef?

little raptor
#

but it's not a good way

#

check cfgPatches

ashen ridge
#

I created a particle effect using vanilla stuff, it works perfectly, but it don't show itself to players more than 3000 meters away even if their vision (terrain and objects) is greater than that. This particle distance limit can be increased? Also set particle quality to High don't change that.

vapid scarab
winter rose
#

if they offer something useful enough for you to make it a dependency, do it
if you don't need their tools, don't use it

sullen sigil
# vapid scarab So im making my own mission framework. What benefits does using CBA to design ev...

in essence:

  • don't use the scheduler if the code needs to be completed in a timely manner or at a precise time, use cba instead
  • you can not use remoteexec, execvm etc by using cba's events systems. i prefer doing it that way by far, unsure if theres any difference network wise.
  • cba state machines have a few useful applications, examples of which are ace medical and grad civilians.
  • cba class event handlers and so on are quite useful for some use cases too; i've never used them myself though so cannot speak for them.
#

people will disagree with me here but that is common

#

as an example of when to use the scheduler for code, i use it in my undercover mod for the loop to check through AI to see if they can see the player and such. that isn't really time sensitive, so can be scheduled to reduce the performance impact. its just a while loop of 0.5 seconds, no other sleep, waituntil or scheduler specific functions in it

#

"KJW's Imposters" on the workshop if you wish to dissect it and look at how I use CBA versus the scheduler

kindred tide
#

are in, -, + supposed to work with code type? e.g
_someCode = {hint "Test"};
_array = _array + [_someCode];
_containsCode = _someCode in _array;

solid hill
#

Hey everyone. By any chance does anyone know a script to make a vehicle have the attributes of a repair truck. Basically I want to turn a pickup truck into a repair truck. Thanks in advance

vapid scarab
#

Are you using ace? or are you talking about vanilla arma?

kindred tide
#

i can add and remove code from array without needing any kind of handle

errant iron
#

@drifting portal remember the pylon manager GUI you wrote up for me? overall its worked pretty well and its remained untouched since last year, but recently i've noticed a couple players having issues with the jet spawning after they clicked the button
today it happened 8+ times in a row for one player, and this is what i gathered from the server log: 19:25:25 "***** CAS RESPAWN ***** SPAWNING JET FOR ..." 19:25:25 " ***** JET TYPE: " 19:25:25 " ***** LOADOUT: []" 19:25:25 " ***** FAILED TO SPAWN CAS JET" i'm inferring that LocalVehicleObject was objNull each time, but the issue stopped after i asked the player to re-connect
would you happen to know what might cause this?
script: https://sqfbin.com/bibiwoyisucuguwopasu

my guess is that there might be a race condition between the code scheduled in _SpawnButton (L460-L469) and the unload handler for your window (L47-L54), so the fix im going to attempt later is moving L458 (VehicleSelectionDisplay closeDisplay 1) to L467 (after deleteVehicle _LocalVehicle)

also i did get them to record it and send their log; the local jet spawned in correctly with the armaments changing to their loadout before they pressed spawn, and there were no errors related to the mission

vapid scarab
# solid hill Vanilla Arma

Beyond me right now. I don't know anything about the vanilla repair trucks (or that they even existed), Hopefully someone else gets to you.

solid hill
kindred tide
#

i'm not used to code being a variable type lol

kindred tide
#

(it's done in the config file)

solid hill
solid hill
errant iron
kindred tide
#

or put it in a spawn and slowly repair over time

queen cargo
#

when i ever will find the time ... i will write an UI Editor ...

kindred tide
#

are particles and lights the only things that can change color?

#

(in the 3D view, not the map/GUI)

warm hedge
#

What do you mean by change color?

kindred tide
#

like changing it from script dynamically

#

i can't change tint of a model material, can i?

#

what i'm trying to do is attach some thingy to a unit's shoulder that would change color based on what faction it belongs to

#

so far i could only think of using opaque particles

#

ideally it would be some small model like a ribbon with changeable tint

warm hedge
#

setObjectTexture/setObjectMatrial are thing

kindred tide
#

ooh, and i suspect _obj setObjectTexture [0, "#(rgb,8,8,3)color(1,0,0,1)"]; is for generating a flat-colored texture of any color?

south swan
kindred tide
#

great, thanks

ashen dock
#

Does anyone possibly know the scripts associated with the CAS support module??? Anyone??? Begging?

south swan
#

define "know", please. Where the script is located? How to work with it? How to modify it? What?

tough abyss
ashen dock
#

You know how you can call in a CAS mission with an unguided bomb? I want to know the script in that module that controls that...

south swan
ashen dock
#

We can probably find it in the config view right?

south swan