#arma3_scripting

1 messages · Page 451 of 1

sand grotto
#

im very new to scripting im not sure how i would do that. @fleet wind

fleet wind
#

It depends on the situation and please note I’m no professional either. But either use a while loop or add some event handler... Not at my pc I’m sure someone can help you.

#

In what way will you use it? You could bodge it together....

sand grotto
#

i need an AI convoy with there lights on at dusk when the sun is up, so before the AI's automatically switch there lights on

winter rose
#

you would have to cycle (maybe onEachFrame) and turn lights on (maybe a action or something)

sand grotto
#

i can turn the lights on with a truger, but then the AI automatically turns them off a frame latter

#

VERY ANOYING

fleet wind
astral tendon
#

Is there a way to make playSound3D move with the object? I know that say3D and others already do that but i need to use playSound3D because Im not willing to write 4000 scipts in description.ext for each sound file I have

fleet wind
#

@sand grotto I’ll be home in 3 ish hours or so I’ll help you out then if you can’t get it working

sand grotto
#

lol i leave for work in 3 hours 😭 , i appreciate it, i will keep trying and if i can't get it ill come to you.

little eagle
#

@astral tendon No.

astral tendon
#

Rip

little eagle
#

That's what say3D is for.

astral tendon
#

I know...

gleaming oyster
#

4000 scripts in description.ext scripts???

winter rose
#

Description.ext#CfgSfx @astral tendon

astral tendon
#

I know... I just dont wanna do that 4000 times

#

because i have 4000 sound files

winter rose
#

macro ?

#

#DEFINE

errant jasper
#

Does playSound3D actually work with mission sounds in MP now? Have vague recollections of it not working in MP because the path to the mission differs on clients and you must supply the path?

astral tendon
#

RemoteExec?

errant jasper
#

? For what purpose?

little eagle
#

Muzzleflash, you just generate the filepath dynamically by using str missionConfigFile

errant jasper
#

I understand that. But isn't it same problem as setObjectTextureGlobal. Basically, you supply an absolute path to a command that then tries to apply that globally on all machines. For addons this works fine (they have the same path on all clients), but for missions the absolute path differs on all machines depending on which drive they installed Arma to and their windows username?

little eagle
#

setObjectTextureGlobal would be fucked, that's right. If it needs an absolute path. I think it does, which is the real problem.

#

You can always use setObjectTexture instead though.

errant jasper
#

But when playing in MP, wouldn't the expression that strips part of str missionConfigFile yield something like ".......\commy\Local\Arma 3\MpMissionCache\__curmp__.pbo" then you append "sounds\mysound.ogg" and pass that to playSound3D?

little eagle
#

Oh right. It's a global command exactly like setObjectTextureGlobal.

#

Now I get what you mean.

#

You could play it for all filepaths of every client and hope no one has the exact same profile folder path so the sounds double up. lol

#

Lot's of RPT spam though I believe.

errant jasper
#

Yeah. Maybe even a dialog box with sound not found, not sure.

#

But I vaguely recall it being one of the reason I moved to remoteExec'ing say3D instead.

little eagle
#

Those commands should just take relative paths of missions. Unbelievable. That would be easy to do too.

errant jasper
#

Yeah definitely. But guess BIS never needed it themselves...

junior stone
#

is is possible to set a max width of a combobox ?

wary vine
#

rip

#

I dont know

#

I know you have whole height for height, but I dont think there is an option for width

junior stone
#

already searched, but nothing like that

little eagle
#

\n

#

Doesn't necessarily work though.

junior stone
#

any idea commy to do a line break or something like that? 😄

little eagle
#

\n

junior stone
wary vine
#

you would need to insert ^^ after ever x characters

little eagle
#

\n
is how you make a new line

viral gust
#

I've not delved into controls yet (I plan to extensively soon though) but have you tried specifying a scrollbar on the control? (No idea if this will solve that issue)

little eagle
#

Not sure if RscCombo has scrollbars.

viral gust
#

Snagged from this forum post (https://forums.bohemia.net/forums/topic/179510-lbadd-problem-with-combobox-help-needed/) and also BIS wiki (https://community.bistudio.com/wiki/DialogControls-Combo) about combo boxes not populating (Not the same issue at all but its on the root topic I suppose): sqf class ComboScrollBar { color[] = {1,1,1,0.6}; colorActive[] = {1,1,1,1}; colorDisabled[] = {1,1,1,0.3}; thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; };

#

Really not sure if that will prevent the content from exceeding the width though :/

junior stone
#

is already

#
class vorlagen
        {
            type = 4;
            idc = 8111;
            x = safeZoneX + safeZoneW * 0.386875;
            y = safeZoneY + safeZoneH * 0.54555556;
            w = safeZoneW * 0.315625;
            h = safeZoneH * 0.03111112;
            style = 16;
            arrowEmpty = "\A3\ui_f\data\GUI\RscCommon\RscCombo\arrow_combo_ca.paa";
            arrowFull = "\A3\ui_f\data\GUI\RscCommon\RscCombo\arrow_combo_active_ca.paa";
            colorBackground[] = {0,0,0,0.5};
            colorDisabled[] = {0.2,0.2,0.2,1};
            colorSelect[] = {1,0,0,1};
            colorSelectBackground[] = {0,0,0,1};
            colorText[] = {1,1,1,1};
            font = "PuristaMedium";
            maxHistoryDelay = 0;
            sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1);
            soundCollapse[] = {"\A3\ui_f\data\sound\RscCombo\soundCollapse",0.1,1.0};
            soundExpand[] = {"\A3\ui_f\data\sound\RscCombo\soundExpand",0.1,1.0};
            soundSelect[] = {"\A3\ui_f\data\sound\RscCombo\soundSelect",0.1,1.0};
            wholeHeight = 0.3;
            class ComboScrollBar
            {
                color[] = {1,1,1,1};
                thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
                arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
                arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
                border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
            };
little eagle
#

Those German classnames tho.

junior stone
#

😛

viral gust
#

😛

little eagle
#

Snurtzelrump

viral gust
#

Sorry I couldn't help! Maybe in a month I'll stumble on the solution and try helping again haha

junior stone
#

and script is atm

{
        _cMessageCombo lbAdd format["%1",__x # 1];
    } forEach _data;
little eagle
#

_x not __x

junior stone
#

yea c&p mistake 😛 in the script its correct

viral gust
#

Is there a better way to loop n times other than forEach [1,2,3,n]?

little eagle
#
for "_i" from 1 to _n do {

};
viral gust
#

Awesome, thanks!

wary vine
#

@junior stone did you get it sorted ?

junior stone
#

nop

#

created a workaround for me how i need it

winter rose
#

the PPEffect filmGrain seems to only deliver coloured grain... anyone know more about it?

marble basalt
#

anyone know why when i call BIS_fnc_moduleEffectsSmoke it does nothing, am i missing any information for it?

winter rose
#

how do you call it?

marble basalt
#

createvehicle [ "BIS_fnc_moduleEffectsSmoke",getPosATL _thing vectorAdd [0, 0, -4.5],[], 0, "can_Collide"];

#

getPosATL _Thing findEmptyPosition [5,5,"BIS_fnc_moduleEffectsFire"];

#

tried both

gleaming oyster
#

Err...wtf. why not make a particle source or at least create a smoke shell?

winter rose
#

it's not a vehicle, it's a function

marble basalt
#

yah im new to this

winter rose
#

it takes a logic as parameter, afaik

marble basalt
#

still learning lol

tough abyss
#

Anyone know where to find weapon class list? The wiki has a nice list but it's not copy and paste friendly, it gets images and random text.

gleaming oyster
#
_list = "true" configClasses(configFile >> "CfgWeapons") apply {configName _x};
marble basalt
#

so how would i add a smoke shell

#

and would it look like a burning object

winter rose
#

can you or not add it by the editor directly?

#

it would save you scripting

marble basalt
#

need it to spawn via script

#

its randomly gen crash

#

like hunt the heli crash type thing

little eagle
#

You cannot create modules mid mission and expect them to work, as none of the arguments are set on them.

winter rose
#
_module = "ModuleEffectsSmoke_F" createVehicleLocal getPosATL player; // ← note the createVehicleLOCAL, needed for modules
[_module] call BIS_fnc_moduleEffectsSmoke;
#

@marble basalt

little eagle
#

Did you try this?

winter rose
#

yup, works

little eagle
#

Modules are Logic, so I expected createUnit to be needed.

marble basalt
#

thanks now my crash is smokin

#

just to make it burn and make wreck sound

winter rose
#

re-setPosATL the module, so it's spot-on target

little eagle
#

Does the effect stick to the module now?

winter rose
#

no, just tried

#

moved the module and the smoke is still happening at the same position.
I guess you could grab the "#particlesource"

little eagle
#

tbh, I'd just create the effect by script and ignore the module.

#
private _colorRed = 0.5;
private _colorGreen = 0.5;
private _colorBlue = 0.5;
private _colorAlpha = 0.5;
private _particleLifeTime = 50;
private _particleDensity = 10;
private _particleSize = 1;
private _particleSpeed = 1;
private _particleLifting = 1;
private _windEffect = 1;
private _effectSize = 1;
private _expansion = 1;

private _emitter = "#particlesource" createVehicleLocal [0,0,0];
_emitter attachedTo [_object, [0,0,0]];

_emitter setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal_02",8,0,40,1],"","billboard",1,_particleLifeTime,[0,0,0],[0,0,2*_particleSpeed],0,0.05,0.04*_particleLifting,0.05*_windEffect,[1 *_particleSize + 1,1.8 * _particleSize + 15],
        [[0.7*_colorRed,0.7*_colorGreen,0.7*_colorBlue,0.7*_colorAlpha],[0.7*_colorRed,0.7*_colorGreen,0.7*_colorBlue,0.6*_colorAlpha],[0.7*_colorRed,0.7*_colorGreen,0.7*_colorBlue,0.45*_colorAlpha],
        [0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.28*_colorAlpha],[0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.16*_colorAlpha],[0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.09*_colorAlpha],
        [0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.06*_colorAlpha],[1*_colorRed,1*_colorGreen,1*_colorBlue,0.02*_colorAlpha],[1*_colorRed,1*_colorGreen,1*_colorBlue,0*_colorAlpha]],
        [1,0.55,0.35], 0.1, 0.08*_expansion, "", "", ""];

_emitter setParticleRandom [_particleLifeTime/2, [0.5*_effectSize,0.5*_effectSize,0.2*_effectSize], [0.3,0.3,0.5], 1, 0, [0,0,0,0.06], 0, 0];
_emitter setDropInterval (1/_particleDensity);
#

There.

#

_object is whatever you want to attach it to.

tough abyss
#

ty mud

little eagle
#

Multiple Username Disorder
But I haven't changed my nick in 12 years.

#

Jesus, this name is almost half as old as I am.

marble basalt
#

cant seem to get fire to work

little eagle
#

This is smoke.

marble basalt
#

no i mean i have smoke from what lou said but trying to add fire

#

the same way

little eagle
#

tbh, I'd just create the effect by script and ignore the module.

marble basalt
#

not sure how so trying to use module

#

just trying to add small fireballs on the ground near smoke

#

in a random radius

little eagle
#

How is this executed?

marble basalt
#

_module1 = "BIS_fnc_moduleEffectsFire_F" createVehicleLocal getPosATL _li_end;
[_module1] call BIS_fnc_moduleEffectsFire;

little eagle
#

Not what, how. I mean. From where.

marble basalt
#

havent done that yet

#

just trying to get fire first then spread it out

little eagle
#

So debug console?

#

I mean, somehow your script has to be executed. Where did you put these lines?

#
params ["_object"];

private _colorRed = 0.5;
private _colorGreen = 0.5;
private _colorBlue = 0.5;
private _timeout = 0;
private _particleLifeTime = 2;
private _particleDensity = 20;
private _particleSize = 1;
private _particleSpeed = 1;
private _effectSize = 1;
private _orientation = 5.4;
private _damage = 1;

private _emitter = "#particlesource" createVehicleLocal [0,0,0];
_emitter attachedTo [_object, [0,0,0]];

_emitter setParticleParams [
    ["\A3\data_f\ParticleEffects\Universal\Universal",16,10,32],"","billboard",1,_particleLifeTime,[0,0,0],[0,0,0.4*_particleSpeed],0,0.0565,0.05,0.03,[0.9*_particleSize,0],
    [[1*_colorRed,1*_colorGreen,1*_colorBlue,-0],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,0]],
    [1], 0.01, 0.02, "", "", "",_orientation,false,-1,[[3,3,3,0]]
];

_emitter setParticleRandom [_particleLifeTime/4, [0.15*_effectSize,0.15*_effectSize,0], [0.2,0.2,0], 0.4, 0, [0,0,0,0], 0, 0, 0.2];
_emitter setDropInterval (1/_particleDensity);

if (_damage > 0) then {
    _emitter setParticleFire [0.6*_damage, 0.25*_damage, 0.1];
};

private _lightSize = (_particleSize + _effectSize)/2;

private _light = createVehicle ["#lightpoint", [0,0,0], [], 0, "CAN_COLLIDE"];
_light setPosWorld (getPosWorld _emitter vectorAdd [0,0,0.5]);
_light setLightBrightness 1.0;
_light setLightColor [1,0.65,0.4];
_light setLightAmbient [0.15,0.05,0];
_light setLightIntensity (50 + 400*_lightSize);
_light setLightAttenuation [0,0,0,1];
_light setLightDayLight false;
#

There. That should work.

unborn ether
#

Everytime i see setParticleParams application i feel a bit deranged

little eagle
#

why?

marble basalt
#

found an easier way to do fire

#

lol

#

so did that instead

little eagle
#

Could've just copy pasted what I wrote but w/e ¯_(ツ)_/¯

unborn ether
#

Wow just found out that any ctrl that has MouseEnter|MouseExit|MouseMoving doesn't react when you press and hold LMB|RMB and move your cursor to its area

marble basalt
#

trying to add to add magazines and weapons to one weaponholdersimulated is this the right thing for it to spawn it and how do i make mags spawn with it

#

or just spawn a gun with a mag in it?

unborn ether
#

@marble basalt Depends. WeaponHolderSimulated is PhysX version of WeaponHolder that whats exactly created when your unit drops a weapon on death. It does ragdoll and stuff. Don't think its a good idea to place multiple items, like weapon + mag in the same holder of that type, as it probably will look awkward.

marble basalt
#

ok

meager heart
#

another way for "custom sounds with playSound3D"

/*
_soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; 
_soundToPlay = _soundPath + "Sounds\test.ogg";
playSound3D [_soundToPlay, player];
_soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; 
_soundToPlay = _soundPath + "Sounds\test.wav";
playSound3D [_soundToPlay, player];
*/

//--- Description.ext
__EXEC (MISSION_ROOT = __FILE__ select [0, count __FILE__ - 15])

//--- script
private _missionRoot = parsingNamespace getVariable "MISSION_ROOT";
playSound3D [_missionRoot + "file_name.ogg", <soundSource>]; 
``` @astral tendon
marble basalt
#

how can i make a gun spawn on the ground with a mag in it or near it with a script

unborn ether
#
private _holder = "WeaponHolder" createVehicle (position player):
_holder addWeaponCargoGlobal ...
_holder addMagazineCargoGlobal ...
#

... stand for anything according to syntax

marble basalt
#

keep getting missing ; on first line

#

from debug

meager heart
#

groundWeaponHolder < try this 😀

#

also afaik it has no PhysX ^

marble basalt
#

still says missing ;

meager heart
#

show your code

marble basalt
#

its good figured it out

#

made it spawn it two seperate ground holders one for the gun and one for ammo

#

be nice to have it in both but eh

astral tendon
#

Old problem really

#

i tryed to figured it out already but no juice

#

Also @meager heart thanks for the script but i also need the sound to follow the unit, so I did on the hard way with Say3D

meager heart
#

¯_(ツ)_/¯

mystic plaza
#

Not sure if this is the right channel, but I want to give the static AA defenses normally on blufor over to opfor. How would I go about doing this in the eden editor?

meager heart
#
0 spawn {
    private _g = createAgent ["Goat_random_F", [0,0,0], [], 5, "NONE"]; 
    private _h = "groundweaponHolder" createVehicle [0,0,0];
    _g setPos (player getPos [0, getDir player]);
    _h addWeaponCargoGlobal ["srifle_EBR_F", 1];
    _h attachTo [_g, [0,0.25,1]];

    private _lootHolder = "groundweaponHolder" createVehicle (player modelToWorld [0,2,0]);
    _lootHolder addWeaponCargoGlobal ["srifle_EBR_F", 2];
    _lootHolder addMagazineCargoGlobal ["20Rnd_762x51_Mag", 10];

    private _secondlootHolder = "groundweaponHolder" createVehicle (player modelToWorld [0,5,0]);
    _secondlootHolder addWeaponCargoGlobal ["launch_RPG32_F", 3];
    _secondlootHolder addMagazineCargoGlobal ["RPG32_HE_F", 5];
};
``` paste it in to the console ^ https://imgur.com/a/osjELaY @marble basalt
little eagle
#

@meager heart Have you tested this in MP with another person? Because PS3D has global effects, and the PTF is different for everyone, yet PS3D and therefore PNS getVar is only ever executed once locally on one client.

meager heart
#

yep, was couple missions with that way ^ and was no troubles, everyone was able to hear it (sc missions with custom sound alarm), commy 🤷

little eagle
#

Yeah, but did youhave to globally execute PS3D?

meager heart
#

yes ^

little eagle
#

That'd mean N^2 network messages, potentially a lot of file not found rpt spam, and rarely doubled sounds if the paths match on two machines.

#

This is certainly intersting behavior that warrants doc just to show how dumb it is.

#

And gives insight.

meager heart
#

btw [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; works just fine also 👌

little eagle
#

?

meager heart
#

it works!

little eagle
#

I don't think we're talking on the same level. ¯_(ツ)_/¯

meager heart
#

sure

#

you said > PNS getVar is only ever executed once locally on one client
and server

#

what is the problem ?

#

(i dont get it srry)

little eagle
#

Okay, playSound3D is a command with global effects, right?

meager heart
#

yep

little eagle
#

Means that if you executed it on machine A, it will send the filepath of the soundfile to every other machine, right?

meager heart
#

yes

little eagle
#

But the filepath is different on every client, so only on Machine A and every client that happens to have the same filepath the sound will be played. Everywhere else it will print an error and be silent, correct?

meager heart
#

yes, but if you make a function and execute it global ?

little eagle
#

Then every client sends a filepath to every other client. And a sound will be played everywhere.

#

BUT

meager heart
#

kinda spam you mean ?

little eagle
#

For every client, a message will be send to every client. N^2 network traffic.

#

N - 1 file not found messages.

#

And rarely, doubled up sounds on at least two machines.

meager heart
#

got it now

little eagle
#

Those are my objections in which I say, it only kind of works.

meager heart
#

rgr

little eagle
#

The nasty thing is that it will behave correctly when NOT remotely executed in local MP testing, because both clients share the same filepath as they are on the same computer.

meager heart
#

that was trouble in b4

little eagle
#

Probably a cause of a lot of confusion, and only now I fully understand what's going on. Or might go on. Haven't thoroughly tested it.

meager heart
#

also i remember that is only one way to make it work if cba enabled

#

i mean RE it globaly

little eagle
#

CBA_fnc_globalExecute is just a wrapper for remoteExec BIS_fnc_call.

meager heart
#

in b4 was using bis_fnc_mp also for that 😀

little eagle
#

The method of remote execute really isn't interesting for this topic though. It will behave the same with all of those, as they're universal.

meager heart
#

well... thanks... i feel how my level is slightly changed now, commy 😄

little eagle
#

I just dragged you down. 👌🏼

meager heart
#

nooo

little eagle
#

There's no going back. Can't forget things at will. Entropy increased and you're stuck with me in hell now.

ruby turtle
#

I tried to disable Simulation in a MP Mission. But when I disable the simulation in the attributes, my objects nevertheless falling down like simulation is enabled. I also tried to use:

lamp1 enableSimulationGlobal false;
lamp2 enableSimulationGlobal false;
lamp3 enableSimulationGlobal false;
lamp4 enableSimulationGlobal false;
lamp5 enableSimulationGlobal false;
lamp6 enableSimulationGlobal false;

on initServer.sqf

little eagle
#

Yeah, because the lamps probably fall down before that script ever runs.

ruby turtle
#

they have enough time to falling down 3.5 metres and turned into a lying position?

little eagle
#

Maybe?

ruby turtle
#

How I can realise a solution?

#

never worked with preInit comamnds if that should be a solution

little eagle
#

"preInit commands" don't exist.

meager heart
#

maybe just objects init will works

little eagle
#

Is this with any mods?

meager heart
#

object initialization fields are called b4 the initServer.sqf 😀

ruby turtle
#

I also disabled visibility of these objects because these objects are carrier of own generated light sources. they are visible at all. (put the visibility of in the attributes. but I will try to use object init.

#

)

little eagle
#

Is this with mods or without?

ruby turtle
#

with mods. just using RHS, Firewill Aircrafts and ACE+TFAR+enhanced Movement+achilles.

#

and CBA...

little eagle
#

Lamp classname?

ruby turtle
#

Land_Camping_Light_F (lamp3)

#

for example

little eagle
#
if (isServer) then {
    ["Land_Camping_Light_F", "init", {
        params ["_lamp"];

        private _position = getPosWorld _lamp;
        private _dirAndUp = [vectorDir _lamp, vectorUp _lamp];

        [{
            params ["_lamp", "_position", "_dirAndUp"];

            _lamp setPosWorld _position;
            _lamp setVectorDirAndUp _dirAndUp;

            _lamp attachTo [commy_lampHolder];
        }, [_lamp, _position, _dirAndUp]] call CBA_fnc_execNextFrame;


        if (isNil "commy_lampHolder") then {
            commy_lampHolder = "Building" createVehicle ASLToAGL _position;
        };
    }] call CBA_fnc_addClassEventHandler;
};

This ought to work if executed in preInit.

ruby turtle
#

work this with all lamps with this classname on the map?

little eagle
#

Yes.

#

Well, the editor placed ones.

ruby turtle
#

have to execute it once, nice. How I use it as a preInit? never worked with using preInit

little eagle
#

But it absolutely has to be put in preInit, otherwise it does nothing.

#

Sec.

#
class Extended_PreInit_EventHandlers {
    My_Tag_missionPreInit = "call compile preprocessFileLineNumbers 'XEH_preInit.sqf'";
};
#

And then you put a file called XEH_preInit.sqf into your mission root folder.

#

Renamed the event because could be used for anything.

ruby turtle
#

because of the name of this sqf, it will be found by CBA and executed automatically because it is a predefined standard name?

little eagle
#

Extended_PreInit_EventHandlers is the predefined standard, My_Tag_missionPreInit just has to be unique since you don't want to overwrite anything.

#

And XEH_preInit.sqf is arbitrary convention / for simplicity.

ruby turtle
#

so again, there is a XEH_preInit.sqf in my mission root folder with the following content:

class Extended_PreInit_EventHandlers {
    My_Tag_missionPreInit = "call compile preprocessFileLineNumbers 'XEH_preInit.sqf'";
};
little eagle
#

You can change My_Tag to whatever you want. That's just placeholder for an OFPEC tag.

#

But yeah, that should work.

ruby turtle
#

just confusing me because I execute this sqf by it self.

and where I put this one:

if (isServer) then {
    ["Land_Camping_Light_F", "init", {
        params ["_lamp"];

        private _position = getPosWorld _lamp;
        private _dirAndUp = [vectorDir _lamp, vectorUp _lamp];

        [{
            params ["_lamp", "_position", "_dirAndUp"];

            _lamp setPosWorld _position;
            _lamp setVectorDirAndUp _dirAndUp;

            _lamp attachTo [commy_lampHolder];
        }, [_lamp, _position, _dirAndUp]] call CBA_fnc_execNextFrame;


        if (isNil "commy_lampHolder") then {
            commy_lampHolder = "Building" createVehicle ASLToAGL _position;
        };
    }] call CBA_fnc_addClassEventHandler;
};
#

?

little eagle
#

Into the XEH_preInit.sqf

ruby turtle
#

both code segments are have to be put into the sqf?

little eagle
#

Oh snap

#

class Extended_PreInit_EventHandlers {
goes into the description.ext

ruby turtle
#

ah okey, so im not longer confused xD

little eagle
#

lol

#

I skipped that part.

#

This is the woodhammer method. If they still fall after this, idk. ¯_(ツ)_/¯

ruby turtle
#

can I put it on the end of the description.ext or should it be more above?

#

cool 😄

little eagle
#

Doesn't matter where.

ruby turtle
#

okey

little eagle
#

The part where it hides the lamp can be put there too.

ruby turtle
#

does you script need traffic during the mission or is it just one command that don't have to be checked during mission?

little eagle
#

I think attachTo may cause traffic.

#

But the script itself only runs once per lamp and is otherwise just memory.

#

You could experiment with enableSimGlobal instead of attachTo , but for now I'd try this one.

ruby turtle
#

Because I have to look. This Mission have 60 Clients in the final Event it does should run on a good performance as possible.

#

But finally, thank you for your spend of time.

little eagle
#

The attachTo would be the only thing that could cause load after the mission start in what I wrote.

ruby turtle
#

Currently it works well. They are not falling down in MP

little eagle
#

With what I posted? Nice.

#

Maybe try enableSimGlobal now.

ruby turtle
#

Yes. Sec.

#

what exactly I have to change. It seems that I have only exchange the attachTo command with enableSimulationGlobal false; But there is an array with commy_lampHolder linked to line 18.

little eagle
#

commy_lampHolder thing can be deleted, as you no longer attach anything to it.

orchid saffron
#

Is it possible to get to use a MACRO inside the debug console?

little eagle
#

No.

#

Only files can be preprocessed.

#

Debug console has no file.

#

Macros are resolved by the preprocessor.

ruby turtle
#

like this?

if (isServer) then {
    ["Land_Camping_Light_F", "init", {
        params ["_lamp"];

        private _position = getPosWorld _lamp;
        private _dirAndUp = [vectorDir _lamp, vectorUp _lamp];

        [{
            params ["_lamp", "_position", "_dirAndUp"];

            _lamp setPosWorld _position;
            _lamp setVectorDirAndUp _dirAndUp;

            _lamp enableSimulationGlobal false;
        }, [_lamp, _position, _dirAndUp]] call CBA_fnc_execNextFrame;
    }] call CBA_fnc_addClassEventHandler;
};
little eagle
#

Therefore debug console cannot preprocess macros.

#

lgtm.

#

How do you hide them?

ruby turtle
#

I currently hide nothing, just wanted to try disable simulation globale first

little eagle
#

ok

#

The only potential issue I see here is, that they still fall down and are only put in place around postInit. So they could still take fall damage and cause collision damage during the loading screen etc.

ruby turtle
#

Atrributes deactivated enable damage. But It could also be to slow.

#

okey, enableSimulationGlobal false; doesn't work. They are still lying down on ground

little oxide
#

Anyway to override a bis functions ? I saw that not possible with cfgfunctions

little eagle
#

I think this is because they get their sim disabled on the server, but still fall on the client and the sim stuff only gets done once they're already down.

ruby turtle
#

but the Server and the client are desynchronized now or not? Should the Server not to be resynchronize it?

little eagle
#

@little oxide Only if you put allowFunctionsRecompile = 1; into your mission, but it means that the whole functions library is recompiled every mission start, meaning your mission loads slower.

#

Blaze, the point of ESG is to no longer synchronize the object.

little oxide
#

No way to do it with addon and pboprefix ?

little eagle
#

With addon you just put A3_Functions_F into required addons and overwrite their configs. That's easy.

#

You can edit CfgFunctions with addon just fine. I do it in a few places.

little oxide
#

Ok thanks

little eagle
#

@ruby turtle

if (isServer) then {
    ["Land_Camping_Light_F", "init", {
        params ["_lamp"];

        private _position = getPosWorld _lamp;
        private _dirAndUp = [vectorDir _lamp, vectorUp _lamp];

        [[_lamp, _position, _dirAndUp], {
            params ["_lamp", "_position", "_dirAndUp"];

            _lamp setPosWorld _position;
            _lamp setVectorDirAndUp _dirAndUp;

            _lamp enableSimulation false;
        }] remoteExec ["call", 0, true];
    }] call CBA_fnc_addClassEventHandler;
};

This.

ruby turtle
#

oh okey, we removed the frame CBA funct.

little eagle
#
["Land_Camping_Light_F", "init", {
    params ["_lamp"];

    private _position = getPosWorld _lamp;
    private _dirAndUp = [vectorDir _lamp, vectorUp _lamp];

    [{
        params ["_lamp", "_position", "_dirAndUp"];

        _lamp setPosWorld _position;
        _lamp setVectorDirAndUp _dirAndUp;

        _lamp enableSimulation false;
    }, [_lamp, _position, _dirAndUp]] call CBA_fnc_execNextFrame;
}] call CBA_fnc_addClassEventHandler;

Alternative idea. Drop the isServer and do the code on every client.

#

enableSimulationGlobal -> enableSimulation

ruby turtle
#

whats the difference? no server communication is needed anymore?

little eagle
#

The script runs once on every client, meaning that every client updates the position to whatever it had when it was created.

ruby turtle
#

So and that means its a more performant way as it the global command will be?

little eagle
#

It means the script may work.

#

I would've just left it at attachTo lol

ruby turtle
#

because of it uses only memory space?

little eagle
#

Because it works

#

Like.

#

The 4k textures of random asset mod cause like ten times the slog a hand full of attachTo's can ever hope to cause.

ruby turtle
#

the last variant doesnt work, I think attachTo is the best way you offered me

#

so and now I have to look about hideObjectGlobal

little eagle
#

hideObjectGlobal _lamp;

#

right after the attachTo line.

meager heart
#

setPos after enableSimulation ? 🤔

little eagle
#

There is no ES(G), we dropped that in favour of attachTo.

#

Or is this a suggestion?

meager heart
#

kinda suggestion yes...

little eagle
#
if (isServer) then {
    ["Land_Camping_Light_F", "init", {
        params ["_lamp"];

        private _position = getPosWorld _lamp;
        private _dirAndUp = [vectorDir _lamp, vectorUp _lamp];

        [{
            params ["_lamp", "_position", "_dirAndUp"];

            _lamp enableSimulationGlobal false;
            _lamp hideObjectGlobal true;
            _lamp setPosWorld _position;
            _lamp setVectorDirAndUp _dirAndUp;

        }, [_lamp, _position, _dirAndUp]] call CBA_fnc_execNextFrame;
    }] call CBA_fnc_addClassEventHandler;
};

Why not, but I still think they fall down on the clients that JIP before ESG is synched.

little oxide
#

HAve you a config example for override BIS functions @little eagle ?

little eagle
#
class CfgFunctions {
    class A3 {
        class GUI {
            class initDisplay {
                file = "whatever";
            };
        };
    };
};
#

A3_Functions_F in requiredAddons

little oxide
#

But i need to put in my folder all the script that have already the BIS one

#

because tested and said me another script missing

little eagle
#

Did you overwrite file outside of the deepest class?

queen cargo
#

Why override a function?

little eagle
#

To have it do something else.

#
if (isServer) then {
    ["Land_Camping_Light_F", "init", {
        params ["_lamp"];

        private _position = getPosWorld _lamp;
        private _dirAndUp = [vectorDir _lamp, vectorUp _lamp];

        private _fnc_glue = {
            params ["_lamp", "_position", "_dirAndUp"];

            _lamp enableSimulation false;
            _lamp hideObject true;
            _lamp setPosWorld _position;
            _lamp setVectorDirAndUp _dirAndUp;
        };

        private _args = [_lamp, _position, _dirAndUp];

        [_fnc_glue, _args] call CBA_fnc_execNextFrame;
        [_args, _fnc_glue] remoteExec ["call", -2, true];
    }] call CBA_fnc_addClassEventHandler;
};

If this one ^ doesn't work then I'd give up on ESG.

little oxide
#

It's working thanks @little eagle

little eagle
#

👌🏻

queen cargo
#

Weird idea: copy it and modify it, afterwards call the copy

little oxide
#

Because, i wanted to not setVariable 7 times to lock a door on my house in public

#

that overload the network for nothing, one var is fine for what I want to do

little eagle
#

savage

meager heart
#

it's good to have dedicated server for testing sh.. things 😄

//--- from the console
0 spawn {
    private _lamp = "Land_Camping_Light_F" createVehicle (player modelToWorld [0,5,0]);
    _lamp enableSimulation false;
    private _position = getPosATL _lamp;
    _position set [2,1.5];
    _lamp setPosATL _position;
}; 
//--- object placed in editor, with this in init
0 = this spawn {
    if (!isServer) exitWith {};
    _this enableSimulationGlobal false;
    private _position = getPosATL _this;
    _position set [2,1.5];
    _this setPosATL _position;
}; 

this ^ https://imgur.com/zdiHrqj

little eagle
#

But that's what I wanted to avoid. Having to manually change the height etc.

meager heart
#

oh... i see

little eagle
#

I imagine the ideal solution to work for every lamp even those you place afterwards with being able to rotate and move them in the editor and without having to put scripts into their init boxes.

meager heart
#

init boxes < imo it's like triggers, ez way for new guys in editor 🤷

little eagle
#

The problem with them is that they're invisible unless you click on them in the gui.

#

Guess you can edit the mission.sqm

#

And having to manually put down a position is frustrating.

#

I'd get annoyed by that quickly.

errant jasper
#

Init boxes are the best way to do object-specific configuration.

little eagle
#

True, but this one is for 6 lamps, so more like class specific.

errant jasper
#

Yup. Just wanted to say that they are not universally bad

#

I also use triggers to mark areas for some specific purpose, like sectors, minefield, etc.. But it is only used to aid the mission designer. When the proper script runs, it find the proper triggers, reads their data, and deletes them.

little eagle
#

Since they added inArea, I like markers more. I find a script to be way less confusing than all those options in the trigger ui.

errant jasper
#

But you have to hide those in preInit right to avoid people seeing them on the map - at least for those areas not intended for players to know about?

little eagle
#

And triggers ignore units in vehicles. That's the absolute most dumb bullshit in this game probably.

errant jasper
#

Yeah, can't believe they never changed that in Arma 1, Arma 2, Arma 2 OA, Arma 3, Arma 3 Apex, Arma 4 (oops spoiler) 😃

little eagle
#

markers are on the map and if you give them descriptive names, the second guy editing the mission should understand.

errant jasper
#

I meant for players

little eagle
#

You can make markers invisible to the players and still see them in the editor.

#

I hope they don't cut too many features from A4. New engine is always scary.

errant jasper
#

Where do you do that?

little eagle
#

Did what?

errant jasper
#

Make the markers invisible to players in the editor while still being able to see them?

#

Also wish they would make them somehow visible in the 3d view..

little eagle
#

Alpha -> 0

errant jasper
#

Then I can't see them in the editor

little eagle
#

Oh you mean in preview?

errant jasper
#

No? In Eden editor (2d view).

little eagle
#

¯_(ツ)_/¯

errant jasper
#

Well, that is why I still prefer triggers that are then deleted later.

little eagle
#

Well if you're smart enough to understand all those dropdown options. :/

meager heart
#

also if that trigger for position, there is option "Copy position" 🤷

errant jasper
#

I ignore all the options for my purposes. Just writing something special in the text field like: <SECTOR> , or <SPAWN_AREA> . When the mission initializes a script just processes each and delete them.

little eagle
#

So you invented a trigger eating machine that craps out scripts? To utilize the ui parts?

errant jasper
#

Does not necessarily craps out scripts. A single script might just go through each and record the area e.g. for side missions in some variable. Then nothing is running after that.

meager heart
#

Just writing something special in the text field like: <SECTOR> , or <SPAWN_AREA> .
thats how BI use them also, in they missions ^

errant jasper
#

They do.... Damn now I feel bad.

meager heart
#

lol

little eagle
#

That's awesome. Does it utilize inArea?

errant jasper
#

My code? Depends on what it does later it might.

#

Like this

private _triggers = [0,0,0] nearObjects ["EmptyDetector", 99999];
private _sectors = _triggers select {triggerText _x find "<SECTOR>" != -1};
MY_MissionAreas = _sectors apply {triggerArea _x};
{deleteVehicle _x} forEach _sectors;```
Nothing that can't be done with markers, just prefer triggers.
#

And inspired by your CBA lobby naming, I may also add additional information in the text: <SECTOR> @ Lakka Town @ 200 (that can of course also be done using markers).

little eagle
#

The only reason I had to do this clumsy @ thing is, because that's the only way to sent information to people in the lobby.

errant jasper
#

Now that I think about it, I should probably just do: <SECTOR> @ ["Lakka Town", 200] because then I can use parseSimpleArray on the second part and forget about manually de-padding.

#

Is there a variant of parseSimpleArray that does not error out when giving not an array - then I can get rid of the separator symbol fully?

little eagle
#

joinString splitString out the white space.

#

Oh, white space is these chars:

#define ASCII_NEWLINE 10
#define ASCII_CR 13
#define ASCII_TAB 9
#define ASCII_SPACE 32

// White-space, used by the SPON_stringTrim* functions.
#define WHITE_SPACE [ASCII_TAB, ASCII_SPACE, ASCII_NEWLINE, ASCII_CR]
errant jasper
#

Found a, uhhhm, workaround for parseSimpleArray that does not error out on bad data:

private _data = parseSimpleArray ("[" + _origArrayStr + "]") select 0;```
little eagle
#

Oh, yeah. You need it to be an array in the first place.

errant jasper
#

You are allowed to select one past the last element of an array? Just yields nil?

little eagle
#

Yes.

#

It only errors at count + 1

#

Despite count

#

not being any element

#

It's weird.

errant jasper
#

Hmm, guess it might be something they "inherited" from C/C++ where you may construct a pointer one element past an arrays end, but not dereference it...

little eagle
#

Or they just screwed up a check and intended for it to error starting at size/count, but forgot a - 1.

#

And now it's here to stay due to bwc.

still forum
#

in c++ you might construct a pointer anywhere. Not just one past the end

little eagle
#

param

still forum
#

I vote for the "forgot" variant

little eagle
#

_array param [10] // <- nil no error

errant jasper
#

Dunno about C++. But in C, am pretty sure that constructing arbitrary pointers is undefined behaviour by the standard, though in practice nothing bad will happen.

still forum
#

It's just a number. Until you dereference it.
Same for "one past the end" as anywhere else

little eagle
#

You could look it up, Dedmen.

still forum
#

I'm very sure they just have a index > array.size then error

#

off by one errors are very common

errant jasper
#

Then maybe I have read too much stack overflow then. But have seen many places where it indicate the things you are allowed to do with pointers by the standard in C/C++ is quite restricted, though in practice nothing bad happens. Even converting pointers to integers to store them, then later converting them back is apparently tricky to get right (in these sense of not breaking the language specification and getting UB).

terse sleet
#

hello my responsibility

#

I want to get the arma 3 backup account, this is ascam as the account holder gift but I have the arma 3 in the backup account

little eagle
#

🤔

terse sleet
#

I am from turkısh

#

google translate xd

#

arma 3 alcam 2. i have an account but i have arma 3

still forum
cold pebble
#

Can you setVariable on terrain objects?

still forum
#

no

#

"generally" not.
Houses you maybe can. But they might get deleted once the house gets out of view distance

cold pebble
#

Ok thanks

peak plover
#

They get deleted?

#

What about on the server

still forum
#

they get streamed out/in.
Don't know about server.

#

But also depends on the type of terrain object. Things like bushes or trees might not be able to hold any variables

little eagle
#

why not try`?

peak plover
#

Quite interesting. I wonder if this wud break me saving the terrain objects into car as ref.

#

I'll be at PC in like 6hours. Gotta try that

#

Intrieguing

still forum
#

"terrain objects" is a kinda broad term. Big Stones are also terrain objects. Just as bushes, trees, fences, houses, lamps, streets

peak plover
#

Hmm yes

still forum
#

and you definetly cannot set variables on terrain stones. You cannot even get them via cursorObject or alike

little eagle
#

Are you sure about that?

still forum
#

no

#

😄

tame portal
#

you can get them via cursorobject i believe

errant jasper
#

But it would not surprise me. Was unable to acquire the gas station signs on Altis to remove. Just a p3d no classname.

tame portal
#

if that doesnt work, nearestobjects returns them 😛

still forum
#

nearestTerrainobject maybe. But doesn't that just return model path and not an actual object?

errant jasper
#

^^ in many cases I believe this is the case.

little eagle
#

Objects don't need to have a classname.

#

E.g. super simple objects, or the gas station signs.

austere granite
#

and not an actual object? It returns objects and you can set variables on them

#

cursorTarget doest work on it, cursorObject often does

little eagle
#

Question is if the variables are synched in case we're talking about setVariable public.

#

And if JIP works etc.

#

Streaming keeps the variable.

#

etc.

still forum
#

Just tried a rock.
nearestTerrainObjects [player, [], 3] -> [425794: limestone_01_02_lc_f.p3d]
myObj = nearestTerrainObjects [player, [], 3] select 0
myObj -> 425794: limestone_01_02_lc_f.p3d
myObj setVariable ["test",123];
allVariables myObj -> []
[myObj getVariable "test"] -> [<null>]

#

doesn't work. Even though you can get the actual object value instead of just a model path

little eagle
#

nice

#

What about cursorObject?

still forum
#

Grrr I already closed Arma. One minute...

#

"Stealing a car is cosidered a serious crime on Malden."

winter rose
#

this one always got me

still forum
#

"National tree of Malden is the stone pine (Pinus pinae)"

#

cursorObject returns the stone. Same as nearestTerrainObjects

#

nearestObjects also returns it

little eagle
#
  1. create a hash
  2. key is [<stone>,"varname"]
#

There, saved the day once again.

#

setVar equivalent on terrain objects

peak plover
#

What's a hash

#

How does it function? Array and find?

little eagle
#

Yes.

peak plover
#

Wow I thought it was more magical

little eagle
#

lol

peak plover
#

I guess that is f8ne

little eagle
#

The magic is to have concepts for many simple things.

#

And then to put them together in the right order.

peak plover
#

🤔

#

I guess u can have key followed by data

#

And keys in separate array from data

#

Etc.

still forum
#

CBA hash is [magic, [keys], [values]]

#

key index == value index

peak plover
#

Magic?

still forum
#

just a identifier so you know that's a hash and not just a random array

little eagle
#

The #0 is so pointless. Getting rid of that in A4.

peak plover
#

Using var nan3space must be faster than sqf

little eagle
#

stones have no var namespace

peak plover
#

Create location and setvar instead of array

little eagle
#

How to link the stone to the location?

peak plover
#

Pos or object

still forum
#

hash works cuz anything can be keytype. Namespace (atleast without Intercept-CBA) only have string keys

peak plover
#

I learned hard way

#

Saving to profilenamespace I need to stringify before saving

#

At least they stopped malicious code from running

#

But I completely broke my game a few times on boot when profile loaded

#

Leaky code type

little eagle
#

Really?

#

pns can't hold code?

still forum
#

it can

#

But sometimes it seems to randomly execute code

peak plover
#

I had mixed and probably mistake saving it

little eagle
#

But sometimes it seems to randomly execute code
lol what?

still forum
#

global namespace not passed.
"true"

Seen that error before?

little eagle
#

Ye

peak plover
#

Yeh, before in theory u could join malicious srv. And get sth that kills ur player or just crashes gam3

still forum
#

Something can corrupt profilenamespace. Which causes the engine to execute code from inside it. While it doesn't have a namespace yet and then prints that

little eagle
#

Can you inject code with that in mp?

peak plover
#

It don't work anymore afaij

still forum
#

didn't try yet. If you store and load code in pns and execute that in MP then obviously yes

#

Vanilla should be safe. But custom mods...

peak plover
#

I save stuff to pns

little eagle
#

ya said it runs on its own.

peak plover
#

A2 oa had that and I think it was in the latest patch notes

little eagle
#

A2 yawn

peak plover
#

Yeah

meager heart
#

cough there is one type of hash that would be considered as even more serious crime on Malden than just stealing a car cough 😄

meager heart
#

🤔

little eagle
#

drugs

#

What are you thonking about?

peak plover
#

HASHtables

#

Hashtables bruh

meager heart
#

yes! exactly that ^... no drugs at all 😄

little eagle
#

hash tablets

peak plover
#

Sounds sketchy, I'm calling the mods

little eagle
#

Isn't it weird how there is an emoji for tabacco, but not weed?

#

🚬

meager heart
#

🚓

little eagle
#

I'd expected there to be neither at worst.

peak plover
#

Disco rd supported by tobacco companies

little eagle
#

I wouldn't be surprised in the least.

meager heart
#

how it works... it looks like it was tobacco company in b4

unborn ether
#

@little eagle well tabacco is kinda not widely forbidden, while weed mostly is.

little eagle
#

What is the law? What does the state? The free man follows his own fate.

peak plover
#

The free man has a white name ✊

#

One of us

still forum
#

What?

meager heart
#

😄

little eagle
#

Morgan Dedman

austere granite
#

Freefurri

little eagle
#

They should number the panels. I read it in the wrong order again.

digital jacinth
#

I am currently creating trigger areas for a script i am working on. It works in sp, but does not work on a dedicated server. I am kind of scratching my head on this one.
I already debugged the trigger statements, they are all true except the inArea check. meaning it is not detecing acre_player inside the trigger area, hwoever as said before, in sp it works.

if(!isServer) exitWith {};

params[["_obj",objNull],["_power",1000],["_frequencies",[ [0,999999] ]],["_effectiveRange",1000],["_falloffArea",500]];

if(isNull _obj) exitWith {};
private _pos = getPosATL _obj;
_trg = createTrigger ["EmptyDetector", _pos];
_trg setPosATL _pos;
_trg setVariable ["jammer_active", true, true];
_trg setVariable ["jammer_object", _obj, true];
_trg setVariable ["jammer_effective_radius", _effectiveRange, true];
_trg setVariable ["jammer_falloff_radius", _falloffArea, true];
_trg setVariable ["jammer_power", _power, true];
_trg setVariable ["jammer_frequencies", _frequencies, true];
private _radius = _effectiveRange + _falloffArea;
_trg setTriggerArea [_radius, _radius, 0, false, _radius];
_trg setTriggerActivation ["ANY", "PRESENT", true];
_trg setTriggerStatements ["this && thisTrigger getVariable ['jammer_active',false] && alive (thisTrigger getVariable ['jammer_object',objNull]) && acre_player in thisList", "[thisTrigger, acre_player, true] call diw_acre_fnc_addJammerToPlayer", "[thisTrigger, acre_player, false] call diw_acre_fnc_addJammerToPlayer"];

_obj setVariable ["jammer_zone", _trg, true];

Any ideas?

winter rose
#

Where is acre_player set? (not familiar with the acre setup)

digital jacinth
#

acre_player is used like ace_player. it is basically the CBA function to get the current player or remote controlled unit

winter rose
#

so, how is the dedi supposed to know where is the player? On a dedi, player is objNull

digital jacinth
#

true, only the client has that set

#

this is however on the client side and not server side

little eagle
#

ace_player is the same as player, except that it reports the unit you remote control if you do instead of the player.
Think of it as currentUnit.
It is meant to be used instead of player everywhere, so your scripts work while remote controlling AI with zeus.

winter rose
#

well this script is server side (or nowhere at all): if (!isServer) exitWith {} ;

errant jasper
#

Lou, the trigger is not created locally only.

digital jacinth
#

the trigger is created on server but is global to all machines

little eagle
#

Is this the target debugging menu?

digital jacinth
#

yes

winter rose
#

@errant jasper oh, right

little eagle
#

I assume acre_player is the same as ace_player, since you can use acre without ace, and jonpas found ace_player to be useful.

#

Probably so you can speak as the unit you remote control as zeus.

winter rose
digital jacinth
#

oh i am an idiot, i set the target scope to server in the target debug menu, of course it is then null...
yet the inArea check is false.

little eagle
#

target debugging is awesome.

winter rose
#

create the trigger, sleep for 2s, then init it maybe

little eagle
#

Wish it was enabled by default.

errant jasper
#

Under which conditions is ACE_player/acre_player != player ?

meager heart
#

maybe you can change setTriggerActivation "ANY" to > "ANYPLAYER" 🤔

digital jacinth
#

@errant jasper when remote contorlling a unit

#

@meager heart any needed for remote controlled units sadly

errant jasper
#

@digital jacinth As in remote controlling UAV/UGV right, unlike teamswitching ?

digital jacinth
#

nah, remote controlling as in zeus remote controll an AI unit

errant jasper
#

Ah yeah, that would be a more common occurrence. Thanks.

#

Seems like maybe there should be a CBA_player instead, since both ACE_player, and acre_player basically delegates to the CBA "unit" player event.

meager heart
#

also that trigger is set to "repeatedly" but there is no setTriggerTimeout 🤔

little eagle
#

Muzzleflash, the whole player events thing was made for ACE, because it was needed to make stuff work, and make it work with reasonable overhead.

#

Then ACRE wanted it too, and probably other people as well, so it got ported to CBA.

#

ACE_player was a thing at that point, so instead of the variable being set via an ace event, it is set via cba event.

#

Can't just rename the variable as well. Would break a ton of things.

#

I don't like that it is named "x_player". Too confusing with theplayer command. It's more of a currentUnit or avatar. My fault, because I made it originally as AGM_player.

#

AGM_Core_fnc_callCustomEventHandlers
This shit makes me nostalgic.

vagrant mango
#

Hey all.. how might I go about getting a light to actually give off light in an area around it. I thought the CUP Red lights would give off light but they don't apparently.
A real quick search found a script for making an exterior red light on a helo but that didn

#

didn't work. (Made sure variablenames and such lined up, and no dice)

little eagle
#

Are you asking how to create a flare?

vagrant mango
#

No. An actualy light

#

Actual light.

#

Or lamp depending on how you refer to them.

little eagle
#

🤔 No such thing in this game.

vagrant mango
#

Well then. Thats a bummer, theres no way to create a lightsource to attach to something at all?

blissful phoenix
#

BI never put much stock in interior design :)

little eagle
#

Of course there is.

vagrant mango
#

Sorry I should have clarified I meant a light source not like a standalone light via scripting.

#

I basicalyl want to attach the light source to the light object which doesn't seem to work.

#

The object itself I mean.

little eagle
#
params ["_object"];

private _lightSize = 1;

private _light = "#lightpoint" createVehicleLocal [0,0,0];
_emitter attachedTo [_object, [0,0,0.5]];

_light setLightBrightness 1.0;
_light setLightColor [1,0.65,0.4];
_light setLightAmbient [0.15,0.05,0];
_light setLightIntensity (50 + 400*_lightSize);
_light setLightAttenuation [0,0,0,1];
_light setLightDayLight false;
#

What is a "light object"?

vagrant mango
#

An actual light. Like a wall lamp. I mean to say something that has a lightbulb and should give off light lol

little eagle
#

Land_Camping_Light_F

#

?

vagrant mango
#

Specifically this light

little eagle
#

Those are automatically on all the time I believe. And when it's dark, you can see the light.

vagrant mango
#

Red_Light_EP1

little eagle
#

No idea what that is.

vagrant mango
#

Hmmmm... not apparently when Im testing it.

#

ITs in CUP.

little eagle
#

Just use the script I posted? It attaches a light to _object.

#

Uhm?

#

_light setLightUseFlare true;
_light setLightFlareSize 3.0;
_light setLightFlareMaxDistance 1000;

#

Some more commands. Flare that I told you about.

fallen locust
#

@vagrant mango _light setHit ["light_1_hitpoint", 0.92]; to turn it on 0 to turn it off... Dont ask why its just arma

little eagle
#

He's not trying to turn it off.

fallen locust
#

0.92 smt turns it on

#

dmg that is

#

Dont know why it just is like that last time i tested

little eagle
#

Red_Light_EP1?

meager heart
#

you can just setDamage it

fallen locust
#

Any light i tested in arma

little eagle
#

0 -> on
1 -> off

fallen locust
#

Could be i know its dumb like that

little eagle
#

You got it backwards.

#

0 is ON
1 is OFF

#

Because if you shoot the light, it goes kaputt.

#

Damage increased.

fallen locust
#

I still dont understand why turning it on and off is directed by damage if damage is not 1 but hey

little eagle
#

I have no idea what you're trying to say. Can you formulate a proper sentence?

#

The Turk was easier to understand.

#

And he used Google Translator in language no one gives a shit about.

fallen locust
#

Should i write it in macros so you understand?

little eagle
#

English would be enough.

still forum
#

Why are you telling someone, that asks how to add a light, how to turn a light off? 🤔
I'm confused

little eagle
#

He's confused too.

#

I still dont understand why turning it on and off is directed by damage if damage is not 1 but hey

#

Like wtf does that mean?

fallen locust
#

Because if you spawn a light during daytime it will not turn on during the night if you dont first set some dmg to it and then reset it to 0.

#

Last time i checked at least

little eagle
#

It is controlled by damage, because if you shoot a light it goes off. Using setHit just exploits that.

#

Okay now that was a coherent sentence. And it's new to me.

tight narwhal
#

Script copier here, would like to ask if my idea is feasible and how to implement it. As is the script aint working (I keep respawning as BLUFOR) and I reach out for positive help. Trying to create a "dynamic respawn" by letting individual players spawn differently depending on number of deaths.

In initPlayerLocal.sqf

_TotalDeaths = 0;  
player addEventHandler 
[
"Respawn",              // When player respawn...
{
    _TotalDeaths = _TotalDeaths +1; // on player respawn add 1
    if (_TotalDeaths == 2) then      // If deaths is 2 then...
    {
        _newGrp = createGroup EAST;             //Greate new east group
        [(_this select 0)] joinSilent _newGrp;  // join new group
    }                                           // Player is now OPFOR/EAST 

    else 
        {
        if (_TotalDeaths == 3) then // if deaths is 3 or more then...  
        {
            call BIS_fnc_EGSpectator;   // move player to specatator 
        }

        else 
        {
        };
    };
];
little eagle
#

You need a global variable for this.

#

The code block inside the Respawn eventhandler is a different script instance.

#

It runs way later than the part of the script that adds the eventhandler.

#

And repeatedly for each death of course.

#

So it being a different script instance means, that no local variables are carried over.

#

_TotalDeaths is a local variable.

#

Change that to a global variable and you're golden.

fleet wind
#

Ie remove the _

little eagle
#

Also, a technicality, but important imo. You named the variable "total deaths", but actually it's about "total respawns", not "deaths".

#

Since global variables are shared in all script instances, the names of the variables of different scripts could collide and cause errors.
Which is why global variables are usally tagged. With an OFPEC tag.

#

So you should use, idk, James_TotalDeaths.

fleet wind
#

Why James ? Hahahaha i did not ask the question

little eagle
#

Oh, sorry. It scrolled too far 😛

still forum
#

Because James is just a very cool name

fleet wind
#

Haha 😂

meager heart
#

also spectator should be initialized when player not respawned yet 🤔

#

you can terminate it after respawn

little eagle
#

total deaths being 2 could remove the eventhandler from inside using _thisEventHandler and add a killed eventhandler starting the spectator.

meager heart
#

yep ^

#

wiki page is empty for EG spectator but there is a lot of options...

tight narwhal
#

Thank you, appriciate the help!

still forum
#

If you need help with them sure

#

But this is not really a "post your random script snippets here" channel

#

No. You will very quickly get a ban for that

little eagle
#

🤦🏼

gleaming oyster
#

enjoy your ban

still forum
#

@open vigil ^

winter rose
#

strike

open vigil
#

And just like that, stupid was washed away.

ruby breach
#

More like do not pass go, do not collect $200

winter rose
#

_praise be unto ye, @open vigil _

golden storm
#

Hello there guys, a quick question, i'm making a script where the engine should choose a number from 1 to 10, if that number is higher than 5, then it should execute a certain script, what i currently have is this:

#

´´
selectRandom [1,2,3,4,5,6,7,8,9,10];
if < 5 then {

for "_i" from 0 to 6 do {
_testPos = selectRandom [getMarkerPos "pos1",getMarkerPos "pos2", getMarkerPos "pos3", getMarkerPos "pos4"] ;

_TakGroup = createGroup resistance;

_typeofgrp = selectRandom [(configfile >> "CfgGroups" >> "Indep" >> "LOP_AM" >> "Infantry" >> "LOP_AM_Fireteam"),(configfile >> "CfgGroups" >> "Indep" >> "LOP_AM" >> "Infantry" >> "LOP_AM_Rifle_squad")];
_TakGroup = [_testPos, GUER, _typeofgrp] call BIS_fnc_spawnGroup;
_ranWay = getMarkerPos "oav";
_TakGroup addwaypoint [_ranWay,0];
}

}
´´

#

would this work?

gleaming oyster
#

how about

if((random 10) > 50) then {

};
golden storm
#
if((random 10) > 50) then {

for "_i" from 0 to 6 do {
_testPos = selectRandom [getMarkerPos "pos1",getMarkerPos "pos2", getMarkerPos "pos3", getMarkerPos "pos4"] ;

_TakGroup = createGroup resistance;

_typeofgrp = selectRandom [(configfile >> "CfgGroups" >> "Indep" >> "LOP_AM" >> "Infantry" >> "LOP_AM_Fireteam"),(configfile >> "CfgGroups" >> "Indep" >> "LOP_AM" >> "Infantry" >> "LOP_AM_Rifle_squad")];
_TakGroup = [_testPos, GUER, _typeofgrp] call BIS_fnc_spawnGroup;
_ranWay = getMarkerPos "oav";
_TakGroup addwaypoint [_ranWay,0];
    }

}

Something like that?

gleaming oyster
#

I guess that works..

golden storm
#

But that will make it ALWAYs execute right?

gleaming oyster
#

but move testPos variable beneath the if statement. No need to run that more than once

#

no

golden storm
#

I want a 50 - 50 chance, so could i change it to if ((random 10) > 5) then {

gleaming oyster
#
if((random 10) > 5) then
{
    //if a random number between 0 and 10 is more than 5 then execute this
};
golden storm
#

yup thats what i was aiming for, just was unsure if it would work, anyways, thanks a lot, ill try it, im kind of new in scripting so thanks

wary vine
#

((random 2) > 1)

golden storm
#

One last question

#

is the syntax for the Independent properly used?

#
if((random 10) > 5) then {

for "_i" from 0 to 6 do {
_testPos = selectRandom [getMarkerPos "pos1",getMarkerPos "pos2", getMarkerPos "pos3", getMarkerPos "pos4"] ;

_TakGroup = createGroup guer;

_typeofgrp = selectRandom [(configfile >> "CfgGroups" >> "Indep" >> "LOP_AM" >> "Infantry" >> "LOP_AM_Fireteam"),(configfile >> "CfgGroups" >> "Indep" >> "LOP_AM" >> "Infantry" >> "LOP_AM_Rifle_squad")];
_TakGroup = [_testPos, GUER, _typeofgrp] call BIS_fnc_spawnGroup;
_ranWay = getMarkerPos "oav";
_TakGroup addwaypoint [_ranWay,0];
    }

}
ruby breach
#

createGroup needs a side. Either resistance or independent

golden storm
#

I was also getting an issue on this line:

_TakGroup = [_testPos, GUER, _typeofgrp] call BIS_fnc_spawnGroup;

ruby breach
#

That also requires a side. Same as above

golden storm
#

but according to Wiki, independent is interpreted like GUER

ruby breach
#

Only when converted to a string

golden storm
#

So it should be:

_TakGroup = createGroup resistance;
_TakGroup = [_testPos, GUER, _typeofgrp] call BIS_fnc_spawnGroup;

Right?

ruby breach
#

Just FYI, ```sqf
(side player == independent) //returns true
(side player == resistance) //returns true
(side player == guer) //returns nothing

golden storm
#

oh lol ok, ty

#

Corrected

_TakGroup = createGroup resistance;
_TakGroup = [_testPos, INDEPENDENT, _typeofgrp] call BIS_fnc_spawnGroup;

Have patiente on me please hahaha

#

Worked!

#

Thx a lot

ruby turtle
#

When I define Leaflets, is it possible to put the text into arabic letters?

peak plover
#
missionNamespace setVariable ["GUER",resistance,true];
missionNamespace setVariable ["CIV",civilian,true];

put that in the beginning of your code

#

Can anyone help me make a formula to make a distance value drop based on speed an height?

#
cDist = 800;

h = 100;
s = 100;

cDist = (cdist - ( ( floor(((h*1.5/100)*s)/100) * 25) ))min cDist;

sand grotto
#

is it possible to set a delay between commands in a trigger

peak plover
#

Sure

#
//onActivation
_handle = [] spawn {
    hint 'triggered';
    sleep 5;
    hint 'triggered 5 seconds later';
};
#

@sand grotto

sand grotto
#

i put that in between my commands?

peak plover
#

hint

#

is a command

#

U put ur commands around the sleep

#

What is ur current trigger code?

sand grotto
#

oh i see

peak plover
#

Those hints would come instant and 2nd one 5 second later

sand grotto
#

should i set up all triggers like that?

#

im fairley new to scriptng

peak plover
#

What are you trying to do

#

It's a janky solution

sand grotto
#

get 2 helicopters to take off a sencond apart

peak plover
#

ohh yeah

#

Just do that

sand grotto
#

oke thx bae 😃

peak plover
#

👏🏻

sand grotto
#

_handle = [] spawn {
pilot1 enableAI "MOVE";
sleep 1;
pilot2 enableAI "MOVE";
};

#

this look good?

#

@peak plover

#

sweet that worked thx man

peak plover
#

hell yeah

#

Btw u can post code in discord by pressing the key under escape and writing like this:
(copy paste the following 5 lines into chat)

```sqf
// comment
pilot1 enableAI 'MOVE';
sleep 1;
```

#

it will look like this:

// comment
pilot1 enableAI 'MOVE';
sleep 1;
#

three x ` (no space)sqf <-- the sqf part is important

#

@sand grotto

gleaming oyster
#

tilde key is the name of the key

sand grotto
#

very cool thanks @peak plover

hushed minnow
#

hey fellow scripters, got a problem for you guys.

_mounted_veh setVehicleAmmoDef 1; will reload guns with the config ammotype and loadout but it will also reset passengers in FFV seats.
Anyway around that?

ivory nova
#

Sorry for the nooby question, but what's the best way to define functions in a functions.hpp while keeping functions organised into different folders? If I use class Whatever { class Functions {}}; and group everything together I can call the functions in-game, but not when splitting them up into different folders and referencing the folders with file = "functions\systems"; etc.

#

Anyone know an example out there that'll clear it up for me?

gleaming oyster
#

@ivory nova you need to create a class for each function inside the systems folder

#
class systemsthings
{
    file="functions\ystems";
   class fn_coolFnc{};
};
ivory nova
#

Hm, this is what I have (removed all but one of each function)

tag = "RND";
        class Macros {
            tag = "RND";
            file = "functions\macros";
            class randomColour {};
            };

        class Systems {
            tag = "RND";
            file = "functions\systems";
            class createActions {};
        };

};```
gleaming oyster
#

make sure each of the functions have a fnc_ or fn_ tag in front of them

ivory nova
#

ohhhh

#

each function declaration in the functions.hpp? or the files themselves?

#

I forgot the fn_ in the file it seems

#

hm, seems to add the fn_ automatically

gleaming oyster
#

files themselves

ivory nova
#

hm, i see, yeah have the fn_ in front

gleaming oyster
#

i could be just speaking out of my ass, but last time i remember that's how you do it.

ivory nova
#

yeah, it's strange, can see the functions in the functions viewer this way, but can't actually call them anymore

#

oh well, will just have to name files better instead of folders (:

#

thanks for your help man!

gleaming oyster
#

No worries, it does still work with the folders. I used it the other day in a mission, has to be something in the setup.

ivory nova
#

hm, i see!

#

yeah, i must've fucked up somewhere

#

i'll have to do a little reading

outer fjord
#

Greetings, I could use some assistance.

I want to use Addon free radio for my kp liberation mission. However, there is a script conflict as the mission already defines class CfgSounds.

Addon Free Radio wants their script installed in the Description.ext

#include "AFAR\f\SFX.hpp"
sounds[]={};
};```

Liberation frameworrk has a define in a hpp file
```class CfgSounds
{
    sounds[] = {};
    class parasound
    {

        name = "parasound";
        sound[] = {"res\c130.ogg", 1.0, 1};
        titles[] = {};
    };
};```

What would be the best way to merge these so they don't conflict?
meager heart
#
class CfgSounds 
{
    #include "AFAR\f\SFX.hpp"
    sounds[] = {};

    class parasound
    {
        name = "parasound";
        sound[] = {"res\c130.ogg", 1.0, 1};
        titles[] = {};
    };
};
#

🤔

little eagle
#

Too late.

meager heart
#

😔

digital jacinth
#

Yesterday I had a problem with a trigger not working properly in mp, I guess I figured out why that is the case.
commands like setTriggerStatement, setTriggerArea and setActivation are not broadcasted through network and you gotta remoteExec those...

digital jacinth
#

well yeah. I did not check that beforehand. Asked for help here as well and I think not many know this. But hey you never stop learning and sometimes cursing sqf in the process

molten folio
#

anyone got a script to show all weapons in a RscList?

digital pulsar
#

does anyone know if the old trick of switching group side by adding a leader with probabilty of presence = 0 causes any problems for players on dedi?

#

i want a group listed under blufor in lobby but be opfor ingame

little eagle
#

Foley, I am not aware of any issue with that, although I never heard of this. I assume not many people use this, so it may be broken, or it may work out nicely. I'd say you try it yourself, and should it cause problems, think of a different solution or ask for one again here.

#

It's not how I would do this.

#

Tom, I assume no.

#

Any specific question about RscList or ground weapon holders?

digital pulsar
#

how would you do this commy, i dunno of any other options?

little eagle
#

initPlayerServer.sqf

#

Give all the slots a specific var name, e.g. OpforUnit1

#

and then put into initPlayerServer.sqf:

#
isNil { // force unscheduled so one can reference potentially undefined variables without getting bothered
    params ["_unit"];

    if (_unit in [OpforUnit1, OpforUnit2, OpforUnit3]) then {
        if (isNil "commy_OpforGroup") then {
            commy_OpforGroup = createGroup east;
        };

        [_unit] joinSilent commy_OpforGroup;
    };
};
#

@digital pulsar ^

digital pulsar
#

thanks

molten folio
#

so i heard Player AllowDamage is detected is it true?

still forum
#

"detected" ? what?

molten folio
#

i mean its detected by Anitcheats

still forum
#

It can theoretically be detected.

#

Depends on the anticheat if it detects that or not

molten folio
#

any other way to have god mode other than Allowdamage?

still forum
#

HandleDamage eventhandler

molten folio
#

does it work on players?

#
player removeAllEventHandlers 'HandleDamage';```
#

Like that?

still forum
#

Think so yeah

molten folio
#

than if i wanna remove it , its like this sqf player addEventHandler 'HandleDamage';

#

??

fossil yew
#

Is it possible to mix wave respawn and regular fixed time respawn?

For example, when player dies he has to pick respawn point. If he picks base, he respawns after ten seconds. If he picks FOB he respawns when ten other players on his side want to respawn on the FOB.

#

Basically I'd like to create more cohesion in respawn based game modes.

#

Those who played Squad could be more familiar with where I'm going...

inner swallow
#

@molten folio you may have that the other way around

#

as evidenced by add and remove

still forum
#

If your intention is getting around anticheats you should very quickly stop chatting about it here...

gleaming oyster
#

^ This is where my thoughts went first

little eagle
#

The nerve of some people. ¯_(ツ)_/¯

#

If you have to ask here, you will not be able to outsmart the cheat fix.

gaunt dagger
#

lads, is there a config or setting for artillery fire randomness?

little eagle
#

No, what're you trying to do?

gaunt dagger
#

adding randomness factor of where the shells land

#

this works but doesnt add randomness to each shell

_artmark = getMarkerPos 'TarMark';
[mortar1, [_artmark getPos [200 * random [- 1, 0, 1], random 180], '12Rnd_230mm_rockets', 3]] remoteExec ['doArtilleryFire', mortar1];
#

and you can't execute the 2nd line 3 times which would randomize each shell but because the artillery vehicle won't shoot 3 shells if it gets the same command 3 times

little eagle
#

Have you tried changing that 3 to 1 and to copy paste the line two times?

gaunt dagger
#

"and you can't execute the 2nd line 3 times"

little eagle
#

Oh, so it only fires once if you order it 3 times at once?

gaunt dagger
#

yeah, it kind of overwrites the previous command

little eagle
#

Makes sense kind of.

gaunt dagger
#

im thinking there must be some kind of AI config or something

little eagle
#

But I recognize the code and it's nice that it at least fires once now.

gaunt dagger
#

because there is slight bit of randomness already

#

yeah, remoteexec did wonders

little eagle
#

It's not AI config, it's just the dispersion of the weapon config.

#

It's not something you can edit with scripts. You'd need an addon for that. And even then, you'd need some math to predict which angles create what scatter.

#

I'd still do a script, just rewrite it. Bit more complicated.

gaunt dagger
#

shit

#

maybe I can get around it by placing 3 artillery and seperately ordering them 1 command each

little eagle
#
_artmark = getMarkerPos 'TarMark';

[[mortar1, _artmark], {
    params ["_mortar", "_artmark"];

    private _weapon = currentWeapon _mortar;

    for "_i" from 1 to 3 do {
        private _ammo = _mortar ammo _weapon;
        private _position = _artmark getPos [200 * random [- 1, 0, 1], random 180];

        _mortar doArtilleryFire [_position, '12Rnd_230mm_rockets', 1];

        waitUntil {_ammo != _mortar ammo _weapon};
    };
}] remoteExec ["BIS_fnc_call", mortar1];
hollow thistle
#

Is it really true that mission params values must be integers only? I'm just checking it out and it seems to be working fine when using float values. Also BIS is using float values in "ReviveMedicSpeedMultiplier" of their revive implementation.

Am I missing something or is wiki outdated?

#

"Values; must be integers; has to have the same number of elements as 'texts'" -- from wiki

little eagle
#

You could try it. I wouldn't trust the wiki if I see it used somewhere in a different way.

#

@gaunt dagger What I wrote ^^^

hollow thistle
#

As I said it seems to be working fine, I'm just wondering if it will not cause problem somewhere where I have not expected them 😄

#

Ok, so I guess wiki is outdated then.

little eagle
#

It's not unheard of that the wiki is outdated, or was never correct about something to begin with.

meager heart
#

in b4 (BIS_fnc_getParamValue) it was working even if you have no text element for some value, it was just empty but working 😀

gaunt dagger
#

@little eagle I'm guessing this one is for waiting for the artillery to reset?

waitUntil {_ammo != _mortar ammo _weapon}
little eagle
#

It's waiting for the ammo of the mortars weapon to change.

#

Basically waiting for it to shoot, then repeat the for block again.

#

3 times.

gaunt dagger
#

aight ill give it a try

#

nvm im an idiot

little eagle
#

That just sends the whole indented code block to the machine of the mortar.

gaunt dagger
#

yeah, i was confusing your solution with something else 😛

little eagle
#

This doesn't handle the gunner dying or running out of ammo, but honestly, for a mission script it's good enough :P

gaunt dagger
#

yeah, it adds a bit of delay between each shot but its acceptable

#

cool thanks for that

little eagle
#

it adds a bit of delay between each shot but its acceptable
Does it?

#

That's surprising.

gleaming oyster
#

in a loop, how would I go about executing something once without exiting the loop? Brain is a little fried right now, need some ideas.

winter rose
#
_doThat = false;
while { true } do
{
   if (not _doThat) then {/*stuff*/ _doThat = true;}
}
little eagle
#

🤔

#

If it's only once then why is it a loop?

gleaming oyster
#

Multi use,
position is checked to see if it's near a location,
and if it's near a location then diag_log something,
of course though I don't want it doing that endlessly in the log.
So you see my dilema

#

@winter rose Interesting I guess.

little eagle
#

So you want to quit the loop as soon as you have a hit?

gleaming oyster
#

No, I want it to continue to loop, but only execute something once instead of multiple times like it would if the condition could be true for a long period of time. For this, I am just looking at the player position and checking if it's near a location, and then logging it.

#

I don't want the log to be totally full if the player stays in a location more than a minute. I think what lou posted is a fair solution

little eagle
#

So some parts of the loop should be on a different timeout.

gleaming oyster
#

here, letme post an example

little eagle
#

We're approaching Spaghetti code here fast. I can already tell.

gleaming oyster
#

most certainly

little eagle
#

I haven't ranted about how loops are shit in a long time here.

gleaming oyster
#
params[["_unit",objNull,[objNull],["_code",{},[{}]]]];
while{alive _unit} do
{
  _cPos = getPos _unit;
  if(!(_cPos isEqualTo getPos _unit)) then 
  {
    call _code;
  };
};

(I don't think this will work, feel free to correct me. Just brainstorming here).
Since the player position will be changing frequently I don't want it to be relentlessly calling the code.

little eagle
#

There's no sleep in that loop.

#

You're running the same loop 1000 times every frame. :P

gleaming oyster
#

Sure, but that's not really the point.
I originally had a suspension time of 3 seconds.
But the same thing, every 3 seconds it'll go "WAAAAH. Execute this shit"

meager heart
#

also move one ] in to _unit

gleaming oyster
#

Yep

little eagle
#

_cPos = getPos _unit;
if(!(_cPos isEqualTo getPos _unit)) then
It seems to me that this is rather pointless?

gleaming oyster
#

Correct

little eagle
#

getPos _unit should always be equal to getPos _unit, no?

gleaming oyster
#

Wait, no. Because it's different.
Say, if at one point it's grabbed and it's grabbed at another time then they're different

little eagle
#

I cannot decipher the purpose of this script, and I'm really trying.

gleaming oyster
#

Pass Unit to evaluate position of -> Pass Code to be executed when position of unit has changed -> loop while unit is alive -> execute passed code if unit's position is different from last

#

suspension is needed for this to work at all

little eagle
#

The positions of units always change, because all they have to do is to twitch and they've moved a micrometer.

gleaming oyster
#

sure, and I'm not really concerned about accuracy of position

little eagle
#

Well then the position check is pointless, because it will always be even so slightly different. Due to rounding alone.

gleaming oyster
#

how would you go about this then?

little eagle
#

You need some kind of distance threshold.

#

Like say, moved at least a meter.

gleaming oyster
#

Hmm.

little eagle
#

Do you see what I mean?

gleaming oyster
#

Yes I do see what you mean. I'm just curious as to how I would do that.

#

subtract a meter from each and make sure it's either equal or above it? 🤷

little eagle
#
params [
    ["_unit", objNull, [objNull]],
    ["_code", {}, [{}]]
];

private _position = getPosWorld _unit;

waitUntil {
    if (_position vectorDistance getPosWorld _unit > 1) then {
        _position = getPosWorld _unit;

        call _code;
    };

    // condition to quit
    !alive _unit
};
gleaming oyster
#

😱 ,
Waituntil???

little eagle
#

Why not? It has only one code block and is therefore better performance wise in every way than while.

#

It also always suspends at least one frame, so the missing sleep is taken care of too.

#

I'd still add a sleep. Well I never would use a loop like this, but w/e.

gleaming oyster
#

makes sense.

little eagle
#

This resembles event based code, so I underestimated it when I said Spaghetti.

#

You can replace
call _code
with
isNil _code
if you want it to do the exact same thing, but execute the _code in unscheduled environment.

gleaming oyster
#

Oh, yeah i forgot about that.

meager heart
#

i'm just curious what that thing should do ? like every unit movement "something" 🤔

#

hint "Don't move!"; 😄

little eagle
#

Execute code every time the unit moves a meter.

#

It doesn't do anything on it's own. It's basically the polling for your own custom ObjectMoved eventhandler.

meager heart
#

😮

little eagle
#

Well, except that this is one loop for each _code. So it's still very basic and bad atm.

meager heart
#

i was thinking maybe it was for some sort of restrictions... or... for some mission thing

gleaming oyster
#

Modified it to pass old position and new position + custom parameters. I dunno, it works okay.

little eagle
#

Do you plan to use this with multiple _code's on the same object?

gleaming oyster
#

how do you mean?

little eagle
#

Well, use the function that creates this loop - the one you posted / I edited - at least twice or more on the same _object.

#

WIth different _code.

gleaming oyster
#

No, I plan to be able to make a new function that can set the used code after it's set. so no need to run it multiple times

#

as well as an exit variable

little eagle
#

If you'd manage to have it run only one loop, but potentially execute multiple _code, you'd basically have an eventhandler that's based on polling. But if you don't want to use it more than once per object, then I wouldn't worry about it.

#

You should still add a sleep, because if you do this on a lot of objects, you eat through the 3 ms or whatever it was pretty quickly, and then the mission stops being fun.

gleaming oyster
#

lol, will do.

little eagle
#

It's not like a unit will move that quickly every few frames anyway.

meager heart
#

sport hatchback 🚗 with tweaks will do the trick lol

little eagle
#

👌🏼

tame lion
#

hey any ACE scriptors on here, i have an issue with getting an ACE interaction to show up from inside a vehicle. I got the action to show up outside the vehicle, but not while in say the drivers seat. How would one go about creating that action?

little eagle
#

ace_interact_menu_fnc_createAction or config?

tame lion
#

createAction

#

also its on an object, not a class, if that matters

little eagle
#
  • 9: Other parameters [showDisabled,enableInside,canCollapse,runOnHover,doNotCheckLOS] <ARRAY> (Optional)
#

I guess enableInside has to be true.

tame lion
#

oh lol never noticed that,, thanks commy. to make sure i understand, those are as an array correct? as in a bunch of booleans? ([true, true....false])

little eagle
#

Yep. You can just use
[nil, true]
though.

unborn ether
#

Is there any way to refill all magazines of a unit, including ones in your containers?

little eagle
#

The thing is that you only get shown the action of your vehicle when inside one. Unless this one is set to true. Then it passes the action the the vehicle or something.
That's what believe at least.

tame lion
#

ah, my hope is to have the action available both inside and out of the vehicle too

#

but i guess if anything, i can just create 2 actions, each with different params

little eagle
#

@unborn ether What do you think how many lines of script that would take? Guess and I'll post the solution.

unborn ether
#

Well it either 1 line, or its like i see it rushing through all the fucking getUnitLoadout

little eagle
#

One.

_unit setUnitLoadout [getUnitLoadout _unit, true];
#

unit setUnitLoadout [loadout, rearm]

#

rearm (Optional): Boolean - Partially emptied magazines will be refilled when the loadout is applied - Default: false

#

¯_(ツ)_/¯

unborn ether
#

oh man. OH MAN

#

I was thinking about that for like 40 minutes

#

Arma give it back please (

little eagle
#

I never tried this btw., I just thought of it.

unborn ether
#

I didn't even know there is a such argument there

#

I was damn sure there is just one

meager heart
#

oh man. OH MAN
öhman 👌

little eagle
#

googles öhman

#

If it were me, this syntax wouldn't exist, but instead we had a
refillMagazines
command.

meager heart
#

rearm - provide with a new supply of weapons
refill - filling a container again

#

and even description :Partially emptied magazines will be refilled 🤷

#

its like modelToWorldVisualWorld

#

self explanatory*

knotty mantle
#

Hey guys i want to make our mechanized units known to the enemy using reveal. It works fine on local MP but doesnt on dedicated. What does in this case the effect: local mean? I run the script on the server on Ai units so it should be fine in my opinion. But they dont know about me. Do i have to run it where the target is local? or is it best used globally?

unborn ether
#

@knotty mantle EL (Effect Local) means that result is applied only to a command instigating PC. So if you call that on server, it will happen only there.

knotty mantle
#

yeah but if the ai that is on server knows about my IFV it should attack it.

#

But it doesnt

#

It does on local MP though.

#

And i dont understand why.

unborn ether
#

local MP?

knotty mantle
#

editor multiplayer.

little eagle
#
[_group, _target] remoteExec ["reveal"];

???

unborn ether
#

Even if its local MP its still MP, other players wouldn't see the result, so yes ^

knotty mantle
#

Demellion i understand what a local effect means. I dont understand how reveal can have a local effect.

meager heart
#

also maybe _group reveal [_target, 4]; < with value ?

knotty mantle
#

i used it with value

unborn ether
#

Its better to reveal a unit to a whole group then, instead of just one client

knotty mantle
#

it is revealed to Ai on the server. and it always reveals to the whole group according to the biki page.

#

and @little eagle thanks that is the solution we are currently testing. But i asked more for my own understanding.

lunar mountain
#

Hello there! Is there a list/resource somewhere where I can look at the Tanks DLC depreciated and new classnames?
What I have already found: Marid, separate CSAT cluster bomb for planes, new Mine cluster magazines for CSAT with _O ending.

tame lion
#

general scripting question here, does creating a zeus module mid mission have the potential to not work as fully as one that is present at mission init? i seem to be having poor performance from zues modules created in the following manor:

_zeus = (createGroup sideLogic) createUnit ["ModuleCurator_F", (getPos _player), [], 0, ""];
_player assignCurator _zeus;
//there is more code under here to get all addons from cfgPatches but you get the general idea```
tough abyss
#

I've completely forgotten the command to recompile a script while ingame, does anyone remember?

#

anyone got a simple if true statement then do blank, else if false do blank?

#

@tough abyss that's a thing??

#

yes

#

i just always restarted a mission or had the file i needed called via an execvm then saved changes and it ran the most recent version i saved

#

sucks if you're doing what i'm doing spawning multiple vehicles via an execvm

#

does anyone know how to setup extdb for a mission file bc i made a wasteland mission file but it doesnt save shit atm

#

databases are only achieved by arma wizards

#

xD

#

nah

#

i almost have inidb installed

#

if ya find out leme know, especially if that shit is friendly to other mods.

#

but inidb is sooo slow

#

kk

#

DB's in general require servers don't they?

#

lol, i got a gameserver but dont use it

#

ye

#

F, i was hoping to make one for this ravage mission i've been making but i cbf to make a server

#

well ravage has a build in save system im pretty sure

#

ravage mod*

#

i spend 2hrs making a wasteland mission file from scratch xD

#

Fug

#

And yeah ravage does but it sadly doesn't save cars 😦 and it sometimes freaks out for zero reason

#

i mean i could help setup INIdb

#

that is a database that saves it as a file on your pc

#

server pc*

#

I'm switch to mission maker chat for this

#

k

tame lion
#

i've accomplished a database using extDB3, but its for my own custom gamemode, not for wasteland

tough abyss
#

i need the save functions

#

and lopad

#

load*

tame lion
#

although i've never set up wasteland, i would assume the only real thing you would have to setup would be the protocols in your sql_custom folder

tough abyss
#

nah i need to set it up inside my mission file

tame lion
#

PM me your copy of wasteland? i've gotten really familiar with how extDB3 works so i might be able to reverse engineer it?

tough abyss
#

sure

#

What is the debug console command to recompile a script, so I don't have to restart the game each change?

gleaming oyster
#

It's a function iirc. BIS_fnc_recompile

tough abyss
#

What's the syntax for that?

#

nothing just []call BIS_fnc_recompile;

gleaming oyster
#

You can also look in the function viewer for required required parameters

#

Wiki seems to be to no avail

tough abyss
#

yo mudnut

gleaming oyster
#

What

tough abyss
#

Anyone know the tag for hideobjectglobal in cfgre

little eagle
#

hideobjectglobal

tough abyss
#

dosent work

little eagle
#

Did you put it into Commands or Functions?

#

Because it's a command.

tough abyss
#

Yeah its in command

little eagle
#
class CfgRemoteExec {
    class Commands {
        class hideObjectGlobal {
            allowedTargets = 2;
            jip = 1;
        };
    };
};
tough abyss
#

I got it, just realized I put hideobjextglobal

little eagle
#

oh, ok

tough abyss
#

I was trying to fast

#

fat fingering gang

little eagle
#

Get an editor and download sqf autocomplete.

tough abyss
#

I just am way to in love with sublime

little eagle
tough abyss
#

I already have

little eagle
#

I'm using ST3 too.

tough abyss
#

its a shitty auto complete

little eagle
#

I type "hid" and then tab twice.

tough abyss
#

yeah I just have to get used to it

#

I used to use atom

little eagle
#

Good switch.

tough abyss
#

just switched to sublime as loadtimes

#

atom is a bit aids on that

#

sublime is instant

little eagle
#

Exactly. Preach!

gleaming oyster
#

Atom is fine if you ask me, larg files losd slowly yes. But everything else seems to work just fine

tough abyss
#

Yeah, I mean there is some cool plugins for it but the load time is a turn off

#

I like to edit fast for things

meager heart
#

it's all personal preference tbh...

#

just use whatever works for you