#arma3_scripting

1 messages Β· Page 689 of 1

warm hedge
#

attachTo

ripe sapphire
#

cant coz i want to keep its rotors spinning

winter rose
#

kill the pilot

ripe sapphire
ripe sapphire
winter rose
#

disableAI all

#

or land
or heli setDammmmage 1

ripe sapphire
winter rose
ripe sapphire
ripe sapphire
#

well this disableAI all

warm hedge
#

attachTo with a Logic. Should do

winter rose
#

foreach crew this

ripe sapphire
#

i did it to both pilto and copilot

#

no woky

winter rose
#

"all", not all

ripe sapphire
#

i even tried disabling simulation to pilot but the chopper still flies away o.0

ripe sapphire
ripe sapphire
warm hedge
#

You want to stay a chopper in the position right?

#

And never move

ripe sapphire
#

yes mate for land vehicles you can easily just disableAI path or move the driver and they not move

#

but aircraft seems to have different AI system

warm hedge
#

attachTo with a Logic. Should do
dis

ripe sapphire
#

thanks pol

warm hedge
#

That's what I've done for screenshot purpose :)

ripe sapphire
#

ok it works but it kinda does the split second rotation thing lol

#

the moment it attaches

#

like it rotates 180 degrees when the code kicks in and then goes back to normal

#

any way to fix?

winter rose
#

weird, as disableAI works for me.

still forum
#

Hi confused, I'm ded

ripe sapphire
# winter rose weird, as `disableAI` works for me.

ok it seems like the reason it took off even though AI features were disabled was because i put a transport unload waypoint to disembark the troops inside, when i removed this waypoint, the chopper stayed where the unitplay ended

#

looks like i'll just have to manually script the disembark

winter rose
#

I still think something else is wrong :\

ripe sapphire
#

ok nvm the chopper actually took off again even though without the waypoint :/

ripe sapphire
winter rose
ripe sapphire
#

ok let me zip it

winter rose
#

no

#

type it in this channel, bit by bit πŸ˜„

ripe sapphire
hasty lark
#

Hey, I have been trying to add the M2 Flamethrower (from the Burn Em mod ) to the RHS M1A2 Abrams TUSK II under control of the gunner using scripts, specifically the addWeaponTurret script. But no matter what I try, i cant seem to get it to work. To be fair I am brand new to scripting, as in this is my first attempt.Can anyone help me?

pulsar bluff
#

I've done it, saying its not easy. that functionality is not built into Arsenal, so you have to create scripts to plug/hack into Arsenal

#

because you also have to monitor the players gear to ensure that they are only carrying whitelisted equipment

#

here's an example script

#

so if you do your own script for it, you first have to read thru and understand the vanilla arsenal function

#

@still forum can we get initFunctions.sqf optimized pls?

#

its still executing this, every time a player connects

#

[[[player,didJIP],"initPlayerServer.sqf"],"bis_fnc_execvm",false,false] call bis_fnc_mp;

#

i want a description.ext option to ignore that line

#

initplayerserver = 0;

#
    [] execvm "initServer.sqf";
    "initServer.sqf" call bis_fnc_logFormat;
};

//--- Run mission scripts
if !(isDedicated) then {
    [player,didJIP] execvm "initPlayerLocal.sqf";
    [[[player,didJIP],"initPlayerServer.sqf"],"bis_fnc_execvm",false,false] call bis_fnc_mp;
    "initPlayerLocal.sqf" call bis_fnc_logFormat;
    "initPlayerServer.sqf" call bis_fnc_logFormat;
};```
still forum
cosmic lichen
#

Kinda funny that someone added didJIP but did not replace BIS_fnc_MP with remoteExec πŸ˜„

winter rose
#

isJIP

#

coffee time! πŸ˜„

cosmic lichen
#

What are you talking about πŸ˜›

fleet geyser
#

Anyone able to help me out with this one.

_this, if allPlayers > 12 setVehicleLock "UNLOCKED" then [this, ["GreenHornets"]] call vn_mf_fnc_lock_vehicle_to_teams;

So what I'm trying to do is - keep the vehicle locked - until the player count reaches 12, and if it is 12 or above run the regular mf_fnc_lock_vehicle_to_teams check.

warm hedge
#

Where to start to point it out, actually? πŸ€”

pulsar bluff
#

@still forum i want a description.ext config option to not have that network call each time a client connects

warm hedge
#

I don't know which article/guide you read to write that script, forget about it

pulsar bluff
#

if i dont use initPlayerServer then i dont want bis_fnc_mp or remoteExec, also ugly to see bis_fnc_mp in official bis functions/scripts πŸ˜„

#

@cosmic lichen IIRC didJIP pre-dated remoteExec

winter rose
fleet geyser
fleet geyser
#

Looking into the link Henry provided now - what I posted was me just shooting from the hip - and seeing what sticks. Now I got some semblance of guidance at least.

vagrant parrot
#

Anyone used the Art of War diorama display to rotate objects before?

vagrant parrot
#

wondering how other people did it

still forum
#

afaik its just drag&drop in 3den?

vagrant parrot
#

how you connect the two tho

ripe sapphire
#

attachTo?

fair drum
#

@winter rose looking through the spotrep for the june, 9 2021 update, it says that HashMap apply, values commands were added. Is that a single command HashMap apply? because when you click the links on the spot reps, it takes you to the hash map and apply individual pages which we've already had for quite a while.

Reference: https://dev.arma3.com/post/spotrep-00099

winter rose
#

"Hashmap's apply and values" would be more correcterest

fair drum
winter rose
#

correct 😊

still forum
#

Is that a single command HashMap apply?
a single command cannot have whitespace in it

winter rose
#

yeah I was confused at first

#

but then I was dad again

fair drum
#

yeah it was just my monkey brain going, wait, we already have apply, why was this listed? was there a typo and there shouldn't be whitespace? but just me being a potato

still forum
#

Its apply for hashmap that was added

wind hedge
winter rose
#

yes but still overhead so baaaaaad 🐐

wind hedge
#

Please devs just replace bis_fnc_MP with remoteExec

winter rose
#

no, for backward compatibility - the 20yo curse of RV
well I thought you asked to remove it

wind hedge
winter rose
#

yep
but most likely not going to happen still 😁

wind hedge
#

keep it for user made scripts that don't want to update

wind hedge
winter rose
#

"Ctrl+H, easy!" 😁

wind hedge
#

πŸ˜…

winter rose
#

for only a little gain

it's better to profile & identify big perf hogs, as Ded' did with lights πŸ˜‰

wind hedge
winter rose
#

d'you have perf samples in those tickets? πŸ™‚

#

as in "zOMG look, 10 actions = -10 FPS!"

#

actually, and speaking seriously here, as a community we (well, am I still part of the community now) must provide repro cases to devs so they don't have to hunt and try to get the problematic situation

the community, if it want and can, now should:

  • dig the perf leak scenarios
  • once found confirm that someone might work on it
  • if so provide straight example repro missions

so devs only have to use that plug & play situation in order to:

  • repro the issue
  • test their fix
#

that's the fastest way to better A3 perfs aside from dev-side profiling πŸ™‚

fierce solar
#

How to disable dropping inventory items?

frosty cairn
#

Like it deletes the item when its dropped on the ground?

#

Also, btw, is there a object variable that can be used when its been spawned by a script (like _x, this, or player, stuff like that)?

fierce solar
#

Well I want them to keep the item

#

would it be easier to just disable the inventory option completely?

frosty cairn
#

no no

#

you can just do this

fierce solar
#

im new so

winter rose
#

hi new, I'm dad!

fierce solar
#

omg πŸ˜…

winter rose
#

actually…

#

!quote 0

lyric schoonerBOT
fierce solar
#

lol

frosty cairn
fierce solar
#

kk

frosty cairn
#

do you want them to still pickup stuff?

fierce solar
#

nope

frosty cairn
#

player addEventHandler ["Put", {
params ["_unit", "_container", "_item"];
_container removeItem _item;
_unit addItem _item;
}];

#

I think it SHOULD work.

#

Not 100% sure.

winter rose
#

free magazine refill

fierce solar
#

for initServer.sqf?

winter rose
#

init.sqf

fierce solar
#

oh that would make more sense

#

idk why I thought that

frosty cairn
#

@fierce solar try reloading, does it allow you to reload

fierce solar
#

Yeah

#

I can drop stuff aswll

frosty cairn
#

Still?

fierce solar
#

one second

frosty cairn
#

Or, well, at least, does it remove and then add the Item back into your inventory?

fierce solar
#

it says its missing a ;

frosty cairn
#

oh

#

hold one

#

player addEventHandler ["Put", {
params ["_unit", "_container", "_item"];
_container removeItem _item;
_unit addItem _item;
}];

#

There.

winter rose
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
frosty cairn
#
player addEventHandler ["Put", {
    params ["_unit", "_container", "_item"];
_container removeItem _item;
_unit addItem _item;
}];
#

Oh, cool.

winter rose
#

IKR??

frosty cairn
#

Never figured out how to do that πŸ˜…

#

I knew it existed.

frosty cairn
#

does it delete it and put it back into your bag.

fierce solar
#

nope

#

it doesent delete it

#

but it does go in my bag

frosty cairn
#

hmm

#

did you put on the ground or a box?

fierce solar
#

ground

#

dont worry about a box

#

I just dont want any stuff on the ground

frosty cairn
#

hmm, i guess the ground doesn't count as a "container"

winter rose
#

it should, as it creates an empty container

#

try debugging with systemChats maybe?

frosty cairn
#

Hmm, I'll give it a try.

#

Ah, I see the issue.

#

removeItem is looking for an object, and the ground probably doesn't constitute as an object

winter rose
#

it is πŸ˜…

#

systemChat typeOf _container πŸ˜‰

frosty cairn
#
player addEventHandler ["Put", {
    params ["_unit", "_container", "_item"];
clearItemCargoGlobal _container;
clearWeaponCargoGlobal _container;
_unit addItem _item;
}];
#

@fierce solar found a fix

#

ah, wait

#

I mean, so long as they don't drop their main rifle, it should be fine.

fierce solar
#

the guns are fine

#

we just worry about uniform mainly

frosty cairn
#

ah, then you should be good.

#

i think.

fierce solar
#

Alright let me try

winter rose
#

you may addUniform then

frosty cairn
#

yeah

#

next issue is how to check if the item is a uniform

#

i mean

#

i guess

#

if they have the same uniform, he could just put the same classname

#

but that seems lazy

winter rose
frosty cairn
#

yeah

#

how did that go

#

if (_item....

fierce solar
#

it works great, but is there a way to add the same uniform back to wearing it?

winter rose
#

if isClass (configFile >> "CfgSomething" >> _itemClass)

fierce solar
#

or vest/glasses/helmet etc

tidal ferry
#

Question

#

Is there any way to get mission filename from within mission?

winter rose
#

Answer

tidal ferry
#

:P

winter rose
#

may I ask "what for"?

tidal ferry
#

Man, you're quick to the draw

#

Basically working on a way for players to be able to switch through our mission on our server without having to be an admin

#

(Or use vote admin)

winter rose
young current
#

at she said

tidal ferry
#

I also want to see if I can save variables specific to a certain mission

winter rose
#

missionNameSource

tidal ferry
#

Ah sweet, thanks!

tidal ferry
#

How do I get the animation completion of an animation triggered in playMove/playMoveNow/switchMove?

#

E.g. waitUntil {_animationcompleted}

#

Where _animationCompleted is a boolean that is true when the current playMove is finished

tidal ferry
#

Oh yeah, right, forgot

#

But yeah sure

brazen lagoon
#

is there an eventhandler for doing something on mine clearing?

idle jungle
#

Hey scripting question

I wanna use a sideChat script in a mp environment

Can I use it in a trigger that's set to server and in the on act box

unit1 sideChat "bla...";

#

Ah no gotta use remoteExec

past wagon
#

if I am adding an action to an object from initServer.sqf, and I want all players to be able to use it, would I use remoteExec?

#

and would that be:

//Default
SpecSign addAction ["Spectate Match", "spectate.sqf", nil, 6, true, true, "", "true", 5, false, "", ""];

//remoteExec
[SpecSign, ["Spectate Match", "spectate.sqf", nil, 6, true, true, "", "true", 5, false, "", ""]] remoteExec ["addAction"];
#

but I suppose there's no reason to put it in initServer.sqf instead of init.sqf, so im just gonna do that instead

copper raven
#

initPlayerLocal would be the most correct

past wagon
#

ok

past wagon
#

ohhhh

#

would the actions only be available to those who were present when the mission starts?

digital torrent
#

hello, anyone know of a script for Firing from Vehicle (FFV) for a PO Orca? If such a script dont exist, what command would be making it possible?

modest nova
#

does exitwith stop execution of the script?

dreamy kestrel
#

Q: do you have to doStop all units you create? or just the grp leaders?

copper raven
warm hedge
#

It is possible to terminate the script too, though

past wagon
# modest nova does exitwith stop execution of the script?

it will exit the current scope that the script is in, so if it is inside an if statement, it leaves the if statement. if it is inside a while loop, it leaves the loop. if it isnt inside any {}, then it stops the script. It will then execute whatever code you put....

exitWith {HERE};
modest nova
#

so i have an if statement that I want to exit the current script that I have the if statement in, how would I do that, im guessing if (condition) exitWith {hint "string"}; wont do that?

copper raven
modest nova
#

thank you

drifting portal
#

how do I get rid of the UI of the camera module?

#
cameraEffectEnableHUD false;
showHUD false;

don't seem to have effect on it

warm hedge
#

Cant see pic

drifting portal
warm hedge
#

Array method of showHUD. Worth a try

drifting portal
drifting portal
sonic hill
#

I am trying to script the BPz 2A0 from Global Mobilization to function like the Bobcat where it will rearm, refuel, and repair, everything from tanks, to towed artillery, to helicopters, and jets. I tried a few scripts I found online but none of them are working.

modest nova
#

hey so i have a dialog that opens another dialog, what i want to do is close them both from a script that is run when a button on the second dialog is pressed, how would i go about doing that?

past wagon
#

if I replace a unit's uniform, backpack, or vest, will it clear everything currently in the inventory of that clothing item, or will the game do its best to fit everything previously in the inventory into the new one?

cosmic lichen
#

Replace how?

past wagon
#

uhh

#

that would replace the uniform, correct?

cosmic lichen
#

Well that's easy to test

past wagon
warm hedge
#

Yes

past wagon
#

ok

#

so its never going to try to fit that item into the unit's uniform or backpack?

#

just wanna make sure, since its pretty important for what im doing

warm hedge
#

wdym by fit item into uniform or backpack?

past wagon
#

if my unit is carrying a Mk-I and then I use addWeapon to give him a PDW, will it try to put that PDW into the unit's backpack if there is enough space?

warm hedge
#

Well, correction a bit: addWeapon actually adds, not replaces

past wagon
#

oh yeah

#

i forgot that im also using removeWeapon

warm hedge
#

But to the weapon space (rifle, pistol, launcher) not the item space

past wagon
#

yeah

#

i am removing the unit's current weapon THEN adding the new weapon

#

shoulda mentioned that

#

but yeah i think it'll work

warm hedge
#

I think addItem is to add a weapon to the inventory

past wagon
#

ok

#

makes sense

#

thanks

past wagon
#
_caller = _this select 1;
if ( roleDescription _caller == "Player 1" ) then { _loadoutBot = blueLoadoutBot1 };
if ( roleDescription _caller == "Player 2" ) then { _loadoutBot = blueLoadoutBot2 };
if ( roleDescription _caller == "Player 3" ) then { _loadoutBot = blueLoadoutBot3 };
if ( roleDescription _caller == "Player 4" ) then { _loadoutBot = blueLoadoutBot4 };
if ( roleDescription _caller == "Player 5" ) then { _loadoutBot = redLoadoutBot1 };
if ( roleDescription _caller == "Player 6" ) then { _loadoutBot = redLoadoutBot2 };
if ( roleDescription _caller == "Player 7" ) then { _loadoutBot = redLoadoutBot3 };
if ( roleDescription _caller == "Player 8" ) then { _loadoutBot = redLoadoutBot4 };
_opticsArray = primaryWeaponItems _loadoutBot;
#

does anyone know why I am getting Undefined Variable: _loadoutBot on line 11 (bottom line)? will those variables not be initialized if they are inside an if statement?
I am playing with unit whose role description is definitely Player 1

copper raven
#

it's because _loadoutBot is undefined in that particular scope

#

also use a hashmap instead of that if stuff

past wagon
#

ok thats what i thought

#

ive never used a hashmap before. what exactly is a hashmap? i will look for it on the wiki

warm hedge
#

HashMap is a β€œhey what is the data of the key: joe?” β€œIt's biden, sir” type of operator

past wagon
#

ok

still forum
#

hashmap is a map.
it maps keys to values efficiently.

"What value is associated with key X"

#

its very fast at looking up keys

past wagon
#

is it super complicated compared to what I was doing?

warm hedge
#

In this case it would be like: sqf _map = createHashMapFromArray [ ["joe","biden"], ["suga","yoshihide"], ["angela","merkel"] ]; _map get "joe"; //returns "biden" _map get "angela"; //returns "merkel"

winter rose
#
_map get "emmanuel"; // returns "slapon"
still forum
#

_caller = _this select 1;
_map = createHashMapFromArray [
  ["Player 1", blueLoadoutBot1],
  ["Player 2", blueLoadoutBot2],
  ["Player 3", blueLoadoutBot3],
  ["Player 4", blueLoadoutBot4],
  ["Player 5", redLoadoutBot1],
  ["Player 6", redLoadoutBot2],
  ["Player 7", redLoadoutBot3],
  ["Player 8", redLoadoutBot4],
];

// lookup which value is associated with the key being the roleDescription, return objNull if none found
_loadoutBot = _map getOrDefault [roleDescription _caller, objNull];

_opticsArray = primaryWeaponItems _loadoutBot;

But in your case the hashmap is constant, recreating it everytime your script is called is inefficient. But you could store it in a global variable

past wagon
#

ok thanks guys

#

i will read up on the wiki about it as well

#

gotta head out for the night now

hallow mortar
#

Is there any way to list what memory points a vehicle has, for use with attachTo? In searching I've found a couple of lists of commonly-used mempoint names, but the ones I thought were the ones I wanted don't seem to be located where you would expect on the vehicle in question.

#

*I just found the one I was looking for in this case, but it would still be cool to know if there's a way to generate a list for a given vehicle

austere granite
quaint ivy
#

Hey, I have a weird issue with animations and scripting. My script somehow manages to break the player's stance animation, causing them to bend over and being stuck like that until death. Anyone have a clue on what could be causing it, or how to prevent it.?

for "_i" from 1 to _sets do 
{
    player playMove "AmovPercMstpSnonWnonDnon_exercisePushup";
    sleep 15;
};

It doesn't break it always so I don't know how to replicate the issue every time

exotic tinsel
#

@quaint ivy you have to clear the move after its done. so switchmove ""; should reset them back to normal.

quaint ivy
#

@exotic tinsel they return to normal. My problem is that sometimes the normal animation gets broken

#

and switchMove doesnt help in that scenario

#

I need to get a screenshot of the actual issue

exotic tinsel
#

when it happened in the past did you try switchmove ""; ? That always resets the players animations for me for all animation bugs. A picture would help.

quaint ivy
#

Yup, i tried to fix it like that. Its the regular animation that's broken. I just got the bug replicated so im taking screenshots right now

#

In the pictures, I am not using free look. In the 2nd picture you can even see that I'm walking forward while the character's torso is pointing down and to the side.

#

I think I know what causes it. I think giving movement inputs while the animation is playing is causing the normal stance to break

terse topaz
#

do anyone has a script that I can play a video (w/ sound) in a in-game monitor?

past wagon
#

Im using a hashmap now, but im still getting undefined variable on the bottom line for _loadoutBot. Did I do it wrong? Do I need to use getOrDefault?

_caller = _this select 1;
_personalLoadoutBots = createHashmapFromArray [
["Player 1", BlueLoadoutBot1],
["Player 2", BlueLoadoutBot2],
["Player 3", BlueLoadoutBot3],
["Player 4", BlueLoadoutBot4],
["Player 5", RedLoadoutBot1],
["Player 6", RedLoadoutBot2],
["Player 7", RedLoadoutBot3],
["Player 8", RedLoadoutBot4]
];
_loadoutBot = _personalLoadoutBots get roleDescription _caller;
_opticsArray = primaryWeaponItems _loadoutBot;
#

uh oh

still forum
#

Thats not the script I sent you as example

past wagon
#

Leopard20 did the meowsweats emoji

still forum
#

my example used getOrDefault for a reason ^^

little raptor
past wagon
#

ok

still forum
#

it's looking for [roleDescription _caller]
which is wrong, you don't have any arrays in your hashmap

past wagon
#

yikes

#

i definitely need some arrays in my hashmap

little raptor
past wagon
#

dont I?

#

ok

still forum
past wagon
#

oh

still forum
#

You want to lookup by roleDescription, what do you need arrays for?
if you want to look up the roleDescription you just need them

past wagon
#

so I store roleDescription _caller to a variable first?

still forum
#

no

#

you look up by the roleDescription

little raptor
#

@past wagon in other words:

_loadoutBot = _personalLoadoutBots get roleDescription _caller;

but the problem is, if it's not in the hashmap the var won't be defined
so use getOrDefault like Dedmen said:

_loadoutBot = _personalLoadoutBots getOrDefault [roleDescription _caller, _defaultLoadout];
still forum
#

not by an array containing one roleDescription

past wagon
#

oh

#

so just get rid of the []

#

yeah but the way the game and scripts are set up it would be pointless to have a default

#

there are only 8 players in the game, each has a personal loadout bot

#

its complicated but i have no need for a default

little raptor
past wagon
#

because if it was ever the case that there was someone in my mission without one of those role descriptions, I would want to know

#

yeah i know

#

but for what im doing im pretty sure this is the easiest way

winter rose
#

or grab the loadout from config

little raptor
#

if you use the default loadouts, do what Lou said

past wagon
#

yeah but I need to be able to change different elements of the loadout, and having a bot that the player get's their loadout set to is the most effective

#

yeah but this isnt a normal mission

#

because when a match starts, the players get TP'ed to the AO and their loadouts get set to whatever they chose in the lobby (which gets stored to the loadout bots)

past wagon
#
// GET SCOPE NAME
_scopeNamesMap = createHashmapFromArray [
    [["optic_Arco_blk_F"], "ARCO Scope"],
    [["optic_Hamr"], "RCO Scope"],
    [["optic_ERCO_blk_F"], "ERCO Scope"],
    [["optic_MRCO"], "MRCO Scope"]
];
_scopeName = _scopeNamesMap get primaryWeaponItems _loadoutBot;

// MESSAGE
["Your Current Loadout: " + _weaponName + _scopeName] remoteExec ["hint", _caller, false];

How is _scopeName undefined on the bottom line?

still forum
#

Key not found in your map

past wagon
#

and _loadoutBot only has a scope on his gun

winter rose
#

wrong way to do it anyway

still forum
#

did you try to just add logging to see whats going on?

winter rose
#

arrays as keys…

still forum
past wagon
#

if I use primaryWeaponItems and there is only one item, wouldnt it return an array?

past wagon
#

then what did I do wrong in the hashmap? can hashmaps not take arrays?

winter rose
still forum
#

so what?

#

why does that matter?

winter rose
#

so it works with isEqualTo, not by ref?

still forum
still forum
#

Array keys are copied on insertion anyway so that you cannot have any references to them

past wagon
#

what is logging?

#

oh

still forum
past wagon
#

you want me to log what I get from the hashmap or from primaryWeaponItems _loadoutBot?

still forum
#

everything

#

log everything

#

and see if it actually is what you expect it to be

past wagon
#

kk

#

oooooooo

#

that makes sense

#

["", "", "" ,""]

#

so this is what I want

// GET SCOPE NAME
_scopeNamesMap = createHashmapFromArray [
    [["","","optic_Arco_blk_F",""], "ARCO Scope"],
    [["","","optic_Hamr",""], "RCO Scope"],
    [["","","optic_ERCO_blk_F",""], "ERCO Scope"],
    [["","","optic_MRCO",""], "MRCO Scope"]
];
_scopeName = _scopeNamesMap get primaryWeaponItems _loadoutBot;

// MESSAGE
["Your Current Loadout: " + _weaponName + _scopeName] remoteExec ["hint", _caller, false];
novel delta
#

If someone wouldnt mind helping me, Im trying to make a hint popup when you enter an area and that seems to work however

#

i've noticed it triggers the deactivation if you get into a vehicle while still in the area

#

this is the current trigger

#

condition

 player in thislist```

On activation
```sqf
hint "You are now entering a restricted zone.";```

On Deactivation
```sqf
hint "You are now leaving a restricted zone.";```
winter rose
novel delta
#

thanks

willow hound
#

Look at this man shamelessly wasting our vertical space krtecek

winter rose
#

W

H

O

?

πŸ‘€

#

now stahp making me break rules for the lulz kthxbai

past wagon
#

how can I use setVectorDir to change an object's pitch and roll?

little raptor
still forum
#

setVectorDirAndUp

past wagon
#

thanks

#

what is a vehicle's default up vector? [0,0,0]?

winter rose
#

[0,0,1]

past wagon
#

ok

winter rose
#

its top faces the sky πŸ˜„

fervent kettle
#

does someone know a good alternative for isTouchingGround, to check an objects height?

still forum
#

getPosATL

#

position with height above terrain

#

or getPosASL for height above sealevel

fervent kettle
#

so for example

if ((getPosASL _objectOne) select 1<2) then{
  code;
}
still forum
#

select 2

#

not select 1

fervent kettle
#

ah yea

#

but detecting the object is correct?

still forum
#

I guess.
I don't know where your _objectOne comes from, but if your object is in there thats correct

little raptor
fervent kettle
fervent kettle
#

Okay, more brackets?

#

oh ya, woops πŸ˜…

little raptor
little raptor
fervent kettle
#

what's the difference between those 2 versions?

little raptor
fervent kettle
#

Oh, okay

#

So it's not dropping an error, but also probably not detecting the correct height. Landed on a flat airport tho

past wagon
#

is there a good way to clear the chat for a player?

fervent kettle
#
// declare variable
_parachute = "B_Parachute_02_F";

//creates the chest
_createChest = "B_supplyCrate_F" createVehicle [0,0,0];
_createChest setPosATL (getPos player vectorAdd [10,0,120]);

//creates and attaches the parachute
_resupplyPos = getpos _createChest;
_parachuteCreate = createVehicle [_parachute, _resupplyPos, [], 0, "NONE"];
_createChest attachTo [_parachuteCreate, [0, 0, 1]];

//removes the parachute when the crate touches the ground and adds a marker to the chests position
// currently not working due to dedicated server problems
if (ASLtoAGL getPosASL _createChest select 50<50) then {
    hint "if worked";
    detach _parachute;
    _markerChest = createMarker ["Nachschubskiste", position _createChest, 1];
}:```
that's the whole code, no loop
little raptor
#

it just runs once

#

so it never sees the object reaching the ground

fervent kettle
#

ah okay

little raptor
#

@fervent kettle in other words:

// declare variable
_parachute = "B_Parachute_02_F";

//creates the chest
_createChest = "B_supplyCrate_F" createVehicle [0,0,0];
_createChest setPosATL (getPos player vectorAdd [10,0,120]);

//creates and attaches the parachute
_resupplyPos = getpos _createChest;
_parachuteCreate = createVehicle [_parachute, _resupplyPos, [], 0, "NONE"];
_createChest attachTo [_parachuteCreate, [0, 0, 1]];

//removes the parachute when the crate touches the ground and adds a marker to the chests position
// currently not working due to dedicated server problems
waitUntil {ASLtoAGL getPosASL _createChest select 50<50};
hint "if worked";
detach _parachute;
 _markerChest = createMarker ["Nachschubskiste", position _createChest, 1];
#

also you had a : at the end

#

the code never worked anyway

little raptor
mighty vector
#

is there any way to enable/disable observer mode and change respawn time during game?
ie: normally, respawn is set to 30secs and observer disabled. when admin runs script, respawn timeout is set to 5 min, and observer mode enabled

sonic hill
#

I am trying to script the BPz 2A0 from Global Mobilization to function like the Bobcat where it will rearm, refuel, and repair, everything from tanks, to towed artillery, to helicopters, and jets. I tried a few scripts I found online but none of them are working.

past wagon
little raptor
little raptor
past wagon
#

kk

winter rose
past wagon
#

get rid of everything

winter rose
mighty vector
#

no @winter rose i think s/he means cls/clear in linux-style

#

to clear systemchat history (currently shown on screen)

past wagon
little raptor
past wagon
#

ok

winter rose
#

local effect

pulsar bluff
#

never seen the clearRadio command in my life

#

used thousand commands, never knew that 1 existed

#

@sonic hill it might not have fuel/ammo/repair cargo capacity

#

that is config not scripting

little raptor
#

you can script it

#

but it won't function "exactly" like vanilla

pulsar bluff
#

yea, i mean hooking into the vanilla system

#

not sure its even possible with script, needs config

little raptor
#

yeah it's not

sonic hill
little raptor
#

yeah

#

but you won't have that action that appears on the vehicle

#

(you can script it tho)

crude vigil
#

why not config it? Isnt it like 2 or 3 attributes to modify?

#

is this for a mission?

sonic hill
#

didn't know I could do a config. How would I do that?

little raptor
sonic hill
#

yeah it's for a training Zeus Op for West Germany Cold War period.

crude vigil
#

yeah but we re in scripting so

#

I kind a assumed it is mod honestly haha

sonic hill
#

So how do I script it?

little raptor
sonic hill
#

automatic tbh

mighty vector
#

is there any way to enable/disable observer mode and change respawn time during game?
ie: normally, respawn is set to 30secs and observer disabled. when admin runs script, respawn timeout is set to 5 min, and observer mode enabled(editado)

past wagon
#

This is outputting <t color='#0000ff'>Blue</t> team wins!

["<t color='#0000ff'>Blue</t>" + " team wins!"] remoteExec ["hint", 0, false];

So I tried this:

_blueWinText = parseText "<t color='#0000ff'>Blue</t>" + "team wins!";
[_blueWinText] remoteExec ["hint", 0, false];

and I got an error

crude vigil
past wagon
crude vigil
#

oh whoops

little raptor
# sonic hill automatic tbh

you can use a server-side loop I guess:
I think this is the best way to do it? thonk

if (!isServer) exitWith {};
while {alive this} do {
  _nearVehs = this nearEntities ["allVehicles", 15];
  {
    _x setFuel (fuel _x + 0.1);
    _x setDamage (getDammage _x - 0.2); 
  } forEach (_nearVehs - [this]); 
  sleep 2;
}

the rearming part is a bit more complicated
meowsweats

dreamy kestrel
#

Q: how do I find the bounding box of a class (vehicle)? without creating the vehicle. can I do it given the class name only? and/or discovering its config?

little raptor
#

no

willow hound
crude vigil
past wagon
#

ok

astral dawn
past wagon
#
_blueWinText = parseText "<t color='#0000ff'>Blue</t>" + "team wins!";
[_blueWinText] remoteExec ["hint", 0, false];

does this work?

crude vigil
#

nope that is still structured text + string

past wagon
#

oh yeah

dreamy kestrel
winter rose
past wagon
#

ok

#

yeah that makes sense

#

thanks

astral dawn
crude vigil
winter rose
dreamy kestrel
crude vigil
dreamy kestrel
#

or known set of available vehicle classes

astral dawn
steel shadow
#

Hello, I am completely new to ArmA 3 scripting and I have this simple vehicle spawning script but would like to spawn drones the same type of way but drones need their AI and this script doesn't spawn vehicles with their crew. Can anyone give me some pointers?

this addAction          
[         
    "Spawn (vehicle)",          
    {         
        _pad1 = getPosATL Spawn_Pad1;         
         
        _dir = getDir Spawn_Pad1;      
        _veh = createVehicle           
        [         
            "(vehicle)",         
            _pad1,         
            [],         
            0,         
            "NONE"         
        ];         
        _veh setDir _dir;      
    }         
]; 
willow hound
#

UAVs are snowflakes too

crude vigil
#

Not sure if it works with UAVs tho

willow hound
past wagon
#
radioChannelCreate [color, label, callSign, units, sentenceType]

What is callSign?

astral dawn
# dreamy kestrel or 'local' to server anyway. so then the trick is discovering all the objects th...
params ["_className"];

if (isNil "bbcache") then {
  bbcache = createHashmap;
};

_bbfromcache = bbcache get _classname; // Get cached value
if (isNil "_bbfromcache") then { // If cached value is not present for this class, 
  _veh = createVehicleLocal ... ; // obtain the value and put value into cache
  _bb = boundingboxreal _veh;
  deleteVehicleLocal _veh;
  bbcache set [_classname, _bb];
  _bb; // return
} else {
  _bbfromcache; // Return
};

In the end your cache size will grow to the size of all vehicles this function has been called for.

winter rose
past wagon
#

😬

past wagon
#

where do I find the config files?

winter rose
#

under the debug console > CONFIG

past wagon
#

ooooooh

winter rose
#

magic, I know 😎

past wagon
#

am I not able to preview any of the sounds in CfgSounds?

winter rose
#

w/ playSound

#

some Editor addons can do that too

past wagon
#

am I not able to do this:

waitUntil { !isNil "myVariable" };
winter rose
#

why not?

#

exceptionally, I shall allow it.

#

here is my permission: you can do what you like, bud ❀️

past wagon
#

nevermind i got it

past wagon
#

also how do the x and y coords work for BIS_fnc_dynamicText?

#

I want it to appear at the top middle of the screen but when I change the values its confusing

winter rose
#

from top-left of the screen I believe?

past wagon
#

well when X is zero, it is centered

#

so what do I need to put for y to make it at the top of the screen?

#

i cant figure it out

winter rose
#

0

past wagon
#

no 0 puts it in the middle of the screen

#

well

#

the center

winter rose
#

you may have set it centered

#

as in, set a centre argument to true

past wagon
#

it doesnt have any boolean arguments

winter rose
#

what are the arguments you set?

past wagon
#
[gameTimeString, 0, 1.5, 1, 0, 0] spawn BIS_fnc_dynamicText;

(gameTimeString is the time left in the game)

#

im testing out the second value

#

right now it is at 1.5, and the text doesnt appear anywhere

#

if I set it to 1, it is near the bottom of the screen, if I set it to 0 it is in the middle of the screen

winter rose
#

then set it to -1? πŸ˜„

past wagon
#

I tried that

dreamy kestrel
#

I must be blind, I am not seeing the error. Does boundingBoxReal require clippingType then?

params [
    ["_className", "", [""]]
    , ["_pos", getPos KPLIB_eden_createVehicle, [[]]]
];
if (isNil {KPLIB_common_bbrCache}) then {
    KPLIB_common_bbrCache = createHashMap;
};
private _bbrCurrent = KPLIB_common_bbrCache get _className;
if (!isNil {_bbrCurrent}) exitWith {_bbrCurrent;};
private _object = _className createVehicleLocal _pos;
private _bbr = boundingBoxReal _object;
deleteVehicleLocal _object;
KPLIB_common_bbrCache set [_className, _bbr];
_bbr;

With errors:

16:06:31 Error in expression <ingBoxReal _object;
deleteVehicleLocal _object;
KPLIB_common_bbrCache set [_cl>
16:06:31   Error position: <_object;
KPLIB_common_bbrCache set [_cl>
16:06:31   Error Missing ;

https://community.bistudio.com/wiki/boundingBoxReal#Syntax

past wagon
#

ok correction: when I set it to 0, the text is towards the top of the screen, but not as high as I want it

#

1 is at the bottom

still forum
past wagon
#

-1 is in the middle

#

-2 is nowhere on the screen

dreamy kestrel
#

oh duh LOL

#

I mean why not I created it local LOL

astral dawn
#

I wrote deletevehiclelocal in my pseudocode but it was pseudocode just to demonstrate how it works

prisma orbit
#

Is there a way to get more info on an error besides just the black and white pop up box

still forum
#

RPT sometimes says more about it than the popup box

#

you can start Arma with -debug parameter which will give you the full callstack of the error to RPT

dreamy kestrel
#

but the error doesn't tell you, command invalid either, so... anywho. thanks...

past wagon
#

does anyone know how the coordinates system works for BIS_fnc_dynamicText? what do I need to put for it to appear at the top middle of the screen?

[gameTimeString, 0, 0, 1, 0, 0] spawn BIS_fnc_dynamicText;
astral dawn
digital torrent
#

anyone know of a scritpt or command to make firing from vehicle (FFV) from the passenger of a PO Orca?

quaint ivy
#

@digital torrent I think you'd need a mod for that to reconfigure the seats

#

Does anyone know of an eventhandler for custom controls being used? Im trying to make a mod that uses Ctrl+Mouse Wheel Up but I can't figure it out.

little raptor
exotic tinsel
#

is there a way to detect if a class name in a var is a weapon? This is not working, it always spawns as an object without mag.

if (
        (_item_classname isKindOf "Weapon") ||
        (_item_classname isKindOf "Rifle") ||
        (_item_classname isKindOf "Pistol") ||
        (_item_classname isKindOf "Launcher")
    ) then
{
    diag_log "weapon";
    _item = "groundweaponholder" createVehicle _spawn_pos;
    _item addWeaponCargo [_item_classname, 1];
    _item setPos _spawn_pos;
}
else
{
    diag_log "just an object";
    _item = _item_classname createVehicle _spawn_pos;
    _item setPos _spawn_pos;
};
cosmic lichen
#

BIS_fnc_itemType

#

could also check if it's in CfgWeapons and not CfgVehicles

exotic tinsel
#

@cosmic lichen sweet thanks mate

past wagon
#

actually maybe its y=-1

cosmic lichen
#

You said, top center

past wagon
#

the only values that work for y are 0, 1, and -1 from my testing

#

yes

#

y = 0 above the center
y = 1 below the center
y = -1 center

#

but I want it to be at the very top of the screen in the middle

cosmic lichen
#

Yeah it's weird. Looking at the function now

#
["gameTimeString", 0, safezoneY, 4, 2, 5] spawn BIS_fnc_dynamicText; 
past wagon
#

is that a different syntax?

cosmic lichen
#

no

tiny pasture
#

@restive leaf should I just type (setEnemy)?

#

If i Want to get them to be enemy’s?

cosmic lichen
#

setEnemy? What is that?

tiny pasture
cosmic lichen
#

There is no command setEnemy

restive leaf
#

Also note I linked the setFriend command, not setEnemy... setFriend sets side relations, friendly or enemy

tiny pasture
restive leaf
#

In IFA3?

tiny pasture
#

Yes sir

restive leaf
#

Don't see a Denmark faction or unit in IFA3

tiny pasture
restive leaf
#

That won't work unless you mod the configs in the 80s mod to make them GUER/INDEP...

tiny pasture
#

is that easy?

restive leaf
#

Sort of, a lot of work... now you need to move to #arma3_config where others can help

warm hedge
#

It should be possible to do it in Editor or scripting, simply group them to opposite side's group or whatever

tiny pasture
#

oh okay thanks for the help both of u!

warm hedge
#

Yup. I think scripting method is more reliable, simply spawn them as a member of a opposite side's group

restive leaf
#

Oh, cool. Had never tried that... in all my time in ARMA... had never tried that 🀦

#

Going to now though. Thanks 🀣

tiny pasture
#

@warm hedge What is works lol thanks for it!

wintry grail
#

So ACE 3 has some way to tell if a unit has explosives in their inventory, given they show an "Explosives" menu if you do, and no menu if you don't

#

does anyone know if I can tap into that code somehow to determine if a unit has explosives or not

exotic tinsel
#

im trying to spawn weapons and gear on the floors of buildings. im using the building positions but the items seem to hove above the ground. I have tried using the following but has no effect. Any suggestions or links?
_item setVectorUp surfaceNormal position _item;

warm hedge
#

setVectorUp does nothing to do with positions. Most likely you're using wrong position format (z-format)

exotic tinsel
#

ive tried setpos, setposATL, and setposASL. some still hover like rocket launchers

warm hedge
#

Post the entire code

exotic tinsel
#
_item = _item_classname createVehicle _spawn_pos;
_item setPos _spawn_pos;
_item setVectorUp surfaceNormal position _item;
_item setDir (getDir _random_location_obj);
warm hedge
#

What's _spawn_pos?

exotic tinsel
#

either the top of an object or a building position. by building positions i mean I used BIS_fnc_buildingPositions.

warm hedge
#

Confused. Post the entire, not the part of it

#

Also get rid of that setVectorUp part, that doesn't do anything more like could problematic. surfaceNormal does return the terrain normal not a object's surface's normal

tulip tundra
#

One of my scripts for an insignia mod is saying input after endoffile

#

And everything is fine with the bracketing from what it looks like to me

warm hedge
#

Nothing can be said unless you post an actual code or script or config or whatever

tulip tundra
#

Uh it's a little long

warm hedge
#

Then sqfbin or pastebin

tulip tundra
#

Found the fix

#

I think

#

The class names had spaces

tulip tundra
#

That did not work so there is the pastebin

warm hedge
#

version={"1.0"};
this part

tulip tundra
#

Oh...

#

Thank you

#

I was trying to fix the original problem so I tried that

copper raven
warm hedge
#

Or just hardcode the height

copper raven
#

well that's basically the same thing

pulsar bluff
#

there arent many building models. set up a good dev environment and you can hardcode all the locations in an evening

#

with a simple lookup table

#

fall back on hardcoded building positions for ones you havent done yet

exotic tinsel
#

So im trying to create a loot spawner and im having issues filling crates with items the server admin listed. We are using the class names for a gun from the eden editor. I need a way to detect if the classname is a weapon, mag, item, or back pack. Someone suggested using BIS_fnc_itemType but it returns and empty array.
Any thoughts?

#

here is an example of one of the items in the loot spawn array

[
    ["className", "Box_NATO_Ammo_F"],
    ["locations", []],
    ["max_count", 100],
    ["min_count", 2],
    ["inventory",
        [
            ["Weapon_arifle_MX_F", 10],
            ["Weapon_launch_RPG7_F", 10],
            ["Weapon_LMG_Zafir_F", 10]
        ]
    ], //item list from inventory copied from eden editor and quantities
    ["can_spawn_on_ground", true],
    ["spawn_on_ground_only", true],
    ["iswepon", false],
    ["active", true]
],
quaint ivy
cosmic lichen
#

Yes, UI EHs are stackable.

quaint ivy
#

@cosmic lichen Could you write me a single line for adding stacked event handlers? Is it like: _myDisplay displayAddEventHandler ["KeyDown" + "MouseButtonClick",{}]; or did I misunderstand you guys?

cosmic lichen
#
_myDisplay displayAddEventHandler ["KeyDown", {}];
_myDisplay displayAddEventHandler ["KeyDown", {}];
_myDisplay displayAddEventHandler ["KeyDown", {}];

_myDisplay displayAddEventHandler ["MouseButtonClick", {}];
_myDisplay displayAddEventHandler ["MouseButtonClick", {}];
_myDisplay displayAddEventHandler ["MouseButtonClick", {}];
#

This is valid. Each EH of given type will get it's own index as reference.

#

@exotic tinsel Weapon_arifle_MX_F
This is an incorrect class name

#

The classname which points to the weapon is arifle_MX_F

#
"arifle_MX_F" call BIS_fnc_itemType; //["Weapon","AssaultRifle"]
unreal scroll
#

In 2.* version the street lamp halo stays even if the lamp is hidden or destroyed. Are there any ways to fix it?
Ah, I've got it, an old trick. Need to setDamage 0.9, then to hideObjectGlobal.
Hmm... No, it can't be done with the script. What is the trick?
The halo is disabled on damage 0.9, but when I try to hide the lamp, it enables again...
So how is it handled?
P.S. Got it finally. Need to setDamage 0.95.

copper raven
real tartan
#
// initPlayerLocal.sqf
[player, [missionNamespace, "gear"]] call BIS_fnc_saveInventory;
[missionNamespace, "arsenalClosed", { [player, [missionNamespace, "gear"]] call BIS_fnc_saveInventory; }] call BIS_fnc_addScriptedEventHandler;
player addEventHandler ["Respawn", { [player, [missionNamespace, "gear"]] call BIS_fnc_loadInventory; }];

for some reason I don't get loadout saved from arsenal after respawn. (testing on editor > multiplayer )

little raptor
real tartan
little raptor
#

Β―_(ツ)_/Β―

#

what R3vo's said is simpler tho meowsweats

real tartan
#

yes, that was my original code, was trying with BIS functions, seems like going back to commands

noble flint
#
_this sideChat "Last one out lock the door!"; 
null = [] spawn {  
{  
  if(((assignedVehicleRole _x)select 0) =="Cargo") then {  
  removeBackpack _x;  
  _x addBackpack "B_Parachute";  
  [_x] ordergetin false;  
  [_x] allowGetIn false;  
  unassignvehicle _x;  
  moveout _x;  
  sleep 0.3;  
 };  
 } forEach(crew _this);  
}; 
#

This isn't right is it?

#

It's an airdrop script

high marsh
#

_this isn't defined inside spawn {}
have to pass it

noble flint
#

What do you mean by pass it

cosmic lichen
#

_this spawn {params ["_vehicle"];....}

#

Then replace _this with _vehicle inside spawn

noble flint
#

Hmm

cosmic lichen
#
_this sideChat "Last one out lock the door!"; 
_this spawn 
{  
  params ["_vehicle"];
  {  
    if ((assignedVehicleRole _x select 0) =="Cargo") then 
    {  
      removeBackpack _x;  
      _x addBackpack "B_Parachute";  
      [_x] ordergetin false;  
      [_x] allowGetIn false;  
      unassignvehicle _x;  
      moveout _x;  
      sleep 0.3;  
    }; 
 } forEach (crew _vehicle);  
}; 
real tartan
unreal scroll
#

Is there a way to disable and enable VON during the mission individually for each player?

unreal scroll
#

Thanks πŸ™‚
But as I understand, it sets the overall volume to 0. So, it blocks every incoming messages. Maybe there could be another way, to block voice transmitting individually? Because if player A can't hear player B, but can hear player C, then it should hear only C.

exotic tinsel
#

Can someone point me in the direction on how to spawn a grenade on the ground so that players can pick it up and use. I know i can put on one the ground and pick it up but cant figure out how to script it.

winter rose
exotic tinsel
#

is this the right code?

_item = "groundweaponHolder" createVehicle _spawn_pos;
_item addMagazineCargoGlobal["HandGrenade", 1];
_item setPos _spawn_pos;
_item setDir (getDir _random_location_obj);
cosmic lichen
#

why createVehicle and setPos?

unreal scroll
#

@cosmic lichen It was more precise from my experience, but it is critical only for vehicles.

I have a problem with triggers.
I created a trigger that activates on load:

    private _factory = nearestObject [[6215.61,16282.9,0], "Land_Ind_Pec_03"];
    private _trigger = createTrigger ["EmptyDetector", getPosATL _factory, true];
    _trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true];
    _trigger setTriggerInterval 5;
    _trigger setVariable ["Factory", _factory, true];
    _trigger setTriggerArea [100, 100, 0, false];
    _trigger setTriggerStatements 
    [
    "some conditions, true at the moment of creation", 
    "some script", 
    ""
    ];

The problem is that it could be activated only when I change some of statement conditions, but not from the very beginning.
Is this a known behaviour?

cosmic lichen
#

Dunno, never used triggers in sqf really

past wagon
# exotic tinsel here is an example of one of the items in the loot spawn array ```sqf [ ["cl...

I made a battle royale game a while ago and in order to have random weapon loot with guns and their respective magazines, I used an array of arrays:

private _weaponArray = [
    ["hgun_ACPC2_F", "9Rnd_45ACP_Mag"],
    ["SMG_03C_TR_black", "50Rnd_570x28_SMG_03"],
    ["arifle_AK12_F", "30Rnd_762x39_AK12_Mag_F"],
    ["arifle_AKM_F", "30Rnd_762x39_Mag_F"],
    ["arifle_Katiba_F", "30Rnd_65x39_caseless_green"], 
    ["sgun_HunterShotgun_01_F", "2Rnd_12Gauge_Slug"], 
    ["srifle_DMR_03_F", "20Rnd_762x51_Mag"], 
    ["srifle_EBR_F", "20Rnd_762x51_Mag"], 
    ["arifle_Mk20_F", "30Rnd_556x45_Stanag"], 
    ["arifle_MX_Black_F", "30Rnd_65x39_caseless_black_mag"], 
    ["arifle_MXM_Black_F", "30Rnd_65x39_caseless_black_mag"], 
    ["hgun_P07_blk_F", "16Rnd_9x21_Mag"], 
    ["hgun_PDW2000_F", "30Rnd_9x21_Mag"],
    ["hgun_Pistol_01_F", "10Rnd_9x21_Mag"], 
    ["SMG_05_F", "30Rnd_9x21_Mag_SMG_02"],
    ["hgun_Rook40_F", "16Rnd_9x21_Mag"], 
    ["arifle_SDAR_F", "20Rnd_556x45_UW_mag"], 
    ["arifle_SPAR_01_blk_F", "30Rnd_556x45_Stanag"], 
    ["arifle_SPAR_03_blk_F", "20Rnd_762x51_Mag"],
    ["SMG_02_F", "30Rnd_9x21_Mag_SMG_02"], 
    ["arifle_TRG21_F", "30Rnd_556x45_Stanag"],
    ["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"],
    ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"]];
_weaponAndMag = selectRandom _weaponArray;
_weapon = _weaponAndMag select 0;
_mag = _weaponAndMag select 1;

_crates = allMissionObjects "Land_PlasticCase_01_medium_black_F";
{
  _x addWeaponCargoGlobal [_weapon, 1];
  _x addMagazineCargoGlobal [_mag, 5];
} forEach _crates;
exotic tinsel
#

@winter rose They code i posted puts something on teh ground but nothing happens when i hit and also i get this message when the mission starts. https://imgur.com/a/LvolkWv
@cosmic lichen I do setpos because createVehicle places in a safe spot.
@past wagon I need a solution for spawing the hand grenade on the ground to be picked up

exotic tinsel
#

nope

unique sundial
exotic tinsel
#

I posted my code. any suggestions?

#

@unique sundial

unreal scroll
#

@unique sundial Maybe.
The problem is in the script condition.
I supposed that if it triggers, then there are some players nearby (trigger radius > 100 m), so in the script there is following condition:
(allplayers findif {_x distance2D OT_factoryPos < 100}) != -1
And it is false at the time the trigger fires.

exotic tinsel
#

Uh, my issue is spawning grenades on ground, you're talking about the other guys issue. Thanks though.

unique sundial
#

i have many questions about that code as it is useless without full context, if you think there is a bug, make ticket with repro @unreal scroll

unique sundial
exotic tinsel
#

ok thx

nocturne ridge
#

Could some one slip me a config that works for thrown weapons please.

nocturne ridge
#

Opps sorry

#

Thanks

past wagon
#

@exotic tinsel if you still need help, post your entire code and explain what you are trying to do. I will help you

exotic tinsel
#

@past wagon thanks mate for following up, I figured it out.

digital torrent
#

dumb question, is there a method to have a seperate sqf but refer to a private variable of another script?

warm hedge
#

Yes. Pass them as arguments

past wagon
# warm hedge Yes. Pass them as arguments

Main script:

[_variable1, _variable2, _variable3] execVM "myOtherScript.sqf";

Other script:

_variable1 = _this select 0;
_variable2 = _this select 1;
_variable3 = _this select 2;

Alternative other script (easier) :

params ["_variable1","_variable2","_variable3"];
#

whoops meant to respond to @digital torrent

warm hedge
#
params ["_variable1","_variable2","_variable3"];``` is highly recommended instead
past wagon
#

oh yeah

#

forgot about that

digital torrent
#

but would the params in the other script be refered to the original?

past wagon
#

no

#

but they would be passed to the new script

digital torrent
#

lol yea. so that my question

past wagon
#

they wouldnt get passed back

digital torrent
#

basically it is something like

past wagon
#

im not 100% sure about that

#

but im pretty sure the best way to do it would be to just use a global variable

digital torrent
#

private ["_variable1"];
_variable1 = create unit "soldier"

some method to pass to other script
deletevehicle _variable1

past wagon
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
past wagon
digital torrent
#
private ["_entitate"];
_entitate= _grp createUnit ["B_Soldier_VR_F",getmarkerpos _poz_orig_sc, [], 0,"NONE"];
_entitate addEventHandler ["HitPart", {[[_this select 0 select 5, _this select 0 select 6 select 0], "AL_Screamer\screamer_hp.sqf"] call BIS_fnc_execVM;}];
#

some method so in other script, when i do deletevehicle _entitate works

past wagon
#

you can start by creating the variable in script 1, then you can pass it to script 2 and delete the vehicle

digital torrent
#

so u mean

Params ["_entitate"];
_entitate= _grp createUnit ["B_Soldier_VR_F",getmarkerpos _poz_orig_sc, [], 0,"NONE"];
_entitate addEventHandler ["HitPart", {[[_this select 0 select 5, _this select 0 select 6 select 0, _entitate], "AL_Screamer\screamer_hp.sqf"] call BIS_fnc_execVM;}];
_entitate = _this select 2;
etc....
deletevehicle _entitate;

#

the second part is the other script

past wagon
#

why are you using BIS_fnc_execVM instead of just execVM?

digital torrent
#

it doesnt change much does it?

past wagon
#

i dont know

#

why are you using the function instead of the command?

digital torrent
#

i mean i can change it

#

does by changing, it allow me to do what i wanted?

past wagon
#

is there a reason for using the function instead of the command tho?

digital torrent
#

no

past wagon
#

ok

#

so here:

digital torrent
#

i just used what was propose to make a HP system @little raptor lol

little raptor
#

never use execVM/spawn in event handler code anyway (unless you want to)

past wagon
#
_entitate = _grp createUnit ["B_Soldier_VR_F", getmarkerpos _poz_orig_sc, [], 0, "NONE"];
_entitate addEventHandler ["HitPart", {
  [_entitate] execVM "AL_Screamer\screamer_hp.sqf";
}];
params ["_entitate"];
digital torrent
past wagon
#

yeah it would be better to just put the code in there

#

instead of execVM-ing it

past wagon
#

yeah lemme check the syntax on that

little raptor
past wagon
#

whats the problem?

little raptor
past wagon
#

no array?

little raptor
digital torrent
#

i cant seems to wrap my head around it lmao

#

no your script, but combining with what ihave haha

digital torrent
#

@past wagon i tried doing what u suggest, but i ran problem with my existing script

private ["_entitate"];
_entitate = _grp createUnit ["B_Soldier_VR_F", getmarkerpos _poz_orig_sc, [], 0, "NONE"];
_entitate addEventHandler ["HitPart", {[[_this select 0 select 5, _this select 0 select 6 select 0], "AL_Screamer\screamer_hp.sqf"] call BIS_fnc_execVM;}];
}];

Other script

part = _this select 0 select 0;
_dmg = _this select 1;

if(_part == "head")then
    {
        screamerhp_dmg = screamerhp_dmg + _dmg + 20 ;
    }
    else
    {
        screamerhp_dmg = screamerhp_dmg + _dmg;
    };

if(screamerhp_dmg > random [1000, 1500, 2000])then
{
_entitate allowDamage true;
_entitate setDamage 1;
_screamer_anomally setdamage 1;
deletevehicle _screamer_anomally;
deletevehicle _entitate;
playsound "earthquakes";
_emit say3D ["scream", 200];
hint "Screamer dead"; systemchat "Screamer dead"
};

*screamerhp_dmg already a public variable

#

the above is the original

#

what i tried with your suggestion:

private ["_entitate"];
_entitate = _grp createUnit ["B_Soldier_VR_F", getmarkerpos _poz_orig_sc, [], 0, "NONE"];
[_entitate] execVM "AL_Screamer\screamer_hp.sqf";
params ["_entitate"];

_entitate addEventHandler ["HitPart", {

_part = _this select 0 select 5; //_this select 0 select 0;
_dmg = _this select 0 select 6 select 0; //_this select 1;

if(_part == "head")then
    {
        screamerhp_dmg = screamerhp_dmg + _dmg + 20 ;
    }
    else
    {
        screamerhp_dmg = screamerhp_dmg + _dmg;
    };

if(screamerhp_dmg > random [1000, 1500, 2000])then
{
_entitate allowDamage true;
_entitate setDamage 1;
_screamer_anomally setdamage 1;
deletevehicle _screamer_anomally;
deletevehicle _entitate;
playsound "earthquakes";
_emit say3D ["scream", 200];
hint "Screamer dead"; systemchat "Screamer dead"
};


}];
little raptor
digital torrent
#

lol i shoudnt have?

little raptor
digital torrent
#

i mean i am trying to do dedicated so i thought global would be better

little raptor
#

and you're using a global var

digital torrent
#

well i can spawn multiple of them with that script

little raptor
#

that's the problem

digital torrent
#

ok so like the above but added the private

#

i am lost tbh rn

little raptor
#

and how is that supposed to address the problem? meowsweats

#

use that instead of those global variables

desert horizon
#

is there an equivialent of player for npc's ?

silk carbon
#

hiya, i'm trying some super basic code, i have this right now

_magazinetype = currentMagazine player;

while {true} do {

hint str(_magazinetype);

};

i'm trying to get it so that currentMagazine is constantly shown as a hint but it only shows the first loaded mag, not anything i switch to. any support would be appreciated

desert horizon
#

you assign the variable only once,

#

not in the while loop

#

so it just shows the hint of the same magazine over and over again

silk carbon
#

ahh so move the magazinetype variable into the while loop?

brave creek
desert horizon
#

thanks

desert horizon
silk carbon
#

gotcha! that’s really useful, thanks for your help :)

brave creek
#

yes this is an array of all alive npc's

silk carbon
#

sorry another question, how do i ;print both a variable and string within a hint?

desert horizon
novel delta
#

im not entirely sure this is the right place to ask this so sorry if its not

Im setting up a zeus mission that vehicles will be spawned on the fly, Is there any way i can make it that anytime i spawn a vehicle it automatically gets its inventory wiped?

#

i'd like to avoid the players potentially using what comes with the vehicle

desert horizon
#

spawn via script or via zeus?

novel delta
#

via zeus

fair drum
#

if you are using ZEN, then you can click the vehicle and click inventory and clear it but its not automatic

willow hound
#

ZEN requires CBA

crude vigil
# novel delta im not entirely sure this is the right place to ask this so sorry if its not Im...
if (isServer) then {
  this addEventHandler ["CuratorObjectPlaced", {
    _veh = _this select 1;
    if (_veh isKindOf "LandVehicle") then { //I dont remember the vehicle hierarchy, u may wanna change this.
      clearWeaponCargoGlobal _veh; clearMagazineCargoGlobal _veh; clearItemCargoGlobal _veh;
    };
  }];
};

Untested ^
Im not well experienced with editor but I guess a isServer check on init of your Game Master module (the thing that you connect to player entity) would be enough.

unreal scroll
#

@unique sundial
"i have many questions about that code as it is useless without full context"
The code doesn't matter.
How does it work for dedicated:

  1. Make a trigger for player presence
  2. Player enters the trigger area
  3. Trigger fires
  4. If we try to find a player from allplayers inside the trigger statements within the trigger radius, it fails. For local it works well.
private _factory = nearestObject [[6215.61,16282.9,0], "Land_Ind_Pec_03"];
    private _trigger = createTrigger ["EmptyDetector", getPosATL _factory, true];
    _trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true];
    _trigger setTriggerInterval 5;
    _trigger setVariable ["Factory", _factory, true];
    _trigger setTriggerArea [100, 100, 0, false];
    _trigger setTriggerStatements 
    [
    "true", 
    "(allplayers findif {_x distance2D [6215.61,16282.9,0] < 100}) != -1", // returns false
    ""
    ];

And it doesn't matter how far the player is, I moved from 100 to ~10 m.
If it is not intended, then I'll write a report. But it is better to check twice πŸ™‚

crude vigil
#

@unreal scroll Apologies for my rustiness with trigger codes but whats the point of setTriggerActivation when you got setTriggerStatement 1st param being true? Shouldnt it be this instead for it to consider that activation? This could also be the issue depending on your test environment.

unreal scroll
#

@crude vigil it is only for testing. Actually there are some conditions, as I mentioned above.
But true means that it should be activated in any case. Could there be triggers that activates in any case? Of course πŸ™‚
You can check conditions inside the executed code.

And the problem is that the trigger doesn't fire for the very first time (if there are any conditions set). If something in statement changes, it activates well. But maybe it is because the player stays inside the trigger radius - seems like the trigger fires before allplayers variable change.

Maybe I need to use thisList as the list of players, but it is strange that server doesn't see the player in allplayers.

unique sundial
#

@unreal scroll You should have started with "it doesnt work on dedicated". The reason is simple, setTriggerStatements is local command you need to execute it on dedicated if you want it to work on dedicated. The trigger you add will have default condition on dedicated and modified condition on client. Default condition is "this", which means it will only activate when you have triggerActivation happen

unreal scroll
#

Ah, so Talya_taya was right, thanks.

"You should have started with "it doesnt work on dedicated"
I didn't know before today tests πŸ™‚

unique sundial
#

you can create global triggerfrom any client, but then you have to remoteExec everything else to all clients if you want it to be identical on all clients. I dont know what you are trying to do but there is definitely less painful way

unreal scroll
#

"I dont know what you are trying to do"
Just say3D (ambient sound) and createvehiclelocal (smoke)

spark turret
#

You can spawn a smoke grenade globally and arma does the rest for the smoke

#

Or (way harder, probably not worth it) you create local particles

unreal scroll
#

It is the smokestack smoke, for a long time. I use the Naval Legends implementation.

spark turret
#

How do you intend to spawn it? Via module?

tidal ferry
#

Hey, question. Is it possible to define/retrieve variables via server.cfg?

#

Looking to get a serverside script set up that only activates when a certain variable is enabled

dreamy kestrel
#

huh, how is this even possible? floating point rounding error perhaps?

_a = 0;
_b = -1;
_a*_b; // -0

versus:

_a = 0;
_b = -1;
round (_a*_b); // 0
brave creek
brave creek
winter rose
dreamy kestrel
tidal ferry
#

Ah sweet, thanks

fleet crystal
willow hound
#

https://community.bistudio.com/wiki/Number at least hints towards the fact that the custom (iirc) floats used in RV (partially) comply with the IEEE 754 standard.
Among the many things defined in that standard is obviously the representation of zero. From https://en.wikipedia.org/wiki/IEEE_754#Formats:

Moreover, there are two zero values, called signed zeros: the sign bit specifies whether a zero is +0 (positive zero) or βˆ’0 (negative zero).
Having two zero representations is a disadvantage that comes with the binary encoding of numbers; the only way to encode whether a number is positive or negative is using a bit dedicated to storing that information.
Simple example with 4-bit numbers, the first bit stores the sign:

0000 //Zero
1000 //Also zero :-(
0011 //Three
1011 //Negative three
```For integers this can be solved easily using https://en.wikipedia.org/wiki/Two%27s_complement, but for floats it's not that simple.
dreamy kestrel
#

hmm good to know @willow hound. the thing is, I am working from a (-1 * count _array), and somehow that is -0. does count not return an int?

fleet crystal
dreamy kestrel
#

ah I see, okay then

willow hound
#

May the Enfusion engine save us

dreamy kestrel
#

isn't that just a terrible rumor at this point? abandon all hope all ye who enter... LOL

unreal scroll
zenith ferry
#

Multiple hideobjectglobal through addaction?

#

in rapid succesion

#

It doesn't work on MP servers right?

winter rose
#

use forEach @zenith ferry

zenith ferry
#

for each?

winter rose
#

{ do stuff } forEach [obj1, obj2]

still forum
#

no

#

forEach, not for each

winter rose
zenith ferry
#

I know but i don't think that will fix it

#

since it's very rapid

#

But i might try

little raptor
#

@dreamy kestrel intercept is also an option

zenith ferry
#

Intercept? i never heard of that

little raptor
#

Sorry I was replying to michaelwplde (seems like I forgot to press reply)

zenith ferry
#

ah no worries then

little raptor
little raptor
zenith ferry
#

Issue is i know the server is executing them

#

since iget the hints that it has run through but it goes um dumb and client doesn't see it

#

So i'm using Sleep which is bad in itself but don't know how to use the fnc to do that

#

My other idea was to make them change locally but can't figure out how to

willow hound
#

Can you share the code in question?

zenith ferry
#
B_1 hideObjectGlobal false;
sleep 1;
B_1 hideObjectGlobal true;
sleep 1;
B_1 hideObjectGlobal false;
sleep 1;
B_1 hideObjectGlobal true;
sleep 1;
V_3 hideObjectGlobal true;```
#

This is just piece of it but it all works on the same basis

#

The issue is server doesn't update it, and my idea of working on Local is um questionable

willow hound
#

What machine does this code run on?

zenith ferry
#

as in Locality or Headless/Dedicated?

#

I'm confused about the question @willow hound

willow hound
#

Does this code run on the server or on a (headless) client?

zenith ferry
#

Server

#

or um Local? It's through Addaction

#

that's why it's HideObjectGlobalso it updates it globally

willow hound
#

Ah, yes, I forgot you mentioned addAction.

zenith ferry
#

oh HideObjectGlobal is to be executed on server? Huh i wish i knew that beforehand

#

any idea how to fix it then? or to apply HideObject to all Players?

#

I presume that would be through execVM

#

or one of those options i have no clue how to use

willow hound
#

Pretty simple in this case:

#
[B_1, false] remoteExec ["hideObjectGlobal", 2];
zenith ferry
#

So i have to do that for each and every one of them right?

#

I mean as in remoteExec each one of those lines individually

willow hound
#

Yes, either that or you could be smart and put the whole code block into a function (or at least its own script file) and then remote execute that function once.

zenith ferry
#

i just realized i'm already using remoteExec in later parts of the script

#

and that part is the one that works

#

I'm dumb, thanks so much for help!

#

nothing bad will happen if i remoteExec a remoteExec ["zen_modules_fnc_moduleNukeLocal",0]

#

right?

willow hound
#

No, but it might be unnecessary (depends on your code design).

zenith ferry
#

I belive it's needed purely to supply params to Nuke so it doesn't kill server

#

this addaction ["Start",{ remoteExec ["Bonk.sqf", 2]}];

#

@willow hound Would that work?

winter rose
#

no

zenith ferry
#

not gonna lie never used remoteExec with .sqf

#

litteraly never

#

oh right i forgot the 2, right?

willow hound
zenith ferry
#

[table, ["Start", "Bonk.sqf"]] remoteExec ["addaction"]

#

?

willow hound
#

Is Bonk.sqf the script that needs to run on the server?

zenith ferry
#

Yup

#

one more question how to delete addaction from every user after it has been used? through remoteExec again?

willow hound
#

remoteExec doesn't take script file names as a parameter, it only takes commands and functions. Thus, we have to remote execute execVM (which does accept script file names):

"Bonk.sqf" remoteExec ["execVM", 2];
zenith ferry
#

so i was "Close" but not close enough

willow hound
zenith ferry
#

my first idea was this addaction [ "text", {code}]; but if im using remoteExec ig i would use remoteExec to create addaction

#

there is removeallactions table in the "Bonk.sqf" but it doesn't work

#

this addaction [ "Turn On", { "Bonk.sqf" remoteExec ["execVM", 2];}]; That's one of ideas how to make it but no clue how would that turn out

#

ik it would work in SP but no clue about MP

willow hound
#

Well the issue with addAction (and removeAllActions) is the fact that it has local effect, the action is only added on the client that runs the command. To solve that we have to use remote execution once again πŸ™‚

zenith ferry
#

Oh

#

so i have to add [table] remoteExec ["removeallactions"]

willow hound
#

Indeed.

zenith ferry
#

Thanks!

drifting portal
zenith ferry
#

Thank you guys so much

drifting portal
#

why adding it to the server only?

willow hound
#

Are you sure you run addAction on every client though? πŸ™‚

drifting portal
zenith ferry
#

You are saving my life tbf since i've found the issue around 4h before the operation....

zenith ferry
#

that was my mistake while typing

zenith ferry
#

Server + Clients, but i could probably have it on -2

winter rose
#

never script for dedicated only, think of the player-hosted

drifting portal
#

if a player

#

hosts it

willow hound
drifting portal
#

not dedicated

#

he won't see the action

zenith ferry
#

It's on dedicated, so ig it should be on 0 or -2 or am i missing smth?

winter rose
drifting portal
#

so you have two types of servers here:
player hosted (player is the host)
and dedicated (a pc is hosting the game, but the pc is not a player)
when you do -2, if the server was player hosted, you will exclude him as a "server" and he won't see the action

zenith ferry
drifting portal
drifting portal
zenith ferry
#

Again Thanks so much!

drifting portal
zenith ferry
#

It's dedicated

drifting portal
#

if player is host it should be 0

zenith ferry
#

but doesn't hurt to do 0 either way

drifting portal
#

I don't think you are going for a front line mission so it doesn't hurt

zenith ferry
#

It's a um 90 Player + operation tbf

#

but i know the server can handle it either way

drifting portal
#

how many lines

#

inside bonk.sqf ?

zenith ferry
#

64

drifting portal
#

is it a massive change or is it something minor?

zenith ferry
#

Minor, nothing that massive

#

Most of it is just feeding parameters to Local functions i scavenged from a friend

drifting portal
drifting portal
#

you are good to go I guess

zenith ferry
#

nope, litteraly feeds Positions, and changed if invisible

little raptor
#

Works on both dedi and non dedicated

zenith ferry
#

Ah that's convinient

#

so in short this addaction [ "Turn On", { "Bonk.sqf" remoteExec ["execVM",[0, -2] select isDedicated]}];

#

or am i going again into a hole

#

@little raptor

willow hound
#

Absolutely not notlikemeow

zenith ferry
#

Oh no

little raptor
#

I see it ok on my phone notlikemeow

willow hound
#

When does this part of the code get executed?

"Bonk.sqf" remoteExec ["execVM",[0, -2] select isDedicated]
little raptor
#

Did you want to exec it on the server?

zenith ferry
#

Never?

willow hound
zenith ferry
#

Oh

little raptor
zenith ferry
#

It doesn't run the select isDedicated ig? but either way i'm using 0

#

since it's um safer?

#

even though i know it's dedicated

#

What can go wrong, it's not like i'm gonna crash the whole server by complete accident

zenith ferry
#

Just to be 100% sure, if i did 0 in there nothing bad will happen

#

right?

drifting portal
#

yes

#
magazines MYTARGET;
#

MYTARGET is a tank, in my first map when I run this it doesn't return an array, but in the second map it does, any possible reason?

willow hound
# zenith ferry Just to be 100% sure, if i did 0 in there nothing bad will happen

Bonk.sqf contains code that has to run on the server (in fact, please make sure it only contains code that has to run on the server), and the server is always 2, so [0, -2] select isDedicated actually has to be omitted in this code block, you have to use 2 instead.
[0, -2] select isDedicated could be used if you were remote executing addAction, but you are not doing that right now (it could be necessary though), you are remote executing execVM.

zenith ferry
#

I've found out

#

that all of it can run on Server without Player input

#

so i will be changing it to 2

#

since um i don't want 90+ ships spawning accidentaly as local assets...

floral steeple
#

how do I get units from a group?

#

for instance:

_groupOne = _this select 0;

_soldier = _groupOne select 0;
floral steeple
#

could you elaborate what that does please?

#

or how I would use it in this case?

#
_groupOne = _this select 0;
_unitsGroupOne = units _groupOne;
#

?

little raptor
floral steeple
#

ah

#

and iirc SQF indexes array at 0 right?

little raptor
#

Yes

floral steeple
#

gotcha, thanks a bunch!

dusky pier
#

Hello, i have one question πŸ™‚

Wanted to make something like
control main vehicle from attached

Though is possible - how to make one vehicle controlled from second one πŸ™‚

Or switch camera from main vehicle to another one?

drifting portal
dusky pier
little raptor
#

You might be able to drive the main vehicle if it's a land vehicle and you use an AI to drive it for you

dusky pier
little raptor
#

It won't be as good as vanilla tho

dusky pier
#

i know - i ask stupid questions, sorry for that blobcloseenjoy

little raptor
#

It's ok notlikemeow

drifting portal
#
if (daytime > 18.0000) then {_timech = (daytime) -18.0000; 
skipTime ((daytime) - _timech);}; 
if (daytime < 18.0000) then {_timech = 18.000 - (daytime); 
skipTime (daytime + _timech);}; 
if (daytime == 18.000) then {sleep 0.01;};
#

I'm trying to set the time (of the mission) to 6pm (18:00)

#

but when I run this code

#

it randomly skips to a time

#

any reason behind that?

drifting portal
drifting portal
#

you mean case 0, case 1 and this type of stuff ?

drifting portal
little raptor
#

I think so
Check the wiki
I'm on my phone

crude vigil
#

Time is synced , u dont need as long as it is server executing it.

drifting portal
crude vigil
#

yep, u can go with 0 as well, sometimes (if there is a diff of 15 mins, it sometimes doesnt sync according to my test 2 years ago)

drifting portal
#

but its not working for some reason

crude vigil
#

ok here we go, where are you doing it?

#

eden mission?

#

console?

drifting portal
#

console

winter rose
#

[[2021, 05, 05, 12, 00]] remoteExec ["setDate"]