#arma3_scripting
1 messages Β· Page 311 of 1
thanks. I'll see if it's useful or not
i've done that manually with nested controlGroups.. so it is possible without it
Yea same here, works fine but was always annoyed that something like this didn't exist yet
yeh
Just one of those things that would seem so likely to have
At least controlsGroupCtrl command made it a lot easier to work with them
yeh and control setVariable ...
used to have invisible labels to store extra data lol
Some control types are not suitable for use inside of Controls Table. These include e.g. control containers (Controls Group and Controls Table) ...
RIP
may not need a controls group?
i think the rows might effectively be controls groups?
well i guess depends what you're doing.. but you can have multiple controls in each row
looks like the commands are all in dev branch only ctAddRow, ctAddHeader, ctClear, ctCurSel, ctSetCurSel, ctRowControls, ctHeaderControls, ctRowCount, ctHeaderCount, ctSetValue, ctValue, ctSetData, ctData, ctFindRowHeader, ctFindHeaderRows, ctRemoveRows, ctRemoveHeaders, ctSetRowTemplate, ctSetHeaderTemplate
double RIP then
needs too many unknowns for controls table
yeh ok.. guess i'd use nested controlsgroups
But that is how the ControlsTable works as well if I'm not mistaken? @vapid frigate
seems the controlstable uses a template that it reuses for each row
which wouldn't easily work with what commy is doing
- it doesn't exist yet
What is he doing?
that pic
What is that?
game options with colour pickers i guess
oh
I'd make something like the google color picker, but that'd be even more complicated on the inside
In some cases it would probably be useful still
i got some cases where i'd use it, but others where i'd go NOPE
HANZ
@little eagle You mean something like this? https://forums.bistudio.com/forums/topic/203269-release-colorpalette/
Yes.
Not as complicated. Just RGB, because it's meant for the average user.
But basically this
Is there a way to detect if client loaded all scripts?
Im asking because my server is tried to call function on client that was not yet initialized
I would like to wait until all players called their scripts and then execute thiss function
can put the name of the function in a 'watch' in the debug console
it should come up your script (and a bit extra).. if it's blank, it doesn't exist
what about getClientStateNumber?
does in-game mean all scripts are loaded?
@vapid frigate what?
Set a variable on the player after the functions initialized like player setVariable ["scriptsDone",true,true] and then you can check that serverside
Depends on how you are "loading" your scripts
probly better to use CfgFunctions or PREP.. then they all exist at the start
Well.. I suggest changing the way you are "loading" your scripts then... Yes it is. And I think async scripts only start after the briefing screen.
Yeah. Use preInit to define the functions.
execvm runs .sqf files though.. so nothing should need to be 'loaded'
CfgFunctions are initialized before the briefing screen. so better use that.
or preInit but without execVM.
ok thanks
The functions in CfgFunctions are defined in preInit "internally"
I'll try to use CfgFunctions for now
The less race conditions you create,the easier it is to follow the code.
And doing more scheduler threads only means more race conditions.
yeah I would like to keep it stable
Lecks, even if you use execVM, the script could depend on other functions.
script is waiting for data from server after function execution
But it should also complain about undefined variables in scheduled environment, so at least you will be told...
so there should be enough time for other scripts to initialize
"should be" : D
i'd probably remoteExec from the server after it's done its thing in that case
it is remotexec from server
but server sometimes sends command too fast and client didnt load that function yet
that's why I'll try cfgFunctions
yeh ok.. hopefully that'll solve it
I can always make a small sleep delay
Remoteexec the functions in array. Last item in the array is a true variable.
That you can do waitUntil {(last item in array)}
That way you know client has all the functions
Or just add the functions to the missionfile
yeah I added them to cfgFunctions
also did a 5 second sleep for server to remoteExec just to be 100% sure
stupid keyboard, sorry for typos. Need to replace it
I have a question
I have a variable life_isknocked that is local on one machine
Given a Unit, I need to check the value of that variable on the machine that the unit is local to / of the player who controls that unit
also, how does setting a variable on a unit work?
do getVariable and setVariable automatically set it on the machine were the unit is local, or is is that local to the machine were it is executed?
just player setVariable ["life_isknocked",true,true] last true makes it global
okay, that answers both questions
then you can use _unit getVariable "life_isknocked from any client
does anyone know how to restart (press esc -> Restart) a mission in the editor via sqf?
or sqf to start a mission in 3den
I have a question for the DMS I would like the vehycule spwan no gas have you a ling of scrip that I must add and or I must add it(Γ©ditΓ©)
@cloud cove DMS is built for exile. Probably better support then asking here. This more related to generic arma.
God damn I hope they fix flyInHeightASL for the jets dlc
Would be kinda funny to still have it broken in a dlc specifically for fixed wing craft
Hey, does anyone know a call to "Get" an array of spawn locations available to a side in game?
I'm trying to add AI to a player's respawn vehicles randomly, so when they respawn, they can grab a squad to go with them.
I don't want to have a "recruiting" function, because it sort of breaks immersion.
We use ACE, so it's easy to join a squad of AI and take command of them.
Ugh, can't figure out how to use https://community.bistudio.com/wiki/fullCrew
How do I get ALL the possible seats in vehicle
Empty would be great
nvm, I think fullcrew [vehicle ,''] works
@peak plover Are you wanting to like, get all available seats with their positions? Or just find the first empty seat
I wanted to get all empty seats
_usedSpots = fullCrew [_vehicle,''];
_allSpots = fullCrew [_vehicle,'',true];
_emptySpots = _allSpots - _usedSpots;
I ended up using this
Is that workin for ya?
I'll try in a few hours when I get my script running and into arma
Trying to make a script that has an AI drop off people in a helicopter
oooh thanks
That is exactly what I needed
Actually. This would work beter I suppose. Really depending on your needs and how you choose to modify it(the sytax for emptyPositons = _unit emptyPositions _position) ```
waitUntil { ([vehicle, "Cargo"] call Client_GetEmptySeats) == 0 };
Client_GetEmptySeats = {
_vehicle = _this select 0;
_check = _vehicle emptyPositions (_this select 1);
_check
};
You shouldnt need the function actually. All you would need is: waitUntil { (vehicle emptyPositions "Cargo") == 0 };
Any way to change the loaded magazine when setting loadouts for AI in the editor (by using the Edit Loadout option to get to Arsenal)?
first magazine added ?
What would we do without error reports from the community. https://github.com/acemod/ACE3/issues/5082
Oh, I'm sure it's riddled with errors.
at least he used the template
It forces the template. You start with the template
oh ok lol
https://gyazo.com/326d9c0120fbbd197802fd30e7770d93 is this something i can replicate or is it unique to end game?
He only change the title
looks like he signed up to github just to make that contribution
Just reduce the errors damnit.
I actually have a ace error in the main menu, forgot what it is, but after leaving a server and going to the main menu, there is a script error
bethesta studio pls fix
spectator?
hey @little eagle what's your AGM_COH mod on github?
hmm that is right though @tough abyss , looks like it's just in missionNamespace https://github.com/acemod/ACE3/blob/master/addons/weather/functions/fnc_updateRain.sqf
And It's called Woops no it's notACE_weather_rain
PublicVariableEH's are always missionNamespace
https://github.com/acemod/ACE3/blob/master/addons/weather/XEH_postInit.sqf#L13 here is that code that battleye tells you
Well.. It's just a normal ACE script that's executing there. No Idea why Battleye complains
is it talking about the ACE_WIND_PARAMS part then?
rather than the ACE_rain part
have you added that to your filter?
Well.. It's postInit.. So no. No uiNamespace
hey:) does anybody know why my lightsource is flickering all the time? (attached to a flying plane)
_light = "#lightpoint" createVehicleLocal [0,0,0]; _light setLightBrightness 0.1; _light setLightAmbient [1, 1, 1]; _light setLightColor [1, 1.0, 1]; _light lightAttachObject [plane, [0,0,0]];
Lightsources to a Vehicle/moving object = Bad idea.
They won't hold Position properly and lag around
ok then chemlight it is π
yep
@rancid ruin
Template for company of heroes mod. Not finished and unlikely to be ever finished.
JIP (Optional):
String or Boolean - If true, function generates a unique ID for the message and the message itself is added to the JIP queue and executed for every JIP. If a non-empty string is given, it is treated a custom ID of the message and the message itself is added to the JIP queue overriding any remoteExecCall message with the same ID. Otherwise, no ID is generated and no message is placed into the JIP queue. [default: false] (see also Example 7 on how to remove previously set function from JIP queue)
So I guess it appears 100 times in the JIP quene.
Since it generates a new JIP id since it uses "true".
did you have something specific in mind for that COH mod or were you just testing?
I wanted to make a template first and then maybe do stuff. CoH1 is pretty dead though.
So hard to motivate. And I don't have unlimited time, so I rather do Arma. π
yeah fair enough
coh doesn't have many players but there is a strong core of like 500 people who are hardcore coh1 people
OMG mod is still played regularly
if (rank _caller >= "SERGEANT" && _state isEqualTo "doDeSpawn") then``` can someone explain me why this generates an error? ```sqf
if (rank _caller <= "SERGEANT" && _state isEqualTo "toLab>
12:37:23 Error position: <<= "SERGEANT" && _state isEqualTo "toLab>
12:37:23 Error <=: Type String, expected Number,Not a Number
12:37:23 File C:\Users\Aebian\Documents\Arma 3\missions\[A]_Cuda.Woodland_ACR\itsAebian\lab_gate.sqf, line 11
12:39:18 Error in expression <s ["_state", "_obj"];``` I followed https://community.bistudio.com/wiki/a_greater=_b this
yea but something can't be greater or less than a string ("SERGEANT")
hmm okay, but the return value of https://community.bistudio.com/wiki/rank is string π
hmm then I need to translate it to numbers
hmm nice thanks you two
do you understand why it gave you an error now, too?
yes you cant compare integers with strings
or numbers in general
I know I just didn't read the wiki enough π
Error <=: Type String, expected Number,Not a Number
This part of the error tells you exactly where it's failing, for future reference
Well, you tried to compare two strings. And
"PRIVATE" >= "SEARGEANT"
is simply undefined.
@indigo snow CoH is a fun game and one of the best RTS, but splitting the community with the shit that CoH2 is killed it.
Sry I meant to tag oneoh -_-
Hi guys, whats the best way to limit darter range to X meters ?
"efficient way"
this is how far i got and failed
[] spawn { while {getConnectedUAV player} do { _drone = _vehicle isKindOf "UAV"; _range = missionNamespace getVariable "GAMEPLAY_DARTER"; _ctrl = UAVControl _drone; _seat = _ctrl select 1; if (_seat == "driver" || _seat == "gunner") || _range < getPos Player then { player connectTerminalToUAV objNull; titleText ["Signal to UAV is LOW"]; }; }; };
@little eagle yeah coh2 is shit, we're on the same wavelength with that π
someone in this channel once said they were working on a coh-like RTS mode for arma...can't remember who it was though
cos i would definitely like to help with that project
How could I do a ratio?
coh as in company of heroes?
Yes
@glass temple Whatcha mean?
Ah. I saw that floating around a while back. Never got up to getting it.
Isn't it kind of like Men of War Assault Squad 2?
Basically calculate ratios in arma.
Use distance @high vigil
raΒ·tio
noun
the quantitative relation between two amounts showing the number of times one value contains or is contained within the other.
10/24
???
50 dogs/elephant
Bananas
10 commy2/SQF
Maybe there is a secret meaning of "ratio" I'm not aware about.
Like how Bambis aren't deer these days.
What's the best editor to write SQF (in your opinion)? I'm making lots of small mistakes that result in endless errors, and I'm wondering if there is a text editor that would notice these syntactic errors (like missing ; or missing "do" in switch statement)
eclipse with SQDev
@tender fossil
But that may be my favorite because I wrote that plugin myself π€
However it should do the trick for you π
There's Eclipse plugin for SQF? Woah π
I'll definitely try it out, thanks for the tip!
You're welcome
Don't forget to join our discord (link in the linked post) so we/I can help you ther if you encounter any difficulties π
You're with a star. Fancy lol
Damn xD
I'm using Atom. Lots of people are using Sublime
Oops should read first.
Only Editors I know that support syntax checking are Eclipse with SQDev and Arma Studio
VSc aswell
@still forum Has syntax checking version of Arma Studio been released yet?
yes.. was included in the alpha. But Arma studio is not usable for writing code yet. As autocomplete is mostly useless. Atleast I need Autocomplete to write SQF. Other people may not
Checking out the Eclipse SQDev now... Do I need to do something in order to enable syntax checking?
Sublime ftw
Nope it works out of the box...
Thanks for @scarlet spoke, we got the issue solved by taking a closer look π
Then the next question in the endless series: How do I delete a line drawn with drawLine?
Wait a frame?
Can someone explain for me EH? I want to add a MPHit EH to an Object to trigger an explosion if it has been hit atleast two times. sqf _obj addEventHandler ["MPHit", {params ["", "", "_damage"]; if (damage _obj > x ) then {/* Explosion here */}}]; was my tryout but for sure its wrong
@queen cargo Draw line is a map function which doesn't have to be ran each frame. (from what I can tell)
@hollow lantern _obj addEventHandler ["MPHit", { _object = _this select 0; _hits = _object getVariable "hitTimes"; if(isNil "_hits") exitWith { _object setVariable ["hitTimes", 1]; }; if(_hits == 1) exitWith { //Explode the object. The if statements says that if it has been hit once, then explode since it just got hit again(meaning it was hit twice) _object setVariable ["hitTimes", 0]; }; _object setVariable ["hitTimes", (_hits + 1)]; }];
oh nice thanks
are addMPEventHandler only triggered in MP? I tried that locally on a unit but the EH was not fired
I can only assume so. Just use _unit addEventHandler [];
hey quick question here, so whenever I use configClasses to return a bunch of classes based off of a base, it obviously returns the config entries. For weapons I just grab the _generalMacro variable for each entry. But for items it's totally different, for each item the _generalMacro is always "Item_Base_F" any ideas?
What are you wanting to grab?
configName ?
already tried, keeps returning the config entry @vapid frigate
@jovial ivy I'm trying to grab the classname.
configName is the class name
Well. Items are stored with CfgWeapons but im assuming you know that
Right that's why I'm so confused. @jovial ivy Indeed i do
Result is "CfgVehicles"```
Hmmmm...weird. Letme try this again and I'll report back.
i would use that anywhere instead of "_generalMacro"
no idea what _generalMacro is/does tbh
Meh, I saw it worked only for the weapons anyways lol.
ok just looked it up.. String: in Arma 3. Has no purpose whatsoever. It is generated automatically by BI developer tools for debugging See here for explanation
Generated automatcially? Are you sure?
so it'll only work for mods created with BI developer tools
(possibly not mikeros?)
Hmm..I don't think that's totally accurate. But alright, since I know to identify units with modifications you need that defined to something custom like "mid_mySuperAwesomeUnit_F"
kind of concept
it's copied straight from here https://community.bistudio.com/wiki/CfgVehicles_Config_Reference#generalMacro
so yeah.. good chance it's not accurate
They seriously need somebody to go through and double check everything documentated, could be misleading for some items.
you don't need it to identify units
typeOf _unit, or if you have the config entry, className (configFile >> "cfgVehicles" >> _class)
the latter is sorta useless using it like that because it just returns _class
I mean, think realistically though. Do you really want to do that for each unit you want to use from an addon? Especially if you have to make an array of them all for a function or something
as opposed to what?
configText (configFile >> "cfgVehicles" >> _class >> "_generalMacro") ?
I think we're talking about two different things all together. I was talking about in a addon defining the unit's classname
yeah maybe we are sorry, thought u were after the classname of a config
Nata my friend, no worries though.
you might want configSourceMod / configSourceAddonList / configSourceModList ?
that tells you what mods created/contributed to classes
Right, are items packed individually?
usually not
Wait what? You're telling me in terms of where the items are defined you can't tell the difference between weapons and items?
// _null = [(thislist select 0)] execVM "thisScript.sqf";
params ["_noob"];
if (unit isEqualTo _noob) then {} ``` Question is will the code after ``then {}`` will only run for the unit that activated the script?
not necessarily.. a pbo can have both items and weapons
and vehicles, etc
if that's what you mean
@hollow lantern yeh, only clients (or servers) that run it
@hollow lantern Depends if it's true or not....tehehe.
Well, no. I mean in terms of how BI has sorted it all out. like in the configSourceMod Example : configSourceMod (configFile >> "CfgVehicles" >> "Car"); "Returns A3"
yeah I just have a script that displays a text via "\a3\missions_f_bootcamp\Campaign\Functions\GUI\fn_SITREP.sqf"; and I don't want the text to be shown to everyone
that's telling you what mod it's defined in.. in that case Car is defined in the base A3 mod
depends what you want to do
are u trying to categorize cfgWeapons/vehicles?
Well yes, I'm using that in combo with configClasses.
unfortunately i don't think it's as easy as reading the mod/addon it's from
I didn't particularly want to do that in the first place, I had used this method before.
because if it says RHS_M4, that doesn't really tell you if it's a weapon/item
dafuq are you guys trying to do?
rifles have a rifle parent
Only read half of it and my headache increased^^
Grab a bottle of aspirin Dscha, it's only going to get worse.
Nothing left -.- Need to wait 4more hours -.-
What? You already consumed your aspirin or is it the overdose warning that is getting to you? π
4 more hours until i can get a new pack of Ibo.
Anyway, too much offtopic. So again:
Dafuq are you guys trying to achieve?
Lool, I'm trying to sort items from weapons :/
"(configName _x) isKindOf['Item_Base_F',configFile >> 'CfgWeapons']" configClasses(configFile >> "CfgWeapons");
_list sort true;
Problem solved, next one.
/*
author: @Aebian
description: doomed!
returns: message!
// _null = [(thislist select 0)] execVM "doomed.sqf";
*/
params ["_noob"];
if (unit isEqualTo _noob) then {
titleCut ["", "BLACK OUT", 2];
[
["Urgent Message:","font = 'PuristaSemiBold'"],
["","<br/>"],
["You failed so bad!","font = 'PuristaMedium'"],
["","<br/>"],
["Leave the battlefield!","font = 'PuristaLight'"]
] execVM "\a3\missions_f_bootcamp\Campaign\Functions\GUI\fn_SITREP.sqf";
}``` Anyone knows why this is not working? Unit is BLUFOR, trigger is set to activation BLUFOR and on repeatable
yes a trigger Dscha, deal with it. And well I want the text just to be presented to the guy who activated the trigger
because the script runs in mp
"deal with it" erm... nope.
@subtle ore #define IT_HANDGUN 2 #define IT_SCOPED 0 #define IT_RIFLE 1 #define IT_LAUNCHER 4 #define IT_BINOCULAR 4096 #define IT_ITEM 131072 _allWeapons = "(getNumber (_x >> 'type')) in [IT_HANDGUN, IT_RIFLE, IT_LAUNCHER ]" configClasses (configFile >> "CfgWeapons");
if they're items, they'll also have an _x >> "ItemInfo" >> "type"
which will be one of these:
Oh....what in the hell. Cool.
#define IIT_SCOPE 201
#define IIT_RAIL 301
#define IIT_BIPOD 302
#define IIT_HEADGEAR 605
#define IIT_UNIFORM 801
#define IIT_VEST 701
#define IIT_NIGHTVISION 616```
Yes yes, wow. Thanks.
don't know if those macros will actually work in the quotes.. i use it a bit different
might need to just use variables or put the numbers in
No need to use the #defines. Only the the numbers work also.
yeh, just a lot harder to read π
π€· Works, I'll go back and make it look beautifal in the end lol.
i still use a manual list of things to put into 'misc' and 'medical' categories.. not sure if you can detect that
they generally use a random one of those IITs
Yeah that's odd.
Woops
Okay, even weirder. The only thing that method returns is: ["UniformItem","VestItem","HMDItem","HeadgearItem"]
i can give you my code for categorizing stuff if you want, but it's not pretty
Shoot
@vapid frigate _magazines pushBAck -_-
this was written before pushback
before configClasses i think too
err nvm can't have been before configClasses
what's the difference between the two? configProperties and configClasses ?
π€
A bit slower than configClasses but allows to access inherited entires.
depends if you need those entires
it sounds like configClasses would only give you the classes that were defined in that config, not it's parents?
not sure
I'm not really sure what entires would detail π€·
so would probably make no difference for CfgWeapons, but could make a difference for cfgWeapons >> "MX_Rifle_F"
in terms of code performance or just grabbing information in general?
both, configproperties can grab more information (including variables, and inherited classes), but is also slower
Right.
i think configClasses would probably be more efficient and get everything u need in this case
but i cbf changing/retesting it since i just do it in preinit and it takes <1sec anyway
yeah that works
https://www.dropbox.com/s/igoq2p3d4i101nq/20170317172439_1.jpg?dl=0
that's what it sorts it to/for
That makes sense
Alright, so I did a little test thing here. _allItems = configProperties[configFile >> "CfgWeapons","(getNumber(_x >> 'type')) in [131072]",true];
returns everything and adds everything just fine, one problem. Get this litle pop up "/acess is not a class ('type' acessed)
ah ok, because _x can be a variable, not a class
Well I would assume it's just checking for that specific number though?
_allItems = configProperties[configFile >> "CfgWeapons","isClass _x && {(getNumber(_x >> 'type')) in [131072]}",true];
if (_wep isKindOf ["CannonCore", configFile >> "CfgWeapons"]) then{}``` I guess (or hope) that will also trigger on a weapon that has the parent CannonCore?
depending what _wep is, yeah
Okay, yet another question if any of you might want to enlighten me on this one. I want to find out the faction type for each of these uniforms, headgear, etc. Any ideas? Faction and side variables don't work they all default in the config viewer and in a ingame run
i only know of 'side' on uniforms
keeps defaulting to 3
that's civs
Right, but even if I use a blufor uniform it's always 3?
hmm shouldn't be
Letme do another run
actually, can see where i do it around line 227 on that pastebin
it gets the CfgVehicle part of the uniform that the CfgWeapon is pointing to, and gets the side from that
Interesting, okay.
So very very odd. I got it to return this: [0,1,3,2,7]
all those being sides 0_o ... 7?!?
hmm.. 7 is ENEMY i think?
keep in mind you'll be getting items with scope=0 and 1
which likely aren't designed to be used
Right, I understand that. Some even with scope=2 like RHS
can someone point me in the right direction? sqf if (vehicles isKindOf ["rhsusf_m1a1tank_base", configFile >> "CfgVehicles"]) then{} I can't run isKindOf on an array. What should I use instead? General idea is to only run the script on a specific vehicle with given parent class
vehicles returns an array but there could be more then one M1 on the map π So a select is nope
vehicle returns all vehicles. It's an array
{
if (_x isKindOf ["rhsusf_m1a1tank_base", configFile >> "CfgVehicles"]) then{
};
} forEach vehicles;
if (({_x isKindOf ["rhsusf_m1a1tank_base", configFile >> "CfgVehicles"]} count vehicles) > 0) then{}
that works too π€·
\o/
yeh depends what u wanna do
midnights will run once for each vehicle
mine will run once (if any are true)
So..probably forEach then @vapid frigate ?
probably don't wanna use vehicles at all?
just the tank that's passed in to the EH?
Unless there are a shit ton of tanks?
@hollow lantern do you want to check all the tanks on the map, or just the ones that fire?
if (_x isKindOf ["rhsusf_m1a1tank_base", configFile >> "CfgVehicles"]) then{
_x addEventHandler ["Fired", {
_wep = _this select 1;
if (_wep isKindOf ["CannonCore", configFile >> "CfgWeapons"]) then {
_veh = _this select 0;
_vel = velocity _veh;
_dir = _veh weaponDirection _wep;
_veh setVelocity [
(_vel select 0) + (_dir select 0) * -5,
(_vel select 1) + (_dir select 1) * -5,
(_vel select 2) + (_dir select 2) * -5
];
};
}];
};
} forEach vehicles;```
every tank on the map '
ah ok yep, then midnights one
i don't think that's quite right.. should start with a {
but hard to tell with that lack of indenting
Woah the formatting 0_o
{
if (_x isKindOf ["rhsusf_m1a1tank_base", configFile >> "CfgVehicles"]) then{
_x addEventHandler ["Fired", {
_wep = _this select 1;
if (_wep isKindOf ["CannonCore", configFile >> "CfgWeapons"]) then {
_veh = _this select 0;
_vel = velocity _veh;
_dir = _veh weaponDirection _wep;
_veh setVelocity [
(_vel select 0) + (_dir select 0) * -5,
(_vel select 1) + (_dir select 1) * -5,
(_vel select 2) + (_dir select 2) * -5
];
};
}];
};
} forEach vehicles;```
was just missing the { at the start
uh formatting thx
hmmmmm ```sqf
if (_x isKindOf ["rhsusf_m1a1tank_base", config>
0:05:09 Error position: <isKindOf ["rhsusf_m1a1tank_base", config>
0:05:09 Error Generic error in expression
0:05:09 File C:\Users\Aebian\Documents\Arma 3\missions[A]_Cuda.Woodland_ACR\initServer.sqf, line 15```` so he has some problems with _x
weird
can't really say if it's the _x
if it's inside a foreach _x is each thing in the array
in this case each vehicle, one at a time
Are you wanting to check if its that specific tank, or just any tank>
specific tank that has the parent class rhsusf_m1a1tank_base
which would include the M1A1 and M1A2 in all variants
because they all have as parent rhsusf_m1a1tank_base
Are you getting the error above? Or what is happening.
ah it looks like for that syntax, you can't use the vehicle directly
Oooh your right.
need to use ((typeof _x) isKindOf ["rhsusf_m1a1tank_base", configFile >> "CfgVehicles"]
or _x isKindOf "rhsusf_m1a1tank_base"
hey @vapid frigate I don't seem to understand how you did vests though? They don't have any info like the uniforms do
should have iteminfo > type ?
facepalm god I'm stupid, sorry.
don't have a side though afaik, only uniforms do
Refresh me on what afaik means again, but I didn't realize that lol.
as far as i know
Oh okay.
Well all the ones in the CfgVehicles do have sides
the ones in CfgWeapons obviously dont
yeh, i only used cfgvehicles for uniforms/backpacks
not all vests, etc will have a vehicle
they're just for if you want to place them in the editor easily
Are you sure?
yeah, have made many vests/helms without vehicles
only uniforms/backpacks need them
shucks
backpacks don't have weapons too.. just the vehicle
Right
anyone experimented with making loot spawning systems?
wondering what the sure fire fastest way to spawn weaponholders + contents in say 20% of buildings on altis would be, before mission start
take a look at Bangabob's script if no one else has to offer anything
i dunno if that would be a good way to do it.. might need to be in populated areas/nearby buildings
would be a lot of objects to do the entire map
could be a probability
plus you could just disable simulation for the weapon holders that are a distance from the player
yeh, but that's not as performant as them not being there in the first place
What? You mean spawn them in as they go?
yeh, that's what most of those survival things seem to do
poorly/slowly in most cases
π€·
i've spawned weaponholders in every building position in every building on altis before, didn't notice any performance drop
this is in single player mind. and it took about 10 minutes
10 MINUTES? MY GOD
i know it does make more sense to spawn stuff as the mission goes on and people move around the map, just would like to find the most efficient way to do it pre-start
10 mins is nothing bro, i made a script to sample height data at a stupid resolution, took like 30 mins haha
That isn't okay though π±
You could just create a variety of zones. And when a player enters it, spawn loot in that area.
Instead of handling it all on start.
And either wait for the zone too be low on loot, or when there are no players to respawn/despawn loot.
problem with that is, that you could create zones around locations for example, but a good % of buildings on altis are nowhere near locations
and doing it by map grid seems a bit meh cos the building density could vary hugely between zones
Indeed. So instead of basing it on locations, just create like a giant grid of zones. Instead of using the base grid system.
could use a quadtree
But idk, spawning items is something I wanted to look into
have a tinker with it, it's good fun to watch in action
i've tried like 3 or 4 different methods but nothing seemed to be great
it just seems to work about 50x quicker to do X amount of spawns pre-init rather than mid mission
you running it unscheduled mid-mission?
that's probably the main difference i think
tried unsched and sched
think appearance wise, spawning a few different threads in different towns actually worked best out of the methods i tried so far
i was going to aim for tying it in to my persistent database, so loot would cycle every couple of days
but it's just a ridiculous amount of data to keep track of for little real benefit
it would prevent having to have everything kept track of in game though
could do it when ppl get within 10m of a building even
but yeah.. i think building ids change when BI updates the map.. so it'd be pretty difficult
probly have to use a hash based on class/position or something for the key
i've never used building IDs and BI haven't recommended people to use them for about a year i think
you'd need to keep track of which buildings have loot, and how much, etc. so doing it all in one big go at mission start does have certain benefits imo
just fire and forget, that's what i'm aiming for
have you tried it in MP? might be slow joining the mission too
because it'd have to transmit the thousands of objects to each client
i don't really care about multiplayer, all i do is dick around scripting for singleplayer
Right well I got loot spawning working. Now to optimize it π
@rancid ruin Example of a grid based loot spawn: http://prntscr.com/ewppcg
hey:) anybody know why there is an error? des_car_2 addEventhandler [ "GetIn", { if (driver (_this select 0) == player) then { (_this select 2) action ["Eject", _this select 0]; hint "You are not the busdriver!" }; if (driver (_this select 0) == des_npc_1) then {des_car_2 lock 3}; };[#] ( missing ] ) ];
Discord mightve eaten your underscores, but you should probably switch this to _this
no there is an underscore
des_car_2 addEventhandler
[
"GetIn",
{
if (driver (_this select 0) == player) then { (_this select 2) action ["Eject", _this select 0]; hint "You are not the busdriver!" };
if (driver (_this select 0) == des_npc_1) then {des_car_2 lock 3};
};[#] ( missing ] )
];
The best way to know if there is one is to -showScriptErrors + Your logs
We are not wizards
There is no voodoo magic to find bugs or something
^
uhhh
maybe
why?
yes
yeah i noticed that a french community is hosting it π
Yup
i havent touched the mission in like a couple of months now π
can only hope malden will have some nice areas
you think it looks polished? π
well yeah thats what i kinda aimed for
quick pvp mode
@vapid frigate nice thx. it really was the additional ";"
Hey just a quick question: Is it possible to send commands from inside Arma to somewhere else? Like a bridge to external tools?
yeh, via an extension (dll), or i guess via httpLoad to an extent
So it should be possible to send commands to a third-party tool like Overwolf or Logitech LED API?
right, totally forgot about them.
Nice, I was maybe planning to add Perkey-RGB-Keyboard support to Arma.
no idea about Roccats or Razer's API but Logitech should work fine.
you could probably do that pretty easily with existing extensions, without having to write your own
there's a nodejs rpc extension for arma 3 somewhere
if you're ok with javascript
bound to be node packages for overwolf/logitech/you name it
thats probably gonna take a while right?
doesn't look like it's been updated in a long time
so possible it won't happen at all
I'll reply to the forum, maybe I'll get an answer.
looks like it's open source
so you could probably copy the code into the 64 bit template and rebuild it
Oh right. I'll look into it when I'm done with my current projects I guess.
Thanks for your help guys!
another potential option is intercept.. it hooks back into arma so you can run script commands directly from other languages
but same issue.. hasn't been updated lately
@rancid ruin Sorry, too many projects. A-Levels this and next month, an App for Overwolf and two Websites.
maca134 did this too https://forums.bistudio.com/forums/topic/189099-arma-c-js-nodejs-extension-compile-on-the-fly/ and he's active here in discord
@brazen sparrow thanks! nice!
easiest way really would probably be to use the C# template for what u wanna do.. would just need to reference something like https://github.com/zzattack/Logitech-LCD and have a couple of lines of code to change the display
then you're not relying on anything else
@vapid frigate not LCD, LED
If you do this for yourself, then it would be way easier to just use JoyToKey. Arma already supports like 20+ of these XBOX keys and sticks and shoulder keys and whatever.
think he's talking about those keyboards which light up
he wants to get arma talking to the lights
Yeah. Just rebind them to the XBOX keys using joy to key and use that ingame.
guessing he actually means the LCD display on G15 etc.. which is probably a bit more complex
im active when im wake π
has anyone got arma talking to a rasperry pi yet? that's where most game/hardware mods end up right
hello. I need a scripter there will make som script to me. i will ofc pay you for the scripts. if you want then add me on steam. http://steamcommunity.com/id/TheBlackspot/
@bleak gazelle might try #creators_recruiting and generally speaking bringing money to modding is sucky move.
i will try
@vapid frigate Nope.... LED LIghting
anything I'm missing here? _magazines = (configFile >> "CfgWeapons" >> _x >> "magazines"); "Error Generic Error in expression"
@young current Because you get your breakfast for free right lol
People getting paid to do stuff is the most normal thing
@subtle ore _magazines = getArray (configFile >> "CfgWeapons" >> _x >> "magazines");
Since there are multiple types of mags for some weapons.
I wouldn't have noticed either lol. Only reason I knew it because I spent 10 minutes figuring that out last night.
Lol
@subtle ore your code threw an exception because you're basically asking for a config at "magazines" which is a array though
So it throws generic expression error
always gets a config
@tame portal I know, I was being dumb.
π
Is there a way to view a log of script errors being thrown clientside?
.rpt files are stored in the game directory yeah
as long as you don't have -noLogs as a launch parameter
Er, rather your documents area
C:\Users\YourUserName\Documents\Arma 3
Are there keybinds in the BIS_fnc_guiEditor or something?
There are shortcuts, not sure why you are calling the function if you have acess to the debug consoile or something?
True I suppose.
like CTRL + SHIFT + S saves your project, and CTRL + S you can define the export type etc
the wiki shows all the shortcuts
@subtle ore the issue is that script errors arent showing up in the logs. it's only displaying in the little black error box clientside
Does the command "BIS_fnc_selectRandom" consider the order of a array?π€
_wep = weaponsLoot call bis_fnc_selectRandom; hides
Oh and @rancid ruin What do you think is a generally good time for loot spawning to take?
can't remember exactly what my scripts took
it was a good few minutes for putting a weaponholder with stuff in every available position on about 50% of buildings on altis
i'll test them when i'm at my pc
I'll have to test altis real fast.
fuck stratis, go ham
Haha
altis or nothing
Fair enough. Leme run it real fast
so its not shuffle the array ?
you mean does it modify the array you pass to it?
selectRandom returns one element, selected randomly, from the array you pass it
Oh goodness this is a lot of loot.
selectRandom = select something Randomly
NOT
selectRandom = i shuffle the whole array and then select an random entry. Result will be a shuffled array.
example : [//Level 1 ["TRYK_U_denim_hood_nc",0.07], ["TRYK_U_denim_hood_mc",0.07], ["TRYK_U_hood_nc",0.07], ["TRYK_U_B_PCUGs_OD_R",0.07], ["TRYK_U_B_PCUGs_gry_R",0.07], ["TRYK_U_B_PCUGs_BLK",0.07], ["TRYK_U_B_PCUGs_OD",0.07] //Level2 ["TRYK_shirts_DENIM_RED2",0.15], ["TRYK_shirts_DENIM_ylb",0.15], ["TRYK_shirts_DENIM_ylb_Sleeve",0.15], ["TRYK_shirts_DENIM_R_Sleeve",0.15], ["TRYK_shirts_OD_PAD",0.15], ["TRYK_U_pad_hood_Blk",0.15], ["TRYK_U_pad_hood_Cl",0.15], ["TRYK_U_denim_jersey_blk",0.15], ["TRYK_U_denim_jersey_blu",0.15], ["TRYK_U_B_Denim_T_WH",0.15] ]
], ] no no
_array = [//Level 1
["TRYK_U_denim_hood_nc",0.07],
["TRYK_U_denim_hood_mc",0.07],
["TRYK_U_hood_nc",0.07],
["TRYK_U_B_PCUGs_OD_R",0.07],
["TRYK_U_B_PCUGs_gry_R",0.07],
["TRYK_U_B_PCUGs_BLK",0.07],
["TRYK_U_B_PCUGs_OD",0.07] //Level2 ["TRYK_shirts_DENIM_RED2",0.15],
["TRYK_shirts_DENIM_ylb",0.15],
["TRYK_shirts_DENIM_ylb_Sleeve",0.15],
["TRYK_shirts_DENIM_R_Sleeve",0.15],
["TRYK_shirts_OD_PAD",0.15],
["TRYK_U_pad_hood_Blk",0.15],
["TRYK_U_pad_hood_Cl",0.15],
["TRYK_U_denim_jersey_blk",0.15],
["TRYK_U_denim_jersey_blu",0.15],
["TRYK_U_B_Denim_T_WH",0.15]];
_random = selectRandom _array;
// _random is ["TRYK_U_pad_hood_Cl",0.15]
yea, but it will nit shuffle it, right ?
http://prntscr.com/ewxfck - Now, the waiting game.
_array will still be _array
k
if you want to select a "level 2" one or a "level 1" then have separate arrays for them
no its only for me to seperate these items of rare
@rancid ruin 402.487s to spawn 14391 loot piles around altis. http://prntscr.com/ewxhkr
nvm forget it
The interesting part is, there was only a 25% chance per loot spawn spot π
is that 14k weapon holders?
"might" ^^
Oh it did lol. I dropped 20 frames
I suggest a caching system or a dynamic loot spawn system where loot is only near players and everything that's not near players is cleaned up
Yeah. I created it on a grid like system. Basically, it just bases it on any markers you create via the editor. I suppose I could auto-generate them but I was just messing around. The system itself does detect players and what not.
https://github.com/DylanSMR/Arma-3-/blob/Loot-Spawning/lootSpawnAltis.Altis/handleZone.sqf - This file is what detects players and what not.
I like the dynamic simulation grid system. It's so cool
Just a q:
Why do you cycle through all zones and check in each zone, if there is player in it?
Why not make it the other way around -> Check every player in wich zone he is -> Set those to a "blacklist" -> Cycle through all zones -> If not in _Blacklist array -> Delete everything inside it.
(at least, thats how i did it)
(Y)
boobs
π€¦ Enough spam π Let Dylan answer
Would it make a performance different? You would think looping through 3 zones might be a bit better then looping through 40 players π
Just reread what you wrote there π
You currently check 3x 40 Players
instead of
1x 40 -> then zones
To be fair I was writing this at 4 in the morning π
No excuse!!!
+one hint: Why do you execVM everything?! oO
make a function of that stuff, you use it more than once
Doesn't matter, even then.
For Deving/Testing
my_fnc_Function = {MyCode};
blabla
call my_fnc_Function;
Indeed. Im gonna keep using the excuse I was up at 4 in the morning π
I mean, its your code. Do what you want, i just mentioned what I think is bullcrap^^
(Advantage of having the code directly in it -> Only one file open π )
Very true.
Anyway, just some ideas from my side =} gl hfwith it
Oh I sure will. It was just a project to have fun with.
Thats how i always started. "oh, this could be fun".
2 month later: "Why did i started doing that anyway? fk it"
Indeed. Sounds like most projects I start haha
anyone knows a documentation of supported elements for RscHTML?
Biki
Alternativ is the full mil sim wiki of vb
Most of the stuff also applies to the rv engine and arma 3
Wait whaaaatt..forgetTarget is actually a real command?
Wouldn't reveal 0 work as forget?
reveal only updates if the revealAmount is higher than the already present amount
knowledge value*
When you realize you were posting in the server admins channel and not scripting, π€¦
_worldSize = if (isNumber (configfile >> "CfgWorlds" >> worldName >> "mapSize")) then {getNumber (configfile >> "CfgWorlds" >> worldName >> "mapSize");} else {8192;}; is this the best way to get the map size?
or _worldSize = worldSize; ?
What about maps without worldSizes? From what I read about VR doesn't have one. Stratis seems to not have one either(hence having the else 8192)
Yeah I know. I realised that π - Any other maps with that known size? Im having to make sure it adapts to custom maps.
i doubt there'd be any recent ones at least.. not sure if worldSize will fall back for older maps properly
guessing it would
you could just say it adapts to 'correctly configured custom maps' π
or add if (_worldSize == 0) then { _worldSize = 8192 };
assuming it's 0 if it doesn't work
most the posts talking about issues were before that command existed too (July 2015)
@vapid frigate Either way, works like a charm π - http://prntscr.com/ex0380
// Ammunition for others
_id = [
/* 0 object */ player,
/* 1 action title */ "Replenish Ammunition",
/* 2 idle icon */ "pictures\machinegunner.paa",
/* 3 progress icon */ "pictures\machinegunner.paa",
/* 4 condition to show */ "cl_classPerk == 'ammo' && (cursorObject distance _this) < 5 && alive cursorObject && !(cursorObject getVariable ['ammo_restored',false]) && (side cursorObject) == playerSide && (cursorObject isKindOf 'Man')",
/* 5 condition for action */ "!(cursorObject getVariable ['ammo_restored',false])",
/* 6 code executed on start */ {cl_lastActionTarget = cursorObject;},
/* 7 code executed per tick */ {},
/* 8 code executed on completion */ _mg_code,
/* 9 code executed on interruption */ {},
/* 10 arguments */ [],
/* 11 action duration */ 1,
/* 12 priority */ 500,
/* 13 remove on completion */ false,
/* 14 show unconscious */ false
] call BIS_fnc_holdActionAdd;
cl_actionIDs pushBack _id;
This allows a player to replenish another player's ammo. How do I change the 0 Object from Player to Emplacement so I can replenish an emplacement's ammo with the same script?
if it refils the other players' ammo, it's probably not 'player' you want to change
might just need to remove && (cursorObject isKindOf 'Man') or change it to a more suitable one
player is the local player (the one doing the action)
Man. I didnt realize how big altis was until I switched my new loot spawning scripts over to it. Took like 5x longer to generate all possible loot zones π
perfect was able to solve it! (I hadn't scrolled to the right to see the isKindOf checks
@jovial ivy I already took a look ;)
At the previous file? Or the one I just linked.
The one you linked yesterday
Oh. The one I just linked is a lot different. The one i linked yesterday was just a one or two zone thing. This one automatically creates zones for any map.
Probably. Its more fun my way π
Lol ;). I was wondering because I want to do a massive dynamic object spawning grid based.
Also I could make it work with hideObject to win those 3 frames
Mine basically uses the grid system. It just replicates it.
I don't think so, why would it?
hey guys, can someone help me with the inplementation of a gunshot? is have this execution sceen set up:
victim disableAI "MOVE"; victim setDir (getDir executioner); victim setPos (executioner modelToWorld [0,0,0]); victim switchmove "Acts_ExecutionVictim_Loop"; executioner switchmove "Acts_Executioner_StandingLoop"; sleep 11.7; executioner switchmove "Acts_Executioner_Forehand"; victim switchmove "Acts_ExecutionVictim_Forehand"; executioner playMove "Acts_Executioner_Backhand"; victim playMove "Acts_ExecutionVictim_Backhand"; executioner playMove "Acts_Executioner_Kill"; //gunshot here! victim playMove "Acts_ExecutionVictim_Kill"; executioner playMove "Acts_Executioner_Kill_End"; victim playMove "Acts_ExecutionVictim_Kill_End"; victim playMove "Acts_ExecutionVictim_KillTerminal"; //victim enableSimulationGlobal false;
because I have some script in init.sqf that executes only on server
and on dedi it executes after briefing
I also use spawn to delay it a bit
maybe spawn causes this
honestly I want it to be executed in-game only and that behaviour pleases me
but I wonder why
Maybe. You could debug with some diag_log
time doesn't pass during briefing, so maybe you have a sleep that gets suspended until the mission starts and time becomes > 0
yeah i have sleep
thanks for the explanation
does getClientState on dedi return dedicated server state or clients game state?
getClientState(Number) isn't really something you need imo
I used it in local MP scripts to suspend until in-game
I wanted my own timer to start after briefing
but as you said about sleep
I could use sleep 1 and it will work same as getClientState > 9
with 1 second extra delay
How do I use eachFrame EH? I've tried to get it to work without result
^
["someId", "onEachFrame", {
hintSilent format["%1 (%2)", _this, diag_tickTime];
}, "Hello world!"] call BIS_fnc_addStackedEventHandler;
Use hint instead for maximum ear rape
@tender fossil
Use addMissionEventhandler https://community.bistudio.com/wiki/addMissionEventHandler
Available events: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler
@rugged basalt
How about uiSleep?
getClientState is nice to check if briefing is shown (I personally add some entries with code tags to the diary where an admin can load mission progress from a SQL database before the mission actually starts...)
Thanks again! π
@bright coral thanks for input but how it's related to my question about getClientState on dedi?
Is there something like an eventhandler for unit behavior, for example when a unit enters COMBAT state?
if no, would it be good to check behaviour every ~10s through onEachFrame EH?
@tough abyss It is never too late
Come on dude
They plan to support Arma for at least 2 years
They probably could add EH
Well you can edit the FSMs yourself and add an 'event' but anyway
It is not hard
does soneone know if the locality eh will fire if it is attached to a map lying on the ground and being picked up by a player?
@bright coral it's good behaviour for me because I need script to be started in-game only (it's bomb)
ok with inventory objects a trigger with !alive bla worls fine
Looking through ACE functions, I'm having trouble finding how to break a wheel reliably in multiplayer. Can anyone point me in the right direction?
I'm using setHitIndex to set everything except HitHull to full damage, but another player still sees wheels intact and can drive it.
You need to execute the command on the machine where the vehicle is local. Has nothing to do with ACE.
ah, I'll look at where it's running. thanks.
@little eagle Is there anyway to disable ACE medical completely from in the mission file without removing the medical pbos?
No.
I like it personally, just wanted to add the option to disable for people that don't want to use it.
Well there is no ingame option to disable it, because it relies on config changes that cannot be changed on the fly without moving around files.
debug console in VA
That's just the extended debug console of CBA
prev and next button too
No.
CTRL + A - Backspace
^ tbqh
- Focus click
Yes.
Why wouldn't it work? @tough abyss
Focus is automatically set to the edit box.
Not if you exec the script or if you type in another box
ctrl + a, not ctrl + s
No it isn't. Ctrl a + backspace lmao
You using RscDisplayDebugPublic?
@little eagle +1
π€¦ π€¦ π€¦ π€¦ π€¦ π€¦
Then of course that is the reason
lmao
lol
π€¦
π€¦
If you don't mind me asking, what debug console are you using @tough abyss? Please do not tell me you are using infistars
One you made yourself?
Can I see?`
Also, if you want Ctrl + A to work, maybe copying RscEdit from config in ui_f in Addons will work
But then again, I'm not sure if that has anything to do with it
I think ctrl + A only works in ST_MULTI edit boxes.
^^ might be
class CA_Version: RscEdit
{
style="0x01 + 0x200";
y="1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 20) + safezoneY";
font="EtelkaMonospacePro";
idc=12146;
x="25.5 * ( ((safezoneW / safezoneH) min 1.2) / 32) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
w="5.5 * ( ((safezoneW / safezoneH) min 1.2) / 32)";
h="1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 20)";
sizeEx="0.55 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 20)";
};
class CA_Player: RscEdit
{
style=512;
font="RobotoCondensedBold";
y="1.25 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 20) + safezoneY";
idc=12145;
x="18.5 * ( ((safezoneW / safezoneH) min 1.2) / 32) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
w="7 * ( ((safezoneW / safezoneH) min 1.2) / 32)";
h="0.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 20)";
sizeEx="0.55 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 20)";
};
class RscEdit
{
style="0x00 + 0x40";
font="RobotoCondensed";
shadow=2;
sizeEx="( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
colorBackground[]={0,0,0,0};
colorText[]={0.94999999,0.94999999,0.94999999,1};
colorDisabled[]={1,1,1,0.25};
colorSelection[]=
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",
1
};
canModify=1;
tooltipColorText[]={1,1,1,1};
tooltipColorBox[]={1,1,1,1};
tooltipColorShade[]={0,0,0,0.64999998};
};```
Thats for the RscDisplayDebugPublic
0x40 is ST_MULTI iirc
```cpp
config
```
#define ST_MULTI 16
#define ST_NO_RECT 0x200 // this style works for CT_STATIC in conjunction with ST_MULTI
@little eagle
Haha not too sure π
Why would you use that instead of RscDisplayDebugPublic?
Okay, so how do you execute this code then?
A function which is not compiled final?
Fair enough
["whateveriwannado"] remoteExec ["QS_fnc_call", 2];?
Rx = remoteexec?
so what i wrote above?
And how do you check for errors?
if theres no errors it executes wherever
server rpt
Yes, but I assume he meant if there is no errors it executes wherever, do you mean just that the engine won't run it if there is an error?
Execution just stops when there is an error encountered and if there is an error during compile, the command reports {} I think.
Yes, I know that, but when he said that it sounded like he had some own kind of thing to check that
Yes, QS has secret tools everyone desperately wants and he's not sharing.
Didn't mean that, but okay ^
π€£
oh try block
How can it be almost useless?
just change ctrl properties to make it work
Just add a button that does ctrlSetText ""
I thought you made that yourself? Why not add it yourself.
is there something like a radius command? I have a truck with addAction and want to kill units within a radius of lets say 15 meters around the truck when the addAction is triggered
hmm inArea seems good
nearObjects / nearestObjects would work.
Yeah, nearEntities sounds more usefull for that
@jade abyss https://github.com/DylanSMR/Arma-3-/blob/Loot-Spawning/lootSpawnMechanics.Stratis/LootSpawning.sqf#L83-L117 - Better in your opinion?
So, allPlayers inAreaArray "marker";
Yeah. Plus wouldn't allPlayers have to loop through more technically? (as you said yesterday) - As it has to loop through like 100+ zones
erm, okay?
And for the next time, we will learn, that
if(!(_x in _zoneBlacklist)) then
{
};```
is better than
```sqf
if(!(_x in _zoneBlacklist)) then {
};```
No no no π
wrong
My brackets can be wherever they so please. π
"I talked them, they want in the nextline. They don't feel well in the same line"
"Its a fact"
Lies.
nono, i said "its a fact" behind it. So its true.
How about. if(!(_x in _zoneBlacklist)) then { //Super long code is here};
For ppl like you, there is a special place in hell.
Haha
if(count(missionNamespace getVariable Format["%1_zone_holders", _x]) == 0) exitWith { _x call Loot_StartZone; };
``` Hue hue hue
Oh I wanted to ask. What was the way to get the nearest spawnable position for say a vehicle?
15:34:39 Error in expression <"_target", "_caller", "_id", "_args"];
_args params ["_device"];
KI_fnc_devic>
15:34:39 Error position: <_args params ["_device"];
KI_fnc_devic>
15:34:39 Error Undefined variable in expression: _args
15:34:39 File C:\Users\Aebian\Documents\Arma 3\missions\[A]_Cuda.Woodland_ACR\itsAebian\tDevice.sqf, line 14
/*
author: @Aebian
description: none
returns: nothing
// _null = [HEMTTA4, SOBJ] execVM "itsAebian\device.sqf";
*/
params["_vehicle", "_object"];
_null = _vehicle addAction ["Trigger Device",KI_fnc_device,_object];
params ["_target", "_caller", "_id", "_args"];
_args params ["_device"];
KI_fnc_device = {
{ _x setDamage 1; } forEach ( _device nearEntities ["Man", 10]);
};``` any ideas? shouldn't that work?
well, no, _args is nowhere defined
^^^
as in, that second params is unlogical
no new arguments, and _this is documented to be only 2 long
https://community.bistudio.com/wiki/addAction there I can pass arguments trough it
if I just pass 1 I could use select 3
yea but thats outside of the addAction command
all those arguments are passed into KI_fnc_device
you've only added the command there
Also, KI_fnc_device is defined after the addaction is used. Will that cause an issue?
it probably does, since it'll point at a NIL value
can arrays contain nil?
Yes, b ut you cannot use local variables
undefined local variables in scheduled environment
mhm. but yea looks like that function needs to be defined ealier and the two params bits should actually be inside that function instead of outside it
Wouldn't this accomplish what you want?
/*
author: @Aebian
description: none
returns: nothing
// _null = [HEMTTA4, SOBJ] execVM "itsAebian\device.sqf";
*/
KI_fnc_device = {
_device = _this select 0;
{ _x setDamage 1; } forEach ( _device nearEntities ["Man", 10]);
};
params["_vehicle", "_object"];
_null = _vehicle addAction ["Trigger Device", { [] spawn KI_fnc_device; }, _object];
device is select 3 as the other ones are reserved for target caller and id
but that would also work if I would just pass one argument along
@tough abyss ^
When I reverse "_revDummy", it also affects "dummy". Any idea how I could prevent this?
ARM_fnc_addDummy = {
dummy pushBackUnique _this;
private _revDummy = dummy; reverse _revDummy;
hint str(dummy);
};
"1" call ARM_fnc_addDummy; // ["1"] dummy === _revDummy
"2" call ARM_fnc_addDummy; // ["2","1"] dummy === _revDummy
"3" call ARM_fnc_addDummy; // ["3","1","2"] dummy === _revDummy```
Use smart things, not dummies.
Ahh thanks, never noticed that SQF uses pointers (thought it's always copy) o.O. Then my problem is quickly solved. Does this only apply to arrays or also other types?
Only applies to arrays.
Well.
_player = player;
_unit = _player
_unit and _player also point to the same thing.
But doesn't apply to numbers or strings or bools.
Quick question here. I had been taking a look at the addScriptedEventHandler function. I was wondering if I did something like "arsenalClosed" would it be local to the player who closed the arsenal or the box that was closed? Or neither? ex: [missionNamespace, "arsenalClosed", {hint "Hello World"}] call BIS_fnc_addScriptedEventHandler;
It would only execute on the machine where the eventhandler was added and only if the arsenal was closed on the local machine.
Okay, that makes sense. So if I were to do [myArsenalBox, "event", {hint "Hello World"}] call BIS_fnc_addScriptedEventHandler; it'd be local to the arsenal then?
"event" would have to a valid event and whether or not this works with myArsenalBox instead of missionNamespace I can check in a moment...
Right, I copied the example. I understand there are different types.
Nope it would not.
This is where the event is called and it's only called on the mission namespace, not the current arsenal box objects namespace.
so either way, the box would exist in the missionNamespace is what you're saying?
No, the event is called with the missionNamespace. First argument in BIS_fnc_callScriptedEventHandler.
So only scripted eventhandlers attached to the mission namespace are used.
Other ones are nowhere used and therefore doing:
[myArsenalBox, "event", {hint "Hello World"}] call BIS_fnc_addScriptedEventHandler;
would never be executed.
And it doesn't look like the currently used object is passed as argument, so you're out of luck.
Wow, well then.
can someone give me an example how to proceed with conditions? I tried:
_null = _vehicle addAction ["Trigger Device",KI_fnc_device,_object,"","","","",{vehicle player isEqualTo _vehicle}];```
and
```sqf
_null = _vehicle addAction ["Trigger Device",KI_fnc_device,_object,"","","","","vehicle player isEqualTo _vehicle"];``` the first one says that he needs a string the second one request a bool.
I also tried:
```sqf
_null = _vehicle addAction ["Trigger Device",KI_fnc_device,_object,"","","","","{vehicle player isEqualTo _vehicle}"];```
()
I tried that also let me check again
Not all the parameters are strings either @hollow lantern
@dusk sage damn I see
"vehicle player isEqualTo _vehicle"
is correct
{vehicle player isEqualTo _vehicle} call ace_common_fnc_codeToString
would work too.
π€
That late already?
hmm yeah as I use ACE. sqf _null = _vehicle addAction ["Trigger Device",KI_fnc_device,_object,2,true,false,"","vehicle player isEqualTo _vehicle"]; according to the wiki it should work but its still telling me type bool expected string hmmmmm
/*
author: @Aebian
description: none
returns: nothing
// _null = [HEMTTA4, SOBJ] execVM "itsAebian\device.sqf";
*/
KI_fnc_device = {
params ["_target", "_caller", "_id", "_args"];
_args params ["_device"];
{ _x setDamage 1; } forEach ( _device nearEntities ["Man", 10]);
};
params["_vehicle", "_object"];
_null = _vehicle addAction ["Trigger Device",KI_fnc_device,_object,2,true,false,"","vehicle player isEqualTo _vehicle"];```
its defined
4th one is priority and on your example it's the third one which should be "arguments" (ANY)
without the condition it works
No, it doesn't.
_vehicle is undefined inside the condition scope and your arguments of addAction are wrong.
Also _null = does nothing
I removed everything after the _object and my addAction works...
Yes, because the third parameter is missing.
So if you delete everything, but the first two, it will obviously work
[title, script, arguments, priority, showWindow, hideOnUse, shortcut, condition]
_null = _vehicle addAction ["Trigger Device",KI_fnc_device,_object];```
that works
["Trigger Device",KI_fnc_device,_object ??????? ,2,true,false,"","vehicle player isEqualTo _vehicle"]
that works
Yes, because the third parameter is missing.
So if you delete everything, but the first two, it will obviously work
just because the priority thing (3rd param) is missing? lol .... lol okay I'll check
_null = _vehicle addAction ["Trigger Device",KI_fnc_device,_object,2,true,false,"","vehicle player isEqualTo _vehicle"];```
β makes no sense
No, that has nothing to do with that.
_null = _vehicle addAction [ <-- that, Why?
Also
params ["_target", "_caller", "_id", "_args"];
_args params ["_device"];
...
params["_vehicle", "_object"];
Why two params???
oO
but I don't get why my _vehicle gets the addAction if I just use sqf _null = _vehicle addAction ["Trigger Device",KI_fnc_device,_object]; I mean _vehicle there seems to be defined
The _vehicle in "vehicle player isEqualTo _vehicle" is undefined
The _vehicle in _vehicle addAction is defined...
so I can't use them there hmm okay
No, you need to pass every local variable as argument.
because that condition is executed every frame or with whatever delay and local variables only exist in their scope. And the condition is a completely different instance.
OR make the local Var "_vehicle" in the addAction to a global one (e.g. MyTag_vehicle)
Quick question here, I'm having a hard time finding a base class for facewear. Ideas?
The base class is called None for almost all of them.
Searching: "class classnameYouSearch:"
π
Ah ha.
Totalcmd ftw
hm, who likes it can use it. I don't/won't. Personal opinion.
yeah
@hollow lantern Use _target instead of _vehicle, or use the new radius param
"_this in _target"
20:56:06 Error in expression <
_object = _this select 0;
_object setVariable ["hitTimes", 0];
_hits = _ob>
20:56:06 Error position: <setVariable ["hitTimes", 0];
_hits = _ob>
20:56:06 Error setvariable: Type Array, expected Namespace,Object,Group,Display (dialog),Control,Team member,Task,Location
20:56:07 Error in expression <
_object = _this select 0;
_object setVariable ["hitTimes", 0];
_hits = _ob>
20:56:07 Error position: <setVariable ["hitTimes", 0];
_hits = _ob>
20:56:07 Error setvariable: Type Array, expected Namespace,Object,Group,Display (dialog),Control,Team member,Task,Location
according to the wiki my setVariable and get Variable should work. I tried this:
_obj addEventHandler ["HitPart", {
_object = _this select 0;
_hits = _object getVariable "hitTimes";
if(isNil "_hits") exitWith { _object setVariable ["hitTimes", 1]; };
if(_hits == 1) exitWith {
for "_i" from 1 to 2 do {
createVehicle ["Bo_GBU12_LGB",[(getPos _obj select 0)+ (_i*cos (_i*17.5)),(getPos _obj select 1)+ (_i*sin (_i*17.5)),0],[],0,"CAN_COLLIDE"];
};
_object setVariable ["hitTimes", 0];
};
_object setVariable ["hitTimes", (_hits + 1)];
}];``` But that looks fine in my eyes
looks too flat to me
{
i
dont
know
what
you
mean
}
you're using _obj in createvehicle, but it doesn't exist there @hollow lantern
- pls learn to use TAB π
hmm I tried to change that in intelij but he reverted and removed all tabs so yeah I need to fix that
hmm I could use _object I see
doesn't work either,
_obj addEventHandler ["HitPart", {
_object = _this select 0;
_hits = _object getVariable "hitTimes";
if(isNil "_hits") exitWith { _object setVariable ["hitTimes", 1]; };
if(_hits == 1) exitWith
{
for "_i" from 1 to 2 do
{
createVehicle ["Bo_GBU12_LGB",[(getPos _object select 0)+ (_i*cos (_i*17.5)),(getPos _object select 1)+ (_i*sin (_i*17.5)),0],[],0,"CAN_COLLIDE"];
};
_object setVariable ["hitTimes", 0];
};
_object setVariable ["hitTimes", (_hits + 1)];
}];```
no errors?
of course, the one above
21:32:41 Error position: <getVariable "hitTimes";
if(isNil "_hits">
21:32:41 Error getvariable: Type Array, expected Namespace,Object,Group,Display (dialog),Control,Team member,Task,Location
21:39:50 Error in expression <bject = _this select 0;
_hits = _object getVariable "hitTimes";
if(isNil "_hits">
21:39:50 Error position: <getVariable "hitTimes";
if(isNil "_hits">
21:39:50 Error getvariable: Type Array, expected Namespace,Object,Group,Display (dialog),Control,Team member,Task,Location
21:39:52 Error in expression <bject = _this select 0;
_hits = _object getVariable "hitTimes";
if(isNil "_hits">
21:39:52 Error position: <getVariable "hitTimes";
if(isNil "_hits">
21:39:52 Error getvariable: Type Array, expected Namespace,Object,Group,Display (dialog),Control,Team member,Task,Location
21:43:12 Error in expression <bject = _this select 0;
_hits = _object getVariable "hitTimes";
if(isNil "_hits">
21:43:12 Error position: <getVariable "hitTimes";
if(isNil "_hits">
21:43:12 Error getvariable: Type Array, expected Namespace,Object,Group,Display (dialog),Control,Team member,Task,Location
21:43:12 Error in expression <bject = _this select 0;
_hits = _object getVariable "hitTimes";
if(isNil "_hits">
21:43:12 Error position: <getVariable "hitTimes";
if(isNil "_hits">
21:43:12 Error getvariable: Type Array, expected Namespace,Object,Group,Display (dialog),Control,Team member,Task,Location
21:43:13 Error in expression <bject = _this select 0;
_hits = _object getVariable "hitTimes";
if(isNil "_hits">
21:43:13 Error position: <getVariable "hitTimes";
if(isNil "_hits">
21:43:13 Error getvariable: Type Array, expected Namespace,Object,Group,Display (dialog),Control,Team member,Task,Location
21:43:30 Error in expression <bject = _this select 0;
_hits = _object getVariable "hitTimes";
once is enough π
looks like for some reason it thinks _object is an array, not object
the biki says ```This EH returns array of sub-arrays [[...],[...],...[...]]. Each sub-array contains data for the part that was hit as usually multiple parts are hit at the same time (see HitPart_Sample).
so SQF _obj addEventHandler ["HitPart", { { _object = _x select 0; _hits = _object getVariable "hitTimes"; if(isNil "_hits") exitWith { _object setVariable ["hitTimes", 1]; }; if(_hits == 1) exitWith { for "_i" from 1 to 2 do { createVehicle ["Bo_GBU12_LGB",[(getPos _object select 0)+ (_i*cos (_i*17.5)),(getPos _object select 1)+ (_i*sin (_i*17.5)),0],[],0,"CAN_COLLIDE"]; }; _object setVariable ["hitTimes", 0]; }; _object setVariable ["hitTimes", (_hits + 1)]; } foreach _this; }];
or SQF _obj addEventHandler ["HitPart", { _object = _this select 0 select 0; _hits = _object getVariable "hitTimes"; if(isNil "_hits") exitWith { _object setVariable ["hitTimes", 1]; }; if(_hits == 1) exitWith { for "_i" from 1 to 2 do { createVehicle ["Bo_GBU12_LGB",[(getPos _object select 0)+ (_i*cos (_i*17.5)),(getPos _object select 1)+ (_i*sin (_i*17.5)),0],[],0,"CAN_COLLIDE"]; }; _object setVariable ["hitTimes", 0]; }; _object setVariable ["hitTimes", (_hits + 1)]; }];
depending on whether you want one for each hitpart, or 1 for the hit overall
well the object just needs two hits to explode so I guess the second approach will do it. Thanks!
can I pass a local variable of a script to an EventHandler somehow?
put it into a global variable.. Or you can compile format it if your variable is a number or string