#arma3_scripting

1 messages ยท Page 663 of 1

copper narwhal
#

Do you have a space I between the โ€œ and the ;

#

Inbetween*

tough abyss
#

its armas way of telling you where the error is

cosmic lichen
#

disableAI #"MOVE";

#

This is wrong

#

<object> disableAI <property>

#

}; forEach units _gGroup;

tough abyss
#

i know the hash isnt really there i was indicating like arma does

cosmic lichen
#

}; is wrong

tough abyss
#

if (isServer) then
{
    _allpositions = nearestBuilding _gGroup buildingPos -1;
    _gGroup = [getPos aPosition, independent, 5] call BIS_fnc_spawnGroup;
 
    {
         _randomPos = _allpositions deleteAt (floor (random (count _allpositions)));
        _x setPos _randomPos; disableAI "MOVE";
    } forEach units _gGroup;
};```
actual script,
 arma is throwing missing ; between disableAI and "MOVE"
cosmic lichen
#

no

#

it's just a rough indication of where something is wrong

#

I showed you the error

tough abyss
#

thats what arma is telling me

#

you mean }; it threw the error before i placed that

cosmic lichen
#

...

#
if (isServer) then
{
    _allpositions = nearestBuilding _gGroup buildingPos -1;
    _gGroup = [getPos aPosition, independent, 5] call BIS_fnc_spawnGroup;
 
    {
         _randomPos = _allpositions deleteAt (floor (random (count _allpositions)));
        _x setPos _randomPos; 
        _x disableAI "MOVE"; // FIXED HERE
    } forEach units _gGroup;
};
tough abyss
#

yeah yeah i just noticed that now im getting a different error yay

cosmic lichen
#

_allpositions = nearestBuilding _gGroup buildingPos -1;
this is wrong as well

heady quiver
#

Revo,

[player, ["cp_mission_accomplished_1", 1000, 1] ] remoteExec ["say3D"];

Would this play a sound that everyone can hear?

cosmic lichen
#

probably not

#

since player is not defined on the server

#

Are you sure you want the player to play the sound?

heady quiver
#

well the goal is to play a sound when objective is done (its in the EH)

#

but i want all players to hear it.

#
// Objective Event Handler (check if alive)
[_objective,["Killed", { 
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    [taskName, "SUCCEEDED"] call BIS_fnc_taskSetState;
    [player, ["cp_mission_accomplished_1", 1000, 1] ] remoteExec ["say3D"]; // SOUND HERE
}]] remoteExec ["addEventHandler",0,_objective];
copper narwhal
#

Sorry to butt in but might i ask is this even the right code to change the vanilla splashscreen? c++ class RscStandardDisplay; class RscDisplayStart: RscStandardDisplay { class controls { class LoadingStart: RscControlsGroup { class controls { class Logo: RscPictureKeepAspect { text="\mv_data\ui\logo.paa"; onLoad=""; }; }; }; }; };

cosmic lichen
copper narwhal
#

I dont think its working for me

#

about the channel also sorry ill move it to there

tough abyss
#

@cosmic lichen got a problem nearestBuilding neads an object is there any way to get the name of the leader of the group i spawn in

cosmic lichen
#

google

#

arma 3 get group leader

#

first link

willow hound
heady quiver
#

[player, ["cp_mission_accomplished_1", 1000, 1] ] remoteExec ["say3D"];

Isn't this remoteExecing

#

?

cosmic lichen
#

It is

#

But player is evaluated and is null or nil on the server

#

and null or nil is send to the other clients. EDIT: It's objNull

tough abyss
#

thanks

willow hound
#

Also I'm not entirely sure if adding the Killed EH on every client and then also remote executing the sound to every client is a good idea. Not sure about Killed EH MP behaviour though.

tough abyss
#

R3vo

cosmic lichen
#

Yeah, double check the locality of MPKilled

heady quiver
#

Mmmm

tough abyss
#

again thanks for the assist R3vo

cosmic lichen
#

yw

heady quiver
#
// Objective Event Handler (check if alive)
[_objective,["Killed", { 
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    [taskName, "SUCCEEDED"] call BIS_fnc_taskSetState;
    [player, ["cp_mission_accomplished_1", 1000, 1] ] remoteExec ["say3D"]; // SOUND HERE
}]] remoteExec ["addEventHandler",0,_objective];

Well this code only executes for the guy who starts the mission.

#

its in a function for starting the mission so..

#

not sure?

willow hound
heady quiver
cosmic lichen
#

What about ?

addMissionEventHandler ["EntityKilled", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];
}];```
#

I am not sure if you need to kill multiple units or just one specific one

heady quiver
#

_objective = createVehicle [selectRandom _vehicleList, _markerPosition, [], 0, "CAN_COLLIDE"];

#

Just one

#

a truck for example.

cosmic lichen
#

Then just add the killed eh to it locally

#

and when it fires, remoteExec the sound

tough abyss
#

_randomTruck= random 1 ??? @heady quiver

heady quiver
#

?

tough abyss
#

nah nevermind

heady quiver
#

its select a random from an array

#

truck, car, etc

#

Not sure where you got that idea x)?

#

But i was asking about EH's

#

@cosmic lichen How would i change to locally?

willow hound
heady quiver
#

will do now

#

ty

#

x)

cosmic lichen
#

createVehicle
attach EH

willow hound
#

Always read the documentation when using any command for the first time.

cosmic lichen
#

Always read the documentation when using any command for the first time. ๐Ÿ˜€

heady quiver
#

๐Ÿ˜†

#

But in the execRemote it asks for a objective for example

#

but in

#
addMissionEventHandler ["EntityKilled", {
  params ["_unit", "_killer", "_instigator", "_useEffects"];
}];

it doesnt

cosmic lichen
tough abyss
heady quiver
#

variable

#

remoteExec ["addEventHandler",0,_objective];

#

how would i point out to the EH that he needs to check the _objective var.

cosmic lichen
#

params remoteExec [functionName, targets, JIP]

willow hound
#

What is he doing?

heady quiver
#

Yes, but now i need to do it locally you said.

cosmic lichen
heady quiver
#

cuz there is no need to add EH to all clients yes?

cosmic lichen
#

yes

#

_vehicle addEventHandler....

heady quiver
#

oh

#

Thats it ?!

#

๐Ÿ†’

willow hound
heady quiver
cosmic lichen
#

๐Ÿคฃ

heady quiver
#
_objective addMissionEventHandler ["EntityKilled", {
  params ["_unit", "_killer", "_instigator", "_useEffects"];
  [taskName, "SUCCEEDED"] call BIS_fnc_taskSetState;
}];
crimson walrus
#

_objective addEventHandler ["Killed", {
[taskName, "SUCCEEDED"] call BIS_fnc_taskSetState;
}];

Added where _objective is local

winged wing
#
_objective addMPEventHandler ["MPKilled", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];

    if (local _unit) then {
        [taskName, "SUCCEEDED"] call BIS_fnc_taskSetState;
        { player say2D "cp_mission_accomplished_1"; } remoteExec ["call"];
    };
}];
heady quiver
#

wow wow

willow hound
heady quiver
#

i scanned it briefly

#

x)

#

So you guys all give me different answers tho

still forum
#

productVersion should

heady quiver
#

addMPEventHandler vs addMissionEventHandler

#

addMPEventHandler executes on all players

#

BUt thats not needed.

quasi rover
#

I tried productVersion, but it shows the client platform, not server platform. @still forum

still forum
#

if you execute on server it shows the server platform

quasi rover
#

oh... really? I just tested it on debug console, and clicked local. thanks.๐Ÿ‘

cosmic lichen
winged wing
# heady quiver addMPEventHandler vs addMissionEventHandler

addMissionEventHandler variant, though the objective variable needs to be global.

addMissionEventHandler ["EntityKilled", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];

    if (_unit == objective && local _unit) then {
        [taskName, "SUCCEEDED"] call BIS_fnc_taskSetState;
        { player say2D "cp_mission_accomplished_1"; } remoteExec ["call"];
    };
}];
heady quiver
#

Oke ๐Ÿค” , doesn't it need to be objective addMissionEventHandler then ?

winged wing
heady quiver
#

x)

cosmic lichen
#

you have no power here ๐Ÿ˜‰

heady quiver
#

๐Ÿ˜ฆ

#

oke oke it works

#

thanks guys..

#

I can't imagine how you guys must feel after so many questions x)

hallow mortar
cosmic lichen
#

Good to know.

heady quiver
#

Quick question if i put on the initServer this: testVar = 1; does that mean that everyone has that available to them?

#

or do i need to set it global

willow hound
#

Only the server has that then.

heady quiver
#

Yea

#

oke perfect all i needed to know.

fair drum
#

can i stack two color corrections on top of each other? say i want a brownish color then screen that with greenish color

spark turret
#

colors are rbg format so yeah you can add them together

#

not sure in what context tho

fair drum
#

solution is to create two colorcorrection effects with different handles and overlap them making sure your priorities are correct with the colors.

spark turret
#

aaaaaaaaaah color corrections whoops

#

only read colors

split coral
#

Yeah you can stack them like that

oblique mason
#

hey I tried that scriped apparently theres a missing } within it

spark turret
#
if ( isServer ) then{
     [this, "AmovPercMstpSnonWnonDnon_exercisePushup"] remoteExecCall ["playMove", this, true];
     this setVariable ["TAG_originalPosition", getPos this];
     this addEventHandler ["AnimDone",{
        params ["_unit", "_anim"];
        if ( toLower _anim == toLower "amovpercmstpsnonwnondnon_exercisepushup" ) then{
            [_unit, "AmovPercMstpSnonWnonDnon_exercisePushup"] remoteExecCall ["playMove", _unit, true];
            _unit setPos (_unit getVariable ["TAG_originalPosition", getPos _unit]);
        };
    }];
};
#

sqf lint and VSC is your friend, friend

fair drum
little raptor
oblique mason
#

thanks

distant oyster
oblique mason
#

thanks

#

question is there anyway to make an AI fire down a shooting range?

spark turret
#

im not sure, but there are (afaik) invisible target object (aka dummy humans) which you could maybe use. i think cba has that?

oblique mason
#

Ill look

#

there is, though not sure how to make them function, they dont work out of the box

#

though I wonder if theres a script to make a enemy unit invisible but AI will still engage it.

tough abyss
#

are triggers a big hit to performance if just using them to detect the player

spark turret
#

the size of the trigger and the amount of triggers matter

#

as always, try to keep things small.

#

10m trigger np but 3km trigger...

tough abyss
#

hm mabey in area would be better then

#

and using markers

spark turret
#

on a timed loop. sleep 5 or sth like that

tough abyss
#

want to make a crap ton of radiation hot spots i think using markers and inArea will work well

fair drum
#

so I'd like to learn how to do a parameter check for things I create. Could someone post an example for one of the parameters in the following so I can kinda get an idea and make the rest? Use of param to do it.

/*

Filename: ionStorm.sqf
Author: Hypoxic

Parameters:
[0] = Object or Array [x, y, z]
[1] = Radius (Number)
[2] = Intensity (Number from 1 to 5)
[3] = Time (Number in seconds)

*/

params ["_pos", "_arearadius", "_intensity", "_time"];

private _timer = [_time, false] call BIS_fnc_countdown;

private _interval = linearConversion [1, 5, _intensity, 10, 2, true];

while {[true] call BIS_fnc_countdown} do {
    private _target = createvehicle ["land_HelipadEmpty_F", (_pos getPos [random _arearadius, random 360])];
    [_target, nil, true] call BIS_fnc_moduleLightning;
    uiSleep random _interval;
    deletevehicle _target;
};
little raptor
#

[variableName, defaultValue, expectedDataTypes, expectedArrayCount]

fair drum
little raptor
spark turret
#

Otherwise you get wierd unwanted stuff happening

little raptor
tough abyss
#

not sure but i think this will work key word 'think'

if (isServer) then
{
    _radiation = ["m1", "m2","m3"];
    _gasmask =["g_airpurifyingrespirator_02_black_f", "g_airpurifyingrespirator_02_black_f", "g_airpurifyingrespirator_02_sand_f", 
    "g_airpurifyingrespirator_02_olive_f", "g_regulatormask_f"];
  
  while {true} do
    {
          {
            if (_x !(inArea in _radiation) && (!(toLowerANSI goggles _x in _gasmask)))then
            {
                _x setdamage (damage _x + 0.1);
            }
          } forEach allUnits;
                sleep 10;
    };
};```
crimson walrus
#

For each unit, you also need to check each radiation area

#
    private _unit = _x;
    if (not ((toLower (goggles _unit)) in _gasmask)) then {
        {
            if ((getPos _unit) inArea _x) exitWith {
                _unit setdamage (damage _unit + 0.1);
            };
        } forEach _radiation;
    };
} forEach allUnits;
sleep 10;```
#

some edits added ^

tough abyss
#

(_x !(inArea in _radiation) does this not do the same thing with _radiation being an array of markers ? and and _x being allUnits

crimson walrus
tough abyss
#

position array or object inArea Marker

little raptor
tough abyss
#

_x representing all units ! in any of the markers listed in the array

little raptor
#

that's not the problem

tough abyss
#

then what is instead of getting on here and shiting on my attemt you help me

tough abyss
#

tell me what the hell im doing wrong

little raptor
#

@still forum or yours?

crimson walrus
#

@tough abyss ,
_radiation = ["m1", "m2","m3"];
Are these markers?

tough abyss
#

literaly every time i have posted a bit of script instead of helping the first thing you do is give me hell for my attempts

#

@crimson walrus yes

crimson walrus
tough abyss
#

im sorry itsd not my fault every time i post a bit of script the formula seems to freeking change for what works

crimson walrus
#

alright, that's better.

#

for each unit, we check if they're not wearing a gas mask
if not, we check if they're in any one of the radiation markers
if so, damage the unit

heady quiver
#

Hi guys, how would i check if fobCargoBox = createVehicle ['B_CargoNet_01_ammo_F', getPos player, [], 0, "CAN_COLLIDE"]; is undefined ?

crimson walrus
#

isNil "fobCargoBox", I think.

heady quiver
#

Yea thought so myself but that didnt work

idle sierra
#

how do you add crew to specific positions in a vehicle?

winter rose
fair drum
#

sooo... how much will I slow a mission if I add 3000 objects loool. might need to tone it down...

idle sierra
#

may wanna ask the mission_maker boys on that

fair drum
#

its a joke. its going to cause problems.

idle sierra
winter rose
winter rose
#

(thanks! I'm on mobile)

idle sierra
#

wow thats a great page. I feel like that should be pinned somewhere.

fair drum
#

too many great pages to pin

idle sierra
#

true lol

idle sierra
#

nice! is there also like a set of tutorials i can watch to get a solid foundation on arma 3 scripting? i think im hitting the ceiling with config files that scripts on init might by able to fix...

fair drum
#

i've looked through a lot of youtube videos when I was learning and theres not really much that is great. I've been thinking about making a comprehensive beginners guide but haven't really gotten around too it. best to ask things here and we can point you to things

heady quiver
#
fobCargoBox = createVehicle ['B_CargoNet_01_ammo_F', getPos player, [], 0, "CAN_COLLIDE"];

Does anyone know how i can check if the var fobCargoBox is set at all ?

#

(undefined)

fair drum
#

do you want a boolean as a result?

heady quiver
#

yes.

#

Because i wanna see if there is a cargo there already, if so remove that and create a new one.

fair drum
#
isNull fobCargoBox; //returns boolean for an object (needs to be entity)
isNil "fobCargoBox"; //returns boolean for a variable
heady quiver
#

but that variable is not set at all when checking for the first time.

#

heyyy

#

that worked

#

or not.

#

undefined Variable fobCargoBox

fair drum
heady quiver
#
    if!(isNull fobCargoBox) then {
        // Delete Previous FOB
        createdFob call BIS_fnc_removeRespawnPosition;
        deleteVehicle fobCargoBox;
    };
idle sierra
fair drum
heady quiver
#

yess

#

That seemed to do the trick

hollow lantern
#

how's that Jet's DLC action named?

fair drum
hollow lantern
fair drum
#

you can use the position of [0,0,0] or a "debug island" position to create them because it won't matter when you move them.

idle sierra
#

so how do i make it so this executes from a config? i use the eventhandler class right?

#

then whatever script i want to use goes under:

{
init = VEHICLE CODE
};```
fair drum
#

are you using CBA?

#

if so, there is an easier non config way to do it

idle sierra
#

yes im using cba

fair drum
idle sierra
#

wow that looks way more streamlined.

still forum
#

@little raptor only rule violations I saw is from you

#

Though I ignored plenty of violations from Darklight in the past and just deleted them

wind hedge
#

Does anyone know if the new Suppressed Event Handler works on Agent Units?

little raptor
still forum
#

no

fair drum
#

can someone explain the math behind wanting a square root vs just a random radius if you want true random position?


// random radius
private _angle = random 360;                        // angle definition (0..360)
private _distance = random _radius;                    // distance from the center definition (0..radius)
private _position = _center getPos [_distance, _angle];

// random position
private _angle = random 360;                        // angle definition (0..360)
private _randomSquareRoot = sqrt random 1;            // random square-root to obtain a non-linear 0..1 value
private _distance = _radius * _randomSquareRoot;    // distance from the center definition (0..radius)
private _position = _center getPos [_distance, _angle];
#

is it essentially creating a random percent to multiply the radius by?

crimson walrus
fair drum
#

thats not a true random position then within a circle if it favors the center?

crimson walrus
#

Agreed.

little raptor
fair drum
crimson walrus
#

Interesting, I like your source.
"the area of a circle grows with its radius squared"

#

makes sense

fair drum
#

I didnt take anything past calc 1 so I'm pretty garbage at math

still forum
wind hedge
#

@little raptor you are one of the most helpful and knowledgeable guys around these parts so don't let a few rude people mess with your peace of mind...

heady quiver
#

Whats going on?

round blade
#

Hi folks, I've got a particle effect that I want to trigger for 0.2s after a player fires - I can't figure out how to set a timer and remove the particle effect, currently it just runs endlessly (and my understanding is I can't use sleep because it's in an eventhandler). Anyone able to spare me a few brain cells? Thanks!

Code:
player addEventHandler ["Fired", { params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; _ProjectileVelocity = velocity _projectile; _ProjectileVectorDir = vectorDirVisual _projectile; _ProjectilePos = getPosVisual _projectile; private _ps1 = "#particlesource" createVehicleLocal _ProjectilePos; _ps1 setParticleParams [ ["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 9, 16, 0], "", "Billboard", 1, 0.2, [0, 0, 0], [(_ProjectileVelocity select 0) *-.01, (_ProjectileVelocity select 1) *-.01, (_ProjectileVelocity select 2) *-.01], //velocity 0, //rotation 10, //weight 7.9, //volume 0.066, //rubbing [0, 3], //size [[0.5, 0.5, 0.5, 0.5], [1, 1, 1, 0]], //color [0.25], 1, 0, "", "", _ps1]; _ps1 setDropInterval 0.01; }];

deft dock
#

what else do i have to add to this line to have all vanilla content in the blacklist?
it's an arsenal blacklist and vanilla + apex stuff is still showing up. i want mod content exclusively
_blacklist = ["gm","kart","mark","tank","enoch","orange"];

hollow lantern
#

apex is expansion and vanilla could be a3 (not sure about that though)

deft dock
#

i tried a3, no joy. i'll check out the other. thx

#

neither did work

hollow lantern
#

hmmm try exp then

#

for the Tanoa stuff

deft dock
#

no joy either

#

like it's cursed or something ๐Ÿ˜„

past wagon
#
_x addMagazineCargoGlobal [_mag, 4];
#

how can I randomize the amount of magazines I am adding to this crate?

#

currently, it adds 4 mags, but I would like it to be 2 - 4

hollow lantern
#
_amount = [2, 3, 4] call BIS_fnc_selectRandom;
_x addMagazineCargoGlobal [_mag, _amount];```
distant oyster
hollow lantern
#

wouldn't that give him always more then 2 Terra?

distant oyster
#

well not if random 2 gives <0.5

hollow lantern
#

ah

#

true

distant oyster
#

btw @hollow lantern instead of BIS_fnc_selectRandom you can use selectRandom as a command

distant oyster
past wagon
distant oyster
past wagon
#

oh yeah

#

thanks

#

the reason it doesn't have the parenthesis around the 2 in my code, is because it is already adding 2 magazines, plus the random extra value

#

what exactly does round random do?

distant oyster
#

also, round random 0.5 will always give 0

past wagon
#

oh

#

ok

distant oyster
#

random <value> picks a number between 0 and value, round rounds it, so round 0.4 -> 0 and round 1.5 -> 2

#

since you cant add half a magazine

#

order of precedence is:

(round (random 0.5))
past wagon
#

ok nice

hollow lantern
#

what's a good way to gradualy slow down a chopper (for landing)? I thought about a while-loop, However my code is broken in a way that it is not slowing down the chopper, however the while-bool-expression is true when the helo is 1599m near the target: ```sqf
waitUntil {(_aircraft distance _destination) < 1600};
_previousSpeed = speed _aircraft;

            while {_previousSpeed > 10 && (_aircraft distance _destination) > 500} do 
            {
                scopeName "landingCycle";
                sleep 1;
            
                _speedCache = _previousSpeed - 1;

                if (( speed _aircraft) > _speedCache) then
                {
                    _aircraft limitSpeed _speedCache;
                    _previousSpeed = _speedCache;
                };

            };```

I guess the if-bool is the issue here. It checks if the speed is 1km/h slower then the speed it had when coming into the 1600m range. However it will never go lower probably.
My main-issue is that I need to gradualy slow it down so it doesn't run out of speed too quickly, however I can't use a fixed speed as the script should be modular.
Maybe I can get the max speed of a helo via the Config and based on that calculate a decend path to the target

gentle sundial
#

Hello i have a question i suck at coding but i was wondering how can i add height adjustment code to a sandbag mod

#

Ty in advance

fair drum
gentle sundial
#

Yeah i just want to be able to adjust its height as i place it

fair drum
#

so its already placed in game and you want to look at it and increase its height?

gentle sundial
#

Yes. It only sticks to the ground with no height modification and i was wondering if all i need to do is attach some code to it for the usual scroll wheel option

#

Basically im just trying to modify the bags of sand mod if you know it

fair drum
#

do you have the class name for the sandbag that is placed?

gentle sundial
#

I have absolutely no ideea about anything

fair drum
#

no i dont know it, nor will i learn the ins and out of its scripting

gentle sundial
#

Was just wondering if all it needed was some extra code

fair drum
#

you need to look into addAction, setPosATL, CBA_fnc_addClassEventHandler

gentle sundial
#

Ty ill check that out tomorrow since rn its 1 am

fair drum
#

you will use the CBA add class event handler to attach some code to any object that has the same class. the code you will attach is an addAction which you will write to increase the height using setPosATL

gentle sundial
#

I think i can kinda make it work from there it doesnt have to be perfect just decent

fair drum
#

this will avoid you having to look through the mod and figure out how they did it

spark turret
gentle sundial
#

Thank you mate you are a good man man :))

distant oyster
spark turret
#

the random command has more advanced stuff to

#

like from a seed or a curve

distant oyster
#

the random [min, mid, max] syntax changes the distribution from equal to gaussian though

#

btw what is the alt syntax 3 seed random [x, y] about? why does it need an extra implementation?

hollow lantern
#

neat, maxSpeed can be returned via

(getNumber(configFile >> "CfgVehicles" >> (getDescription _aircraft select 0) >> "maxSpeed"));```
dark pecan
#

Hello guys, once again im having trouble, the code makes the object do 2 actions, when the hold action is complete. but idk why only the sound work but the text doesnt. But when i remove the codeline from the sound the text do appear.

titleText ["<t align = 'center' shadow ='2' color='#FF0000' size='1.7' font='RobotoCondensedBold' >speaker: </t><t color='#ffffff' size='1.7' font='RobotoCondensed' >chat here</t>", "PLAIN DOWN", -1, true, true]
idle sierra
#

how would i delete a vehicles crew on init?

#

{ _this deleteVehicleCrew _x } forEach crew _this; on the vehicle right?

dreamy kestrel
#

I've got a strange error. trying to implement a queue of sorts using an array. literally boils down to:

private _changeOrder = if (_changeOrders isEqualTo []) then {
    locationNull;
} else {
    _changeOrders deleteAt 0;
};

The queue is known to have two elements in it. First one pops just fine.
The second one tries to, but I get an ACCESS_VIOLATION and Arma crashes.
How might I avoid this scenario? Would _changeOrders select [1, count _changeOrders - 1] be any better?

hollow lantern
#

if you put it in the init field

dreamy kestrel
#

The whole sequence logs as follows:

18:49:31 [KP LIBERATION] [315.862] [CHANGEORDERS] [fn_changeOrders_process] Entering: [isNull _target, isNull _changeOrder]: [false,true]
18:49:31 [KP LIBERATION] [315.862] [LOGISTICSSM] [fn_changeOrders_tryDequeue] Entering: [isNull _target]: [false]
18:49:31 [KP LIBERATION] [315.862] [LOGISTICSSM] [fn_changeOrders_tryDequeue] Popping front element: [_countBefore]: [2]
18:49:31 [KP LIBERATION] [315.862] [LOGISTICSSM] [fn_changeOrders_tryDequeue] Front element popped: [isNull _changeOrder, _countBefore, _countAfter]: [false,2,1]
18:49:31 [KP LIBERATION] [315.862] [LOGISTICSSM] [fn_changeOrders_tryDequeue] Fini: [isNull _changeOrder, _countBefore, _countAfter]: [false,2,1]
18:49:31 [KP LIBERATION] [315.862] [CHANGEORDERS] [fn_changeOrders_process] Processing: [isNull _target, isNull _changeOrder]: [false,false]
18:49:31 [KP LIBERATION] [315.867] [CHANGEORDERS] [fn_changeOrders_process::onProcess] Processed: [isNull _target, isNull _changeOrder, _entering, _result, _processCount]: [false,false,false,false,1]
18:49:31 [KP LIBERATION] [315.867] [LOGISTICSSM] [fn_changeOrders_tryDequeue] Entering: [isNull _target]: [false]
18:49:31 [KP LIBERATION] [315.867] [LOGISTICSSM] [fn_changeOrders_tryDequeue] Popping front element: [_countBefore]: [1]

Before ACCESS_VIOLATION.

idle sierra
dreamy kestrel
#

This is all "running" in a CBA state machine "pending" state. Neither here nor there really, apart from context.

crimson walrus
hollow lantern
past wagon
#
_supplyDropSpawn = [[SupplyDropArea], ["water",]] call BIS_fnc_randomPos;
#

it says I am missing a [ but I dont see where

hollow lantern
#

remove the ,

past wagon
#

ohhhh

#

thanks

#

๐Ÿคฆโ€โ™‚๏ธ

dreamy kestrel
#

@crimson walrus no, it is an array for sure. during enqueue or insert operations, I get a default starting value, effectively this:

private _changeOrders = _target getVariable ["KPLIB_changeOrders_orders", []];
#

it's working just fine until now, but now I am piling up more than one element... which I wonder if one of those operators has a stronger than normal lock on the array instance.

#

the offending operator seems to be deleteAt. so I wonder if I get creative to workaround that operator.

#

it's a pretty heavy operator IMO, it does a lot, affects the array itself, and returns the first element. this appears to be the line where things go wonky:

private _changeOrder = if (_changeOrders isEqualTo []) then { locationNull; } else { _changeOrders deleteAt 0; };
#

open to suggestions, maybe a creative use of select around the desired element, something like that.

past wagon
#

how can I temporarily hide a marker from the start of a mission?

#

there are a couple of markers that I dont want shown on the map until specific points in the mission

dreamy kestrel
#

does not seem to matter which way I handle it, deleteAt working around with a _changeOrders select [1, count _changeOrders - 1], still with a ACCESS_VIOLATION
maybe I just "get" the array as-is, and forEach over them...

past wagon
#

thanks guys

cosmic lichen
#

Nevermind, I just wrote your inital post

#

I don't see how deleteAt can cause an Access Violation and crash. It should just fail.

dreamy kestrel
#

Yes, basically that. but really, just want to process the queue. probably being too finicky with my usage around that.

#

re: deleteAt, or select for that matter, re: AVs, me neither, ๐Ÿคทโ€โ™‚๏ธ , but it is.

#

trying to isolate just when that might be occurring.

cosmic lichen
#

deleteAt is not the issue.

idle sierra
#

whats wrong with this code? i'm trying to clear a vehicle crew, create a new group, then add that group to the vehicle:

#
            
            "FBHPT_or8_ofw_p08" createUnit [[0,0,0], []];
            "FBHPT_or6_ufw_p38" createUnit [[0,0,0], []];
            "FBHPT_or4_uffz_p38" createUnit [[0,0,0], []];
            "FBHPT_or3c_gfr_p38" createUnit [[0,0,0], []];
            "FBHPT_or1_pzsch_p38" createUnit [[0,0,0], []];
                
            [FBHPT_or8_ofw_p08, FBHPT_or6_ufw_p38, FBHPT_or4_uffz_p38, FBHPT_or3c_gfr_p38, FBHPT_or1_pzsch_p38] join (group panzeriv);
                
            FBHPT_or8_ofw_p08 moveInCommander this;
            FBHPT_or6_ufw_p38 moveInDriver this;
            FBHPT_or4_uffz_p38 moveInGunner this;```
#

all it does is delete the old crew

cosmic lichen
#

You should read the docs of createUnit

dreamy kestrel
#

@cosmic lichen maybe not, but that's what I am attempting to isolate. perhaps one other area that things might be falling over on, but given which, difficult to imagine that is the cause, either, it's been working just fine to this point as well.

hollow lantern
#

is there a equivalent for addPrimaryWeaponItem that works with any weapon placed in the 3DEN editor?

fair drum
#

you trying to add an action to a placed weapon on the ground in the editor?

#

@hollow lantern

hollow lantern
#

no, I'm trying to add a weaponItem e.g. scope or laser to a weapon on the ground. These are normally just created weapons via weaponGroundholders.

#

addPrimaryWeaponItem needs a unit to function

#

so it doesn't work with the plain weapon

#

so I'm searching for an alternative

fair drum
#

ah yes, i think i ran into that earlier this year and didn't find a solution as of yet

#

might just need to have them in pieces until a solution is found...
i do know that base arma, and some mods like RHS and CUP have premade weapon class names that have things attached to them by default.

hollow lantern
#

I mean I could create a groundWeapon holder and then do addWeaponWithAttachmentsCargoGlobal

#

would be a hacky workaround

#

but should work

hollow lantern
#

@fair drum that works:

KI_wGround01 = "GroundWeaponHolder" createVehicle [5849.19,5005.69,0.880923];
KI_wGround01 addWeaponWithAttachmentsCargoGlobal [["rhs_weap_M107_d","rhsusf_acc_nxs_3515x50f1_md_sun", "", "", ["rhsusf_mag_10Rnd_STD_50BMG_mk211",1], [], ""], 1];
KI_wGround01 setPos [5849.19,5005.69,0.880923];
fair drum
#

@cosmic lichen lovin the additions to 3den Enhanced

hollow lantern
# fair drum noted, good find
KI_wGround01 = "GroundWeaponHolder" createVehicle [5849.19,5005.69,0.8]; 
KI_wGround01 addWeaponWithAttachmentsCargoGlobal [["rhs_weap_M107_d","rhsusf_acc_nxs_3515x50f1_md_sun", "", "", ["rhsusf_mag_10Rnd_STD_50BMG_mk211",1], [], ""], 1]; 
 
[KI_wGround01,270,0] call BIS_fnc_setPitchBank;
KI_wGround01 setPos [5849.19,5005.69,0.8];
[KI_wGround01,0,-10] call BIS_fnc_setPitchBank;```  final: https://i.imgur.com/zncoj7Y.jpeg
lean anchor
#
_veh1 = format (_veh1 select 0);

I currently have this where _veh is currently referencing a helicopter. Im wondering how i can turn this object reference into text?

#

sorry if this is really stupid

past wagon
#

BIS_fnc_randomPos only gives X and Y coordinates, correct?

hollow lantern
copper raven
hearty hound
#

beginner question, how can I assign the gunner of a tank a rank. I have:
_tank1 = [ [getMarkerPos "tankMarker", 0, markerDir "tankMarker" ] call BIS_fnc_relPos, markerDir "tankMarker", "cwr3_o_t72b1", _tankgroup] call BIS_fnc_spawnVehicle;
_tank1Com = commander _tank1;
_tank1Com setRank "LIEUTENANT";
I keep getting a type Array expected Object error on the second line and I'm not following that. I get the same error trying to use this which is an example from the biki page: (driver _tank1) action ["getout", _tank1];

past wagon
#
_randomSupplyDropSpawn = [[SupplyDropArea], ["water"]] call BIS_fnc_randomPos;
// SupplyDropArea is a trigger

_supplyDropSpawnX = _randomSupplyDropSpawn select 0;
_supplyDropSpawnY = _randomSupplyDropSpawn select 1;
"SupplyDropMarker" setMarkerPos [_supplyDropSpawnX, _supplyDropSpawnY];

isNil {
private _parachute = "B_Parachute_02_F" createVehicle [_supplyDropX, _supplyDropY, 750];
_parachute setPosATL _randomSupplyDropSpawn;
supplyDrop attachTo [_parachute, [0,0,0.5]];
};

why isnt this working? the parachute and crate just spawn on the ground

copper raven
hearty hound
#

oh okay. That makes sense now. Thank you. I normally use createVehicle and was viewing _tank1 as the tank itself and not as a return from spawnVehicle.

past wagon
#

can anyone figure out whats going wrong with my code ^^

copper raven
#

iirc createVehicle ignores Z coordinate, set pos the parachute with the proper height after you create it

past wagon
#

ohhhh

#

yeah

#

thanks

copper raven
#

also since you set pos, initial position doesn't matter, so use [0,0,0] when creating, it's abit faster that way ๐Ÿ˜‰

past wagon
#

ok

#

also does BIS_fnc_infoText not work in multiplayer?

#

if not, how can I get it to work?

#

because it is working fine for singleplayer but it wont work for me in multiplayer

copper raven
#

where are you executing it?

past wagon
#

initServer.sqf, between sleep commands

#

@copper raven

copper raven
#

UI stuff has to be executed locally on clients/playerhost, obviously running it on server won't make clients see anything

past wagon
#

oh

#

im new to this lol

#

well how can I fix that? do i need to use something else or can I fix it

copper raven
#

you most likely want to put it in initPlayerLocal.sqf or something similar that runs on clients, and not only server

past wagon
#

ok that sounds good

#

yeah I can make that work

#

@copper raven does initPlayerLocal.sqf run right as players finish loading in to the mission or as they select a role?

copper raven
#

for exact time it's ran look up initialization order, it can't run when they select a role obviously(the player object is even passed to the script itself)

brazen lagoon
#

any advice on using BIS_fnc_initVehicle?

#

I'm currently running it in a script run with extended init event handlers only on the server

#

it seems like it should work, but it doesn't appear to

warm hedge
#

Without sharing your code and issue, nobody will debug

brazen lagoon
#

oh this is odd. If I create new vehicles with Zeus it works but the units already there at the start don't have the correct appearance. I wonder if bis_fnc_initvehicle doesn't work well with JIP

#

my description.ext has this: sqf class Extended_Init_EventHandlers { class Man { init = "_this call (compile preprocessFileLineNumbers 'set_uniform.sqf')"; }; class LandVehicle { init = "_this call (compile preprocessFileLineNumbers 'set_texture.sqf')"; }; class Air { init = "_this call (compile preprocessFileLineNumbers 'set_texture.sqf')"; }; };

#

set_texture.sqf:```sqf
private "_this";
_this = _this select 0;

if (!isServer) exitWith {};

_ru_texture_primary = 'textures\ru_digital_snow.paa';
_ru_texture_secondary = '#(argb,8,8,3)color(0.5,0.5,0.5,1)';

_us_texture_primary = 'textures\us_bdu_snow.paa';
_us_texture_secondary = '#(argb,8,8,3)color(0.7,0.7,0.7,1)';

if (typeOf _this == "CUP_O_SU34_RU") then {
[
_this,
["White",1],
true
] call BIS_fnc_initVehicle;
};```

past wagon
#
sleep 180;
["The safe zone has been", "marked on the map in blue!"] spawn BIS_fnc_infoText;
sleep 5;
["Get inside within", "15 minutes or die!"] spawn BIS_fnc_infoText;

why the hell wont it show the second message?

#

the first one works fine, but the second one does not appear on screen

#

when I set the first sleep value to something smaller like 20, it works perfectly

#

but when I want it to wait 180 seconds before doing it, it wont work

#

also would I want to put this in my init.sqf or serverInit.sqf file:

civilian setFriend [civilian, 0];
final storm
dreamy kestrel
#

this is SO bizarre. I've tried to work around this ACCESS_VIOLATION error, to no avail.

#

as long as the change order array (really, queue) is empty or has one element, it's all good. as soon as I add a second element, it goes to shit.

final storm
#

what are you trying to do?

past wagon
#

i think it might be because I have other code running at the same time in initServer.sqf

#

this code is in initPlayerLocal.sqf

little raptor
final storm
past wagon
#

yes

#
sleep 180;
["The safe zone has been", "marked on the map in blue!"] spawn BIS_fnc_infoText;
sleep 5;
["Get inside within", "15 minutes or die!"] spawn BIS_fnc_infoText;
final storm
#

works for me

past wagon
#

ok

#

@final storm when I change the first sleep value from 180 to something much higher or much lower, it works just fine

past wagon
#

ok thanks

dreamy kestrel
#
// // tried both ways of getting the var, var is got either way...
// ([_target, [
//     [KPLIB_changeOrders_orders, []]
// ], _callerName] call KPLIB_fnc_namespace_getVars) params [
//     "_changeOrders"
// ];
private _changeOrders = _target getVariable [KPLIB_changeOrders_orders, []];

if (_debug) then {
    [format ["[fn_changeOrders_process] Got vars: [count _changeOrders]: %1"
        , str [count _changeOrders]], "CHANGEORDERS", true] call KPLIB_fnc_common_log;
};

if (_changeOrders isEqualTo []) exitWith {
    if (_debug) then {
        ["[fn_changeOrders_process] Nothing to process", "CHANGEORDERS", true] call KPLIB_fnc_common_log;
    };
    true;
};

// ACCESS_VIOLATION
_changeOrders = +_changeOrders;
private _changeOrderCount = count _changeOrders;

if (_debug) then {
    [format ["[fn_changeOrders_process] Processing: [_callerName, _changeOrderCount]: %1"
        , str [_callerName, _changeOrderCount]], "CHANGEORDERS", true] call KPLIB_fnc_common_log;
};
final storm
dreamy kestrel
#

if the _changesOrders array is empty or count 1, it is fine. adding a second CO, it pukes

#

_changeOrders is a a simply array, nothing magical about it

#

treating it as a FIFO queue

#

preferably pushBack, deleteAt 0, or forEach, whatever works

#

would CBA per frame handlers that potentially touch the variable cause something like that?

brazen lagoon
#

@little raptor ok thanks, but is that likely to be my issue? it seems to be some sort of locality problem or that bis_fnc_initvehicle doesn't work for players that join after the command is run

final storm
past wagon
#

when I do

civilian setFriend [civilian, 0];

it makes it so that civilians cannot access storage crates because they are enemies with the side the crate is on. how can I fix this?

i need civilians to be enemies because I dont want civilian vs civilian to show up as friendly fire

dreamy kestrel
#

@final storm I am trying to get a snapshot of the array.

cosmic imp
#

Hey there, i'm trying to script something to create an object in front of the player that they can place, rotate etc etc. Now this is probably one of the newbiest questions out there but google hasn't helped. I've managed to get the sandbag i'm creating to pop up in front of me with attachObject using addAction but i can't get it to detach, let alone rotate or anything else. Any ideas where to start?

dreamy kestrel
#

I suppose by Occam's razor, if that's the obvious potential issue, that may be the simplest answer. don't copy the array. I could try that.

final storm
#

in the code you sent _changeOrders = +_changeOrders; doesnt do anything

cosmic imp
#

i'm not totally a beginner. I've gotten both of those to work, i just can't get it to allow me to move the sandbags location around and detach. I can have it attach but when i use my action to drop it won

#

't detach

past wagon
#

why dont you show us your script so far?

final storm
#

detach _sandbag;

#

send ur script if you need more help then that

cosmic imp
#

i'll be honest i found it on the internet and kind of hotwired it to get it to work. ``` objectDirection = 180;
objectHeight = 0;

init ={
removeAllActions player;
player addAction ["Open Menu", {
call main;

}];

};

main =
{
removeAllActions player;
player addAction ["Barricades", {
call barricades;
}];
player addAction ["Towers", {
call towers;
}];
};

barricades =
{
removeAllActions player;
player addAction ["Sand Bags Long", {
_sbag1 = "Land_BagFence_Long_F" createVehicle position player;
_sbag1 attachTo [player, [0, 5, 0]];
[_sbag1]call objectAdjustment;
}];
player addAction ["Sand Bags Round", {
_sbag2 = "Land_BagFence_Round_F" createVehicle position player;
_sbag2 attachTo [player, [0, 5, 0]];
[_sbag2]call objectAdjustment;
}];
};

towers =
{
removeAllActions player;
player addAction ["Tower Tall", {

}];
player addAction ["Tower Short", {
    
}];

};

objectAdjustment =
{
removeAllActions player;
_object = (_this select 0);
player addAction ["rotate", [_object]call rotateOr];
player addAction ["raise", [_object]call raiseObject];
player addAction ["lower", [_object]call lowerObject];
player addAction ["drop", [_object]call dropthing];
}];

rotateOr =
{
_object = (_this select 0);
objectDirection = objectDirection + 20;
_object setDir objectDirection;

};

raiseObject =
{
_object = (_this select 0);
objectHeight = objectHeight + 1;
_object attachTo [player, [0, 10, objectHeight]];
};

lowerObject =
{
_object = (_this select 0);
objectHeight = objectHeight - 1;
_object attachTo [player, [0, 10, objectHeight]];
};

dropthing =
{
_object = (_this select 0);
detach _object;
call init;
};

call init; ```

#

syntax will probably make you want to puke

past wagon
#

i need some quick help with something

#

how can I automatically make all crates/vehicles unlocked for all players?

#

when I do

civilian setFriend [civilian, 0];

it makes it so that civilians cannot access civilian containers/crates because they are enemy containers/crates

#

i need to make civilians enemies with other civilians so that it doesnt say "friendly fire" when a civilian kills another civilian

dreamy kestrel
final storm
#

if ur makeing a new variable

copper raven
#

is there any more to that code? and are you 100% sure that's the line it crashes on?

dreamy kestrel
#

99.75% certain of that, yes @copper raven

#

at least according to the debug statements

#

the log literally gets that far then dumps

 1:10:32 [KP LIBERATION] [241.22] [CHANGEORDERS] [fn_changeOrders_process] Entering: [isNull _target, _target, _callerName]: [false,Location CBA_NamespaceDummy at -1000, -1000,"fn_changeOrders_process"]
 1:10:32 [KP LIBERATION] [241.22] [CHANGEORDERS] [fn_changeOrders_process] Got vars: [count _changeOrders]: [2]
copper raven
#

did you try not running PFHs(ones that do any modifications to the array reference)? even though i highly doubt that's the issue, still worth trying

dreamy kestrel
#

what is pfhs?

copper raven
#

per frame handlers*

dreamy kestrel
#

oh right, I see. hmm well... no, BUT... it's key to many parts of other subsystems.

#

though I wonder per my Occam's thought, Arma 3 sees it as trying to overwrite itself with a snapshot, and so that's the simple answer.
anyway kind burnt on it tonight, that'll be first tomorrow, maybe into a separate var, i.e. private _snap = +_changeOrders

#

although I do that in other places and have not seen the same issue, so it's still a bit odd to me

copper raven
#

doesn't change anything

#

really weird, the unary plus just does a deep copy

past wagon
#

can anyone help me figure out the solution to the problem I posted above? ^^^^^^^^^

dreamy kestrel
#

@copper raven wait you said deep copy? I thought that was a snapshot? i.e. 'new array', leave the other bits alone

#

which wouldn't be right, I don't want a deep copy of course. those are CBA namespaces in there. I just want a new array.

copper raven
#

i'm not sure if i get what you mean, cba "namespaces" are just some objects, copying it won't make a different one, if that's what you were thinking @dreamy kestrel

past wagon
#

can someone link me to a wiki page really quick

#

i just need players to be able to access vehicles and containers from sides that they are enemies with

#

@ me

#

can I set the side of an object?

final storm
past wagon
#

oh

#

where can I find the biki page on that?

final storm
#

what do you wanna do have everyone on bluefor and have a free for all?

little raptor
past wagon
#

@little raptor well then how can I make it so that even though civilians are enemies with civilians, they can still access vehicles and crates?

limber stump
#

Does anyone have a script to end the game automatically when the "Commander" slot is not filled? I want to make the Liberation gamemode only playable when the Commander slot is filled by admin.

dusk shadow
#

@Any one with experience with attachTo and multiplayer. Given: serverObj attachTo [clientObj] does this change the locality of serverObj to the client in question?

#

@limber stump if the commander unit is named in editor (say: comUnit) then you could check for !isNull comUnit

#

comUnit would be null until a player loads into that role AFAIK

limber stump
#

How about the event?

dusk shadow
#

Sorry, which event are you refering to?

limber stump
#

Is there any event I can use to trigger when role assignment are done by player?

#

if (!isNull comUnit) then {
sleep 1;
endMission "END6";
};

#

like this?

dusk shadow
#

in it simplest form, yes that would do it

#

but since endMission has local effect you'd want to make sure it executes an all clients

little raptor
#

it's reversed

dusk shadow
#

ah yes good spot

#

the remove the !

little raptor
#

also see the pinned messages

#

post your scripts with syntax highlighting

limber stump
#

so like this? btw how I can make it executes an all clients?

if (isNull comUnit) then {
        sleep 1;
        endMission "END6";
};
little raptor
dusk shadow
#

@little raptor Cheers was hoping to have avoid fire up the mp test bench

little raptor
dusk shadow
#

but looks like ill have to

little raptor
#

@limber stump to execute for everyone, use remoteExec.
Also that script is not suitable. It probably always fails the mission (especially in dedicated server)

limber stump
#

like this? "End2" remoteExec BIS_fnc_endMission;

#

I mean

"End2" remoteExec BIS_fnc_endMission;```
dusk shadow
#

Syntax of remoteExec is a bit off but that's the gist of it

#
/* in initServer */
[] spawn {
    if(isNull comUnit) then {
        "End2" remoteExec ["BIS_fnc_endMission"];
    };
};
little raptor
#

@dusk shadow @limber stump as I mentioned that'll probably always fail the mission.
The simplest way to fix it is to wait a few seconds before checking that condition.

#

it's not robust, but at least it's better

dusk shadow
#

ofc, we're talking a player object... which is initalized by the client right?

little raptor
#

The slots are not necessarily filled at the start. (JIP)

dusk shadow
#

but that was @limber stump's goal, to end the mission if they weren't

#

unless i missed somethin

limber stump
#

It's worked! Thanks โค๏ธ @dusk shadow @little raptor

dusk shadow
#

@little raptor About the attachTo locality thing: From my limited testing I'd say you were right. Locality does not seem to change when attachTo is used.

pine solstice
#

what is the floor for in this line code?

_possibility = floor (random 10) < 3;
warm hedge
pine solstice
#

i looked at that but i am still unsure to what it does ๐Ÿคฃ

warm hedge
#

You're asking what floor does generally or in the code? If later, I don't think it's making sense at all for me

little raptor
winter rose
pine solstice
#

thank you i understand it now

tough abyss
#

how would i go about getting the difference of a count if it changes

winter rose
#

You would store it beforehand

tough abyss
#

and i do that by running count as a variable right?

past wagon
tough abyss
#

sosqf _countGroup = count units group group1

winter rose
#

if you want to check if someone died from within the group, add them a "killed" EH, no?

tough abyss
#

i want to get how many have been killed so that i can spawn that number of replacment troops to reinforce the squad

#

so squad started with 8 now its got 6 so spawn 2 more riflemen

winter rose
#

how would you do with logic?```sqf
private _startCount = count units _group;

while { true } do
{
waitUntil { sleep 1; count units _group < _startCount };
private _difference = count units _group - _startCount;
/* spawn _difference units */
};

#

that's not ideal and Killed/EntityKilled EH is better, but you get the idea

tough abyss
#

ah perfect thanks @winter rose lou i had the right idea then was going about it wrong, was juggling how to write it in my head

#

its not going to be counting large numbers so it dosnt have to be very efficient, and event handlers scare me i havnt go a clue where to start on them XD

winter rose
tough abyss
#

ahh

winter rose
tough abyss
#

cool thanks Lou for the help

smoky rune
#

is there any way to convert getPos (PositionAGLS?) position to positionWorld?

#

use case - i have a position and need to create simple object, but BIS_fnc_createSimpleObject accepts only world position

little raptor
#

@smoky rune also converting AGLS makes no sense. Imagine a multi story building. No matter which floor you stand on, your AGLS position is always: [x, y, 0]

spark turret
#

do missiles not fire their "killed" eventhandler?

#

they dont seem to ever fire for me.

diag_log ["missile",_missile,"target",_target];
_missile addEventHandler [
    "Killed",
    {diag_log ["missile killed:", _this, " target: "];}
    ];

_missile addEventHandler ["Killed", "hint format ['Killed by %1', _this # 1];"];
winter rose
#

iirc EH don't work on "bullets"

spark turret
#

is there any other way than a loop to do stuff with bullets?

winter rose
#

nope ๐Ÿ˜ฌ

#

(afaik)

spark turret
#

rip. well then
thanks anyways

#

i have a params command that expects certain data types as input, if i input a wrong one, it throws and error BUT continues my function?? wth

#

is there a way to make it auto exit?

winter rose
#

if (!params []) exitWith {};

#

BUT I believe it would exit on using default values as well

spark turret
#

ah i misread in the biki:
"checks if passed value is one of listed Data Types. If not, default value is used instead. "

spark turret
little raptor
#

params returns bool which indicates if it was successful

spark turret
#

aaaaaaaah okay i should really read the biki more carefully

#

sorry lol i promise to read the whole section next time

winter rose
winter rose
spark turret
#

!!1!1!!!elf

smoky verge
#

can I spawn enemies only locally for a player?

clever radish
#

I currently got about 20 objects that I want to delete, how do i do this best? I tried _Vessel = [obj1, obj2...] deletevehicle _vessel but is shows an error "type array, excpeted object"

smoky verge
#

I see thanks

winter rose
#

@smoky verge you can although create enemies and hideObject them where wanted

distant oyster
smoky verge
normal abyss
#

Doesn't dynamic simulation technically achieve that?

smoky verge
#

to explain myself better
team A goes to point A
team B goes to point B
Team B will never see the enemies in point A
and vice versa
is there a way for team A to not simulate the enemies in point B?
or does the game automatically do that?

#

I though dynamic sim enables sim for everyone in the server not just who's close by
but I don't really understand perfectly how MP stuff works so I might just be saying stupid stuff

still forum
winter rose
spark turret
#

what benefit has that?

#

the units are remote-server entites anyways, so whats the point in disabling them on some clients?

still forum
winter rose
little raptor
smoky verge
#

mhm I see
nevermind then
was hoping to get some method to increase performance due to this particular mission I'm making

winter rose
little raptor
#

altho if the object is disabled locally then I guess the client won't tell the server that it has been updated. in this case it might actually reduce network traffic

spark turret
#

maybe arma is smart enough to tell the server to not update disable units positions.

anyways other topic:
are there invisible target objects i can use to make AI shoot at something?
I have in the past tried literally everything else, down to tick-loops forcing fire if muzzle pointed at right direction.

spark turret
#

yeah thats what i heard

little raptor
#

you can create your own

smoky verge
#

they are like vehicles

little raptor
#

just inherit from B_invisibleTarget_F

#

(iirc)

#

and set scope = 1

spark turret
#

is B_invisibleTarget_F an object i can already use? i dont want to mod my own

little raptor
#

you can't

#

it's "private" (scope = 0)

smoky verge
#

I gues cba only makes it more easy to create

little raptor
#

yes

#

it simply uses scope = 1 (or 2) for them

spark turret
#

sanchez you got a classname for the cba one?

little raptor
#

CBA_B_invisibleTarget I guess

#

you can check in 3den

#

under NATO

smoky verge
#

I don't but they should be like vehicles you can place

spark turret
#

aaah cool, listed under nato -> targets

#

CBA_B_InvisibleTargetAir
CBA_B_InvisibleTarget
CBA_B_InvisibleTargetVehicle

little raptor
#

that was a good guess blobcloseenjoy

spark turret
#

does AI recognize it automatically like an enemy or do you have to reveal it via script?

little raptor
#

they're just empty (but invisible and massless) vehicles

#

if you add crew to them they might

spark turret
#

nope, CBA_B_InvisibleTarget is directly attacked by opfor

little raptor
#

they're not supposed to attack it tho meowsweats
just target it

#

it's an empty vehicle

#

I guess if you place them in 3den it also adds the crew

#

maybe that's why

spark turret
#

that makes sense

still forum
spark turret
#

yeah, my invisible target vehicle is called "shawn faulkner", placed in 3den

little raptor
pale ridge
#

i think i am doing something wrong:
where do i put a eventhandler?
I am trying to call it via CfgFunctions in the config.cpp
as fn_Needler.sqf.
is that ok or do eventhandlers require a special envirioment/calling?

little raptor
#

and of course what you do in the function

pale ridge
#

ok so this is the evenhandler:

player addEventHandler ["Fired", {
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
    if (_ammo isEqualto "AmmoNeedler")
        then
        {
            _dt = cursorTarget;
            player globalChat (format ["%1",_dt]);
            if (_dt isKindOf "Man")
            then
            {
                [_dt] spawn 
                {
                    sleep (5 + random 6);
                    _dt setDamage 1;
                };
            };
        };
}];```
#

igonre the globalchat i tried to test it, but it doesn't work

#

for what ever reason

#

i can use cba eventhandlers normally, but i have no experince wit hbis eh yet

little raptor
#

this function has many flaws

#

first of all, player depends on the client

#

second of all, you're using player inside the event handler (the player may have changed)

#

use _unit

pale ridge
#

hmm

little raptor
#

third of all, _dt is not defined inside the spawn

#

fourth of all, lots of unused variables

pale ridge
#

so do i have to do: params["dt"];?

#

i wasn't sure because i thought u can only use predifined in params

little raptor
pale ridge
#

ahh ye sry

little raptor
#

that still doesn't mean that the function will work

still forum
wary lichen
#

Hello, everyone. How to use SelectPlayer for current player, for example: cursorTarget -> player. I want to change the model of the player I'm looking at.

#

you can use selectPlayer for other players in any order?

#

in other words, I want to replace the model with the player I'm looking at, and get him instance from cursorTarget

winter rose
#

selectPlayer cursorObject

#

you could add more checks, but technically this can work (beware of MP locality issues)

wary lichen
#

selectPlayer -> transformation shooter to target

#

I need selectPlayer -> turn the victim into an animal for example

#

I have script for transformation

#

but script works, only for shooter

normal monolith
#

Hi guys !
i wanted to know, is there a way to know if a controller (xbox or others) is detected ?

wary lichen
#

selectPlayer locally works for script executor, and transform player to victim, but I need turn the victim into an arbitrary object

#

how to execute selectPlayer on victim side

winter rose
#

remoteExec

wary lichen
winter rose
wary lichen
#

removeExec don't work in arma 2 as far as I know

winter rose
#

yep, A3 only

wary lichen
normal monolith
winter rose
# wary lichen how to?

e.g an event handler

player addEventHandler ["Killed", {
  _rabbit = createRabbit;
  selectPlayer _rabbit;
}];
```(pseudo code, of course)
wary lichen
#

humm, cursorTarget can't help?

winter rose
#

why would you care about cursorTarget?

wary lichen
#

adding an event for the player every time is not very rational as it seems to me

winter rose
#

the EH is kept upon respawn iirc; and if not, it's still not a negative performance impact

wary lichen
#

the more I need to turn the player without damaging him or killing him

winter rose
#

and you could kill someone with a grenade, therefore nulling cursorTarget

#

or shoot through wooden planks, etc

wary lichen
#

uhh

#

I try it, thanks

heady quiver
#

Hi guys, how can i add smoke to something ๐Ÿค” ?

winter rose
heady quiver
#

-.-

winter rose
heady quiver
#

Create the page "addCigarette" on this wiki!

#

lemme create one

winter rose
#

nooo

heady quiver
#

kidding

#
private _ps1 = "#particlesource" createVehicleLocal _posATL;
_ps1 setParticleParams [
            ["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 1], "", "Billboard",
            1, 10, [0, 0, 0.5], [0, 0, 2.9], 1, 1.275, 1, 0.066, [4, 5, 10, 10],
            [[0.3, 0.3, 0.3, 0.33], [0.4, 0.4, 0.4, 0.33], [0.2, 0.2, 0, 0]],
            [0, 1], 1, 0, "", "", _ps1];
_ps1 setParticleRandom [0, [0, 0, 0], [0.33, 0.33, 0], 0, 0.25, [0.05, 0.05, 0.05, 0.05], 0, 0];
_ps1 setDropInterval 0.5;

Wouldnt this just create it local and only for one person ?

winter rose
#

yes

#

particles are local, so are the sources

heady quiver
#

yikes

winter rose
#

not really, since you can create sources on each machines

heady quiver
#

lets say i create a vehicle:

objective = createVehicle [selectRandom _vehicleList, _markerPosition, [], 0, "CAN_COLLIDE"];

I wanna make sure everyone sees the smoke.

winter rose
#

remoteExec theSmokeFunction?

#

that or create it from the beginning

heady quiver
#

That code above runs on the server (1x)

#

on function call

#

do i still need to exec it then?

winter rose
#

remoteExec with JIP = true

heady quiver
#
        // Create Objective
        objective = createVehicle [selectRandom _vehicleList, _markerPosition, [], 0, "CAN_COLLIDE"];

        // Add smoke effect to objective
        private _ps1 = "#particlesource" createVehicleLocal getPos objective;
        _ps1 setParticleParams [
            ["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard",
            1, 8, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [1, 3, 6],
            [[0, 0, 0, 0], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.1, 0.1, 0.1, 0.5], [0.125, 0.125, 0.125, 0]],
            [0.25], 1, 0, "", "", _ps1];
        _ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
        _ps1 setDropInterval 0.05;

This works (for me) but like you said it wont work MP cuz i need to remote exec how would i make that entire function remote?

copper narwhal
#

hello again, is it possible in any way to prevent someone changing weapon attachments through the inventory instead only allowing them to do so through the Ace interaction menu?

willow hound
# heady quiver ```sqf // Create Objective objective = createVehicle [selectRand...

You take your Add smoke effect to objective code block, put it in a separate function, substitute objective with _this in that function and then modify your original code to be ...

// Create Objective
Objective = createVehicle [selectRandom _vehicleList, _markerPosition, [], 0, "CAN_COLLIDE"];
// Add smoke effect to objective
Objective remoteExec ["BS_fnc_addSmokeEffect", 0];
```... and set the JIP parameter as needed.
heady quiver
#

really need to make a seperate function for that?

willow hound
willow hound
copper narwhal
willow hound
#

Yep, that's what I meant.

heady quiver
#

Not sure if im following gotta dig a bit deeper i guess.

copper narwhal
heady quiver
#

@willow hound Can't i loop over all the players in the server and add the smoke like that?

willow hound
heady quiver
#
        ["#particlesource", getPos objective] remoteExec ["createVehicleLocal"];

Something like this? notlikemeow

winter rose
#

no ๐Ÿ˜ฑ

heady quiver
willow hound
#

You still need more reading I'm afraid.

heady quiver
#

well the 'hint' one is simple

#

but mine is a bit more complex i guess

#

lol

winter rose
#

if you create the particle source locally, you still have to use settings on it

willow hound
winter rose
#

my best advice would be to execute a script (better, a function) on client's machines

heady quiver
#

but

#

How would i make a function that can have a parameter ๐Ÿค”

willow hound
#

You always have the magic variable _this available in scripts and functions.

#

How do you find out about this? You search the wiki for an article on functions.

winter rose
heady quiver
#

Mmm

#
fncSmokeEffect = {

    params ["_objective"];

    // Add smoke effect to objective
    private _ps1 = "#particlesource" createVehicleLocal getPos _objective;

    _ps1 setParticleParams [
        ["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard",
        1, 8, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [1, 3, 6],
        [[0, 0, 0, 0], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.1, 0.1, 0.1, 0.5], [0.125, 0.125, 0.125, 0]],
        [0.25], 1, 0, "", "", _ps1];
    _ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
    _ps1 setDropInterval 0.05;

};
// Call function remote
[objective] remoteExec ["fncSmokeEffect"];
#

I have a feeling im close ๐Ÿค”

wind hedge
#
_nearTargets = _zombie nearEntities [["CAManBase", "Dog_Base_F", "Goat_Base_F", "Sheep_random_F", "LandVehicle", "Helicopter", "Boat_F"], _zCheckRange] select {
    ((getPosWorld vehicle _x) select 2 < 50) &&
    (abs speed _x < 30) &&
    (lifeState _x isNotEqualTo "INCAPACITATED") &&
    (isNil {_x getVariable "vIsZombie"}) &&
    (_x != _zombie)};
``` Why is this resulting in _nearTargets still having incapacitated units? Am I doing the select wrong?
willow hound
heady quiver
#

fncSmokeEffect = initServer.sqf

#

this entire code is actually

willow hound
#

And where does initServer.sqf run? ๐Ÿ™‚

heady quiver
wind hedge
#

initServer is not client!

#

just run the same code in initPlayerLocal.sqf

#

problem solved

heady quiver
#

done that now

#

so the function is in the initPlayerLocal.sqf but i have a feeling that something is off: [objective] remoteExec ["fncSmokeEffect"]; right here.

willow hound
#

Is there a script error manifestation of that feeling?

heady quiver
#

no

#

i didnt run anything yet

#
objective remoteExec ["fncSmokeEffect", -2];
``` <--- shouldn't it be this ?
willow hound
#

The secret ingredients are reading the documentation and testing one's code a lot.

heady quiver
#

"Example 1" remoteExec ["hint", -2]; // Executed everywhere except on the server.

winter rose
#

-2 excludes a potential player-hosted server

willow hound
#

Ah, but hint does not take an array argument.

heady quiver
#

oh ye..

wind hedge
#

how does that smoke effect look like?

willow hound
#

Since your function uses params, it takes an array argument, in this case, an array with only one element.

heady quiver
#
[objective] remoteExec ["fncSmokeEffect"];

So this is fine?

willow hound
#

It should be.

heady quiver
#

๐Ÿ’ฆ

wind hedge
#
_smokeEffect = createVehicle ["test_EmptyObjectForSmoke", getPos objective, [], 0, "NONE"]; ``` (This is global since createVehicle is global. Fixes all your problems unless you want a very specific type of smoke)
#

๐Ÿ‘† @heady quiver

heady quiver
#

bruuh

#

i thought light / smoke etc didnt work wtih createVehicle

willow hound
heady quiver
#

only local

wind hedge
heady quiver
#

Well it seems to work right now.

#

so im gonna keep it like this

#

x)

#

ty for the help @willow hound

wind hedge
#

๐Ÿ˜…

winter rose
#

@heady quiver โ†’ @wind hedge :p

heady quiver
#

Sup?

#

But

#

Whats wrong with what i have now then?

winter rose
#

no no, nothing ^^ if it works it's good!

heady quiver
#

Well i cant really check if it works with other ppl but i seem to get the smoke

#

I just need to find a better way to do this:
taskName = format['task_%1', round(random 9999)];

#

Cuz this is bound to ask for problems x)

winter rose
#

round time + "_" + round random 9999 ?

heady quiver
#
// Create random task name
taskName = format['task_%1_%2', round(random 9999), round(time)];
winter rose
#

it's not a javascript function ^^ you can use round random 9999 and round time

wind hedge
#

as a funny note, I added this handleDamage event handler to a NPC: SQF private _hits = _zombie getVariable "vHits"; _maxHits = _zombie getVariable "vHitPoints"; _hits = _hits + 1; _zombie setVariable ["vHits", _hits, true]; systemChat format ["hits %1, MAXhits %2", _hits, _maxHits]; And then shoot at the zombie ONCE and I get the systemchat "hits 56,57,58,59" !!! So a single pistol shot causes the EH to fire 59 times!!!!

final storm
heady quiver
#

thats why functions and parameters where a bit weird for me

#

function(parameter){ } is what im used to lol

winter rose
#

yes, with SQF you have to re-learn some basics

#

all in all it's "not that bad", but some quirks

heady quiver
#

Well atleast i learned how to do it now so thanks for that.

fair drum
#

then there's me who learned .sqf first now I'm trying to learn an actual language...

winter rose
#

behold, as I learnt SQS before anything else ๐Ÿ˜‚

#

what do you mean, "forget goto"?

fair drum
#

there a wiki page with all of the hidden variables like setVariable ['bis_disabled_Door_1',1,true]?

winter rose
#

not really no

surreal peak
#

Where could you go about finding all the variables so I see them

winter rose
#

allVariables <object>

#

mayhaps

surreal peak
#

ahh

hushed tendon
#

Would adding a remoteExec to an addAction for this object work in MP?

surreal peak
#

anyway to see a list of all of these for all objects? In a PBO somewhere or would it be an engine thing

winter rose
hushed tendon
#

And would the {} of the addAction be global?

winter rose
#

no
action would be added locally everywhere

โ€ฆjust what do you want to do?

hushed tendon
#

Or would it just allow every client to perform the addAction?

winter rose
#

if you use this addAction *** without any remoteExec, everyone will see that action - and it will not be common to everyone as in "one activate it then the other cannot see it"

hushed tendon
#

okay

#

Thanks

heady quiver
#

Another question i have a supportRequester module that has a limit of 0 (support runs need to be earned) how would i add +1 to CAS for example?

#

i think i already found it:
[player, "Transport", -1] call BIS_fnc_limitSupport;

#

Doesn't seem to work tho

heady quiver
#

Yea im trying but its not updating the support menu i think

winter rose
#

quantity: Number - support run limit. -1 for unlimited support

heady quiver
#

it returns: true tho

#

yep

winter rose
heady quiver
#

So i linked up the virtual modules to the requester and the requester to the JTAC unit, i spawn in as him and i call this in console:
[player, "Artillery", 1] call BIS_fnc_limitSupport;

#

Do i need to refresh the menu or something?

dreamy kestrel
#

did a bit of testing from yesterday and got past the issue. I am satisfied that _array = +_array is a SQF anti-pattern, in the sense that, _array has a lock on it as + tries to operate, and cannot replace itself when it has a lock, so ACCESS_VIOLATION. makes perfect sense.

heady quiver
#

@winter rose it does return true but the support radio menu (0-8) has no options available after i run it

winter rose
#

you may have to add support, dunno

crude vigil
#

@heady quiver Because the player is wrong parameter in [player, "Artillery", 1] call BIS_fnc_limitSupport;

#

You need to pass the supportRequester module instead of player

heady quiver
#

i tried that too but the docu says caller.

#

the unit able to request support

#

maybe the docu is just wrong

crude vigil
#

I dont wanna say wrong without testing

#

or it might be supporting both..

heady quiver
#

Alright i linked up everything again virtual module -> requester -> unit , i now have 1 CAS_Heli available and when i use it its gone then i try this: [player, "CAS_Heli", -1] call BIS_fnc_limitSupport; nothing happends or [supRequester, "CAS_Heli", 0] call BIS_fnc_limitSupport;

#

wait.

#

it works now

#

x)

crude vigil
#

It must be requester module, documentaiton is wrong

heady quiver
#

Yea

#

i just changed to the supRequester

#

and works.

crude vigil
#

1st parameter is misleading

heady quiver
#

caller: Object - the unit able to request support <-- should be support requester module

crude vigil
#

I checked the file

winter rose
#

are you two drunk or what

crude vigil
#

it also says Support Requester Module

winter rose
heady quiver
#

HAH

#

He changed it

#

meowsweats I thought i went insane for sec.

winter rose
#

that's my routine joke I love doing, forgive me ๐Ÿคฃ

crude vigil
#

Thanks :)

heady quiver
#

Btw

#

I got something that might be a complete bug

copper raven
#

@dreamy kestrel it's not an anti pattern, make a support ticket as Dedmen said, the cause is probably elsewhere

heady quiver
#

Scrap that

little raptor
#

_array has a lock on it as + tries to operate, and cannot replace itself when it has a lock
meowsweats
in sqf no data can be accessed at the same time by two commands

quasi sedge
#

full client.sqf https://pastebin.com/XuFz4DGR

This error spamming .rpt
over 9000 times of this:
Only on clientside .rpt tho, nothing on server.rpt

22:24:42 Error position: <select 12 == 1) then {
_text = (amm_CMar>
22:24:42 Error Zero divisor
22:24:42 File xx\addons\d_map_adv_markers\client.sqf..., line 135
22:24:42 Error in expression <(d_restr_enable_freeze) then {
if (_mar select 12 == 1) then {
_text = (amm_CMar>
#

i even dont't understand where divisor is

winter rose
#

_mar select 12
_mar might have less elements than that

quasi sedge
#
if (_mar select 12 == 1) then {
_text = (GVAR(CMarkerChannelToChar) select MAR_CHAN(_mar)) + " " + _text;
} else
{
_text = ((_mar select 11) select 0) + " " + _text;
};
little raptor
#

for select with bound checking use param

deft dock
#

i need to plug your big brainz for a bit........
i'm trying to add a "custom arsenal" to warlords. more like, having all vanilla content blocked. warlords has two functions where to hook that in, but i had no joy yet.
first option was, using the warlords blacklist filter:

_blacklist = ["gm","a3","kart","mark","tank","enoch","orange","exp","exp_a","exp_b","epa","epc","Expansion"];

_cfgWpns = configFile >> "CfgWeapons";
_cfgVehs = configFile >> "CfgVehicles";
_cfgGlasses = configFile >> "CfgGlasses";
_cfgMags = configFile >> "CfgMagazines";

{
    _cfg = switch (_x) do {
        case 5: {_cfgVehs};
        case 7: {_cfgGlasses};
        case 22;
        case 23;
        case 26: {_cfgMags};
        case 24: {_cfgMags};
        default {_cfgWpns}
    };
    _arr = +(BIS_fnc_arsenal_data select _x);
    _arr = _arr select {!(toLower getText (_cfg >> _x >> "DLC") in _blacklist)};
    BIS_fnc_arsenal_data set [_x, _arr];
} forEach [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 22, 23, 24, 26];```
i added everything after "gm", still apex and base game stuff shows up in the arsenal...

my second approach was, do directly influence the call for the arsenal:
```sqf
_funds = player getVariable "BIS_WL_funds";

"close" call BIS_fnc_WLPurchaseMenu;

_null = ["Open", TRUE] spawn BIS_fnc_arsenal;

player setVariable ["BIS_WL_funds", (player getVariable "BIS_WL_funds") - BIS_WL_arsenalCost, TRUE];

closeDialog 602;```
but i have no idea how to either restrict the vanilla content, or load a custom arsenal that is not a box.

any ideas?

please ping me if someone responds. i'm not monitoring this channel usually

thanks guys
cosmic lichen
#

@deft dock The first method might work, but you cannot use the dlc property since it's not define for expansion weapons and vanilla weapons

#
configSourceMod (configFile >> "CfgWeapons" >> "arifle_ARX_Viper_hex_F");
``` Would return "expansion"
deft dock
#

since my knowledge of scripting is basically non existing, what would the first function look like?

cosmic lichen
#

You only want CUP items right?

deft dock
#

for now, yes.

#

a solution others can use / modify would be top notch ofc

cosmic lichen
#

So I guess it's easier to use a whitelist instead of a blacklist

deft dock
#

indeed

cosmic lichen
#
_whitelist = ["CUP"]; //I dunno what configSourceMod returns for cup items so double check that

_arr = _arr select {(toLower configSourceMod (_cfg >> _x) in _whiteList)};
#

Later on, whitelist could be a missionConfig property or so which others can edit.

#

But first check if that brings the result your are looking for.

deft dock
#

i doubt we have a tag like "CUP" that returns with configsourcemod

#

i'll check that

#

nope... no return on configSourceMod

cosmic lichen
deft dock
#

ikr

#

this is DLC = "foo"; right?

cosmic lichen
#

This might help you

#

I use it for me inventory manager and it works reliably

deft dock
#

i already have it (since today)
helping for what?

cosmic lichen
#

check the link ๐Ÿ˜„

deft dock
#

ahh

#

i thought you want me to DL the mod ๐Ÿ˜„

cosmic lichen
#

nah

deft dock
#

ok, what am i looking at? ๐Ÿ˜„

cosmic lichen
#
private _addonClass = "";
    if (count configSourceAddonList _x > 0) then
    {
      private _mods = configsourcemodlist (configfile >> "CfgPatches" >> configSourceAddonList _x # 0);
      if (count _mods > 0) then
      {
        _addonClass = _mods # 0;
      };
    };

You are looking at a reliable way to figure out what mod/dlc/addon a item belongs to

#

_x is the config of the item

deft dock
#

excuse my ignorance, but how do i use that?

cosmic lichen
#

One sec

#

I need to download cup weapons ๐Ÿ˜„

deft dock
#

๐Ÿ˜„

#

oh...
i guess i ๐Ÿฆ†ed something when pasting your code
weapons are now returning "@CUP Weapons"

cosmic lichen
#
_configToItem = (configFile >> "CfgWeapons" >> "CUP_arifle_FNFAL5061_railed"); 
 
private _addonClass = ""; 
if (count configSourceAddonList _configToItem > 0) then 
{ 
  private _mods = configsourcemodlist (configfile >> "CfgPatches" >> configSourceAddonList _configToItem # 0); 
  if (count _mods > 0) then 
  { 
    _addonClass = _mods # 0; 
  }; 
}; 
 
_addonClass
#

@CUP Weapons is correct

#

modParams [_addonClass, ["name"]] # 0; // "CUP Weapons 1.16.3"

deft dock
#

but mags, uniforms, ect are returning nothing

cosmic lichen
#

They do

#

_configToItem = configFile >> "CfgMagazines" >> "CUP_10x_303_M";

#

Also returns @CUP Weapons

deft dock
#

so, the whitelist could look like this:

_whitelist = ["@CUP Weapons","@CUP Units"]; //I dunno what configSourceMod returns for cup items so double check that

_arr = _arr select {(toLower configSourceMod (_cfg >> _x) in _whiteList)};
#

?

cosmic lichen
#

Yes, that should in theory be reliable

#

However, if you only want cup stuff you could also just filter the class names since they all start with CUP_

deft dock
#

keep in mind, i have zero scrip skills
"just" is like climbing mt everest without oxigen, gloves and boots for me ๐Ÿคฃ

#

i can't even find the function where the blacklist is called to change it to a white list.......

#

so much for that

cosmic lichen
#

A3\Functions_F_Warlords\Warlords\fn_WLArsenalFilter.sqf

#

BIS_fnc_WLArsenalFilter

#

This one?

deft dock
#

yes. i cant find where this function is called

cosmic lichen
#

you got arma 3 data extracted?

deft dock
#

yes

cosmic lichen
#

Then just use "Search in files"

#
"configName _x select [0,4] == 'CUP_' && (getNumber (_x >> 'scope') > 1)" configClasses (configFile >> "CfgMagazines");

This is how you filter cup items by the class name

deft dock
#

searching 92k files now ๐Ÿ˜„

cosmic lichen
#

safe to say that scanning only .sqf files would be enough ๐Ÿ˜„

deft dock
#

it's not in warlords functions

#

a3\missions_f_warlords\commonInitScript.sqf:

#
[] spawn {
    waitUntil {!isNil "BIS_WL_arsenalSetupDone"};
    call BIS_fnc_WLArsenalFilter;
};```
#

and "BIS_WL_arsenalSetupDone" leads to a3\functions_f_warlords\Warlords\fn_WLClientInit.sqf which also contains some sort of blacklist

if (BIS_WL_arsenalEnabled == 1) then {
    BIS_fnc_arsenal_data set [3, BIS_WL_factionAppropriateUniforms];
    BIS_fnc_arsenal_data set [5, (BIS_fnc_arsenal_data select 5) - BIS_WL_mortarBackpacks];
    BIS_fnc_arsenal_data set [23, (BIS_fnc_arsenal_data select 23) - ["APERSMineDispenser_Mag"]];
    BIS_WL_arsenalSetupDone = TRUE;

damn... this is getting worse and worse

#

i think the "whitelist" approach is a nope

#

any idea how to rewrite the blacklist to have the rest of vanilla stuff removed?

deft dock
#

Thanks to Taro i have a solution to my problem (which sadly requires rebranding of functions_f_warlords for now):

combined custom warlords arsenal:

  • place an arsenal box (or a box where the custom arsenal is attached to) in the mission and hide it
  • name the box (in my case CUP_Arsenal_Box)
  • open fn_WLOpenArsenal.sqf and use this
_funds = player getVariable "BIS_WL_funds";

"close" call BIS_fnc_WLPurchaseMenu;

_null = ["Open",[nil,CUP_Arsenal_Box,player]] spawn bis_fnc_arsenal;

player setVariable ["BIS_WL_funds", (player getVariable "BIS_WL_funds") - BIS_WL_arsenalCost, TRUE];

closeDialog 602;

faction specific warlords arsenals:

  • place two arsenal boxes (each with a custom arsenal for the specific faction)
  • name the boxes (in my case CUP_USMC_Arsenal and CUP_Russia_Arsenal)
  • open fn_WLOpenArsenal.sqf and use this
_funds = player getVariable "BIS_WL_funds";

"close" call BIS_fnc_WLPurchaseMenu;

if (!(CUP_USMC_Arsenal isEqualTo objNull) && !(CUP_Russia_Arsenal isEqualTo objNull)) then {

    private _arsenalBox = CUP_USMC_Arsenal;
    switch (true) do {
        case (side player == west): { _arsenalBox = CUP_USMC_Arsenal};
        case (side player == east): { _arsenalBox = CUP_Russia_Arsenal};
    };

    _null = ["Open",[nil,_arsenalBox,player]] spawn bis_fnc_arsenal;

} else {

    _null = ["Open", TRUE] spawn BIS_fnc_arsenal;

};

player setVariable ["BIS_WL_funds", (player getVariable "BIS_WL_funds") - BIS_WL_arsenalCost, TRUE];

closeDialog 602;
#

thx to everyone here who tried to help me out nevertheless

wind hedge
#

Has anyone experience addActions on containers with "Inventory" loosing they addActions a little while into the mission? Don't know what is causing that.

copper raven
#

๐Ÿค”

#

Perhaps some mod messing with them?

leaden haven
#

Any way to improve this code? Is there a way to check if the game has the pause menu open in MP?

h = [] spawn {
    while {true} do {
        waitUntil {! isNull (findDisplay 49)};
        _btn = ((findDisplay 49) displayCtrl 2) ctrlSetText "";
        _btn2 = ((findDisplay 49) displayCtrl 103) ctrlSetText "";
        _btn2 = ((findDisplay 49) displayCtrl 2) ctrlSetBackgroundColor [0.7, 0.3, 0.9, 1];
        _btn1 = ((findDisplay 49) displayCtrl 1005) ctrlSetText format ["ZGM83 Afghan war. %1 : Arma 3 v%2.%3!", "1.79", (productVersion select 2), (productVersion select 3)];
        _btn3 = ((findDisplay 49) displayCtrl 120) ctrlSetText "Enemy insurgents have invaded Aghanistan. Destroy their assets and remove all enemies to free this suffering nation. This must be carried out in a humanitarian way, minimising damage to civilian assets.";
        _btn4 = ((findDisplay 49) displayCtrl 523) ctrlSetText playername;
        _btnclr = ((findDisplay 49) displayCtrl 2) ctrlSetBackgroundColor [0, 0, 0, 0];
        _btnclr1 = ((findDisplay 49) displayCtrl 103) ctrlSetBackgroundColor [0, 0, 0, 0];
        //_CEH = ((findDisplay 49) displayCtrl 2) ctrlAddEventHandler ["MouseButtonDown",{(findDisplay 49) closeDisplay 0; _ok = createDialog "MyDialog";}];
        //_CEH = ((findDisplay 49) displayCtrl 2) ctrlRemoveEventHandler ["MouseButtonDown", 0];
        waitUntil {isNull (findDisplay 49)};
    };
};

This is meant to use the Arma 3 multiplayer pause menu to display various text. I should not use while {true}, but I need a better way.

copper raven
#

bunch of unnecessary assignments in your code

little raptor
#

use onGameInterrupt event handler

leaden haven
#

Thank you.

ember path
#

hello old friends,
i have a question, in a stream the vcom ai dev did, they use some sort of debug tool to see what the ai is "thinking" or well trying to do, their paths, commands etc. What is that and how do i access it (trying to figure something out in my mission and i want to avoid using unitCapture)
quick timestamp: https://youtu.be/mfY2ff9WZeg?t=697

verbal saddle
#

The ones your looking for are under AI

ember path
#

ahhh i need a different branch i see, okay, ill check it out, thanks!

cosmic imp
#

Hey there, trying to get an attached object to rotate through my addAction "Rotate". I can get it to go by setDir but i want to be able to select rotate again and keep rotating the object to optimal position. I was wondering if there was something i could do along the lines of setDir++ where it just keeps adding direction incrementally. Code below for reference ``` player addAction [
"Round Sandbag",
{
params ["_target", "_caller", "_actionId", "_arguments"];

    JD_Barrier = ["Land_BagFence_Round_F"] call createObject;
},
nil,1.5,true,true,"","JD_Barrier isEqualTo objNull"

];

player addAction [
"Rotate Sandbag",
{
params ["_target", "_caller", "_actionId", "_arguments"];

    JD_Barrier setDir 180;
    
},
nil,1.5,true,true,"","JD_Barrier isNotEqualTo objNull"

];```

quasi sedge
#
        if (  GVAR(CMarkerTagChannelVisibility) == MTAG_ALWAYS_ON ||
            ( !GVAR(CMarkerTagNameVisibilityTemporaryOn) && GVAR(CMarkerTagChannelVisibility) == MTAG_ON ) ||
            ( GVAR(CMarkerTagNameVisibilityTemporaryOn) && GVAR(CMarkerTagChannelVisibility) == MTAG_OFF )
             ) then
        {
 
            if (d_restr_enable_freeze) then {
                if (_mar select 12 == 1) then {
                    _text = (GVAR(CMarkerChannelToChar) select MAR_CHAN(_mar)) + " " + _text;
                } else
                {
                    _text = ((_mar select 11) select 0) + " " + _text;
                };
            } else {
                _text = (GVAR(CMarkerChannelToChar) select MAR_CHAN(_mar)) + " " + _text;
            };
        };        

How to rewrite to use "param" instead of "select" for 2nd "if". Simply instead "select 12" use "param [12]"? That's all?

        if (  GVAR(CMarkerTagChannelVisibility) == MTAG_ALWAYS_ON ||
            ( !GVAR(CMarkerTagNameVisibilityTemporaryOn) && GVAR(CMarkerTagChannelVisibility) == MTAG_ON ) ||
            ( GVAR(CMarkerTagNameVisibilityTemporaryOn) && GVAR(CMarkerTagChannelVisibility) == MTAG_OFF )
             ) then
        {
 
            if (d_restr_enable_freeze) then {
                if (_mar param [12] == 1) then {
                    _text = (GVAR(CMarkerChannelToChar) select MAR_CHAN(_mar)) + " " + _text;
                } else
                {
                    _text = ((_mar select 11) select 0) + " " + _text;
                };
            } else {
                _text = (GVAR(CMarkerChannelToChar) select MAR_CHAN(_mar)) + " " + _text;
            };
        };        
#

Error with "select" which was spamming

22:24:42 Error position: <select 12 == 1) then {
_text = (amm_CMar>
22:24:42 Error Zero divisor
22:24:42 File xx\addons\d_map_adv_markers\client.sqf..., line 135
22:24:42 Error in expression <(d_restr_enable_freeze) then {
if (_mar select 12 == 1) then {
_text = (amm_CMar>
ember path
winter rose
ember path
#

it said Dev with the lil blue thingy on the launcher, is that not it?

verbal saddle
#

The launcher only uses the default exe

ember path
#

ah heck

still forum
still forum
verbal saddle
tough abyss
#

So, I am new to SQF, or to say better i've never did any SQF scripting, so I am not sure if this script of mine would work as intended

#
uisleep 5;
systemChat format ["Starting Heroes of Serbia Content Protection System..."];
sleep 10;
if (!isMultiplayer) exitWith {};
if (isMultiplayer) then 
{
    systemChat format ["Starting Heroes of Serbia Content Protection System..."];
    //Gets Players Steam64ID
    _igrac = getPlayerUID player;
    //Banned Players Steam64UID
    _listaID = [];
    //Length of the Array
    _velicinaBanListe = count _listaID;
    for [{_i = 0}, {_i < _velinicaBanListe}, {_i = _i + 1}] do // A loop repeating 10 times
    {
        if (_igrac == _listaID # _i) then{

            systemChat format ["Starting Heroes of Serbia Content Protection System - Check Failed"];
            sleep 5;
            titleText ["Using Heroes of Serbia Mod without permission? How about no? Keep playing and Markan will be big sad :(","PLAIN",5];
            
            sleep 5;
            disableUserInput true;
            titleText ["Still not going to stop using the mods? Alrighty then","PLAIN",5];
            sleep 10;
            titleText ["Can't move? How about we kick it into overdrive?","PLAIN",5];
            sleep 5;
            player allowDamage false;
            player enableFatigue false;
            player setUnitRecoilCoefficient 15.0;
            enableCamShake true;    
            addCamShake [10, 45, 10];
            [getPos player, east, 10] call BIS_fnc_spawnGroup;
            for "_j" from 1 To 10 do 
            {
            [getPos player, east, 100] call BIS_fnc_spawnGroup;
            if(vehicle player != player) then { vehicle player setDamage 1; }; 
            _veh = "Bo_GBU12_LGB" createVehicle position player;
            sleep 5;
            };
            titleText ["Still here hun? Well, you ain't anymore","PLAIN",5];
            "end1" call BIS_fnc_endMission;
    } else 
    {
        systemChat format ["Heroes of Serbia Content Protection System - Checks Passed!"];
        systemChat format ["Have fun using our mods"];
    };
    };
};```
ember path
verbal saddle
#

It loads the dev exe, but the diagnostics exe is separate to the dev exe

ember path
#

i see

winter rose
cosmic lichen
#

yeah

#

weird

tough abyss
#

Habbit I inherited from a buddy

winter rose
#

ok

tough abyss
#

Sorry if a misunderstanding happened ๐Ÿ˜„

still forum
cosmic imp
#

I'm having some trouble with BIS_fnc_setObjectRotation. I have [JD_Barrier, [0,0,50]] call BIS_fnc_setObjectRotation; in an addAction to rotate. When i make the x, y, z 100,100,100 i can keep hitting space on the action and it will rotate, just not the way i want it to. I need it to rotate on its x axis. But when i change any of those values it doesn't change the rotation. Any ideas?

#

would this require the use of vectorDir?

tough abyss
ember path
#

hm now im getting some weird error.... assert usr.. bad case in texture name?

#

..dev\futura\lib\txtbank.cpp[290]\func: Texture::SetName

#

anyone know what thats aout

#

(dont worry just hit ignore a buncha times, its fine, dont worryyy about it)

#

c:\bis \ source\ dev\futura \physx\physxintefface.cpp(5569)(fu nc: Physx3Transport::Init) [AssertRLS] MainThread= 5152 Config: Warning! suspForceAppPointOffset is set above the center of mass. This will result in odd vehicle behaviour Its highly recommended to set tireForceAppPointOffset to position below the COM and above the wheelCenter.

#

hmmmmmmmmmmm

little raptor
#

not scripting

ember path
#

gotcha, nah its just throwing a bunch of errors, persumably 1 one of the mods is broken

mighty vector
#

hi.

is there any way to have some sqf files in server paths (outside mission/pbo), and run their functions/invoke them inside mission (ie: external reference?) without being a mod?

winter rose
mighty vector
#

@winter rose yet to investigate that, but to be sure I understood correctly:
if I have myserverfunctions.sqf and running mission altis.pbo...will I be able to edit/change sqf file "on the fly/hot" while playing?

winter rose
#

maybe, but I don't think so

#

the server might lock it

#

if you do that for test purposeโ€ฆ you are doing it wrong ^^

mighty vector
#

so far for me, scripting is a pita :S

mighty vector
#

much appreciated, but my main concern is having to exit to eden to just change a colon, and then back to play and wait the loading screen...to change another colon f**k again, and wait...and so on.

#

that's why i was looking some easier to read and handle than console...

winter rose
#

why not write it properly in the first place ๐Ÿ˜ฌ
you can test with a local server/client as well

Visual Studio Code shows you some code errors with some SQF plugins, too

mighty vector
winter rose
#

depending on your usual errors, if they are MP locality, or just script-writing issues

#

if you have script issues, then you don't even need to run a server @mighty vector; the script error window should tell you when starting preview in Eden anyway (if you enabled -showScriptErrors ofc)

tough abyss
#

hmmm im getting a generic error here on the # mark do sleep commands not work with event handlers

    _soldierName groupChat "Popping green smoke"; #sleep 5; "Land_HelipadCircle_F" createVehicle _lzSite; ```
#

it works without the sleep command

#

but i need the delay

winter rose
#

then spawn your code