#arma3_scripting

1 messages ยท Page 108 of 1

tulip ridge
#

There's also hashmaps

ebon wing
meager granite
#

Idea: attachTo it to something

#

Something that doesn't have physics

ebon wing
meager granite
#

oh lol it was instantly suggested

tulip ridge
#

Yup

meager granite
#

Sorry for not reading the whole thing before replying thonk

tulip ridge
#

You're good

ebon wing
#

Oh, big fan

#

Anyways, yeah If thats the only way ig ill run that

#

So, just some invis obj should do yea?

tulip ridge
#

Yeah, game logic should do

meager granite
#

Logic is the simplest one, but I'm not sure how well it will work. Attached objects inherit simulation rate of whatever they're attached to, but I guess it might not be relevant for inventory actions?

ebon wing
#

As long as it cant be pushed, or airlifted and can still be opened.

ebon wing
#

Ill give it a try, thanks lads!

meager granite
#

Just tested it and it works, except crate no longer a physx object, so other object pass through it (vehicles), but not units.

ebon wing
meager granite
#

Yeah, probably

ebon wing
#

Sweet, thanks!

meager granite
#

Also logic is unit, you can createAgent it or use another basic object, I'd suggest HeliH but that's a helipad that AI can use, not sure if its a good idea.

#

UserTexture1m_F or something perhaps

#

Building seem to be very basic too

ebon wing
#

Good idea with the building - ill spawn it in right on the crate, Im doing everything inside SQF so my script is as plug and play as possible. Ill read up on making logic units!

meager granite
#

Got curious and tested it, you can hook the crate but it won't move anywhere

#

You can use enableRopeAttach to stop the action

ebon wing
#

So, I can just use enableRopeAttach on the crate?

meager granite
ebon wing
#

Thats definitely gonna come in handy in the future, didn't know it existed

#

More I do the more impressed I am with SQFs functions

meager granite
#

Wait till you encounter that something seemingly basic is impossible or require huge crutches and workarounds hmmyes

#

Actually attaching a crate to an invisible object is already a such workaround

ebon wing
#

Im at the point where I spend 1 hour going through the links in Additional info whenever I find a new function so I dont try to make workarounds for things I dont need

meager granite
ebon wing
#

Perfect reading when curled up in bed during a storm

meager granite
next kraken
#

how would i make all unit look at players on a dedicated server. i tried different things with doWatch in a loop, but no succeess. its just for immersion

meager granite
#

Also try glanceAt and lookAt

proven charm
#

or just setdir

meager granite
#

Not sure how MP-compatible these commands are though

#

Knowing Arma they might be completely local

tribal sinew
#

Is there an alternative for quickly creating smoke emitters apart from BIS_fnc_moduleEffectsSmoke?

tribal sinew
#

yeaah, i meant a more module-like approach

#

but thats fine too i guess, thanks

wary sandal
#

i have a file called "version.inc" in the root of my mission, and i want to #include it from a script in a folder called "functions"
what would be the path?

#

if i put the wrong path the game crashes for some reason

little raptor
grizzled cliff
#

how do you mean?

digital hollow
wind flax
#

Is there anyway to set the fromObject when using ropeCreate on an object which isn't under the transport class?

little raptor
#

no. it has to be transport

digital hollow
#

You can potentially use a helper object for rope start, and attach it where you need to. ace fastrope helper can be handy.

wind flax
vapid scarab
#

When scripting a module, how do I access synced objects?

south swan
sullen sigil
#

save me 30 seconds of github looking up im not supposed to be touching github im on a break

digital hollow
#

ace_fastroping_helper

fleet sand
# digital hollow `ace_fastroping_helper`

I have a general question for looking up a variable. How should i find variables like Cba_missionTime or Ace_Player, or Ace_mainActions Where are those types of variables stored ?

digital hollow
#

Unintentional reply? anyway, those are just global variables. (probably not ace_mainActions tho)

fleet sand
#

Yea sry didnt mean reply.

#

Is there a way to look all the globalVariables ?

digital hollow
fleet sand
#

Ok and is there a way to make this somehow to look all global variables from a certiann mod ?

digital hollow
#

Filter for mod tag in variable name.

fleet sand
#

Oh nice thank you very much.

limber thunder
#

Hi guys, I'm currently working on a script which should mark certain players from one side on the map. I have the part with the marking already done but am now facing a problem how to identify which player is from which faction and triggered the script. Accordingly, another part of the script should be triggered.
For example:
If a player from Bluefor has triggered the scirpt, the part which marks the Opfor players will be triggered.
Of course the same should work the other way around.

Do you have an idea how I can determine the side which triggered the script and execute a this or that function?

Thanks for your help ๐Ÿ˜‰

digital hollow
limber thunder
digital hollow
upper siren
#

Can someone explain to me why

["CAManBase", "Reloaded", { 
    params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"]; 
    //if (isPlayer _unit) exitWith {}; 
    _oldMagazine params ["", ["_roundsLeftold", -1, [0]]]; 
    systemChat format ["_roundsleftold: %1", _roundsLeftold]; 
}, true, [], true] call CBA_fnc_addClassEventHandler;

prints out _roundsleftold: any?

to me any is not a number so it should use the default -1 ,no?

sullen sigil
#

indeed

#

its a moment

upper siren
#

well, luckily any > 0 returns false, so I'll just go with it ๐Ÿ˜„

south swan
#

_oldMagazine seems to be not present at all when doing that meowsweats

upper siren
#

yup, I've tried it with rocket launcher, the RPG-7V2 from RHS

#

guess makes sense, at type of reload the shooting has happened so there's nothing in the launcher

south swan
#

me and my wording. "Empty" as in "no mag in weapon", sorry for confusion

upper siren
#

ah right, yeah so same basis

vapid scarab
#

what is a faster read operation?

  1. Reading from missionConfig
  2. Reading from missionNamespace variable
still forum
#

namespace

wintry yoke
#

I think I'm going in the right direction, just having trouble pulling the information for the missiles now. I'm using the RHS Apache, when I put in the command to pull weapon firemodes (hint str (getArray (configFile >> "CfgWeapons" >> currentWeapon player >> "modes"));) it only seems to be giving me information for the main gun and not the missiles. I also tried DenV's code here: https://community.bistudio.com/wiki/weaponsTurret, but it still doesn't tell me anything about the missiles

digital hollow
#

try weaponState vehicle turret syntax

wary sandal
#

can i find anywhere in the config the DLC icons?

#

CfgVehicles entries provide DLC names but not the icons

digital hollow
#

CfgMods

drowsy geyser
#

Just a quick question will the contact scripts be available for the base game in the future?

still forum
#

files in "contact" folder will not be added to basegame no. They will stay as separately loaded

wintry yoke
tough abyss
#

Just curious if configfile / missionconfigfile is also blocking or if its just configclasses

wary sandal
#

another question, how would i go retrieving all armed aircraft (planes, helis and drones) in the games?

#

i found this from someone's mission but this doesn't include drones and some aircraft like kajman and buzzard, any idea why?

("(configName(_x) isKindOf 'Air') && (getNumber(_x >> 'scope') == 2)") configClasses (configFile >> "Cfgvehicles")
hallow mortar
#

Kajman and Buzzard are both scope 2 and kindOf air, so they should be returned by that if it works at all.
Bear in mind this is returning an array of data type Configs, not an array of data type Strings (classnames), which might be affecting whatever you're trying to do with it.

wary sandal
# hallow mortar Kajman and Buzzard are both scope 2 and kindOf air, so they should be returned b...

maybe i'm doing something wrong in my code:

        {
            private _weapcount = count getArray (_x >> "weapons");
            private _currentVeh = _x;

            {
                if (_x isKindOf ["SmokeLauncher", configFile >> "Cfgweapons"]) then {
                    _weapcount = _weapcount - 1;
                };
            } forEach (getArray( _x >> "weapons"));

            if (_weapcount > 0) then {
                private _category = "";
                if (toLower getText(_currentVeh >> "vehicleClass") != "autonomous") then {
                    if (["plane", toLower getText(_currentVeh >> "simulation")] call BIS_fnc_inString) then {
                        _category = "Planes";
                    } else {
                        _category = "Helicopters";
                    };
                } else { _category = "Drones" };
                (aircraft get _category) pushBack (configName _currentVeh);
            };
        } forEach (("(configName(_x) isKindOf 'Air') && (getNumber(_x >> 'scope') == 2)") configClasses (configFile >> "Cfgvehicles"));

(sorry for indent)

#

basically it just takes that array of configs and sort them as strings in a hashmap looking like this

#

i'm not sure what the smoke launcher part does (and why is it even useful when working with aircraft?), again i just tweaked someone else's code

hallow mortar
#

This isn't the issue, but you don't need those toLowers; != and BIS_fnc_inString (by default) aren't case sensitive

wary sandal
#

ah, thank you

hallow mortar
#

(Aircraft countermeasures launchers are kindOf SmokeLauncher, so this should work for both air and ground)

wary sandal
#

wtf arma

#

thanks for the explanation

hallow mortar
#

They both work in fundamentally the same way, so one inherits from the other to save having duplicate implementations of the basic functionality. isKindOf checks the full inheritance tree.

wary sandal
#

maybe flares weren't a thing when they added smoke launchers, idk?

hallow mortar
#

That seems quite likely.

vapid scarab
# still forum namespace

How significant is the difference?

If you dont mind me asking, here is my scenario. Im asking more so out of curiosity than anything. I already having caching done.
Say I have all this data defined in a config in the mission file. Is it worthwhile exporting the data to namespace variables if its only being read a few times over the course of 2 hours for an individual player?

In my scenario, I have a faction with multiple loadouts defined for it (this is for a custom loadout script). The only time the data needs read is on mission start when players are assigned loadouts, whenever a player goes to view loadouts to change their loadout, and whenever a player changes their loadout.

sullen sigil
#

Caching takes like 30 seconds to script

#

Saves performance

#

You can measure the difference in debug console

mental vine
#
this addaction ["Get In",{(_this select 1) setpos [markerPos "exit1" select 0, markerPos "exit1" select 1, 0]}];
#

How would i add the radius parameter to this script?

#

I'd like for the addaction to only be avaliable for when you are within 5 meters.

fleet sand
mental vine
#

Thankyou! Do i have to always add in the other parameters?

fleet sand
#
this addAction
["Get In",{
private _getMarker = getMarkerPos "exit1";
(_this select 1) setpos [_getMarker select 0, _getMarker select 1, 0];
    },
    nil,
    1.5,
    true,
    true,
    "",
    "true",
    5,
    false,
    "",
    ""
];```
mental vine
#

Thankyou! Just curious as Im still fairly new to sqf and scripting in general. What was messy about it in the first place?

fleet sand
#

Its just for you so you can read it better. You can do it how ever you want.
But in my example i saved marker position in variable so i can use it in setpos and if need bee i can use it somewhere else but with your. You basicly are calling 2 times getmarkerpos when its only needed once.

mental vine
#

Gotcha thankyou!

stray jackal
#
_playerClose = [];
_markerpos = getMarkerPos "Solo_Arena_Area";
{
    if ((_x distance _markerpos) < 80) then 
    {
    _playerClose pushback _x;
    };
} foreach allPlayers;

_nearplayercount = count _playerClose;

try
{
if (_nearplayercount > 1) then
    {
        throw "Reduce Total Number of Players in Arena to 1";
    };
};

Does this make sense, I can't test multiplayer on my test server.

fleet sand
stray jackal
#

kick back and stop the script if more than 1 players is near the marker

#

using the throw

fleet sand
solid ocean
#

im trying to get this simple script to spawn a vehicle with an add action but its not working

#

any ideas

#
 
this addAction createVehicle _Dos_Drop_Pod = "Spawn Drop pod" getMarkerPos "pad1";

stray jackal
#

you're trying to apply the addaction to the vehicle or the addaction creates the vehicle

solid ocean
#

add action creates the vehicle

#

i was trying to be clever ive seen this teleport script before that has an interact and thought i could just use that to do vehicles but apparently not

stray jackal
#
            _Variable, //Thing that you want to apply the addaction to
                [
                    "Spawn Vehicle", //Text
                        {//Script
                                                    Your Vehicle creation Script
                        },
                    nil, //Arguments
                    1, //Priority
                    true, //showWindow
                    true, //hideOnUse
                    "", //shortcut
                    "true", //condition
                    10 // Radius for addaction to show
                ]
solid ocean
#

so the players interact with the terminal to get the vehicle

stray jackal
#

the _variable has to be an object assigned to that variable

solid ocean
#

oh so it can be anything then

stray jackal
#

yes

solid ocean
#

where do i define what vehicle i want to spawn though?

fleet sand
solid ocean
#

??

fleet sand
#

actuall no

#

Where you see Class_Name_Vehicle instead of that you want to put
Dos_Drop_Pod so like this:

this addAction ["Create Vehicle", {
    private _veh = createVehicle ["Dos_Drop_Pod", getMarkerPos "pad1",[],0,"None"];
}nil,1.5,true,true,"","true",10,false,"",""];
solid ocean
#

class name is the bottom one right?

granite sky
#

There's no comma after the }

solid ocean
#
    private _veh = createVehicle ["Dos_Drop_Pod", getMarkerPos "pad1",[],0,"None"];
},nil,1.5,true,true,"","true",10,false,"",""];```
fleet sand
#

yea between } and nil is missing comma ,

solid ocean
#

there we go

#

that did something

solid ocean
fleet sand
solid ocean
#

yeah thats what i need so people can walk into it and then choose a landing point

fleet sand
#

Make sure the marker is named pad1 and not Pad 1 or something like that.

solid ocean
#

im such a dumbass

#

its a marker

#

not an object

#

heres me wisihing it would appear on this

#

there we go

#

@fleet sand @granite sky my thanks amigos it works like a charm

stray jackal
#

the exitwith didnt work legion, so i defaulted back to the try catch.

try
{
    if (_nearplayercount > 0) then
    {
        throw "Reduce Total Number of Players in Arena to 1";
    };
}
catch
{
    format ["%1 Gladiator Detected, Beginning Solo Arena", _nearplayercount] remoteExecCall ["systemChat",-2];
};

_nearplayercount with just me in the area is absolutely showing as 1, but I'm getting the catch, where the throw isn't working.

#

I want it to check the player count in the radius and if its greater than 1, it terminates the code, until the if argument is met

fleet sand
still forum
stray jackal
#
try
{
    if (_nearplayercount > 0) then
    {
        diag_log "Inside throw";
        throw "Reduce Total Number of Players in Arena to 1";

    };
}
catch
{
    format ["%1 Gladiator Detected, Beginning Solo Arena", _nearplayercount] remoteExecCall ["systemChat",-2];
};

So I'm getting "Inside throw" showing in my server rpt. but the throw isn't displaying or stopping the script

upbeat valve
#

I have a coop mission where my friends command squads by making them squad leaders, making their squad mates playable units, and then having them be ai controlled at the start. Is there a way that I can prevent squad mates from respawning, until a squad leader dies, and then have all of the dead squadmates respawn, adn the alive ones teleport back to the respawn so the squad can be together again? Because what happens is, if one of us moves say 2km from the respawn, then gets in a fight, and half of the squad dies, then half of the squad will be with the squad leader while the other half is over at the respawn, and they have to walk 2km to reconnect with the squad leader. So in a nutshell our squads get split apart from us, their leaders, over time, and i cant come up with a fix

digital hollow
upbeat valve
#

So when i have a friends squadmate die, i sohuld just like spawn one in for them in zeus and connect them to their squad

digital hollow
#

Well, this is scripting. So consider spawning the AI via a script that runs on respawn.

dreamy kestrel
#

got a bit of a kerfuffle, after much logging and pulling hairs... addAction, I know for a fact I am getting the action to attach to the object successfully, I have the ID in the log. however, is not appearing in the menu. I wonder if it is a priority collision in the menu why it is not showing, having verified at least one other such action with the same priority?

dreamy kestrel
granite sky
#

Is -1000 even a valid priority?

dreamy kestrel
granite sky
#

oh yeah, 1m is very short.

dreamy kestrel
#

pulling my hairs out over it, after biasing the sector pressure, and running out of sectors in which to reasonably verify ๐Ÿคฃ

tough abyss
#

or is remotexecuting this command betterhttps://community.bistudio.com/wiki/playMusic ?

hallow mortar
#

BIS_fnc_playMusic is almost certainly using playMusic internally, in which case passing "" as the track class will stop whatever's playing

tough abyss
#

thank you

cobalt path
#

question, I am trying to spawn a missile that hits the target, I want it to spawn at random direction from the target, 2 km away, 1 km higher. I know how to get position of the target, but how do I do the whole random part?

#
[[8132.62,4392.19,1110.44], "ammo_Missile_Cruise_01", mfammotarget1, 180, false, [0,0,0.25]] spawn BIS_fnc_exp_camp_guidedProjectile;
#

to replace coordinates to say: spawn 2 km away, 1 km higher than mfammotarget1

#

The spawn at random direction part that alludes me

hallow mortar
#
_position = AGLtoASL (_targetObj getRelPos [2000, random 360]) vectorAdd [0,0,1000];```
- generate a random number between 0 and 360
- use that as a direction for getRelPos with distance 2000
- add 1000 to the Z axis of the resulting position
- convert from AGL as provided by getRelPos, to ASL as required by the function
(Last two might happen in opposite order depending on how the order of precedence shakes out, but the result is the same either way)
cobalt path
#

Hmm I am getting an error, saying its not a 3d vector

cobalt path
#

Nvm I found a work around

upper siren
#

Is there a smart way of removing a weapon + all compatible magazines from a units loadout?

meager granite
upper siren
lone forge
#

Sometimes when testing custom single player respawn scripts I end up locked out of the editor. Hitting [Esc] in mission doesn't bring up the menu to allow returning to the Eden editor so I have to kill the Arma3 task and re-launch it.

Anyone know if there is a keyboard shortcut or other way of getting a locked out mission to fall back to the Eden editor?

tribal sinew
#

How can I get the variable name of the unit that the player is controlling? To be precise - I want to do this inside initPlayerLocal.sqf, so the player object is _player.

#

What I wanna do is prevent intro from executing in case

  • The player is a zeus character
  • The player JiP'd
if (!_didJIP || _player != zeusCharacter_1) then {
    _null = [] execVM "scripts\intro.sqf";
}

This doesnt seem to work thinking

meager granite
#

Args are passed in _this

tribal sinew
#

yep yep

tribal sinew
#

should i try _this with select or #?

meager granite
# tribal sinew
diag_log ["_didJIP", _didJIP, "_player", _player, "zeusCharacter_1", zeusCharacter_1];
#

See what logs

#

Also get rid of that _null = assignment before [] execVM, its a relic of a buggy editor which required no returns in Init field.

tribal sinew
meager granite
#

Ah, you need to change your condition:

!_didJIP && _player != zeusCharacter_1
#

Show only only if NOT jip and NOT zeus

#

(only init-loaded players)

tribal sinew
#

wont it prevent JiP intro only for the zeus character?

meager granite
#

Or

!(_didJIP || _player == zeusCharacter_1)
```same thing
meager granite
tribal sinew
#

i want to prevent it for all of the players when they jip OR when its a zeus regardles of JiP

meager granite
#

You want it only for init-loaded players, right?

tribal sinew
#

wdym by init loaded?

meager granite
#

non-JIP

tribal sinew
#

oh, yes

meager granite
#
  • The player is a zeus character
  • The player JiP'd
    Did you want BOTH these conditions or either of them?
#

Thought you never wanted to show intro to Zeus players

tribal sinew
#

either, i dont want the intro for zeuses at all

meager granite
#

Only show intro if:

  • NOT JIP
    and
  • NOT Zeus
tribal sinew
#

oh yeah, sorry, my bad

#

i need another cup of coffee

#

works fine now, thanks

meager granite
#

Not sure if you can recover from that with some key combo

tough abyss
#

anyone know how to recreate the mission intro text you can set in editor? also triggers when you change scenario name (mainly looking for a function) able to make a ui element if i need to

meager granite
#

Check other in "See also"

tough abyss
#

yeah looks like a good place to start

lone forge
# meager granite Not sure if you can recover from that with some key combo

Thx m8. I'm working the BIS Helo MP Support modules into an SP mission and they do all kind of funky stuff with the MP respawn code kicks in. I don't have control over that directly so am hacking around it to make it play nicely with SP. It's mostly working but sometimes I lock myself out.

Might play around spawning a watchdog that kills the mission after a couple of minutes while debugging.

meager granite
#
{_x displayAddEventHandler ["KeyDown", {if(_this select 1 == 0x58) then {endMission "END1";}}]} forEach allDisplays
#

(0x58 is F12)

warped hornet
#

private _riotBackpack = _baseBackpack + ["JLTS_riot_shield_item",1];```

Hello I dont suppose anyone knows how id go about adding an array to an array of arrays. The method I have shown seems to throw errors.
hallow mortar
#

Array + merges two arrays. You have one array that is an array of two arrays, and one that is an array of a string and a number, so + will result in array of two arrays, one string and a number.
You just need to turn your riotshield thing into an array of arrays as well. It'll be an array of one array, but that still counts.
Or, in other words, use more []

warped hornet
#

Ah okay that makes sense

#

Thank you

astral bone
#

err- closeDialog doesn't seem to be working in eden ๐Ÿ˜…

proven charm
astral bone
#

That seems to not work in eden either. I am guessing it's b/c simulation isn't enabled in eden?

#

ah yes, I've just remembered, this isn't actually needed

keen stream
sullen sigil
#

is there a better way of doing something like this?
_x setVariable ["diwako_dui_radar_customIcon", format [GVAR(path), _rank]];
i want the path to be able to be changed via cba settings but it looks like it may not be compatible with format like that

#

wait, nvm, it works -- just forgot to set the variable properly later on derpWolf

coarse needle
#

LOL :D

#

As a drummer I can relate to the pain of that man

granite haven
#

can it take up perf having alot of unsused files setup in: CfgFunctions?
for example ive got quite some server side files that clients dont need to use ever, could i leave those out of CfgFunctions and just define them in a server side file with:

compile preprocessFileLineNumbers "";
meager granite
#

I don't think amount of function variables matters for performance what so ever

granite haven
#

also the other way around*

#

ok

granite sky
#

Well, they're all variables in the global namespace so maybe a tiny cost, but probably not measurable.

naive needle
#

Does someone know why on earth my units 20 seconds after killing getting teleported 1000 meter under the ground ?

granite sky
#

Unless it's your code that's doing it, it's off-topic :P

naive needle
#

Idk if its my code doing it meowsweats

#

idk if there is a scripting command which can cause such issues

#

it only happens with Units not agents

granite sky
#

You can certainly move bodies underground if you want to.

naive needle
#

but that would be like 2 meters under the ground, right ?

#

here they just 1000 meters under the ground

granite sky
#

This sounds like a "remove mods until it stops doing it" problem anyway.

naive needle
#

yea probably notlikemeow

ashen ridge
#

It's possible to make a mod that changes the total number of particles allowed in Low particles setting?

granite sky
#

Hopefully not? :P

tough abyss
#

is there anyway one can run code from the debug console or other interaction methods from a player and have the code run and persist through server restarts?

meager granite
#

I messed around with them some time ago and got an impression the max number is always the same

#

Quality only affects which particle config is used for generation

#

qualityLevel in particle configs

fair drum
eternal eagle
#

I need help getting in the direction of who knows how to change what weapons are available to specific aircraft, yall know anyone who csn help with that?

#

Specifically I wanna take the brimstone from FIRAWS and add it onto other aircraft than the tornado

eternal eagle
#

So I run that command where? I've never done anything with modding before

fair drum
#

this would be scripting not modding. You have a lot to read to get started:

#arma3_scripting message

If you are asking for one of us to write it for you, we can, just might be a bit due to life stuff

eternal eagle
#

I'm just trying to find the knowledge on how to make it changeable by players mid.mission

#

I'm assuming it's gonna take going into the mod file itself, saving a separate copy and modifying that one

fair drum
#

no need for mod. you'd put that command in the aircraft's init box in editor with no server filters since the command is a local execution command

eternal eagle
#

And it adds that weapon as a possibility to load mid missiom

fair drum
#

no, that overrides the pylons the aircraft has on mission load

eternal eagle
#

Gotcha

fair drum
#

whats available would be in the mod direction and thats a whole slope to go down

eternal eagle
#

Yesh

#

That's where I need to go

#

If we think of ordnance as diff magazines

fair drum
#

well i'm off to the gym, so i can help in a few hours

eternal eagle
#

Copy that, I'll keep digging

fair drum
eternal eagle
#

Oo bet

#

Ty

sullen sigil
#

is it possible to get the length of a line drawn on the map

#

i.e not necessarily straight, could double back on itself

#

oh theyre called polylines, neat

ashen ridge
#

I want the best situation: The particle count limit from Ultra and the particle density from Low.

#

I have a super bomb in my mission. On Low there is no "vanishing" smoke. On High, very soon, smoke start to get deleted because it reach the limit. So the guy use High to avoid smoke deletion and have smoke deleted all the time hmmyes

#

I want to increase particle limit on Low setting to lead smoke in my mission to another level, and tell my mates to use Low when we are playing.

#

Low is the best configuration now for this experience, but it still have some "vanishing" smoke, High is just a waste of time, at least on this mission, smokes vanish all the time.

#

It's so strange because people set particles to Ultra High Super believing that they will have a better particles experience, but they will not have ๐Ÿซ‚

#

They will have immersion breakes everywere.

mild pumice
#

Hello guys.
Is there a way to reduce the volume of a video played with BIS_fnc_playVideo ?
I tried fadeSound, fadeMusic, fadeRadio, fadeSpeech, fadeEnvironment but none of them worked

ashen ridge
#

Those commands you tried affecs the entire game.

#

It's viable to extract the video sound, change the volume, and remix it into the video?

keen stream
#

It would be nice to have some kind of ArmAReactions tumblr like devops, dba and security reactions for example.

waxen hearth
#

Just to be clear before I make a ticket - is there no event handler to detect if unit's identity/face has been changed?

elfin inlet
#

Hi. So I'm writing a script to create a deployable shield around a vehicle, and then another script to delete said shield whenever the use decides to. I got the shield to deploy as intended, but I'm having trouble getting the other script to delete the shield.

Here is the deploy script

_MedPathfinder = _this;
_speed = 0;

_MedPathfinder setVariable ["MedPathfinder_ShieldUp", true];
_MedPathfinder setVariable ["MedPathfinder_ShieldDown", false];

_MedPathfinder setFuel 0;

_shield = "Aux501_Weapons_Grenades_Special_Object_Squad_Shield" createVehicle [0,0,10000];
_shield attachTo [_MedPathfinder, [0,-1.4,-2], "attach_point"];
_shield setVectorDirAndUp [[0,0,-1], [-1,0,-1]];
_shield disableCollisionWith _MedPathfinder;

And the delete script

_MedPathfinder = _this;

_MedPathfinder setVariable ["MedPathfinder_ShieldUp", false];
_MedPathfinder setVariable ["MedPathfinder_ShieldDown", true];

_MedPathfinder setFuel 100;

deleteVehicle _shield;
waxen hearth
#

why two variables?

_MedPathfinder setVariable ["MedPathfinder_ShieldUp", false, true];

false - shield is down
true - shield is up
#

I suggest adding true on third index to make it public

elfin inlet
#

I'm new to writing scripts so I did what I knew worked. I'm doing two user actions on the vehicle. Scroll wheel to activate the shield, and scroll wheel option to deactivate it

waxen hearth
#

how do you call this script?

elfin inlet
#
class UserActions
    {
                 class PathfinderShieldUp
        {
            animPeriod=5;
            condition="(player == driver this) AND (alive this) AND !(this getvariable [""MedPathfinder_ShieldUp"",false])";
            displayName="<t color='#FE2E2E'>Deploy Shield";
            displayNameDefault="<t color='#FE2E2E'>Deploy Shield";
            onlyForPlayer=0;
            priority=10;
            radius=100000;
            showWindow=0;
            statement="0 = this spawn Aux85th_FnC_MedPathfinderShield_fnc_PathfinderShieldUp";
            textToolTip="<t color='#FE2E2E'>Deploy Shield";
            userActionID=54;
        };
        class PathfinderShieldDown
        {
            animPeriod=5;
            condition="(player == driver this) AND (alive this) AND !(this getvariable [""MedPathfinder_ShieldDown"",false])";
            displayName="<t color='#FE2E2E'>Disable Shield";
            displayNameDefault="<t color='#FE2E2E'>Disable Shield";
            onlyForPlayer=0;
            priority=10;
            radius=100000;
            showWindow=0;
            statement="0 = this spawn Aux85th_FnC_MedPathfinderShield_fnc_PathfinderShieldDown";
            textToolTip="<t color='#FE2E2E'>Disable Shield";
            userActionID=54;
        };
    };
#

I see where the two variables doesn't make sense but when I only used one it didn't work. Though it could've been a skill issue on my part

waxen hearth
#

! means "not", therefore the return value has to be false in order to satisfy the condition

elfin inlet
#

AH

#

That makes much more sense

waxen hearth
#

so use ! when shield is down (shieldup = false) and dont use it when its up (shieldup = true)

elfin inlet
#

Gotcha

waxen hearth
#

!(this getvariable [""MedPathfinder_ShieldUp"",false])
// shield is up, do something
(this getvariable [""MedPathfinder_ShieldUp"",false])
// shield is down, do something

#

now, im not big on scripting either, so i might have missed some detail

elfin inlet
#

All good. That's working for me with the single variable. So thank you for that information.

#

Now I just need to get the shield to delete itself on the execution of the second script

#

that's the only thing not working now

waxen hearth
#

one variable less in this world

#
_MedPathfinder = _this select 0;
_speed = 0; //what is this for?

// shield is up
_MedPathfinder setVariable ["MedPathfinder_ShieldUp", true, true];
// check how much fuel the vehicle has
_MedPathFinderFuel = fuel _MedPathfinder; 
// store fuel in variable
_MedPathfinder setVariable ["MedPathfinder_Fuel", _MedPathFinderFuel, true];
// remove fuel from vehicle
_MedPathfinder setFuel 0;

_shield = "Aux501_Weapons_Grenades_Special_Object_Squad_Shield" createVehicle [0,0,10000];
_shield attachTo [_MedPathfinder, [0,-1.4,-2], "attach_point"];
_shield setVectorDirAndUp [[0,0,-1], [-1,0,-1]];
_shield disableCollisionWith _MedPathfinder;
// store the shield inside a variable so we can address it later
_MedPathfinder setVariable ["MedPathfinder_Shield", _shield, true];

remove part:

_MedPathfinder = _this select 0;
// shield from previous function is now addressed
private _shield = _MedPathfinder getVariable "MedPathfinder_Shield";
_fuel = _MedPathfinder getVariable "MedPathfinder_Fuel";

_MedPathfinder setVariable ["MedPathfinder_ShieldUp", false, true];
// return the amount of fuel vehicle had before
_MedPathfinder setFuel _fuel;

deleteVehicle _shield;

I hope I didnt forget something lol

#

let me know if it works

ancient apex
waxen hearth
#

Vortex is asking for help with his functions

ancient apex
#

oh ok

elfin inlet
#

The speed was a leftover from another script I was using as the baseline

#

I did get it working butttt I do like the addition of tracking its fuel level. We typically don't worry about it but I appreciate the attention to detail

#

So I'm testing your script now

#

@waxen hearth Tis not working friend. I try to activate the shield and nothing happens

waxen hearth
#

can i see your cfgFunctions?

elfin inlet
#
class CfgFunctions
{
    class Aux85th_FnC_MedPathfinderShield
    {
        class functions
        {
            class PathfinderShieldUp
            {
                file="85th_Vics\Pathfinder\init\fn_PathfinderShieldUp.sqf";
                class PathfinderShieldUp
                {
                };
            };
            class PathfinderShieldDown
            {
                file="85th_Vics\Pathfinder\init\fn_PathfinderShieldDown.sqf";
                class PathfinderShieldDown
                {
                };
            };
        };
    };
};
waxen hearth
#
class CfgFunctions
{
    class Aux85th
    {
        tag = "Aux85th";
        class Aux85th_MedPathfinderShield
        {
            class createShield
            {
                file = "\85th_Vics\Pathfinder\init\fn_PathfinderShieldUp.sqf";
            };                
            
            class deleteShield
            {
                file = "\85th_Vics\Pathfinder\init\fn_PathfinderShieldDown.sqf";
            };
            
        };
    };
};
#

cfgVehicles >> yourVehicle

class UserActions
    {
        class PathfinderShieldUp
        {
            animPeriod=5;
            condition="(player == driver this) AND (alive this) AND !(this getvariable [""MedPathfinder_ShieldUp"",false])";
            displayName="<t color='#FE2E2E'>Deploy Shield";
            displayNameDefault="<t color='#FE2E2E'>Deploy Shield";
            onlyForPlayer=0;
            priority=10;
            radius=100000;
            showWindow=0;
            statement="[this] call Aux85th_fnc_createShield";
            textToolTip="<t color='#FE2E2E'>Deploy Shield";
            userActionID=54;
        };
        class PathfinderShieldDown
        {
            animPeriod=5;
            condition="(player == driver this) AND (alive this) AND !(this getvariable [""MedPathfinder_ShieldDown"",false])";
            displayName="<t color='#FE2E2E'>Disable Shield";
            displayNameDefault="<t color='#FE2E2E'>Disable Shield";
            onlyForPlayer=0;
            priority=10;
            radius=100000;
            showWindow=0;
            statement="[this] call Aux85th_fnc_deleteShield";
            textToolTip="<t color='#FE2E2E'>Disable Shield";
            userActionID=54;
        };
    };
#

change your statements to be as above

elfin inlet
#

Got it working now

#

Thank you very much for your help. I'm sure I would've brute forced it eventually but this taught me much

waxen hearth
#

You're welcome

fair drum
tulip ridge
#

What'd be a good way to check if all of a vehicle's seats are filled?

tulip ridge
gray bramble
#

@tough abyss they are as blocking as "player". I haven't looked at the code, but presuming they weren't complete idiots, all it'll do is return a reference to a confignode in memory. The clue is that configclassES allows you to pass in code and have it run - uninterrupted.

#

I previously proposed a command, I think I used atomic as a keyword, but deschedule would be another option, such that atomic { a=1; b=2 } would run that block as a critical section.

polar belfry
#

Can you spawn just an explosion?

warm hedge
#

No. You can spawn a bomb

polar belfry
#

ok

woven rivet
#

Where do i put init.sqf?

#

do i put it beside mission.sqm

#

or inside mission.sqm

#

nvm

stray flame
#

Hello, I am having issues with my mod that is suppose to save loadout on death and then restore it when spawned back in

#

I need help

#

I would post this question in config makers but I think this issue may be closer to that of a script

#
HAMSCH_EH_onPlayerKilled = player addEventHandler ["Killed", {
    
    
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    player setVariable ["HAMSCH_Saved_Loadout",getUnitLoadout player];
}];


HAMSCH_EH_onPlayerRespawn = player addEventHandler ["Respawn", {
   
    private _loadout = player getVariable ["HAMSCH_Saved_Loadout",[]];
    player setUnitLoadout _loadout;    
    
    params ["_newObject", "_oldObject"];
    deleteVehicle _oldObject;
    player switchMove "UnconsciousFaceDown";
    player playMove "UnconsciousOutProne";

    private _radio = (_loadout select 9) select 2;
    if (_radio isEqualTo "") then 
    {
        hint "Radio not found";
    };
}];


#

What could be the fault?

#

it works in like lan tested server but I tried it with friends and nothing

#

it just sets the loadout to be the same as when the match started

#

the previus script
initPlayerLocal.sqf
onPlayerKilled.sqf
onPlayerRespawn.sqf
tasked to do this was very reliable

stable dune
#

Have you tried change your player.
In 1st

_unit setVariable ["HAMSCH_Saved_Loadout",getaunitloadout _unit];

2nd

params ["_newObject","_oldObject"];
private _loadout = _oldObject getVariable "HAMSCH_Saved_Loadout";
_newObject setUnitloadout _loadout;
stray flame
#

Huh?

#

ah

#

replace 1 with 2

#

So like this?

HAMSCH_EH_onPlayerKilled = player addEventHandler ["Killed", {
    
    
    params ["_unit", "_killer", "_instigator", "_useEffects"];
   params ["_newObject","_oldObject"];
private _loadout = _oldObject getVariable "HAMSCH_Saved_Loadout";
_newObject setUnitloadout _loadout;


HAMSCH_EH_onPlayerRespawn = player addEventHandler ["Respawn", {
   
    private _loadout = player getVariable ["HAMSCH_Saved_Loadout",[]];
    player setUnitLoadout _loadout;    
    
    params ["_newObject", "_oldObject"];
    deleteVehicle _oldObject;
    player switchMove "UnconsciousFaceDown";
    player playMove "UnconsciousOutProne";

    private _radio = (_loadout select 9) select 2;
    if (_radio isEqualTo "") then 
    {
        hint "Radio not found";
    };
}];```
#

or no I think thats wrong

#

may need to be more specific

woven rivet
#

I keep getting this error even though there is a ;
would anyone be able to help?

cosmic lichen
#

ctrlDeleteAllControls? That#s not a valid command

woven rivet
#

Oh

cosmic lichen
#
allControls _ctrlGroup apply {ctrlDelete _x} ;

is what you wanna do

#

or just ctrlDelete _ctrlGroup

woven rivet
#

I will try that now

#

Still getting an error...

#

Nvm

#

It works

#

Thanks ๐Ÿ™‚

agile pumice
#

my eventhandler doesn't seem to trigger. No hints when sel is changed:

createDialog "RscAssetIdentificationDialog";

_comboBoxCtrl = (findDisplay 1337) displayCtrl 2100;
_comboBoxCtrl_Options = ["Technicals", "Light Armor", "Heavy Armor"];
{_comboBoxCtrl lbAdd _x} forEach _comboBoxCtrl_Options;

_pictureCtrl = (findDisplay 1337) displayCtrl 1200;
_pictureCtrl ctrlShow false;

fn_comboBoxCtrl_curSelChanged = {
    params ["_control", "_lbCurSel", "_lbSelection"];
    hint str format ["%1\n%2", _lbCurSel, _lbSelection];
    //_pictureCtrl ctrlShow true;
};

_comboBoxCtrl ctrlAddEventHandler ["onLBSelChanged", "_this call fn_comboBoxCtrl_curSelChanged"];```
still forum
#

name is wrong

#

onLBSelChanged doesn't exist and should give you a script error

#

also _this call... is not needed

#

_comboBoxCtrl ctrlAddEventHandler ["LBSelChanged", fn_comboBoxCtrl_curSelChanged];

agile pumice
#

I forgot about that. I'm going to try and add the event handler to the config's RscControlsGroup class instead

#

Thanks dedmen

#

I am attempting to open/load the gui editor project I had saved to config earlier. Trying ctrl + I to no avail with configFile >> "RscAssetIdentificationDialog" (error display not found)

cosmic lichen
#

How did you save it to config?

tulip ridge
#

I have a damage handler running on a vehicle, and when returning 0 for it (to make the vehicle not take damage) it would repair the vehicle if it was already damaged

Rough breakdown:

  1. Vehicle is damaged (let's say 0.3 damage) before the damage handler is created
  2. Damage handler is created
  3. Vehicle takes damage, damage handler returns 0 (for no damage)
  4. Vehicle is restored to 0 damage
#

I'm not running any setDamage commands, so I assume the return value from the damage handler is being set for the vehicle's health, rather than subtracting from it (or well, I guess adding to it)?

granite sky
#

Yes. So's the input damage value.

#

To prevent new damage you have to go look it up with getHit or whatever.

tulip ridge
#

Ah gotcha, seems odd though
Main reason I was doing it this way was because I needed the amount of damage the vehicle should take, appreciate it

tulip ridge
# granite sky To prevent new damage you have to go look it up with getHit or whatever.

So basically just get the damage of the selection and re-apply the damage?
Something like:

this addEventHandler ["HandleDamage", {
    params ["_vehicle", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit"];
    _selectionDamage = _vehicle getHit _selection;
    _vehicle setHit [_selection, _selectionDamage]; 
}];
dreamy kestrel
#

Q: about commanding menu expressions, they can be multiple lines? i.e. something like, ["expression", "do something; do something else"]?

tulip ridge
#

Should be able to
I went to go check my chat wheel mod to see but then realized they're all one line function calls

tulip ridge
agile pumice
# cosmic lichen How did you save it to config?
// Predefined controls
#define IDC_OK                1
#define IDC_CANCEL            2
#define IDC_AUTOCANCEL        3
#define IDC_ABORT            4
#define IDC_RESTART            5
#define IDC_USER_BUTTON        6
#define IDC_EXIT_TO_MAIN    7

class RscAssetIdentificationDialog
{
    idd = 1337;
    onLoad = "[""onLoad"",this] call fn_handleDialogControls"; // changed expression and function call
    
    class controls
    {
        ////////////////////////////////////////////////////////
        // GUI EDITOR OUTPUT START (by J. Hachi, v1.063, #Cygyku)
        ////////////////////////////////////////////////////////

        class Background: IGUIBack
        {
            idc = 2200;
            x = 0 * GUI_GRID_W + GUI_GRID_X;
            y = 0 * GUI_GRID_H + GUI_GRID_Y;
            w = 40 * GUI_GRID_W;
            h = 25 * GUI_GRID_H;
        };
        class ScrollBar: RscSlider
        {
            idc = 1900;
            text = "Page"; //--- ToDo: Localize;
            x = 15.5 * GUI_GRID_W + GUI_GRID_X;
            y = 23.5 * GUI_GRID_H + GUI_GRID_Y;
            w = 9 * GUI_GRID_W;
            h = 1 * GUI_GRID_H;
            type = CT_SLIDER;
            style = SL_HORZ;
            tooltip = "Change page";
            onSliderPosChanged = "_nul = [""sliderMoved"",this] call fn_handleDialogControls;"; // added onSliderPosChanged event handler
        };
        class Picture: RscPicture
        {
            idc = 1200;
            text = "#(argb,8,8,3)color(1,1,1,1)";
            x = 0.5 * GUI_GRID_W + GUI_GRID_X;
            y = 0.5 * GUI_GRID_H + GUI_GRID_Y;
            w = 39 * GUI_GRID_W;
            h = 22.5 * GUI_GRID_H;
        };
        class StructuredText: RscStructuredText
        {
            idc = 1100;
            text = "RSC Asset Identification Cheat Sheet"; //--- ToDo: Localize;
            x = 9 * GUI_GRID_W + GUI_GRID_X;
            y = -1.5 * GUI_GRID_H + GUI_GRID_Y;
            w = 22 * GUI_GRID_W;
            h = 1 * GUI_GRID_H;
            sizeEx = 3 * GUI_GRID_H;
        };
        ////////////////////////////////////////////////////////
        // GUI EDITOR OUTPUT END
        ////////////////////////////////////////////////////////
    };
};```
granite sky
tulip ridge
#

Yeah fair point, was thinking I needed to apply the damage manually from my first instance

cosmic lichen
#

Try missionConfigFile >> "RscAssetIdentificationDialog"

agile pumice
#

That worked, thanks. I should have known

tulip ridge
#

I may just be having a moment but I'm trying to switch over a percent and set a value based on it. Just something like:

_somePercent = ...;

switch (_somePercent) do
{
    case _somePercent >= 10: {...};
    case _somePercent...
};
#

(Also I'm aware that the example isn't correct, just wanted some sort of example)

hallow mortar
#

โœจ linearConversion โœจ

tulip ridge
#

Awesome, works fantastic

digital lodge
#

When I changed the line from removeItem to removeItems because I wanted to delete all items of a given type, not just one, the script did not remove any at all. Do you have any idea why?

if (
    !params [
        ["_itemClassNames", [], [[]]],
        ["_side", nil, [east]]
    ]
) exitWith {
     ["MAJ_fnc_removeItem invalid arguments: %1", _this] call BIS_fnc_error;
};

private _sideUnits = units _side;

{
    private _unit = _x;
    {
        if (typeName _x == "STRING") then {
            systemChat format ["removed %2 from %1", _unit, _x];
            _unit unassignItem _x;
            _unit removeItems _x;
        };
    } forEach _itemClassNames;
} forEach _sideUnits;
twilit scarab
#

Is there anyway to make it so if you take a picture of am object with the Camera from WS it will activate a trigger for a task. Basically want to do a gather intel task where the goal is to take a photo of a SAM Battery but not sure if thats even possible

digital hollow
#

A "take photo" action, condition must have camera, script checks line of sight for the target. Overall concept anyway. Take it in parts.

waxen hearth
#

is there anything I could use to check that opened arsenal is that from main menu?

mental vine
#

So here I have a trigger that activates when a player gets within 2 meters of the downed pilot in this case pilot_2. The script functions fine however I am getting annoyed that I have to constantly change the variable for each new pilot e.g. pilot_3 pilot_4 and so on.

#

is there a way I could make it so i don't have to change the variable each time?

fair drum
#

findIf

mental vine
#

How would I implement that in?

fair drum
#

are these pilots all near each other? or are you having the player go to different parts of the map

mental vine
#

different parts of the map

digital hollow
mental vine
#

So I would just put that where I have the pilot variable instead?

#

like sqf [synchronizedObjects thisTrigger join player; synchronizedObjects thisTrigger enableAI "MOVE"; synchronizedObjects thisTrigger setCaptive false;

digital hollow
#

Read the biki page and see what the command returns, that will tell you how to get the pilot object.

mental vine
#

I get that it gets my an array of what objects are synchornized but I don't understand how I actually use that array within the activation field.

mental vine
#
player distance thisTrigger <2;
#

Why can't I just do this as the condition and ```sqf
thisTrigger join player; thisTrigger enableAI "MOVE"; thisTrigger setCaptive false;

#

this as the activation? As I understand it thisTrigger is just whatever the trigger is synched too correct?

warm hedge
#

thisTrigger is the trigger object. I think you want to use thisList

#

Also enableAI and setCaptive uses an object not an array

mental vine
#

wouldn't thislist be an array then?

warm hedge
#

Which means you can use forEach

mental vine
#

I still don't really follow... I just ended up abandoning using a trigger all together and exclusively used the actual pilots init field. seems to work fine now.

formal stirrup
#

Is there anyway to switch camera but keep actions and the scrollWheel?

meager granite
#

Logic constantly suffocates though so you'll need to disable the effect

#

Or you can just create your own mousewheel menu or other menu

wary sandal
#

how can I get RscCombo to work?

#

when i simply put the wiki example the Combo doesn't appear

#

i tried adding items to it but nothing

#
import RscCombo as Combo;

...

        class testCombo: Combo
        {
            x = "pixelW * 5";
            y = "0.1 + 0.05 + 0.005 + pixelH * 5";
            class Items
            {
                class Alphabet
                {
                    text = "Sort alphabetically";
                    default = 1;
                };
                class Mod
                {
                    text = "Sort by mod";
                };
            };
        };
meager granite
#

Try adding items with script

#

Also make sure you reload mission completely for configs to update (load it again in file selection)

#

Default has

    w = 0.12;
    h = 0.035;
```though
wary sandal
#

this is my new config

#

but it still doesn't work

#

(i reloaded the mission)

meager granite
#
15:59:41 Warning: no idc entry inside class KingOfHill_Badges/controls/testCombo 
#

Warning in RPT but no popup window

#

With idc your config works

wary sandal
#

idc gets me all the time

#

thank you for the help, it does show up now

cosmic lichen
#

Just be careful with absolute values for x,y,w,h. It might not look for others as it looks for you.

wary sandal
#

i don't mind stretching

wary sandal
#

any ideas why my Items won't appear?

class WTK_MIS_gamemodes
{
    class Waves
    {
        text = "Waves";
        default = 1;
    };
    class Invasion
    {
        text = "Invasion";
    };
};

class gamemodeCombo: Combo
{
  x = "pixelW * 5";
  y = "0.1 + 0.05 + 0.005 + pixelH * 5";
  w = 0.2;
  h = 0.05;
  class Items: WTK_MIS_gamemodes { };
  idc = 302;
};
#

i might be misunderstanding what the : symbol does

#

from my understanding it copies all the properties from another class

astral bone
#

Have you tried putting them in directly?
To me that seems right but- welp xP

wary sandal
#

so it should theorically work when it's separated right

astral bone
#

Could do an import

#

Import from a file and said file just has what would be in items

#

Wait is it import or include-

wary sandal
#

a specific one

#

but i don't think it'd work

astral bone
#

Include should

#
Class items{
#include MyFile.hpp
};
\\ MyFile.hpp
Class Option_A{
Text="A";
Default=1;
};
Class Option_B{
Text="B";
};
#

Im on mobile so please excuse and capital mistakes x3

#

But the games just sees it as 1 big file.

Class items{
\\ MyFile.hpp
Class Option_A{
Text="A";
Default=1;
};
Class Option_B{
Text="B";
};
};
wary sandal
#

you can include directly inside classes?

astral bone
#

Yea, its basically copy pasting the file referanced right where the ibclude is

hallow mortar
#

#include is a preprocessor command, which means it's handled before any of the code is interpreted or executed by the game. All preprocessor stuff is resolved by the time the game sees the file; it is essentially invisible and can be done anywhere, as long as the end result is valid.

sudden yacht
#

Help. Forgive me i was not sure where to post this. Recently i tried uploading OGV. video to custom mission, however the audio becomes out of sync the longer it plays. Does anyone know of a solution?

dreamy kestrel
# wary sandal

not so much stretching but the multi-display scenario...

fair drum
kindred zephyr
dreamy kestrel
wary sandal
#

what if i want my ui to appear on one screen only

dreamy kestrel
lofty lily
#

Good afternoon. Im having trouble with the teleport script not working for me

wary sandal
brittle hedge
#

any idea why this code doesnt work?
while {true} do {
_orange = nearestObject [player, "Orange"];
_distanceThreshold = 5;

if (alive _orange && {_distanceThreshold > (player distance _orange)}) then {
    player setDamage 1;
    hint "You were killed by the nearby orange!";
};

sleep 1;

};

tulip ridge
#

What "doesn't work"?

dusk knot
#

I dont know why, but im unable to figure out how returns work at all?
Heres a small code snippet, the _return variable contains the right boolean, but whenever i try to access it from another script it just says either any or <null> and i cant seem to figure it out, any help is appreciated. This is just some sample code.

CheckPermissions = {
  private _isAdmin = false;  //Getting this value from somewhere..
  private _return = true;
  if(_isAdmin == false) then {
    _return = false;
  };

  _return;
}
dusk gust
# dusk knot I dont know why, but im unable to figure out how returns work at all? Heres a sm...

To use the _retrun, you need to call the script and assign it. Ex

CheckPermissions = {
  private _isAdmin = false;  //Getting this value from somewhere..
  private _return = true;
  if(_isAdmin == false) then {
    _return = false;
  };

  _return;
};

_evaluateFunction = [] call CheckPermissions;

_evaluateFunction;
// _evalutateFunction will be true or false, depending on what your function should return.
dusk knot
dusk gust
#

Are there any script errors? It looks like it should be proper

brittle hedge
#

it wont activate correctly
i have an Orange which is with the variable orange and an normal infantry dude

#

the _orange is the orange and then the player in line 2 should be the player

#

from my limited knowledge

dusk gust
brittle hedge
#

ok

#

ill try at it

dusk knot
dusk gust
# dusk knot Im stupid, the only ones are from calling it from outside the function.. isn't i...

I wouldn't ever use preprocessFile to process a function; What I would do is add the file into a "Functions" header, then its always usable.

//description.ext
class CfgFunctions {
  class Functions {
    // Tag is the prefix of your function ex. Kru_fnc_whateverFunctionName
    tag = "Kru";
    file = "core"; // If you have sub-folders in your mission, you will want to navigate to it here Ex. \core is where you have functions
    class whateverFunctionName {};
  };
};


// Above is now compiled on run-time of mission, and no need to pre-process any file.

_valueReturned = [] call Kru_fnc_whateverFunctionName;

Using a preprocessFile will process the file and run the function, but as far as I know should basically never be used unless necessary

dusk knot
#

Thanks! Ill look into it more

wind egret
#

need help figureing out my rp life files with how to config and move to editor

queen cargo
tulip ridge
#

For a boolean parameter, do you need to do params ["_name", false, [true, false]] or will just either true or false work for available types?
Only one is needed, thought I remembered there not being an example on the wiki but I was incorrect.
https://community.bistudio.com/wiki/params#Examples

meager granite
#

"that kind of feature can be really dangerous because all scripters will start to paste all their codes into one Non-scheduled piece of code, so We're not planning to changing anything on current implementation"

#

The last time this feature was asked for

queen cargo
#

@candid sun ... so add this line to the very end: (toString _retStr) and the function will work

#

@meager granite and that is a serious concern
most people simply do not know when some code has to be run in one step
still i dont feel like thats a reason against some callBlock command

meager granite
#

It indeed isn't. There are countless ways to fuck up performance already.

cosmic lichen
#

The value in the brackets just represents the allowed data type not its actual value. Would be bad for numbers otherwise meowsweats

thick merlin
#

Does anyone know of a script that will respawn a/any vehicle group with ai a set number of times?

#

Thanks.

errant jay
#

Could someone help me/point me to the right direction for this;

I'm having AI in the game that give Intel when dead, that part i know how work with, but how can i make it so that it also adds new map markers with the same command?

warm hedge
#

Any scripts you made so far?

errant jay
warm hedge
#

Example 3 says a way to inject a code

errant jay
#

Sorry, but im having a bit of a stupid moment and don't see it?

warm hedge
#
// Add a scripted event that notifies all clients via systemChat when the intel is found:
[
    this,
    "IntelObjectFound",
    {
        params ["", "_foundBy"];
        private _msg = format ["Intel found by %1", name _foundBy];
        _msg remoteExec ["systemChat", 0];
    }
 ] call BIS_fnc_addScriptedEventHandler;```This part
errant jay
#

Sorry, i'm very new to scripting so don't understand that, but i'll try to figure it out thanks

errant jay
#

where on that part should i put that it executes a sqf? cause i cant seem to figure it out

digital hollow
#

You can replace the code in the {...} to do your own stuff, like run sqf, or unhide/create marker.

errant jay
#

thanks, figured it out now

rich frost
#

does the MusicEH MusicStart trigger on a Headless Server?

ornate whale
# rich frost does the MusicEH MusicStart trigger on a Headless Server?

It executes where it has been added. That means it has local effect. So assuming all computers run the following piece of code, you can do this to exclude headless clients or a dedicated server from having the EH.

if (hasInterface) then
{
     addMusicEventHandler [...];
};

You have to check where you are putting this code, if it's init.sqf it runs only on the server. If you place it in a trigger, in default, it will run on all computers. Always check BI wiki page.

thick merlin
#

Ive been using this script suite for vehicles with ai respawning set number of times.But after respawning group twice the group is being spawned as civilian.Civilian sided T-140's...Cant work it out

#

heres how iam executing it -

#

veh = [this, 100, 10, "spawnMarker", "operationMarker", "Attack", "start"] execvm "Init_respawn.sqf";

hallow mortar
#

If the headless system actually simulates playing music (even though it doesn't output) then yes it'll work. If it just ignores music commands, then no.

thick merlin
#

Trying tp paste code for script but being blocked...

#

Init_respawn

granite sky
#

christ, why mediafire

#

Use pastebin or something.

thick merlin
#

pastebin wont let me...

granite sky
#

You're banned from pastebin? :D

thick merlin
#

no

rich frost
thick merlin
#

never used it b4

rich frost
thick merlin
#

pastebin is telling iam not allowed to post...Iam in Australia..

ornate whale
next kraken
#

evening ! is saySound broken in terms of adjusting volume in the description.ext somehow?

#

volume is not changing for me

#

mhhh

winter rose
#

what is saySound?

next kraken
#

sorry...this commands

#

ls1 say "barking"

#

works

#

it still ignores the volume definition here

#

{
name = "bark"; // display name
sound[] = { "sounds\bark.ogg",5, 1, 250 }; // file, volume, pitch, maxDistance
titles[] = { 0, "bark" }; // subtitles
};

#

and the distance too

#

i tried another command, which does nothing

#

playSound3D ["sounds\bark.ogg",ls1];

winter rose
#

yes, playSound3D takes an absolute path, see playSound3D

winter rose
next kraken
#

what is an absolute path please?

#

yes

#

no difference to hear at this command

#

for noise

sleek token
#

for mods it is like in the example

prefix\addon_name\folders\data.ogg
#

so full specified relative to the pbo

#

for missions you can get the first with "getMissionPath"

#

This will return the absolute path until inside your mission folder (like where init.sqf and stuff is located)

next kraken
#

i tried to get it in the debug console with the "getMissionPAth", but i dont get it

#

shouldnt it be just the missionname then like this:

#

playSound3D ["Operation_Silent_Viper_1\sounds\bark.ogg",ls1];

#

i do not fully understand

sleek token
#

no

tulip ridge
#

The mission path isn't just the name

sleek token
#
playSound3D [getMissionPath "sounds\bark.ogg",ls1];
tulip ridge
#

Shouldn't need the mission name

winter rose
#

this now yes

sleek token
next kraken
#

great,that works! thanks a lot !meowsweats

sleek token
#

Remember read the docs and examples carefully ๐Ÿ˜„

next kraken
#

yea, working a bit too long today i guess^^ ๐Ÿ˜ฌ

unreal scroll
#

Hi guys, recently I created a report about the problem I faced: https://feedback.bistudio.com/T175874
Say, I have two functions:

fnc_getitems = {
    _magstoremove = [123];
    [_magstoremove] 
}; 

fnc_check = {
    _set = ["",0,[]]; 
    _magstoremove = _set#2;  
    _magstoremove
};
call fnc_check; //returns []

Both have the same local variable name inside, but, following the logic of most programming languages, it should have different scopes. so _magstoremove variable should live only withing each function scope.

But if I call the second function in this way:

fnc_getitems = {
    _magstoremove = [123];
    [_magstoremove] 
}; 

fnc_check = {
    _set = ["",0,[]]; 
    _magstoremove = _set#2;  
    call fnc_getitems; // calling the first function, no matter with params or without
    _magstoremove
};

call fnc_check; // returns [123]
  • seems like this variable leaks from one function to another.
    Leopard said that it is normal.
    Did I miss something?
ivory lake
#

call runs code inline

#

essentially

#

although hmm the way I understood it was the same as you and it should be a different scope but i guess it's more inline than I thought

little raptor
#

following the logic of most programming languages
SQF is not like other programming languages. it doesn't have "functions".

unreal scroll
#

Mmm... It's not very intuitive yet. Where is it described in more detail?
Just maybe don't mislead people with the name "functions" then?

south swan
#

not a problem / works as intended / use private keyword on varibles in the inside scope if you don't want it to modify outside ones blobdoggoshruggoogly

unreal scroll
#

A local variable is only visible in the Script, Function or Control Structure in which it was defined.

SQF is not like other programming languages. it doesn't have "functions".

works as intended
You guys are contradicting yourselves and the manual.

granite sky
#

Local variables get passed into child scopes. It's a bit... unusual.

sullen sigil
#

its beautiful

granite sky
#

Easy to fuck up in ways that are very hard to spot.

unreal scroll
#

Local variables get passed into child scopes. It's a bit... unusual.
Of course they should pass there. But I suppose, not a local variable, defined inside the child scope/function (that is not exsist?) passes to the upper scope?! ๐Ÿ˜

granite sky
#

what

sullen sigil
#
private _var = 123;
private my_fnc_thing = {
  _var
};
call my_fnc_thing```
will not return 123
#

however if you do not private it i (think) it will

granite sky
#

Yes it will.

sullen sigil
#

wtf is the point of private then

granite sky
#

lol

little raptor
south swan
#

"private" = "variable belongs to this scope and not up" = "variable would be destroyed when this scope is destroyed" ๐Ÿคทโ€โ™‚๏ธ

sullen sigil
#

i dont know im so tired

granite sky
#

Actually it'll throw a syntax error because private my_fnc_thing is invalid :P

little raptor
sullen sigil
#

i just prefix all local variables with private

little raptor
#

my_fnc_thing is global...

sullen sigil
#

oh yeah

unreal scroll
#

OMG. Okay, let's forget programming, just putting private anywhere I could get ๐Ÿ™‚

sullen sigil
#

sqf is its own beast and its a brilliant one

granite sky
#

There should have been a callSafe that creates a fresh scope.

sullen sigil
#

callThread ๐Ÿ˜ƒ

granite sky
#

It's not a thread :P

sullen sigil
#

it is now

#

ive graced it with the kjw naming

little raptor
#

iirc it does

south swan
granite sky
#

Yeah but it doesn't return values or call immediately.

sullen sigil
#

hell yeah because we all love the scheduler

#

(it would be somewhat usable if people didnt use the damn scheduler as a way to wait)

little raptor
granite sky
#

Uh. It does in SP and not in MP.

#

Armaaaa

little raptor
granite sky
#

In SP right :P

little raptor
#

yeah

granite sky
#

abomination of the day

little raptor
granite sky
#

I wouldn't bother. Feels like the window for that particular design decision is past.

#

Curious how much performance penalty there is for creating a fresh scope though.

vapid scarab
granite sky
#

If you use a different profile for each mission, sure.

vapid scarab
#

Thats about what I thought. How do I access the set difficulty?

molten yacht
#

Can anyone tell me the right language to program a trigger with to detect only planes/helicopters

#

like "enemy present, but only works if it's a plane/helicpter"

opal zephyr
#

use inkindof and side

fair drum
#

or whatever enemy side is

molten yacht
#

So these are "players, don't leave this area" sam sites

#

and players are blue

#

so that should be west instead of east?

fair drum
#

yes

molten yacht
#

Thanks.

tough abyss
#

ok, im trying to get my first script to work in arma 3... Its a fine wine of copy pasteing ๐Ÿ™‚
But it doesnt quiet work and im not sure why
I want one pp-effect at day time and one at night time:

if !(daytime > 19.5 OR (daytime > 0 && daytime < 4.7)) then { hint "DAY"; DAY = ppEffectCreate ["colorCorrections", 1501]; DAY ppEffectEnable true; DAY ppEffectAdjust [0.95, 0.95, -0.03,[0.0, 0.2, 1.0, 0.0],[1.0, 1.0, 1.0, 0.6],[0.2,1.0,0.5,-0.5]]; DAY ppEffectCommit 0; ppEffectDestroy NIGHT; } else { hint "NIGHT"; NIGHT = ppEffectCreate ["colorCorrections", 1501]; NIGHT ppEffectEnable true; NIGHT ppEffectAdjust [0.88, 0.88, 0.003,[0.9, 1.6, 1.0, 0.01],[0.45, 0.52, 0.55, 0.3],[0.5,1.0,1.5,1.1]]; NIGHT ppEffectCommit 0; ppEffectDestroy DAY; };

golden verge
#

where does one find default sounds to play though a script

unreal scroll
#

@tough abyss You script works. Why do you think it isn't?
You just don't need to check daytime for negative values, I doubt it could happens ๐Ÿ™‚

golden verge
#

i did this currently
"3DEN_visionMode" call BIS_fnc_playSound;
and it works i dont know where to find the sounds i actually want to play

#

im just lost as my "3DEN_visionMode" doesnt have a .wss on the end

tough abyss
#

*ofc i have also tried the script in the debug console

#

maybe there is a smarter way to switch pp effect at a certain time... for example 19:00

unreal scroll
#

You need to make a loop to check conditions, otherwise it runs only once - at the mission start ๐Ÿ™‚

tough abyss
#

aha

unreal scroll
#

Need an example?

tough abyss
#

can you guide me in the right direction? or even better, complete the code

#

yes please

unreal scroll
#
// The scrip works even without it, but it is better to adjust variables from the very beginning
DAY = ppEffectCreate ["colorCorrections", 1501];
DAY ppEffectAdjust [1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]];
DAY ppEffectEnable true;
DAY ppEffectCommit 0;

NIGHT = ppEffectCreate ["colorCorrections", 1501];
NIGHT ppEffectAdjust [1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]];
NIGHT ppEffectEnable true;
NIGHT ppEffectCommit 0;

[] spawn {
    while {true} do { // you can use your own condition, with 'true' it runs all the time the mission is running
        sleep 30; // the period in seconds
        if (daytime <= 19.5 && daytime >= 4.7) then { // it is better to use non-invert logic, it is better for debugging
            hint "NIGHT";
            ppEffectDestroy DAY;
            NIGHT = ppEffectCreate ["colorCorrections", 1501];
            NIGHT ppEffectEnable true;
            NIGHT ppEffectAdjust [0.88, 0.88, 0.003,[0.9, 1.6, 1.0, 0.01],[0.45, 0.52, 0.55, 0.3],[0.5,1.0,1.5,1.1]];
            NIGHT ppEffectCommit 0;
        } else {
            hint "DAY";
            ppEffectDestroy NIGHT;
            DAY = ppEffectCreate ["colorCorrections", 1501];
            DAY ppEffectEnable true;
            DAY ppEffectAdjust [0.95, 0.95, -0.03,[0.0, 0.2, 1.0, 0.0],[1.0, 1.0, 1.0, 0.6],[0.2,1.0,0.5,-0.5]];
            DAY ppEffectCommit 0;
        };
    };
};
tough abyss
#

ah man! even with comments and all!

#

many many thanks man!

unreal scroll
#

NP

tough abyss
# unreal scroll NP

ok last n00b question i hope...
Can i execute the code from an objects init? like in my image i posted ? Do i need to name the "variable name" to something special?
Or is the only/best way to include it into the missions init.sqf?

unreal scroll
#

You can run your code from any object init - the object itself just need to exist at the needed time.
But it is recommended to use logical layout - like, global scripts in mission init field. Or in sqf files or in functions, called from there, or from special sqf files like initPlayerLocal or initServer. Scripts for objects - in the object init, if needed.
As for variables - it is better to use prefixes, and not to use simple words for variable naming.
DAY = bad
MyMod_Day_effect or MyMod_DAY = good

tough abyss
#

ah many thanks again!

#

will elaborate with it!

fervent wyvern
#

hi, anybody knows how to detect if a door from, in this case, a container is open?, i have no clue how to do it

fleet sand
unreal scroll
#

Animations can be retrieved via the config viewer - you need to find the object >> animationSources or so.

kindred zephyr
#

Hello fellas,

Is there a command to set control attributes like padding when they are created using

ctrlCreate
```?

Im trying to do the aligment of the columns for a ListNBox control since everything is aligning to the right.
https://community.bistudio.com/wiki/CT_LISTNBOX
warm hedge
#

Nope. You want to make a control class

meager granite
#
_packet set ["score", (_packet get "score") + _final_score];
```Wish there was a shorthand of something like:
```sqf
_packet add ["score", _final_score];
```muh microseconds
#

And same for arrays but with indexes

polar belfry
#

is there a way to spawn an explosive charge on a timer?

#

like spawn a demo charge that will go off in x seconds

meager granite
polar belfry
#

thanks

#

can I do this with missiles as well ?

meager granite
#

Try it

polar belfry
#

will do

meager granite
#
private _hits_hashes = _unit getVariable "hitparts_by_hash" getOrDefaultCall [_hit_hash, {createHashMap}, true];
```I love hash maps ๐Ÿฅน
#

Wish getVariable was also able to do that

#

getVariableCall or something

#

Or use same name for ENTITY getOrDefaultCall ARRAY

still forum
still forum
# granite sky Curious how much performance penalty there is for creating a fresh scope though.

Every scope is a "fresh scope"
The difference is that sub-scopes have a reference to their parent.
If local variable cannot be found in current scope, its parent is searched, and all the way up the chain.

what private does is don't go up to search in parents when setting the variable.
VBS also has a "privateAll" command that basically severs the connection to the parent
essentially all variables set after running privateAll will be implicitly private

But that also means if you then want to read a specific variable from parent scope. You can't.
So they added another "import" command that allows you to load a variable from parent scope into the current one, so you can access it.

native hemlock
#

I'm guessing what I'm encountering with nearestObjects vs nearEntities is a bug. On an empty map using BIS_fnc_codePerformance nearestObjects [player, ["Man"], 50];averages 0.005 ms, player nearEntities ["Man", 50] averages 0.0039 ms. Placing down about 80 AI with enableSimulation false outside of my 50 meter radius results are now 0.0058 for nearestObjects and 0.0078 for nearEntities. If the AI are within the radius though nearestObjects is 0.059 ms and nearEntities is 0.014ms. I haven't tested this yet in a multiplayer environment or with more objects on the map.

unreal scroll
#

It's much clearer now, thanks. So it is better to look at sqf "functions" like just a piece of code at the same hierarchical level.
But does spawn has different behavior from it, as mentioned above?

still forum
#

Spawn creates a new instance of a script. Instead of executing things in the current script
Also spawn runs asynchronously. So it couldn't refer to variables in another script that has exited and was deleted long ago.

kindred zephyr
unreal scroll
#

Thanks, I read most of A3 manuals a long time ago already, just wanted some explanation from people familiar with the structure, to avoid the problems described above.

sullen sigil
#

scheduler is an important read as other scripts can influence the speed of it and shouldn't really be used to just wait in your code

#

it is useful for running high cost code that you cant send out to an extension or something however cba functions really should be used for while loops, sleeps etc

unreal scroll
#

and shouldn't really be used to just wait in your code
Alternatives? CBA functions? Without error logging? Not a good choice for me.

sullen sigil
sullen sigil
#

can also just use diag_log if need be

south swan
#

yeah, because SQF scheduler checking "should this piece of code run now" is totally worse than CBA's scheduler loop checking that same very thing ๐Ÿฟ

unreal scroll
#

they will return script errors if you have an error
No they won't. Man, I'm digging into it for four or five years actively ๐Ÿ™‚

sullen sigil
#

yes they will

#

its executing the same code

#

just not scheduled hmmyes

unreal scroll
#

No, CBA functions will NOT return eny errors inside its code. Believe me, or just check it.

sullen sigil
#

you are probably writing bad code or testing it badly then

#

because it does

#

i use cba per frame handlers for my capital ships mod extensively and whenever i run the mod in release branch it bitches at me 24/7 for no angular velocity commands

unreal scroll
#

I don't see the point in arguing with you. Just look at what I write.

sullen sigil
#

no

#

i know when im right which is right now

south swan
#

All code that has a visible effect for the user or requires time specific guaranteed execution shall be written in unscheduled space.

sullen sigil
#

(cba cba cba its for cba)

unreal scroll
#

Especially for KJW who doesn't even bother to verify elementary things which he claims.

[{
    params ["_unit"];
    speed _unit > 0
},{
    params ["_unit"];
    _veh = [];
    if (speed _veh > 0) then {};
    hint "All is done";
}, [player], 3] call CBA_fnc_waitUntilAndExecute;

Catch the error please.

sullen sigil
#

may i recommend you try and test your "verifying" outside of cba

#

because there is no undefined variable error in base a3

#

oh wow what the fuck is happening therer

#

oh well it gets the point across anyway

unreal scroll
#

Oh wait, you can't read the log? Okay, O'll help you, this is without CBA:

16:19:32 Error in expression <    _veh = []; 
    if (speed _veh > 0) then {}; 
    hint "All >
16:19:32   Error position: <speed _veh > 0) then {}; 
    hint "All >
16:19:32   Error speed: ะขะธะฟ ะœะฐััะธะฒ, ะพะถะธะดะฐะปัั ะžะฑัŠะตะบั‚
16:19:34 Ref to nonnetwork object 1825876: <no shape>

This is with CBA:

south swan
#

editing the code after getting the reply is kinda low

sullen sigil
#

oh cool we be changing our examples after the fact now

#

how desperate are you to win an internet argument

#

because i am not at all

#

i know when i am right which is right now

#

please do not try and argue about functions that you rather clearly seldom use when they are the community standard

#

it just makes you look stupid

unreal scroll
#

editing the code after getting the reply is kinda low
Man, I'm writing from memory, I'm not in game every time.
Trying to shift the focus is silly. You are being shown that CBA does not return an error. You claimed that it does.
What are you talking about?

south swan
#

except it does

unreal scroll
#

Examle please, for the case provided above.

sullen sigil
#

you misunderstand what he means by scheduler

exotic gyro
#

You can check this by running the diag all active sqf scripts

sullen sigil
#

scheduler is just something that decides should this bit be run now

#

sqf scheduler is The Scheduler

#

cba scheduler is the handler that goes oop still got to wait until this execute

#

sqf scheduler is just dragged down by other scheduled scripts

south swan
#

CBA looping over all waiting scripts every frame is equivalent to their own scheduler implementation

exotic gyro
#

"scheduler" in this context is unclear and I hate that it means two things now

south swan
# unreal scroll Examle please, for the case provided above.
16:21:57 Error in expression <ams ["_unit"]; 
    _veh = []; 
    if (speed _veh > 0) then {}; 
    hint "All >
16:21:57   Error position: <speed _veh > 0) then {}; 
    hint "All >
16:21:57   Error speed: Type Array, expected Object``` from literally your new example
exotic gyro
#

Besides the Accursed Scheduler

sullen sigil
#

sqf scheduler is just called the scheduler because it has no other name

#

in practice it is just the sqf scheduler

exotic gyro
#

stop it

sullen sigil
#

because it checks what should be run and stuff

south swan
#

because we're having a stupid argument in the Internet

#

and back to dual mening of "scheduler" - i've tried to prevent that by explicitly telling "CBA's scheduler loop"

unreal scroll
#

What's this all about? It looks as stupid as possible. The topic:

they (CBA functions) will return script errors if you have an error.
There is one of hunderds examples I had, that proves it doesn't. Any questions?

exotic gyro
#

just don't use the scheduler for things you want to actually run

sullen sigil
sullen sigil
exotic gyro
#

The Scheduler

south swan
#

it errors when run with CBA. It errors when run in vanilla. Same behavior, no extra difficulties involved

exotic gyro
#

The Accursed Beast

sullen sigil
#

The Scheduler (derogatory)

kindred zephyr
#

lower case s to make it the lesser scheduler

sullen sigil
#

sqf scheduler is useful for things like kjw imposters where i do a lot of LOS checks etc

#

stops it taking up too much framerate

#

aside from that

unreal scroll
#

I don't have any errors from CBA functions errors. Never had. With any version.

sullen sigil
#

yuck

south swan
#

and once more

sullen sigil
#

i bet he has showscripterrors turned off

south swan
#

i mean, i have it disabled as well, i'm just running in 3DEN where it's on by default blobdoggoshruggoogly

unreal scroll
sullen sigil
#

lmao

native hemlock
#

Results get worse for nearEntities with larger number of mission objects. Using the most heavy mission.sqm I could find (Altis Life) and standing in the middle of nowhere nearestObjects [player, ["Man"], 50] was 0.0057 and player nearEntities ["Man", 50] was 0.0148.

sullen sigil
#

with how fucked that pause menu is

exotic gyro
sullen sigil
exotic gyro
sullen sigil
#

i can guarantee either you have a mod breaking cba or you have script errors turned off

south swan
sullen sigil
#

oh yeah that too ๐Ÿ˜‚

#

holy shit this is so embarassing

queen cargo
#

CBA is a frame eater
change my mind

kindred zephyr
sullen sigil
#

you also think theres no such thing as excessive macro usage X ๐Ÿ˜‰

south swan
#

~you're still~in a dream~frame eaaateeeer~

exotic gyro
#

Kjw's giant pull request

sullen sigil
#

i wouldnt do that to you

#

probably

#

probably not

#

(i will)

upper siren
unreal scroll
#

have you tried, you know, actually moving your goddamn unit for the condition to turn true?
Hm, it works from a console, but not for server scripts.

CBA is a frame eater
No, it is just hard to debug on a server.

queen cargo
sullen sigil
#

thats so mean

upper siren
#

MACROs are great for eh.. borrowing code from other mods

south swan
#

that sounds awfully close to "scripts that run on server don't show errors on my local screen" which is strange

queen cargo
sullen sigil
#

armas netcode is something but its not "im going to share every script error with every connected client" something

sullen sigil
#

wait you are mildly interested

#

not mildly infuriating

#

i always thought your username was mildly infuriating

upper siren
#

After excessive exposure to Arma that would be more correct

sullen sigil
#

thats why i thought it

south swan
#

Mildly_Overexposed

upper siren
#

Although CAD and forum software are doing their part, not sure what's worse

south swan
#

inb4 "i've opened FreeCAD forums once and my life changed entirely"

upper siren
#

I'll never touch the curse that is FreeCAD, the paid ones are bad enough

kindred zephyr
unreal scroll
#

@south swan that sounds awfully close to "scripts that run on server don't show errors on my local screen" which is strange
Even if the server is local? Does it seem strange to you? ๐Ÿ™‚

still forum
# south swan yeah, because SQF scheduler checking "should this piece of code run now" is tota...

CBA's code only checks until it finds one that shouldn't run.
Which might be the first, so it might only check one piece of code whether it should run.
But the engine always checks all scheduled scripts, even if you have hundreds/thousands. or atleast until the 3ms time limit is over.
Which might even already be over before it manages to execute the first line of script because the checking/sorting took too long

still forum
south swan
#

i mean, if we're at "thousands of threads" territory - we're only one (although big) assumption from "thousands of waiting entries in CBA's waitAndExecArray getting sorted every frame when the new ones are added" ๐Ÿ™ƒ

#

but that's arguing for arguing sake already, i just admit i've never written or debugged anything big enough to get either of solutions even close to their limits

still forum
south swan
#

eyyy, heavy artillery is here

still forum
still forum
native hemlock
#

Reducing the distance from 50 to 5 nearestObjects [player, ["Man"], 5] is now 0.0042 and player nearEntities ["Man", 5] is around 0.0146.

still forum
unreal scroll
#

@still forum One moment, I'm making the test function.

unreal scroll
#

WTF... I can't reproduce it now with test functions. I need to dig in - there could be more specific cases, as I used nested CBA functions (maybe it was the cause?).
But this is the reason I was needed to rework all the mod (hundreds of CBA function calls written before) to spawn procedures - I just didn't see any error inside.
So, I mistook the bug for a feature, and never thought it is the bug - so it is hard to find the real case, all functions are rewritten and fixed.
I'll try to reproduce it in the real campaign code. Maybe it is for dedicated only - I test the campaign mostly on dedicated.

still forum
#

The difference with all your previous examples was just that the code that had the error, was never executed.
And errors are only printed when trying to be executed

unreal scroll
#

Don't pay any attention to it, I never ran CBA functions from a console, only as a part of server scripts. So not "tada", guys, at least the problem existed, and it was the bug. I was wrong about it being a "feature", yes, so sorry.
And I can't say for sure right now if the bug is gone because of a game update, or just because the CBA functions are no longer used.
I'll try to get some missions code from backup.

sullen sigil
#

server scripts show the debug message on the server
which you arent

unreal scroll
#

server scripts show the debug message on the server
Because it shows error in the dedicated server log maybe? Which I read line by line?

sullen sigil
#

then thats a problem with your server

#

error logging works fine on mine

unreal scroll
#

I didn't say it doesn't work for you, I just said it was a bug. For me, yes. Do you expect to have the same bug? I doubt it, as my scripts are... very complex, to be short ๐Ÿ™‚
And if the bug is still unknown, it most likely requires some specific conditions. I just need to recreate it.

sullen sigil
#

my brother in christ i wrote an entire physics engine in sqf using cba functions and not once had this issue

#

your scripts are only very complex if they are written poorly

unreal scroll
#

Your favorite thing, as I see it, is shifting accents.

sullen sigil
#

๐Ÿคจ

south swan
#

can you please stop beating the same dead horse? Thanks in advance.

meager granite
#

Such a shame that HitPart triggers separately for direct hit and for splash damage

kindred zephyr
#

you can check if is direct

meager granite
#

Because HandleDamage combines both damages in same EH fire streak

meager granite
#

For example if you have is_direct=true fire and then is_direct=false fire

#

Does it mean it was single hit (direct and then explosion) or it was one direct hit and then one mess but splash hit? Is such case even possible?

#

I'm testing it by shooting RPG at a unit, it does 3 fires:
Direct, Splash, Splash

kindred zephyr
#

isnt it the same for handleDamage but x4?

Handledamage fires multiple times in the same frame after all

hallow mortar
#

It'd be nice if there was a good way to associate splashes with their directs, but I definitely don't want them to be merged. Distinguishing between them is useful.

meager granite
kindred zephyr
#

at least for hD, the behaviour is to happen once per hit per type per selection

meager granite
#

๐Ÿค”

#

I'm trying to do a seemingly impossible task, associate HitPart with HandleDamage

meager granite
#

Shooting 1 bullet through 2 legs triggers 2 HitParts: Direct, Direct and also 2 sequences of HD

#

I wonder if situation where HitParts triggers like Direct+Splash+Splash could mean 2 separate hits?

#

First hit: Direct+Splash
Second hit: Splash only

#

Is this even possible in the engine? Is there a projectile that passes through doing splash and then another splash separately?

granite sky
#

Now wondering whether a bullet passing through two legs does twice as much general damage.

south swan
#

Iirc the damage is proportional to projectile's speed change?

#

Or just speed at impact tanking

meager granite
#

Second leg only got ~0.3 overall damage compared to first leg getting ~0.4

granite sky
#

Not sure if velocity falloff or just smaller intersection.

south swan
#

First leg penetration should reduce speed. I'm like 98% sure

meager granite
hallow mortar
meager granite
#

from HitPart

#

lost like 45% of its speed

#

I shot approximately through center of both legs btw

#

Well, looks like leg shots can yield you more damage if you hit both

granite sky
#

I guess the common arm -> body would also do that, although body shots do little general damage.

#

(assuming some body armour)

south swan
#

I want to test if gross overpen does less damage

native hemlock
#

With 4 AI next to me the result for nearestObjects [player, ["Man"], 7] is 0.0053 and for player nearEntities ["Man", 7] it's 0.0155. So it seems like there is a sweet spot for nearestObjects being faster than nearEntities for smaller searches and the number of objects that match the type you are looking for within the radius.

ivory lake
#

it does

#

atleast with vehicles and the like

#

like this was toyed with a while ago so maybe I'm misremembering a detail but with the ammo rack components in spearhead we had to make them very dense but easy to penetrate cuz otherwise tank shells would sail right through them, dealing very little damage

hallow mortar
#

Does A3 have a workable APHE fuzing model, or is it all just the same "AP" as pure kinetic penetrators like APFSDS?

south swan
#

Inb4 it's dumb HE model

rich frost
#

soooo.... playMusic "" is supposed to trigger a "MusicStop" Eventhandler, but it doesnt?

Do i do something wrong here?

#

Hm

#

so it does, but only when there is an actual track being played ...

#

guess that makes sense

ivory lake
#

because nah - can probably do something scripted with hitpart

dreamy kestrel
#

Q: not sure what the best channel is for this question, looking for some javascript based templates, maybe they use gulp, etc, to package addons, mods, etc? I don't mind adapting example code to suit our internal organizational patterns, folders, files, that sort of thing. wonder if such a thing exists?

astral bone
#

ah yes, I should probably do scripting in notepad++ or something instead of all in the debug console
Small scripts it's fine, but even when using advanced dev tools, large/long scripts- Well, I just had an if statement twice xD

if(count _memPoints == 0)then{
  continue;
};
if(count _memPoints == 0)then{
}else{
  ... // DO STUFF if it has valid mem points
};

sooo yea- xD

dreamy kestrel
#

waitUntil {...} to sleep or to uiSleep? I'm not clear the difference...

little raptor
dreamy kestrel
waxen hearth
#
Suspend execution of script for given UI time. uiSleep is a sleep method to delay script execution where script time/simulation time is stopped. uiSleep is basically using the system time (uiTime more specifically) and not simulation time. So in the cases where sleep would get stuck indefinitely, uiSleep can still be used to effectively delay script execution for example in pause or in a mission briefing or an editor or when simulation is paused in general.
little raptor
#

well you really shouldn't wait for a var to become available. if you do, it typically means you're doing something wrong
but in any case, it depends how the var becomes available. uiSleep means wait in UI time (what you experience as human). sleep means wait in game time (e.g. it could be slower or faster due to time acceleration, game pause, etc.)

dreamy kestrel
#

sounds like uiSleep for the win. thanks.

still forum
rich frost
#

๐Ÿ™ƒ

rich frost
still forum
#

There should be a old FT ticket that you should be able to find

#

if not fixed it should be reopened not a new one

rich frost
waxen hearth
#

onMissionLoad seems to not function in same way as other 3DEN event handlers?

My Function:
checkUnits

[] spawn {
    if ("ace_arsenal" in activatedAddons) then {
        // Unit calls fnc after ACE Arsenal loadout is applied
        ["ace_arsenal_displayClosed",{
            [] spawn {
                uiSleep 0.1;
                {
                    if (_x isKindOf "Man") then {
                        [_x] call Deg_TB_fnc_checkBalaclava;
                    };
                }forEach allUnits; 
                systemChat "ace_arsenal_displayClosed";
            };
        }] call CBA_fnc_addEventHandler;    
        // Detect face change in ACE Arsenal, issue correct balaclava face if balaclava goggles are worn
        ["ace_arsenal_displayOpened", {
            [] spawn {
                [] spawn {
                    while{uisleep 0.01; !(isNil "ace_arsenal_center")} do {
                        if(!(isNil "ace_arsenal_center") && "Deg_TB_" in (goggles ace_arsenal_center) && !("Deg_TB_" in (face ace_arsenal_center)))then{
                            ace_arsenal_center call Deg_TB_fnc_checkBalaclava;
                        };
                        systemChat "ACE Arsenal Is Open";
                    };    
                };
            };
        }] call CBA_fnc_addEventHandler;    
    };    
};

Expected:
systemChat for events when ACE Arsenal is opened/closed

What works:

  • Init
  • onMissionNew
  • onMissionPreviewEnd
  • executing the code from console after mission load (3DEN)

Does not work:

  • onMissionLoad

I'm fairly new to scripting so I'd appreciate any suggestions?

Config.cpp

class Cfg3DEN
{
    class EventHandlers
    {
        class Deg_TB_3DEN_EH
        {
            Init = "[] call Deg_TB_fnc_checkUnits";
            OnMissionNew = "[] call Deg_TB_fnc_checkUnits";
            OnMissionPreviewEnd = "[] call Deg_TB_fnc_checkUnits";
            OnMissionLoad = "[] call Deg_TB_fnc_checkUnits";
        };
    };
};
dreamy kestrel
#

trying to find the command groups for those things in the map, log briefing and such. is that diary?

dreamy kestrel
granite sky
#

@waxen hearth Do you know if the event is firing at all?

waxen hearth
#

Yep, tested with additional systemChat. Event itself fires, but CBA event handlers are not applied to mission.

#

I tried spawns inside spawns, without spawn, nothing seems to work. I tried to delay with uiSleep, still nothing.

granite sky
#

What about the activatedAddons check?

#

I have no idea what that does. Both activatedAddons and activateAddons are undocumented.

waxen hearth
#

everything under IF is triggering as well, its just that event handlers are not applied

#

however they are applied with init, onMissionNew, and onMissionPreviewEnd

#

just not with onMissionload

granite sky
#

That suggests that CBA is clearing out the event handlers after you add them.

waxen hearth
#

wouldn't uiSleep delay work around this? or you're suggesting CBA somehow clears them after they're added?

#

which does not happen with other 3den EHs, as said before

granite sky
#

shrugs

#

You're dealing with two sources of undocumented initialization order here.

#

You'd probably need to read CBA at least.

astral bone
#

wait no

#

So, this is meant to help me make powerlines for terrain builder. But the lines aren't QUITE right-

#

other side is similar, it's not actually on the map1 or map2 points

#

is it scale? does scale mess with rotation?

#

I know I'm doing something wrong with my math, but I have no clue what

#

idek if it will work with 3 or more, instead of 2

tough abyss
astral bone
#

what

waxen hearth
#

bullets are not visible. only tracers.

#

unless you have an object.

tough abyss
waxen hearth
#

ok, tracers. i guess open console and initiate camera, set time to 0 during shooting?

tough abyss
hallow mortar
#

People usually use mods like POLPOX's Artwork Supporter, which has a function to make units continuously fire

keen stream
#

Is that when you run the tests multiple times on different spots to make it reproducable and not an anomaly?

limber thunder
#

Hello guys,
I have written a script which marks the enemy players on the map for a certain time. The problem is that dead players are also shown on the map. Does anyone have an idea how I can make it so that only living players are displayed?
Here is my script:

hint "Gegner werden auf der Karte angezeigt";
sleep 1;
if (side player == west) then {

hintSilent "Spieler ist auf der blufor seite!";
sleep 1;
hintSilent "";
sleep 1;

for "_i" from 1 to 30 do { 
sleep 0.1;
_playerPosition1 = getPosATL p1;
_playerPosition2 = getPosATL p2;
_playerPosition3 = getPosATL p3;
_playerPosition4 = getPosATL p4;

_playerMarker1 = createMarker ["marker1", _playerPosition1];
_playerMarker1 setMarkerType "hd_objective";
_playerMarker2 = createMarker ["marker2", _playerPosition2];
_playerMarker2 setMarkerType "hd_objective";
_playerMarker3 = createMarker ["marker3", _playerPosition3];
_playerMarker3 setMarkerType "hd_objective";
_playerMarker4 = createMarker ["marker4", _playerPosition4];
_playerMarker4 setMarkerType "hd_objective";
sleep 1;

deleteMarker "marker1";
deleteMarker "marker2";
deleteMarker "marker3";
deleteMarker "marker4";
}

 } else { 

hintSilent "Spieler ist auf der Opfor seite!";
sleep 1;
hintSilent "";
sleep 1;

for "_i" from 1 to 30 do {
sleep 0.1;
_playerPosition5 = getPosATL p5; 
_playerPosition6 = getPosATL p6;
_playerPosition7 = getPosATL p7;
_playerPosition8 = getPosATL p8;

_playerMarker5 = createMarker ["marker5", _playerPosition5];
_playerMarker5 setMarkerType "hd_objective";
_playerMarker6 = createMarker ["marker6", _playerPosition6];
_playerMarker6 setMarkerType "hd_objective";
_playerMarker7 = createMarker ["marker7", _playerPosition7];
_playerMarker7 setMarkerType "hd_objective";
_playerMarker8 = createMarker ["marker8", _playerPosition8];
_playerMarker8 setMarkerType "hd_objective";
sleep 1;

deleteMarker "marker5";
deleteMarker "marker6";
deleteMarker "marker7";
deleteMarker "marker8";
}

  };```

Maybe someone has an idea and can help me. ๐Ÿ™‚
meager granite
#
if(alive p1) then {
    _playerMarker1 = createMarker ["marker1", _playerPosition1];
    _playerMarker1 setMarkerType "hd_objective";
};
``` for each `createMarker`
#

but you really should start using Arrays

granite sky
#

And indentation :P

limber thunder
granite sky
#

Are you blinking markers using createMarker/deleteMarker?

limber thunder
#

yes

granite sky
#

you should use setMarkerAlpha for that instead. Either version might be irregular in MP though.

limber thunder
#

They must be updated when the player moves

granite sky
#

setMarkerPos

limber thunder
#

yes I did this

granite sky
#

In an ideal world you do this stuff client-local using the setMarker*Local commands but that might be a bit much if you're new.

limber thunder
#

I'm glad it works the way I want it to

#

but thanks

meager granite
#

nearestObjects and nearEntities work differently

#

nearEntities goes through all entities in the world while nearestObjects addresses grids with list of entities currenty in that grid

high vigil
#

is it possible to add backpack to a backpack

warm hedge
#

If the backpack allows that, yes AFAIK

meager granite
#

number of addressed grids increases with radius in nearestObjects

#

nearEntities always goes through every entity and does radius check for each

native hemlock
next kraken
#

morning guys. ive got a issue with animations on dedicated server. seems like the initializaton of the code is executed too late. units are doing the anims, but they look in different directions and are on slightly different places. i executed the code in the init, initserver and in the units init line, no luck. even tried remoteexec, no luck too. they play the anims but issue remains. using the "normal" Bis function

#

[civ_3, "LISTEN_BRIEFING", "ASIS"] call BIS_fnc_ambientAnim;

#

is there a way to make them execute the code earlier and trustfully so they dont port around?

cosmic lichen
#

This function is not a good idea in multiplayer but sadly there are no alternatives except you wanna use mods.

@winter rose I remember you wanted to write some new functions for this?

next kraken
#

hah!

#

got it working

#

using snappoints, (i use cyan arrows, hiding the model, and then executing the functions in the init, makes them do things perfect)

#

thanks revo

#

you have to syncronize the unit with the snappoint

#

works perfectly

candid sun
#

@queen cargo thanks for fulfilling your promise but i'll stick with mine, it's much faster

#

21ms vs 0.06ms

queen cargo
#

as i said
it has room for improvements

#

its going through it char by char

#

and doing that the most old way you could imagine

candid sun
#

something's broken somewhere with it too, it returns "ESCAPE" not "foobar" lol

meager granite
#
16:48:53 #########################################################
16:48:53 "Frame 4119232: FiredMan: B_Soldier_F"
16:48:53 ["B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","arifle_MX_GL_F","GL_3GL_F","Single","G_40mm_HE","3Rnd_HE_Grenade_shell","1780686: ugl_slug.p3d (G_40mm_HE)","<NULL-object> ()"]
16:48:53 #########################################################
16:48:53 "Frame 4119238: HitPart: I_Heli_Transport_02_F"
16:48:53 ["1eb7dd52040# 1780351: heli_transport_02_f.p3d (I_Heli_Transport_02_F)","B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","1780686: ugl_slug.p3d (G_40mm_HE)",[6836.83,16286.6,87.2636],[-66.8329,42.3681,9.25785],[],[80,8,6,1,"G_40mm_HE"],[0.613409,-0.788473,-0.0451515],1.64285,"a3\data_f\penetration\armour_plate_16mm.bisurf",true]
16:48:54 #########################################################
16:48:54 "Frame 4119280: HitPart: I_Heli_Transport_02_F"
16:48:54 ["1eb7dd52040# 1780351: heli_transport_02_f.p3d (I_Heli_Transport_02_F)","B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","1780686: ugl_slug.p3d (G_40mm_HE)",[6836.83,16286.6,86.9409],[0.000613212,-0.000788219,-2.54834],[],[80,8,6,1,"G_40mm_HE"],[0.420269,0.171321,0.891079],1.61775,"a3\data_f\penetration\armour_plate_12mm.bisurf",true]
16:48:54 #########################################################
16:48:54 "Frame 4119290: HitPart: I_Heli_Transport_02_F"
16:48:54 ["1eb7dd52040# 1780351: heli_transport_02_f.p3d (I_Heli_Transport_02_F)","B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","1780686: ugl_slug.p3d (G_40mm_HE)",[6836.83,16286.6,86.9411],[0.000420269,0.000171321,-0.0874062],[],[80,8,6,1,"G_40mm_HE"],[0.420269,0.171321,0.891079],1.61775,"a3\data_f\penetration\armour_plate_12mm.bisurf",true]
... etc 100 times ...

So if you hit a vehicle with a grenade point blank it triggers hundreds of HitPart but none result in HandleDamage (on soldiers too)

#

I wonder if there is a way to tell apart such HitPart fires from ones that produce HandleDamage response? Any ideas?

#

(Grenade falls through the vehicle triggering HitPart several times a frame while its inside vehicle geometry)

#

There is no way to reliably check if fuseDistance was traveled it seems

#

I know that if you shoot tank\arty through trees it explodes several times during flight, can same happen with vehicles?

#

Can single HE shot pass through vehicles and explode twice?

#

Is there a special case for trees foliage or something?