#arma3_scripting

1 messages · Page 560 of 1

velvet merlin
#

so the fix would be to have a sleep or 1 or 2?

still forum
#

not necessarily

#

if you save while the sleep is 99% done, and it then continues you might get same problem

#

fix is to check the return of list for nil

dreamy kestrel
#

@still forum can you clarify? still quite confused. in particular I am working on a mpmission, for instance. are we better off with relative include paths?

still forum
#

i told you how you can find the complete path for your mission base. If you try that you'll see you get a couple different paths and cannot predict which one you'll get, meaning thats completely useless for you.
meaning yes, use relative paths

velvet merlin
#

like if (isNull (list XXX)) then {false} else {(vehicle player) in list XXX};

still forum
#

not sure if its really null, i assume nil, yes it has to be nil.

dreamy kestrel
#

fair enough, appreciate it.

velvet merlin
#

well check for isNil "triggerName"?

still forum
#

🤔

#

no..

#

_list = list triggername;
if (isNil "_list") exitWith {false};
vehicle player in _list

cold mica
#

Is there a boolean for whether a script is executed in the editor or in a hosted server? I wish to have my script automatically enable when I test a mission in Eden but disable when I host it normally on a server.

still forum
#

nah not good enough

#

there was some way

winter rose
#

doesn't is3den check if in the editor, not in editor preview ? 🤔

still forum
#

ye

#

but is3denMultiplayer also returns true in preview

cold mica
#

that's perfect! it's odd that is3den returns false in preview but is3denMultiplayer returns true in preview. Nevertheless, it's nothing a simple not and or statement can't fix. Thank you.

unique sundial
#

@velvet merlin got it on my list (pun intended)

still forum
#

its only initialized after the first trigger sweep. Which is every.. 0.5 seconds or so?

jade abyss
#

.5, yep

unique sundial
#

it should return empty array

#

initialized or not

velvet merlin
plain current
#

Does #include not work with __EVAL like #include __EVAL(someVariable)? Getting "preprocessor failed with error - empty file name"

still forum
#

Exception handling in scripts doesn't handle script errors

#

The variable being in parsing namespace? @plain current

plain current
#

yes, it's defined with __EXEC

unique sundial
#

_eval is looking for = before it

plain current
#

so there is no way to include a file based on script?

unique sundial
#

Maybe preprocessfile on condition

plain current
#

well yes but i mean based on a variable in script, eg _lastBit = "hpp\definedikcodes.inc"; evalThis = format["\a3\ui_f\%1", _lastBit]; #include __EVAL(evalThis)

unique sundial
#

I think include is processed before everything

plain current
#

ok, thanks

unique sundial
#

Let me just tell you, you are wasting your time trying to hack preprocessor

#

Give up and find another way

#

There are only handful of cases when macros actually useful, but if you can avoid, avoid

willow rover
#

Is there a way to change the limit a cargo container can hold on mission load?

long glacier
#

I am having some real trouble trying to figure this out :(

I am trying to give each of this kbTell command a variable so I can try and select one randomly when the .sqf is run any ideas how I achieve this? ```_A = prisonguard kbTell [player, "prisonchat", "PrisonGuard1"];

_B = prisonguard kbTell [player, "prisonchat", "PrisonGuard1"];

_C = prisonguard kbTell [player, "prisonchat", "PrisonGuard1"];

_D = prisonguard kbTell [player, "prisonchat", "PrisonGuard1"];

_guardchat = ["_A", "_B", "C", "D"];

selectRandom _guardchat;```

slate sapphire
#

hello does anyone had a corrupted file after crash with notepad++ would like to recover one file if you have experience with that issue let me know

long glacier
#

Trying this ```private ["_soundArray", "_soundToPlay"];
_soundArray = ["prisonguard1", "prisonguard2", "prisonguard3", "prisonguard4"];
_soundToPlay = _soundArray call BIS_fnc_selectRandom;

_prisonguard say3D _soundToPlay;```

winter rose
#

@long glacier sqf prisonguard kbTell [player, "prisonchat", format ["PrisonGuard%1", ceil random 4]];

tiny wadi
#

@long glacier In your first script, you have the variable names as strings. That won't pass the object and will only give selectRandom the ability to give you strings and not the object reference you're looking for

#

that too ^^

long glacier
#

Rgr cheers guys, trying to find a way to get this kbTell crap to work on dedicated server

winter rose
#

with remoteExec , haven't we been through this already?

long glacier
#

Yeah I tried your solution and it did not work on server, worked in SP/MP again but not on server

winter rose
#

and how did you add topic?

long glacier
#

Yes

winter rose
#

how

long glacier
#

I will show you full script

#

This is in the init.sqf ```sqf
// add all random voiceovers
if (isServer) then {
prisonguard kbAddTopic ["prisonchat", "prison.bikb"];
};

if (isServer) then {
gateguard kbAddTopic ["gatechat", "gate.bikb"];
};

// select random voice over prison guard
prison_guard_voice_over = {
params ["_speaker","_voice_sample_name","_number_of_voiceovers"];
private _voiceover_list = [];

for "_i" from 1 to _number_of_voiceovers do {
    _voiceover_list pushBack (format ["%1%2",_voice_sample_name,_i]);
};

[_speaker, [_speaker, "prisonchat", selectRandom _voiceover_list]] remoteExec ["kbTell", _speaker];

};

// select random voice over gate guard
gate_guard_voice_over = {
params ["_speaker","_voice_sample_name","_number_of_voiceovers"];
private _voiceover_list = [];

for "_i" from 1 to _number_of_voiceovers do {
    _voiceover_list pushBack (format ["%1%2",_voice_sample_name,_i]);
};

[_speaker, [_speaker, "gatechat", selectRandom _voiceover_list]] remoteExec ["kbTell", _speaker];

};

winter rose
#

@long glacier ```sqf plz

long glacier
#

sorry was trying to figure out how to do that haha

finite dirge
#

```sqf
code
```

winter rose
#

```sqf
/* your code */
```

#

ninja'd… NANI??!

long glacier
#

then this is my prison.bikb

class Sentences
{  
    class PrisonGuard1
    {
        text = "";
        speech[] = {"\sounds\PrisonGuard_1.ogg", 2, 1, 20};
        class Arguments {};
    };
    
    class PrisonGuard2
    {
        text = "";
        speech[] = {"\sounds\PrisonGuard_2.ogg", 2, 1, 20};
        class Arguments {};
    };

    class PrisonGuard3
    {
        text = "";
        speech[] = {"\sounds\PrisonGuard_3.ogg", 2, 1, 20};
        class Arguments {};
    };

    class PrisonGuard4
    {
        text = "";
        speech[] = {"\sounds\PrisonGuard_4.ogg", 2, 1, 20};
        class Arguments {};
    };   
};

class Arguments{};
class Special{};
startWithVocal[] = {hour};
startWithConsonant[] = {europe, university};```
winter rose
#

yeah @long glacier you are using kbAddTopic on the server, not on the machine that has the unit
you could remoteExec it on all machines, "just in case"

long glacier
#

So just take the add topic out of the if is server?

#

this is the code in my trigger sqf if (isServer) then { [prisonguard,"PrisonGuard",4] call prison_guard_voice_over; };

winter rose
#

if you have isServer check in your trigger, why have it in the script?

long glacier
#

No idea mate thought it helped the script run on dedicated

#

Should I remove those for local execution on players machines

winter rose
#

thought it helped the script run on dedicated
no, really not ^^ it just re-does a check that haas already been made

Should I remove those for local execution on players machines
where? because your script doesn't run on any client here

long glacier
#

Both in the trigger and in the script

#

to run on client?

winter rose
#

is your trigger only "once" or "repeated"?

long glacier
#

repeated

winter rose
#

then it's not "great" because you keep adding and adding the same topic to the guy, it's not really a problem but let's say it is not ideal

#

keep your script server-side only
and whatever you need to do remotely, remoteExecute it

long glacier
#

I am guessing I remote execute the trigger then instead of having he if is server check

winter rose
#

NO

#

use one trigger, server-side, on any player detection

long glacier
#

Yeah I have

winter rose
#

if the trigger is server-side only, you don't need isServer checks then

long glacier
#

Yeah I have the server only check box ticked

winter rose
#

then remove all of your isServer checks

long glacier
#

ok rgr but will that potentially fix it for dedicated?

winter rose
#

no, that's just removing clutter

#

remoteExec will solve your issue with dedicated

long glacier
#

but I am using that already in the script right or do I need to also remote execute the trigger activation code?

winter rose
#

you are not remoteExecuting the kbAddTopic, right?

#

this is your issue: only the server has added the topic, not the machine where the speaker is local

#

so you are basically telling the unit to say a sentence it doesn't know

long glacier
#

Ahh rgr got ya

#

This better? 🤞 ```sqf
// add all random voiceovers

remoteExec prisonguard kbAddTopic ["prisonchat", "prison.bikb"];

remoteExec gateguard kbAddTopic ["gatechat", "gate.bikb"];

// select random voice over prison guard
prison_guard_voice_over = {
params ["_speaker","_voice_sample_name","_number_of_voiceovers"];
private _voiceover_list = [];

for "_i" from 1 to _number_of_voiceovers do {
    _voiceover_list pushBack (format ["%1%2",_voice_sample_name,_i]);
};

[_speaker, [_speaker, "prisonchat", selectRandom _voiceover_list]] remoteExec ["kbTell", _speaker];

};

// select random voice over gate guard
gate_guard_voice_over = {
params ["_speaker","_voice_sample_name","_number_of_voiceovers"];
private _voiceover_list = [];

for "_i" from 1 to _number_of_voiceovers do {
    _voiceover_list pushBack (format ["%1%2",_voice_sample_name,_i]);
};

[_speaker, [_speaker, "gatechat", selectRandom _voiceover_list]] remoteExec ["kbTell", _speaker];

};```

winter rose
#

won't work ^^

long glacier
#

😢

winter rose
#

compare your

remoteExec prisonguard kbAddTopic ["prisonchat", "prison.bikb"];``` with my ```sqf
[_speaker, [_speaker, "gatechat", selectRandom _voiceover_list]] remoteExec ["kbTell", _speaker];```
long glacier
#
[_prisonguard, [_prisonguard, "prisonchat", "prison.bikb"]] remoteExec ["kbAddTopic", _prisonguard];```
winter rose
#

almost

#
[_prisonguard, ["prisonchat", "prison.bikb"]] remoteExec ["kbAddTopic", _prisonguard];
long glacier
#

ohh I was close 🙂

winter rose
#

it's basically [<leftArguments>, <rightArguments>] of the command itself

long glacier
#

rgr kind of makes sense now

winter rose
#

e.g```sqf
[unit, 1] remoteExec ["setDamage", unit];

long glacier
#

Yeah got ya

#

Cheers man I appreciate it and trying to help me get there on my own

winter rose
#

with pleasure!

I get less questions to answer if you understand how it works 😛

but also, you get to read and understand it and not provided with a plug & play "big code mess" so in the end, it's good

long glacier
#

Hopefully the mission tomorrow goes well

#

Is it ok if it does not work in SP now?

winter rose
#

hmm nope

long glacier
#

ohh rgr

winter rose
#

it should work in all situations, so there might be an issue here

long glacier
#

rgr I spotted something I will try again hopefully that was it

#

Ahh damm it is giving me errors on mission start line 3

winter rose
#

bring it on

long glacier
#
 [_prisonguard, ["prisonchat", "prison.bikb"]] remoteExec ["kbAddTopic", _prisonguard];

[_gateguard, ["gatechat", "gate.bikb"]] remoteExec ["kbAddTopic", _gateguard];```
winter rose
#

are the units defined there? _prisonguard, _gateguard?

long glacier
#

Not in the script no they are named in mission in the variable field

winter rose
#

then use the names: prisonguard, gateguard

#

no underscores

long glacier
#

ahh rgr I know this one because this means they are local to the script

winter rose
#

like it is in the unit name

exactly

long glacier
#

mega working now

winter rose
#

noice!

long glacier
#

Can't thank you enough mate 🙌

winter rose
#

hehe you're welcome!! enjoy your game, and don't hesitate to come back in case of trouble

long glacier
#

will do cheers

hollow lantern
#

can I limit the radar range of an MPQ-105? Google only provides me with a sensor config reference

winter rose
#

not by script afaik

cosmic wedge
#

Hello guys, I am new to making missions in Arma, although I love the game for many years. I kinda couldn't Google up anywhere if there is any possibility of making let's say one opfor and one bluefor unit guarding like a border line without shooting at eachother? Plus if I infiltrate the opfor side as an bluefor player and they see me, they try to take me down? I will be glad for any help, since I am trying to get my first coop mission working! :)

winter rose
cosmic wedge
#

But the thing is - how do I make them shoot at me if they see me on their side of border?

winter rose
#

you should make yourself enemy of both sides

#

either that, or make them part of the same group

#

so, either

  • west vs east, east vs resistance, west vs resistance and setCaptive
  • or west grouped to east (automatically friendly), enemy to resistance
#

@cosmic wedge before anything: what is the exact situation you are trying to depict?

cosmic wedge
#

Okay, I think you actually solved it for me. The thing is I am starting inside small hiden west outpost inside the east teritorry (that has been just detected and I need to escape), so I need the west to be friendly and east to be enemy. But on the border I need them to not shoot at eachother. But I think I will change it and make the starting point resistance, which will be friendly with west but not east, so east will shoot at them, but west will not shoot at me if I get to border.

winter rose
#

yes
you can also use setFriend (both ways!) between west and east

cosmic wedge
#

Thank you mate for your help! 🙂

tough abyss
#

anybody can make if some one mouse wheel and choose(name is vote) vote it pops out right side to everyone

#

anyone can make?

#

i need help

worn forge
#

Frown I don't think I understood your request, can you restate with more words?

plain current
#

I think he means if he clicks on a scroll wheel action it shows a hint to all players?

stoic crater
#

not sure if I'm supposed to ask in this thread, but my question is: Can I make editor previews from only my mod in some way, the BI wiki only gives factions as an example (and my Blufor is quite big)

astral dawn
#

You can script lots of stuff in 3den

verbal saddle
stoic crater
#

wow that was right infront of me the whole time xD Think I get it, thanks!

astral dawn
#

Different hardware runs SQF with different performance. Can we maybe make some basic script and measure how fast it runs on different CPUs? Does it make any sense and is it interesting for anyone?

#

Although, I think it might only make sense to test that at 2-3 CPUs, the rest can be interpolated by looking at some other CPU single-thread benchmark

winter rose
#

my Pentium III has issues running Arma 3 indeed

solemn token
#

The more single core Mhz the better (for Arma).
Intel runs much better than AMD
Not sure about the newer Ryzen CPUs. Any experiences???

astral dawn
#

It's not the proper thread

#

@solemn token

tranquil kindle
#

Anybody know how to enable zeus through the debug console?

still forum
#

yes

#

u have cba?

tranquil kindle
#

Yes

still forum
tranquil kindle
#

@still forum Do I copy the text or?

tranquil kindle
#

I cant figure how to get this to work

still forum
#

copy paste, local execute, done

tranquil kindle
#

Doesn't seem to work then. I paste but the I can't go into zeus.

#

I just need it so I can unstuck a vehicle.

still forum
#

dunno then, worked for me last time i used it

tough abyss
#

Hi
How i can lock just one door of a building in multiplayer environment?

winter rose
#

hi, what does google say about it?

#

Spoiler:```sqf
_theHouse setVariable ['BIS_Disabled_Door_1',1,true];

tough abyss
#

thanks snake can open it 😄 ? how i can get the door number i want to disable?

winter rose
#

try & cry 😋

unique sundial
winter rose
#

oooh nice 👌

#

since OFP:R iirc?

unique sundial
#

Can’t say, don’t have that info

winter rose
#

ok; I remember of that with the OFP:R campaign, would Viktor Troska narrate the font would be different

#
titles[] = {
  0, <t color="#ff0000">Red text</t>,
  1, <t color="#00ff00">Green text</t>
};```
I am amazed that it doesn't require another set of quotes around that
unique sundial
#

Because anything not a number is a string for config parser

winter rose
#

I expected a parsing error actually!

exotic tinsel
#

is there a way to tell if an object is a helicopter or a plane? im using is kindof but only "Air" seems to work.

exotic flax
exotic tinsel
#

ok ill try it again thx mate

dreamy kestrel
#

curious, I've got a function that goes something like this:

params ["_array", ["_many", []]];
{ _x params ["_i", "_value"]; _array set [_i, _value]; } forEach _many;
_array;

The idea is that I want to "set many" in one fell swoop. However, I am finding that the array elements are resulting in any, which I am sure is incorrect. Example:

_x = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
[_x, [0, "test"]] call LINQ_fn_set;

I half expect ["test",[4,5,6],[7,8,9]], however, it yields [any,[4,5,6],[7,8,9]]. Ideas?

#

Oh wait, I think I spotted it,

_x = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
[_x, [[0, "test"]]] call LINQ_fn_set;
runic quest
#

excuse me, I want to ask how to add a parameter to config.cpp in the module so that the vehicle can't be damaged after hitting any object? Thank you

tough abyss
#

anybody can make if i scroll the middle button and i click that it can move

#

i don't know how to move

#

pleaseee...

still forum
#

I think noone knows what you mean

tough abyss
#

Ok

#

may i give you picture DM?

still forum
#

no, but you could send a link to a picture here, for others to maybe help you with it

tough abyss
#

scroll

#

and click that

#

and

#

pop out like this

#

so i can't move like w a s d

#

click

#

but i want to move

ivory lake
#

instead of createDialog etc

jade abyss
#

☝️ 👍

tough abyss
#

mmm..

#

if some of player push PageUp button it events command #reassign and if PageDown just close Also it percentage 50%

#

some one can make script..?

#

help..

#

c++

cunning crown
#

Just make an array with all players that have voted for the restart. If the array is more than allPlayers / 2 then you got your 50%, don't forget to remove player that disconnected. Then use the serverCommand to restart.

unique sundial
#

c++
🤔

runic quest
#

Excuse me, I have placed some AI in the editor and run it at the beginning of the task. How can I set the corpses to be automatically removed after these AIs die? Thank you!

stoic crater
#

Ok so exporteditorpreviews, checked out the BI wiki for it, but can't for the life of me get it to work for my mod only. according to the wiki '0 = [nil,"all",[],["My_mod"], []] spawn BIS_fnc_exportEditorPreviews;' should work, but it keeps giving me a no classes found. Probably missing something here xD

exotic flax
#

what kind of objects are you trying to find?

stoic crater
#

Everything, Gear, vehicles and units

solemn token
#

@runic quest
Putting this into the init field for the Unit should work:

this addEventHandler ["killed", {deletevehicle (_this select 0)}];

Maybe you have to change this to _this. Not sure atm...

exotic flax
#

0 = [nil,"all",[],["My_mod"], []] spawn BIS_fnc_exportEditorPreviews;

This means:

  • duration = 1 (default)
  • type = all (so all objects in CfgVehicles)
  • sides = all
  • mods = "My_mod" (classname in CfgMods)
  • addons = all (can be removed then empty)

And each objects has:

  • scope = 2
  • side is set
  • CfgMods is set for mod where the object is set
  • used model is not in blacklist (dummyweapon.p3d, laserTgt.p3d, HelipadEmpty_F.p3d)
  • inherits from All
  • object is not inheriting from blacklist (WeaponHolder, LaserTarget, Bag_Base)
stoic crater
#

So it should work like that, but it's giving me a no classes found error

#

Not sure what you mean by '- CfgMods is set for mod where the object is set' is that the dir="my_mod"; ?

exotic flax
#

no, it's:

class CfgMods {
   class MY_MOD {  // <-- this name
      // variables
   };
};
stoic crater
#

ok, that's set up correctly

exotic flax
#

hmm... I'm trying to do the same and I get the same issue...

stoic crater
#

aah well, got it in the end by doing 0 = [nil,"all",[west]] spawn BIS_fnc_exportEditorPreviews; and just deleting all the screenshots that aren't my mod xD takes a while but got there in the end

queen junco
#

Hey, got a short question as well. I am trying to check if the Guards behaviour is set to combat, then wait 5 seconds and then check if the unit is still alive. Any ideas why it is not working?

alarmtr setTriggerStatements ["{behaviour Guard3 == 'COMBAT'; sleep 5; alive Guard3;}",
"handle_ = execVM 'alarm.sqf';", ""];

worn forge
#

A trigger is essentially a codified loop, you can't (and wouldn't want to) put a sleep statement in there

still forum
#

your trigger condition is never true

#

trigger waits for true,
you return a piece of code

#

handle_ = thats useless

worn forge
#

Just do :
"alive Guard3 && behaviour Guard3 == 'COMBAT'

queen junco
#

that would be missing the 5 second delay though :/

worn forge
#

Shouldn't use a trigger, then

still forum
#

just add sleep and alive check to the start of your alarm.sqf

queen junco
#

okay, thx will give it a try ^^

#

@still forum @worn forge works perfectly fine now, cheers ^^

worn forge
#

👍

ashen hawk
#

Hello, I am trying to make a trigger that activates when there are more than 3 civies in the area, how do i set it up?

winter rose
#

count thislist > 3 @ashen hawk

ashen hawk
#

@winter rose Thank you SO much! 🙂

winter rose
#

with pleasure 😎

ivory lake
#

if the first unit is setcaptive or civilian it will return EAST as hostile

#

it already mentions that in Side_Relations but man what a pain it was trying to work out what was causing this issue

winter rose
#

a note should be added, indeed!

#

at least a reminder to visit the page. bad Guba is enemy to everyone

hollow lantern
#

is there a way I can set a default value for a variable?
I have a script that runs several times and has two if statements. However if I place the _status = "free"; above the if statements the second if statement will not be executed because everytime the script runs, the _status variable will be reset

still forum
#

if (isNil "_status") then {_status = "free"}

hollow lantern
#

thanks!

drifting copper
#

~~I am using DayZ Medics UAV script

tv setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
cam = "camera" camCreate [0,0,0];
cam cameraEffect ["External", "Back", "uavrtt"];
cam attachTo [uav, [0,5,0], "PiP0_pos"]; 
cam camSetFov 1;
"uavrtt" setPiPEffect [0];
addMissionEventHandler ["Draw3D"], {
    _dir = 
        (uav selectionPosition "laserstart") 
            vectorFromTo 
        (uav selectionPosition "commanderview");
    cam setVectorDirAndUp [
        _dir, 
        _vUp = _vDir vectorCrossProduct _vSide;
    ];
};

But if you go into arsenal it breaks the display. I tried adding

[missionNamespace, "arsenalClosed", {
    isNil {
        cam cameraEffect ["TERMINATE", "BACK"];
        camDestroy cam;

        cam = "camera" camCreate [0,0,0];
        // etc.
        cam cameraEffect ["INTERNAL", "BACK", "uavrtt"];
    };
}] call BIS_fnc_addScriptedEventHandler;

to init.sqf but can not seem to get it to work. Latter is found of a reddit post. Can anyone please advise?~~

drifting copper
#

Found a solution ^

Simply added sleep 5; execVM "screen.sqf";

So it is now

tv setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
uav lockCameraTo [tgt, [0]];
cam = "camera" camCreate [0,0,0];
cam cameraEffect ["External", "Back", "uavrtt"];
cam attachTo [uav, [0,5,0], "PiP0_pos"]; 
cam camSetFov 1;
"uavrtt" setPiPEffect [0];
addMissionEventHandler ["Draw3D", {
    _dir = 
        (uav selectionPosition "laserstart") 
            vectorFromTo 
        (uav selectionPosition "commanderview");
    cam setVectorDirAndUp [
        _dir, 
        _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]
    ];
}];
sleep 5;
execVM "screen.sqf";
slate sapphire
#

Hello I need to know if AI is player controlled or server controlled in order to count it for some checks, is there a specific syntax to determine it?

winter rose
#

isPlayer @slate sapphire !

still forum
#

AI is never isPlayer

#

per definition a AI is not a player

slate sapphire
#

I think I have to use local

still forum
#

you can grab the ownerID, via owner

#

or check using local yeah

slate sapphire
#

if I run that on server should work

winter rose
#

I totally misunderstood the question, plz don't mind me

slate sapphire
#

good that I don't use Headless client, cos I guess also headless client on server script is not local

#

my question was if there was a specific command to check if ai is player controlled

still forum
#

what do you mean by "player controlled"

slate sapphire
#

the ai on player team the one you can give order f2 f3 f4 f5 etc.

still forum
#

isPlayer leader _yourAIUnit

#

if the group leader is a player, he controls the AIs

slate sapphire
#

ok that could work,

#

if I have 3 ai, on my group and I disconnect, isPlayer leader _myaiunit would return false right?

still forum
#

yeah

slate sapphire
#

cos the leader/ai will be back on server

#

perfect

still forum
#

cos the leader/ai will be back on server
no

#

The locality of the leader has nothing to do with that

#

He might aswell be on another player, or the headlessclient

slate sapphire
#

ok but it will return false

#

that's the important

jade abyss
#

Yep

slate sapphire
#

I need to determine if it's player controlling AI or not, cos when people disconnect with AI in town those ai are raising peace time in my warfare, so I want to remove that to save some annoying situation and count for peace time only ai that is player controlled

#

it count also the player itself right?

still forum
#

you mean if player is alone in a group?

#

then he is the leader of his own group. so yes

slate sapphire
#

and if he is not alone in group, example ai are on different place not with him in the town range

#

I think it will still return yes cos he is still the leader of his own group if I got the logic of the command

still forum
#

unless ofc he is just as player in a AI group, with a AI leading the group

slate sapphire
#

ok that's clear, but in my version all players are leaders of AI so it should work that way thanks

tough abyss
#

How do i call bis_fnc_arsenel_data. And access/change it in my mission

#

Errr i was gonna post a ss but no permission, basically its supposed to give me a list of whitelisted classnames according to a post on warlords forum awhile back by jezuro

#

If theres a way to blacklist instead that would be good to

tough abyss
#

Is it possible to use scripts to make a menu? if so, any pointers

#

like a clickable and interactable

ruby breach
unique sundial
#

Sure, createDisplay cutRsc ctrlCreate

#

createDialog even

ruby breach
#

There's also a GUI Editor you can use

dreamy kestrel
#

how does one handle such things as "critical sections", i.e. where we want to modify state that is being operated on by "manager" loops.

#

puzzling through that, I cannot reduce it to fewer than two Booleans involved, one to signal a pause, the other to acknowledge paused. or, minimum, a flag, 0, 1, 2, etc.

dreamy kestrel
#

would it be overkill to guard something like waitUntil { _semaphore == 0; };, then whichever are the critical operations, increment/decrement the sempahore signaling occupied or all clear?

astral dawn
#

Best way to achieve this... is to avoid scheduled code at all cost, otherwise you end up with asynchronous behaviour, lots of confustion, lack of debugging for such things, pain, suffering, etc......

#

But yes waitUntil can be used quite well for critical section

unique sundial
astral dawn
#

Good stuff! Where is spawnOrdered needed?

#

I mean, where do BI use it?

unique sundial
#

Was gonna use it for vehicle textures but perhaps engine solution would be better

dreamy kestrel
#

interesting, so with BIS_fnc_spawnOrdered , that potentially averts mutex code from stepping on its interrelated toes?

#

my only critique of the interface is that it takes a function name. does it allow CODE? that would be great.

astral dawn
#

so BIS_fnc_spawnOrdered works like a queue into which you push code to be executed in sequence?

#

I've just realized that, or might be wrong

dreamy kestrel
#

I think so, that's how i take it, with potential to isolate according to named mutex.

#

pushing args and a function name in the current name space.

astral dawn
#

but perhaps engine solution would be better
Multithreaded scripting language... 😢 😻

dreamy kestrel
#

if I understand it correctly, just pass in the array which is tracking the mutex, etc.

#

can even wrap in a delayed try lock.

#

Q: where does _SQF_VM get defined? is that built in to A3?

still forum
#

Q: where does _SQF_VM get defined? is that built in to A3?
nowhere, no it isn't

#

That's from SQF VM (The emulator)

dreamy kestrel
#

ah I see, looks like that is for internal testing then.

#

MUTEX_SCOPED_LOCK(mutex) is pretty sexy... Run some bit of code in the scope of a mutex. Sweet!

#

has great potential. I have a manager and need to inject change orders in. but I need to park the COs in queue until the manager is clear from whatever it wants to do.

paper laurel
#

Real quick question, so I am looking to rotate a object while using in game scripts or whatever. Under is the attachto line

x2 attachto [x1,[0,-1,-0.6]]

exotic flax
#

https://community.bistudio.com/wiki/attachTo has some comments about this.

  1. You can use setDir to rotate the object relative to the attached object (0 is front, 180 rear)
  2. You can use setVectorDirAndUp to set the orientation
paper laurel
#

Seperate lines?

exotic flax
#

yes

paper laurel
#

Many thanks, time to make my genocide meme machine

random tangle
#

Guys, is there a way of making a unit (in this case a hostage) getting in a enemy vehicle?

#

that hostage is already in an enemy truck and I'm having trouble even to get him out of it

dreamy kestrel
#

@random tangle not enough information. off the cuff, sounds like maybe the hostage is not actually in your group and/or aligned with your side? other than that, your campaign mode supports capturing vehicles?

random tangle
#

hmm

#

ok, I have a unit a hostage, he is in BLUEFOR. That unity is set captive and (ace) handcuffed in the back of an ural truck (OPFOR). That truck moves to an air port were I want that hostage to get in a plane.

#

I have it almost working except for the hostage

#

this is my current script. I execute that using a scripted waypoint

thorn saffron
#

I remember there was a way to check what addon is the last to make changes to a class. However I just cannot remember what that command was and I my google-fu fails me yet again.

hollow thistle
#

@thorn saffron

thorn saffron
#

Thanks

hollow lantern
#

@still forum thanks for your hint on isNil. Will this however reset my variable to nil once my script is run? My script is this:

/*
    author: @Aebian
    description: Airsupport script for my test mission.
    returns: nothing
    // [Vulture21CR, Vulture21, "KION", US_HeliPad01,"OnStatCampEast","US_PilotWait01", Engineer01, "US_EngineerWait01"] execVM "itsAebian\KI_AISUP.sqf";
    */

    params["_group", "_vehicle", "_cond", "_helipad", "_prepos","_waitpos", "_engineer", "_engpos"];

    (units _group) params ["_leader","_gunner"];


    _status = nil;

if (isNil "_status") then {_status = "free"};

 if (_cond isEqualTo "KION" && _status isEqualTo "free") then 

         { // On station thingy

         _status = "inAction";

         _leader assignAsDriver _vehicle;
         _gunner assignAsGunner _vehicle;

         sleep 2;
         [_leader, _gunner] orderGetIn true;

         sleep 10;
         _group move (getMarkerPos _prepos);


         sleep 240;
         _status = "missionCompleted";
         
         } 


    else 

     { // RTB

     if (_cond isEqualTo "KIOFF" && _status isEqualTo "missionCompleted") then 

         {
             _leader setBehaviour "SAFE";
             _gunner setBehaviour "SAFE";

             _leader landAt _helipad;
             _leader land "LAND";

             unassignVehicle _leader;
             unassignVehicle _gunner;

            _leader setCombatMode "BLUE";
            _leader setBehaviour "SAFE";

             _gunner setCombatMode "BLUE";
             _gunner setBehaviour "SAFE";

              _group move (getMarkerPos _waitpos);

             _status = "readyFix";

             _engineer move position _vehicle;

            _engineer action ["repairVehicle", _vehicle];

            sleep 250;

            _engineer move (getMarkerPos _engpos);


             sleep 40;
             _status = "free";

        }

}```
#

I defined the variable _status almost at the beginning

#

however It doesn't seem that I can leave out the assignment. Even when using private it wants a value

winter rose
#

give it one?

hollow lantern
#

when I set the variable it will override every time the script will be run

#

so nil is the only option

#

I'm not sure if this will affect the script aka if the variable will always be set to nil

winter rose
#

wait, what is it that you want? If you want a private variable, make it private, else, make a public one?

hollow lantern
#

no, what I want is a variable that is set only once to status free at the start of the script so that the first if gets executed. But then it will change so that the second if will be executed

winter rose
#

so a global variable

#

@hollow lantern ```sqf
if (isNil "AEBIAN_FIRSTRUNDONE") then {
AEBIAN_FIRSTRUNDONE = true;
// firstRun
} else {
// secondRun
};

flat sphinx
#

Hello. I have problem with createVehicle command executed by server, with classname O_Heli_Transport_04_bench_F. The helicopter behaves in a strange way, looks like problem with sync or simulation. Video for understanding: https://youtu.be/0c4jrDeYhiE. And if you will join as driver in helicopter before suspension goes in down position, then with a high probability there will be an explosion or a big jump. Any ideas how to fix it?

winter rose
#

try to set velocity down maybe, to "init" the physics

flat sphinx
#

I tried, it doesn't help

winter rose
#

what if you create it 0.5m altitude?

flat sphinx
#

same

winter rose
#

welp

random tangle
#

@winter rose hey, is it bad is I ask a question directly to you? haha, anyway, I'm trying to code a rescue hostage mission, just to understand the internals of arma scripting. It is a MP/SP mission (1 - 4 players) where you have to rescue a hostage before it gets in a plane and leaves. I'm having a issue with the hostage though, everything else is working quite well. My hostage is a bluefor civilian unit with setCaptive true and ACE handcuffs. I have used the extended 3den editor mod to place the hostage inside an opfor truck. The issue I'm having is that I cannot get the hostage out of the truck using commands, and I cannot order the hostage to get in the enemy plane too.

#

I have read the wiki on the commands list but I couldn't find any commands that work, I have tested a few (doGetIn, orderGetIn, commandGetOut, orderGetIn...). They only seem to work when the squad owns the vehicle

winter rose
#

moveOut, unassignVehicle ?

random tangle
#

oh, sorry I missed the notification

#

I haven't tried moveOut

#

unassignVehicle I don't know if it will work because the unit is not part of any squad that owns the vehicle

winter rose
#

moveOut should do the job - else use action "getOut"

hollow lantern
#

@winter rose well, Global Variable is fine, I added another param so I assign the variable via script execution. However the status will not be always nil at first. If the second run is completed it will stay on _status = "free" . What about that? My guess is that your code needs to look like this:

if (isNil _status or _status == "free") then {
  _status = "free";
  // firstRun
} else {
  // secondRun
};``` 
correct?
winter rose
#

I don't get it? is _status a provided parametre now?

hollow lantern
#

well the script will run several times for several vehicles. One global variable doesn't make sense, I need many global variables then

#

so I just assign them as param so that this issue is solved

jade abyss
#

hu?

#

wat?

winter rose
#

setVariable on the vehicle? e.g Aebian_init = true

#

that, or split your code in multiple scripts
or make a _mode param "init", "refresh", whatever

hollow lantern
#
    params["_group", "_vehicle", "_switch", "_helipad", "_prepos","_waitpos", "_engineer", "_engpos", "_status"];``` this are the params. This is how the script will be run:
```sqf
[Vulture21CR, Vulture21, "KION", US_HeliPad01,"OnStatCampEast","US_PilotWait01", Engineer01, "US_EngineerWait01", THEGLOBALVARIABLE] execVM "itsAebian\KI_AISUP.sqf";```
still forum
#

@hollow lantern isNil _status thats not how you use isNil

jade abyss
#

also, why do you check for _status

if (isNil _status or _status == "free") then {
  _status = "free";```
then set it again?
#

+this should also pop up an error, btw

still forum
#

in your code that you posted above

_status = nil;

if (isNil "_status") then {_status = "free"};

that makes no sense, why check isNil RIGHT AFTER you've set the variable to nil? You already know its gonna be nil, you just set it to that.

jade abyss
#
isNil "_var"```
hollow lantern
#

because the script will never run after status has been set as the variable is no longer is nil

jade abyss
#

global var

still forum
#

yeah your usage of a local variable that you intend to stay alive seems weird.
That only makes sense if its defined at a higher scope

hollow lantern
#

I just need the _status variable alive

still forum
#

which is a legit thing to do, but noone will expect that, and such a thing should always be explained with a comment on it so that the reader knows whats going on

hollow lantern
#

that's all

jade abyss
#

global var...

winter rose
#

seriously, either make [arguments, blah, "init"/"update"], or setVariable on the vehicle itself

jade abyss
#

Yeah, or what lou said.

winter rose
#

Lou* 👀

jade abyss
#

lOu

winter rose
#

DSCHA! *bless you*

jade abyss
#

*Gesundheit

winter rose
#

à vos souhaits

jade abyss
#

Englisch pls, not 🥖

winter rose
#

you will be going through so much pain

jade abyss
#

sry loU

winter rose
#

L.o.u = hello you

hollow lantern
#

well, global variable fixed the issue. Only had to add sqf if (isNil "_status") then { _status = "free"; }; at the beginning of my script

#

Thanks guys

jade abyss
#

You say global var, but show a local var, hu? I am confused

winter rose
#

it's in params @jade abyss

jade abyss
#

ah

dim kernel
#

is it possible to put text on billboards from a script

young current
#

No

ruby breach
#

If you have textures with the text you'd like; or you somehow mod the billboard to be a license plate, yes. Otherwise, no.

dim kernel
#

okay Thanks

exotic tinsel
#

i could use some help/direction on how to determine a position on the side of an object that is opposite from the side the player is standing on. if that doesn't make sense, i need to tell an AI to go to the opposite side of an object that the player is standing on. looking for functions or existing solutions i can view and adapt.

fleet hazel
#

Guys. I have a marker on the map, it has a variable. How do I get this variable on mouse hover?

winter rose
#

@exotic tinsel direction from unit to object +180
or direction from object to unit, of course
with getPos, distance and direction you can make something working!

#

@fleet hazel you can't set variables on markers

fleet hazel
#

@winter rose How to gain control of the marker?

winter rose
#

@fleet hazel you told me you had a variable on this marker…?

else all marker commands, getMarkerPos, etc

jade abyss
#

There are alot of commads for that (incl. examples)

winter rose
#

Well, what he said. Also, there might be a "Markers" command category, check it out

fleet hazel
#

@winter rose @jade abyss My goal. When you hover over the marker with the mouse cursor, a window will appear that describes what this marker is needed for.

jade abyss
#

"eachFrame" eventhandler, that checks for "getMousePosition", markerPos, mapToScreen (or however it was called)

#

+creates a ctrl ("window") with the text 🙂

#

Sounds easy, aye?

#

(not)

winter rose
#

I don't know if a function already exists for this though

fleet hazel
#

I'll try

drowsy axle
#
objectName =  name _this;
namestr = str objectName + "Has been spawned.";
hint namestr;``` Can you concatenate strings and variables in sqf?
#

Yes, it can. 🙂

exotic flax
drowsy axle
#

o.0 thank you.

exotic flax
#

which is more a array2string

drowsy axle
#

I've been coding in JS, for like two weeks, been a few months without any SQF 😢 so I'm a little rusty.

exotic flax
#

known problem when you program multiple languages

drowsy axle
#

Within my code: _this is the object, I assume is class name. To find the displayName I need to look into the cfgConfig. Specifically CfgVehicles so that script would look like: ```sqf
objectClassName = typeOf _this;
objectName = getText(configFile >> "CfgVehicles" >> objectClassName >> "displayName");
namestr = format ["%1 has been spawned.", objectName];
hint namestr;

#

Yup, getText() returns a string, awesome.

#

oops, I found an error. _this isn't the class name. 😢

cold mica
#

_this is a magic variable

drowsy axle
#

It's been defined, dw.

#

sorted.

#

my only issue, is spawning another vehicle, when something is in it's way.

exotic flax
#

I'm sure you use createVehicle, which automatically finds a suitable spot to spawn an item (unless "CAN_COLLIDE" is set).
You could use nearestObjects beforehand to check if there are objects within a range.

_object = "some_vehicle";
_marker = "some_marker";
_radius = 10;

if (count (nearestObjects [getMarkerPos _marker, ["Vehicle"], _radius]) > 0) exitWith { hint "Can't spawn object." };
createVehicle [_object, getMarkerPos _marker, [], 0, "NONE"];
#

PS. not tested, but should give an idea on how to do it 😉

drowsy axle
#

I don't know how the module it created. 🙂 not my creation.

#

Thanks for the help.

winter rose
#

btw, you don't need to str with format

plain current
#

Unless you want quotes around something, which obviously no one would want...

still forum
#

puts quotes around @plain current

plain current
#

Ah yes i do like some "quotes"

ruby breach
#

But do you "like" quotes, or do you like "quotes"?

plain current
#

"That is the real question" -Fini, 2019

sharp grotto
#

Possible to do removePrimaryWeaponItem in cargo inventory ?

still forum
#

afaik no

#

in general its not possible to "remove" something from cargo inventory.. atleast not directly without workarounds

#

workaround for this is to grab weaponItems, remove all weapons, then readd all weapons with attachments with that thing you wanted not being readded

sharp grotto
#

so another cfgpatch for these weapons and just remove linkeditems 🤔

still forum
#

why config changes?

#

you can just script it

sharp grotto
#

its a bit more complicated in my case, exile (persistence)

brave jungle
slate cypress
#

How do I create a laser on an object?

#

No AI or anything, just spawn a laser on a given object

copper raven
#
#define TEST 5
TEST;
'"';
TEST;

second TEST doesnt get resolved, '"' breaks preproc i suppose, do i not know something?

still forum
#

huh... it shouldn't break preproc, and never noticed it breaking on that

copper raven
#
#define TEST 5
TEST;
'""';
TEST;
'"';
TEST;

first and second are correctly resolved, 3rd one however, doesn't get resolved

winter rose
#

@slate cypress if you mean laserTarget, there is such an object that you can createVehicle (see Arma 3 classes on the wiki)

slate cypress
#

If I already have a vehicle in place?

#

How do I just add the laserTarget to it?

plain current
#

what was the kegeytegs tool for undoing .bin files? it was like unrap or derap or somethin but i can't find it cuz his websites gone down

#

i found it, it's "unrap"

still forum
#

Cfgconvert in arma3 tools.
Mikeros derap

hollow lantern
#

Hi, quick question: this is the params array sqf params["_group", "_vehicle", "_switch", "_helipad", "_prepos","_waitpos", "_engineer", "_engpos", "_status"];
The last part is a global variable I handover to the script. I have this at the beginning of the script:

if (isNil "_status") then {
 
  _status = "free";
  diag_log "Setting variable to free status";

};``` What I noticed is that if I run the script a second time with that same variable name passed to the params it will again get set to "free" or at least the log tells me that. If I check on the variable via debug console it returns nothing. Is that intended behaviour or what's wrong? 
As the script will be run for different vehicles I need a way to define the variable dynamically so I tried the method via params
exotic flax
#

_status from the params array is by default private, so no matter what you do, _status is a private variable inside that script.

#

So it depends on what you want to do; either set the status every time you call the script (in that case it should never hit the if (isNill "_status") statement).

#

Or don't use it as a parameter, and make it global through publicVariable

still forum
#

You are copying whatever value you had in your global variable, into _status.
Then you set _status to "free" and expect it to also magically update the global variable that the script never saw that it even exists...

hollow lantern
#

I have nothing in the global variable I thought by specifying it there as param and with the isNil stuff I would set it

still forum
#

You are setting the local _status variable

#

It doesn't know anything about a eventual global variable that might have been somewhere at some point in time

#

If you want to use a global variable, then you have to use the global variable and write down it's name right there and then

hollow lantern
#

I run the script like this: sqf [Vulture21CR, Vulture21, "KION", US_HeliPad01,"OnStatCampEast","US_PilotWait01", Engineer01, "US_EngineerWait01", KI_AIRSUP_VU21] execVM "itsAebian\KI_AISUP.sqf"; I expected that KI_AIRSUP_VU21 will be threated as global var

#

but I guess that's is wrong

still forum
#

_status = 1
Sets the variable "_status" to 1. That's exactly what the script tells the game to do.
Now you expect it to magically know about, and set "KI_AIRSUP_VU21" to 1. That clearly won't work.

#

I expected that KI_AIRSUP_VU21 will be threated as global var
It is, and it will be yes.

hollow lantern
#

huh? I thought _status is just the reference to the param "_status"

still forum
#

There is no "param" that's not how that works

#

Here I'll write you a analogy

#

You take a picture of a house (that's your global variable that you read out)
You print it out and send it to your parents in the mail (your execVM)
Your parents take it out of the envelope and make a copy of the picture using their photocopier (that's params)
Now they take a pen and draw a huge duck onto the copy of the picture.
Is there now a drawing of a duck on the house you photographed in the beginning?

hollow lantern
#

if you point it this way no. So param is a one way ticket but doesn't phone back?

still forum
#

All things in SQF are passed as reference yes, but it's a reference to the value that was stored in the variable, it's not a reference to the variable, the value has absolutely no idea where it came from

#

If you want to set a global variable, then you have to directly set it

#

MyGlobalVar = 5

hollow lantern
#

my expectation in my head was: _status param gets KI_AIRSUP_VU21 as value, so the isNil function sets KI_AIRSUP_VU21 = "free"

still forum
#

MyGlobalVar is the street address of the house, and you set the house at that address to 5.

#

_status param gets KI_AIRSUP_VU21 as value
No. KI_AIRSUP_VU21 is not a value, it's a variable name.
It's not a house, it's a street address.

#

_status gets the value that was inside that variable at that time.
It gets a photo of the house that was at that street address at that time

hollow lantern
#

you mean it takes the value from the var KI_AIRSUP_VU21 ?

exotic flax
#

yes

hollow lantern
#

wow

#

that is not how I expected it to work

still forum
#

Script commands can actually not see variable names, they are long gone before the command is actually executed.
That's why you have to pass a string to isNil and params

exotic flax
#

params simply creates a private variable with the name _status and the value is coming from the variable you placed in the call.

solemn token
#
if (isNil "Myglobalvar") then {
 
  Myglobalvar= "free";

};```
No need to use Params for a global car. Simply directly work with the global var in your subscript
hollow lantern
#

yeah but then I only have ONE global var

still forum
#

Pass the name of the global var

#

And use get/setVariable

hollow lantern
#

hmmm ok

solemn token
#

So you don’t want to let the subscript change the global var?

still forum
#

Var1 = 5
Var2 = 7
[Var1, Var2] call {params ["_var1"]}

What call actually gets is [5,7] and it puts that into _this
It doesn't know where these numbers come from.
Params grabs the first value in _this and puts it into _var1
_var1 is now 5.
But neither _var1 nor params nor _this nor call know anything about Var1 ever having existed

hollow lantern
#

@solemn token no, if the script will run again with another vehicle it shouldn't use the global var of the first vehicle

still forum
#

Why don't you just store your variable ONTO the vehicle? Like was recommended to you some 10 hours ago?

hollow lantern
#

because then I'm always tied to the vehicle, I don't want it. I just want a simple one-line (the execVM part) and that;s it. I guess I fiddle around wit get/setVariable

solemn token
#

Dedmen is 100% right.
Store the var on the vehicle then.
This would be the best / correct way!

still forum
#

But... Don't you right now just have one global variable per vehicle anyway?

hollow lantern
#

my point is, if I run the script like this sqf [Vulture21CR, Vulture21, "KION", US_HeliPad01,"OnStatCampEast","US_PilotWait01", Engineer01, "US_EngineerWait01", "KI_AIRSUP_VU21"] execVM "itsAebian\KI_AISUP.sqf"; given the fact that the last part is now the globalVar name and it will properly set, then I don't need to touch the vehicle in anyway. Or I just read you wrong and you mean I should within this script just tie a globalVar to _vehicle

still forum
#

I meant like
_vehicle setVariable ["status", "free"]

#

And to read the current value you can just
Vulture21 getVariable "status"

hollow lantern
#

I'll test this out, thanks for opening my eyes

solemn token
#

Another hint could be:

Params [“_status“];
_status = +_status;

Will make a stupid copy of the param _status and NOT affect the Original one / global var

still forum
#

Syntax error. Invalid quotes

#

Also not sure if unary + works on strings

hollow lantern
#

I find the get/setVariable much more sufficient. and it works right away thanks @still forum @solemn token @exotic flax

still forum
#

much more? The vehicle thing we talked about is get/setVariable too. Just as the missionNamespace stuff

slim oyster
#

I am reading from an array read from a config, but all booleans are being read as numbers, which i suspect is a parsing thing as I am using armake. What is the best practice to using a boolean in config arrays like this? Quote?

#
        if (_value == "true") then {
            _value = true;
        } else {
            _value = false;
        };
    };``` is this necessary?
cunning crown
#
_value = if (_value isEqualType "" && { _value isEqualTo "true" || _value isEqualTo "false" }) then (compile _value);

Something like that?

winter rose
#
private _booleanValue = _value != 0
tough abyss
#

guys how do I post like you guys post yours script?

#

should I use which symbol?

winter rose
#

```sqf
// your code
```

@tough abyss

tough abyss
#

ok

#

lemme do one quick test

#
"hi world"
#

OwO it works

#

ty very much

#
// KP_liberation_clear_cargo is in other script
// KP_liberation_clear_cargo is one cargo cleaner condition set on the parameters 

private _boatank = "LIB_LCM3_Armed";
private _boatruck = "LIB_LCM3_Armed";
private _truck = "LIB_US_GMC_Tent";
private _tank = "LIB_M8_Greyho";
private _area_check_Tank = missionNamespace getVariable ("boatank_");
private _area_check_Truck = missionNamespace getVariable ("boatruck_");
_inside_Truck = _boatruck inArea _area_check_Truck and _truck isVehicleCargo _boatruck;
_inside_Tank = _boatank inArea _area_check_Tank and _tank isVehicleCargo _boatank;

if (_inside_truck = false) then {
    createVehicle [_boatruck, (_area_check_Truck select 0), (_area_check_Truck select 1), (_area_check_Truck select 2)];
    createVehicle [_truck,(_area_check_Truck select 0), (_area_check_Truck select 1),( _area_check_Truck select 2)];
    _truck setDir (getDir _area_check_Truck);
    _truck setposATL (getposATL _area_check_Truck);
    _boatruck setDir (getDir _area_check_Truck);
    _boatruck setposATL (getposATL _area_check_Truck);
    _boatruck setVehicleCargo _truck;
    if(KP_liberation_clear_cargo) then {
        clearWeaponCargoGlobal _boatruck;
        clearMagazineCargoGlobal _boatruck;
        clearItemCargoGlobal _boatruck;
        clearBackpackCargoGlobal _boatruck;
        clearWeaponCargoGlobal _truck;
        clearMagazineCargoGlobal _truck;
        clearItemCargoGlobal _truck;
        clearBackpackCargoGlobal _truck;
    };
    sleep 0.5;
};
#

so I don't think the engine of the _truck wouldn't work.

#

I re-wrote the script with a few modifications

#

I tested and didn't work guess I still need modify this

winter rose
#

= is assigning

tough abyss
#

I just read the RPT

winter rose
#

if (something == false) wouldn't work
Use if (not something)

tough abyss
#

some variables aren't defined

winter rose
#

also, private your _inside vars

tough abyss
#

@winter rose ty I'll add this

#

ok

slim oyster
#

here's a long shot... I would like to use a grid system that calculates a rough terrain type (surface calcs, building counts, etc) and an ability to draw a line between two points for intersection/grid counting. eg. line between one area and another area results in 3 of terrain type A and 1 of terrain type B.

#

Now creating the grids and labelling as specific terrain types is intensive, and cannot be done ingame. Is there an effective way to make a grid calc in game, or am I looking at an extension to handle this in a separate thread?

#

I experimented with wrp parsing but I couldn't get the types of nObjects to work properly. If i calc this with the surface types command and export it for use in a calc thread do you think this would improve performance enough to let me use it in game?

winter rose
#

You may want to process it beforehand and export the data for the island in a sqf/txt file?

#

That, or startLoadingScreen/endLoadingScreen to only process data before playing

slim oyster
#

Sorry I am exporting this data, currently I am saving in config and reading from there in preInit. It is the searching of large arrays of grids that is too intensive. Comparing distances of X and Y elements in a large array is just not efficient.

#

CBA hashes are just matching/corresponding array sets correct? So it would help but only to a point in which an array becomes too large to filter right?

winter rose
#

I don't know I don't use CBA *preparing for incoming stones*

slim oyster
#

is there a best practice for storing large datasets? particularly I wish to store around 10 elements of data about particular grids, with each being 50-100m, so for large maps this is obviously a very intensive operation.

dim kernel
#

is it possible to show a vehicle model in a Dialog Menu?

tough abyss
#

why there's no vehicle in vehicle script tutorial on youtube?

#

that's annoying

#

OH I THINK I'VE FOUND IT

#

no I didn't

rough dagger
#

Hi all, I am working on a little heli mission that gets the pilot to ferry AI groups from a base to a random location (original, I know). The way I want it to work, I create a group, then create units and assign to that group. Then, I get said group to board my heli. There are some other checks that basically track the flight and kick the AI units on landing at the LZ. All fine so far. But I am trying to delete the group the AI are assigned to, and then re-use the same group name on the subsequent cycles of unit creation. The issue I find is that on first go, everything works fine, but as I return to base to pick up the second bunch, only one of the units boards, the others do not react. My guess is that I am messing up the bit where I delete the group and then reuse the group. Here is the code: https://www.pastiebin.com/5dfe21781846c

#

If anyone could take a look and advise, I would be most grateful.

#

Apologies in advance, my skills are pretty shoddy..

astral dawn
#

@slim oyster so why does plain multidimensional numeric array not suit you? Or you mean, how to store it in a file or whatever?

#

Even if it's 50 megabytes of RAM, who cares... and if it's 50 megabytes of ROM (per island), who cares as well, since you are distributing it as an addon through workshop

#

@rough dagger I would use one group for chopper crew, another one for all the soldiers being transported by the chopper

#

create group with delete when empty flag

rough dagger
#

Hiya Sparker, thanks

astral dawn
#

Probably there isn't much value in managing resources that attentively, if game can do it itself

#

Also Pizzadox I like that grid idea, it's awesome I believe

slim oyster
#

getting that data and storing it is no issue, the issue is being able to use it efficiently enough for what I want... to evaluate neighbour grids and their qualities, most likely hash returns in a variety of data types, as well as a X/Y overlap system for virtual lines (this is just using the X and Y coordinates of the grid data elements with a bit of math)

#

Not an issue if the array is small enough, big issue if the array is very large

astral dawn
#

I believe you have something like... 2-dimensional array of arrays of flags describing terrain properties?

slim oyster
#

yes

astral dawn
#

Then I assume your access to this is a bunch of selects... nothing can be faster than that in SQF, I don't really understand....

austere granite
#

why there's no vehicle in vehicle script tutorial on youtube?1
Because videos are a bad way of explainig text based things

tough abyss
#

@austere granite can you help me building one script or point me one script with create vehicle? and/or one with setVehicleCargo?

#

pls

austere granite
#

no

tough abyss
#

AWN

#

ok

#

That'll do me save time

#

T_T

#

even tough I'm here because I'm free so...

#

I'm already spending time 😉

patent estuary
tough abyss
#

That's what I'm doing!

#

I just want more

#

XD

still forum
#

@slim oyster

but all booleans are being read as numbers, which i suspect is a parsing thing as I am using armake.
nope... Booleeans in configs don't exist. So you cannot read bools from config.

        if (_value == "true") then {
            _value = true;
        } else {
            _value = false;
        };

->

_value = (_value == "true")

if (_value isEqualType "" && {_value == "true" || _value == "false"}) then {
->

if (_value in ["true","false"]) then {

CBA hashes are just matching/corresponding array sets correct? So it would help but only to a point in which an array becomes too large to filter right?
yes. But you could use a namespace.
Are you sure that is really the slow part? array selects are fast.

tough abyss
#

how to put a pre-placed trigger in the sqf script?

#

🤔

#

just like we place objects right?

#
//variable
private _i = 0;

//Vehicles
private _LCM3 = "LIB_LCM3_Armed";
private _M8_greyhound = "LIB_M8_Greyhound";
private _GMC_truck = "LIB_US_GMC_Tent"; 

//locations
private _in_area_tank = _LCM3 and _M8_greyhound inArea "checkAreaTank_0"; // Triggers
private _in_area_truck = _LCM3 and _GMC_truck inArea "checkAreaTruck_0"; // Triggers

//Set cargo functions
private _embark_M8_function = _LCM3 setVehicleCargo _M8_greyhound;
private _embark_truck_function = _LCM3 setVehicleCargo _GMC_truck;

// executing stuff 
if (_in_area_tank = true and _in_area_truck = true) then {
    setVariable [_i, 0, true];
} else {

};

if (condition) then {
    execVM _embark_truck_function;
    execVM _embark_M8_function; 
};
#

am I doing it right?

#

still WIP

still forum
#

setVariable [_i, 0, true]; whats that supposed to do?

tough abyss
#

reset the variable value

still forum
#

that's like.. wrong on all accounts.
left parameter missing, _i is not a string, the true at end is nonsense for a local variable

tough abyss
#

🤪 oof

still forum
#

if (_in_area_tank = true and _in_area_truck = true)
= assigns a variable
== compares a variable.
I assume you want to compare here.
But comparing a boolean to true is nonsense too.
true == true -> true
if you just remove the comparison
true -> true
same result

tough abyss
#

aaaaaaaaaaaaaa that make sense

still forum
#

//Set cargo functions
private _embark_M8_function = _LCM3 setVehicleCargo _M8_greyhound;
wtf is that? setVehicleCargo doesn't return a function?

slim oyster
#

engine AI path is asynchronous right? There is no on demand pathGenerate?

still forum
#

@slim oyster yes

tough abyss
#

ok

#

thx

still forum
#

also setVehicleCargo takes two objects (like the wiki tells you)
your variables there are strings though

tough abyss
#

thank you again

tough abyss
#

I think I'm going to do it by a trigger

#

it's way more easier

#

in game trigger lol

slim oyster
#

I think I am going about my terrain grid/node parsing all wrong. If i collect data from a certain cellsize using mostly surfacetype commands, stick them as well as the 2D data in a cba hash, what would be the best way of finding nearby/neighboring grids of a certain element type?

#

finding neighbouring grids on the XY system is fine, just a name change based on the grids coords, but comparing elements of those grids requires multiple hashgets of those coord names, then a comparing command.

#

Is there a library of some sort that has a A* algorithm with multiple params, not just the distances/flat cost?

#

maybe an extension call to a library that generates a few paths based on some passed params/cost modifiers.

#

prefer forested terrain, avoid cells near roads, etc

winter rose
#

in-game, there is a calculatePath stuff

slim oyster
#

yes with the EH return, but over long distances it seems to drop in quality of sampling, which makes sense of course

#

I assume there is a resampling over a certain distance or time, but with the EH we just get the one return

winter rose
#

you can use it multiple times for small parts yourself (not that risky)
or you can code your own path yes (or find one that exists)

slim oyster
#

I would love to see the sampling for terrain that the engine pathing does, like some short distance stealth path generation

#

short distance stealth gen can somehow detect very small clumps of trees and bushes, which makes me wonder how small the sample area for a surfacetype or even object search is

winter rose
#

this is possible in a debug build iirc

slim oyster
#

Wasn't it added to RC?

#

it was on dev for the longest time

winter rose
#

well, can't find.

drifting copper
#

So I am wanting to use

tv setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
cam = "camera" camCreate [0,0,0];
cam cameraEffect ["External", "Back", "uavrtt"];
cam attachTo [uav, [0,5,0], "PiP0_pos"]; 
cam camSetFov 1;
"uavrtt" setPiPEffect [0];
addMissionEventHandler ["Draw3D", {
    _dir = 
        (uav selectionPosition "laserstart") 
            vectorFromTo 
        (uav selectionPosition "commanderview");
    cam setVectorDirAndUp [
        _dir, 
        _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]
    ];
}];
sleep 5;
execVM "screen.sqf";

But it keeps on breaking Zeus camera? Locks Zeus to first person for some reason. Anyone maybe have an idea?

random tangle
#

Hey guys, how are you? I'm still having a lot of trouble trying to make a hostage interact with an enemy vehicle... It seems no vehicle commands work if the vehicle is from the other team. The unit can't get in the vehicle and can't get out if I force it in.

winter rose
#

they… can get out? get in, with commands (moveInCargo, moveInDriver, etc)

#

@random tangle

random tangle
#

If I place my hostage (a captive soldier) in the enemy truck I want him to be, he leaves the truck as soon as the mission starts. If I use ACE to handcuff him he never leaves the truck, not even with doMoveOut

#

Maybe I should just change his team and work with that...

#

I don't think what I want to do is possible without hacking arma a lot

winter rose
#

assignAsCargo/driver/gunner

#

I don't have experience with ACE though; can't tell

random tangle
#

@winter rose I don't think the problem is ACE. I have removed the handcuffs.

#

I just can't get a unity from a side to stay on a vehicle from another side. I think this is a limitation, dunno

winter rose
#

let me try 🙂

#

maybe disableAI would help

random tangle
#

assignAsCargo doesn't seem to work too

#

Yeah, maybe I'll have to disable the unit ai

winter rose
#

when in doubt, remove their brains - as a zumbie, you should know 😄

random tangle
#

haha

#

this is my current setup

#

oh

#

no images here

#

hmm

#

I'm using this assignAsCargo zm_truck; on the civilian

winter rose
#

ok, I'm on it, so:
you want a civilian to remain in a CSAT vehicle

random tangle
#

yes

#

I just found out that I'm able to use ace captives to do that.

#

By using ace handcuffs he stays in the vehicle, then I use ACE_captives_fnc_doUnloadCaptive to unload him

#

it works

#

there is a load method too

winter rose
#

well, no problem anymore then? 🙂

random tangle
#

yeah, I got it to work using ace captives

#

and the hostage even has a handcuff

#

haha

#

but yeah, it works!

#

Thanks man!

runic stratus
#

Hi, trying to make a script to sit and get out of a seat without using ACE cuz its broken on my pack

this addAction 
[ 
    "Get in Pilot's seat", 
    { 
        params ["_target", "_caller"]; 
        [_caller, "SIT_AT_TABLE", "NONE", arrow1] call BIS_fnc_ambientAnim;
        call exit_seat;
    }, 
    [], 
    1, false, true, "", 
    "true" 
];

exit_seat = {
    leave = _caller addAction 
    [ 
        "Leave seat", 
        { 
            params ["_target", "_caller"]; 
            _caller call BIS_fnc_ambientAnim__terminate;
            _caller removeAction leave;
        }, 
        [], 
        1, false, true, "", 
        "true" 
    ];    
}

this works apart from the leave seat action, it doesn't add the action unless i cancel the animation thru console?

exotic flax
#

change 1 line and add 1 line:

this addAction 
[ 
    "Get in Pilot's seat", 
    { 
        params ["_target", "_caller"]; 
        [_caller, "SIT_AT_TABLE", "NONE", arrow1] call BIS_fnc_ambientAnim;
        [_caller] call exit_seat;
    }, 
    [], 
    1, false, true, "", 
    "true" 
];

exit_seat = {
    params ["_caller"];
    leave = _caller addAction 
    [ 
        "Leave seat", 
        { 
            params ["_target", "_caller"]; 
            _caller call BIS_fnc_ambientAnim__terminate;
            _caller removeAction leave;
        }, 
        [], 
        1, false, true, "", 
        "true" 
    ];    
};

This should work

tough abyss
#

Does SetViewDistance go into description.ext?

violet gull
#

setViewDistance is code to be executed within a script or init box of an object/unit

#

You can code a lobby parameter to set the view distance though, which can be done in the description.ext

tough abyss
#

@violet gull figured it out through what you said, used a game logic ty

ivory lake
#

I'm having issues with CfgRemoteExec, missions seem to be overriding the mods config definitions basically breaking mod functions, is there a way to set it up so they can co-exist other than manually adding the mods functions to the missions description.ext?

jade abyss
#

missions seem to be overriding the mods config definitions basically breaking mod functions,
Yep.

#

a way to set it up so they can co-exist other than manually adding the mods functions to the missions description.ext?
and: afaik nope.

high marsh
#

another thing to note, setViewDistance has to be executed local to the client you want affected

ivory lake
#

wow what a fantastic system :/

#

copy paste time it is

jade abyss
#

Yeah :/

slow isle
#

can someone explain why this isn't working? It's giving me a generic error in the expression

WHILE {alive this} do {
this disableAI "ALL";
sleep 3;
this enableAI "ALL";
sleep 3;
};```
#

I basically am trying to make the Pretorian (turret) fire in 3 second intervals

astral dawn
#

What is 'zero' for dateToNumber?
When I do dateToNumber [date#0,1,1,0,0]; it returns 1.58549e-008

#

Although for [date#0,1,1,0,1] it returns 1.91844e-006, so should be 'zero enough' 😆

copper raven
#

@slow isle init boxes are unscheduled

slow isle
#

Does this mean it's impossible to do what im doing with WHILE {} DO {} ?

#

Like what does unscheduled mean?

astral dawn
#

Whole frame stops until your code is done

#

so... should not make the frame wait for too long
also can't use sleep or any kind of suspension

winter rose
#

@slow isle use spawn

slow isle
#

👍 ill try

astral dawn
#

spawning makes your code run 'in parallel' with the game, so you can suspend your script, sleep, do whatever you want

slow isle
#

oh okay

#

i understand now

#

makes sense

#

I dont understand this in the wiki page (1st given example):
_handle = [] spawn {player globalChat "Hello world!"};
What does _handle mean? and why is there an underscore?

#

it says it's an argument but how can that be an argument

#

can i just put "true" there?

astral dawn
#

_handle is so that you can terminate the script later (terminate command) or check if it has been finished running (scriptDone)

slow isle
#

if im not using the terminate command do i just remove it

astral dawn
#

yeah just do arguments spawn {...code...}

#

but then you won't be able to terminate it ever

#

...because you don't know its handle

#

well, unless you exit it in the code you ahve spawned

slow isle
#

okay in my case should i leave it there?

#

because im a bit confused, doesnt it terminate after it reads the script

#

oh also i want to make it loop so i should remove it?

copper raven
#

when your while loop breaks, the script will terminte itself, because there won't be anything else after to execute

astral dawn
#

well If you say that you do not intend to use scriptDone or terminate, then you don't need to store the handle, so you can ignore it

slow isle
#

okay spawn command worked i think

#

do i now put it in the while loop

#

because it's not looping

winter rose
#

nope, you wrap the while loop with the spawn

#
this allowDamage false;
this spawn { // creates a "parallel code"
  while {alive _this} do {
    _this disableAI "ALL";
    sleep 3;
    _this enableAI "ALL";
    sleep 3;
  };
};
// init will end immediately after spawning, but spawned code will still run
slow isle
#

OOOHHHH

#

okay

#

makes sense

#

im an idiot

#

thanks

winter rose
#

nope, you're learning ^^

better look like a fool for 5 minutes for asking,
than act a fool the rest of your life 😄

slow isle
#

😄

#

im kinda proud of myself because i wrote 1/6th of it myself

#

progress 😄

winter rose
#

well yeah 🙂

tender fossil
#

I'm confused

#

What's the command for skipping an element in forEach loop?

#

Like, if a condition is fulfilled, I want to skip the rest of the function and tell the execution to move to next element in array

#

Commands like breakOut etc seem to just exit the whole scope

still forum
#

What's the command for skipping an element in forEach loop?
doesn't exist (yet)

#

just wrap it in a if statement?

tender fossil
#

Ah, ok

winter rose
#

@still forum would you be on to something? 😋

still forum
#

mh?

#

its on my todo list

exotic flax
#

I believe endme would be a perfect name 🤣

winter rose
#

continue 👀

#

one could use a break too (not a breakTo/breakOut)

modest temple
#
_gun = ["rhs_weap_m4_carryhandle", "rhs_weap_ak103", "rhs_weap_hk416d10", "LOP_Weap_LeeEnfield_railed", "rhs_weap_pkm"] call BIS_fnc_selectRandom;
_this addWeaponCargoGlobal [_gun,5];

if ((_gun == "rhs_weap_m4_carryhandle") OR (_gun == "rhs_weap_hk416d10")) then
{
_this addMagazineCargoGlobal ["rhs_mag_30Rnd_556x45_m855_PMAG", 2 +random 9];
};
#

what is the issue with this?

#

it doesn't work

#

oh addWeaponCargo is for vehicles

#

what command should i use instead of it

#

addItemCargoGlobal?

tough abyss
#

@modest temple

#

🙂

modest temple
#

i want it for a box

#

not a guy

tough abyss
#

ok

modest temple
#

for random loot spawn

winter rose
#

addWeaponCargo would work for a box

tough abyss
#

I guess this one works better

modest temple
#
_gun = ["rhs_weap_m4_carryhandle", "rhs_weap_ak103", "rhs_weap_hk416d10", "LOP_Weap_LeeEnfield_railed", "rhs_weap_pkm"] call BIS_fnc_selectRandom; _this addItemCargoGlobal [_gun,5];  if ((_gun == "rhs_weap_m4_carryhandle") OR (_gun == "rhs_weap_hk416d10")) then { _this addItemCargoGlobal ["rhs_mag_30Rnd_556x45_m855_PMAG", 2 +random 9]; };
#

so this?

winter rose
#

line returns!!

modest temple
#

?

#

it does not work

#

still

tough abyss
#

"box addItemCargoGlobal [item, count]"

#

exemple from BIS site

supplyBox addItemCargoGlobal ["optic_ARCO2", 10];
modest temple
#

_this addItemCargoGlobal [_gun, 5];

#

is that not correct?

tough abyss
#

I guess it should be the variable name of the box

modest temple
#

hmm

#

but thats _this

#

oh

#

its just this

#

not the _

#

it works

tough abyss
#

you did it?

modest temple
#

yes

tough abyss
#

nice

modest temple
#

kinda

#

not 100%

tough abyss
#

well, it's one beggining

modest temple
#

yes

tough abyss
#

I'm building up one small template for vehicle respawn module, and one trigger that checks if the two vehicles are inside, and if true, the setVehicleCargo is active at the two vehicles after respawning, and this is set to repeat.

init.sqf

[] call compile preprocessFileLineNumbers "functions.sqf";

functions.sqf

fnc_setVehicleName = {

    params ["_veh", "_name"];
    missionNamespace setVariable [_name, _veh, true];
    [_veh, _name] remoteExecCall ["setVehicleVarName", 0, _name];
};

vehicle respawn module expresion field:

if ( isServer ) then {
    
    params[ "_newVeh", "_oldVeh" ];

    _name = vehicleVarName _oldVeh;
    _newVeh setVehicleVarName _name;
    missionNamespace setVariable [ _name, _newVeh, true ];
};

bargetruck is LCM3 (transport ship)
truck is GMC truck

trigger condition field:

bargetruck inArea checkAreaTruck;
truck inArea checkAreaTruck;

trigger activation field:

bargetruck setVehicleCargo truck;

and I'm getting one error but the mission works fine:

///RPT FILE///

Error in expression <ehicleVarName _name; missionNamespace setVariable [ _name, _newVehicle, true ]>
12:31:52 Error position: <setVariable [ _name, _newVehicle, true ]>
12:31:52 Error Reserved variable in expression

////PLS HELP///

winter rose
#

_name cannot be any game command

#

if you try e.g player = 3 it will say nope the same

tough abyss
#

I took one example

#

from one site

winter rose
#

ask that one site, idk

tough abyss
#

maybe the _name should be the name of the vehicle

#

🤔

#

nvm

#

It's working now

winter rose
#

by which magic?

tough abyss
#

I copy pasted the old script

winter rose
#

¯_(ツ)_/¯

tough abyss
#

vehicle respawn module expession field:

if (isServer) then {

params [["_newVeh", objNull], ["_oldVeh", objNull],"_vehName"];

_vehName = vehicleVarName _newVeh;

[_newVeh, _vehName] call fnc_setVehicleName;

};
#

It was that old script @winter rose

#

on this site

modest temple
#

player SetPos getMarkerPos "selectRandom [spawn_1,spawn_2,spawn_3,spawn_4,];"; I cant use this correctly

#

how are you supposed to write it

dreamy kestrel
#

Q: say we have a definition,

#define WAIT_UNTIL_CONDITION(cond) waitUntil {cond}

Then we want to expand it,

WAIT_UNTIL_CONDITION(a && b && c);

I am assuming this would expand as waitUntil {a && b && c} ?
Thanks...

winter rose
#

@modest temple

player setPos getMarkerPos selectRandom ["spawn_1","spawn_2","spawn_3", "spawn_4"];
brave jungle
tough abyss
#

is it possible to make all classnames of a specific vehicle spawned non rearmable? asking because im trying to add thermonuclear weapons and want them to be one shot only

winter rose
#

@tough abyss you could remove any rearm truck?

tough abyss
#

@winter rose that would be despised by 90% of players on warlords

winter rose
#

Hehehe :p

tough abyss
#

👀 still on my grand quest of finding out how to do that AND blacklist arsenel assets, which is proving more difficult than i thought it would

dreamy kestrel
#

Q: re addPublicVariableEventHandler, does not seem to be working. testing a MP mission on a local hosted instance. the only thing I can figure is that perhaps the event is "seen" as being sent/received by the same machine, which it is, and effectively getting dropped. how do we overcome this?

tough abyss
#

Hi,
i'm trying to prevent to put items into a specific container with putItem EH but don't work.

if (typeOf _container isEqualTo "Box_Wps_F") exitWith {false};
worthy willow
#

Do you want the container to be opened?

#

If you don't use InventoryOpened eventhandler

tough abyss
#

The container have to be openable for pick up items.

dreamy kestrel
#

Well this makes some amount of sense, I suppose. Since I am self hosting / debugging the MP mission, it is both isServer=true as well as isDedicated=false. So, as I wondered, publicVariable in fact does nothing. Or it tries, but I am not connected as a true client in the client sense of the word.

winter rose
#

yep, always have in mind that a server is not always dedicated

dreamy kestrel
#

Does addPublicVariableEventHandler support more than one callback?

still forum
#

it says add not set right? so yes, it just adds a additional handler

cold mica
#

I'm currently experimenting with a script to practice SQF. One thing I do not understand is that when I call the script, it is called four times since systemChat str count _this shows the value 4. Any idea why _this has 4 elements when called?

still forum
#

it is called four times
what?

#

_this contains the arguments that you passed

#

or the _this variable from the parent scope

#

it has nothing to do with how often its called

unreal scroll
#

I have some complex functions which called with remoteexec(call), like [_veh,OT_fnc_engine] remoteExecCall ["call",2]; As I understand, it means it has to be executed only on a server. But clientowner command returns 2 for my player (host in local MP). Does it mean that the code will be executed on my PC too, {and how to avoid it}?

cold mica
#

Ok, that makes _this more understandable. Is there a way to tell where the four arguments are coming from?

plain current
#

@unreal scroll if you're the server (in local mp you are the server) then executing on the server executes on you. Use -2 if you wanna execute on all clients, but not on the server. To fix this issue use a dedicated server.

unreal scroll
#

In Overthrow mod on dedicated server I have a "general" player, which gets a serious perfomance hit comparing to other players. I assume some code is executed on it too.

plain current
#

Also, please don't do this: [_veh,OT_fnc_engine] remoteExecCall ["call",2]; making call available for clients is basically suicide, you are letting all clients execute any code on the server.
Do something like this instead: [_veh] remoteExecCall ["OT_fnc_engine",2];

#

If the mod is running on a dedicated server then there shouldn't be anyone with owner id of 2, it should only be the server. In MP hosted from the game client itself, the host prolly has client id of 2, meaning calls to the server would be executed on the host client.

tough abyss
#

Hi
Anyone know how if it's possible to transfer ground items to a container?

winter rose
#

you would detect "groundWeaponHolder" with a nearObjects command, and get their content by e.g getItemCargo @tough abyss

plain current
#

You could get the existing items from the weapon holder with weaponCargo and itemCargo and then add them to the new container with addWeaponCargo and addItemCargo

#

also check the global versions of those commands for MP

tough abyss
#

Thanks for ur help

winter rose
#

@plain current ninja'd

plain current
#

The itemCargo wiki page doesn't mention weapons, that's why i put weaponCargo separately, but addItemCargo page says it supports weapons too, so i'd assume itemCargo would return weapons as well?

winter rose
#

getWeaponCargo would get them yes

#

well, weaponCargo too

#

when did all these commands appear? 🙀

plain current
#

I edited it, typed it wrong ^^ itemCargo might return weapons too

winter rose
#

@smoky verge so basically an infinite tunnel for ~100m?

smoky verge
#

within viewlenght techincally,

winter rose
#

"view" would be server-side then

#

(if it is multiplayer)

smoky verge
#

singleplayer

winter rose
#

purrfect

#

get your train oriented to North (0° angle), I'll get ya sumthin'

smoky verge
modest temple
#

civilian setFriend [west, 0];

#

why does this not work?

winter rose
#

What does it do, and what do you expect it to do?

#

This should make civilians afraid of west. If you want west to attack civilians, do it the other way around @modest temple

brave jungle
winter rose
brave jungle
#

That's for the scenario

#

Not entity

winter rose
#

yep, realised that too late -__-

brave jungle
#

But even tho

exotic flax
brave jungle
#

The list by BI doesn't have everything

#

Zeus modules for example

#

you can set them up

#

I have looked into the cfgs

#

tried a variety of options and nothing seems to work

#

@exotic flax I'll have a look

winter rose
brave jungle
#

But it doesn't do anything

#

the cfgs lead to an object name, "all" as a string and forced a number bool

#

Unless i'm wrong

brave jungle
#

I reckon it's predefined and ignores cfgs

winter rose
winter rose
#

no problem, close enough ^^

languid tundra
#

Is there a way to change the magazine reload time without modifying the config? I'm only aware of setWeaponReloadingTime, which is however for the ammo reloading time.

modest temple
#

@winter rose if you do it the otherway around its clitchy

#

West just points guns at civs but dont actualy shoot

#

i want civs to be hostile so i can have players be able to pick up any uniforms in my survival sandbox

modest temple
#

it does't work with those

#

west just gets afraid of civs but doesn't actualy shoot

copper raven
#

had this issue too @languid tundra, except that i wanted to get rid off reload time completely, it works. However, i don't think there's a command to do what you want though.

winter rose
modest temple
#

that also has an issue

#

that doesn't allow grouping

restive leaf
#

Second option specifically does

modest temple
#

both do

#

if you are renegade it breaks groups

#

also doing pardon in ACE would break it

winter rose
#

these are the only options you have in this game afaik

modest temple
#

are there other ways to group than the normal group? like in scripting?

restive leaf
#

Why not just mod the uniforms to achieve what you want?

modest temple
#

i have never packed addons and im trying to see if i can script around it

restive leaf
#

Always a first time to send you on the path to the Dark Side

languid tundra
#

@copper raven Actually, I also wanted to get rid of it for a possible VLS module. The long reload time makes it really unresponsive to users.

copper raven
#

The only solution i found is, removing magazines and the weapon from a certain vehicle, then, adding magazines back, then the weapon. This gets rid off reload time for those magazines.

languid tundra
#

Hmm, I'll give it a try. ArmA was always about hacky solutions, especially when working with AI 😅

copper raven
#

I had to do this, because tigris normally has 2mags of 4x titan aa, so if i wanted it to have 1 mag only without the hacky stuff above, the gunner would have to wait a pretty long time, before he could shoot.

languid tundra
#

@copper raven Thx, it works nicely. Noticed that it is essential to add back the magazine before the weapon to get it working.

copper raven
#

yea, adding the magazine after the weapon, kicks in the reload time again, np.

winter rose
#

@smoky verge on it 😉

smoky verge
#

you're probably doing more than me

still forum
#

@plain current

itemCargo might return weapons too
Items (first aid kit, map, watch) are weapons.

uncut sphinx
#

does anyone know of a script that replaces CUP Chernarus houses with their Enoch counterparts? I know there are addons that do this but I would like to integrate it into a mission

exotic flax
#

I'm sure it's possible to script it, but it will kill the server and clients due to how heavy it is.
The mod simply replaces the configs and won't impact at all

uncut sphinx
#

ah

#

at the mission level it's probably best to do through 3den then?

craggy bluff
winter rose
#

use allowDamage combined with lifeState @craggy bluff

dreamy kestrel
#

Q: what do SQF functions return when they return "nothing"? is that nil?

spice axle
#

yes

still forum
#

depends on what kind of "Nothing" you mean

#

can you show me a example of a SQF function that returns nothing? Besides a completely empty function, these do indeed return nil

exotic flax
#
_result = call { hint "hey there" };

_result should now be "Nothing", but valid

#

although I can't think of a reason to check if a result in this case should be checked for anything

still forum
#

what do SQF functions return when they return "nothing"?
that function you posted doesn't return nothing though, it returns what the hint command returns, which in this case is nil

#

thats my point, what is considered "nothing"
if "nothing" means a script that isn't intended to return anything special, then you can't say what it returns, depends on whatever command it executed last

#

if you mean a script that returns literally nothing, aka nil, which we usually call "nothing" then.. yes it returns that

restive leaf
#

objNull 😉 ?

still forum
#

unless a script ends with a = assignment, in which case it literally doesn't return anything and assigning the result will error

velvet merlin
#

still bit confused with use of enableRadio, enableSentences and setSpeaker

enableRadio is basically for cutscenes and PvP only if you want to disable radio messages completely (protocol and convos) - text and voice (radio or direct/3d) - does not affect player chat (text or VON) (done via enableChannel or disableChannels in desc.ext - somewhat bugged tho)
enableSentences is for SP/COOP if you want to keep kbTell convos (wont mute all automated radio call outs though - bug?)
_unit setSpeaker "NoVoice" is if want to disable radio protocol (text and voice) - most reliable way one
custom mute mods if you only want to disable the audio/voice part of radio protocol

for MP you need to execute setSpeaker with delay and on all entities (players and AI) on all machines
{_x setSpeaker "NoVoice"} forEach allUnits;
[player,'NoVoice'] remoteExec ['setSpeaker',0,(format ['disableSpeaker_%1',profileName])];
and needs to be reapplied on respawn:
player addEventHandler ['Respawn',{[player,'NoVoice'] remoteExec ['setSpeaker',0,(format ['disableSpeaker_%1',profileName])];}];

tough abyss
#

hey guys i was just wondering if there was a script that would prohibit certain AI from firing at certain things

#

i'm making this Jakku battle in the game with the star wars opposition mod and the BLUFOR soldiers keep trying to shoot at the enemy turrets in the sky instead of the enemy on the ground infront of them

#

any scripts that would make this possible?

#

thanks in advance

velvet merlin
#

constant forgetTarget. but probably requires config mod

unique sundial
#

disableAI "RADIOPROTOCOL"? @velvet merlin

velvet merlin
#

@unique sundial thanks! so thats basically same as _units setSpeaker "NoVoice"?

unique sundial
#

No

#

"RADIOPROTOCOL" - Stops AI from talking and texting while still being able to issue orders Available since Arma 3 v1.95

velvet merlin
#

isnt this the same?!?

winter rose
#

same "outside" effect I suppose

unique sundial
#

i guess no as NoVoice allows AI to output text messages

#

This command was added because there were some inconsistencies/problems with doing it with available commands

winter rose
#

noVoice + enableSentences maybe

velvet merlin
#

@unique sundial allow in what sense? NoVoice uses RadioProtocolBase which has only empty classes and assignments. so not just the voice files removed like the said mods do

#

that aside i easily believe existing solutions had some loopholes, so the disableAI is a good addition. would be just good to exactly understand the differences - hence my testing and summary in here.

unique sundial
#

I dont remember exactly, maybe AI was still reacting to getting hit with hardcoded interaction, or something to do with orders the text might have appeared. I don't remeber and TBH I don't want to remember, whatever was the problem, you can avoid it by using new command., end of.

velvet merlin
#

ok thanks. will do some testing and update the BIKI

craggy bluff
#

nato vehicles sochor (weapon mine remove)

What is the way?

winter rose
#

drive on them (really 😄 )

#

AP mines only, of course

craggy bluff
#

@winter rose I didn't understand.

I want to remove the mines from the sochor equipment.

winter rose
#

it has mines in the inventory? clearItemCargo or clearMagazineCargo then

craggy bluff
#

@winter rose That is not what I want.

Missile Type: Mines sochor

winter rose
#

removeMagazine?

craggy bluff
#

yes

#

scorcher equipment

Missile Products: Can't remove mines?

winter rose
#

removeMagazine

craggy bluff
#

yes thank you

twin steppe
#

Hey guys. Just wanted to ask if anybody had a simple snow fall script that you can use in the debug console?

still forum
#

Yep I do. But no access rn.
I think google for "simple snow script" and check the A2 BIF thread for it, in the last post in the thread there should be a improved A3 version

#

Nah can't find it... Maybe I'm mixing that up with he breathing fog script

#

@orchid timber has the snowfall.sqf tho. Maybe he has some free time to waste to grab it

worn forge
#

The only thing I don't like about these environmental ambiance scripts (dust, snow, etc) is that people complain about how it impacts on their performance, and doesn't affect enemy AI in any way...

still forum
#

If you use the good scripts you don't feel the perf impact. But AI yeah. But my snow script also causes dense fog, which does impact the ai

worn forge
#

That's a good point, though Bohemia's implementation of fog... if you don't finesse the settings, you get the weird banding

unique sundial
#

Particle effects should be local to player, and if AI runs on the server, it won’t know

worn forge
#

Well exactly, unless you use fog to create a blanket visibility restriction as well

velvet merlin
#

as smoke is blocking AI vision, you should be able to do so too

#

however more meaningful is to use camoCoef

tough abyss
#

How to make a make a specific crate spawn specific items every 5 mins want to have special purpose gear inside but not alot at once so everyone just dosnt have the ability to take one immediately

winter rose
#

do you want to… restrict its access?

tough abyss
#

In a sense yes

#

Basically its a warlords mission cant figure out how to restrict normal arsenel so i removed it and put down two virtual arsenels in both teams bases

#

Im going to have 2 sectors that spawn a box with special purpose gear and ghillie suits and it gets one of each every 5 mins

tough abyss
#

nvm i got it the script i made formyself was fine, i was overthinking the error i made and thought my script had 0 logic behind it when all i missed was an ; :C

winter rose
#

-showscripterrors flag! :U

twin steppe
#

Yeah I just wanted some snowfall. The snowstorm is a little bit too much.

fleet hazel
#

@still forum

Guy. Help. How to change player name in TFAR channel. In what file can this be changed

winter rose
#

@fleet hazel quit tagging people please, the channel is for answering scripting questions

fleet hazel
#

ok.

#

Help. How to change player name in TFAR channel. In what file can this be changed

winter rose
tough abyss
#

How to prevent a whole classname from being able to rearm. Putting a script inside the innit wont work because warlords will spawn a new one without the innit. So im thinking i may need to use the classname and disable rearming in a new .sqf but not sure how to

spice axle
#

just use CBA_fnc_addClassEventHandler

#

["CAManBase", "Init", {systemChat str _this}] call CBA_fnc_addClassEventHandler;

tough abyss
#

okay ill try it thanks

still forum
#

That's a scripting issue. But not with that attitude.

tough abyss
#

i feel like im not understanding something extremely obvious 🤪

tough abyss
#

Is it bad to call spawn inside of a spawn?

#

Like how would that work with the scheduler?

ornate prairie
#

I'm creating an op for the Star Wars mod, and i'm trying to have a spaceship "warp" into the map
i think the best method to do it would be to use setVelocityTransformation, but i cant wrap my head around how it works
I need to unhide it, and have it move fast in a straight line and slow down to 0 which should be simple enough?

tiny wadi
#

Is there a similar functionality to continue in c# for sqf? I could wrap my entire code in an if statement but it'd be cleaner to write my condition and then skip that iteration in the for loop

copper raven
#

@tough abyss it pushes a new script onto the queue the same way. How bad it is, depends how clogged your scheduler is, and what the code does. The only reason you would want to do that is, if you wanted to run something in parallel to the current scheduled script.

@tiny wadi nope, is going to be added i think tho, was somewhere mentioned in this channel. wrapping into an if is the way to go atm.

tiny wadi
#

rgr thanks

tiny wadi
#

Would it be possible to emulate a min-heap in SQF?

real osprey
#

looking for a way to reset damage done via ACE Advanced medical

#

I cant seem to find the correct function to call

winter rose
#

@ornate prairie no Star Wars mod talk / mention here, as these mods are illegal.

astral dawn
#

Would it be possible to emulate a min-heap in SQF?

What?

copper raven
queen cargo
#

@tiny wadi same way as it is done in non sqf Environment

tiny wadi
#

yeah after going to bed I realize that was a dumb question lol, thanks though. Sort wouldn't work for me because i need to do it based on a cost function for each element in my array. its not based on indecies

#

Although I guess I could move my cost variable to the first element of the array and then use sort

copper raven
#
sharp_fnc_orderBy = {
    params [["_array", [], [[]]], ["_order", false, [false]], ["_selectorFnc", {_x}, [{}]]];

    private _mapped = _array apply {[call _selectorFnc, _x]};

    _mapped sort _order;

    _mapped apply {_x select 1} 
};

//Example
private _array = [[1, 2, 3], [4, 5, 6], [1, 2, 3]];

[_array, true, {_x select 1}] call sharp_fnc_orderBy // [[1,2,3],[1,2,3],[4,5,6]]
tiny wadi
#

Oh perfect

#

Thank you @copper raven

unreal scroll
#

Have some problems with dedicated server. I want local garrison soldiers to launch flares on specific condition. I use the following code: ```private _me = player;
private _visibility = 1500;
private _men = (_me nearEntities ["Man", _visibility]) select {side _x isEqualTo west && {(_x distance _me < _visibility) or ((_x distance _me < (_visibility * 3 / 2)) && random 100 > 80)}};

private _leaders = ([_men,[_me],{_x distance _input0},"ASCEND",{handgunWeapon _x isEqualTo "LIB_FLARE_PISTOL" && {_x ammo "LIB_FLARE_PISTOL" > 0}}] call BIS_fnc_SortBy);
if (count _leaders > 0) then {
private _leader = (_leaders select 0);
_leader selectWeapon "LIB_Flare_Pistol";
private _dir = _leader getdir _me;
private _target = "Land_ClutterCutter_small_F" createVehicle (getPos _leader);
private _coord = [(getpos _leader select 0) + (50 * sin _dir), (getpos _leader select 1) + (50 * cos _dir), 150 + random 50];
_leader disableAI "MOVE";
_target setPos _coord;
_leader doWatch _target;
_leader doTarget _target;
[{
params ["_leader","_target"];
[_leader, "LIB_Flare_Pistol"] remoteExecCall ["fire",0];
_leader enableAI "MOVE";
_leader doWatch objNull;
deleteVehicle _target;
}, [_leader,_target], 8] call CBA_fnc_waitAndExecute;
}; It runs perfectly in local games, but when playing at dedicated server, the unit doesn't look up at the created target, and launches a flare straight before it. I can guess that one of the command doesn't work correctly in MP, but I've tried[_leader, "PATH"] remoteExecCall ["disableAI",0];
[_leader, _target] remoteExecCall ["doWatch",0];
[_leader, _target] remoteExecCall ["doTarget",0];``` with no luck.

unique sundial
#

Tried BIS_fnc_fire?

unreal scroll
#

Not yet, will try.

unique sundial
tough abyss
#

How to add a .sqf file that changes the ammo of all vehicles of a classname?

copper raven
tough abyss
#

@copper raven im not too understanding of scripting i read that link and im still not understanding completely what its saying. Can i pm you my issue

mortal nacelle
#

could you use displayctrl in array, so that you can select a button declared by displayctrl and add an event handler so if the button you selected was correct it would hint "correct" for example, or does that not make sense?

#

or do you have to do it individually