#arma3_scripting
1 messages Β· Page 474 of 1
What was the UI template pack in Workshop called?
Google -> Arma 3 workshop UI template -> https://steamcommunity.com/sharedfiles/filedetails/?id=287378519
@still forum remember that issue I had yesterday?
I found that attaching simple objects to my mech caused this:
every time I joined a dedicated server for the first time, some of the init scripts didnt work (I didnt get any error messages which is weird, but I printed out the attached objects and found NOID on alot of the objects). Some of these objects was used for positional Say3d sounds.. When leaving the game and rejoining, things worked fine.
after switching out simpleObjects with createVehicleLocal, the problem was fixed. Still no clue as to why this happened
wasnt a call for help lol π just telling about my findings
@nocturne basalt I was referring to Dedmen's reply to me π
oh sry ^^
@meager granite thanks. Guessed as much π¦
@meager granite Fired EVH also has a magazine along with ammo.
I think he meant creation of magazines in crates\inventory
oh I thought this could go here oh well
How do I retrieve data from listbox rows and columns? I see commands for adding data, but not for retrieving it
I'm adding data to a listbox like this:
params ["_commanderCandidate"];
_index = lnbAddRow [124, [format ["%1", name _commanderCandidate], "1"]];
Here's my loop for retrieving the selected row in the listbox:
_handle = [] spawn {
while {!isNull (findDisplay 1500)} do {
_commanderCandidateRow = lbCurSel 124;
_commanderCandidateRow // ??? How do retrieve and edit data in the row?
};
};
https://community.bistudio.com/wiki/lbData ? That maybe?
I don't know. You are mixing lnb and lb commands. That sounds wrong
Generally speaking you create a global array and then use the lb Index on that to get your data
Alternatively Set Variable on the control
Thanks for the tips! π
Urgh. I'm reading how similar dialog was implemented in Benny's Warfare, and while the code is kinda clean, it's just the UI framework that makes my brain melt.
For those interested: https://pastebin.com/duWP7ix0
Doesn anyone remember that drone operator station composition that was posted on the sub a while back? It had a few nice scripts I wanted to look at from what I remember and I cant seem to find it
Which sub?
I'm pretty sure it was on the main arma one
Bro... what sub? Could we get a web address?
A subreddit. Gotcha.
@hexed owl https://www.reddit.com/r/arma/comments/8v8a0g/i_made_an_editor_template_for_uavs_with/ did you mean this one?
can you have multiple tags in your functions.hpp file? looking for a way to better organize my functions.
can I play a sound using say3d that is only heard from the inside of a vehicle?
maaaybe, if you make the sound radius the size of the vehicle I think
result not guaranteed
Maybe local to everyone in the vehicle and not for everyone else?
playSound < maybe...
interestingly, when i last tried setting the vehicle as the sound source, the sound was actually attenuated
afaik all sounds which will be played not via radio channel, will be with those attenuations effects
(when you're inside)
I ended up using soundEngineOnInt guys
I dont understand this addCamShake function.. it seems to shake my screen no matter how far I am from the source
uhm ... https://community.bistudio.com/wiki/addCamShake
there is only one syntax
and that has nothing to do with range
duration: Number - Duration in seconds (how long the effect will last)
frequency: Number - Frequency of shake, practical range is 0 to 100 (how will be the rhythm).``` are what is expected @nocturne basalt
reason why your screen always shakes is because you use the command wrong
if you want some proper distance calculation, you need to do it yourself π
so you cant set the range? kinda thought it was build into power..
when using it like this>
addCamShake [10, 1, 10]; shakes no matter what
since it said range is 0 to 20
but no matter what power I set, I feel the shake even if Im 200m away
yeah tried 10
so frequency is the range? Im confused
I swear I felt the shake much further away than 10m
param 1 has nothing to do with actual range
@nocturne basalt addCamShake doesnβt have any source
@nocturne basalt range mean min and max value of parameter
ok thanks. pretty useless function then if you ask me
@nocturne basalt it is very useful function
why do you ever want to add camshake for everyone on the entire map_
?
unless its armageddon
@nocturne basalt because player has only one camera
I dont follow
@nocturne basalt what you need? Shake depended on distance from source? 5 sec
yeah I just want the cam to shake if youre close enough to the source
its enough that it shakes for 1 sec if youre 10m or closer
@nocturne basalt just wait, i am running game...
kk
What does _i refer to? when used in things like "for _i from 0 to 3 do { "
@nocturne basalt enableCamShake false; enableCamShake true; onEachFrame { addCamShake [ linearConversion [50, 0, player distance source, 0, 4], linearConversion [50, 0, player distance source, 0, 1], linearConversion [50, 0, player distance source, 0, 10] ]; };
oh wow thanks alot @strong shard
Is it like _x? (sorry can you explain further? I only recently understood what _x was used for so i completely understand it now, but not _i)
you can set anything. _i is just a variable name
many use _i for and increasing number
in that for loop, _i is set to start at 0
Oh. So its the traditional variable name used for increasing numbers?
@torn jungle for "var" from "begin" to "end" do "code" it is built-in implementation of ```var = begin
while (var < end) do {
code;
var = var + 1;
};
@still forum thanks for your answer up there
@strong shard @nocturne basalt Ahhh seems clear to me now thanks to you guys. Thanks!
so worldName returns the "displayname" if I am correct..
is there any way to find the "class name" of the current world?
nvm, seems worldname gives the classname, carry on :p
yep
How do I check if a remote client is a dedicated server or headless client from a server-running script?
I'd like to filter out these entities in addMissionEventHandler ["PlayerConnected", {}];
@astral dawn If that is a server, you will have no entity, if that is headless client - AFAIK you will not have any entity too, since HC usually occupies logics, not units, they are not counted as entities.
So there is no proper command for that? π€¦ ? What the...
Also in allPlayers wiki page it says that we can find headless clients with entities "HeadlessClient_F", so I assume they have entities
logics are entities too
π€ well exclude them for your purpose with what you just stated: entities "HeadlessClient_F"
allPlayers select {!(_x in (entities "HeadlessClient_F"))}
Not sure if thats what you seek exactly.
Is entities initialized by the time PlayerConnected mission EH is executed?
Entities are if to be correct, but PlayerConnected triggers before the connected occupy some object, so you only have UID and owner
You can exclude that by UID, since HC has UID looking like "HCblahblah"
Hmm... interesting... then I also need to exclude the dedicated server somehow. I guess I will just do remoteExec and retrieve hasInterface this way π€¦
Server UID also has "__SERVER__" or just "SERVER" by the way
You basically can filter out server with just its always 2 as an owner
But if it's a client-run server? Then it also has owner=2
Im pretty sure it is.
@astral dawn Just thought of kinkiest workaround - parseNumber on incoming UID. Since parsing a string with a first letter will return 0 - means thats not what you looking for :D:
addMissionEventHandler ["PlayerConnected", {
params ["_id", "_uid", "_name", "_jip", "_owner"];
if ((parseNumber _uid) isEqualTo 0) exitWith {}; // Definitely not a player
}];
Thanks... I would rather rely on hasInterface
My dirty solution
params ["_id", "_uid", "_name", "_jip", "_owner", "_hasInterface"];
diag_log format ["[TFE] Info: Player connecting: %1", _this];
if (isNil "_hasInterface") then {
// Call owner to report if it has interface (WTF! Why can't I just remotely check if it has interface??)
[[_id, _uid, _name, _jip, _owner], { (_this + [hasInterface]) remoteExecCall ["TFE_fnc_onPlayerConnected", 2]; }] remoteExecCall ["call", _owner];
} else {
// Now we finally know it it has interface
};
oh btw from wiki That happens only for GUI clients, if HC client connects first, EH does not fire for server.
So it doesn't even fire for a server
Well it fired for a server for me:
2018/07/19, 16:29:32 "[TFE] Info: Player connected: [2,"""",""__SERVER__"",false,2]"
When I as an admin player have joined the server and pressed the start button
π€
silly question,
a.sqf:
abc_list = ["aaa", "bbb", "ccc"];
b.sqf:
_veh = abc_list;
_veh append ["ddd"];
then hint str abc_list ?
I thought abc_list is still ["aaa", "bbb", "ccc"]. But wrong, why ["aaa", "bbb", "ccc", "ddd"] ?
because append modifies the existing array
and you are not copying the array
Every value in SQF is passed around by reference. So if you don't want to modify the array by reference. You have to copy it like _veh = +abc_list
i for int
i'm pretty sure i is meant to stand for index in loops
Both are post rationalisations. It dates back to when the character used for the variable was tied to the type of that variable - https://en.wikipedia.org/wiki/For_loop#Loop_counters
So i for int is actually more correct than index especially considering it is the loop counter register being referred to. It doesn't matter really, it is just what is used so you have to get used to it as its a historical limit. Most languages today don't limit it to a single character or a fixed variable so we ought to use what we want but you still see i and j everywhere.
I thought that it came from algebra, because they use i and j for matrix indices everywhere
Could be why Fortran tied i/j/k to the integer type certainly.
that wiki section doesn't seem very sure about the topic lol
i guess it doesn't really matter though
maybe it stands for increment, and j stands for jncrement? π€
I did see a video some years back explaining the origins of it but alas my old and useless brain is not giving me good recall on what and where. Might come to me at some point. But as far as I know in computing it all ties back to Fortran and Algol and how they used single letters for variables and tied to type. But those type mappings probably tied to the conventions from mathematics since it was mathematicians designing and writing the early programs.
maybe just index> _i π
'm pretty sure i is meant to stand for index in loops
that ^
i did think that, but i'm leaning toward "increment" now lol
because the variable increments every loop. that'd make more sense to me
same shit different name though
the register in use is usually called the loop counter which is why some languages have used count or counter in the past
What if
We started giving params via {code}
nice for big functiosn with a lot of optional params
_fnc_test ={
private _a = 1;
private _b = 1;
private _c = 1;
(_this param [0,[],[[]]]) call (_this param [1,{},[{}]]);
// return
(_a + _b + _c)
};
_number = 5;
[[_number],{_c = _this#0;}]call _fnc_test;```
Ez params π
array based maps that can be read either in order or as maps for key->value mappings is basically how a lot of languages sort of do it providing both as a possibility.
sqf doesn't have keys for arrays
@peak plover becuase that is horribly inefficient
Can someone tell me why CBA felt the need to produce this :
https://github.com/CBATeam/CBA_A3/blob/master/addons/common/fnc_randPosArea.sqf
Given that there is a BIS function doing the same since ArmA 1.00 ?
https://community.bistudio.com/wiki/BIS_fnc_randomPos
CBA has a more functions that do similar/same things that are available through BIS functions / commands. Mostly because a lot of them is a little bit wonky π
So if I am converting my code from mission to addon, I need to convert all the file paths from "folder\file.sqf" to "addon\folder'\file.sqf"? Is there an better way?
@astral dawn yes if you are use absolute path (Started with β/β)
Then it is relative to arma folder, right?
Is it possible to specify the paths so that they could run both from an addon and a mission?
@astral dawn use relative path (Not started with β/β)
@astral dawn *\
@astral dawn and not started with Drive Name
Like this? _handle = [] execVM "SubFolder\test.sqf";
@astral dawn yes it is relative path
(do you really have to mention him in every sentence?)
From wiki: it will search in:
.\arma2\missions\CurrentMission.CurrentWorld\SubFolder\test.sqf
.\arma2\scripts\SubFolder\test.sqf
.\arma2\SubFolder\test.sqf
So in case of mission it will find the proper file, in case of addon it will not
@astral dawn β\folder1\folder2β and βC:\User\MyUserβ - absolute
Why not use functions library and do _handle = [] spawn tag_script; ?
Functions library can be easily setup in both addons and missions doesnt it ?
(I might be horribly wrong as so far I have done missions only.)
You are right but I dynamically create some functions... damn I think there is no way than
" I dynamically create some functions." π
well with things like myFnc = compile pre...;
because I have made some macros and they rely on this thing...
@astral dawn you can use cfgFunction in mission without βfileβ param, and for add-on just add βfileβ for category or tag class
@astral dawn sorry it rule (absolute\relative path) for preprocessor
Thx, I know about the cfgFunctions, but I needed that for things like myFnc = compile preprocessFileLineNumbers "..."
but cfg functions does exactly that.
it finds the file and compiles it into variable π
@astral dawn it is same
@astral dawn but cfgFunctions have more:
- _fnc_scriptName and _fnc_scriptNameParent
- function name = TAG_fnc_NAME
- shows this function in "function viewer"
This is for the weird macros I have which does 'exactly that' plus some more things, so cfgFunctions is not an option. Thanks for the help guys.
@astral dawn for macro you can use preprocessor
Hmm actually you are right... I could check for a flag if it's an addon or a mission, then add addon prefix. Brilliant!
If you're using macros I guess you could define some define (:D) with correct path prefix when used in addon.
But I assumed such a thing already exists somewhere in arma... or in the pbo packing software
Because, like, isn't a mission a kind of an addon... then why do they use different path structures π«
Thx, Dedmen. π @still forum
@vernal mural the wiki version numbers aren't always correct. I think Arma 1.0 might be the default value. Lots of CBA stuff has also been there before Arma had it in vanilla. But just compare the code of the CBA function with the BIS function and you'll see what the difference is.
Good to know, thanks !
{
_unit = group player createUnit [_classname, [(getPos player select 0) + 75 - random 10,(getPos player select 1) + 10 - random 20,0], [], 0, "FORM"];
} else {
_vehicle = _classname createVehicle (player modelToWorld [0,8,0]), [], 0, "NONE";
};```
That there works nicely when testing through A3 editor but not in dedicated server environment, how come?
it's missing a }; that shouldn't work at all
@forest ore player is undefined on dedicated server
also the _unit variable is useless and _classname might be nil.
Oh yeah.. ^ that too
Apologies, the missing }; is on me
I always start with the complicated things duh..
almost figured it was because of the player but can't figure out how to turn it to anything else. Thus came here to seek help
well player references the local player
referencing the local player on a server doesn't make any logical sense
so.. You want to reference a player. Which player?
should be any
you want to place a vehicle at the position of any player?
Even the one standing 5km outside of the map and zeusing?
If so
_player = selectRandom allPlayers
and then use _player instead of player
every player has a sort of "buy" menu available for them and they can get stuff from the menu. The above code I pasted either spawns an AI soldier about 75m away from the player and the other spawns a vehicle 8 meters away from the player
But you said you want any player
why are you saying wrong things
just execute the code you posted above on the players machine instead of the server
slight difficulties to word myself properly, apologies
there player will work
ahh, well ok I might even understand that. But what if I wanted the server to do the spawning?
can I just use _player?
not in this case...I guess..
heh well π
so guess one could ask that how to tell the server that it needs to spawn this stuff to that player who invoked the command
Yes
depends on how you tell the server to do anything though
You apparently don't want to tell me what you are using but it's apparently not remoteExec
@forest ore pls, select one:
- remoteExec/remoteExecCall
- setVariable/getVariable
- publicVariable/addPublicVariableEventHandler
π
I would pick the first one
does remoteExec work with player or does that need changing?
If your targeted code is running on a player then it can use the player command
that question isn't.. like.. I don't know what to answer
yes. You remoteExec is a thing that works
Dedmen, so far I'm not using remoteExec since testing the code from the editor worked just fine. But I'm all in using remoteExec or what ever would suit best
yes it also works if you execute it. Which is what you are supposed to do with it
yes you can also execute it if you are you.. aka player
well tell me what you are using right now that doesn't work
how do you execute on the server
Stop letting me pull everything out of your nose
just tell me what you are trying to do exactly.
I am not using, that's why it doesn't work on the server
(that means) it doesn't work π
@forest ore simple example:
on client:
[player, typeof player] remoteExec ["MyFunc", 2, false];
on server:
MyFunc = {
params ["_player", "_classname"];
private _unit = group _player createUnit [_classname, position _player, [], 0, "FORM"];
};
that means it's executed locally
meaning player works and is not your problem
That is why i want you to tell me what you are doing FFS
most of the problem is that I don't understand how to remoteExec anything.
you don't really need remoteExec for this
so you want to know how to remoteExec that?
Why don't you just say that?
I did not have the slightest idea that I needed to remoteExec that
you don't
createUnit on the server is actually a kinda bad idea. Because it will create the unit on the server and then have to move it back to the player's machine
so it actually moves it to the player's machine and doesn't stay on the server?
yes
AI units are always on the machine of the groups leader
you are adding it to the players group
well then I might not want to remoteExec the script if such happens
how about the vehicle that a player spawns, is it on the server if the script is remoteExec'd?
aghh
anyone familiar with ACE explosives ? I wonder if being a specialist prevent the random detonation when the setting "explode on defuse" is activated
mh, good catch
nah. just google and knowing what to look for
Alright. Today I'm trying to get the total count of all units in several specific groups, and as that count drops, I want to ramp up the chance of an event.
So, if they have thirty units to start, and they lose ten, the event should begin having a chance to trigger. By the time they have lost twenty units, the chance of the event should be at or nearing one hundred percent.
Any pointers?
@shadow sapphire
(random 1.0) >= (linearConversion [_aliveBegin, _aliveEnd, _aliveCurr, 0.8, 0.0])
@shadow sapphire aliveCurr >= aliveBegin = 20%; aliveCurr <= aliveEnd = 100%; aliveBegin > aliveEnd; and chance changed between begin and end from 20% to 100% linearly
btw linearConversion [_aliveBegin, _aliveEnd, _aliveCurr, 0.8, 0.0] -> _aliveCurr * 0.8 / _aliveEnd π
Wow. That is FAR less complicated than I thought it would be.
Could I get a lesson in application?
What do _alivebegin, _alivecurr, and _aliveend mean? Do I need to define them? How do I pull group information into that?
@shadow sapphire just 3 variable, aliveBegin - how much alive units on start, aliveEnd - when chance is 100%, aliveCurr - current number of alive units
Right, but do I need to define them or are they in the game already? How do I tell it which units to monitor in the count?
@shadow sapphire you define
Ah, okay, gotcha. Hmmm... Okay, I think I'm getting it.
So,
_fullstrength = count groups on spawn.
_currentstrength = current number in groups.
_understrength = count groups/2
@meager heart ((0.8 - 0.0)/(begin-end))*(curr - end) π
@meager heart, what are you explaining there?
@shadow sapphire he say that linearConversion is syntax sugar for linear equation π
Haha, okay. Sounds good.
How do I indicate which groups should be totalled and then plugged into this?
@shadow sapphire variable name in edit dialog of group in 3den
That's not going to work. My groups are being created via scripts...
@shadow sapphire then var = createGroup...
I know that. Haha, you're not understanding the question I'm asking. That's fine, you've been plenty of help, I'll try to pick away at this a while. It'll do me some good.
If (!isServer) exitwith {};
Params ["_trigger"];
_Base = (getmarkerpos "Origin");
_HQ = [_Base, INDEPENDENT, ["I_officer_F","I_medic_F","I_officer_F","I_soldier_UAV_F"],[],["LIEUTENANT","PRIVATE","SERGEANT","PRIVATE"],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;
_G1 = [_Base, INDEPENDENT, ["I_Soldier_TL_F","I_Soldier_AR_F","I_soldier_F","I_soldier_F"],[],["CORPORAL","PRIVATE","PRIVATE","PRIVATE"],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;
_G2 = [_Base, INDEPENDENT, ["I_Soldier_SL_F","I_Soldier_M_F","I_Soldier_AR_F","I_soldier_F"],[],["SERGEANT","PRIVATE","PRIVATE","PRIVATE"],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;
_G3 = [_Base, INDEPENDENT, ["I_Soldier_TL_F","I_soldier_F","I_Soldier_AR_F","I_soldier_F"],[],["CORPORAL","PRIVATE","PRIVATE","PRIVATE"],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;
_G4 = [_Base, INDEPENDENT, ["I_Soldier_SL_F","I_Soldier_GL_F","I_Soldier_AR_F","I_soldier_F"],[],["SERGEANT","PRIVATE","PRIVATE","PRIVATE"],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;
_G5 = [_Base, INDEPENDENT, ["I_Soldier_TL_F","I_Soldier_AR_F","I_soldier_F","I_soldier_F"],[],["CORPORAL","PRIVATE","PRIVATE","PRIVATE"],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;
_G6 = [_Base, INDEPENDENT, ["I_Soldier_SL_F","I_Soldier_AR_F","I_Soldier_GL_F","I_soldier_F"],[],["SERGEANT","PRIVATE","PRIVATE","PRIVATE"],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;
{
{
_gearhandle = _x execvm "Gear\AAF.sqf";
waitUntil {scriptDone _gearhandle};
if ((_x getunittrait "medic") && {"Medikit" in items _x}) then {
[_x, IndiCasualties] execVM "Combat Medic.sqf";
};
_x addeventhandler ["Handledamage",{
if (_this select 2 > 0.8) then {
_unit = _this select 0;
_unit setunconscious true;
IndiCasualties pushbackunique _unit;
};
}];
} foreach units _x;
_x deletegroupwhenempty true;
} foreach [_HQ, _G1, _G2, _G3, _G4, _G5, _G6];
Thats a bit excessive ^
Is there a way to remove objects only from roads ? I try to clean the chernarus 2035 map, and there are like thousands wrecks on the road, and it just looks stupid and it's not good for gameplay. I tried some cleaning scripts for the whole map, but it's to much. So if you park a vehicle somewhere where a wreck was and the server restarts, your car will explode after restart because the server is not fast enough with deleting all this wrecks.
U might have to edit the map it self, or I think theres a thing in eden that removes stuff on a map
yea hide object module, but i think it's not the smartest way to place 1000 of the modules for every collection of wrecks on the road
delay respawning the vehicles? that sounds like a bad idea.
It's a Exile server, so things are a bit different than usual
i have a bunch of buildings i want to destroy. how would i go about doing it? connecting them all to the trigger?
yeah
Place a unit via Zeus and the deletedEH is called. When you place things
But.. Even though deleted is called. The things still exist a couple frames later
so if you want to really make sure that something was deleted you need to wait a couple frames and check if it's really gone
_ied addEventHandler ['deleted',{systemChat str _this}];
didn't work
Do I have to wait before I can add it?
Am I doing it wrong?
ohh lmnao
it doesn't work on mines
That's why haha
ohh
This kind of sucks
Hello guys, quick question, if i write an inline function inside another function which is declared in Functions.hpp, should i declare the inline one too ?
What's a inline function?
i read it on the wiki, sec
this :
my_fnc = {
a = 1;
b = 2;
c = a + b;
c //<- fine
}
aah
its about client calling server, then server calling back the client with that inline function
function is just a variable which is a code block
oh okay
code blocks can be executed using call and others like it
ok thanks you
setRandomLip needs to be remoteExecuted_
_weight = loadAbs scout;
//should get weight of the "scout" playable unit (has the variable name "scout")
while {true} do
{
//The While Loop works
if (_weight < 26) then
{
//But this doesnt doesn't activate
hintSilent "This should work";
//trying to debug - this doesnt activate
scout setAnimSpeedCoef 10;
//should make scout really fast -also doesnt activate
};
}; ``` I tried using this to make it when the "scout" player has less than 26kg of weight it makes him faster but it doesnt work and I dont understand why. TBH it is probably something simple but I dont see it
_weight will never change within the scope of the loop
sorry, im a bit new to scripting, how would I do it so it would change?
would I have to make it not a private variable?
Define it inside of the loop perhaps?
what did you do?
put the _weight = loadAbs scout; inside of the loop
how?
{
_weight = loadAbs scout;
//should get weight of the "scout" playable unit (has the variable name "scout")
if (_weight < 26) then
{
//But this doesnt doesn't activate
hintSilent "This should work";
//trying to debug - this doesnt activate
scout setAnimSpeedCoef 0.1;
//should make scout really fast -also doesnt activate
};
};```
forgot I changed it to not private variable
So you didn't put the _weight = loadAbs scout; inside of the loop at all
you for whatever reason removed the underscore
IK, was testing taht
that*
the defining of _weight is in the while loop
in the example above
Are you sure that 26 is correct? 26 is a soldier with map,radio,compass,watch and rangefinder
Did you check what the actual weight is via the debug console?
I was basing the weight on what it told me on the player menu
ah sorry, ill send screenshot, im also using ACE which I should have mentioed
mentioned
Well as I said 26 is a soldier with map,radio,compass,watch and rangefinder does that match your loadout?
Ah you mean the KG weight display in the inventory?
yeah
really?
you are using that right there in your script already
yeah... im not smart sometimes
Sup guys, I will start helping out here a lot from now on, I love the idea of this discord. I just have a quick question, does anyone have a script for changing skins on arma 2? Wherever I look I just find DayZ scripts.
this is what I have so far: _plrInit = _plrInit + format["this setObjectTexture %1;", (_x select 2)];
respawnSkin = (_x select 2);
Iknow I have to use the setobjecttexture
setObjectTexture yeah.. But what is that format stuff there?
https://www.youtube.com/watch?&v=ueaWYkDOX8k
Has anyone got an idea how I could work around this issue?
What does setSide have to do with setIObjectTexture?
i don't understand what your problem is
The bounding box seems to be infront of where the car actually is, what I gathered on the forums is that the physx simulation is ahead of the rendering part
All I need is a basic change skin (unit) script really
hmm will just have to play around with it until arma wants to cooperate
thanks though π
We might be able to help you if you'd tell us what your actual problem is ^^
I guess it doesn't work for you for whatever reason
We have a clothing shop system, that's why the format stuff were there
Clothing shop sounds like you want to change the uniform not the texture
yeah Id like to change the unit
im talking about arma 2 here π
i suspect that doesn't matter
https://forums.bohemia.net/forums/topic/90450-changing-uniform/ first result via google... That looks complicated tho
well what isn't complicated :p
But I dunno why setObjectTexture doesn't work
well the shops work
but I want to be able to execute my own script to use a unit not available on the server
not available on the server? :u That sounds weird...
Where is it then if not on the server?
its not available for the public no
but all the units are there unused still
gosh im stupid
this setObjectTexture US_Soldier_TL_EP1;
its probably as simple as this
no
it's not
setObjectTexture takes the path to the texture
you are giving it a undefined variable
you can get the path by spawning the unit and using getObjectTexture
_newUnit = _grp createUnit [(_x select 1), _pos, [], 0, "NONE"];
addSwitchableUnit _newUnit;
and then just delete the old unit right?
Hey I'm a relatively newbie scripter and am trying to throw something together quick
I need to add an "Eject' action to a plane that is mission that button so that my guys can parachute out. Will need to be dedicated compatible. I was thinking I'd add an add action the plane and have it use the GetOut action on the player who presses it
But how do I set it to run server side, and how do I set it to only eject whoever presses the button
So you want to eject all passengers with a scroll option?
No I want each person to be able to individually eject themselves with a scroll option
you want them to spawn in with a parachute even if they dont have one
No I gave them parachutes in a gear script
They just need to have the option to actually get out of the plane
okey gimme 2 sec
It's a modded plane where the modders took away the eject option and replaced it with their own script which is buggy
So I'm just trying to add the eject option back in so we can use the vanilla system
put that in the init of the C-47?
2 sec more
I'm not sure that's what I'm looking for. I need to add the eject action back into the scroll menu
Yeah, basically I need to add someone like this
waituntil {!(IsNull (findDisplay 46))}; _keyDown = (findDisplay 46) displayAddEventHandler ["KeyDown", "if (_this select 1 == 57) then {
if (!(isTouchingGround player) and (vehicle player == player)) then {
[] spawn {player switchCamera 'EXTERNAL';Player SwitchMove 'AswmPercMrunSnonWnonDf_AswmPercMstpSnonWnonDnon';addCamShake [4, 2, 20];sleep 0.7;playSound3D ['@SCS\Sound\Parachute.ogg', Player, false, GetPosASL Player,5, 1, 250];titleText ['', 'White IN', 0.6];addCamShake [2, 2, 10];chute = createVehicle ['Steerable_Parachute_F', position Player, [], 0, 'Fly'];chute setPos position player;player moveIndriver chute; chute allowDamage false;};
};
}"];
put this in the init.sqf
and try it, migh tnot work
nononon
thats wrong
_heli = vehicle player;
_Offset = [10,10,0];
_worldPos = _heli modelToWorld _Offset;
_heli setVelocity [0,0,50];
unassignvehicle vehicle player;
player action ["eject",vehicle player];
sleep 0.5;
_para = "nonSteerable_Parachute_F" createVehicle _worldPos; //--- Parachute classnames --- "nonSteerable_Parachute_F" or "Steerable_Parachute_F"
_para setPos _worldPos;
player moveIndriver _para;
waitUntil {((visiblePositionASL player select 2) < 5)};
sleep 1;
MoveOut player;
deleteVehicle _para;
this is what you want
Ok, where do I put this?
make a .sqf file in your main mission folder and name it like eject.sqf
then add this to the init: [] execVM "eject.sqf";
Ok, wait why can't I just make a script that says caller = this_select 1;
_this select 1;*
there is tonnes of ways to do it
_player action ["Eject", vehicle _player];
can be as simple as that
caller action ["getOut", vehicle caller];
just make it a scroll option
and then in the C-47 init
no you dont init to a vehicle
you need to make a scroll option which runs this script: _player action ["Eject", vehicle _player];
ah ok
remember this will just make them fall out of the sky so make sure you have some parachutes :p
They do :p
I'm trying to make my own script to get better, if I do I'll let you know give me a sec :p
yeye np
I will probably need help making it MP compatible
Whoohoo! My little script works in SP
Now could you tell me how to make an AddAction work on a dedicated server? Appreciate it
do you have an actions.sqf in your mission
if the action is just an individual player getting kicked out of the plane then there is nothing ot change to make it work in mp
the action only should run on the client and nobody else needs to do the same action when he does it
if you send that command to everybody then it will eject every single player in the game out of their vehicle
or if you send the scroll action for whatever reason, there would be an action on each person's screen for every player in the match, so if you had 30 people ingame, each person would end up with 30 scroll actions for 'Eject' :p
@tough abyss
Thanks @noble pond
That would be pretty funny to do in a meme mission though, give 1 player the ability to throw everyone out of a vehicle π
sending lots of data like that would probably wreck the connection and make everyone rubberband too until the server clears the massive backlog of data to transmit
Lol sounds about like my unit's typical mission
Why does this:
character say "a3\dubbing_f_beta\showcase_combined_arms\15_Insertion_Complete\showcase_combined_arms_15_insertion_complete_BHQ_0.ogg";```
Throw an error saying no .ogg file found or whatever? This is a vanilla file. Must I rip and reupload or classify this somehow to make it work?
can't you just use the file directly, without the whole path?
Must I rip and reupload or classify this That is the worst idea ever
I would recommend to use your eyes to read
I've read it several times. I still don't understand the issue.
I'm not a coder. This knowledge isn't innate or obvious.
sound: String - classname of the sound to be played. Defined in CfgSounds including Description.ext
you'll have to put the sound in descriptions.ext
and then the string is the classname, not the path
the path goes into descriptions.ext
Dedmen just said classifying it is the worst idea he's ever heard. So, unless he's never heard of the holocaust, to me that means there's a major bad no no here.
Okay, so I DO need to classify it?
Easy enough. Thank you much.
That's fine. I didn't anticipate I did, but was just asking if I had to do that OR classify it.
Thank you much for explaining.
no problem π
(btw, i didn't understand what you meant by classify... i was thinking in terms of categorizing/classification π )
π»
classifying to me means finding a category for something so you can... classify it..
just get yourself comfy... in b4 tho π
how can I lock vehicles for AI? lock seems to work only for human players
if you're running without mods, then AI should not be able to access a locked vehicle
hmm dont seem to work. Im trying to lock the vehicle but the AI keeps getting in
it says it for players
"Lock vehicle (disable mounting / dismounting) for player. Similar to setVehicleLock when number is used as param."
lockstate: Number - 0 - Unlocked; 1 - Default; 2 - Locked; 3 - Locked for player;
i think you need 2
yeah tried that already. also tried setVehicleLock "LOCKED"
and you're not running any mods?
hmmm.. well I can certainly not getin. AI walks straight up
weird
maybe I have to script my way around it....
try locking from the editor too and see if that makes a difference
maybe some locality issues
Im using an eject script to force the AI out, then I lock it
if you're locking vehicle just to make ai do not get in after eject... there is few better options...
allowGetIn <
{
[_x] allowGetIn false;
_x action ["GetOut", vehicle _x];
} forEach _unitsCargo;
done
thanks ^^
imo GetOut < looks better... but it will work with eject too
it worked ty
I was only ejecting the gunner. driver was still inside, and the gunner got back in when using lock. didnt it work because the driver was still inside?
is the vehicle unlocked again with allied crew inside maybe? π€
hmm... idk, never tried it that way ^
hmm cant really use allowGetIn. it keeps them from entering any vehicle. I just want to lock this perticular vehicle
set it back
but then they get back in xD
Β―_(γ)_/Β―
xD
btw to get them in, better will be orderGetIn
but you will have to assign the roles b4
something like that assignAsCargo > orderGetIn
@meager heart wokring now.
_v lockDriver true;
_v lockTurret [[0,0], true];
he tries to get in, but i rejected
then he dont try again
no idea what you're doing there, but if that works for you π π
βΊ
you might need to unassign the vehicle from the ejected guy
this stuff could be interfering
Is there a event handle to check if some opem a door?
@astral tendon no, you need create this event manualy
Why doesn't the for loop add any players to the list even though I'm on the server ingame when the function is executed? (The function is executed on server)
// Array format: 0: player index, 1: player name, 2: number of votes
CNC_arr_commVotePlayerList = [0, "No commander", 0];
// Note: "No commander" has index 0 (see above), starting from index 1
_i = 1;
{
CNC_arr_commVotePlayerList pushBack [_i, name _x, 0];
_i = _i + 1;
// Exclude headless clients from vote
} forEach allPlayers - entities "HeadlessClient_F";
The content of the list after executing these lines of code is:
"[CNC (DEBUG)] [frame: 1747 | ticktime: 50.336 | fps: 45.4545] CNC_FNC_InitCommVote: Content of CNC_arr_comVotePlayerList: [0,""No commander"",0]"
@tender fossil where it is executing (meaning script/event...)
If a unit joins a group local to player1
does the unit locality transfer over to player1?
@strong shard The script is being triggered manually by other scripts
hi guys. can someone confirm that damage isnt synced perfectly across the network?
in my script I did some checks on damage level, and couldnt for the love of god figure out why it sometimes only triggered on one client..
so I printed out the damage and I see now the are not the same!
see printscreen:
https://www.dropbox.com/s/r4103sbdqirwk25/Untitled.png?dl=0
Is there an "easy" way to get a classname when you only have the displayname at your hand?
no
@peak plover Yes (AFAIK)
AIs in group are controlled by the machine/client of player leader
Thx
it creates a local group empty group
but as soon as someone joines the group. He is the leader
@nocturne basalt try getAllHitPointsDamage, it must be more accurate, βdamageβ command is magic π
Ah thanks gonna check it out
@tender fossil first you need insert βinit valueβ in array, because now you will get [0, βNo commander, 0, [1, βPlyaer #1β, 0], [2, βPlayer #2β, 0]...]
@tender fossil second: in debug name of variable is correct? Mb typo in name, but idk how you create this text
@strong shard How to insert that init value correctly? I'm confused π
@tender fossil myVar = [[0, βNo commanderβ, 0]] if you need array of arrays
Here's how I check the variable
["CNC_FNC_InitCommVote: Content of CNC_arr_comVotePlayerList: %1", CNC_arr_commVotePlayerList], 1] call CNC_FNC_LogContent;
Ah, true that. Thanks π
@tender fossil what mean 2nd parameter?
It's syntactic sugar, logging level for filtering out unnecessary information
CNC_FNC_LogContent = {
params ["_logType", "_logContent", ["_logLevel", 0]];
if (_logLevel >= CNC_LogLevel) then {
diag_log format ["[CNC (%1)] [frame: %2 | ticktime: %3 | fps: %4] %5", _logType, diag_frameno, diag_tickTime, diag_fps, _logContent];
};
};
@tender fossil you can also print allPlayers command result with out any filter and classname of each player?
Gimme sec, doing that now
@tender fossil diag_log allPlayers; diag_log (allPlayers apply { typeof _x; });
@tender fossil print it between array initialize and forEach loop
Both are just []
@tender fossil all this code executed from any type of βinitβ code?
Nope, it's remote executed on server by client after 10 seconds sleep
from mission start
The execution chain starts from initPlayerLocal.sqf, where this: script is execVM'ed:
sleep 10;
call CNC_FNC_InitCommVoteClient;
CNC_FNC_InitCommVoteClient = {
[player] remoteExecCall ["CNC_FNC_InitCommVote", 2];
};
On server:
CNC_FNC_InitCommVote = {
params ["_voteStartClient"];
// Array format: 0: player index, 1: player name, 2: number of votes
CNC_arr_commVotePlayerList = [[0, "No commander", 0]];
// Note: "No commander" has index 0 (see above), starting from index 1
_i = 1;
{
CNC_arr_commVotePlayerList pushBack [_i, name _x, 0];
_i = _i + 1;
// Exclude headless clients from vote
} forEach allPlayers - entities "HeadlessClient_F";
["DEBUG", format ["CNC_FNC_InitCommVote: Content of CNC_arr_comVotePlayerList: %1", CNC_arr_commVotePlayerList], 1] call CNC_FNC_LogContent;
[] remoteExecCall ["CNC_FNC_CreateCommVoteDialog", -2];
publicVariable "CNC_arr_commVotePlayerList";
["INFORMATION", format ["Commander vote has been started by %1", name _voteStartClient]] call CNC_FNC_LogContent;
};
@tender fossil magic π idk why player is not initialized on server
I also tried with BIS_fnc_listPlayers, same result π
@tender fossil print frameNo and time when this script is executed on server, and in βPlayerConnectedβ EH, and create on server infinity loop with print of allPlayers each 0.5-1.0 second
_i = 1;
{
CNC_arr_commVotePlayerList pushBack [_i, name _x, 0];
_i = _i + 1;
// Exclude headless clients from vote
} forEach allPlayers - entities "HeadlessClient_F";
->
{
CNC_arr_commVotePlayerList pushBack [_forEachIndex + 1, name _x, 0];
// Exclude headless clients from vote
} forEach allPlayers - entities "HeadlessClient_F";
Fixed, thanks @still forum
@strong shard Interesting... From the allPlayers monitor loop:
16:00:52 "[CNC (DEBUG)] [frame: 2120 | ticktime: 60.39 | fps: 44.3213] allPlayers on server: []"
16:00:55 "[CNC (DEBUG)] [frame: 2253 | ticktime: 63.407 | fps: 43.3604] allPlayers on server: [B Alpha 1-1:1 (Ezcoo) REMOTE]"
16:00:58 "[CNC (DEBUG)] [frame: 2384 | ticktime: 66.415 | fps: 45.4545] allPlayers on server: [B Alpha 1-1:1 (Ezcoo) REMOTE]"
16:01:01 "[CNC (DEBUG)] [frame: 2520 | ticktime: 69.422 | fps: 45.4545] allPlayers on server: [B Alpha 1-1:1 (Ezcoo) REMOTE]"
It takes over 20 seconds for allPlayers to get initialized
up to xx minutes sometimes...
#define ALL_PLAYERS ((allUnits + allDeadMen) select {isPlayer _x})
BIS_fnc_listPlayers v2.0 ^
How to check whether a Number type variable exists? With isNull ?
Thanks @meager heart, testing it now
The hit event handle is supouse to not work on placed objects like Dirthump_1_F (Dirt)?
I don't think it works on statics
So, how can I check if the player shoots at a particulary target?
Maybe use this?
https://community.bistudio.com/wiki/cursorObject
Together with the fired eventhandler
Could someone tell me how to make the player exit the script (exitwith ?) when he uses the UI action menu ? Maybe using the eventHandle https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/inGameUISetEventHandler#Action ??
what is "the script"?
any script, just exit the script without playing whats next
would this work ?
inGameUISetEventHandler ["Action", "if (true) exitWith {};"];```
that would do absolutely nothing
mmeh
fail
you want to kill any script when he uses the action menu?
so just grab a random script from somewhere and kill it?
nah, kill the script in witch the inGameUISetEventHandler is
he wants his specific script to exit when he uses the action
use a variable
I guess your "script" has a while true loop now?
make it check a variable and set it to false in the eventhandler
inGameUISetEventHandler ["Action", "exitThisShit = true;"];
if (exitThisShit) exitWith {};```
inGameUISetEventHandler ["Action", "exitThisShit = true;"];
if (exitThisShit) exitWith {exitThisShit = false};```
that wouldn't do anything
after adding the eventhandler it will continue the script
run past that before the variable can possibly be set
and then not check again
exitwith line needs to be in a loop
Well. then it would exit that loop
what do you mean ? @noble pond
and not the script above it
thats what I thought lol
Show me "the script" and I'll tell you where to put it
could use waitUntil, it really depends on what you are doing and where this code is going :p
need more context to tell you more
Why does this script add votes to new UID but doesn't remove them from the old one? There's some minor glitch in this script (apparently), but I'm suffering from being braindead after learning to script the whole day so I'm unable to spot it :D
CNC_FNC_RegisterCommVote = {
params ["_oldClientVoteUID", "_newClientVoteUID"];
if (isServer) then {
if (!(_oldClientVoteUID isEqualTo _newClientVoteUID)) then {
{
if (_x select 2 isEqualTo _oldClientVoteUID) exitWith {
_numberOfVotesOldTarget = CNC_arr_commVotePlayerList select _forEachIndex select 3;
CNC_arr_commVotePlayerList select _forEachIndex set [3, (_numberOfVotesOldTarget - 1)];
};
} forEach CNC_arr_commVotePlayerList;
{
if (_x select 2 isEqualTo _newClientVoteUID) exitWith {
_numberOfVotesNewTarget = CNC_arr_commVotePlayerList select _forEachIndex select 3;
CNC_arr_commVotePlayerList select _forEachIndex set [3, (_numberOfVotesNewTarget + 1)];
};
} forEach CNC_arr_commVotePlayerList;
CNC_var_oldCommVoteUID = _newClientVoteUID;
publicVariable "CNC_arr_commVotePlayerList";
};
};
};
So I guess the error lies in this part of the script:
{
if (_x select 2 isEqualTo _oldClientVoteUID) exitWith {
_numberOfVotesOldTarget = CNC_arr_commVotePlayerList select _forEachIndex select 3;
CNC_arr_commVotePlayerList select _forEachIndex set [3, (_numberOfVotesOldTarget - 1)];
};
} forEach CNC_arr_commVotePlayerList;
CNC_arr_commVotePlayerList select _forEachIndex wtf?
that's what _x already is
just use _x
Oh lol π
also each UID can only have one vote?
Yes
why are you looping through everyone if you only want that one guy?
{
if (_x select 2 isEqualTo _oldClientVoteUID) exitWith {
_numberOfVotesOldTarget = _x select 3;
_x set [3, (_numberOfVotesOldTarget - 1)];
};
} forEach CNC_arr_commVotePlayerList;
Because the vote can change
use findIf to find the element of that guy.
This function is being called repeatedly (each time player presses "vote comm" button)
Yeah. But you are iterating over all elements even though you only want a single one
that's 99% waste.
CNC_arr_commVotePlayerList findIf {_x select 2 isEqualTo _oldClientVoteUID} will return you the index of it
then you can
if (_index == -1) then no old vote found..
private _element = CNC_arr_commVotePlayerList select _index;
_element set [3, (_element select 3)- 1];
Also you can make your script alot easier to read if you turn your if (isServer) then { into a if (!isServer) exitWith
get's rid of alot of the indentation and makes it easier to read.
in generall making your script smaller and splitting it up will make it alot easier to understand.
Just make a tiny inline function called _addVote = {} you call it with the clientVoteUID and the number of votes. In your case 1 or -1
get's rid of that duplicate code and reduces the surface for errors
private _currentUID = [_newClientVoteUID, _oldClientVoteUID] select {
CNC_arr_commVotePlayerList findIf {_x select 2 isEqualTo _oldClientVoteUID} != -1
};
```π
Hi, my Drone operator wishes something that shows where on the map the drone is looking at. I saw in some of @gilded rampart videos (e.g. https://youtu.be/KY9fJggGiZM?t=9m14s) that they have something to see where the helo camera is looking at, I thought this would be perfect. Is this a mod/script that is somewhere available?
you can attach a marker to the drone
but that cone thing is probably way more complicated to implement.
Is there a way to lower armor value of a vehicle without touching its cfg file ?
if I attach a marker to the drone I would get the drone position, would't I?
the drone terminal already shows where the drone is but not where the gunner camera is looking at, which is what he wants/needs. as an alternative could we show on the uav terminal map what point he is lasing?
private _id = findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", {
params ["_control"];
_control drawTriangle [
[
player getRelPos [-150, 0],
player getRelPos [50, -50],
player getRelPos [50, 50]
],
[1,0,0,1],
"",
false
];
}];
``` that way maybe ^
more info > https://community.bistudio.com/wiki/drawTriangle
oh thats nice I will fiddle around with that for a bit
Maybe, anyone know, why HC trying join to the game, automatically kicked to lobby? And how exclude from onPlayerConnected event heandler HC? I add this "if (_uid in ["", "SERVER", "HEADLESS", "HC"]) exitWith" but, its not work π¦
oh really?
i can't tell if you're being sassy with me π
I use that for HC if !(isServer || hasInterface) exitWith {};
In words, if it is not a server or has no interface (it should be a headless client) just exit
@coral wraith onPlayerConnected server side
no client side
actually every side
or even better just use the PlayerConnected EH
it only fires for GUI clients
there is also stated that _uid of an HC will contain the PID so your if clause will not match because of the added pid
Hm, i not see PlayerConnected... Thanks. But, why he kicked to lobby??
oi people.
i'm trying to spawn a backpack on a very exact position (and rotation). obviously it doesn't work due to collision.
anyone got any clues on how / if this is somehow solvable?
i've already tried to spawn one with CAN_COLLIDE, but it didn't changed anything. then i tried attachTo but it wasn't having any effect either
found a solution. "groundweaponholder" to the rescue. i should post more in here.
"Rubber Duck Debugging"
damnit, still doesn't really work, though.
first it did work and i attached the backpack to an object and then adjusted the attachto coordinates + setvectorup ... but now i can't get it to work anymore
also now i can't pick it up anymore. ehw.
i hate this vector crap. so much try&error
what about weapon holder (non ground) and just setPos?
i have to rotate the object, not just simple direction
i've fiddled with it a lot now and got it to work mostly right.
wish this kind of stuff would be a default 3den feature
Is there any way to detect a trigger via SQF?
I know if you create one using createTrigger you get back an object
but I want to detect unnamed eden placed ones
My best guess was entities "EmptyDetector" but that doesn't seem to work
0 spawn {
private _holder = "GroundWeaponHolder" createVehicle (player modelToWorld [0, 2, 1]);
_holder addBackpackCargoGlobal ["B_Kitbag_rgr", 1];
_holder setVectorDirAndUp [[0, 0, -1], [0, 1, 0]];
};
and here is almost the same ^ with couple more adjustments > https://gyazo.com/5bb48f8c931dc1f5a32f5700d131ef65 π
Operators connected Drone Laser Postion on his map, ok it's not as fancy as I wanted it but at least it works π https://youtu.be/dJE08YVnIkQ
@coral wraith Modify it to indicate the start to destination with a line maybe. Position of UAV to laser pos
@chilly wigeon ```
allMissionObjects "EmptyDetector";
Hey guys is there a way to set AI to recognize wrecks on the road ? Or a mod that enable them to do so
@gleaming oyster now the code looks a little more "professional" and it draws a line
((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ['Draw', "
private ['_connectedUav', '_intersects', '_laserPos', '_validLaserPos'];
_connectedUav = getConnectedUAV player;
_intersects = (lineIntersects [getPosASL _connectedUav, getPosASL laserTarget _connectedUav] || terrainIntersectASL [getPosASL _connectedUav, getPosASL laserTarget _connectedUav]);
_laserPos = position laserTarget _connectedUav;
_validLaserPos = !(_laserPos isEqualTo [0,0,0]);
if (_intersects && _validLaserPos) then {
_this select 0 drawIcon ['a3\ui_f\data\igui\cfg\islandmap\iconplayer_ca.paa',[1,0,0,1], _laserPos, 24, 24, 0, '', 1, 0.03, 'TahomaB', 'center'];
_this select 0 drawLine [ _connectedUav, _laserPos, [1,0,0,0.5]];
};
"];
@earnest path try this: https://steamcommunity.com/sharedfiles/filedetails/?id=1231394000
I want to take it a step further and change the icon if the laser is locked on (ctrl+t) a positon/object is there a way to get that information
So this;
class CfgSounds
{
sounds[] = {};
class roger
{
name = "roger";
sound[] = {"a3\dubbing_f_beta\showcase_combined_arms\15_Insertion_Complete\showcase_combined_arms_15_insertion_complete_BHQ_0.ogg", 1, 1, 1};
titles[] = {1, "Testing."};
};
};```
Executed from console with this;
```SQF
C_1 say "roger";
Gives a subtitle, but nothing else.
Does anyone know why off the top of their head?
@shadow sapphire you've set the distance to 1m
{"a3\dubbing_f_beta\showcase_combined_arms\15_Insertion_Complete\showcase_combined_arms_15_insertion_complete_BHQ_0.ogg", 1, 1} try this
Ah, I know what happened. The distance was set to 100, then I deleted the distance completely since it was optional, then I added back a test value, it didn't work, then I ended up fixing it and forgot to change that test value. It's almost always some stupidity. Thanks a ton.
no problem π
@inner swallow, it still isn't working. I loaded a different mission in editor, then loaded back in to my test mission to try to make sure the new description.ext was loaded, not sure if that's necessary or if it doesn't go far enough, either way, still not working.
hmm. maybe try without a3 at the start of the path, or just the filename without the path?
Hokay! Good tips. Will try both and report back.
btw did you see this?:
NOTE: Since Arma 3 v1.49.131710 it is possible to define AddOn sounds in mission config. In order to make engine look for the sound in AddOn, the sound path must start with @ (instead of \) for example:
class CfgSounds
{
sounds[] = {};
class addonsound1
{
name = "sound from addon";
// start path to sound file in AddOn with @
sound[] = { "@a3\Ui_F_Curator\Data\Sound\CfgSound\visionMode", 0.8, 1, 100 };
titles[] = { 0, "" };
};
};```
ππ½
is switch applying lazy eval - as in stopping checking with the first true statement? Or is it checking for all cases regardless?
Switch checks all cases defined.
so i'm actually better of nesting of if statements than using case? lame
Don't know. My knowledge is limited. Switch as it is has been useful for many a gear script, so I wouldn't put it down, myself, haha.
it looks tidier, but if it checks all cases regardless of a match already found it's potentially wastefull
If a case has no code block, the code of the next case will automatically be executed. This makes it possible to formulate a logical "or" for cases which otherwise would contain the exact same code. (See example 4 below)
The default block will be executed only if no case matches, no matter at which position inside the switch it is. It is not a case, and will never be entered by fallthrough.
switch returns whatever the return value of the executed case block is. If the condition is not matched by any case and there is no default, it returns true.```
always worth checking the wiki π
Did I mislead him, @inner swallow?
yeah (partially) π wiki suggests it stops checking other cases, if there is a code block present
Ah, I see.
meh okay, was reading https://community.bistudio.com/wiki/switch
How can I make it so I can process multiple drugs in one drug processing (atlis life) class uranium { MaterialsReq[] = {{"uranium_unrefined",1}}; MaterialsGive[] = {{"uranium_refined",1}}; Text = "STR_Process_Uranium"; //ScrollText = "Refine Uranium"; NoLicenseCost = 10000; }; example coding
@strong shard Thank you i will try it
i noticed that there is a mod for survivable crashes on the workshop
but i dont know how to make it function
why is that working in the debug console but not in postInit
_uavHelper = [] spawn {
disableSerialization;
_ehUavHelperMap = ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["draw", "_this call qipTPL_fnc_uavHelper"];
_ehUavHelperTerm = ((findDisplay 160) displayCtrl 51) ctrlAddEventHandler ["draw", "_this call qipTPL_fnc_uavHelper"];
};
probably there are no displays yet... you can add waitUntil {!isNull ((findDisplay 160) displayCtrl 51)}; also ctrlAddEventHandler does support { } < script code
@coral wraith
nice, also you can remove disableSerialization
ok at least the map works the uav terminal doesn't work at all , did thay change the display idd?
private _idd = uiNamespace getVariable "RscDisplayAVTerminal";
I guess I would then have to use it like this?
_idd ctrlAddEventHandler ["draw", "_this call qipTPL_fnc_uavHelper"];
@meager heart it is not good to remove disableSerialization in any script that working with UI
lol
in spawn it's actually needed tho... I think?
It's not needed inside the eventhandler
when you do not store UI elements you not need it at all and if you will store them, you will need disableSerialization but only in scheduled
@meager heart disableSerialization not only about storing UI types to variable
oh.. yeah. stopped reading at displayCtrl. But can't scheduled suspend mid-expression? π€
@meager heart it is about saving script to save file
@meager heart UI not saving to save-file. UI need reinitialize after load. If any UI script saved in middle - after loading save, this script make undefined behavior
this script make undefined behavior
Well the UI variables would be null. displayNull/ctrlNull
actually quite well defined.
@still forum if command not need variables, or this script do something else (Not UI)?
Don't understand
btw maybe good topic for the sqf blog ^ π€
I can grab all the technicalities if anyone wants π
That's more something for ITE which is my format anyway
i have free time this week. Maybe.
up2u man, imo that topic is needed, also will be easier to just paste links rather than fight with letters in chat π
One more note on using UI handlers. This is the best way of handling UI. You do not need to use disableSerialization in any of the functions that are called from UI event handler. It is only if you are planning on storing UI variables and then reusing them later you might get complains from the engine and consider using disableSerialization. Even storing your UI variables in uiNamespace might not be enough in this case. - KK
(not something i know anything about, saw the discussion here and randomly googled for stuff)
@still forum why should mid-expression evaluation result in issues?
the command evaluation has nothing to do with variable saving π
I want to check if a compass bearing is roughly equal to another compass bearing (say, +/-20 degrees). I have no clue how to go about this. I figure there must be a simple trick i just don't see right now.
@queen cargo because you might have a control/display on the stack when the script get's serialized. And they can't be serialized.
@inner swallow I already said that above. It's not needed inside the eventhandler π That's basically all that big text in... shorter.
@waxen tide abs (_dir1 - _dir2) < 20
Simple math
@still forum too simple. Thanks. I'll fetch more β
@still forum aye, it was meant more as a third party citation of the same :p
I'm trying to make vehicle guns shoot faster but
_Unit = vehicle player;
_Unit addEventHandler ["Fired", {
_Unit setWeaponReloadingTime [(_this select 7), (_this select 2), 0.1];
}];
doesn't seem to work
you cannot shoot faster than your FPS if that's what you are trying to do
reload time can be minimum one frame
No this is for the MG251
the USS Liberty gun
It currently has like 6 seconds between each shell
Trying to make it more inline with a bushmaster or something
did you check if the gunner and muzzle are correct in the eventhandler?
Yeah so it seems weird, if I do _Unit = (vehicle player) and then _Unit addEventhandler
it wont work
but if I do (vehicle player) addEventHandler
it works
nevermind, worked for the artillery piece, but not for the drone piece
yeah. you are not "in" the vehicle if you are controlling a drone
yeah but even "this" or "vehicle this" in the init wont owkr
I systemChatted the event handler variables and they look fine
Meh serialization is too boring for a full blog post. If you call disableSerialization the whole script VM will get serialization disabled which means it's not saved to the save file meaning the full script will be gone after load.
Important detail. If a script calls disableSerialization all it's parents will also get it disabled. So if your spawned while true loop calls some other script that calls some other script that disables serialization. Your while true loop won't be running after a savegame load
Wow, really? Thought it only applied to the scope it was in. Should really be a unary command taking code on the right to which it applies in....
Hah ππ funny
@still forum did you also checked if Dialog command chains can error out if saved?
Hello, I want to check if a variable is either Nil or false, this is my code: if ({isNil "kka3_inSuicideAction"} || {!kka3_inSuicideAction}) then
But it says generic error in expression. I know that the Syntax is wrong, but I'm not sure what exactly
it better does not ... whole reason i never used variables in such scripts was because i feared those problems
oh, aight. Gonna try this
but why not use getVariable with a default value of true?
if (isNil "kka3_inSuicideAction" || {!kka3_inSuicideAction}) then
is the same as
if !(missionNamespace getVariable ["kka3_inSuicideAction", true]) then
It doesn't seem to work when the var is nil, that's why I tried the above.
it returns the default value when the var is nil.
It doesn't work lol I don't know what I'm doing wrong
check value in debug console
if (isNil "kka3_inSuicideAction" || {!kka3_inSuicideAction}) then yeah.. Didn't even see. That can't work
it only checks it's value if it is nil. But if it's nil it can't check the value cuz it's nil
if (isNil "kka3_inSuicideAction" || {!kka3_inSuicideAction}) then
Works fine, thanks for your help π Is there a wiki to look up correct Syntax? I feel like it's my main issue besides of actual experience
^^
Who was it that linked me how to distribute waypoints in a circle before? Where is that web page? Anyone know?
@shadow sapphire I don't know who was that... beautiful man lol, but this will helps http://sqf.ovh/sqf math/2018/05/05/generate-a-random-position.html π
Probably that communist
rip
I tried searching for it here, I know it was in this channel, but I canβt remember what to search the than βcircleβ or maybe βdistribution.β
I do think thatβs the site, @meager heartc. It was a dot ovh site that whoever linked. It might have been you that linked it originally, anyway.
Dammit. That link is giving me 404.
π€
works for me.
alternatively just http://sqf.ovh and click the post manually
Carefully and biologically produced Arma 3 sqf training site
@mortal nacelle that would be more of a #arma3_config thing
oh crap, sorry lol
those are nice posts, dedmen!
I made one of them
@mortal nacelle np, it's for you π if you want faster/better answers
ah
I read quite a bit about the topic, but i am still wondering why you get so much fps drops and stuttering when you execute heavy scripts. I mean shouldn't the whole point of the scheduler be to avoid that? I also noticed that scripts that run forever but do not spawn anything but just fetch lots of data and calculate things don't really mess with the games performance, but as soon as you spawn something, you have issues. So i figure the functions we have to spawn things do not consider performance at all and just overload the game loop while spawning all the stuff. Assuming that i wonder if chopping up spawning things into smaller bits with breaks intbetween especially in MP to sync stuff would help. But i've not really seen anyone do that.
It all depends on what scripts you're running. Scheduler executes scripts by pieces but single heavy scripting command execution cannot be split into pieces, it has to execute right here and right now. Heavy stuff includes nearestObjects, allMissionObjects and others.
How can heal a player to full when ACE has someone unconscious?
@@waxen tide Many spawn systems optimize for spawn stutter. In ALIVE we can easily spawn 200+ AI in under 2 seconds without inducing any noticeable spawning - related lag
For the most part you can stuff a few empty frames in between each spawn to get a smoother result.
@hardy flax no. @drowsy skiff @open vigil @graceful pewter
Thx for input Sa-Matra.
@snow pecan I wonder a bit how to stuff in a few empty frames reliably?
Keep an array of units that should spawn, then have a separate loop iterate per frame and pick off X units to spawn each frame
From there you can spawn once every X frames, or once every X seconds etc
By array of units, I mean data needed to create that unit
Do you know from the top of your head how to iterate per frame?
I believe you can add a perFrame event handler with 'addMissionEventhandler', but I'm on mobile so you'll have to consult the wiki to confirm
CBA also has has some solutions if you have that running
Oh yes ofc, event handler. Thanks. I would never have thought about doing things this way, i would have figured it just creates needless overhead.
class Extended_FiredBIS_EventHandlers {
class AllVehicles {
class ADDON {
clientFiredBIS = QUOTE(_this call FUNC(fired));
};
};
};
Can anyone explain what is clientFiredBIS?
I looked on the cba wiki
but it doesn't really say anything
just says that firedBIS is differenet from fired
I was looking into the antistasi performance issue this morning and it turns out the real killer is actually onFrameEventHandlers and playerEH's. The scheduled environment hits a maximum and doesn't go past it but those unscheduled event handlers are what takes the frame rate down from something reasonable (60+) into the 40s most of the time in the game mode. It isn't antistasi directly however, it doesn't use CBA and these are CBA events, so probably ACE since it is a heavy user of custom events.
I was actually really wanting a bit more information than the profiler build gives me, because it tells me where the time is going but alas it is at the gsEva; 2.22161; 4.13762;"call cba_common_fnc_onFrame" level and doesn't give me any more to go on, so from that point it is a guess as to whom is likely using the CBA stuff that gets called from onFrame.
I was actually really wanting a bit more information than the profiler build gives me
https://forums.bohemia.net/forums/topic/211626-arma-script-profiler/
I'd say being able to profile down to script instruction level should be enough
Cool I shall have a look at it and find the culprit.
@peak plover What is missing from the XEH wiki https://github.com/CBATeam/CBA_A3/wiki/Extended-Event-Handlers-(new) , it even gives a description of why? XEH's Fired originally added the projectile parameter to the event. But when BIS added magazine parameter in Arma 1 instead, projectile and magazine now had overlapping positions. The recommendation to use FiredBIS rather than Fired is probably it has the parameters exactly like they are given (like all the other events), and the original Fired is there for backwards-compatibility.
The client prefix in clientFiredBIS makes it only run on machines that acts as clients (not on dedicated). The latter part does not have to match, e.g. could have been clientFarkleBloom instead.
aah
Thanks
["AllVehicles", "FiredBIS", {systemChat str _this}] call CBA_fnc_addClassEventHandler;
Returns false
I guess it only supports configs
haha, I just found that just now
That's funny, because they also say not to use fired
and then they say to use fired
π€
I guess I'll use description.ext
lol?
@drowsy skiff witten.
He posted same on YLands/Folk ARPS too
@rugged token please remove that link from here
if you want to advertise a community, please read #rules and then use #communities_arma3
puts the Makarov back in the drawer
@still forum Also CUP, IFA and several others
Witten yes. But that message above no. Only Ylands/DayZ/Vigor/Folk ARPS/TFAR/ALiVE
In the end, doesn't rly matter... simply ignoring and insta-banning that "person" is the only way to deal with him.
Sad state of affairs when your life is composed of spamming discord servers for months :/
It's been half a year now
So I put intercept host @intercept in the mod string as well as @tough abyssScriptProfiler and I am running profilerCaptureFrame; from the debug block as admin and just nothing. I have missed a step I presume.
Works only without battleye. And read the latest forum post for the last-gen stuff. The ingame profilerCaptureFrame is not as advanced as the new stuff
Not running battle eye
should get a error message in main menu about dummycert not found.
Where did you get Intercept from? The latest build of the profiler has intercept inside it. Not in @intercept
Ah you probably used the intercept thingy linked in the thread? That's very outdated. I'll remove that link.
Just take this build: https://github.com/dedmen/ArmaScriptProfiler/releases/tag/RC6 it has everything in one package.
You might want to remove sqf-assembly.dll because that add's a F-ton of data to your profiling.
OK Installed that and restarted, same thing running profilerCaptureFrame and nothing is happening, no error in the RPT.
Looks healthy from the log entries - "15:25:32 Initializing Intercept
15:25:32 CallExtension loaded: intercept (c:\a3mods_dev@armascriptprofiler\intercept_x64.dll) [ΓΒΊΒ£Β]
15:25:32 Intercept initialization part 1/3: 1
15:25:32 Intercept initialization part 2/3: true
15:25:32 Intercept Loading Plugin: SQF-Assembly
15:25:32 Intercept Loading Plugin: ArmaScriptProfiler
15:25:32 Intercept initialization part 3/3: -1"
I didn't test out the old stuff since I started working on integrating the brofiler UI
But I thought I didn't touch it π€
nvm. https://github.com/dedmen/ArmaScriptProfiler/blob/brofiler/src/scriptProfiler.cpp#L29 Could be that, that build is built with brofiler only and the old stuff is disabled. Don't have my project here to look how it's configured currently
I would really recommend to go for brofiler. It also shows you arguments passed to functions. And I didn't test the ingame display stuff since I started with brofiler.
Here is a build with ingame profiling support enabled.
is there an easier way to search a GUI Tree than doing a manual recursive search through all items?
OK brofiler does something, I hit the start, click the game, capture 20-50 events before I get back to it and hit stop and then I click back on the game and I see some ms counts, game freezes for a bit until brofiler crashes.
probably because of too much data because of the sqf-assembly thing that I told you that you might want to remove because of the F-ton of data :D
Not sure why it crashes though.
Sorry. The profiler is a very nieche and experimental thing. Not the most user friendly thing I made π
I'll remove it and try again.
"<unknown> 5.1ms" - sigh. None the wiser unfortunately. 48ms frames and its not unscheduled, well 5ms of it is but no idea what it is.
right click -> show source
I think in bottom left. Might also work on the flame graph in the middle.
It shows all scripts that were compile/compileFinal'ed and run in unscheduled. Scripts that were made like MyFunc = {code} or direct engine eventhandler or config scripts aren't shown.
Time is all spent in the CBA onFrameHandler code, that certainly showed me something
and if it doesn't show any lower code then it was either added via [{codehere}] call cba addEH
or mycode = {code}; [mycode] call cba addeh sorry for crude. Gotta catch bus
you can manually add _blalsdbsdbsbds = createprofilerscopethingy to these scripts. Not the correct command. again in hurry.
https://imgur.com/YZXq8QA <- So this is the weird part, lots of stuttering but the unscheduled is fairly consistent and pointing at this for 4-5ms a frame - https://imgur.com/LBJwhSl
So there is definitely a problem in CBA there that is consuming a lot of time, the sub calls just don't add up although acre is a prominent contributor
hi guys. has anyone written a nice way to get all items in a container and equip them to a player?
I find it a little challenging since methods for equipping items differs for itemtype.
For example:
_pilot linkItem "G_Diving";
_pilot addVest "V_RebreatherB";
_pilot addHeadgear "H_HelmetB";
do I have to identify each itemtype, then use the correct method for equipping them?
Thanks @tough abyss You gave me an idea on the bus how I can show scripts that were defined inside scripts and not directly via compile
You can zoom in in the flame graph with CTRL+Scroll
to see the exact timing of stuff
okey it crashes and I know why. But not what causes it
Is there a way to delete or overwrite a class completely in order to replace it?
@nocturne basalt you can use BIS_fnc_itemType to identify them
if you re-add each entry you will overwrite it completelty
and there is also the delete keyword to delete a class yes.
but some packers have problems with deleting/redefining in same config
Is that one the wiki somewhere?
@still forum thanks
Yes, that works.
need to make sure your requiredAddons is correct
Interestingly, if I delete the class and add the same class again it say member already defined
make 2 configs
one delete. second readd
or use CBA display EH to catch when it opens and open your own one instead
Nah, way too much work π
Okey I take it back. I don't know why the profiler crashes. It did crash once for me. But after I rebuilt brofiler and the profiler plugin everything works π€
π€¦ the last release is missing a very important bugfix.. wtf
I just figured out my general approach. I write code, and then i try to find out what it does.
Sometimes what it does is what i wanted to do, in that case i keep the code.
sounds like a pro, @waxen tide
Don't worry, one day you may ascend to my level.
How do you write code and not know what it does?
Can you even write words you don't know?
Brazibblugrub
@tough abyss added a new feature. Now also displays scripts that just exist inside a file that's compiled so stuff like [{code}] call CBA_fnc_addEventHandler
https://s.sqf.ovh/2018-07-24_22-26-32.png It displays the line number if you enable that button.
Will be RC7 that I upload in a couple minutes. That should show you now what scripts are running in that PFH
Also it doesn't crash for me with sqf-assembly. But that could be luck
You legend! We just finished for the evening but I should get the opportunity to run it in tomorrow and I'll see what it gives me.
can I disable error/warning messages on a single function and not the rest of the script? in php I can do that with @functionName
yeah I know I dont usually do, but I have a function that prints an error message only when my vehicle dies
and I cant figure out why
it telling me the variable is a string and expecting a number, but it is a number .---
add logging to it and check what it really is
You have an error in your script. Disabling the warnings won't fix the problem
ok ty. gonna try to find it
diag_log [_var, typeName _var]; to see what it really is
I'm trying to write a script that finds realistic spots for roadblocks around a city. So far i'm generating a circle of positions around the city, check for nearestroad on each, use that as my start position and then search the road network following each branch i find for 50 steps. Result looks like this: https://i.imgur.com/nINefxP.jpg
First, this is really slow already (figures) secondly i'm not even done yet identifying the strand that leads to the city to look for a suitable position on it for a roadblock.
Does anyone have a genius idea for a smarter approach?
Well if you define a suitable position as the one lying in the middle between two cities, then something like...
For each city find its neighbouring cities (like 2...3 closest ones within 1km range)
For every pair of 'this city' an 'neighbour city' find a midpoint
Search roads around this midpoint with radius equal to like 0.3 of the distance between the cities, then select the road segment which has the lowest module of difference between the distances to the city centers
To make it fast use the array select {} command instead of custom for loops
Guys I have a weird problem with my script. I have added a mission event handler "PlayerConnected", inside it I do something trivial like:
if (condition) then { [{ systemChat "You are detected!"; }] remoteExecCall ["call", _owner]; diag_log "Player detected!"; }
I see in the .rpt of the server that it gets triggered nicely, but on the client's side it only displays the text in systemChat on a clean mission start but not in JIP O_O Am I missing something? Like maybe I need to wait until the player spawns or his mission display appears or ...?
The issue with that would be that you'll potentially just find a road that runs inbetween two cities, too
Yeah you can also check the reoad direction
like it must be within +-20 degrees range of the line between the two cities
tried stuff like that
if you have a road with a tight bend it will throw it out
despite it being a good spot for roadblock
Well... maybe you could form a 'goodness' metric for your position based both on angle criteria and 'distance from midpoint' criteria?
Then sort them by this value π
i just had an idea
i can easily detect branching, then cache whatever i find while i follow a branch, and at the end of the branch i check how close it is to the city. if it is too far, i throw away all branch data.
this way i only keep one branch, the one that leads to the city for sure
and i only need a handful of distance checks, not 9001
When you start detecting these branches it will get slow, I guess, but surely you can try
My idea was use the select or apply commands as much as possible to accelerate it
i already follow all branches? and i can detect them by counting the roadsConnectedTo array
cheap check
it just counts an array with 2 or 3 elements
I think i did not understand your idea to the fullest extend.
You didn't understand the... geometric part of the idea or...?
I didn't understand how array select would be useful
But i am also quite certain that your approach will fail at certain spots due to map weirdness.
you could easily find a road that is not connected to either city
yet the direction and position would indicate that it does
hence why i did the roadsConnectedTo madness
like some damn pieces of runway count as road. some random bits of concrete in a military base connected to nothing do