#arma3_scripting
1 messages ยท Page 473 of 1
I know
I have 30 apples and an unknown amount of players. I wanna split the apples as equally as possible,
but always give out 30 apples
What do?
eat all apples and distribute none, that way they are equally distributed
๐ค
What if I replace the apples with umm...
ACE_bananas
I can not eat any bananas
I am allergic to bananas
how do I give the 30 bananas to unkown amount of players in a way that every single time 30 bananas are given out and they get as close to equal amounts of bananas as possible
lol
wait I think I know
_apples = 30;
_players = allPlayers;
for "_i" from 0 to _apples - 1 do {
_player = _players select (_i % count _players);
_player setVariable ["apples", (_player getVariable ["apples", 0]) + 1];
};
Something like this?
But wouldn't count _players mean that you actually know the number of players?
Code can be optimized depending on what "apple" is
ohh, I guess that can work ๐ค thanks
I didn't even think of it like that ๐
haha
He means that player number may change each time you run the script
I see
Any idea why (_disp displayCtrl 1600) ctrlEnable false; (_disp displayCtrl 1601) ctrlEnable false; hides my control instead of disabling it?
Seems like they are moved behind the background or so.
Try disabling background too?
Gonna try that
A long shot, but maybe there is a color defined for disabled control?
@meager granite No luck.
@peak plover That could be, let me check
You were right
Why didn't I think about that.
Thanks!"
๐๐ป
https://www.youtube.com/watch?v=EjIJMsk15u0 Let me know what you think, feedback would be appreciated! (New Function Viewer)
"Copy" button should say "Copy Source". Because of the placement it looks like it means "Copy function name"
Yep, you are right
looks nice, good job ๐ also no white backgrounds... finally... ๐
@cosmic lichen looks very good.
Wait these are all precompiled, right?
*preprocess
They are added via loadFile
need some experienced scripters to help me shape some lil project of mine: https://discord.gg/wbM6u2T
right now, it is mostly creating the chapters properly (yes, it is a text thingy .. not sure what it will end up being ๐คท)
What's that about?
i plan to write some comprehensive document about SQF
that is pretty much the channel to discuss everything
not much is yet done
but ... it is in the very early phase anyways ๐คท
Sound like alot of work, but the title fits perfectly ๐
it is
but ... hey ... that crap floated in my mind for ages already
and @gleaming oyster just made me think about it again ๐คท
^this btw. is the reason i need help by experienced scripters
so i cover every topic that may or may not be needed for SQF
I am going on vacation tomorrow, we can talk about that when I am back. I am generally interested but not sure how much time I can invest.
no problem
not sure how fast the whole thing will progress either
it may be done in a few month or in a year from now on ๐คท
What's the difference between BIS_fnc_addStackedEventHandler and BIS_fnc_addScriptedEventHandler?
ScriptedEventhandlers are scripted EH's
addStackedEventHandler is a old almost obsolete thing for engine eventhandlers
For back when you could only have one eventhandler in the engine that was used to be able to bind many functions to the same handler
but we now got stacked eventhandlers on engine side. Only thing that StackedEH is useful is that you can directly bind arguments to your handler code
I wonder why are both commands used in this snippet of code
tag_vehiclePlayer = objNull;
["tag_customEvents", "onEachFrame", {
_data = vehicle player;
if !(_data isEqualTo tag_vehiclePlayer) then {
[missionnamespace, "vehiclePlayerChanged", [_data, tag_vehiclePlayer]] call BIS_fnc_callScriptedEventHandler;
tag_vehiclePlayer = _data;
};
}] call BIS_fnc_addStackedEventHandler;
[missionNamespace, "vehiclePlayerChanged", {
params ["_newVehicle", "_oldVehicle"];
systemChat "Changed vehicles"
}] call BIS_fnc_addScriptedEventHandler;
@still forum
Do you need to like format and prepare the stuff and attach it to "onEachFrame" EH with addStackedEventHandler and then actually add the event handler with addScriptedEventHandler?
I'm confused ๐
agents
I can offload some code to the clients to keep server/hc perf higher
has anyone here done that?
Should I even do that?
So you want to offload the civilian AI calculation to clients @peak plover?
Benny's Warfare (back in A2) used to offload the AI calculation to clients with best performance
Let me check, I might even have the code on my PC
Okay
I'm thinking I'll measure fps and ping to the server, then set a variable that allows civilian creation
then I can use nearentities and such to make sure one area only has a certain max amount of civilians
basically I'd create civilians only around the player that is allowed to run it
/*
Get the available delegators.
Parameters:
- Count
*/
Private ["_amount", "_count", "_delegators", "_fps", "_get", "_limit", "_unit", "_units"];
_count = _this;
_units = if (isMultiplayer) then {playableUnits} else {switchableUnits};
_limit = missionNamespace getVariable "WFBE_C_AI_DELEGATION_GROUPS_MAX";
_fps = missionNamespace getVariable "WFBE_C_AI_DELEGATION_FPS_MIN";
_delegators = [];
_amount = 1;
while {count _units != 0 && count _delegators < _count && _amount <= _limit} do {
for '_i' from 0 to count(_units)-1 do {
_unit = _units select _i;
if (isPlayer _unit) then { //--- Only get players.
_get = missionNamespace getVariable format["WFBE_AI_DELEGATION_%1", getPlayerUID _unit];
if !(isNil '_get') then { //--- Make sure the client already communicated with the server.
if ((_get select 0) >= _fps && (_get select 1) <= _limit) then { //--- Check that the client FPS avg is above the FPS min and that it still has room for groups.
if ((_get select 1) < _amount) then { //--- Progressive checks to prevent client overloading.
_delegators = _delegators + [_unit];
};
} else {
_units = _units set [_i, "**NIL**"];
};
} else {
_units = _units set [_i, "**NIL**"];
};
} else {
_units = _units set [_i, "**NIL**"];
};
if (count _delegators >= _count) exitWith {};
};
_units = _units - ["**NIL**"];
_amount = _amount + 1;
};
_delegators
Note that this is from Arma 2
Then just set the locality of AIs (I think you need to set the locality for AI groups instead of individual AIs in Arma 3)
Hmm
From setOwner A3 Wiki page:
From server machine, change the ownership of an object to a given client. Returns true if locality was changed.
Since Arma 3 v1.40, this command should not be used to transfer ownership of units with AI (agents are an exception to this rule). Using command in an unintended way will display an on-screen warning and log a message to .rpt file.
To transfer ownership of all AI units in a group properly, use setGroupOwner instead.
right
So basically how does benny do it?
he loops through all the players
Finds the ones that are suitable for handling the units
/*
Make an object local to a client.
Parameters:
- Object
- Locality target (client)
*/
Private ["_object","_local_to"];
_object = _this select 0;
_local_to = _this select 1;
_object setOwner (owner _local_to);
But yeah, in Arma 3 you need to use setGroupOwner if you're handling AI groups, with agents setOwner works however
How does he get waypoints etc.
Hmm... Based on the code I'm going through, he seems to track the AI locality with this function:
/*
Track the delegation of a group.
Parameters:
- Client UID.
- Group.
*/
WFBE_SE_FNC_DelegationTracker = {
Private ["_delegator", "_group", "_uid"];
_uid = _this select 0;
_group = _this select 1;
_id = (_uid) Call WFBE_SE_FNC_GetDelegatorID;
while {!isNull _group} do {sleep 5};
if (_id == (_uid Call WFBE_SE_FNC_GetDelegatorID)) then { //--- Only decrement if the session ID is the same (make sure that the player didn't disconnect in the meanwhile).
[_uid, "decrement"] Call WFBE_SE_FNC_DelegationOperate; //--- Increment the group count for that client.
};
};
I guess you just need to monitor the locality of AIs (like above) and send the AI commands with eg. remoteExec
That sounds like waay too much traffic ๐
I don't know... If you target specific clients instead of spamming it out loud to every client, it should work, no?
@tender fossil why are both commands used Because they do different things. One add's a onEachFrame handler which is a engine handler thus AddStackeEH. The other add's a scripted eventhandler
The PFH is executing the scriptedEventhandler. It works like the CBA eventsystem pretty much
but worse
PFH?
What's PFH ๐
run code every frame basically
PFH == Per Frame Handler == onEachFrame
Ah
i guess i could've done a stacked mission EH for him, i never wrote vanilla code since those were added
tag_vehiclePlayer = objNull;
tag_vehicleChangedEHID = addMissionEvantHandler ["EachFrame" , {
_data = vehicle player;
if !(_data isEqualTo tag_vehiclePlayer) then {
[missionnamespace, "vehiclePlayerChanged", [_data, tag_vehiclePlayer]] call BIS_fnc_callScriptedEventHandler;
tag_vehiclePlayer = _data;
};
}];
[missionNamespace, "vehiclePlayerChanged", {
params ["_newVehicle", "_oldVehicle"];
systemChat "Changed vehicles"
}] call BIS_fnc_addScriptedEventHandler;
but whatever, it'll work for him :3
that would be the more modern variant
stackedEH's are.. mostly useless.. With the direct engine EH you get the EH recompilation bug and you cannot bind arguments
Hmm... I think I might've understood it, which is my goal since I'm trying to learn to write such stuff on my own ๐
yea i just couldn't remember the vanilla way of doing them in a couple lines
you get the EH recompilation bug
this is still a thing?
fucking lel
What "scriptedEventhandler" is doing is keep a Array in missionNamespace with all the handlers
...and to avoid the vast minefield of bugs
so you essentially have
VehicleChangedHandlers = [{systemChat "handler1"},{systemChat "handler2"}];
and
{call _x} forEach VehicleChangedHandlers
event systems like that are a nice way of keeping things modular in arma, that means you have one central place for basic events like that, and then in other areas you can add their actual behaviour
To your example.
tag_vehiclePlayer = objNull;
tag_VehicleChangedHandlers = [];
tag_vehicleChangedEHID = addMissionEvantHandler ["EachFrame" , {
_data = vehicle player;
if !(_data isEqualTo tag_vehiclePlayer) then {
{[_data, tag_vehiclePlayer] call _x} forEach tag_VehicleChangedHandlers
tag_vehiclePlayer = _data;
};
}];
tag_VehicleChangedHandlers pushBack {
params ["_newVehicle", "_oldVehicle"];
systemChat "Changed vehicles"
};
the scriptedEH functions are just a framework that take care of defining that tag_VehicleChangedHandlers array for you
// currently including HC
private _players = allUnits select {isPlayer _x};
missionNamespace setVariable ['mission_civ_sent',CBA_missionTime];
{
//--- runs on the client
// make sure player exists
if (isNil 'player' || {isNull player}) exitWith {};
[[player,(diag_fps)],{
//--- runs on the server
params ['_unit','_fps'];
private _sent = missionNamespace getVariable ['mission_civ_sent',0];
private _ping = CBA_missionTime - _sent;
_unit setVariable ['unit_civ_fps',_fps];
_unit setVariable ['unit_civ_ping',_ping];
}] remoteExec ['call',2];
} remoteExec ['call',_players];
// give time for players to return their stuff
sleep 1;
// limits
private _pingLimit = 0.3; // in seconds
private _fpsLimit = 50;
// select only the players which surpass the requirements
_players = _players select {
private _unit = _x;
private _ping = _unit getVariable ['unit_civ_ping',10];
private _fps = _unit getVariable ['unit_civ_fps',0];
(_ping < _pingLimit && _fps > _fpsLimit)
};
if (_civPlayers isEqualTo []) exitWith {systemChat 'civ: error no _civPlayers'};
// init the players
[true] remoteExec ['civ_fnc_initLoop',_civPlayers];
I got this so far
Hello, whats the best way, to play a sound when a player is near an specific object ?
@compact maple
https://cbateam.github.io/CBA_A3/docs/files/network/fnc_globalSay3d-sqf.html
Thanks you, but it say this is deprecated
right tnx
@peak plover <link that's not supposed to embed here>
oooh, yes
also your's can't embed anyway
Dedmen, what do you think of the sqf posted above
I wanna make players run scripts
Basically
Agents that run on players
My brain probably can't right now.. I just spent 3 hours with vectors and normals and degenerated edges
๐ฎ
Aite, I'll keep crackin' at it.
Trying to figure out clever ways to do this, without too much hassle.
imo better option will be just keep all mission flow stuff on the server only and "something ambient" on hc, if hc is on the server... so those ambient things is optional/required hc, nigel
Well
I use HC for normal Ai
server always has shit to do
Clients are complaining of high fps
I'll just use the clients
Why not to offload everything on HC only?
"Clients are complaining of high fps" What? ๐
But is it a complaint?
sure
Sounds like happy dude to me
A happy dude has no business playing arma
also possible > Man my fps was so high in that mission Man i was so high in that mission ๐
That is quite possible
My brain is generating endogenous high when I have high FPS in Arma, does it count?
i mean.... "to high fps issues... " do not exist afaik ๐
Ever play on a wonderful place called takistan ? ๐
This badboy can fit so many FPS
60 FPS... Mmm drools ๐คค
You can get more fps simply by following a couple of simple rules
with Dedmen unlocked exe you can have 500+ fps on the server, but if fps will be higher, i don't mind at all ๐
How would I define _this in this?
_this addweaponglobal "arifle_Mk20C_plain_F";
Which is called from an ammo box in my mission with this in the init:
Null = execvm "script.sqf";
this execVM "myscript.sqf" ๐
Oh. That explains a lot, actually. This shit used to work.
Never give ai weapon attachments.
Never give ai backpacks(unless absolutely necessary)
Limit the amount of total units in players view distance at any time as much as possible.
Delete dead bodies.
^ free fps above this line
cool mods ^ also... i mean play with just normal addons... ๐
@winter rose, there isn't an error being thrown anymore, but the box is still empty...
I gotta go to work, so I guess I'll have to work on this later, haha.
try _this setDamage 1 and see if there is an effect; if there is, the script has an issue ๐
Yes. That worked. Will explore later, thanks!
@winter rose, was using addweaponglobal, should have been using addweaponcargoglobal.
_this addWeaponCargoGlobal ["arifle_Mk20C_plain_F", 1];
try this ^ DEL-J ๐
๐
That was it, @meager heart. It's been a loooong time since I messed with equipment crates haha. Damn... Anyway, thanks a bunch, @winter rose and @meager heart. Gotta run!
Hello, I am having an error output show up on testing a mission I've created. I am not sure what it wants for me. Are there any editors out here who can help me make sense of it so I could fix the issue?
we are, yup
@tawny island Yes, it's best to just paste your issue/output here
between these
```sqf
I am not sure how i can copy the text from the little black square, or how I could expand it to copy it
Do you know how to access your .rpt file? The errors are logged as text there
:
```sqf
hint format ["you are %1", name player];
```
โ
hint format ["you are %1", name player];
No, how do I access this file?
%AppData%\..\Local\Arma 3
^ put that into start
or run
windows key + R
Look at the logs
Should I paste the entire file here? Thats kind of spammy.
I can upload it to a pastebin
Try out %LocalAppData%
@nigel "%LOCALAPPDATA%" :P
boom!
๐ฎ
I found the file, I am talking about the text
I guess pastebin is cool?
Search the file for the portion of the error that you did see
Ok, thanks, one moment please.
I am attempting to set up a zeus enabled mission. I am running all the CUP mods as well as VCOM-AI while editing.
I've unpacked a copy of the ZGM missions to copy the zeus setup, as well as copied the init and desc files to my mission folder.
But I think this kind of raw copy paste is what caused this error to start, so maybe I am missing a certain parameter defined somewhere.
Probably the init is trying to reference something that doesn't exist in your mission. Go into the init and comment out everything except what you're familiar with.
the only thing in my initServer.sqf is #include "\a3\Missions_F_Curator\MPScenarios\MP_ZGM_m11.Altis\initServer.sqf"
Also this repeats itself ``if (_rule > 0) then {
_grpCount = _grpCountR>
23:04:08 Error position: <_rule > 0) then {
_grpCount = _grpCountR>
23:04:08 Error Undefined variable in expression: _rule
23:04:08 Error in expression <IconVisible && (_grpCount < _minsize || _rule <= 0) && _n < _allgroupstotal && !>
23:04:08 Error position: <_rule <= 0) && _n < _allgroupstotal && !>
23:04:08 Error Undefined variable in expression: _rule
23:04:08 Error in expression < "_icon"
&&
!isnil "_iconsize"
&&
_rule > 0
&&
_n < _allgroupstotal
&&>
23:04:08 Error position: <_rule > 0
&&
_n < _allgroupstotal
&&>
23:04:08 Error Undefined variable in expression: _rule
23:04:08 Error in expression <isnil "_icon" && _rule > 0 && _n < _allgroupstotal && !i>
23:04:08 Error position: <_rule > 0 && _n < _allgroupstotal && !i>
23:04:08 Error Undefined variable in expression: _rule
23:04:08 No glasses for bis_curatorUnit``
Looks like trying to make this work is going to be a lot messier than just learning to put down a Zeus Game Master module.
I think so too, my problem is, even after I remove the modules I copied and the files except for the mission file the error keeps dishing out.
I guess I'll start over. Do you have any good tutorials for understanding how to lay down Zeus?
I couldn't find anything concrete that imitates the BIS zeus missions on the web.
Should probably take it to #arma3_scenario now.
Alright thanks for the help!
Try out %LocalAppData%
"%LOCALAPPDATA%" :P
boom!
ctrl+alt+r"Open Last RPT" vscode extension > https://marketplace.visualstudio.com/items?itemName=bux578.vscode-openlastrpt
pew pew
Which one of these is correct?
_drawMhqOnMap = addMissionEventHandler ["EachFrame", "updateMhqPosOnMap"];
or
_drawMhqOnMap = addMissionEventHandler ["EachFrame", updateMhqPosOnMap];
where updateMhqPosOnMap is a global function?
Both are "correct"
depends on what you are trying to do
the first one does nothing. You'd need to add a call for it to call your function
the second executes the function but is hit harder by the recompilation bug
So the first should be something like
_drawMhqOnMap = addMissionEventHandler ["EachFrame", { call updateMhqPosOnMap }];
?
Ah, so the string is interpreted even without the curly brackets?
how do i make a simple teleporting thingy
yes.
i want to be able to teleport from a flag pole to another
I see, thanks!
The function actually internally only uses string
it converts your code to a string. and uses that
lol
@tough abyss player setPos <target here>
not that directly. You'll probably wanna add a action
And then put the addAction into the object init
stupid question but is there just a simple mod for it?
because im terrible at this stuff
Making a mod is more complicated that just writing this script
so I don't think so
this addAction ["Teleport to target", { player setPos <target here> }];
in init field.
of course need to insert your target
okay so i just change the "target here"
the <target here>
so what am i supposed to put as the target if i want multiple of them?
got it
You can do it! Fly like an eagle! setPos [0, 0, 1000]
so the target is supposed to be a variable
so how do i make a target a variable lmao
WAIT
NVM
Is every function in the given file (given that there are multiple functions inside it) compiled if I call the file like this?
call compileFinal preProcessFileLineNumbers "Core\Server\Init\initServer.sqf";
ok i seem like an idiot rn that has to ask for everything but one more thing
@tough abyss Don't worry, I have the same feeling ๐
That's how we start our journey into Arma programming
now it says error: Type object, expected array
You probably used the object itself as variable, while you should use its position (getPos objectName)
this addAction ["Teleport to target", { player setPos (getPos _target) }];
omg thank you so much
@tender fossil that whole file is compiled. Including everything inside it
Nice, thanks again ๐
I guess you mean with "multiple functions inside it" whether the variables for these functions are set
compiling and setting a variable are different things
you are calling that code. Meaning it will execute. Meaning your assignments are executed. Meaning your variables are assigned
Also what the compileFinal there instead of compile?
That makes absolutely no sense
what command can i do after a skip waypoint trigger to force units to ignore all enemies and get in the chopper. they stay in auto danger too long searching for more enemies
@still forum I thought compileFinal would be better for functions ๐
Then you don't understand what it's doing at all
Probably not ๐
you shouldn't be doing things that you know nothing about. Keep it simple
KISS
super simple?
When is compileFinal useful?
if you store the function in a variable and want no one to be able to overwrite it
That's kinda what I did
I don't see store the function in a variable anywhere in there
you call it directly and then discard the code
The content of the file is (currently):
updateMhqPosOnMap = {
deleteMarkerLocal "mhqCurrentPos";
_mhqPos = getPos currentMhq;
_mhqCurrentPosMarker = createMarkerLocal ["mhqCurrentPos", getPos currentMhq];
_mhqCurrentPosMarker setMarkerShapeLocal "ICON";
_mhqCurrentPosMarker setMarkerTypeLocal "DOT";
if (speed currentMhq > 2) then {
_mhqCurrentPosMarker setMarkerColorLocal "ColorBlack";
_mhqCurrentPosMarker setMarkerTextLocal "MHQ - Moving";
};
_mhqCurrentPosMarker setMarkerColorLocal "ColorYellow";
_mhqCurrentPosMarker setMarkerTextLocal "MHQ";
};
Keep
It
Simple
Stupid
๐
yeah. you are assigning code to a variable without any compile inbetween
so the variable will not be final
Read again store the function in a variable
THE FUNCTION
not some other function somewhere else in your game
is it possible to delete grass with some sort of script?
updateMhqPosOnMap = compile "
deleteMarkerLocal "mhqCurrentPos";
_mhqPos = getPos currentMhq;
_mhqCurrentPosMarker = createMarkerLocal ["mhqCurrentPos", getPos currentMhq];
_mhqCurrentPosMarker setMarkerShapeLocal "ICON";
_mhqCurrentPosMarker setMarkerTypeLocal "DOT";
if (speed currentMhq > 2) then {
_mhqCurrentPosMarker setMarkerColorLocal "ColorBlack";
_mhqCurrentPosMarker setMarkerTextLocal "MHQ - Moving";
};
_mhqCurrentPosMarker setMarkerColorLocal "ColorYellow";
_mhqCurrentPosMarker setMarkerTextLocal "MHQ";
";
? ๐
@tender fossil compile takes string
Whoops
@tough abyss you could spawn a grasscutter. That's a object that hides the grass in it's area
don't know it's classname though
you should be able to spawn that in 3DEN too
okay but is it possible to change terrain from grass to rock for example
no
Is it better now? ๐
look at the syntax highlight and answer that yourself
Well, I guess it's correct since it's a string now ๐
look at that syntax highlight garbage and tell me again that it's correct
A string has one color in syntax highlight.
So maybe
updateMhqPosOnMap = {
deleteMarkerLocal "mhqCurrentPos";
_mhqPos = getPos currentMhq;
_mhqCurrentPosMarker = createMarkerLocal ["mhqCurrentPos", getPos currentMhq];
_mhqCurrentPosMarker setMarkerShapeLocal "ICON";
_mhqCurrentPosMarker setMarkerTypeLocal "DOT";
if (speed currentMhq > 2) then {
_mhqCurrentPosMarker setMarkerColorLocal "ColorBlack";
_mhqCurrentPosMarker setMarkerTextLocal "MHQ - Moving";
};
_mhqCurrentPosMarker setMarkerColorLocal "ColorYellow";
_mhqCurrentPosMarker setMarkerTextLocal "MHQ";
};
compile "updateMhqPosOnMap";
yeah.. compile "updateMhqPosOnMap" now returns {updateMhqPosOnMap}
and then you throw that returned value away
updateMhqPosOnMap = compile "updateMhqPosOnMap";
Now? ๐
That is the same as updateMhqPosOnMap = {updateMhqPosOnMap};
I guess it's related to how the interpreter works? (By replacing that variable with the code I've stored in it)
And because it's inside curly brackets, it's interpreted as code
curly braces mark the start/end of a string. Which is supposed to be compiled as CODE
you have to get your function into a string
easiest way is to just put it into a file and load it from there
Keep It Simple Simple
I never say twice... never say twice...
โ @peak plover
The problem is that I don't understand yet what is simple and what is not @meager heart ๐
That's what I'm trying to learn here ๐
That's why you should use CfgFunctions ^^
-Dedmen
that ^
So I guess it would be the best option to make new file for every function and compile the files individually?
I'll check the wiki article for the CfgFunctions (given that there is one)
Oh yes, this will make my life a lot easier ๐
once again, im still having trouble learning certain scripts. like this
{_x setcaptive true;} foreach [units baseass]
how do i fix my syntax
replace [] with ()
that would do it
so ive seen units with a shooting range with scores
is there some sort of script for that or do is there a mod?
Likely custom. Search workshop for shooting range missions.
ok there is one mod
altis advanced shooting
do i need to add that to tadts or
just subscribe to it myself and put it down on the mission file?
Can I group several functions together in one file to be compiled by CfgFunctions? Or do the functions need to be in individual files to be compatible with CfgFunctions
No you can't.
If you ask me, CfgFunctions is just a nuisance. compileFinal security usefulness is very slim.
anyone got any good video resources for arma 3 scripting?
Aight, thanks for info @meager granite ๐
In my opinion, unless you expect that your functions will be used by someone else (e.g. public mod that will be used in scenarios made by others), there is not much reason to use CfgFunctions, organize your codebase in a way convenient to you.
guys why this didnt working https://hastebin.com/celivuzeri.coffeescript
@civic canyon Config looks fine, but I doubt anyone will help you with Altis Life issues here, ask in their discord.
if i run setcaptive and action surrender on a unit while hes in combat, will the enemy still kill him or will it disengage
captive will set the unit temporarily to civillian site, other ai will not engage that unit then
that does not mean they will not shoot that unit by accident
defuser = createVehicle ["Land_MultiMeter_F", _caller, ["",""], 0, "CAN_COLLIDE"];
defuser attachto [_caller, [-0.2, 0.01, 0.06], "LeftHand"];
defuser setVectorDirAndUp [ [0,1,1], [0,0,1]];
Rope = ropeCreate [defuser, [0, 0, 0], _this select 3, [0, 0, 0], 3];
_this select 3 is a Land_MobilePhone_smart_F, the rope is not created, even if i reverse it, tohugh if I change to a vehicle it does work.
use params really ๐
@astral tendon ropeAttach only works (afaik) on PhysX, simulated objects
@meager granite ฤฑ found
If someone is interested FPS problems of the Liberation players that I was trying to debug were caused by C2 - Command & Control.
Every time unit respawns it adds more "killed" event handlers to player unit.
Full bug report on C2 discord: https://discordapp.com/channels/347326610657116160/348969069694812170/467448218645430314
almost... like 50% ๐
"C2 - Command & Control"
The ai commanding mod that was even featured a few times in BI articles.
I guess the author thought that "killed" EH dies with the unit.
It does not ;>
but that shouldn't lower FPS
after many rapid respawns i had 2k scripts in the scheduler.
it just causes big FPS drops at death
Oh.. It also add's scripts and never removes them?
It adds more EH and these EH execute something on every respawn.
So after few respawns it spawned so many scripts that my scheduler looked "dead"
count of active scripts was not going down for ~10min
Then there's two bugs. These scheduled scripts never stopping and always spawning new on respawn.
And the killed EH's stacking up which causes even more scripts spawned every respawn
hi What can I do against hackers?
Run Battleye. Ban them.
the server exploded
You say it was BOMBED? ๐
FBI has joined the server
yes i've tried so hard for it ruined
hi What can I do against hackers?
you can be logged as admin on the server, so when hackers will start hacking, admin will start banning ๐
๐ <with this tools
@winter rose is it possible to make a invisilbe dummy with PhysX?
with #arma3_model for sure... But without mods.. Dunno if hideObject disables physx
params [
["_namespace", objNull, [true, >
1:57:42 Error position: <params [
["_namespace", objNull, [true, >
1:57:42 Error Params: Type Object, expected Array
1:57:42 File A3\functions_f\Misc\fn_callScriptedEventHandler.sqf [BIS_fnc_callScriptedEventHandler], line 20
Ingame it complains about some error with preProcessor (empty file or sth)
Where could the issue be?
preprocessor? where
you are calling BIS_fnc_callScriptedEventHandler with invalid arguments
CNC_mhqEhId = addMissionEventHandler ["EachFrame", {
_currentVehicle = vehicle player;
if (!(vehicle player == player) && (vehicle player isKindOf "LandVehicle")) then {
currentMhq = _currentVehicle;
};
[missionNamespace, "mhqMarkerUpdate", currentMhq] call BIS_fnc_callScriptedEventHandler;
}];
[missionNamespace, "mhqMarkerUpdate", {
params ["_currentMhq"];
_currentMhq call CNC_fnc_updateMhqPosOnMap;
}] call BIS_fnc_addScriptedEventHandler;
yeah. currentMhq
arguments need to be ARRAY not object
exactly like the error says
So,
[missionNamespace, "mhqMarkerUpdate", [currentMhq]] call BIS_fnc_callScriptedEventHandler;
?
ye
Are you using scripted eventhandlers although you only ever have a single handler?
and why are you using EachFrame handler for all your stuff?
This is code written mostly by someone here ๐
EachFrame should only be used if you know what you are doing.
And if the timing needs to be exact
Yeah, I know it takes it's toll
I don't think it would be a big problem if the marker is updated half a second late
so, advanced armor plate mod auto doesnt auto add plates to vests, in eden nor zeus.
is there any way i can auto add plates to units i spawn in with zeus?
!(vehicle player == player) Wow.. That's...
(vehicle player != player) also exists.. you know?..
lol true ๐
@rotund otter that sounds like something extremely specific to that mod that probably very few people here know. Asking somewhere mod specific like on their BI Forum thread or if they have a discord or something would probably get you a answer sooner
i just need to know how to add an item (like a magazine) to a unit with additem, i just need to know how to sense when they spawn
Do you have CBA?
yes
https://github.com/CBATeam/CBA_A3/wiki/Adding-Event-Handlers-to-Classes-of-Objects
["CAManBase", "InitPost", { <your code to add stuff here. unit is in _this> }, nil, nil, true] call CBA_fnc_addClassEventHandler;
finding empty positions is a pain in the rear.
https://community.bistudio.com/wiki/BIS_fnc_findSafePos
Return Value:
Array - in format [x,y] on success. When position cannot be found at all, default map center position is returned, which will be in format [x,y,0]
why the hell return the default map center? do i seriously now have to write around that to catch it? jesus.
probably easier to look up the fnc, copy it and remove the bit of code that does that
Why?
"Preprocessor failed with error - Invalid file name (empty filename)"
I wonder if it has something to do with functions.hpp and using the default folder structure
just put it directly into description.ext
I've included functions.hpp to description.ext
thanks, ill take a look
#include "functions.hpp" like this?
Yes
is there a simple way to define custom AI loadouts and groups?
how do i add an item to a unit on zeus spawn?
["Man", "Init", {addItemToVest "SCT_plate_ceramic_sapiS_magtype" _this}] call CBA_fnc_addClassEventHandler;
or
init = "addItemToVest "SCT_plate_ceramic_sapiS_magtype" ['_Man'];";
what am i doing wrong {_x setcaptive false;} foreach [crew truck2 + vehicle truck2]
Basically
crew truck2 // [unit1,unit2,unit3]
vehicle truck2 // truck2
truck2 is already vehicle
vehicle truck2 is same as truck2
you cannot add an object (vehicle truck2) to an array (crew truck2)
forEach goes over each element of the array
by writing ```sqf
[crew truck2 + vehicle truck2]
You create a new array containing no elements, because you can't add (crew truck2) to (vehicle truck2)
ok so what would be an example of a way to do it?
to return all the crew members of the vehicle: (crew truck2)
i could do... {_x setcaptive false;} foreach crew truck2
yes
ok got it. just do it for units
Vehicle has side of commanding unit in it. Empty vehicle is civilian.
Yeah, so do (crew truck2 + truck2) @fair drum
you can't
you can't add a object to an array
(crew truck2 + [truck2])
That would work however
Ah, yeah, good point
๐
you do a good organized job at explaining
I personally used this only with agents and the "LEADER PLANNED" mode
Can one give the agents guns and have them shoot at people?
I take it you can actually give them guns if they inherit from CAMAN base, but you probably need to code all the target acquiring and pulling the trigger.
personally I only rally made ambient civs and animals as agents. once they need to shoot i'd rely on AI
ezier for me to just do normal units
@rotund otter for your information I just told you what do do but deleted it again. If you want any help here in the future I'd really suggest you read #rules
is there a way to disallow nvgs without removing them from inventory completely?
Anyone ever F with Source mods? My son wants to make a HL2 mod
@alpine dew This is the Arma discord
I'm aware
Is it safe to learn to create GUIs with Arma Dialog Creator?`
Or will I spoil myself ๐
@digital jacinth place them in the vest, unequip them?
I mean in general SQF coding gives you brain damage.
@tough abyss It's too late already
@winter rose scenario is total electrical wipe out. since they are using modern nvgs they shouldn't be able to use them. placing them into their vests is as good as deleting them
actually, no it is better then deleting them
but still. i wished i could just disable them or force them off as soon as they enter into the nvg mode
@digital jacinth you can script wise, visionMode or something like that
or dont remove the nvg but add full black display/overlay to simulate dead NVG.
true! it would be better (but for a player only)
maybe currentVisionMode + setAperture ๐
it will be for players only. however this would require me to check each second if the vision mode is the one i dissalow
i doubt there is an eh for that
I don't think a disableNVGequipment would work ๐
nah it works for vehicles only
yeah you would need a PFH but i doubts it is perf intensive.
checking each second should be enough, but knowing the players i usually play witht ehy will just spam the nvg key to see a little bit
waitUntil {currentVisionMode player == 1};
playSound "RscDisplayCurator_visionMode"; //--- cool sound
setAperture <value>; //--- > -1 auto default
๐ค
[{
if(currentvisionmode player == 1) then {setAperture 100};
if(currentvisionmode player == 0) then {setAperture -1};
},[],1] call CBA_fnc_addPerFrameHandler
something like that
setAperture ([-1, 100, -1] select (currentVisionMode player))
```๐
okay, so with ace nightvision enabled i have an even better effect now. this is with aperture 1000
https://i.imgur.com/ycItO6G.jpg
totally unsuable
oh no, i guess i also need to add a check if the player is looking through binocs..
probably you will have to check for the vehicles... too
๐ฉ
and weapon scopes...
ouch! true, totally forgot them
this is escalating quite nicely xD
LOL! I made my first dialog with ADC having pretty much no idea what I was doing, and got it working in the game within an hour
Got me honestly excited ๐
ADC?
Arma Dialog Creator
Now that I look at the config I exported, I feel sad for everyone that has had to go through it manually
What was trigger classname again?
just wondering, does anyone know exactly when onPlayerConnected / onPlayerDisconnected are fired? Like is it only when the player truly joins the server or can I use it safely for tracking which players are in a mission? (ie does it fire when a mission is started / ended)
I enjoy writing dialog configs very much, I must be a masochist
@primal mulch When you go from lobby to game and from game to lobby
Not when you join or leave the server itself
I enjoy writing dialog configs very much
๐บ
ah so if a player stays on the server between a mission finishing and starting it will fire for them both times?
(Leaving the server by say stopping game's process will also trigger disconnected event of course)
Configs GUI are not flexible anymore. I see more profit in procedural ones with createDisplay and ctrlCreate
It should
I don't think you can do everything with just createDisplay and ctrlCreate
Well you can do even more
Since you can't basically ctrlDelete a simple config controls group is already an argument for me
"NOTE: Since Arma 3 v1.69.141213 ctrlCreate will also search for control class in mission config, if search in the main config failed."
So yeah, you can do anything then
Yes since some 1.68 I believe
The thing is you can build GUI based on offsets with procedural way
I did that by copying all elements 100 times back in the day LOL
Like control Y based on previous control H f speaking roughly
I wonder if I might be the first one doing this back in 2013? ๐ค
Probably not
๐
lol
imo also animated elements ^ (sliding/collapsing/transforming) with ctrlCreate is kinda easier vs configs...
Dialog from the config above: https://i.imgur.com/A1Y9HPj.jpg
pats himself on back
The basic example of why I use procedural is when you have a list of controls (lists of something but better than RscListboxes) in controls group - if you want to delete and regenerate a new one you simply can ctrlDelete the whole controls group, while config will not allow that
This creates some kind of pagination
what i mean by "animated elements" (part of repair thingy) > https://gyazo.com/828e812db8c306b7064d1c605324370a
hi guys, nice GUI
i have a problem, I have a Unit with a variable name "tp1" (without the quotes) and when I try to use it in my scripts it says undefined variable. Could you help me please?
i can imagine 80% of the development time of koth was used for the UI
@tough abyss well is the unit actually there?
omg im retarded
There is also ctAddRow now that was added exactly for this kind of task, I didn't use it in real case yet though.
@tough abyss it means it's nil - unit wasn't created or variable wasn't defined at all
thanks @tame portal, probability of presence was 0%
@meager granite Those are still useful but lacking visuals
@tame portal This is actually not far from truth. UI and progression config were most time-consuming tasks initially.
Though honestly ct* stuff is kind of pointless since you have absolute flexibility with ctrlCreate\Delete already. And its not like you need to create or delete 100s controls each frame, usually heavy stuff happens onLoad or when you press a button, performance gain from ct* commands is likely a drop in the ocean in real cases.
Hey guys i downloaded a map called Chernarus 2035 the map has a lot of wrecked vehicles spread around it. When i use the console i see all of them are <NULL-object>. Now the core of my question is i have roaming AI which are struggling to pathfind trough these objects so i would like to remove them but none of the commands i know work on them (deleteVehicle, hideObject, hideObjectGlobal) any suggestions?
u can't do anything with them
before https://gyazo.com/8e4942131cbd432325d8ff20245678a6
after https://gyazo.com/43842e83d36884d59e387dcc2143608d
code in the console ^ ๐
im new to arma 3 is it a dead game?
@meager heart I am trying the same as your code and i cant get it to go away did you test this in Multiplayer or map ?
in Multiplayer or map
in Multiplayer on map < there ๐
@meager heart Cool i manage to get it working by using hideObject rather than hideObjectGlobal hmm
today I learned you can fill every bit of ram with arma by just shooting people up beyond the stratosphere https://i.imgur.com/XfkaziU.png
someone from my group is currently trying and arma is uses 30 gb ram now
@meager heart Thank you for your help i will figure it out further
@meager heart if you would allow me to pick your brain again.
Class => Land_Wreck_Skodovka_F
// Remove all wrecks
{
_x hideObjectGlobal true;
}
forEach nearestTerrainObjects
[
[worldSize/2, worldSize/2],
["Land_Wreck_Skodovka_F"],
worldSize,
false
];
Any idea how to get this working
afaik it should be type name not the class name ^
yes but the that class has no type
In the docs it says its of type wrecks but it does not work with nearestObjects or nearestTerrainObjects
I know but all i want is to be able to select all these objects trough one command so i can get their coordinates than i will make a script to hide them
And currently the nearestTerrainObjects does not have a way of giving me all the shkoda wrecks
0 spawn {
private _list = (nearestTerrainObjects [getPosWorld player, ["HIDE"], 1000, false]) apply {hideObjectGlobal _x};
hint str (count _list);
};
```into the console ^
nearestTerrainObjects doesn't use classes, use nearestObjects for that
nearestObjects [[worldSize / 2, worldSize / 2], ["Land_Wreck_Skodovka_F"], sqrt(2 * worldSize ^ 2) / 2]
Its a wreck of a skoda
ะจะบะพะดะฐ ๐
Thanks for the help gents i am going to bed will try solve this mystery tomorrow morning over a cup of coffee ๐
so with HIDE was removed: all wrecks, r2_boulder2, lavicka_3, garbage_square5_f and something else.... ๐
@meager heart the HIDE picked up the shkodas and the garbages i guess that would work for me
Now i just have to extract a list of coordinates of all the skodas and use that filter with very small radius on these coordinates and it will delete just the skodas
that thing >p_articum
@meager heart @earnest path tip: its better to hide objects in pre-init stage, and server only. Hiding that much of objects on client drastically decreases FPS and increases RAM usage. Server does it better and faster and doesn't really load JIP. Checked that multiple times for own purpose.
@unborn ether Sure my intention was always to use server to do the job on initial load. I was just looking for a way to get an array of objects that needed to be cleared
@earnest path is allMissionObjects suitable ?
Oh nvm it's not
It doesn't touch map objects
Well nearest*objects then
@unborn ether nearestObjects < afaik will not return those ^... preInit < unscheduled and with worldsize your mission start will be slightly deeeeelayed ... ๐ pre-init stage < thats before objects initialized... ๐ค
Hey there
Im locking for a way that force AI to use RPG-7 against a BlackHowk (you know what i wanna say :D)
I search many froums but cant find any thing usable
Can any one help me?
Why does calling BIS_fnc_findSafePos on the exact same location with the same parameters sometimes fail to find a position, yet 90% of the time finds one absolutely fine?
_checkPos getPos [_maxDistance * sqrt (_off + random _rem), random 360] call
random 360
That's why
@meager heart In pre-init objects are created but not initialized right - but pointers are already existent. I did cleanup in a world size and by specific coordinates. Worldwide cleanup takes around 40 seconds and touches ~18k objects on Altis map
@meager heart why is it faster - I can only guess that those objects which hidden in pre-init doesn't init any geometry and maybe simulations, so it's easier to go by created-hidden than created-inited-hidden
I remember that there is a way to disable default actions like place mines
what is the command for that? I need to disable the place exlosive.
I know the way with addon, but i don't think it's possible without any addon
This will allow to detect current action by name or string definition and disable acting with addAction to DefaultAction (see actions list) - this is basically allowing to disable any actions up to firing a weapon
inGameUISetEventHandler ["Action", "_this select 3 == 'UseMagazine'"];
```something like that, maybe
were is the list of actions?
there >
inGameUISetEventHandler ["Action", "hint str _this"];
nice, thanks
Hmmmm... How do I grab the init of an individual spawned in a group?
_HQ = [_Base, INDEPENDENT, ["I_officer_F","I_medic_F","I_Soldier_SL_F","I_soldier_UAV_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;```
I want to grab the medic's init to put something in there. So, I need select 1's init somehow. Is this possible? Is there a roundabout way?
https://gyazo.com/06c4dfeeefb0740021eefccb4509c6c4 Wondering how to fix this error, I have defined it everywhere
@mortal nacelle do not post URL links w/o short description of what it is , anywhere
@still forum fixed.
Does this work? Alternatively, how might I monitor if it's working myself?
{
{
_x execvm "Gear\AAF.sqf";
} foreach units _x;
_x deletegroupwhenempty true;
} foreach [_HQ, _G1, _G2, _G3, _G4, _G5, _G6];
The deletegroupwhenempty part is what I'm trying to monitor... It's not throwing errors, but I want to know if it's actually deleting these groups when they are dead.
@shadow sapphire well it pretty sure does, that group will become grpNull, if you want to compare further
How might I monitor that?
I don't actually remember why that exist, since AFAIK all empty groups are still deleted within some time
@shadow sapphire If you need to monitor that, you can temporary put them into global vars
Or setvariable as array elsewhere
Sounds good. Will just make them global temporarily. The only reason I added that deletegroupwhenempty catch is because it was noted that it was still needed on the bis wiki.
_x spawn {waitUntil{isNull _this}; systemChat "Group just got deleted";}
When I try to use:
[group this, getPos this, objnull, true] call BIS_fnc_wpDemine;
12:40:44 Error in expression <
};
} foreach (_units - _specialists);
sleep 1;
count _mines == 0 || count _>
12:40:44 Error position: <sleep 1;
count _mines == 0 || count _>
12:40:44 Error Generic error in expression
12:40:44 File A3\functions_f_orange\Waypoints\fn_wpDemine.sqf [BIS_fnc_wpDemine], line 140
12:40:44 Suspending not allowed in this context
12:40:44 Error in expression <alists);
sleep 1;
count _mines == 0 || count _units == 0
};
{
_x domove _p>
12:40:44 Error position: <|| count _units == 0
};
{
_x domove _p>
12:40:44 Error Generic error in expression
12:40:44 File A3\functions_f_orange\Waypoints\fn_wpDemine.sqf [BIS_fnc_wpDemine], line 142
That happens.
Well it says what the issue is: 12:40:44 Suspending not allowed in this context
As for other error, probably wrong arguments
yeah ^ call that function from scheduled or spawn it maybe...
It's a BIS function and I can't seem to find the documentation I need to understand it, since I'm ignorant about function.
Oh, that's a good idea!
Spawn. Will try that soon.
location of that function File A3\functions_f_orange\Waypoints\fn_wpDemine.sqf ๐
What can I learn from the location of the function?
I'm pretty ignorant about this stuff.
It's a BIS function and I can't seem to find the documentation I need to understand i
so... just check it, maybe you will find the answers ๐
copyToClipboard str BIS_fnc_wpDemine
Is quickest way to see what's going on
Otherwise look at original file
Copying function into clipboard like this doesn't have comments and some formatting, but it should contain file path of original script and can give you a quick idea what function does.
Yeah, it's a very neat technique.
Hey lads, If I were make a mod that uses vanilla units and stuff to add custom units into factions, like CTRG, will it still be clientside etc. or not
Depends on how it's implemented and if you care about errors being thrown.
If you do it as a replacement, you can do it pretty slick, but if you do it in addition, then it's down to your tolerance for errors being thrown.
Sorry I missed something on clientside hehe. I mewant clientside mods, like JSRS etc.
In theory, it's not required for everyone correct? (if it's vanilla)
This is for the Zeus Menu
That's what I'm saying. It's not required for everyone, as long as it isn't calling a class that the clients don't have. If it's calling something that they don't have, then it could throw errors in the back ground.
To answer your question in short form, yes. You can have host/server/Zeus mods without requiring them for everyone else.
I used to run a mod that relied on some trickery like that. Got the idea from America's Army II. Ask @past inlet about it, if you want. He's the one that constructed it. Was really slick stuff and I haven't seen it used anywhere but on AAII and on our Arma server.
Oh neat
I presume custom weapon textures will require all clients with the mod
but say, loadouts don't
(example)
Not necessarily.
Oh?
In fact, our mod was a weapon mod. We replaced the MX rifles with AR15s, and set it up so that errors weren't thrown, because there were no mismatches. Clients running the mod saw AR15s, clients without the mod saw MX rifles. It was a clean replacement, just had to make sure that file names remained exactly the same. So, you could do custom weapon textures that directly replace vanilla textures, then the host and any clients running the mod would see the custom textures, people not running the mod see vanilla textures, but get no errors or anything.
Just remember, REPLACE, don't ADD. Adding stuff in or misrepresenting a replacement gives you trouble or requires everyone to have the mods.
America's Army II used it in a very clever way. A way that I've thought about using for PVP modes in Arma or my own game. They had it where either side looked like the "good guys" to themselves, but looked like "bad guys" to their opposition. Very cool concept, instead of having a good team and a bad team, both teams were playing as the US Army against insurgents. Neat stuff. Clever execution.
Problems would arise with certain vehicles and hitboxes, but even then, you could get away with quite a bit with similarly classed vehicles.
Hello , Our new server has some problem about scripts.When more players join to the server , all scripts start to run slower as they play.As example : car lock unlocks with a delay , a bit late.When you log out and re login to the server it fixes for you but a bit after that , the same problem starts to happen again.Server's ping is normal and cpu , ram is pretty good too.There's no problem about them
write better scripts or get better internet?
@civic canyon Your client VM degrades, relog tells that this is not JIP - that means your scheduled environment gets pawned with some whiles or wait untils in spawns or something
To be a noticeable delay, you'd need a large amount of that
you guys know of a good linting tool for SQF and HPP?
One might assume he'd unlock the car on keydown though, and it wouldn't be scheduled
delay is getting too much
all scripts start to run slower as they play
When you log out and re login to the server it fixes for you but a bit after that slower
As someone said before, it sounds like you're clogging the client scheduler with too many infinite loops and/or spawned scripts
Can it be related to the command to destroy snakes and rabbits?
Go over all of your scripts and optimize them
Sounds like slow scripts
If your concept works and this prototype you have is fun but laggy, rewrite the thing and make it optmizied
๐ฆ
also you can check this > http://sqf.ovh/ite/2018/01/21/ITE-the-scheduler.html
@civic canyon
onEachFrame {systemChat str activeScripts}
Watch number grow as you do actions in your mission, this will give you a hint what causes threads to pile up
@halcyon ivy Visual Studio Code with the SQF Linter extension
How do you consume a new CfgFormations subclass? Can't seem to find anything that directly references the formation class names, just the corresponding string values accepted by setFormation and such.
Formations list is hardcoded but uses values from CfgFormations
You can't add a new one, only modify existing
with CBA events you don't pass code around
only the arguments
You have the eventhandler on the target side who already has the code and waits for a message with the arguments
In artillery support module, is there a way to restrict artillery support only when the cursor is targeting at armored vehicles?
you can create your "custom support system" with whichever options you want > https://community.bistudio.com/wiki/Arma_3_Communication_Menu
btw not long time ago did that simple arty call menu for the mission (with ctrlCreate only) https://gyazo.com/6027468bc33a8db91034ac799bb6f91a ๐
(picture from wip stage there ^)
@meager granite this problem is only in the civilian
LIB_argt_vasilev_group = group argt_vasilev;
_wp1 = LIB_argt_vasilev_group addWaypoint [getMarkerPos "argt_marker_task4",0];
_wp1 setWaypointType "move";
_wp1 setWaypointSpeed "full";
_wp1 setWaypointBehaviour "aware";
_wp1 setWaypointVisible false;
_wp1 setWaypointStatements ["true","argt_crossroad = true;"];
LIB_argt_vasilev_group setCurrentWaypoint _wp1;```
does anyone know if only the AI GL can complete the (move) WP or also you as player if you are part of the group and in the radius?
also is there way to force complete a WP?
also is radius really 0 b default (https://community.bistudio.com/wiki/setWaypointCompletionRadius) - doesnt fit with my perceived experience. can one visualize that?
does anyone know if only the AI GL can complete the (move) WP
afaik it's just about the formation/spread or whoever will be in the completion radius first
also is there way to force complete a WP?
setCurrentWaypoint< last active wp becomes completed
also is radius really 0 b default
probably it's depends onunitReadyor some engine based way of checking when unit completed "move order"... or he is atexpectedDestinationso it's slightly random like withdoMoveandmove๐ค
params ["_waypoint","_group","_position"];
[_waypoint,_group,_position] spawn {
params ["_waypoint","_group","_wpPos"];
_distance = (leader _group) distance _wpPos;
_distance = ((_distance)/1000.0) max 1.0;
sleep (_distance * 200);
_currentWPs = waypoints _group;
_newPos = getWPPos (_currentWPs select 0);
if (_wpPos isEqualTo _newPos) then {
[_group] call GAIA_fnc_removeWaypoints;
};
};
So we have been finding that vehicles sometimes don't move, could be an AI mod or a game bug, regardless we have been cancelling waypoints if they hang around too long. This is a bit MCC specific as it assumes the first waypoint is the target (MCC generates two for just about everything and only the first one matters) and the way it removes all waypoints might not be appropriate but the approach of assuming some time period with a spawn script that sleeps and then checks if the waypoint has already been met or if it hasn't remove it works fairly soundly.
The tricky bit is determining the actual waypoint is done and you will probably want _currentWPs select currentWaypoint and not 0 and then the GAIA_fnc_removeWaypoints you will probably want to just deleteWaypoint _currentWPs select currentWaypoint
Thanks Sa-Matra. I was worried that was the case.
0 spawn {
private _group = createGroup playerSide;
private _marker = "VR_3DSelector_01_default_F" createVehicle (player modelToWorld [0, 30, 0]);
for "_i" from 1 to 5 do {
private _unit = _group createUnit [typeOf player, player, [], 10, "NONE"];
};
private _wp = _group addWaypoint [_marker, 0];
_wp setWaypointType "MOVE";
_wp setWaypointSpeed "FULL";
_wp setWaypointCompletionRadius 0;
private _wpRadius = waypointCompletionRadius _wp;
private _position = waypointPosition _wp;
waitUntil {unitReady (leader _group)};
{
if ((_position distance (expecteddestination _x select 0)) > _wpRadius) then {
_x doMove _position;
waitUntil {unitReady _x};
doStop _x;
};
} forEach units _group;
};
```this ^ https://gyazo.com/3290d023f972dc187d99ce94f4f6fc6d ๐
completion radius is 0
but...
i mean... actual units positions will be random every time
how to I add inventory opened to all future dead bodies?
Doesn't this happen already with normal arma?
I add inventory opned to all units and then?
hmm
Killed > InventoryOpened ๐ค
Respawn < and after > add InventoryOpened ๐
๐
@meager granite this problem is only in the civilian
@meager heart Just to be sure, add any EVH after Respawn ๐
Or even right inside of it
@unborn ether thanks! will try that one!11 ๐
BraK3N - Today at 14:16
@Sa-Matra this problem is only in the civilian
BraK3N - Today at 18:40
@Sa-Matra this problem is only in the civilian```
๐ค
Hello all, I am trying to get sound to play when a trigger is activated. I need the sound to play from a radio and to be positional. I also do not want the sound to be played and then played again because then it seems to play multiple tracks of the same sound overlapping.
I am currently using this:
condition this && (trigger1 getVariable ["delay",true])
On Activation On Activation [radio, ["music",3,1]] remoteExec ["say3D"]; null=[] spawn {sleep (61); trigger1 setVariable ["delay", true]}; trigger1 setVariable ["delay", false];
serverside only trigger with activation once?
Seems to work well in MP preview but I will be using on a dedicated server
Repeatable
And currently server only unticked
or remove the remoteExec
Could I swap say3D out for playsound3D because it is global
Then all players hear it at the same time
you could but it takes an absolute path
which is a bit tricky to set up on a dedicated server http://killzonekid.com/arma-scripting-tutorials-mission-root/
but yeah no reason to change this
just make it server only
OK rgr I will try it with the server only option ticked cheers for your help
sleep (61); > sleep 61; and if that trigger is trigger1 > you can use thisTrigger
Rgr cheers
@dusk sphinx
why?
so does anyone here know if it's possible to translate an object's rotation relative to another object with scripting commands within the eden editor?
like for placing walls, you could simply change the widget coordinate space to be local to the object rather than the world so you could align the walls perfectly no matter what their rotation is by sliding it along the appropriate axis
I am trying to align a bunch of walls that already exist but aren't oriented in perfect 90 degree angles relative to the world so I can simply copy the rotation but I can't find a way to move the other walls in local coordinate space
I wish there was a place like the animation viewer where you could listen to every line of dialogue in the vanilla game and get the path to it to call it for stuff...
Need a bit of help. I'm using ASOR vehicle selector and I need to detect when the vehicles spawned by the selector dies.
I was thinking, make a list and have the spawn pad add the vehicle to the list and then another trigger to check if vehicle in list is dead.
thinking what i need to do is add an eventHandler to the vehicle as its spawned
but not sure how to add it to the vehicle inside the trigger
I'm having a hard time understanding global variables.
I have a variable I want to keep on the server, which is sent to each client when they join, then execute code with that variable. I'm struggling to understand how to do this properly
is it possible to add an event handler to a vehicle via trigger?
like when the vehicle passes through the trigger
nvm i figured out another way lol
Is there any way to stop a group from becoming automatically deleted when there are no players in it anymore? I create groups prior to any players joining, and it doesnt delete until I add a player and then remove them with [player] joinSilent grpNull. I have set it to not automatically delete when empty as well.
I already use deleteGroupWhenEmpty false so very weird.
you dont have any clean up scripts deleting empty groups manually?
I do however I check isGroupDeletedWhenEmpty before deleting them to make sure they shouldn't be deleted
this is not a reserved var?
neither is _this iirc
you can also overwrite _x
only commands and "" are reserved. this _this _x are all not commands
this is a local variable
This is insane
this isn't insane
Lol
Same for anything similar like _forEachIndex
calculatePlayerVisibilityByFriendly true
//friendly units will/will not calculate visility of player```
probably. its in dev branch - no more info from BI yet
anyone ever profiled the gain from disableRemoteSensors?
BI said back then they had a significant gain, most community people in BIF and reddit couldnt see any "visible" difference, while a few people saw a (big) difference
Yeah I saw the dev entry, wasn't sure
Would be nice if dwarden or someone else with detailed knowledge could write something up on the wiki about these two commands and the common situations to use them
There are details on the talk page but they're old, from 2015
Ah nvm, I see he has a thing on Reddit (probably should link to it on the wiki)
Hi,
If I place a trigger with the conditions BLUFOR present and repeatable and this in the on activation:
playSound3D ["A3\Sounds_F\environment\ambient\battlefield\battlefield_firefight2.wss", sound];
It should play a sound right? Any idea why it won't when I am testing in editor multiplayer?
Does the sound object exist?
its the variable name of the trigger itself
Try running it in Debug Console. Does it work there?
good point, one second
global execute right? @digital hollow
Or local because I am the server
hm
If I do this:
playSound3D ["A3\Sounds_F\environment\ambient\battlefield\battlefield_firefight2.wss", player]; it works
but it wont work with any object
I do not get it, ACEs ambient sound module also won't work
Should execute on Server. Try placing a test object and play it on that.
anyone know a good way of having people survive aircraft crashes? I've tried the survivable crashes mod previously but it cause errors when used with ACE
event handler?
Can onButtonClick have multiple entries? If yes how to correctly add the entries?
Does anyone know if removeMagazineTurret needs to be executed where the turret or the vehicle is local?
@wispy patio where turret is local
@forest ore in config - only one, in scripts - ctrlAddEventHandler
@forest ore if need more from config then use onLoad and add other by ctrlAddEventHandler
is it possible to convert local object coordinates to worldspace coordinates and vice versa?
like the coordinates used with the attach command and what that position would be in the actual world
is anyone familiar with ACE interaction framework here ?
I would like to add an ACE action to multiple vehicles, without knowing which ones exactly. It would like it to be the kind of interaction you have access when driving a vehicle, with your External Actions key, but without adding the action to each of the vehicles
Like, creating the action via script on virtually "all" vehicles and then check in the condition if the current player's vehicle must display it or not
I could add the action directly on the player, but if possible I want it in the actions of the vehicle, not in player's self actions
hi guys. Im having a strange problem that is really getting to me... hoping someone is able to help.
THE case that dont work atm:
- when playing on a dedicated server(have only tested local) and on a Zeus map, my vehicle dont seam to trigger init scripts(or at least not all) in the eventhander. (problem seem to happen on pre-spawned tank). If I spawn in new ones as Zeus, they work better but are still missing certain elements.
cases that work fine:
- playing on a dedicated(again local) server that is not a Zeus mission
- playing as the host in local MP (works fine on both zeus and non zeus missions)
- playing as the client in local MP (works fine on both zeus and non zeus missions)
- playing in SP (ofc doh, everything works in SP)
Anybody got any clue whats going on? any known Zeus bugs I should know about?(edited)
I know this got a little long... sry ๐ถ
I am using this for runing the dedicated server:
http://killzonekid.com/arma-3-local-dedicated-server/
@still forum you mean the eventhandler entries?
class Eventhandlers
{
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers_base {};
init = "_this execVM '\Macross_Destroids\scripts\init_destroid.sqf';_this execVM '\Macross_Destroids\scripts\init_walk.sqf';_this execVM '\Macross_Destroids\scripts\init_turret_rot.sqf';";
fired = "_this execVM '\Macross_Destroids\scripts\fired_defender.sqf';";
getin = "_this execVM '\Macross_Destroids\scripts\getin.sqf';";
getout = "_this execVM '\Macross_Destroids\scripts\getout.sqf';";
engine = "_this execVM '\Macross_Destroids\scripts\startup.sqf';";
killed = "_this execVM '\Macross_Destroids\scripts\killed.sqf';";
};
oh yeah it does
thats the weird thing
it works on a dedicated server that is not running a zeus mission
I see you have CBA there
and it works if playing on non-dedicated server, both as host and client
why don't you just use the CBA init eventhandler?
๐ค I thought this was the way to make my EH work with CBA
I can always show you my scripts, but they are quite big...
you think this could be source of the problem?
I edited my multiplayer mission and now it says just "Server error: Player without identity Ezcoo" when I try to join the server. Could this be caused by code?
Perfect time for discord to die
yeah....
It's caused by Google Cloud, it has issues atm
Is there any way that I can make it so ai will pass through when a gate opens or something like that
like when the gate is closed
they stay still
but when it opens they pass through
like when the gate is closed they stay still
https://community.bistudio.com/wiki/doStop
but when it opens they pass through
https://community.bistudio.com/wiki/doMove
Is there any mod which can check other user addons?
without signatures?
Serverside
poke my name pls
I don't think you are being clear enough, @quasi sedge . Any mod can have any other mod as a dependancy, but it's not a matter of scripting. It's all about config (and it's pretty straightforward). So, what do you want ? Checking by script if a given addon is loaded ?
I have ACE RHS CUP
without signatures people can load any other mod like cheating @proving_ground
How i can forbid other mods, which different from server?
so people can load @plucky grove @RHS @CUP only
?
but with serverside signatures=0
@vernal mural
So you want people to join your server with exactly the same mods as the server itself, but not using the specifically designed system, right ?
I don't know how to do it. I know ACE have a "check PBO" module, but I don't really know how it works or what it does. You might wanna have a look at it. Maybe you'll find some answers
why not just use verifySigantures ? Makes no sense.
@high marsh im forking one server ^_^
@high marsh is right though, this system is aimed at doing this task.
Here is the doc for ACE's check PBO module : https://ace3mod.com/wiki/framework/checkPBOs-framework.html
ty, i will check
forking one server??
whatever can lead you to use this, I suggest you re-think your project in order to use the dedicated solution. It will surely be safer and more stable
signatures is best method, but people dont want to load signatures each time they connect my server i think
What....
Your place your mod keys in your server installation, that'll restrict the allowed mods to the ones you provided your server with keys.
i have bad relationship with server which mods i using
What?
Then it's not your server to administrate. Mods contain keys, you load the mod keys on the server.
so i can generate keys which my clients will download?
and people can play both servers without any issues?
No, use the keys provided with the mods.
place the keys from the mod folder into your keys folder in your server installation
make sure your verifySignatures is set to 2
then mods with keys placed in your keys folder will be allowed whilst others will not
they use multiple mods like half cup half hlc and other pbo's
but okay, im will check https://ace3mod.com/wiki/framework/checkPBOs-framework.html
๐คฆ
best solution without signatures=2
Not really.
if this is something somebody slapped together then they have to create a key for it yes
but people need to download them? right?
If the client mod is signed with the same key then you're fine
they wont bother with downloading, thats problem
No, if they have your mod downloaded and you signed it with the key then the key you place on the keys folder for the server installation then your mod will be allowed to be loaded
otherwise, it will not.
#server_admins < - was the best spot to ask this.
@meager heart yeah but the thing is i dont know how to make it a variable
like when the bar gate is open, how would a3 recognize that?
like im so confused
@tough abyss the bargate being open or not is a status of an animation
it has a value from 0 to 1, you can get that via
you just need the name of the animation, i dont know that one on top of my head though
cant i just set it as a variable?
what is the benefit of that?
what is the goal youre trying to achieve again
i want to make a simple checkpoint with ai
when the gate is open
i want them to move towards a certain checkpoint
if its not open, i want them to stay still
i think you wont get around a loop of some kind in that case then
that repeatedly checks if the gate is open or not
or is the gate closed by default and only opens once per mission?
i think the loop would be the better choice
because im going to do it with multiple civs
(that code doesn't make sense at all btw)
i know
so you have ai sitting around somewhere and as soon as the gate opens you want them to move to a checkpoint
correct?
yes
can the bargate close midway through?
ai stands still, gate opens, they go towards the gate but it closes again before they get through
why not just use a tigger
how?
i never used triggers ๐
on deactivation, close it
i dont think thats what he wants
i have no idea how to make that
set trigger radius manually to the size of the gate
so you have ai sitting around somewhere and as soon as the gate opens you want them to move to a checkpoint
^
sounds more like the gate is supposed to give the go
anyway, if the gate can be closed midway through the AI should respect that it gets a bit more complicated as it must be saved when exactly the AI is through the gate
otherwise closing the gate after they went through would make them stop aswell
could just keep it open as long as they're inArea?
still need to know if they passed through ๐
cant i set a trigger to where it deactives the script as soon as they reach a certain place
like 5 meters away from the gate
well, if they're out of the area after being inside it then they've passed ๐
you could do that yes
ok but how lmao
im just confused on how the original script is even going to be made
...have you made a mission before?
if you havent worked with scripting at all yet this might be a bit overkill for you
lol
its not complicated but you would need to learn a bunch of things first to understand how to do it
im gonna be straight forward
yeah. go through the editor tutorial and start something simple, to begin with
is the script going to be complicated? if not, can you honestly just write it out for me
the script itself no
with a please and a thank you
its just that you wont understand a thing afterwards and run into the next issue and land here again lol
im sure this isnt everything you will need for your whole mission ๐
anyway, i'm off to sleep, good luck ๐
it actually is lol
im just making a checkpoint thing
like i wanna play with it for 30 minutes then go play something else lol
i dont have the time right now to do it sorry
0 spawn {
private _barGate = "Land_BarGate_F" createVehicle (player modelToWorld [0, 20, 0]);
private _unitDude = createGroup playerSide createUnit [typeOf player, player, [], 5, "NONE"];
_unitDude doMove (_barGate getPos [0, 0]);
waitUntil {unitReady _unitDude};
_barGate animate ["door_1_rot", 1, 1];
waitUntil {_barGate animationPhase "door_1_rot" > 0.5};
hint "It looks like... gate is opened!";
_unitDude call BIS_fnc_neutralizeUnit;
};
```into debug console ^ ๐
@tough abyss
Does anyone know how to get ai to speak. Not through radio but actual speech for a briefing that Iโm trying to make.
Anyone have a script that can toggle all lamps (including ones built into the map) off? I.E. I'm trying to emulate an EMP. The achilles mod "toggle lamps" function does not work, it would appear. That's speaking for the map Lythium. Please @ me if you know of one!
@weary pivot, https://community.bistudio.com/wiki/say3D
Hmm
speed only does forward speeed
how do I get speed, even sideways
add the x and y of velocity?
abs of x and abs of y
IS there any event that will run when ammo is created?