#arma3_scripting
1 messages · Page 583 of 1
as for the first question I would say "why not", but better to confirm with experts there yes
I'll delete the question here
Hey guys I'm in need of some scripting help... I set a scenario where the player can be "disguised" when mounting enemy vehicles
I found something that works for that
but I don't want the player to be able to do that when enemies are around
and I can't find something that accomplishes this
@loud python long Story short: Code is no lambda but only some data type
Scoping is pretty much, if the local scope of a Variable leaves, the variable disappears
sooo... dynamic scoping?
knowsAbout has memory throughout the mission and doesn't work with the setting, nearestEnemy only provide grid position and and nearTargets can have a null component
An exhaustive discussion on the rules regarding private variables and scopes in ARMA 3 SQF scripts.
targetKnowledge
@merry glen
that returns the last time the target was seen by the unit
so something like side targetKnowledge player
@queen cargo can't read that article right now, but damn that seems interesting :)
Thanks for posting!
ok thanks I'll try that
it takes a single unit as first argument though
so I guess you have to combine that with some other stuff
there's a targetsAggregate but I'm not sure I understand what it's for exactly
Yeah... Dynamic scoping pretty much
It appears that
nearestObjects [_posWorld, [_type], 0.25, true]
doesn't return the same list of objects as
nearestObjects [_posWorld, [], 0.25, true] select { typeOf _x == _type }
This appears to be the case if the objects are simple objects, but why isn't really obvious, and the documentation doesn't mention it.
what does not the same mean?
hows it different?
actually
yeah obviously it doesn't
because your select does a different thing
your select variant returns fewer objects
because you check if the type equals what you want, thats not what nearestObjects is doing
no, the first one returns 0 objects, the second one returns the correct set in the case i am testing
sorry I didn't explain clearly
I think so
so in my case i placed picnic tables, the ones marked simple object doesn't appear in the first call, only the second one
they appear in the second call
Think nearestObjects just shouldn't return the simple objects
send me the link to the FT ticket I'll take a look next week
Same ^ pls don't fix :c
Using CBA or Vanilla functions, is there a way to add an eventhandler for when CursorObject changes?
Or is there an efficient way rather than just a CBA PerFrame handler? I don't want to be unnecesserillaly checking something so regularly
is there any way for a client (admin) get the list of scripts (via diag_activeSQFScripts) on dedicated server?
Hey guys, has anyone experienced a wrong value for ctrlTextHeight? I am just confused because my structured text height is too high
@daring pawn if there was a cba event handler for this (maybe it exists, I didn't check) it would have been implemented in the same way
is there a way to make all placed objects in the editor have no damage instead of going into each object and setting it to disable damage
select them all and check disable damage?
can I post youtube links regarding my problem?
to set vehicle color I must use setObjectTexture?
the color that can be set in appearance menu
uhm
you said it yourself
to set a vehicle color you need to use the appearance menu
in code
setObjectTexture has [0 - n, ...] I dont want to set all this, I want to set the color itself
alright so
what setObjectTexture does is let you apply a texture onto an hiddenselection if an object doesn't have an hiddenselection you can't retexture it
what do you mean exactly by color?
I just checked all the available textures and used switch...
I don't follow sorry?
what are you trying to do and what do you need?
…for? forEach?
@spiral fractal
Good day, I am new here and in Arma 3 Scripting. I would like to ask help in regards to the MP mission I am trying to make.
I am trying to add a custom loadout for a medevac vehicle's cargo, by putting this addItemCargoGlobal ["ACE_fieldDressing", 50]; on the init field of the vehicle.
Also I put this setvariable ["CS_TYPE","CAS"]; in the init field of some of the vehicles I placed to include it as the ALiVE Combat Support, and since I am using VCOM AI I also added this setVariable ["NOAI",1,false]; into the units init fields of the combat support, following the ALiVE's FAQ. (http://alivemod.com/wiki/index.php/FAQ)
Every time I run my MP Mission, it loads initially and then loads a 2nd time, I'm not exactly sure why, but it respawns these vehicles and cancel out the scripts I've put in them, rendering all of it useless.
Here's a 5 min. video I recorded to show what I am trying to say. https://youtu.be/3nxOfavKnBY
I've been trying to figure this one out myself by trying to execute the scripts at a delayed time but with my skills, I don't think I have the capability to do it. I feel like I've reached a dead end.
I'm sorry for a long post, I just wanted it to be detailed and clear. But thanks in advance if someone manages to help me.
Edit: I have ACE, ALiVE, MCC, RHS, VCOM AI(Script).
@simple moat dont do ".." for showing code, look at pinned message. need to structure it using `
makes it much easier to read
@simple moat dont do ".." for showing code, look at pinned message. need to structure it using `
@surreal peak My bad, I didn't know how to do it.
np, you dont need to repost it, you can just edit your current post to update it
np, you dont need to repost it, you can just edit your current post to update it
@surreal peak Will do. Thank you. 🙂
@simple moat what does it loads initially and then loads a 2nd time exactly mean? Do you start the mission twice or do you start the mission, it stops and restarts?
@simple moat what does
it loads initially and then loads a 2nd timeexactly mean? Do you start the mission twice or do you start the mission, it stops and restarts?
@round scroll As seen on the video, I get into the lobby > briefing (map) pressed continue > loads into the game, then couple of seconds later another loading screen pops up and loads something and once finished it respawns the vehicles in some way and all the scripts no longer work as if the vehicles are back at its default state w/o the scripts.
@simple moat looks quite weird, can you run the mission without alive and also in another test without vcom to rule out that one of those mods respawn the vehicles?
@round scroll I did, I tried it by putting the modules one by one and a version without the VCOM AI, it actually worked but I think what causes this is the AI modules of ALiVE which I need.
In my assumption, the 2nd loading screen initializes all the scripts coming from the loaded modules, ALiVE in particular to recognize the objective placements such as towns and military bases and to start spawning AI. That's my guess, so I think I definitely need that to occur, only thing I need now is to either have a script stopping the vehicle to respawn or have the scripts in the vehicles to execute at a latter time, prolly after the 2nd load.
if it's Alive, then your best bet is to check out alive.com website and their wiki for a solution
if it's Alive, then your best bet is to check out alive.com website and their wiki for a solution
@round scroll I'll give this a go. Thanks.
Is it possible to use modified Arma functions in a custom mission without forcing all players to download/install anything before playing the mission?
Good day, I am new here and in Arma 3 Scripting. I would like to ask help in regards to the MP mission I am trying to make.
@simple moat I have found the culprit that is making my problem. I found out that the ALiVE Virtual AI system profiling is doing it, so I switched it off and everything is now working.
Thank you for all the suggestion and help.
I gave a string "64 + 128" and I want to turn it into a number that I can feed into the bitflag function. However since it's a string I cannot do that.
How can I get what number is in there? It can be individual numbers or the sum, either is fine.
I tried the call compile but I don't quite get how to use the resulting code
derp, I forgot to actually put in the call before the compile, call compile "64 + 128" returns the proper sum
Hey! for scripting with ace, is there a list for all the commands and scripts ace has?
@proud carbon https://google.com/search?q=arma+3+ace+functions 🙄 ?
ACE doesn't add any command, only functions.
anyone know a way to get userTexture to be flat on the ground and NO 'setvector' doesn't work
The Nimitz sports a populate carrier script, which places F/A-18E/F aircraft or other planes on the Nimitz at parking positions. For the F/A-18E/F I check the classname (JS_JC_FA18E and F) to set specifics textures for different carrier names (E.g. Nimitz has different squadrons than Roosevelt than Reagan and so forth). Now the beta of the F/A-18E/F sports different textures and I'm wonder if there's a smart way to support both versions. Probably checking for the contrib squads in CfgPatches (JS_JC_FA18_CONTRIB_SQUADS2019 and such) ?
How can I override function from mod?
no can do
?
you cannot
why?
safety reasons
can I disable it then?
nope
what is that??
nope = no
I mean why its blocked, where is Duda?
who is Duda?
Duda is the creator of advanced sling load mod
More of a question if its a function you don't want just // it out in the files? lol
I mean why its blocked
safety reasons
if BE is off, its still impossible?
server has it and I am not an admin...
¯_(ツ)_/¯
@spiral fractal so you are not the adminn of a server and you want to disable a server side mod?
…see how it could be a security issue?
Advanced sling load mod cant lift wrecks, I made some changes to allow lifting wrecks
did you edit the config or make a script for it?
I paste the edited function to debug console and it "override" it
I want to make it work without additional actions
look:
- the server you don't own nor manage uses a mod of which you are not the author
- you are trying to override a server-side mod behaviour
simply, drop it - if you want to edit the mod, ask the mod author
if there are certain settings that need server administration, ask the server owner
all the rest is copyright infringement or hacking
What Lou said, the solution I gave is a bit of a grey area, and does require achilies to work. Also requires you to be zeus
https://github.com/sethduda/AdvancedSlingLoading last edit 4 years ago...
I get it - it's frustrating
that doesn't make it more valid
and if you somehow manage to find a way to execute code without being admin/ server owner. BIS would be very interested
I thought that because the mission executed by the server it will have more "rights" to execute code
it is not doable - let's close the topic now.
@spiral fractal simple question here.. are you trying to change a function for your OWN server or a 'server' you play on..
Advance sling license agreement is
The MIT License (MIT)
Copyright (c) 2016 Seth Duda
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
what I understood from it is that I can modify it
let's close the topic now.
@urban tiger
@spiral fractal edit the script as the license allows you to (so INCLUDING CREDITS), and run your own server with it.
@winter rose My apologizes my post was 5 seconds after.
BIS would be very interested
I dont think BIS would be that interested, but BI propably would be@surreal peak
Nop, BIS is BISim
ahhh
as in Bohemia Interactive Simulations, a now seperate and autonomous studio
BI was BIS
BIS was BIA
they make stuff like VBS
BIS → BI (Bohemia Interactive)
BIA → BIS (aka BISim)
so why are the functions still BIS_? Is it just cause they dont want to change all of them
Havent heard BIA mentioned before
Ah okay
they have a place in Australia? Never realised that
They had, thats BIS now
they did as they split, but it's more #offtopic_arma now
Also yeah if you changed all the BIS functions to BI functions you'd break lots of scripts that arent being worked on anymore
now we even have BIN_ prefix (BI Netherlands I assume), "thanks" to Contact…

That's painful for the wiki okay??
Dedmen, do something from Germany and make it BIG_ 😄
A few weeks ago already iirc
I don't count the weeks
he found a way to change his avatar colour, then they hired him
damn, GZ to him. MAKE BIG_

what about you Lou? I always see you on here helping out people
I help people for free, I don't see why in their right mind they would send me monies for that 😄

but I can hold help code hostage until all of ya send me Paypalz 👀 😅

Oh god dont give Dedmen the idea of starting a 1-man BI division in germany, he's gonna do it and go down to max 1 hour of sleep a night
sounds like 1 more hour of sleep than he usually gets
like he needs sleep anyway

Which scripting related question: Whats the name of the software you can use to make sure your code doesnt throw errors at you so you dont have to constantly go to Arma to check
sometimes brain.exe crashes and doesnt look for a single , hecking me over
@queen cargo made a wonderful SQF-VM that allows for proper debugging
other debugging code tricks and tools can be found at https://community.bistudio.com/wiki/Debugging_Techniques
https://github.com/SQFvm/vm This thing?
looks like it
Looks like it
thanks, will give it a shot
SQFVM, or a linter. There is a linter thing extension for VSCode
That would catch the missing commas/semicolons
Theres also a style set for Notepad++ for simple stuff
got the notepad++ one, has saved me many hours of my life
style will show you missing string quotes, but no semicolons n stuffz
"skacekachna.sqflint",
"armitxes.sqf"
Yep, these are the extensions for VSCode altough new scripting commands are missing
and they don't prevent my coding errors
Hey guys, little trouble with a teleport script. During testing it seemed to teleport all players rather than just those within the trigger.
player setPos _pos;```
because player yes
I believe your trigger is configured as "once triggered, move player there"
you should teleport units in thislist
Yea I thought that might have been the case.
So;
thislist setpost _pos;
will do what I need?
nope.
Sorry not 100% with this stuff
{ _x setPos _pos } forEach thislist
something like
players in thisList setpos _pos; no?
thislist is probably an array so you would need to foreach setpos Lou!
ah
Ok, thanks @winter rose
Oh, second question.
Say player B moves into the trigger 30 seconds after player A, would they both teleport when it fires after player A started the timer?
Does the script fire when the timer is triggered or after the timer ends?
It will teleport every player that are in the zone at the moment of the script execution
as in when are people teleported, since it'll teleport every player that is in the trigger area when its executefd
Also hi @oblique arrow !!
It's currently on 'countdown'. So will activate when Any player is present

(With a timer)
you should come join us on almonds discord
So I am correct in thinking that after X time, "on activation" fires, which will teleport anyone present?
Well there's an invite to mine (mostly empty
But ye as Heyoxe said it'll teleport every player that is inside thisList (so the trigger area) when that script line is executed
therefore, you could make the trigger player-side (not server-side) and have in conditions ```sqf
this && player in thislist
Nah I want all players in the trigger after X time (it's a reinsertion after death).
I've been fiddling with a whole bunch of stuff, but looks like I was starting to think too complicated for a simple thing.
the hardest part in coding is simplifying, indeed
Hello guys, I'm back again for another scripting question.
I am trying to remove the vanilla fatigue on my MP mission so that only ACE fatigue works once its initialised, because the gun sway is affected when player loads due to the player being encumbered and the gun sway stays with the ACE Fatigue when the mod is initialized.
I have added this script on my initPlayerLocal.sqf
_unit = _this select 0;
_isJIP = _this select 1;
if (!_isJIP) then {
_unit setFatigue 0;
_unit enableStamina false;
};
if (_isJIP) then {
_unit setFatigue 0;
_unit enableStamina false;
};```
But I don't think it's working... Any suggestions?
if something do X
if not something do X
why not "just do X"?
I think ACE fatigue should be disabling vanilla fatigue on its own, atleast that would be a logical thing to do
I think ACE fatigue should be disabling vanilla fatigue on its own, atleast that would be a logical thing to do
@still forum True, but initially when the game loads the modules takes time to initialise. And since my Medic loadout has a lot of stuff in the inventory, it makes the character encumbered, so when the missions loads my medic character will be fatigued and have so much weapon sway, until the ACE Fatigue kicks in, then fatigue becomes fine but the weapon sway stays.
Because in my understanding, when the mission loads all vanilla settings kicks in and you can move your character and then couple seconds later the mods initializes, then ACE kicks in and replaces the vanilla settings.
can a Simple Object be added an Event Handler? 🤔
can a Simple Object be added an Event Handler? 🤔
@winter rose I don't know, since I am a rookie when it comes to scripting in Arma. That's why I only tried the most straight forward way of doing it by putting those scripts but it isn't working.
I just want to disable the vanilla fatigue so that when mission starts and player joins in, the vanilla fatigue won't have any effect on the characters until the ace kicks in. That's why I put it in both ```sqf
if(!_isJIP) {};
if(_isJIP) {};
That's why I put it in both
both doesn't make any sense tho
both doesn't make any sense tho
@still forum I see. I just thought that, all players joining in servers has that buffer time for them to initialize mods whether their JIP or not. Meaning the ACE system won't take effect until that happens.
But the thing is, the script is not working whether I put it in init.sqf, initPlayerLocal.sqf or initPlayerServer.sqf. which is weird.
and you're not too heavy for ace fatigue?
can a Simple Object be added an Event Handler? 🤔
apparently, nope
and you're not too heavy for ace fatigue?
@still forum Nope, it drains the stamina, but I still start at full at least compared to the vanilla fatigue wherein it doesn't even allow the character to walk until the ACE Fatigue kicks in.
apparently, nope
@winter rose I see, although I don't really understand what are "Simple Object" and "Event Handler" does, since I'm not that familiar with all the scripting stuff. Still trying to learn it.
it was a question, I answered myself 👍
how can i turn the following into an array of doors to lock for civilians
if (!isDedicated && {playerSide == civilian}) then {this setVariable ["bis_disabled_Door_1", 1, false];}
iv tried
if (!isDedicated && {playerSide == civilian}) then {this setVariable ["bis_disabled_Door_1", "bis_disabled_Door_2", "bis_disabled_Door_3", "bis_disabled_Door_4", "bis_disabled_Door_5", "bis_disabled_Door_6", "bis_disabled_Door_7", "bis_disabled_Door_8", 1, false];}
&
if (!isDedicated && {playerSide == civilian}) then {this setVariable ["bis_disabled_Door_1", 1, false];}
if (!isDedicated && {playerSide == civilian}) then {this setVariable ["bis_disabled_Door_2", 1, false];}
//and so on up to door 8
non of those work im not good with arrays
if (!isDedicated && {playerSide == civilian}) then {
{this setVariable [_x, 1, false]} forEach ["bis_disabled_Door_1", "bis_disabled_Door_2", "bis_disabled_Door_3", "bis_disabled_Door_4", "bis_disabled_Door_5", "bis_disabled_Door_6", "bis_disabled_Door_7", "bis_disabled_Door_8"];
};
when I delete vehicle that has attached object what happens to that object?
it unattaches itself iirc
its seems like it
Any function to kick players to lobby different from failMission, endMission and forceEnd??
If anybody can tell me what's wrong with my string... I'm trying to set several activation statements for the same trigger without using the Eden interface: sqf triggerActivated capboss; bcuff=(boss getVariable ["ace_captives_cargoindex", false]); capboss setTriggerStatements ["bcuff !=-1", "titletext [""Hard to believe, but we did it. Let's go home Alistaire."", ""PLAIN DOWN"", 5]" + "titleFadeOut 2" + "playSound [""p6"", true]", ""];
The engine doesn't like my "+", but I can't find another way to concatenate the strings
syntax error
Why even concatenate at all?
I don't see any reason to concatenate?
just put all in a single string?
maybe then you'll also see what you did wrong, try it
@high horizon …why?
@still forum Arghf you're right. The activation statement is a single string...
Thanks
Uh
with the + you also had a single string
you were just missing the semicolons, and the + didn't really make sense
and btw you can just use single quotes inside strings
instead of having to ""
This works:
sqf bcuff=(boss getVariable ["ace_captives_cargoindex", false]); setTriggerStatements ["bcuff !=-1", "titletext [""Hard to believe, but we did it. Let's go home Alistaire."", ""PLAIN DOWN"", 5]; titleFadeOut 2; playSound [""p6"", true]", ""];
I put double "" because I have quotes in there originally
"If you want to include double quotes (") in strings enclosed by double quotes, the inside double quotes have to be written twice.
_string = "my string ""with"" quotes"
_string2 = 'my other string "with" quotes'"
This would also work
"titletext [""Hard to believe, but we did it. Let's go home Alistaire."", ""PLAIN DOWN"", 5];" + "titleFadeOut 2;" + "playSound [""p6"", true]"
or this
"titletext ['Hard to believe, but we did it. Let's go home Alistaire.', 'PLAIN DOWN', 5]; titleFadeOut 2; playSound ['p6', true];"
I see 👍
Guys, any way to simulate a key stroke locally via script either natively or via CBA or something?
real keyboard stroke no
So if I want the player to salute I will have to use the playAnim "_anim" option?
I wanted to simulate the key stroke (salute) because the keystroke already deals with sending the animation to all other clients
Now I will have to remoteExec the switchMove
its a gesture afaik
Does anyone have a smarter way of doing ```sqf
_cardinalDir = switch (true) do {
case (getDir player <= 22 || getDir player >= 348): {"north"};
case (getDir player <= 347 && getDir player > 303): {"north west"};
case (getDir player <= 302 && getDir player >= 248): {"west"};
case (getDir player <= 247 && getDir player >= 203): {"south west"};
case (getDir player <= 202 && getDir player >= 158): {"south"};
case (getDir player <= 157 && getDir player >= 113): {"south east"};
case (getDir player <= 112 && getDir player >= 68): {"east"};
case (getDir player <= 67 && getDir player >= 23): {"north east"};
};
getDir player <= 302 && getDir player >= 248
That range is incorrect, thats 54, not 45
_cardinalDir = ["north", "north east", "east" , "east", "south east", "south east", "south", "south", "south west", "south west", "west", "west", "north west", "north west", "north", "north"] select (((getDir player)/45-0.5)*2)
meh could be better, the duplicates are crap because the north thing.. But probably..
Do you guys think this fnc could fix the current bug where for EDEN EDITOR placed Ai units who were edited with the EDIT LOADOUT option disable the player's ability to pick up their weapons?
`vAiInventoryFix = { // Potential fix for the bug where players can't pick up items from Ai units equiped via EDEN EDITOR EQUIP UNIT OPTION.
params [
["_editorPlacedAiUnit", objNull, [objNull]]
];
if !(Local _editorPlacedAiUnit) exitWith {};
if (isPlayer _editorPlacedAiUnit) exitWith {};
[_editorPlacedAiUnit, [_editorPlacedAiUnit,name _editorPlacedAiUnit], [], false ] call BIS_fnc_saveInventory;
_editorPlacedAiUnit spawn {
sleep 2;
[_this, [_this,name _this]] call BIS_fnc_loadInventory;
};
};`
I know that manually removing and re adding the items via script works in fixing the issue but perhaps BIS_fnc_loadInventory does exactly that
_cardinalDir = ["north", "north east", "east", "south east", "south", "south west", "west", "north west", "north"] select ((getDir player)/45-0.5)
try this @tough abyss
Ok I accept the indifference 😔
@winter rose https://feedback.bistudio.com/T150415
thanks
I didn't know about this one. is it about "loading a custom loadout" or simply editing the loadout?
Editing the loadout via Eden is enough to cause the bug
Doesn't happen for all players and certainly not for the host/server
I am not entirely sure it happens just for the EDEN edited units, I believe it could happen for any unit placed via EDITOR even if you did not customized his LOADOUT
Can be pretty game breaking for the players suffering from it
maybe for player-hosted missions? I could see a locality issue
as for the original question "could it fix the issue", well… hard to tell given the (lack of) info.
I guess the main issue is that repro is not 100% sure...
as for the original question "could it fix the issue", well… hard to tell given the (lack of) info.
@winter rose I was actually trying to know if that BI func was doing the whole
removeBackpackGlobal player;
player addBackpackGlobal _backpackClass;
etc etc
I mean, units that get their loadouts via script do not suffer from this it seems
BIS_fnc_loadInventory is removing all items/gear and putting new items/gear back to unit
you can check function's code in the Functions viewer too
can player 2 see the items, but not take them?
player 2 can see the items, interact with them even
but moving for example the ai's primary weapon to their inventory (primary weapon slot) will cause the inventory to be bugged
Now player 2 is unable to pick up weapons nor drop his
droping his bugged primary weapon results in it being duplicated on the ground
ah well, I can't say much more about solving that - besides perhaps
@still forum thanks for the help but it seems like I can't find any smart solution that would be as accurate as the ugly switch. I've looked in different libraries and a lot of people come up with similar solutions as yours but they're off by at least a couple of degrees if not in the double digits.
@tough abyss what are you using that fnc for?
Getting a cardinal direction from bearing. IE [getDir player] call fnc_degree2Cardinal
more specifically for ATC chatter when AI is flying planes
@tough abyss I use this for my 3D compass and it is accurate in getting true cardinal directions onEachFrame:
if (alive player && "ItemCompass" in (assignedItems player)) then {
_infrontDistance = 1;
_compassRadius = 0.25;
_cameraPos = AGLToASL positionCameraToWorld [ 0, -0.5, 0 ];
_compassCenter = _cameraPos vectorAdd ( getCameraViewDirection player vectorMultiply _infrontDistance );
{
_x params[ "_text", "_dir", "_size", "_color" ];
AGLToASL( _compassCenter getPos[ _compassRadius, _dir ] ) params[ "_offsetX", "_offsetY" ];
_offsetPos = ASLToAGL[ _offsetX, _offsetY, _compassCenter select 2 ];
drawIcon3D[
"",
_color,
_offsetPos,
1,
1,
0,
_text,
0,
_size,
"PuristaMedium",
"center",
false
];
if (_x select 3 isEqualTo [1,1,1,1]) then {
drawLine3D[ ASLToAGL _compassCenter, _offsetPos, [ 1, 1, 1, 0.2 ] ];
};
} forEach [
[ "N", 0, 0.07, [1,1,1,1] ],
[ "ne", 45, 0.05, [1,1,1,0.5] ],
[ "E", 90, 0.07, [1,1,1,1] ],
[ "se", 135, 0.05, [1,1,1,0.5] ],
[ "S", 180, 0.07, [1,1,1,1] ],
[ "sw", 225, 0.05, [1,1,1,0.5] ],
[ "W", 270, 0.07, [1,1,1,1] ],
[ "nw", 315, 0.05, [1,1,1,0.5] ]
];
};
Perhaps you can adapt it to your needs... and to Ais because this is currently for players
you can use
```sqf
/* your code */
hint "Amazing!";
```
to get a better code block:
/* your code */
hint "Amazing!";
😉
@tough abyss does my version. Not work?
You are splitting up into 45° sections. So you can totally math it down like I did.
My test cases all looked fine
And if you want "rough" cardinal directions, why does one or two degrees off matter?
Your switch case is also wrong, like I told you.
All sections should be 45° but for some reason you have a 54° in there
@still forum Yeah I mixed ut 4 and 5 there, fixed that after sending it. Putting it all at 22.5+45 indefinitely was the most accurate solution as of yet for me.
private _strDir = switch (round getDir player) do
{
case 0;
case 1;
case 2;
(...)
case 23: { "North" };
case 24;
case 25;
case 26;
(...)
};
Need to have default or true will be returned if no match is found
true dat - after that, best code ever
anyone know a way to make a trigger be 'very' accurate as in ONLY if the unit is inside. weird as that is to say. but ive noticed even if i make the trigger '1m' and attach it to a unit, it will still trigger when the player is outside of it.
@urban tiger sorry, what?
Yes it confusing to even explain lol
So if i make a trigger that is say '5m by 1m' and attach it infront of the unit. It will sometimes cause the conditions of the trigger to happen when im not actually in the trigger yet.
using attachTo?
yep
maybe the trigger's simulation is slow and updating every 0.5s or so, check with a hintSilent position trigger
if the unit moves, the trigger may lag behind
Yeah i think its just a weird bug in the engine.
if i make the trigger 0.5 its 'more' accurate at 1m. weird
actually i think ive found why.. the trigger 'size' are not in meters
image showing triggers are not in meters: https://i.imgur.com/ZCNo1Gm.png
Trigger size is in metres
then the classnames are wrong?
What class names
look at the image KK
Tell me what Im looking at
I think he means 5m fence is not actually 5 meters
that wall is defined as '5m' same gones for the '1m' cube however if i placed 5 1m cubes, and move them in increments of 1m in eden
Do you realise that trigger A B and C are half sizes, so A 5 will make it 10 m wide
so what i just said? lol
Don’t know
if i make the trigger 0.5 its 'more' accurate at 1m. weird
You said many things, one of them is that sizes are not in metres, they are
ive moved five 1 metre boxes and moved them in increments of 1m. and you have this https://imgur.com/a/fCOhcvj that.
So to have a trigger as 5 its actually 10m. not '5m'
Yeh its fine, just that triggers are tooltipped as 'area size' not "radius"
Do you realise that trigger A B and C are half sizes, so A 5 will make it 10 m wide
Can anyone tell me why this isn't showing both the 3D icon nor the markers:
vPARAMS_3Dhelpers = 3;
v3Dhelpers = {
vWoundedMarkers = [];
if (vPARAMS_3Dhelpers > 0) then {
addMissionEventHandler [ "EachFrame", {
if (diag_fps > 15) then {
{
if (side _x isEqualTo side group player && {alive _x} && (_x distance player < 500) && (lifeState _x isEqualTo "INCAPACITATED")) then {
private _dist = (player distance _x);
private _color = [1,0,0,1 - (_dist / 200)] ; // COLOR RED
drawIcon3D [
'a3\ui_f\data\revive\medikit_ca.paa',
_color,
[
visiblePosition _x select 0,
visiblePosition _x select 1,
(visiblePosition _x select 2) +
((_x modelToWorldVisual (
_x selectionPosition 'body'
)) select 2) + 0.28 + _dist / 4.5
],
0,
0,
0,
"WOUNDED " + name _x,
2,
0.033,
'PuristaMedium'
];
//Wounded Marker
if (count vWoundedMarkers > 0) then { {deleteMarkerLocal _x} forEach vWoundedMarkers;};
private _marker = createMarkerLocal ["vWoundedMarker_" + format["%1",_forEachIndex], position _x];
vWoundedMarkers pushBack _marker;
_marker setMarkerShapeLocal "ICON";
_marker setMarkerTypeLocal "hd_join";
_marker setMarkerTextLocal ("WOUNDED " + name _x);
_marker setMarkerColorLocal "colorBLUFOR";
};
} count playableUnits - [player];
};
}];
};
};
[player] call v3Dhelpers;```
…not reading that indentation Oo
Cannot do better because of Discord 2000 char. limitation
https://sqfbin.com paste indented there and gib link 😉
@winter rose https://sqfbin.com/igatepuhocivogopaden
I see a { } count playableUnits - [player]; 
Can someone help me with setPylonLoadout
whenever I use this the old weapon remains in the list for the vehicle with 0 ammo - how do i make it go away so only the weapons that are actually on the vic are present in the list
i have been googling this for 5 hours now
I have only come here because I couldn't find my answer there
@wind hedge https://sqfbin.com/hotonasinedusoroboli better 😛
and what does it show and not show?
@potent granite show us what you got! 🌞
it shows a 3D icon over incapacitated playable units and also a marker
@wind hedge https://sqfbin.com/hotonasinedusoroboli better 😛
@winter rose still doesn't work
I just changed the indentation and count → forEach
it shows a 3D icon over incapacitated playable units and also a marker
isn't it what you want?
@winter rose
here is a video of what im talking about - you cane see my custom pylons are present but the default pylon weapon is still in the list with 0 ammo
https://www.youtube.com/watch?v=f7GXFuVfSuA&feature=youtu.be
isn't it what you want?
@winter rose That is what I want but it is not working at all
in the init of the vehicle (for testing purpose and then will be moved to sqf using _this)
this setPylonLoadout ["Pylon1", "FIR_Hydra_M247_P_19rnd_M",false];
this setPylonLoadout ["Pylon2", "FIR_SUU23_P_1200rnd_M",true];
[["RHS_UH1Y"], {_this setPylonLoadout ["Pylon1", "FIR_Hydra_M247_P_19rnd_M",false]; _this setPylonLoadout ["Pylon2", "FIR_SUU23_P_1200rnd_M",true];}],
@winter rose ^
@wind hedge do you use show script errors?
(I am leaving for tonight though 🌜 beep me in 10h)
Also, you are creating/deleting markers every draw, I am not sure this is a great thing
Oh! Also, you are using modelToWorldVisual altitude, where drawIcon3D takes AGLS @wind hedge
so your icons must be high up in the sky 😄
Yeah I wouldn't add a marker creating/deleting on each frame, maybe on the mapdraw / howerer it's named but each frame is useless
we love them burn
but please stay ontopic and keep illegal content out of this Discord
still offtopic...
anyone have any idea how to change
if ((_vehicle isKindOf "Tank" || _vehicle isKindOf "TrackedAPC") && _special isEqualTo "FORM") then {
_pads = nearestObjects [getPos _vehicle, [_pad_heavy], 200];
// _pads = nearestObjects [getPos _vehicle, [_pad_heavy], 200];
_pads = [getPos _vehicle] nearObjects ["_pad_heavy", 200];
im trying to make it use near objects instead of nearest
but i cant seem to get it to work
bottom part is what i tried changing to to
_pads = (getPos _vehicle) nearObjects [_pad_heavy, 200];
ok thanks ill give that a try
Anyone know the difficulty config setting equivalent of enableStressDamage?
yes that command equivalent
hmm not seeing an example of that in wiki. Do you have a link?
yea, its for the old difficulty configs though, so i dont think it is any use now.
so then does anyone have any experience with enableStressDamage command ? I could not make it work.
I assume you have enabled AFM... so isStressDamageEnabled should return true.
tbf... I haven't played with AFM a lot, especially not in a scripted way. But the only thing I can think of is that the vehicle doesn't support RotorLib itself, meaning it will still use the default behaviour.
Unless the function is broken, although in that case the settings should work.
@robust hollow worked! thank you!
Question: can inline functions go outside the scope of an SQF file they are defined in?
Short answer, yes. Are the inline functions defined by a global variable? For example you want to call on function defined in one script from another function defined in another?
There is no actual function in sqf
There is the code data type, that can push scopes in conjunction with call and etc.
For example you want to call on function defined in one script from another function defined in another?
No, that is exactly what I want to avoid. I just want the inline function to exist only in the SQF file it's defined in.
It does not matter now as I decided to make a proper function from that inline one
Private _whatever = code
^
I found a post on Reddit from about 4 years ago about changing the horn sound of a vehicle. I tried using the script in the comments, but it only disables the horn, instead of playing the sound I put in it.
Would someone be able to help me with this? Here's the Reddit post I found: https://www.reddit.com/r/arma/comments/4e47no/scriptinghelp_car_horn/
Is it because I'm using an .ogg? The comments mentioned a .wss filetype.
hey, so i just started to script and im running into an issue
im in the Eden editor and editing the "init" section.
basically if someone has a laptop in thier inventory, I want an action to pop up,,,heres what i got and it doesnt seem to work
if ("Item_Laptop_closed" in items player) then {
player addAction ["Download Intel", {}];
};
ah ok. i see thgat now. lets see
just make sure to fill the previous arguments correctly for your case
player addAction ["Download Intel", {if ("Item_Laptop_closed" in items player) {};}]
i dont think thats right lol
object addAction [title, script, arguments, priority, showWindow, hideOnUse, shortcut, condition, radius, unconscious, selection, memoryPoint]
player addAction [“Download Intel”, “your code.sqf”, [], 1.5, true, true, “”, “‘Item_Laptop_closed’ in items player”]
ahh, ok, see i thought that if theyt were optional, like command line, you could omit them
thank you
So I am trying to make a training arena, or some type of area with less than lethal, or blanks. I saw a BAF (British Forces) mod with weapon BFA's (Blank Firing Adapters). How would I script in, or create a BFA for weapons in game?
odd we have the same name
@plain linden Noice. Lmao I might change it soon
yeah lol
anyway @fallow gazelle modded adapters can change a weapon damage, they probably modify weapons to have 0 damage
you can use the handle damage event handler to remove any damage
@spring lodge Is that done in Eden Editor?
Nah, scripted
is there a way to add multiple amounts of the same object with addItemToBackpack
How would I start with that? Or are there any tutorials online for editing damage in game?
I've read that I could do addItemToBackpack [ "GrenadeHand" , 20 ];
would that work? nevermind it doesnt
@spring lodge
sadly didnt work
I dont have a script to run yet, so im just trying to make it pop up
This is what I have
player addAction ["Download Intel", "", [], 1.5, true, true, "", "'Item_Laptop_closed' in items player"];
I go to the drone without the laptop, it doesnt show...thats good
I pick up the laptop, go back to the drone..it still doesnt show
Is the class name correct?
checked from cfgMagazines
arma isn't giving me any error
but even if I try adding 1 it doesn't give me
so not sure
when i hovered over the laptop in the eden editor thats the name it gave me
Ahh the problem is items
It returns special items, so like your compass, watch etc
Not what is in your inventory
AHHHH
Lmao
i thought that was assignedItems that was for those special items
‘Item_Laptop_closed’ in ((vestItems player) + (uniformItems player) + (backpackItems player))
I’m honestly not sure what the difference is
same
weird, when i load in, it keeps saying "invalid number expression"
player addAction ["Download Intel", "", [], 1.5, true, true, "", "‘Item_Laptop_closed’ in ((vestItems player) + (uniformItems player) + (backpackItems player))"];
and still no dice
so apparently I can't add grenades to inventory
the classnames seem correct
and it does work for chemlights
but I can't get neither RGO and RGN
maybe i have to assign a variable to the player?
@smoky verge code…? also, has enough storage space…?
it does have space
code is
player addmagazine "GrenadeHand";
which doesnt work
but
player addmagazine "Chemlight_red";
does
btw congrats for the profile
thanks
it's "HandGrenade"
GrenadeHand is what is throw iirc, the bullet itself
they should fix the biki cfg magazines then
what about the mini_Grenade
that doesnt work either
take the FIRST COLUMN class Oo I mean
HandGrenade
MiniGrenade
@smoky verge you don't addMagazine "B_65x39_Caseless", you addMagazine "30Rnd_65x39_caseless_mag" 👀
oh completely didn't notice
took the chemlights as reference
which have it identical
That's a paddlin'
The chemlights through me once off as well 😄
I like the singleplayer death screen alot but if I use it in a multiplayer mission everyone would need to abort the mission and rejoin every single time they die.
I think I have found the singleplayer death screen function under P:\a3\functions_f\respawn\fn_respawnnone.sqf.
Can someone tell me how I would need to modify the code of this function so that I can use it in a onPlayerKilled.sqf script?
My mission has the respawn type 3 ("BASE") so what I hope to achieve is that when you die the score board appears (just as it does by default) but in the background you would have the "singleplayer death screen" (with KIA:, ENY:, TOD: etc.) but without the "Team switch"-, "Abort"-buttons etc. in the bottom left corner and after the respawn delay is over the "singleplayer death screen" would disappear and you would just respawn like you would normally do without the need to abort the mission. Basically an imitated singleplayer death screen.
Sadly I don't really understand this function exactly so I would really appreciate your help.
@wind hedge got it working?
I have function that run on the server, it is called inside init_server.sqf and run in loop, it moves marker using setMarkerPos command, do I have to use remoteExec to see the marker position updated as player?
@teal mirage you could also be banned for promoting illegal content (and language), too
I recommend you to read our #rules
@spiral fractal setMarkerPos is global.
the f in lmfao
when getting familiar with the Virtual Garage I stumbled over https://community.bistudio.com/wiki/BIS_fnc_initDisplay and the CfgScriptPaths setting. Is this CfgScriptPaths used anywhere else? Not sure I fully understand the idea behind it
@delicate lotus but for some reason I dont see the marker pos updates
this includes harassment, name calling, racism, sexism, homophobia, other derogatory remarks (profanity) or any insults.```indeed
profanity does not mean insult.
thanks, Dedmen
@spiral fractal How do you call the function?
!mute @teal mirage 7d
Silence!! ò_ó
...
I keel u, @teal mirage!! Ò_Ó
got your back
Thanks for muting him
@spiral fractal Can you show me a snippet or the whole function where you call setMarkerPos ?
is there faster way to test mission or dedicated server?
I want to check for a variable to be true in a condition of a userAction. Should I add the variable to the object in question ((this getVariable 'ttt_nimitzParent') getVariable ['ttt_nimitz_hangarGarage', false];) or rather go with a global variable ttt_nimitz_hangarGarage ?
better with the object variable, let's not "pollute" mission namespace
also, what if you have two Nimitz ^^
yes, that's the reason why I moved all the old global variables into the object namespace originally, thanks for reminding 🙂
the closest, the bestest
there isn't any way to use keyframe animation on a walkable unit is there?
they would be floating I think
once its played if the unit is alive they just stand still doing a weird shuffle. once the unit is dead they'll slide along to floor like super man 😂 Although it seemingly works fine in the editor minus the walking animation. Best to use BIS_fnc_UnitCapture; for accurate patrolling?
nope, it is meant for aerial vehicles
shame, guess ive got to do the old school way of lots of 'setpos' with unitcapture and a while loop doing a walking animation
it depends on what you want to do yes
just accurate repeatable patrols. that have the same path every time.
waypoints?
I gotta a error with dialogs, it says Resource not found, they are on a .hpp defined on desc.ext and inside that .hpp there is another dialog working
Any solution? quite weird
Hosting an MP game from client, at start the camera is stuck like this and escape menu doesn't open, only game restart helps.
Also once in a few minutes the game shows this message in rpt:
13:43:50 Unit 0:0 not found, cannot update
https://cdn.discordapp.com/attachments/684459680810270750/704617803327602738/unknown.png
Any idea how I can debug what's causing this? How is it even possible with a script? 😮
I've found that IFA Liberation ACE is causing this, specifically ifa3_ace_placeables.pbo, but it has nothing special in it, it just adds some ACE interaction entries, I don't understand 🙈
@winter rose waypoints are not accurate when doing very tight movement where they hit the same point every time. think of it as 'cinematic'
\o/
not going to lie, you got me a strong flashback vibe here!
also got the animated background on the floor and walls nicely!
I got the music in my head now… thanks
I'm remaking all the music too 😂
Nothing else to really do during lockdown, i can automate all my work remotely. so decided to get back into modding on arma, granted i've gotten very rusty since 2015...
I gotta a error with dialogs, it says Resource not found, they are on a .hpp defined on desc.ext and inside that .hpp there is another dialog working
@high horizon Anyone?
it might not be a #arma3_scripting matter @high horizon
you should show your config and script here, and if it is not a scripting issue you are banned go to #arma3_gui for config help 🙂
why are you tagging yourself?
Discord's quote function does that
He's just bumping, just as he does in my DMs, and on feedback tracker
it might not be a #arma3_scripting matter @high horizon
you should show your config and script here, and if it is not a scripting issueyou are bannedgo to #arma3_gui for config help 🙂
@winter rose Yep true, i always forgot it sorry
and don't bump so frequently as said above ↑
anyway I'm trying to detect if all pop up targets are down at the same town
I'm not sure how to do that since there is no way (to my knowledge) to detect the animation status of an object
really?
maybe I like the paddle


anyone can help me?
so as I've understood Animation Phase returns somewhere a value between 0 and 1
how can I use that value inside a trigger for example?
place code inside the condition field?
if I do that how would the trigger know what value to activate to?
oh so I can specify which value to have
something like
if
target animationPhase ["terc", 1];
then
because the syntax in the biki just says
object animationPhase animationName
so not sure if the above is correct
and returns a number, which you can just compare to 0 or 1
e.g animationPhase > 0.5
please read correctly ;)
_building animate ["maindoor",1]; // <--- animate
_p = _building animationPhase "maindoor"; // <--- animationPhase
it would be better to use animationSourcePhase though 👀 🙂
oh didn't copy from that
just though it would be the way to specify the phase
do you want to set it, or get it…
I want to use it as an activation trigger for a script to run
so I think it would go
target animationPhase "terc" == 1;?
^^ that will return true when target is down
exactly what I need
McThankies from Mcspankies
oh ok thanks
last thing
is there a way to have multiple Vnames inside the object parameter?
so I'll just have to make a bunch of &&
yes
better than nothing I guess
could be some sort of forEach check could be done
[target1, target2] findIf { _x animationPhase "terc" < 0.99 } == -1
And if you only care about all targets being down, you could probably do something like (_trg1phase + _trg2phase + ...) >= (0.99 * (count _target)), that would atleast avoid puttings 3000 &&
My word is the one and only :p
I mean it works ¯_(ツ)_/¯
the book says orange is better than pink
sorry @cunning crown
The book is wrong then 🙃
Hi
Is there a way to get who activated a trigger?
Like a variable name or something
I want to make an action work only for a specific player
More specifically. I'm showing subtitles when entering a trigger, but the subtitles are visible for everyone even if they're on the other side of the terrain
maybe
thatguy in thislist
thisList has the list of units inside the trigger
if the trigger was activated by a unit, the unit will be in there
you can make your trigger client-side too (depends on the usage)
there is a checkbox in the editor, "Server-side" - untick it
it all depends on the code you run in it, too
[
["Chief of Security", "Hey Commander!", 0],
["Chief of Security", "I need to talk you.", 2]
] spawn BIS_fnc_EXP_camp_playSubtitles;
The subtitles are visible for everyone
I want them to be visible only for the ones entering the trigger
ah, in condition you should set this && player in thislist
@winter rose doesn't seem to work
(count (_targets select { _x animationPhase "terc" >= 0.99 })) isEqualTo (count _targets)
That maybe then? (That will return true if every target in _targets are down, if 1 is the down state)
Nop, _targets is an array with all your target objects (_targets = [obj1, obj2, obj3]
yeah was about to say that
It was to see if you would catch it 😉
and I guess the array is in the init?
not the init of the trigger no
I mean init.sqf
then it would be a global variable, so maybe yes
what heyoxe suggested gives me an error if put in a trigger
local variable in global space
and what I suggested you?
local variable in global space
then it would be a global variable
no errors but doesnt work
…did you even change [target1, target2] ?
yeah of course
So setting the trigger to work client side, will show the subtitles only clientside for those entering the trigger?
and if you set the player in thislist condition
so this && player in thislist && pltHq in thislist?
@smoky verge ```sqf
targetsList findIf { (_x animationPhase "terc") < 0.99 } == -1
@vagrant urchin wasn't it this?
It works fine on my end Sanchez (
systemChat str ((count ([trgt1, trgt2, trgt3] select { _x animationPhase "terc" >= 0.99 })) isEqualTo (count [trgt1, trgt2, trgt3])
); true
```)
so only guys in the area will have the subtitle yes (@vagrant urchin)
and also only pltHq will be able to activate it right?
so what I'm using is pop up target
which get hit
go down, then I guess they have a 3 seconds sleep then pop back up
shouldn't be an issue with grenades considering one pops them all down istantly
@vagrant urchin if both the local player and pltHq are in the trigger, it will fire on the player's machine. even if the player enters later.
That's what I used too @smoky verge and it works with grenades
mhmm could have messed the array
I'll try again
if you want the player to have subtitles only if the player is in the area, and never after, you can use ```sqf
OnCondition:
this && pltHq in thislist
OnActivation:
if (player in thislist) then { /* your subtitles go here */ };
My issue is that the subtitles are also visible for those not in the trigger. I think it's the way the subtitles work not the trigger
…when do you want them to display?
if pltHq enters the area and the player is in the area, or "close" to the commander?
you can check the distance
When entering the trigger.. The problem is that even if only one player enters the trigger, the subtitles are visible for everyone
I get the issue you have
I am trying to see the conditions you are trying to set
if the player is in the area then pltHq enters, should it trigger?
if the player drives the pltHq, should it trigger?
if the player is 1m out of the area and the pltHq enters, should it trigger?
if pltHq enters the area, then 5 min later the player enters it, do you want it to trigger, too?
pltHq is a player.
The trigger should trigger once only when the player with the variable name pltHq is in the trigger.
The code (subtitles function) in the activation event should work only for pltHq, so only that player should see those subtitles
set ```sqf
if (player == pltHq) then { /* subtitles */ };
afaik are subtitles shown to all players which are "local", and since triggers execute for all players (even when not in the trigger area), it will execute on all machines.
The suggestion by Lou might work
might
trigger can be set to local as far as I understood from the docs, it has 3rd param makeGlobal
I managed to fix my markers issue, I had to pass the global array to the function, but now for some reason when marker change pos its title disappear 🤨 what can cause it?
btw, initServer.sqf should be the name of your file, not init_server.sqf @spiral fractal
setMarkerPos is global effect
what is your issue again?
I am editing existing mission, and this is how the author called it, when marker change pos its title disappear, only the marker type is visible
what is the code? because moving a marker does not change text (unless there is a bug I don't know)
I'm having a problem where my AI wont fire at me when point blank range. I give an AI civilian a weapon and add him to an EAST group to make him hostile. anyone has advice?
they aim at me and when i walk away they start shooting, but at point blank/close range they wont shoot
for my virtual garage hack for the Nimitz I now face the problem that some vehicles are too big for the space on the elevator. I can check the size with boundingBoxReal and geo clip on a spawned object, but ideally I would need to know the size before I spawn it. Any way for that? Otherwise I will just add a blacklist and disallow spawning of some classes
sizeOf?
Any way for that?
I don't know any way to do it without spawning the vehicle atleast once
spawn it at 10km altitude, get bounding box, delete :\
(be sure to use createVehicleLocal)
ok
hi
unit "init" has
this addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
...
}];
when/where would be executed? in every client? server+local?
init is executed for every client server and local
is there a way to print "who is currently running script"?
eg: using "systemchat", it would be useful to read "server says: ...and client_1 says:..." to help me debug
hmm...doesnt seem to work
both lines return 0
what i would like to see is something like "0" for server, and "x" for every client
code context?
that would mean im running that multiple times
this addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
systemchat format ["%1 says hello",clientOwner];
}];
this is unit's init
systemChat is local, so it won't trigger anywhere but the local machine
code in init field runs for every client (even connecting ones), so yes it is run multiple times
that's the point. the systemchat is printed twice
i would like to know who is printing each message
both seem to have have clientOwner=0
see https://community.bistudio.com/wiki/Multiplayer_Scripting#Join_In_Progress
both seem to have have clientOwner=0
in SP maybe. Try the following
this addEventHandler ["Killed", {
[format ["%1 says hello", clientOwner]] remoteExec ["systemChat"];
}];
on my way...im testing it on editor, so that could be the reason
of course again, if it is the offline editor
to ensure this is only executed once, and considering the ia is handled by server/hc
should i add a condition before that? (handle event only on server)
if in Eden offline you already have two runs of one init field, there is something wrong
that's what im trying to figure out
a unit, that code, 2 systemchats. first with params, 2nd null
this addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
_id=clientOwner;
systemchat format ["normal %1 hello %2 %3 %4 %5", _id, _unit,_killer,_instigator,_useEffects];
[format ["remote %1: hello", clientOwner]] remoteExec ["systemChat"];
}];
this ends with 4 messages written on chat
in MP Eden or in "normal" Eden?
@mighty vector
if in "normal" Eden, it is obviously not a matter of client, so clientOwner is useless.
would you happen to be running the runInitScript command anywhere? 👀
the mission is stored on mpmissions...if that is what u ask. Im not aware of any runintiscript...
Is it possible to get the weapon that killed a player in the onPlayerKilled.sqf?
params [
"_oldUnit",
"_killer",
"_respawn",
"_respawnDelay"
];
``` @vague geode
You could however add a killed EH that would setVariable on the dead unit the weapon used
(and get it through onPlayerKilled)
@winter rose within editor, tried playing in mp, and still 4 messages were print. remote this time was 2.
im not sure, but i think for some reason its being invoked twice...
"Killed" EH also doesn't return weapon... I believe the only (semi-)reliable method is to use the "HandleDamage" EH's to log the projectile (which can then be checked with weapons) of the last person who damaged the player (aka killer), and then use set/getVariable to retrieve that data in the "Killed" EH.
the "Killed" EH returns the _ammo though my bad
I don't get all the cases in your last message@mighty vector
with only one systemChat ```sqf
[format ["remote %1: hello", clientOwner]] remoteExec ["systemChat"]; // this one
how many messages appear:
- in Eden Singleplayer
- in Multiplayer, you hosting, no other person
- in Multiplayer, you hosting, one other player (nvm if you cannot have someone else connecting)
@winter rose
this is the unit init:
this addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
[format ["im %1, say %2 %3 %4 %5", clientOwner, _unit,_killer,_instigator,_useEffects]] remoteExec ["systemChat"];
}];
from eden>play in multiplayer (MP) option
when unit is killed, the systemchat is shown twice. first time with params, 2nd with null-object. both times client=2.
Do you want an screen cap?
another reason not to add anything to an init field
and from Eden > preview (no MP), I bet it works fine?
i dont think so, but going to check
playing in SP at camera position also fails
(i dont have a preview option)
hmm....starting to blame ace....
…thanks for mentioning the usage of mods
(although I don't see why they would do anything, but maybe)
try in vanilla and report?

99% of all computer issues are actually the user
don't put stuff in the init field (without knowing what it does), use an init.sqf or initServer.sqf
just testing
if you're just testing, then why do you need support for something that obviously isn't working...
cause is not working as expected. just confirmed is an ace issue
once things are working as expected, it would make sense to write them on init.sqf
otherwise, you should review ur programming habits 😛
Burn the init fields 🔥 , I always said it 😄
It's not an ACE issue... CBA/ACE did make a workaround for the bug which triggers certain EH's multiple times and since ACE is already adding a lot of EH's the issue is most likely that yours are being overridden...
Which is not ACE's fault, but not knowing how CBA/ACE works 😉
while {_time > 0} do {
_time = _time - 1;
hintSilent format["Time Left: \n %1", [((_time)/60)+.01,"HH:MM"] call BIS_fnc_timetostring];
sleep 1;
}; ```
so i have this code for a timer, and it works, but the hint box doesnt go away after
how can i make it go away after
woops wrong channel
@plain linden```sqf
hintSilent ""; // this?
so back on that pop up target issue
we've managed to identify how to use the downed targets as a trigger activation
and I can run some checkup scripts to see that it works
but I can't find a way to keep them down
with the other scripts I've made a simple animate ["terc", 1]; does the job
but not in this case apparently
lol ya i just came back to say i figured it out lol
so if I use a sleep and let them pop back up the script works
looks like I can't stop them from staying down, only pull them down once up again
Regarding removeEventHandler, it says "Removes event handler added by addEventHandler. When any handler is removed, all handler indices higher than the deleted one should be decremented.".
How can event handlers in different addons work if removing one event handler invalidates the handles of all others? This can't be right...
@vague geode currentWeapon _killer
Anybody know where I could find a full list of the base classes like "Tank", "Plane", "LandVehicle", and "SoldierWB"? Am I just not looking hard enough on the asset config page?
@smoky verge I think there is a "noPop" variable to set, but I can't remember which one nor where
Hey, So im working with setGroupOwner and have run into the issue of, if the group is in a vehicle and it is idle, It will dismount the squad leader(likely due to the dummy waypoint used in transferring by the command). Now I can remount the unit via moveInDriver however, if this is in the dismount animation, it will not work. Another problem is the unit is determined as no longer in the vehicle at the start of the dismount process/animation. Anyone got a potential solution to get around this? I need the unit to either never dismount or to be immediately remounted upon the completion of its dismount animation.
I recall that nopop was somewhat global and I had to do extra fiddling to make it target specific
sadly I don't remember what exactly
try a setVariable, either "noPop" or "BIS_noPop" maybe?
the global noPop = true was in A2 yep
@potent depot have you tried locking the vehicle until transfer is done maybe?
doesnt locking only prevent mounting not dismounting? I believe it states that in its documentation
also does that work with AI?
blocks everything, and should work with AI
yeah had looked at lockDriver not just lock
they have different functionality
as well as locality restrictions so had assumed it was the same across
ill try it out
Sorry repeating cos I really need an answer to this, it seems an obvious problem:
How can event handlers in different addons work if removing one event handler invalidates the handles of all others?
There must be something I'm missing or I didn't read the documentation correctly?
The handler returns an ID upon creation you can use that to remove it later if needed
that way it doesnt remove all of that type
Okay but removeEventHandler docs say "When any handler is removed, all handler indices higher than the deleted one should be decremented."
(thanks for replying)
I believe this is falsehood though (I hope)
So if I add an openInventory handler, and some other mod does, then I remove mine, other mod can't remove its?
I really hope so as well because its a major design error if it works like this imo
yeah I would think that would break the purpose of that command. So i would hope that would be false as well. I have not experienced any issue with this.
I will test now hopefully docs can be updated (I didn't get write access yet)
can you try and confirm? so I update the biki
ye
that would be a problem if it is true
maybe it was this way in the old days though
like OFP/ArmA
ouch, this wiki sentence indeed dates back to OFP era (2006)
dear lord thats old
That worked btw Lou
ty
should have checked rather than assuming
w00t w00t!
so add and remove event handler seem to work as we would hope, however removeAllEventHandlers, does reset the index to 0, so the next add returns 0
which it shouldn't really
nice
well, there are pros and cons I would say
removeAllEventHandlers is a reset, so "why not" - although I admit, if someone calls it and the other scripts are not aware of it… big damages ahead
no real reason to reset though
thanks for the test, updating the page now
only con is if you hit max int with your event handlers right? if that happens you already got other problems, con is that all other code needs to know about you calling removeAllEventHandlers (which i guess people should never do basically)
The main con would be residual single removes with the old indexes if the indexes get reset if could hit a different one than intended
updated
i would say a warning on removeAllEventHandlers to not use it would be appropriate. There is no way for contentious addon writers to protect themselves in this case.
updated removeAllEventHandlers as well
thanks!
thanks to you too, random citizen!
So why is account registration suspended for the wiki? Wanted to add a note to setGroupOwner about the dismounting issue/feature. Not that many people use the command tbh.
to prevent spam and people (willingly or unwillingly) break it
although feel free to share your thoughts in #community_wiki so it can be added
can do
@winter rose Seems theres a related ticket in the hands of dedmen: https://feedback.bistudio.com/T149510 . I'll ask politely which milestone it could go:
Dear Dedmen: trying to create a killed event handler, I just noticed it was executed twice (!?).
With the much appreciated help of Mr. Montana, we were able to blame ACE.
Seems they already have a "workaround" for this, as detailed in https://github.com/acemod/ACE3/pull/7561, and that it might be solved if https://feedback.bistudio.com/T149510 is solved.
Do you have an ETA for this?
Hmm interesting, I am trying to debug something now where Killed EH will not run at all on first death, but only on second (or something like this, trying to narrow it down and make some kind of repro)
feel free to check https://github.com/acemod/ACE3/issues/7673
Hopefully I can expect that if I execute
player addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
systemChat format ["KILLED EH: %1", _this];
_unit removeEventHandler ["Killed", _thisEventHandler];
}];
in script box while alive and then hit respawn button KILLED EH should be immediately printed right?
as long as you don't use an init field 😄
no no using the Execute window
sadly I don't get the behavior we would expect, trying to work out why :/
anyone know how to generate a classname list of weapons from a cargo
that has a typo in return value btw
_id = player addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
systemChat format ["== %1 KILLED %2", _unit, _thisEventHandler];
_unit removeEventHandler ["Killed", _thisEventHandler];
}];
So if I run this say 10 times before I press respawn, it will execute every second one of them. e.g. 1,3,5,7,9 only :/
The others will be executed if I then respawn again.
…in vanilla?
Trying it now in an empty mission, then in vanilla. However how could a mod interfere with an event handler like this? Seems it should be impossible?
You can't intercept other peoples event handlers can you?
confirmed it happens in empty mission now
mods are cba, ace and some others
confirmed in vanilla
I had 0, 2, 4
then 1
then 3
yeah same
weird
%1 you mean?
Yea
My bad
Something is quite broken with respawn: the event handlers appear to be staying on the player unit, but only some of them. If I just execute that code once and hit respawn, and then repeat that a few times, I end up with each respawn printing multiple messages.
@plain linden see https://community.bistudio.com/wiki/format
@plain linden see https://community.bistudio.com/wiki/format
it means "place argument #1 here"
lol
ninja'd 😢
I need to report this EH bug? I can do that or only some people?
you can head towards the feedback tracker, but be sure to search before creating one
yeah i did, i can't see one about this, only about it firing twice
So is it intended that Killed EH travels with player after respawn or not?
As in even if I don't re-add these EH they still fire (every second one) if I respawn multiple times?
Actually no its obviously broken, I am calling removeEventHandler in the callback, so it shouldn't fire again.
Okay if I don't try and remove them in the callback it executes every single one
so maybe the index is jumping around…
More like the event calling code is not copying the callback list before executing the callbacks (a classic mistake in event systems). When I remove the event handler it is removing it from the list that is actually being iterated, so item 1 becomes item 0, and the next iteration executes on item 2.
Does anyone know why I can't use alive with waitUntil?
waitUntil {
sleep 1;
!alive player;
};
"Generic error in expression |#|!alive player"
you can use alive, just not with an ! in front of it...
try !(alive player); instead
https://community.bistudio.com/wiki/waitUntil
example 1 on the wiki doesn't work for me. Going to test vanilla. Doesn't work in vanilla arma:
waitUntil {!(alive player)};
there's a big difference between !alive and not alive!
No it's not? and neither works for me.
does the player even exist the moment you run that code?
the whole wikipage is has examples full of them... so I'm sure it's possible...
waitUntil {
if !(alive player) then {true} else {false};
};
waitUntil {
if !(alive player) exitWith {true};
false;
};
both give me generic error
100% vanilla arma in the editor after lauching and walking around for a bit I use the debug menu and run
waitUntil {
!alive player;
};
and what happens with
waitUntil { not alive player };
???
same result
doesn't work on any objects neither. IE a vehicle or w/e
can you try it real quick in the debug menu if you're on arma rn? Just so I know I'm not going crazy.
starting her up right now 😉
only thing I can think of is scheduled/unscheduled...
so;
[] spawn {
waitUntil {
!alive player;
};
hint "you dead";
};
^^ this works
hmm yeah it's probably because I'm using the debug.. I feel stupid now. thanks!
same applies for regular scripts, although usually it's already scheduled
yeah debug calls a temp function I think. I appreciate the help and insight haha 🙂
the console is great for small things, but does require some knowledge on how scripts are executed... been there, done that 
So I've tried numerous ways to respawn with "current" loadout when killed but I can't get it to work. Can I ask for any examples to try
"current" as in "anything I had the moment I died", or as in "the loadout I had the moment I spawned in"?
hey, I just now got it !
lol
never fails, work all day,....finally give in and ask somebody and then bam, got it
thanks anyway
ok, so 2 player coop,..I respawn and my body disappears, that good. The AI or other player get killed and respawns but dead body stays. How to remove?
That's actually what I started to research way back this morning
yup I just read where BI AI (non-player) will not get body removed
I think
Only live players
corpseManagerMode
0 = None - None of the units are managed by the manager
1 = All - All units are managed by the manager
2 = None_But_Respawned - Only units that can respawn are managed by the manager
3 = All_But_Respawned - All units are managed by the manager with exception of respawned (opposite to mode 2)
does that go into the init?
if you put it to 1 it should remove all dead bodies when the limit is reached
it's in description.ext, part of the mission files
got ya
thanks !
my mission already has a fuction to "clean up dead bodies"
I just need to know if when my coop buddy dies, he respawns and his body will be gone
again; keep in mind that it only works in combination with the other garbage settings (like limit and time), so it doesn't de-spawn directly (unlike players who respawn)
no, MP only
rog
Is there a problem with remoteExecing a bunch of 'unit setpos getpos x's?
I'm trying to parse a cutscene and it would be a lot easier if I didn't have to divide the scripting up so much at this point :x
is there a way to assign the spectrum analyzer frequency signals to object in the platform version? im using the script from the wiki but cant figure out if i can assign the signals to an object "missionNamespace setVariable ["#EM_Values", [141.8,-30, 140.85,-50, 141.12,-40]];"
To Clarify something:
! == not and UNARY UNARY NULAR == UNARY (UNARY NULAR) aka !alive player == not alive player == !(alive player)
in MP when player enter as driver server cant setFuel on that vehicle?
…yyyes.
usually server is the authority
if I execute function on server that should set fuel I have to use remoteExec and set owner _veh as second parameter?
I actually don't get your question.
what I can tell you is that setFuel takes a local argument, as shown here
https://community.bistudio.com/wiki/setFuel
so from the server, use```sqf
[_vehicle, 0.5] remoteExec ["setFuel", _vehicle];
@spiral fractal ^
ah so I dont have to do owner _vehicle I can send the _vehicle itself, I thought it should be player who is the owner of the object.
so when I want to execute function that is located on the server only, I use remoteExec and pass the vehicle, will it work?
what I said above
I recommend you reading https://community.bistudio.com/wiki/remoteExec, it is a goldmine of information
I did like 3 times already... it didn't answer all my questions
@vague geode
currentWeapon _killer
@wraith cloud The thing is that it only shows the current weapon of the killer but if you get killed my a granade or mine it doesn't show it properly.
targets: Object - the function will be executed only where unit is local
maybe these explanations should be rewritten then
params [
"_oldUnit",
"_killer",
"_respawn",
"_respawnDelay"
];
``` @vague geode
You could however add a killed EH that would setVariable on the dead unit the weapon used
@winter rose My problem is that I don't know how to properly work with event handlers...
hello guys, I'm not sure I understand the BIS_fnc_spawnObjects function : i cant give as arguments both coordinates and "sitting on the ground" ?
position: PositionASL, or Array as [referenceObject, placement]
https://community.bistudio.com/wiki/BIS_fnc_spawnObjects
np 😄
feels weird tho ^^
you could always use createVehicle @runic edge
in the "main syntax" of createVehicle : type createVehicle position
Is the simulation enabled ?
and BIS_fnc_createSimpleObject allow me to place vehicles as well via the "array" input ?
Check the wiki!!1! :@
Is it possible to use dynamic loadouts in warlords meaning is it possible to have the same vehicle in the list of buyable vehicles but with different loadouts?
What is it that you want to do? 😅 place an object by pos, by array, by random, by Jove? @runic edge
I m not sure 😬
I'd say I try to create a mission where a crate will spawn on a random position
I guess that the best way to do it is something like
private _markerArray = ["marker_0","marker_1","marker_2","marker_3","marker_4","marker_5"];
private _randnumb = floor random 5;
private _loc = markerPos (_markerArray select _randnumb);
//hint str(_loc);
"rhs_weapons_crate_ak" createVehicle _loc; ```
there is BIS_fnc_randomPos command https://community.bistudio.com/wiki/BIS_fnc_randomPos
or the alternative createVehicle syntax 😄
mh yes indeed
…this gif comes to my mind :D
https://giphy.com/gifs/ryan-gosling-eating-girlfriends-zdIGTIdD1mi4
oops that s accurate !
:p
a hard part of coding, indeed
or the alternative
createVehiclesyntax 😄
@winter rose if I may, is there a way with the markers to avoid picking the same marker position twice. Like in random draw without replacements ?
you cannot have a "random" that is "random without the previous random" unless you store the previous one somewhere
you can write your own random nubmer generator
that's the long way, no? 😅
there is BIS_fnc_arrayShuffle, too
private _positions = [getMarkerPos "abc", getMarkerPos "def", etc];
_positions = _positions call BIS_fnc_arrayShuffle;
private _pos1 = _positions select 0;
private _pos2 = _positions select 1;
private _pos3 = _positions select 2;
@runic edge ^
yeah thank you, i'm looking at the wiki
ok so i got it and i understand why your code is doing what i want but how on earth did you make that up: i mean its quite a tricky way to say it !
am I good or am I good 😎
yeah but how can i make it up by myself next time ^^
what do you mean?
my brain processed it this way:
- you want a random, but not a random that has been chosen before
- therefore, one pick for each entry
- therefore, randomise and pick in order
That s what I meant
if I make a custom taskType would the icon appear in the slider on the module?
I don't think so, but trials could prove me wrong
yeah doubted that too
also where are the default ones located?
configFile >> CfgTaskTypes
oh I can just click on them to get the source file
if he wants random from array, maybe remove the item that was chosen so it will not even exits anymore in the array?
that is a solution too
@runic edge you could also resize the randomised array so you don't "pick" from it, too - many ways to do it 🙂
what programming language sqf is most similar to?
rather similar to C++ IIRC
SQF? Maybe Javascript
hmm from my little experience with it, I though its more like JavaScript
was just typing it 😄
I 'll try your first method after lunch then I 'll look into the resize method @winter rose
(Co-op) been working with things like save loadout on respawn, clean up corpse on respawn, movable respawn marker,...all work great now. Last thing I'm looking for is, when a player dies and does all of the above, primary weapon is still on the ground. How to clean that up, if possible?
you could try to detect nearestObject(s) of "WeaponHolderSimulated" @sage flume
...heading to Google
the wiki would be better
private _weaponHolders = nearestObjects [getPos _unit, ["WeaponHolderSimulated"], 5];
{ deleteVehicle _x } forEach _weaponHolders;
I tried it in onplayrespawn, initplayerlocal, onplayerkilled, but doesn't work. 😟
if you want to remove all the weapons immediately, you could do a removeAllWeapons
if it is on deletion, maybe use a mission EH
is one of the files I mentioned the proper one to work it in?
onplayerrespawn?
or killed?
right now I have this
removeAllWeapons player;
removeGoggles player;
removeHeadgear player;
removeVest player;
removeUniform player;
removeAllAssignedItems player;
clearAllItemsFromBackpack player;
removeBackpack player;
player setUnitLoadout(player getVariable["Saved_Loadout",[]]);
in playerrespawn
and alll that works as it should
sooo Ill try that
@winter rose Which of the following parameters of the "MPKilled" event handler is the weapon which killed the player? params ["_unit", "_killer", "_instigator", "_useEffects"];
none, I was mistaken
you would have to use a "hit" EH, but this one doesn't (always) trigger on killed
Ok, but what's the difference between "_killer" and "_instigator"?
see https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#MPKilled
killer is the "unit" that killed
instigator is the unit that pressed the trigger
I believe it makes the distinction for remote-controlled UAVs @vague geode
But how can those differ from one another?
@winter rose made it works with a sexier typo :
private _positions = [0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] apply {getMarkerPos ("marker_" + str(_x))};
_positions = _positions call BIS_fnc_arrayShuffle;
_positions resize 6;
{"rhs_weapons_crate_ak" createVehicle _x} forEach _positions;
thanks for the tipSSSSSS !
@vague geode _killer = UAV, _instigator = the guy that remote controls the UAV
Ah, ok.
(I think)
anyone know a way to make the AI completely 'not see/ ignore' any other units?
@urban tiger careless?
tried that, it then completely ignore the move point and walk through the wall 😂
disableAI 🙂
what do you want to do?
ill send you a pm of what it does
I mean, the list in https://community.bistudio.com/wiki/disableAI tells you about what you can do
pm'd you what the AI does when it see any unit close to it
is there a framework/script only solution to simulate injured loading into a vehicle, like a helicopter? I know AIS and ACE have something like this, but would look for a more lightweight solution. Basic idea is that you're the pilot, land near the injured, task a crew member to get the wounded aboard, crew member exits, supports/transports the wounded and both board the helo
@urban tiger how is it walking around? waypoints?
Move.
maybe AUTOTARGET & CHECKVISIBLE ?
tried that. still go 'nah' and yeets itself off the side
"ALL" 😄
@urban tiger if you want to have an AI that does not engage in combat, maybe try an Agent instead? AFAIK it doesn't have the combat state machine
@round scroll combat isn't the problem. The ai works perfectly fine but once a unit is close it refuse to work correctly. even if you disableAI
update ONLY does it if its a player is close. if it an ai unit and the player is no where close it works perfectly as attented
My AI pilot suddenly began skipping all the way to his last waypoint in the mission... worse, that waypoint doesn't even exist anymore, or does but has changed in number @_@
Does disabling and enabling simulation of a unit reset the group's waypoints?
should not
Does setCurrentWaypoint account for the first scripted point being #0?
It's getting to that point, but I'm scared of the alternatives.
And apparently not, still going to waypoint 14 out of 13
:/
0,0,0 I presume
No, actually where 13 is located; an arbitrary 'head in this direction, end mission on extraction' area.
Except now it's 'Mission's beginning, immediately leave base and stop in midair' :/
Fah... What would be the recommended way of doing waypointless AI guidance for more than simple actions?
What's weird is that I have a Pilots SetCurrentWaypoint [Pilots, 2] script that runs right after I re-enable the driver's simulation and "MOVE" ai, it just speedballs through all it's waypoints :c
Okay, instead of calling the group by name, I just passed Group Driver Vehicle instead and that... seems to have worked? o.0
... right there in the notes, "Using this command forces the last waypoint to complete. Any code in the on Act of that waypoint will run. " ... :c
make a dummy last waypoint maybe?
I mean, there's no scripting in the last waypoint, but I feel like that may have been related? I don't know anymore @_@
Looking into doing 'get to waypoint, wait until action I want is done, pilots addwaypoint to next thing I want done'
Don't give them more than one waypoint at a time
rewind to the very beginning of this and answer:
what is it that you want to do?
Fair
The players start in a base next to the pilots; the pilots run to the helicopter and start it up and open the ramp, while the players go to the armory and quick-load their inventory.
The pilots wait until all units of the player group including AI are aboard, then take off and head to the next waypoint.
I've had all kinds of issue with the waiting-for-everyone-to-get-aboard, however... from just straight taking off and heading away, to taking off and hovering 20m in the air, to the most recent - going just enough to light the wheels, then kinda drifting across the helipad.
I've done all manner of variations; disabling the pilot simulation, disabling their moveAI, tying a Hold waypoint to wait until the count of players inside is equal to the count of players, etc
It was... 'working', up until I started trying to simplify it, since there were so many code snippets from various attempts :/