#arma3_scripting
1 messages · Page 534 of 1
22:48:53 Error in expression <ban "UID" "MY TEXT">
22:48:53 Error position: <"MY TEXT">
22:48:53 Error Missing ;
22:53:50 Error in expression <ban "UID" MY TEXT>
22:53:50 Error position: <MY TEXT>
22:53:50 Error Missing ;
hmm so this will be hard to do i guess?
I'd say probably impossible
i think its possible with extension .dll, but no knowledge in this😉 .
The codecrew _vehicle;return the same array in all clients? I mean with the same order.
_vehicle is the same object in all clients
@still forum you know 😀 ?
I would've already answered if I did
if yes i will be able to do a good optimization in my code
What are you trying to do? In 0.001% of cases, when someone is entering/leaving a car, it might return different values because nothing gets synchronized instantly in multiplayer
...and, if something has even a slightest chance to fail, it will fail some time
so probably relying on this command to return the same value for all players on the server is a bad thing to do
critical decisions must be done centralized, preferable at the server
Can anyone recommend a good tool to build GUIs for Arma? Something a bit more flexible when it comes to macros compared to the Vanilla GUI Editor?
That looks nice. Thanks for the info!
Although not without drawbacks... it doesn't support groups or a few other types of controls
But it can organize classes pretty well
Love the UI for changing control properties.
not sure where to ask this, https://gyazo.com/ce48ac668cf2b74caf428ca93f12397a is there a way of getting rid of these black lines on RscLine ?
@wary vine Are these like 1000 lines drawn to create a graph?
Try adding 512 to the RscLine style property
oi people. quick question.. i'm trying to export data from a variable into a generic text file... i think that's possible, no?
diag_log? 😂
wiki says it exports to the report file
damn
alright, then i gotta do it manually via copytoclipboard
would have been easier / more fancy to just have it create what i need manually
So, not sure if this is the right place to ask, but may as well try here.
Does anyone know how RHS has setup their disposable launchers to be auto-dropped upon use?
I’m working on a disposable launcher of my own and I’d really like to explore adding that functionality.
Not sure how RHS has done it but there is an CBA framework for that:
https://github.com/CBATeam/CBA_A3/wiki/Disposable-Launchers
Oh, that’s neat
Though it looks like that still requires going into your inventory and ditching the tube
Hi there,
is there a way atm to make AI put their weapons on their bakcs (and ideally walk around with them)?
SoldierOne action ["WeaponOnBack", SoldierTwo]
does not work. Couldnt find anything in formus as well.
snooping through ACE github bc i know they have a player function for that, maybe itll work for AI
tell me if you find it plz
@astral dawn maybe this?
http://www.rhsmods.org/page/developers#disposable-weapons
i found some really clonky way to do it
Oh, god, @blazing quiver that is for you:
http://www.rhsmods.org/page/developers#disposable-weapons
Sorry, @astral dawn
freeze the unit with diableAI "Anim", then add the weapon with addWeaponGLobal. It will stay on the untis back. thos the unit is frozen
frozen in terms of "its head moves a bit but it wont walk or react"
Another really bad way to do it is: create an invisible weapon holder (like the ones spawend when a weapon is dropped) and attach that one to the back of the unit. then the unit can walk around with it too
@spark turret https://forums.bohemia.net/forums/topic/190697-how-to-force-ai-to-holster-weapons/
In this thread example of code makes AI holster secondary weapon. Don't work with primary weapon 😒
@lost copper CBA has disposable weapons. That's probably preferable over the rhs thing
@still forum yep, you are right. 😅
Interesting
But I unfortunately don't know how to get rid of the artifacts.
Have you tried using dots instead of lines?
I haven't what I was thinking of trying next was using just something with a background and using atan2 to find the angle between the 2 positions and trying ctrlsetAngle
That could work. Question is if you can properly align those lines then.
Any easy way to detect if a player is teleporting?
Intentionally or cheating
cheating
I'm getting a bit fed up with the script kiddies joining the mission I maintain
Infistar anti cheat?
hi, does anyone know in wich cfg entrie tree models are declared ? I found grass in cfgworld but not tree
is there a method to find them ?
In a switch do what does the default case do?
it does what other case don't
So basically a case else? (in other languages)
yes something around that 😃
thanks
Do you have to be logged as admin or server command admin to use serverCommand?
I have 2 buttons in my admin menu that uses serverCommand kick and ban
You don’t have to be logged in at all
What is the lifespan of variables in uiNamespace?
And what if I set a variable to an object handle placed on a map by default?
so I ran into a little issue with MP respawn EH. I made a mission in eden with respawned enabled, and played it in Multiplayer. in my init.sqf I have
player addMPEventHandler ["MPRespawn", {
params["_unit","_corpse"];
diag_log format["%1 respawned",time];
}];
Now I noticed in the RPT file, that if I respawn, theres two entries in the log that show up. Is it because I am both the server and a player that theres two entries or is there something else?
I also did use CBA_fnc_addClassEventHandler to see if that would do anything different, which Ik it cant use MpRespawn so I used respawn so idk if that would cause any issues in MP
@astral dawn till game restart
object will turn objNull after it's despawned
"if that would cause any issues in MP" you didn't understand the difference between MP Eventhandlers and normal ones
If you addMPEventhandler ONCE, it will be added on every client and server
aand it's despawned when map is unloaded, right?
will it get unloaded when I leave editor and go to main menu?
in my case the variable turned to nil actually
yes,yes
ill go read up on MP respawn again then
what do you want to achieve? if you are doing a mission, there is an onPlayerRespawn.sqf event script
it's executed locally on the computer of the player that has respawned
oh well I started out scripting on a mission just cause its easier, I might make it into a mod idk. thats why I didnt want to use onPlayerRespawn.sqf
yeah but what do you want, do you need this event handler to be executed on every computer in MP or where?
MP event handlers are executed on every PC
I just need to be executed on the player that respawns, which I thought MP EH only executed on the local unit
It is only triggered on one machine where the unit it was assigned to is local. thats wat it says on the wiki, maybe my mistake was thinking triggered and execute are not the same word?
You can add it from anywhere but it is executed on local unit when player respawn, ie on player's machine only
Ah wait, MPRespawn has its own description where it states that it doesn't work as other MP event handlers work :////
target: Myvar = 4;
dunno what it is, defo not sqf
@edgy dune yeah I can't understand why it's being run twice in your case, judging by description it should get called once
Maybe try this one: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Respawn
added with addEventHandler
marker.sqf:
_playerPos = "";
{
_playerPos = createMarker ["PlayerMarker", position _x];
_playerPos setMarkerShape "ICON";
_playerPos setMarkerType "hd_arrow";
_playerPos setMarkerDir direction _x;
_playerPos setMarkerText profileName;
} forEach allUnits;
while {true} do {
{
_playerPos setMarkerPos position _x;
_playerPos setMarkerDir direction _x;
} forEach allUnits;
sleep 0.05;
}
What am I doing wrong? This is executed from initServer.sqf this way:
[] execVM "marker.sqf";
Maybe was added twice? @astral dawn
Maybe yeah 🤷
@astral dawn I will, I was doing this last night so maybe a good nights sleep will help today lol
But he said that he adds it only in init.sqf
@tender fossil Marker names must be unique
I guess it works but only for one person in your case, right?
Yeah, also it's not updating the position and direction
I'll make individual names with format
you can probably use client owner as a unique ID for each player
neural processor needs a cooler too
Tin foil
How do I generate unique variable for each unit?
Oh ok
I would use https://community.bistudio.com/wiki/owner for unique ID
or setVariable onto the unit
ProfileName is local command
setVariable a "playerMarker" variable on the unit.
then use getVariable in your loop where you set the marker position
Then you can also check if the variable is nil, and if so, dynamically create a new marker. That way you also handle newly spawned units
Maybe I should also use local variables to avoid extra traffic on network?
Local markers instead of global markers (?)
@tough abyss its my new Langage xd😂
local markers makes sense yes
Yeah meant markers
Markers are the worst and the oldest implementation in Arma. When you reference a marker the engine has to cycle array of all markers to find it, For. Every. Marker. Command.
Same for network markers, each marker command is a packet sent
Arma 3 😂
It is all fun and games when you have only a few markers
how long does it take to iterate through them?
Compared to speed of SQF
if I have 100 of them for instance or 1000 or do you have any numbers for any value?
You are missing the point
"Compared to speed of SQF"
like the blink of an eye compared to a snail crawling up stairs.
It is fast to find marker
But still bad, because it could be done SO much better and faster
But when you have to do it for every marker command it mounts
so if I lbAdd in a dialog all marker map, this will use a lot of traffic?
No idea
Vague question
I am using the following for a moving respawn point that is attached to a vehicle.
while {alive rspn} do {"respawn_west" setmarkerpos (getpos rspn); sleep 1;}; ;
{};
_killspawnusmc = alive rspn;
if (not _killspawnusmc) then
{
deletemarker "respawn_west";
};```
Is there a method of moving the spawn-in to that same vehicle? Note not using a "respawn" module but ``respawn_west`` marker instead.
what does lbAdd have to do with markers 🤔
and with traffic 🤔
What I'm doing wrong this time? :D
{
_x setVariable ["playerLocalPos", (createMarker ["PlayerMarker", position _x])];
(_x getVariable "playerLocalPos") setMarkerShape "ICON";
(_x getVariable "playerLocalPos") setMarkerType "hd_arrow";
(_x getVariable "playerLocalPos") setMarkerDir direction _x;
(_x getVariable "playerLocalPos") setMarkerText profileName;
} forEach allUnits;
while {true} do {
{
(_x getVariable "playerLocalPos") setMarkerPos position _x;
(_x getVariable "playerLocalPos") setMarkerDir direction _x;
} forEach allUnits;
sleep 0.05;
}
Name of the marker has to be unique
Even if I attach it to object right away?
@Dedmen for pushing marker info in a dialog.
"PlayerMarker" --> format["%1_marker", name _x]
But sleep 0.05 looks like bad for network
Getter commands do not broadcast @tough abyss
@astral dawn local marker for every player with his own pos?
as I understand, yes
@tough abyss so i'm safe ty for anwser.
but yep command with global effect with a loop is never good😉 .
@lost copper Local markers yeah
Even if I attach it to object right away? you are not doing that.
(_x getVariable "playerLocalPos") get it once, and store it in a variable.
if (hasInterface) then {
_marker = createMarkerLocal [format["%1_m", name player], player];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerTypeLocal "hd_arrow";
_marker setMarkerDirLocal (getDir player);
_marker setMarkerTextLocal (name player);
while (true /*maybe "alive player" here*/) do {
_marker setMarkerPosLocal player;
_marker setMarkerDirLocal (getDir player);
sleep 0.1;
};
};
I feel scared of this because, imagine if a cheater send a loop with global effect command i'm fucked no?
"imagine if a cheater" well you are already f-ed
xd
@lost copper that only spawns one marker
For one player
Yes
@Dedmen i have good AH but, what u can do if a player exec global command effect in a loop?
nothing
I already tried this with no luck:
{
_x setVariable [format ["pos%1", name _x], (createMarker ["PlayerMarker", position _x])];
(_x getVariable str [format ["pos%1", name _x]]) setMarkerShape "ICON";
(_x getVariable str [format ["pos%1", name _x]]) setMarkerType "hd_arrow";
(_x getVariable str [format ["pos%1", name _x]]) setMarkerDir direction _x;
(_x getVariable str [format ["pos%1", name _x]]) setMarkerText profileName;
} forEach allUnits;
while {true} do {
{
(_x getVariable str [format ["pos%1", name _x]]) setMarkerPos position _x;
(_x getVariable str [format ["pos%1", name _x]]) setMarkerDir direction _x;
} forEach allUnits;
sleep 0.05;
}
@tender fossil the variable name is not the marker name
"PlayerMarker" is the marker name, which needs to be unique
Player should localy see only his position or position of all players on the map? @tender fossil
Ok, wait a min
{
private _newMarker = createMarker [format ["PlayerMarker%1",name _x], position _x];
_x setVariable ["playerMarker", _newMarker];
_newMarker setMarkerShape "ICON";
_newMarker setMarkerType "hd_arrow";
_newMarker setMarkerDir direction _x;
_newMarker setMarkerText name _x;
} forEach allUnits;
while {true} do {
{
private _marker = _x getVariable "playerMarker";
_marker setMarkerPos position _x;
_marker setMarkerDir direction _x;
} forEach allUnits;
sleep 0.2;
}
Do they both need to be unique or just the marker name?
Ah alright
So I put the format in wrong place
To make it local, just use the local marker commands everywhere, and let that code run on every players machine
Yeah, that's what I'm doing now
@still forum your script is not JIP compatible)
Problem is, if you spawn a new Unit, it will be in allUnits but not have a playerMarker set on it
"your script is not JIP compatible" wat?
You can fix that though by just checking if _marker is nil at the bottom, and then creating a new marker if needed
Yep i want to say that
It's JIP compatible if the new player joins into a existing AI
FFS profileName is local command you will see the same marker text
oops
_newMarker setMarkerText profileName; -> _newMarker setMarkerText name _x;
Could always have it setup something like ```sqf
while {true} do {
waitUntil {visibleMap};
//spawn markers
while {visibleMap} do {/Update markers each frame/};
//delete markers
};
what if we want them at GPS too
[] spawn {
while {true} do {
{
_x addTorque [1000,0,0];
} forEach vehicles;
};
};
Result my server got killed in like 2sec.
visibleMap true for gps too?
Not sure
need to try then. I assume it should be tho
@ruby breach or drawIcon like a pro
The example I have for that method is pre-pushBack, so I'm just not going to bother posting it lol
don't even dare 😄
@tough abyss as dedmen said, if you hyave a client sending random crap around you are f*d already
Disable addTorque with CfgDisableCommands @tough abyss
@still forum I tried your code, it's not working for some reason
@tough abyss yes i have done that but there is plenty of another command doing the same.😬
but anyway u right i can't do nothing sad.😰
Sounds like you are not using battlEye
I don't run server atm, i just prepare my self to RP communty😂 😂
RP server
no battleye
hahha i want to see result of that
@still forum Still not working for some reason, it shows only one marker
I want to do simple in game debug menu, any recommendations? I was going to use CBA Fleximenu but there appears to be no documentation at all (if anyone knows where it is, or a project that uses it that would be helpful!)
don't know why Ezcoo, can't see error
How do I get the current zoom level, or better - current view cone which the player is observing?
This thing should take into account binoculars, optics, right mouse button zoom, etc
Best way to see if player is on copilot seat in a heli?
or maybe on the benches on a hummingbird for example?
@astral dawn maybe bind some action to the input action for zooming?
afaik, there is one of two states the regular fpp, and then the zoomed in mode to compensate for real vision.
same with the binocs.
Opened -> RMB -> Action
yeah but how do I get the size of the view cone, in whatever way? be it angles or coordinates of the four edge points of my camera?
screen to world?
Is there any way/function to get the idc from the actual Display object? I can easily pass it along to the function I'm using it in, but if there's a simple way to get it that'd be preferable.
you mean the displays that are open?
allDisplays
if you end up needing to find one in specific you're going to need to look at the config.
No an individual one, for example a select and hinting it out would give you something like "Dialog #301" - I just need to capture that number by itself
Probably like this:
_className = findDisplay 12 getVariable ["BIS_fnc_initDisplay_configClass", ""]; // "RscDiary"
Then go to config >> className >> "idd"
I think he means, he has a display handle, and he needs to get its IDD - Display ID
No I need the idc, not the idd
which is it? control or display?
Yeah I don't work with dialogs too often, it's a control.
then https://community.bistudio.com/wiki/ctrlIDC is your friend
if it's a control.... because initially you said 'display'
you can also use a UI EH to enact mouse over actions
Thanks, yeah as mentioned I don't work with dialogs too often so it's a foreign area and that distinction wasn't clear to me.
Is ctrlIDC the only way?
why would you need another way 🤔
I mean it does what you asked for
getting IDC of a control handle
missing the control handle? :[
Yeah, it's also an Arma 3 function and I'm working within the constraints of 2 by working on a revival of an old game mode for a challenge. However the most challenging part is not having access to A3 functions. I still come to here for support, since it still helps.
so it's arma 2, ok 🤔
shouldn't change a ton
Yeah a lot of useful functions got added in 3. I can just pass along the idc to the function, so it's no biggie.
shouldn't change a ton
You think? A2 is way behind now, you just have no idea until you try something
10 years from its release date :{ damn I'm old
What would be a reliable way to tell if player has mouse cursor on the screen? 🤔
Be it some menu or map open
dialog?
Doesn't cover map being open
Ah ninjaed
getMousePosition returns previous position regardless of cursor being visible
I can check if map is open by another command sure but I wonder if there is better way
99.9% its not
Even less reliable
Well, I guess dialog || visibleMap is sufficent enough
I have this string: "[[myMedevacVehicle, 15], [myMedicTent, 10]]" and I need to convert it to an array, how do I do that?
I tried the compile, but it returned a code, the toArray is unreadable for normal humans and you have to then convert it back to a normal text one letter at a time
remove the space in there
and then use parseSimpleArray
toArray is unreadable for normal humans toArray doesn't turn a string that contains an array to the array
myMedevacVehicle that won't work with parseSimpleArray
do you not have any way to simply not put that array into a string?
call compile should do the job, no?
ye
@astral dawn it returns a code block, not an array. Like this:
{[[myMedevacVehicle, 15], [myMedicTent, 10]]}
and that breaks the script down the line
but did you call it?
I just get this:
[[any,15],[any,10]]
what is myMedevacVehicle then?
and myMedicTent
do they exist at all in your mission namespace?
well undefined variables gonna be undefined
myMedevacVehicle is a name of an object, but AFAIK you will be able to put in classnames as well.
However I do need to convert that string to an array. Its a string because the CBA settings editbox sends strings down the line.
and I just get [[any,15],[any,10]] instead of [[myMedevacVehicle, 15], [myMedicTent, 10]] the names are gone
The variables are undefined then
well undefined variables gonna be undefined
https://i.imgur.com/y916mkc.jpg
What is the logically explanation to why systemChat in initPlayerLocal.sqf isnt shown in the game, unless you first put in a sleep? - I am new to this arma scripting, and are trying to learn the ropes!
fixed! 😄
https://community.bistudio.com/wiki/Event_Scripts
Some scripts run before everything is loaded in order to init for example vehicles or variables; so if you add a sleep or waitUntil then it will happen once the simulation started
Yeah I understand that, but I guess that the reason why a systemChat in the beginning of initPlayerLocal.sqf isn't shown, unless you give it sleep 1; is be cause that the chat module isn't yet loaded or something?
oh so there has to be a an object that is named in the mission for it to work. I just thought it would be passed into the array anyway. Now I get it.
Just make the intro a little longer? 😛
I would have guessed that when it reached the point where it went on with the initPlayerLocal it would be ready for what ever you tossed at it, like systemChat
hmm
ok so I guess it has something to do with the player object then: it writes the systemChat before my client takes over the player object and make it local?
And therefor I do not see it
ok i guess the chat / message system is just slow AF to initialize? because hints, and other effects shown is working right out the start
Try that
waitUntil{!isNull (findDisplay 46)};
that worked!
So this means that I didnt see the systemChat because there was no display at the time?
correct.
much appreciated 😃
And why hint is working is because its a way slower function, I guess...
Yep
Hey guys,
working on a script for a mission to rescue AI in the field.
this setSpeaker "NoVoice";
this disableAi "ALL";
[this, "Acts_InjuredCoughRifle02"] remoteExec ["switchMove", 0];
_action= ["Carry", "Carry", "", {[player, cursorTarget] call ace_dragging_fnc_startCarry;},{true}] call ace_interact_menu_fnc_createAction;
[this, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;```
```ace_dragging_fnc_startCarry``` is sadly returning nothing, so how do i get the AI back into the first Animation.
I thought of a ```waitUntil {inputAction "defaultAction" > 1};``` because u have to press that Key anyway to drop down the AI.
Someone has a better idea?
```
Code
```
for better readability
Yep
nope
sadly an object classname wasn't passed through a compile. also if you dont have the object with the name on the map the compiling stops and it breaks the scripting.
I think I will have to come up with something completely different
What are you even trying to do? So you have a string representation of an array, and you need to get data out of it. It's pretty weird. Why would you even need that? Maybe there is another way?
it comes from a CBA setting, and cba settings are strings
the user is supposed to enter a proper variable name in there, but you cannot ever trust the user to enter something correctly
also that might happen when you work with arma extensions - they return results as strings
Well it certainly works:
myVar = "Whatever";
myArrayString = "[[myVar, 0], myVar, 1]";
myArray = call compile myArrayString;
myArray // Returns: [["Whatever",0],"Whatever",1]
You can pass a string through a string and then through call-compile too:
myArrayString = "[[""classOfDude"", 0], ""classOfDude"", 1]";
myArray = call compile myArrayString;
myArray // [["classOfDude",0],"classOfDude",1]
When didJIP is true means the player joins a server where the mission is started right?
So for it to be false is, to join a server without a mission or?
JIP is when you join a mission after the server owner has started it
Non-JIP is when you are in the lobby when server owner presses 'OK' button to start the mission
Ah ok, I thought the lobby was part of the mission too
all the SQF functions, preinit, postinit, init.sqf or whatever, run after the lobby
gotcha
Btw do you have any idea why, when I use TEDST to start the localhost test server, that it looks like a have 3 running in the server browser window?
ok weird
I can't seem to find any place with a list of attributes on the player object?
Hmm I am not following
you mean name and uid is all there is? 😄
untill you add your own?
hmm ok
I would have guessed there would be stuff like IP, versions, mods, etc etc
ok that could be handled server side
JIP : Join In Progress?
Yes
is it possible to spoof UID still? - watched some aged videos where people were dll injecting
I am just asking, if it's safe to use like auth
Dedmen can you make an SQF command that will...
...change the 3ms scheduler limit to something else?
ye
Hmm really? That would be most awesome actually, because we are currently trying to push as much processing into that poor scheduler
Can you add a -useAllCores flag (that works?)
I'm not joking, can you really do that?
Damn that would be cool 🎇
I don't get what's script priority 🤔
Question: I have a box on the map, near that box I have a MIM-145 AA battery. I now want to automatically rearm the battery once the ammo of it is 0 and then after 3 minutes rearm it. Can someone tell me how to run the script continuously and if there is a better way of doing it? My script: ```sqf
params ["_ammobox"];
_list = _ammobox nearEntities ["Car", 15];
_list params ["_gun"];
if (typeOf _gun == "B_SAM_System_03_F" && _gun ammo == 0) then {
sleep 180;
_gun setVehicleAmmo 1;
};
make a loop
ok and about the nearEntities, is there a better way of getting the SAM class? I get some _gun is not defined variable which makes me believe that the missile isn't always the first object
nvm I rewrote the script, thanks for the hint @tawny kindle
np
_gun ammo <- wrong syntax
Is there any function that changes a player's vision mode? I'm getting the vision mode through _var = currentVisionMode _player; but can't seem to set it again.
Depends on what you're planning to do exactly, but the NVGoggles actions may be of some use: https://community.bistudio.com/wiki/Arma_3_Actions#NVGoggles
ok so passing the array through CBA setting didn't work well at all.
Is it possible to get all objects in a mission that have a specific variable? I think it might be possible to set variable for an object in the editor by putting something like this into the init:
this setVariable ["funkyMedevacStation", true]
Then after mission launches I would need a script that finds all of the objects with funkyMedevacStation set to true and build an array out of them.
Is it feasible to do it like this?
Doing it once on mission start is reasonable.
You would just need to run your stuff in postInit as preInit will run before editor init "box" code is ran (so your variable will be not yet set on the object).
something like this in postInit should work:
MY_funkyMedevacStations = (entities [[], [], false, false]) select {_x getVariable ["funkyMedevacStation", false]};
will it run only for editor like objects and skip map houses, trees and such?
Yeah entities does not run for map objects.
If it would it would freeze your game for someeee time.
(or more likely crash the game)
cool it seems to work
scratch that, it does not work on static objects placed in the editor (tents and such)
try with (allMissionObjects "") then
does getIn EH set in configs always trigger at mission start even if units start in a vehicle?
Hello guys, does the lbSetCurSel function trigger the onLbSelChanged EH ?
It should
I'm trying to get units to ragdoll when they are injured. Sadly setting the setUnconcious true then false stops units from reporting that they are injured with prevents you from using the normal heal action and breaks the AI ordering medics to heal units.
I tried setUnconcious to false and then apply some damage in order to remind a unit that it's injured and report it's status.
a questions about global variables. if i declare IRON_GasAreas = [x,y,z]; in the initServer, will the clients be able to access it? i tought thats the point of global variables, that they are global
i need some way to have an array that gets declared by the server and is accessible by all clients
Global variable is global on your environment. Every network instance client/server has it's own copy of all namespaces. So if you want to have server variable accessible to all clients you need to broadcast it over the network.
eg. https://community.bistudio.com/wiki/publicVariable
or setVariable command with public flag set to true
thank you i will try that.
gosh I wish there was a way to just ctrl + s a script and instant test it instead of rebooting and repack pbo etc etc
-filePatching?
i'm currently making a zeus op and would like all of the players first person apart from me, as the zeus (so i can fly better when in a heli - to improve speed of medevac's etc). i've placed my zeus as a BLUFOR unit with the game master module attached (just so long range radio will work with TFR) so i don't know if that'll affect anything scripting wise.
Is there any way to have all caharacters but mine first person locked?
Trying to get setPosATL to set a location of an object about a meter directly in front of the player, can someone help? _panel setPosATL [(getPosATL _unit select 0) -5, (getPosATL _unit select 1) + 5, getPosATL _unit select 2];
@gleaming estuary not entierely exactly what you've asked, but ive achieved a similar thing with:
_enemyPosX = (_targetToMurder call CBA_fnc_getPos) select 0;
_enemyPosY = (_targetToMurder call CBA_fnc_getPos) select 1;
_enemyPosZ = (_targetToMurder call CBA_fnc_getPos) select 2;
_enemyPosX = _enemyPosX + 25;
_newPos = [_enemyPosX,_enemyPosY,_enemyPosZ];
_boogy setPos _newPos;
_targetToMurder is the person u want to set the object in relation to. boogy is the object you want to set the location
not really sure what this is doing... gets the x,y and z adds 25 to x to create a new pos?
@gleaming estuary getPos can perform conversion from cylindrical coordinate system to XYZ https://community.bistudio.com/wiki/getPos
but it works with AGL position, not AGL
so you can try like...
private _object = player;
_dir = direction _object;
private _newPos = _object getPos [1, _dir];
yeah actually getRelPos should be better!
For all intents and purposes, _panel setPosATL (_unit getRelPos [1,0]) would work fine unless you're doing shenanigans over water
wait, but getRelPos takes heading relative to current object's heading (that's why I meant that it's better)
so it must be getRelPos [1, 0]
Yeah, missed that bit. getPos is relative to North, getRelPos is relative to the object in question.
_posATL = ASLtoATL (player modelToWorldWorld [0,1,1.8]);
@gleaming estuary
In callExtension, are the strings passed in UTF-8 or UTF-16? The wiki says the internal encoding is UTF-8 but toString always converts to/from UTF-16
Uhm... Wut?
When I receive a call to my extension, be it either RVExtension or RVExtensionArgs, are the strings UTF-8 or UTF-16 encoded? The wiki says the internal encoding of strings is UTF-8 but it also says that toString encodes and decodes to/from UTF-16 strings. But I already figured it out, I was just reading the wiki wrong
hello, question about creating Praetorian 1C "vehicles" (or similarly classed assets). I have a script that automatically stages key assets when the server initializes.
however, they are not appearing in the UAV Terminal list. do I need to set a flag on them?
if it matters, this is an ACE server.
if I just place the assets via editor, they appear in the list oddly enough. but when through createVehicle, no.
I figured it out. Follow createVehicle with createVehicleCrew as appropriate. Works like a champ. 👍
@torpid grail it’s multibyte
@surreal peak
_enemyPosX = (_targetToMurder call CBA_fnc_getPos) select 0;
_enemyPosY = (_targetToMurder call CBA_fnc_getPos) select 1;
_enemyPosZ = (_targetToMurder call CBA_fnc_getPos) select 2;
Oof.. You are calling getPos 3 times, that's so inefficient, and all the selects don't make it better.
->
(_targetToMurder call CBA_fnc_getPos) params ["_enemyPosX", "_enemyPosY", "_enemyPosZ"];
...
_enemyPosX = _enemyPosX + 25;
_newPos = [_enemyPosX,_enemyPosY,_enemyPosZ];
_boogy setPos _newPos;
Soo complicated.
_enemyPos = _targetToMurder call CBA_fnc_getPos;
_newPos = _enemyPos vectorAdd [25,0,0];
_boogy setPos _newPos;
@torpid grail utf8
@still forum thanks for advice, I was att the end of my ropes trying to get some other parts of the script to work so I decided to be very lazy. Also I completely forgot about the actual function for getPos. Thanks!
can someone help me with a code issue. I need to use apply on player attachedObjects to see if one of the attached objects iskindof "man". I still dont fully understand how apply works. could somoeone help me out?
You know you NEED to use apply, while you don't actually know how it works/what it does?
Sounds to me like you don't actually want to use apply
show me code or idea of what you're trying to do
in the condition of an action menu i need to determine if one of the players attachedbojects is a man. if true then i can show the action.
sounds like you want findIf, and not apply
researching it now
anyone got a recommendation for a function to increase the players weapon sway. kind of like after someone ran and the weapon moves around a lot. setCustomAimCoef did not have an effect when executed on the player.
You need to look into it's config then
Yeah, that's what I thought
For example a flashlight: http://tikka.ws/class/index.php?b=cfgWeapons&c=acc_flashlight&conf=1#subclass1
getNumber (configFile >> "CfgVehicles" >> _itemClassname >> "ItemInfo" >> "mass")
Yes I have already tested this, the problem is that some mods are made differently (they define the mass in the main class)
But it doesn't matter, with a condition I can easily find it
Arma itself only reads mass from one place
Oh yes ?
watch out as mass is an abstract value not really representing it
i have a script reqiring the weight of different weapons, the only way to acuratly get the mass in Kilograms was to place it in an ais backpack, weigh the ai before and after and then subtract.
she represents the weight of the item in the inventory
the mass in the config is not equal to the mass in the inventory.
I can write mass all over the place, doesn't mean that Arma will read it.
A config file is just that, a config. The config entries are read by the engine, at the place the engine expects them at.
:/
"the mass in the config is not equal to the mass in the inventory." huh? Sure it is
There was a bug with rocket launcher ammo that the ammo mass was counted wrong, not sure if that was fixed yet
wasnt 2 weeks ago when i last checkd
In weapons the mass comes from WeaponSlotsInfo it seems. On items it comes from ItemInfo
Magazines have it directly in their class
vehicles have it in their 3D model and not in the class at all
now for example, BW mg3 has no mass entry, also no weaponSlotinfo.
i remeber that getting the mass from the config was such a pain in the ass i couldnt solve.
Are you sure it's not just inheriting that?
so instead i spawn a unit by scrit and weigh it, add the weapon, weigh it again
i have no idea where mass is defined in the config. i only know that i wasnt able to solve that
Well. It's in ItemInfo for items, and WeaponSlotsInfo for weapons.
Every weapon class needs to have WeaponSlotsInfo
ah, i also remeber that the mass from config for magazines is abolsutely off. it seems like a random value really.
There's something strange about it. When I use loadabs with a map on me it returns 2. Whereas when I put it in my backpack and use loadBackpack it gives me 0.0125.
BW mg3 has no mass entry, also no weaponSlotinfo.
I don't know what you're looking at.
https://git.koffeinflummi.de/bwmod-team/bwa3-public/blob/master/bwa3_mg3/CfgWeapons.hpp#L152
yeah well 200 mass
but what do i take from that.
its ~ 11 kg in game in inventroy
mass is mass and volume combined
Arma doesn't have any "kg"
It's just a arbitrary "magic" mass unit, it's not kilogram or grams or anything
well the inventory does have kg (might be ace, idk)
i dont know what rainboypony needs the mass for, but an abstract mass value is worthless to me mostly
Mods like ACE though made up a formula to convert game-mass into real world values that about match what you expect
Here's what ace uses
private _weight = loadAbs _unit * 0.1;
format ["%1kg", (round (_weight * (1/2.2046) * 100)) / 100]
I have the answers to my questions, thank you 🙃
(Last question, this type of product is it hard to make: https://armaservices.net/product/main-menu/ ?)
I don't know why they do a * 0.1
or why loadBackpack returns a weird value
lol
one would assume that such an easy thing like weight would be easy to get in this game
load player returns an absolte value (in kg iirc) tho
thats what i use to weigh MGs
and its accurate
also not an ACE function
load returns the relative mass.
It's explained on wiki what it does
it doesn't return mass
I found out about my question. I have to get the full capacity of the bag and multiply it with : 0.0125. * 160 = 2
Returns current sum of mass from items stored in all unit's containers
im like 95% sure it returns KG
"and its accurate" I have absolutely no idea what you are doing mate 😄
https://community.bistudio.com/wiki/load formula is right there
it returns percentage of "maxSoldierLoad"
not mass in kilograms at all
well, i put a gun in the units backpack, weigh him before and after and then write down the difference = weight of gun#
not with "load" no.
You get the percentage that the gun weighs relative to maxSoldierLoad
I'll fix the wiki page for loadBackpack. Thanks @subtle flint
and loadUniform.. and loadVest
hm let me test again
👌
now okay, it either a huge coincidence, but i tested my script again and got all the weights of all MGs i use
with the "load _unit" command
"rhs_weap_m249_pip_S_vfg",7.17255 for example
IRL weight is 7,31 bis 8,4 kg
"CUP_lmg_M60E4",10.314 - IRL 10.5 kg
beware as that only worked for guns, the magazines gave back really wierd values.
Wiki fixed
maxSoldierLoad in vanilla Arma is 1000
rhs_weap_m249_pip_S_vfg is 159.39 in config
Using ACE formula 159.39*0.1 * (1/2.2046)
That's 7.22kg
Don't know what your script does.
interesting
But the wiki is correct.
load returns percentage of max load.
_mass0 = load _unit ;
_unit addWeapon _wepclass;
_mass1 = load _unit ;
_unit removeWeapon _wepclass;
_wepMass =(_mass1 - _mass0)x100x0.45;
//*0.45 bc lb to KG
thats the core of the whole thing.
maxLoad is either 56 or getNumber (configFile >> "CfgInventoryGlobalVariable" >> "maxSoldierLoad")
good to know the formula for config to Kg tho
makes it much easier to get precise values
according to your results. In your config maxSoldierLoad seems to be 22.2 for you?
I have never seen a mod that changes that, and my configs all have 1000 in there
*0.45 bc lb to KG hold on. what?
dont ask me
its just the value i got and i played around until i got useful stuff form it
You said load returns the weight, but it doesn't at all.
As I said
(159.39/1000) * 100 * 0.45
Boom
(weight/maxSoldierload)* yourspecialthing
It returns a percentage
i dont know what i did, i only know that it works and i get KG in the end lol
ofc if the maxLoad is always 1000, and you multiply it by a thing it will end up roughly at the same value
yeah thats probably what i did. but your method is better
Are we clear now that load doesn't return weight?
yes
it just corresponds to weight if the max weight in a player is 1000
coincidence basically
If you want to still use load, and get real weight.
(_loadDiff * getNumber (configFile >> "CfgInventoryGlobalVariable" >> "maxSoldierLoad")) * 0.1 * (1/2.2046)
yeah ill see that i use the ace formula in the future to get more precise values
Since I currently can't test it, are variables local or shared across the network?
Client 1: fooBar = createVehicle ['LOP_AA_Offroad', [3380.74,2139.57,0.0236716], [], 0, 'CAN_COLLIDE'];
Client 2: player distance fooBar
Global variables are not shared over network by default. You would need to publish it over network.
Hi guys. Any thoughts why I can't put an item to the player's inventory with this code?
`this addAction ["Take the Antidote Kappa", {
[ player,"RyanZombiesAntiVirusCure", true ] call BIS_fnc_invAdd; }];`
I've tried different item classes and addItemToBackpack stuff too.
BIS_fnc_invAdd never heard of that..
Holy macaroni what is that function..
Why does one need vectorDiff for adding a item to inventory.
And wtf, it's counting slots? That's not a thing anymore in A3.... wtf..
https://community.bistudio.com/wiki/addItem here. This.
u sure that classname is correct?
Most probably, yes, because I've tried other classnames from tutorials and they also didn't work.
Have you tried... you know... vanilla items?
addItem definitely works
If it works for a vanilla item and not your modded item(s), it's a mod issue (or you've got incorrect classnames)
Not sure about addItem somehow I've hit addToBackpack from the first googling and then got to functions because sometimes they were more bulletproof than scripting commands
I'll try addItem for sure
Hi, can i detect, that player is using scope? I tried to use animationState but this doesnt work (same state).
Most BIS functions aren't really preferable
@twilit field https://community.bistudio.com/wiki/cameraView
great
BIS functions are nice.... But not 10 year old arma 2 bis functions that someone forgot to delete
And it was a cherry on a cake after 5hrs struggling with ai getting through the walls, so i probably weren't too focused :)
Hey folks! I'm having some issues with the v1.93.145618 waitUntil change/update. I have as follows:
mug_types = ["LandVehicle", "Ship"];
waitUntil {uiSleep 1; ({if ((objectParent player) isKindOf _x) exitWith {true}} forEach mug_types)};
//do something
And I'm getting a "Type Bool expected Bool" error. I know why it's happening, I'm pretty sure (if it returns false it becomes nil) -but- I've been pulling my hair out trying to figure out a workaround. On dev-branch as well, FWIW.
Am I missing something?
waitUntil {mug_types findIf {(objectParent player) isKindOf _x} > -1}? (an idea anyway)
You know what, I think that'll work fabulously! Much appreciated. Knew there had to be some not-overly-convoluted way to do it, but be damned if my brain wanted to go there. Thanks again!
Thanks guys for the addItem command, much appreciated! But the adventure continues - does anybody know how to find actor of the triggered addAction command?
I have a mission for the blufor guys to bring an item to the specific place and push the button with addAction. Inside there is an if that checks that the guy who pressed the button has an item. But there are 4 different MP guys and I can't just check a player.
"find actor of the triggered addAction command" you get it as argument in the code that addAction executes
read addAction wiki page
Read thrice and now it seems that I'm a blind and / or stupid. _this params ["_caller"], right?
Is it possible to get the Legacy Fatigue to work? It would be kinda cool if I could get the very old stamina system working again
i wondered since it is found in arma 3 samples
@gritty grotto not without an addon (available on the Steam Workshop) I'm afraid
what you mean?
do you mean that it won't work without making it as a mod? I figured that.
"to get the Legacy Fatigue to work" yes
LOL... Does the Legacy Fatigue Mod still work? https://steamcommunity.com/sharedfiles/filedetails/?id=561559542
According to the first comment it works with some exeptions
That comment was 2017... lot of water under the bridge since then
I am trying to get players to respawn on a carrier but you know, lets fall through the deck glitch cause object solid state is weird.
At the moment I have tried a respawn_west marker on land with a trigger using
Cond
this && (player in thisList)```
On Act
```player setPos [getmarkerPos "something" select 0, getmarkerPos "something" select 1, 10]; player setPos [12670.24, 24750.043, 23];```
Issue is the "teleport" works though setting height is a issue. 23 on Z lets you fall 20m onto the deck and 22 lets you fall in water. Tried every .something value with no luck. Does anyone maybe have an idea how to do this or how to make the carrier a "solid object"?
Use absolute positioning with setposasl
Thank you, though I might need that in a "simpler" english as that was foreign to me
Teleporting player into a vehicle that is on deck like the RHS CH-53 that has the cargo space will work. Just lack the know-how
I have found this as well
if (!isServer) exitwith {};
{
_x addEventHandler ["respawn",{
_unit = _this select 0;
if (!isPlayer _unit) exitWith {deleteVehicle _unit};
_vehicles = vehicles select {(side _x == side _unit) && canMove _x};
if (count _vehicles > 0) then {
_unit moveInCargo (_vehicles select random (count _vehicles -1))
};
}]
} foreach playableUnits
}```
On line ``_unit moveInCargo (_vehicles select random (count _vehicles -1))`` I assume that is any random side vehicle? If so how would I set it to a specific vehicle?
It worked ^ Thank you
Guys, maybe someone has faced this:
-multiplayer, a group of 2 UAV's spawned. When logging any of them diag_log format ["uav: %1", _uav] in logs I see 9:41:51 "uav: B Alpha 4-1:2"
-after some time, the group entity itself disappears. The vehicles themselves are in place, but out of crew and out of the group itself. When you try to log, you see 9:45:51 "uav: 00007FF63C13C4E0"
-about 4 minutes passed since the group was spawned to the moment of it disappearing
-happens regularly on the live environment
any ideas what the heck is this?
Some mod script deleting groups/ai units
don't think.. the only assumption - is arma might consider the gruop with UAV's only - an empty group and eat it with the deleteGroupWhenEmpty mechanism
will be able to check in some hours
what actually confuses me a lot - is what gives the uav: 00007FF63C13C4E0 when I make diag_log
that's the memory address of the uav vehicle
Hi there guys.
Any advices on how to get trigger owner via script?
you mean like https://community.bistudio.com/wiki/owner?
have you tried if owner works?
Oh gosh. It's like "google how to get owner of the trigger? Oh, nobody knows for sure. Just spend an hour or so digging commands never finding nothing useful and then boom it's owner!"
Thanks, @still forum i'll try owner now 😃
Yeah, was there just looking at the wrong direction.
Tried in trigger onAct:
_caller = owner this
Didn't work.
what did it return?
this is not defined in on activation
the variables are thisTrigger and thisList
owner thisTrigger
digging through debug console docs to get what it returns
https://community.bistudio.com/wiki/setTriggerStatements (for thisTrigger info)
Just save it into a global variable
but. I can already tell you it returns nil, because this is nil too
Just got some fun debugging. 3 MP players, each has a script that creates a task and addAction on death. Code is 100% similar (except for units names of course). Works well for the Singleplayer. In MP the "host" player script works only for the task creation. addAction does not apply. Other players' scripts work just fine.
locality of addAction?
I'm trying to use the invisible O_TargetSoldier by spawning it in front of BLUFOR AI but the AI aren't targeting it or even reacting to it. I've been using createVehicle to spawn them. Does anyone know how to get AI to react to these targets?
@still forum
locality of addAction?
Could you elaborate on this a bit more?
how do you run the script that executes the addAction?
could remoteExec it over to the correct player
it's a trigger that checks if the MP player is dead and has an Item as Condition and then adds action to the player's name variable: bf1 addAction ["blabla", {dirty deeds}];
does the trigger run globally or server only?
globally
then it should probably work 🤔
does anyone know how to get O_TargetSoldier to work?
@lethal sandal are these soldiers OPFOR or do they have something that eagers BLU guys to shoot them?
no, just needed sides. however, i found another classname that works: LaserTargetW
to clarify, I wanted AI to to target a prop based on it's init file
but independent does not have a LaserTarget
wait nvm. LaserTargetW doesn't work
@still forum
then it should probably work
That's exactly my thought!
I'm running this MP player as host from the editor wonder if that could be an issue
@lethal sandal did you look at this one? https://forums.bohemia.net/forums/topic/212237-ai-does-not-fire-at-practice-target/?tab=comments#comment-3254631
Long story short if the target is a vehicle (not an object) then doTarget + doFire should do the trick
the issues is that I need all the Units to not only attack but also react to it as if it were another AI.
hello all. I'm creating a mp scenario and I was wondering if there's a way to detect when players are in a certain area and teleport them to a location? This is easily doable with variables but do I have to assign a variable to each player? There's more than 70 so that way would be very inefficient. I heard that each (human) player already has a local variable called "player" but would this work with an area trigger?
"I heard that each (human) player already has a local variable called "player"" no that's not how that works.
{/your code here/} forEach allPlayers?
area trigger trigger onActivation code get's all units in thisList variable
Just grab all players thisList select {isPlayer _x}
and then teleport all the units in that list
if (player inArea playercatcher0) then{
player setPosASLW [15457,15485,23.7];
player setVelocity [0, 0, 0];
};
so this is the code
You might want to make a serverside only trigger for that.
For one that improves performance for your players.
Second it prevents every player trying to teleport every other player 😄
yeah exactly what I want to avoid lol
make a area trigger, server only
onActivation: {_x setPosASLW [15457,15485,23.7];} forEach (thisList select {isPlayer _x})
Why do you set the velocity?
And why aslW ?
so this is on a carrier and anything other than ASLW didn't work for some reason. My guess is that this is due to the sea floor not being equal in terms of altitude.
when players jump down the carrier they gain a velocity and when I tested the script on a singleplayer scenario I died when I teleported back, setting the speed to 0 solved the problem
@still forum thanks for the code! really helpful.
ASL should also work fine
@still forum just tested it and it works on players. thanks for the heads up.
I want to use DEBUGMSG(TEXT) as marco in my script to print TEXT in the chat using systemChat.
I would to define it like this #define DEBUGMSG(TEXT) systemChat TEXT;, right?
If I were to use #ifdef, #else and #endif to only make this work if DEBUG is defined. How could I still keep using DEBUGMSG but nothing would happen?
Just an empty define like #define DEBUGMSG(TEXT)?
why don't you first try before asking? i really hate those questions @delicate lotus
The answer is indeed, yes
I did try it and it kind of didn't work 😅
#define DEBUG
#ifdef DEBUG
#define DEBUGMSG(TEXT) systemChat TEXT
#else
#define DEBUGMSG(TEXT)
#endif
DEBUGMSG("my text")```yields
```sqf
{ systemChat "my text" }```
;
hmmm. Maybe because I used format ["%1,%2", _unit, _anim] instead of just a string it did not work
#ifdef DEBUG
#define DEBUGMSG(TEXT) systemChat TEXT;
#else
#define DEBUGMSG(TEXT)
#endif
DEBUGMSG(format ["%1,%2", _unit, _anim])
yes
commas start a new argument
you are calling DEBUGMSG with the arguments
format ["%1,%2"
_unit
_anim]
But a DEBUGMSG macro with 3 arguments doesn't exist
// #define DEBUG
#ifdef DEBUG
#define DEBUGMSG(TEXT) systemChat TEXT
#else
#define DEBUGMSG(TEXT)
#endif
DEBUGMSG("my text")``` yields ```sqf
{ }```
ahh, the good old comma problem
solution:
#define COMMA ,
#define DEBUGMSG(TEXT) systemChat TEXT
DEBUGMSG(format ["something is odd with %1" COMMA "peter"])```
ahhhh
the ;?
This would also probably work then.
#define DEBUGMSG(TEXT) systemChat TEXT
_msg = format ["bla%1",bla];
DEBUGMSG(_msg);
since it no longer contains a comma
yes, but now you waste performance cuz you always do the format ^^
but it defeats the whole "only render when DEBUG is set" thing
It's still only "rendered" when it's set
but eats computing power
||i love it when we end each others sentences @still forum 😏 😏||
I guess its best if I just do an formatting macro
nope, not me @still forum
barely used spoilers at all by now
someone did :U My brain knows this

I'm sure this has been asked recently but is it possible to disable the footstep sounds of a player?
not the sound themselves (without a mod),
but the effect on AI yes
https://community.bistudio.com/wiki/setUnitTrait myUnit setUnitTrait ["audibleCoef", 0]; @devout stag
Ah gotcha, the effect is for a tvt game-mode but thanks anyway!
Am I allowed to do #include "\A3\ui_f\hpp\defineCommonGrids.inc" in my description.ext ?
Not anymore since they changed how filepatching works.
Hmm... so it means, I can not include a file from another addon?
Yes, you can't.
But Mikero's build tools solve this problem by doing preprocessing at build time?
That's the way, right?
🤷
I mean if there is no way then it makes no sense to me
If it does preprocessing at build time there will be no include but inlined code so yeah it will work.
Also i don't know if it is the case for missions in addon.
I summon @still forum
He will know for sure.
Ok thanks Veteran
"Not anymore since they changed how filepatching works." since 3DEN.
"But Mikero's build tools solve this problem by doing preprocessing at build time?" description.ext is not binarized
So if it's not binarized then it doesn't do its preprocessing?
yes
I guess you could just preprocess it manually or smth.
But can't help you as I don't use any of BI or Mikero tools. Only armake2 and hemtt.
You always can use sqf-vm for preproc 😏 😏 
Yeah works nicely
what's bad in being able to include something from another .pbo?
if I have that pbo and I am at a server then it's not forbidden on the server

im trying to use the following in an action condition. the goal is to make sure the cursor object is not already attached to a player. but its not working. Can someone advise me on what im doing wrong.
((attachedObjects cursorObject) findIf {isPlayer _x} == -1)
I don't see a reason that check wouldn't return what you expect it to. true if no player attached, false otherwise
Isn't that testing for what's attached to your cursorObject, not what your cursorObject is attached to? I think you would want to use attachedTo instead.
^ would be the issue. See https://community.bistudio.com/wiki/attachedTo
Try
(!isPlayer attachedTo cursorObject)
Does anyone know a tool which allows comparison of two files and merge diffs line by line quickly?
Don't know the one which does merging
But notepad++ has a comparison plugin
Alright, thanks. Seems using git seemed to have worked.
I have an array of locations and I want to prune all locations that are not inArea of a list of another locations. How would I do this? More specifically, I have an array of houses and I want to only have houses that are in my array of city locations.
in can check position in location https://community.bistudio.com/wiki/in
@tough abyss So in basically uses inArea?
so houses = houses select {(_x in cities)}; ?
I dunno. What houses is, an array of what?
created using nearestTerrainObjects
Then no.
Read the page I linked to
What type of argument should be on the left of in
And cities is an array too?
Then double no
Yeah basically I'm filtering an array created using nearestTerrainObjects with another array created using nearestLocations
is there a way during nearestTerrainObjects I can filter it? (nearestTerrainObjects [player, ["House"], 300]) select {(count (_x buildingPos -1) > 0)}
It sounds more complicated than a single expression, but reading what you said again it is unclear to me what you want to achieve
Okay. I want all of the houses on the map within a 300 meter radius but only inside of a specified list of locations (using nearestLocations [getArray (configFile >> "CfgWorlds" >> worldName >> "centerPosition"), ["NameCityCapital","NameCity","NameVillage","CityCenter"], 25000];)
That is even more confusing. How many locations you want your houses to be searched in, one location or every location?
Okay look. I have the following
A: list of houses in a 300m radius to the player (using nearestTerrainObjects)
B: list of locations I want to filter the houses to (using nearestLocations)
That means I want NO houses that are OUTSIDE of B.
Dunno try something like this:
_filtered = _houses select {_pos = position _x; _locations findIf {_pos in _x} > -1};
Okay, I'll try that. Thanks 😃
would _filtered = _houses select {(getPos _x) in _locations}; work too?
Yeah that didn't work
I am going to try inArea
Nope none of that works
The code I gave you works for me ¯_(ツ)_/¯
@astral dawn what's bad in being able to include something from another .pbo? Nothing. It's a bug.
@cosmic lichen I use tortoise git's merge tool, or Araxis Merge cuz I'm so fanceh
is there any way to trigger ragdoll without using setUnconscious true? It kinda breaks quite a bit of stuff, the unit is unable to report that it is injured and player stops being a squad commander with causes AI to give orders with can mess up your tactics, even if you trigger the Unconscious just for a moment.
attach a can to the unit, set the mass of the can really high and setvelocity on it.
This seems to break the damage handling drom another script and units die inatantly.Needa further testing though.
@still forum Thanks for the tip, gonna try that.
For some reason, my serverCommand wont kick clients. I have ensured the password is the same as defined, check error logs but nothing is showing a problem
Here is my code:
'serverCommandPassword' serverCommand format ['#kick %1', name (objectFromNetId (netId player))];
```The name is returned by that code and it's correct, however nothing seems to happen in-game.
(objectFromNetId (netId player)) wat?
why
player is already an object
why turn it to netid and back
have you checked that the string you are sending it looks correct?
Yes it is correct, in terms of why I used that, I tried the normal name player but I had the same error as above, it not kicking, so I saw somewhere to use that
basically, it's there just from a random try
well if name player returns the correct data, why would the other thing then return different data, and why would the different data be correct if your current data is already correct. That doesn't make sense 😄
And you are 100% sure that command password is right?
Yes
its different from serverpassword and admin password
where do you execute that code?
Servers don't have dialogs
https://community.bistudio.com/wiki/serverCommand
"As of Arma 3 v1.39 an alternative version of serverCommand can be used on dedicated server and headless clients."
The client is actually executing it tho
Ah.
via a button click
The wiki says in multiple places that the command only works on server.
But you are exectuing it on client. What does that tell us?
We instead need to send it to the server right
remoteExec it and be done with it?
Cheers 👍
Or use the overload that doesn't accept a password and which works on the client 😬
But I guess that's more tedious and restrictive as you need to be logged in as admin
Yeah trying to avoid the logged in admin approach
do not forget to avoid the "ohh my allowed player UIDs is hardcoded into the missionconfig / is softcoded in a simple array inside the mission serverside" 😉
Is there anybody that'd like to help me out with some scripting?
Aight! I've been trying to get boxes to trigger a trigger once they're inside. I tried (box1 in thislist) and for some reason that didn't give any results what-so-ever. The ideal set-up would be where players load up a truck with crates/ammoboxes ect (Using ACE) then when they arrive they unpack the supplies and bring them to a drop-off point which will only trigger if all the items are inside the trigger. Basically I'm trying to figure out how to do that, and if its possible taking ACE logistics into account (As I think the items are despawned and respawned when loading them in and out of a vehicle)
"As I think the items are despawned and respawned" not ammoboxes no
ammoboxes are attached 100m below the vehicle and made invisible
Oh, that's interesting.
another question is: what does your trigger configuration look like, what does didn't give any results what-so-ever mean
what exactly right now is the problem? Trigger not firing or not the expected outcome results from that trigger firing?
The trigger won't fire. I had it set the same as you do when using (!alive box1) && (!alive box2) in its condition, with no type, activation and activation type selected.
... I think I fixed it myself. I never realized I needed to have Activation anyone present
well, that was pretty much what i expected :P
https://community.bistudio.com/wiki/Eden_Editor:_Trigger
I'm new to the entire ArmA missionmaking.. Bound to happen. Thanks for the help though. 😛
Still can't get this fcking kick to work 😠
_password = "aPassword"; //EXACTLY the same as the server.cfg entry, changed to show an example here.
_client = lbData [1500, ( lbCurSel 1500)]; //grabs currently selected user, this returns the name of the player. this works.
format ["[%1, '#kick %2'] remoteExec ['serverCommand, 2]", _password, _client]; //Exec on server and uses the kick playerName param.
Just for giggles I tried making an animation with ragdoll = 1; but it didn't work
You can see your error right in the syntax highlighting
first format, then remoteExec
not half-format half-remoteexec
_client = lbData [1500, ( lbCurSel 1500)]; Does this return a value?
uhm ... better question actually to me is: is that your real code?
format ["[%1, '#kick %2'] remoteExec ['serverCommand, 2]", _password, _client]; //Exec on server and uses the kick playerName param.```
because this obviously will not work for multiple reasons
Format returns a string...
yup
and not even the correct one as this is the outcome currently:
[whateverisinpassword, '#kick whateverisinclient'] remoteExec ['serverCommand, 2]
If i'm honest, been away from arma for a while, I keep answering my own questions here xD
i need to be putting format where the client part is
then taking from that
// Fixed format for ya
format ["[%1, '#kick %2'] remoteExec ['serverCommand', 2]", str _password, _client];
I'll give it a try 😃
Ended up working with sqf [_password, format ["#kick %1", _client]] remoteExec ['serverCommand', 2];
ty for helping 👍
Having lots of units each in their own group, so one group per unit is quite a waste of resources.
But if I want to make civilians walk around, all in a different direction to different positions I would have to put each civilian in their own group.
Is it advisable to just use agents instead, even though they apparently use the same collision model as players and therefor cost more resources then normal AI? (https://community.bistudio.com/wiki/createAgent; second comment)
Wow okay. I am totally going to save that for later use so I always know what is more resource expensive.
I sure have the time and ability to do that and I will. I want my mission to run as smooth as possible after all.
Can I spawn cars as a simple object?
Checking the Simple object box for the object in 3den seems not to work
It work
But you have to lock them because if you wanna get in you will stuck there and have to respawn
well it gets reset to unchecked after I reload the mission...
Hmm ok
probably because they are modded vehicles
Should not be a problem if there are modded good. But could be the reason. Try a vanilla vehicle
jup its because its a modded vehicle. Guess I have to iterate over all my prop vehicles and turn them into simple objects upon mission init.
If you have enough time you could spawn the model and not the vehicle itself. But I have no idea how and i‘m not sure if this really works
But google or another person here is your answer
@tough abyss so creating agents instead of units in a off-combat-limits base for atmospheric reasons makes sense?
do you know if the agents can do animations?
yeah, for my khe sanh helo transportation mission I have up to 400 AI mostly idling around. Replacing most of them with agents might make it actually playable without HC 😃
ok
That stuff is not well known enough
that these things work, and are good for performance
Maybe some chapter on optimization page on wiki could help with spreading the knowledge?
Just need to find someone with enough time to write such
😬
@tough abyss is it still possible to make agents shoot and aim with the correct commands? For shooting like forceWeaponFire
@tough abyss on the BIKI page of BIS_fnc_replaceWithSimpleObject it says this:
"Use with caution as this technique is not very clean - should not be used for many objects and definitely not in MP games.". Well my mission is a COOP MP mission...
But if it just replaces the object with a simple object, why should it not work in MP?
I don't see any reason why it could not work in MP.
Bear in mind that some notes on BIKI can be pure bullshit or speculation.
lol
However you never know with bi functions. The best you can do is to take a look inside with functions viewer.
yep. I usually do that with all BI function to just learn. Though its not always good practice since some functions are... well... meh in terms of efficiency
What is a Super Simple Object? @ https://community.bistudio.com/wiki/BIS_fnc_createSimpleObject
Apparently just the model is used instead of the class and the position is additionally adjusted. Not sure what that has to do with being a superior simple object...
It has minor performance advantage, but I think you can't animate it etc. 🤔
Okay I made my vehicles a simple object but there is a problem with vehicles that have guns.
They now have the muzzle flash as if they would fire...
Also they got a weird symbol attached to them...
I think thats a hiddenSelection https://steamcommunity.com/sharedfiles/filedetails/?id=1769042019.
You can hide them with hideSelection https://community.bistudio.com/wiki/hideSelection
so i'm trying to work out the set velocity script for the Virtual Combat support module with a plane, currently i have it as _this setvelocity [0,0,500]; for it to spawn at a height, but i need to give it speed so it spawns with the engine on. I had it as _this setvelocity [200,0,500]; but it just seemed to flip. Any idea's?
@zinc sorrel I think you can simply use https://community.bistudio.com/wiki/BIS_fnc_spawnVehicle and it will fly. If you want to follow the velocity approach, I recommend giving https://community.bistudio.com/wiki/setVelocityModelSpace a try
and don't forget to give it a crew 😃
we really need eventhandler that runs when player is changing his view. Already got 2 quite heavy loops due to lack of it:(
@shut finch There already is one "PlayerViewChanged"
@cloud thunder
No. it's not what it sounds like.
Fired on player view change. Player view changes when player is changing body due to teamSwitch, gets in out of a vehicle or operates UAV for example.
it's the most misleading EH name, unless I don't know something.
In other words: does it trigger when I change view from 3rd person to 1st person? Doesn't sound like it is.
I need an ability to create loops within that type of EH: https://community.bistudio.com/wiki/cameraView
what are you trying to do?
I've written a script that checks zoom when the player is using his scope and adjust shadow draw distance depending on the given zoom, so when you look into the scope you can see shadows at high distances. Unfortunately it has to be run in a loop forever, since there is no eventhandler.. also the bug with getshadowdistance command doesn't help either, it never returns value below 100.
Also I use another script that forces 1st person in specific vehicles.. and again, when player is in the vehicle it has to run in a loop (I already use getin vehicle EH at least)
I also see other great possibilities using this eventhandler, including draw distance optimization depending on the view, but again, it's not here.
You don't need to have a loop to restrict view for some vehicles you can use handler keydown and getoutman. You may also be able to avoid aloop for gunner and draw shadows with right mouse click for holding breath or zooming while in optic with key handler as well. here is an example of a BMR Insurgency exert for limiting 3rd person view when not in vehicles. It needs to be modified for your requirements ofcourse.
0 spawn {
waitUntil {!isNull (findDisplay 46)};
if (lobby_parameter_limitPOV isEqualTo 1 && {(difficultyOption "thirdPersonView") isEqualTo 1}) then {
player switchCamera "INTERNAL";
JIG_3rdPersonVeh = (findDisplay 46) displayAddEventHandler["KeyDown", {
_keyOver = false;
params['_display','_key','_shift','_ctrl','_alt'];
if (inputAction 'personView' > 0 && {isNull objectParent player}) then {
player switchCamera 'INTERNAL';
_keyOver = true;
};
if (_key in [DIK_NUMPADENTER, DIK_DECIMAL, DIK_ABNT_C2] && {inputAction 'personView' isEqualTo 0} && {isNull objectParent player}) then {
player switchCamera 'INTERNAL';
_keyOver = true;
};
_keyOver
}];
player addEventHandler["GetOutMan", {if (cameraView isEqualTo "EXTERNAL") then {player switchCamera "INTERNAL"};}];
};
};
you can add this to "KeyDown" to find out the output of right click if any
[_key] spawn { hint format["%1", _this]; uiSleep 1; hint "" };
I already use GetInMan to start a loop when player is inside vehicle.
Well, I still see you're using waituntil loop, but didn't know about inputAction command, that will help a little.
As for keydown, it's more complicated, but better than nothing, I'll try it, thanks,
the waituntil just happens once momentarily at the begining of mission. Once it gets past this waituntill then loop is forever over and it should be safe to add these handlers..
inputAction 'personView' shall help me get rid of loop, I didn't see that at first, thank you
np
Need some advice on how to prevent player from using client side mods on our server. We have a server side only mod and no client side mods. We changed the verifySignatures to =1 but it keeps giving a message on connect
"session lost - File 'addons\air_f_rtd.pbo' not found". what am i doing wrong
File 'addons\air_f_rtd.pbo' not found have you checked if that file is.. there?
should i look on the server or the client?
both
it exists on the server but not on my client. is it like a dlc thing or something? We dont require any dlcs on the server.
no it's not dlc
verify files on your client
maybe it shouldn't exist on the server, if so delete there.
If the client is really missing it, add it.
One of them is wrong
im concerned that other players may run into this. the goal is only to require basic arma 3 addons and prevent client side addons.
If multiple players have the same issue, then the pbo on the server probably shouldn't be there
maybe steam forgot to delete something
will we have issues if we have a server side only addon with out a signature? if use verifySignatures = 1;
if you load it via -serverMod then it shouldn't be an issue
ok
its saying that this is not found "missions_f_epa_data.pbo" but its on both the client and the server.
nvm
in the server browser, when i select our server it says "Time until mission ends: 15min left". how do i get rid of that? the mission is continuous.
Is there any vanilla fired even handler that I can plug myself into or do I have to add new fired EH to do my stuff?
I want to start a script every time any player throws a smoke grenade
Could somebody please provide me with the output of theese:
systemChat format ["%"];
systemChat format ["%1"];
systemChat format ["%2", 1];
systemChat format ["%%"];
systemChat format ["%%%"];
systemChat format ["%1", true];
systemChat format ["%1", false];
systemChat format ["%1", 1];
systemChat format ["%1", []];
systemChat format ["%1", [1,2,3]];
systemChat format ["%1", [[]]];
systemChat format ["%1", "test"];
systemChat format ["%1", player];
currently at work (and no arma installed at home because i needed those 120GB for something else)
@exotic tinsel https://community.bistudio.com/wiki/estimatedTimeLeft I believe
@winter rose thanks. But why is it showing up at all? is there something i can do in the description or server file so i dont have to script it in?
I don't know much more about this issue, I am sorry - it seems 15 minutes has always been the default value since OFP
what value must i assign to get it to go away? the wiki doesnt say
chances are either 0 or -1
estimatedTimeLeft 0; and estimatedTimeLeft -1; sets the server browser Time until mission ends: 1 min
well ... then i am not really able to help ya sadly
why not just ignore that number? not like anyone would have ever cared in the history of arma about it
plus as it seems that you have arma currently running, could you please execute theese quickly and provide me the output? https://discordapp.com/channels/105462288051380224/105462984087728128/589017100627083284
worried players will see the server is about to restart in 15min and since it says that all the time they may not join
@queen cargo sure i can do that
// initserver.sqf
[] spawn
{
while {true} do
{
estimatedTimeLeft 36000; // Set to max (10 hours)
sleep 3600; // Sleep for 1 hour
};
};
well ... you can always just use this workaround, unless somebody is actually capable of telling you how to disable this
how do you want me to capture these results? screen cap? or would you rather i write them to log file and paste here?
replace systemChat with diag_log and send him the RPT :d
we did already
and just like this, new SQF-VM test cases where born: https://github.com/SQFvm/vm/blob/master/tests/sqf/format.sqf
by the way, there is no way to show the % character from the left format argument? you have to "trick" with format ["%1" , "%"] ?
Does anyone have some kind of script for dumping ALL arsenal class names into a variable, the clipboard or something.
I'm pretty sure ACE uses this in this func: https://github.com/acemod/ACE3/blob/master/addons/arsenal/functions/fnc_addVirtualItems.sqf
but i can't decipher how to use it to get the names
uiNamespace getVariable "ace_arsenal_configItems"
@queen cargo did someone gave you the output ?
I solved it by adding stuff to a box with the Ace thing and then querying ace_arsenal_virtualitems
with getVariable
@compact maple yes
@winter rose no, only using that Trick percentage is possible as char
@still forum Your thing works too, but returns an array of arrays
nwm, the other thing does too
thankie! I always wondered if there was a hidden trick of some sort ^^
note: safe CVL reverted out of #perf_prof_branch
can you put a condition when adding an XEH in config, I want to add EH only to players, right now I'm adding it to every one, but I realize its not optimal. It looks like this right now:
class Extended_Fired_EventHandlers
{
class Man
{
class LZ_smoke
{
fired="_this call LZ_smoke_fnc_markLZ;";
};
};
};```
I see the issue now. Thinking about it removing the EH could break team switch, not sure how remote control is handled
and as bonus, fixed ctd in dynamic simulation in #perf_prof_branch
How can I put newline only in string? endl is \n\r, but I want \n only.
Putting \n in directly is having the effect of just printing \n in my case (using an intercept plugin)
\r\n?
?
I am sending a string to an intercept plugin which writes it to a file, and I want to put newlines in the file. If I send the string "\n" it just prints litereally "\n" into the file.
If I send endl I get two newlines
funny
Dunno if this is an sqf thing or an intercept thing
Intercept
So normally \n should be newline?
When used in Arma, yes
But not in a dll
Okay thanks
grrrr :/
but "\" doesn't need escaping to "\\"?
lol it does in discord tho
there is literally a wiki page for string but it doesn't explain any of this wtf. The words escape character aren't even on there :/
it must need escaping to \\ or how would you write \ and then n?!
Test and see (-:
i prefer explicit documentation I dunno if my test cases are universal or not
Sounds like it an issue outside of Arma though
my original issue is
right now i am just asking about escape characters IN arma though
at least i can exclude one variable if i can understand that
but i don't see any documentatio and google isn't helping
seems like the string "\n" is not a new line to me
or i guess it probably is when you pass it to certain functions or something..
I mean, I'm pretty sure that in Arma a string is just one unbroken line of continous text.
Pass a string containing /n to something like hint, and it'll display a line break
Or use parseText and then <br> works
yeah but pass it to diag_log or whatever and you just get "\n"
Because diag_log just prints a string
yeah that is what i mean it is interpreted by the function and itsn't actually putting control chars into the string
"just prints a string" isn't a definition of behaviour though
anyway thanks for help it is clearer to me now
Could always just ```sqf
_yarp = _stringIWantToSplit splitString "\n";
_yarp apply {diag_log _x};