#arma3_scripting
1 messages · Page 375 of 1
condition (Optional): String - script code that must return true for the action to be shown. Special variables passed to the script code are _target (object to which action is attached to) and _this (caller/executing person). Default value: "true"
instead of those nasty if statements.
I wish the wiki had an example with all the (default) parameters so you could copy paste them.
How do I produce a script that makes if (side player == west) then {car1 addAction ["Impound Vehicle", {deleteVehicle car1}];};
dynamic for all vehicles?
It only has examples with like the first 3 parameters.
drops to floor in defeat
Don't you have to be 16 to play this game or something like that?
playerSide defaults to west for JIP players early on during initialization regardless of their side.
I hate this game.
@little eagle Im learning how to script, I am actually 16 :p
just use postInit.... oh wait
Sorry for facepalming you
alganthe, one day
car1 addAction["Impound Vehicle",
{
},[],1.5,true,true,"","side _this isEqualTo west",15,false,""];
all default params
lgtm, but maybe side group _this, because renegades.
🤔 Why? Just .... why.
Renegades.
Yeah. Why, Commy.
I said "maybe".
Better mention it than having people be confused later why it won't work.
Maybe BI should model the Enfusion AI to fit commy's overthinking layout.
or the player side is just civ, since, you know, looks like it's for "life" stuff
I hate FSM's ever since they taught me what they were.
arma FSMs are stupid
FSM is a lie
Are we still talking about the sqf thing or about the noodle monster?
i think we're onto the noodle monster
This is quite revealing Commy, I bet you use execVM when no one is looking.
Scheduled ✔
🍿
scheduler
scheduler can go die in a fire, same for scheduled loading screens
sure 🤝
Might as well use sqs.
no plz
they do for startup logos
Thanks Cloud, 🍿 🍹
and the first loading screen
wow what a jem, SQS
it chokes on itself and ruins fps
they fucked it up
arma and fps? is it 2035 yet?
Hey Cloud, watch your mouth young man
sorry
now if they could add back empty groups to the garbage manager that'd be nice, flagging for deletion is getting old, contrary would be better.
Doesn't it? 🤔
Sort of reminds me of Xeno's domination in a3 comparibly to a2.
advanced ballistics or medical in scheduled would be a fun comparison
hey just because you like your swirly icons at a blistering 2,000 fps doesn't mean it's okay alganthe
It wouldn't work. But having it converted to scheduled by someone who has no idea what he's doing wouldn't work out either for that mission.
The idea is to have as little SQF run at any time. If you just do all the loops in unscheduled, you achieve nothing. But Quiksilver already said that he's not interested in honesty and is just trolling so w/e.
He can't stop himself. The worst kind of triggered troll there is.
The politics channel is even worse, but we don't speak of that here.
I value honesty over a feigned politeness, so someone had to say it, Quiksilver.
I have all channels muted except dev announcements, general chat and scripting
#arma3_terrain is worth checking sometimes, for cool shots of maps and to see some confused people
Or just a deposit of Bulldozer/TB crashes and control issues
of all the tools we have bulldozer is quite good
Both are fairly entertaining
Is there a way in a init.sqf to do a addAction for all vehicles present in the mission?
yes but it will cost you
I like TexView or whatever it's called these days.
yep, same
It's real quick to open. A no bs tool.
object builder can go die in a fire, enforce tools next to it are godlike
@subtle ore so just vehicles addAction etc etc... ?
Enforce is still using Oxygen 2 iirc
in the init?
Is there a way in a init.sqf to do a addAction for all vehicles present in the mission?
Not without CBA there isn't.
I have CBA
Good. wait
vehicles probably returns an array of vehicles, then you can loop over that
jesus christ, way to pull the cba card so quickly
// init.sqf
["Car", "init", {
params ["_car"];
_car addAction [...];
}, nil, nil, true] call CBA_fnc_addClassEventHandler;
Ewwwww.
Well, maybe he wants to spawn cars mid mission?
Why not use this instead of reinventing the wheel every time. He already said he has it.
what eew? also, no tag in that EH?
@little eagle Thanks 😄
Commy is just jealous
Of what? Sorry I may have missed some messages while typing the script.
/s
OK. The day BI adds entityCreated, I'll never use this function. Happy?
but if i do```["Car", "init", {
params ["_car"];
_car addAction ["Impound Vehicle", {deleteVehicle _car}];};
}, nil, nil, true] call CBA_fnc_addClassEventHandler;``` wouldnt it delete all vehicles?
Or not
Change
{deleteVehicle car1}
to
{deleteVehicle (_this select 0)}
So it deletes the vehicle the action is attached to.
you guys are helping to make a life mod here and you didn't even know it
i can see the bigger picture
I never said I have a problem with that.
Shit I really should ask for money for this.
@little eagle I love you
No, don't give him any money. He'll just start a monopoly
monopoly
Everyone would flock to me for my mad sqf skillz?
All those untaxed transactions. oof
Yep, your madz skillz would attract all from far and wide
@little eagle https://gyazo.com/bb386621daafaf285645321001fc9267
Your sister country Austria called, they want your SQF skills.
just make sure all the headers are
made by commy2
That's all part of the package plan 1 aglanthe, number two requires no header names.
```hint "put a sound" and ["safe","assigned",true] call BIS_fnc_taskSetState````
_car addAction ["Impound Vehicle", {deleteVehicle _car}];};
you wouldn't get the reference midnight 😄
what is the generic error?
@lone glade Fill me in kool kid
_car addAction ["Impound Vehicle", {deleteVehicle _car}];};
Delete the};at the end. Doesn't belong there.
Wtf is that Roque
AND / && are for condition blocks
stuff
and and &&
remove it and put a semicolon, there fixed
comma*
coma
some one remember the key to make the editor swich back the keyboard configuration? this is driving me nuts
@little eagle Whats the exact code should I put in?
that's a windows thing, it's switching between installed keyboard layouts
params ["_car"];
_car addAction ["Impound Vehicle", {deleteVehicle _car}];};
}, nil, nil, true] call CBA_fnc_addClassEventHandler;``` I have that but its not working.
I changed it myself, but it should be shift alt or shift + something
Change this line:
_car addAction ["Impound Vehicle", {deleteVehicle _car}];};
to
_car addAction ["Impound Vehicle", {deleteVehicle (_this select 0)}];
The }; at the end is too much.
Yes.
@little eagle That is using cursorTarget no?
yes, can't remember where tho
No, (_this select 0) is always the object the action belongs to.
So it will always delete whatever car it was without having to add any names to it.
if you remember plz pm me
@little eagle ```["Car", "init", {
params ["_car"];
if (PlayerSide == west) then {_car addAction ["Impound Vehicle", {deleteVehicle (_this select 0)}}];
}, nil, nil, true] call CBA_fnc_addClassEventHandler;``` Ive added a little bit of something to it, will it work?
how do I set the brackets?
if (PlayerSide == west) then {
_car addAction ["Impound Vehicle", {deleteVehicle (_this select 0)}];
};
The then block brackets have to encapsulate the whole line.
```sqf
player addWeapon blah
```
For colored code.
Ewwwwwww...wtf.
Like, literally I just posted all the default params above, copy and pasting is pretty easy
¯_(ツ)_/¯
@little eagle read dm
I don't have a paypal (anymore) and I don't need it. But thanks.
I do rich old women for my income tbqh.
pimpin'
ah! I knew it!
one for each hand
because you added it twice
No i didnt
params ["_car"];
if (PlayerSide == west) then {
_car addAction ["Impound Vehicle", {deleteVehicle (_this select 0)}];
};
}, nil, nil, true] call CBA_fnc_addClassEventHandler;```
that's the EH, where do you call it
Change the name to "Impound Vehicle 2" to make sure.
Okay
If there's another one, but with the old name, then you must've forgotten it somewhere.
@little eagle Okay thats odd, I am using the exact mission folder and putting it in to my dedi... and it i did change it to Impound Vehicle 2 and im still getting 2 actions.
when i put it in my local desktop it only shows one
They're both named Impound Vehicle 2, right?
["Car", "init", {
params ["_car"];
if (playerSide == west && isNil {_car getVariable "commy_hasAction"}) then {
_car setVariable ["commy_hasAction", true];
_car addAction ["Impound Vehicle", {deleteVehicle (_this select 0)}];
};
}, nil, nil, true] call CBA_fnc_addClassEventHandler;
why's it called a class event handler if you gotta check each time whether it's had the EH added or not
Yes.
race conditions.
Blame pabst. He made that retroactive flag. I'd just put it into preInit, but why explain the long way.
Thanks
It is fixed :d
@little eagle Sorry for being greedy, is there a way to delete the action under the condition player is not in a vehicle?
Delete the action if player is in a vehicle
@tough abyss Yup
addAction ["action name", {
}, nil, 1.5, true, true, "", "_this in _target"];
This essentially.
Yeah, that'd work, especially now that you have to be inside the vehicle.
No need for cursorTarget
Guess the bad thing is that it checks to condition every frame.
"classname" addAction
if I had any say in this.
¯_(ツ)_/¯
I saw a video.
4 years building enfusion*
Access was indeed early.
The animation blending doesn't look too impressive, but maybe it feels better controlling the guy now. Can't really tell that from a video.
I was more excited that they finally ditched the shitty system we have now in arma
dayz modding could be cool as fuck once all the systems are in place
would be more suited for certain missions than arma, and vice versa, but i'm interested
probably yes, the game isn't fun yet but the tech is coming along
well, let's check steam stats shall we?
it's quite good tbh
arma 3 is about 16K average
then don't buy it, have you seen the "buy" page on steam?
there's warnings absolutely everywhere
Arma 3 way of early release was fine.
But who will play DayZ once it's actually 1.0 "finished".
By then all interest is lost.
Depends how much modding support / stable it is when they release the modding tools & server files (apparently during the beta sometime).
@tough abyss yeh, if modding allows proper reskinning etc., I'm sure many will be interested in playing a seasonal or just winter Chernarus. I think I would.
another thing - I'd like to them to release a completely new map and maybe incentivize its exploration by never providing a full detailed map to the player, so the player can only find cop-outs and even by collecting them all the map image will never be completed and you'll have to memorize some parts by yourself.
i like that idea but someone would just put a web map up eventually and everyone would use that
that's true, having a web map in this case would bring lots of traffic to the website, but I guess some would just prefer to play it hardcore mode. I have a group of 4 people and we've talked this through and we'd very interested in playing on a map which is not 100% known and may never will be, if you don't "cheat"
it'd be an interesting experience to connect the drawn parts inbetween with what you've memorized yourself
can some one put a note on this page saying that the enginner cannot defuse explosives and only the explosiveSpecialist?
explosiveSpecialist required iirc
scratch that, engineers can defuse too
I added a note on there in case of confusion I guess
explosives not mines
enginner cannot remove explosives like C4
i am using RHS charge packs
im gonna test this with vanila assets
explosiveSpecialists and engineers can defuses IEDs and Explosive charges like satchel charges and boudning mines
However
IEDS don't seem to be able to be defused by anyone
positive man
Err..
wtf
so without setting traits..
i can defuse
but if I force it to false
then it doesn't do anything
wtf
i put more images
@astral tendon Alright, thanks for that. i'll change the note.
maybe that sohuld get a ticket too, i dont think it is supouse to work that way.
@astral tendon Maybe, maybe not. But as it stands right now, only explosive specialists can defuse mines then
this is freaking wacky though man
default unit without any traits set inherit the abilities to defuse mines
but once you go to set them, then it seems to go all hay wire
yes, thats strange to me to, i would like to give a medic or other icon to the unit with a set of traits
like the machine gunner with a MG unit icon
but he keeps geting called rifleman
both
icons, look at the ui_f pbo, names set them in the playable unit's role description in the editor
to make they be called something else i need to borrow a unit from other team
yes
and that icon?
the unit icon on the map
config based as well iirc, not too sure on that one
never really worked with the insides of those classes, but I know the name is reliant on displayName
did not find about that "displayName" on wiki
but i already find another work around, dont need to mind it.
@little eagle I tested replacing all ; with , doesn't do anything.
The instruction is essentially a "end of statement" That clears the stack afer each statement. For example after a call there is the returned variable on the stack. So to clear it it add's that clear instruction.
CODE blocks are strings&compiled code. Not just string. I could theoretically go into them.. But on Instruction level they are constants. same as strings, numbers n stuff. And if I recurse into them.. I can create endless recursion.
@icy raft Everything in SQF is by reference.
I was the one that told you it was by reference. I @tribal crane was the one that started arguing. That was about 2 weeks ago.. And I answered @hasty violet and not you ^^
found it.. 3 months ago.. That was really "a while ago"
Hi all, does somebody know a method to grab relative position of a vehicle's wheel?
You can probably get the position of the hitpoint
selectionPosition
But if you want to take the rotation of the wheel into account youll have to attachTo some helper object and then get a relative position from that.
Hi Chaps, tryna switch off certain types of lights by setting hit damage in the init, unfortunately I'm not quite understanding how to make the getAllHitPointsDamage arrray functional:
{
for "_i" from 0 to count getAllHitPointsDamage _x - 1 do
{
_x setHitIndex [_i, 0.97];
};
}
forEach
[
"Land_PortableLight_single_F",
"Land_PortableLight_double_F",
"PowerLines_Ssmall_base_F"
];
getAllHitPointsDamage is fine. But you use this on classnames. setHitIndex requires OBJECT. So you need a nearestTerrainObjects somewhere in this.
pretty sure you can just do setDamage instead of hitpoints?
As always.. Being able to read really helps: https://community.bistudio.com/wiki/setHitIndex https://community.bistudio.com/wiki/getAllHitPointsDamage
With lights if you do SetDamage they fall over :/
I would use specifically setindex but I couldn't fit the hitareas in the CFG
0.95 should have them stand up, turned off
setting it to 0 again will turn it back on
at least that worked for me once
Can I make a "else if" like this in Arma 3 ? https://pastebin.com/h3FQ6xFt
can you explain it?
@cedar kindle {_x setDamage 0.95} forEach (allMissionObjects "Land_PortableLight_single_F"); Yea that did the trick & it looks like double lights are subs of single so bingo!
side player == ENEMY and (side player isEqualTo ENEMY) do not give any value
but (side player == sideEnemy) does
can some one put a anotation on that wiki page too?
why would you expect a string to be equal to a side ?
i mean. it does say that it's an example of what the strings looks like when used with format
The debug console should be changed to properly serialize this stuff.
I've probably got this all wrong, but I'm using my begginers logic sense. I'm trying to add a HoldAddAction to all generators across the map:
Would the magic variable _x follow through to the 'then' or doe's it stay within the if() ? If not would I need to use '(_this select 0) ?
{
if (_x isEqualTo "Land_Portable_generator_F") then
{[
_x,
"Pump Generator",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"(alive _target) && ((_this distance _target) < 3)",
"_caller distance _target < 3",
{},
{},
{execvm "Fncs_Ambient\LightSwitchOn.sqf"},
{},
[],
10,
6,
false,
false
] remoteExec ["BIS_fnc_holdActionAdd", -2, _x];}
forEach (allMissionObjects "Land_PortableLight_single_F");
allMissionObjects won't list map placed objects, only mission placed objects. You need nearestTerrainObjects for this as I already told you.
{
if (_x isEqualTo "Land_Portable_generator_F") then {
[
_x,
"Pump Generator",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"(alive _target) && ((_this distance _target) < 3)",
"_caller distance _target < 3",
{},
{},
{execvm "Fncs_Ambient\LightSwitchOn.sqf"},
{},
[],
10,
6,
false,
false
] remoteExec ["BIS_fnc_holdActionAdd", -2, _x];
????
} forEach (allMissionObjects "Land_PortableLight_single_F");
The indentation is really bad. Hard to read the code. Here it's fixed. As you can see, there's a missing closing bracket. Totally not functional.
allMissionObjects would report OBJECTs. OBJECT are never equal to STRING.
Dunno about BIS_fnc_holdActionAdd, but remoteExec in a loop with so many objects will probably cause lag whenever someone connects.
remoteExec wants a boolean as 3rd argument in the rhs array. You have OBJECT?
Pretty sure adding actions to map objects doesn't work anyway. Better off adding one to the player using cursorObject.
Ok Commy, That is a thought cursor object. Sorry the copy and pasting was a mare due to my added notes will endeavour to keep it clean. Thank you for the help, I'll test some more and let you know what works
@little eagle You should get paid for this
didJIP still checks true even if you already spawn and you are inside the game?
it works as intended
as in, it returns true if the player wasn't present during the mission init
I am pretty certain that allMissionObjects return all map objects, even ones placed by yourself. I could be wrong, but IIRC I used it for something that needed the latest objects. Nevertheless, the performance of it is baaad and is very expensive operation.
@little eagle
Returns all mission objects (created by or during a mission)
Ye, what I thought.
thats not terrain objects then
Ah you mean like that
@little eagle https://gyazo.com/8de74a068bc562e7d3a4cefe48b25f1e
for code ```js
["Car", "init", {
params ["_car"];
if (PlayerSide == west) then {
_car addAction ["Impound Vehicle 2", {deleteVehicle (_this select 0)}];
};
}, nil, 1.5, true, true, "", "_this in _target]; call CBA_fnc_addClassEventHandler;```
you can see the error by the colour
hint the end isnt supposed to be a string (green)
its missing ""
yea so add it?
where?
where its not supposed to be green anymore
oh shit
}, nil, 1.5, true, true, "", "_this in _target"]; call CBA_fnc_addClassEventHandler;```
yea annd remove the extra semicolon too
Fucked that up
thats fucking you up too
}, nil, 1.5, true, true, "", "_this in _target"] call CBA_fnc_addClassEventHandler;```
@indigo snow good?
looks good to me
thanks
@indigo snow https://gyazo.com/7659f44deeb5c4d0ac639e7f98b2f8c1
["Car", "init", {
params ["_car"];
if (PlayerSide == west) then {
_car addAction ["Impound Vehicle 2", {deleteVehicle (_this select 0)}];
};
}, nil, 1.5, true, true, "", "_this in _target"] call CBA_fnc_addClassEventHandler;```
check if your input matches what the function needs
you currently give it string, string, code, any, number, bool, bool, string, string
So i have this script https://pastebin.com/raw/zvWfV67J and i was wondering how can i spawn the selected item in the list box when i press the spawn on position button?
ok but , how can i spawn the selected item in the list box, im not sure how i would do this
what do you mean by spawn, create the listbox entry or doing something once the listbox entry is selected ?
oh, that's pretty simple actually
i mean spawn the vehicle that is selected
use https://community.bistudio.com/wiki/displayAddEventHandler and do the spawning part in the code block arg
@lone glade im still pretty clue less, do you mind showing me how?
It says it can't find the following image
\a3\ui_f_data\gui\cfg\cursors\hc_unsel_gs.paa
But my path seems correct ..
Did I overlook something?
\a3\ui_f\data\gui\cfg\cursors\hc_unsel_gs.paa
the ui_f_data prefix is a3\ui_f\data
Is there a simple way to tell if an object's bounding box is colliding with the bounding box of another object?
I've got a complex solution but it's not very optimized (at least in comparison to my other work) and am wondering if anyoone would help me find a more simple solution
you want it as colliding anywhere on the boundingbox or visually (walls and stuff)?
Either @robust hollow For my application they are the same
i have a problem that all triggers fire at once when a JIP player join in the midle of the game
(of course only for the JIP)
and the triggers already got fired once by other player
in my case those triggers are to execute a audio from the plot in my mission, and they all play at once
@astral tendon of course, it's going to be evaluated when a player joins
i tryed to make the trigger deleat it self on the deactivation but it still exist
is there other way around it?
Don't use triggers
triggers are a big ol gongshow.
they can be speedy because they are built in c++ but otherwise they are a mess
deleting and making them is a bit tricky, better to do whatever you want via script
JIP wise they fuck things up even more
do it all by script.
@astral tendon
ok, my situation is that i need audos do be played in cetain points in the mission
once they are in one particualry area, once a area have no enemys, and once one ting or another dies
what i can use instead?
i hear that scipts that runs every time also kills perfomace in the same way was triggers
like a loop trigger
sinks to floor in defeat
so what i can use to check conditions EVERY time?
yup, that is also coop 8 players friendly and perfomace friendly?
can i trust a week of work around it and dont have to re-work it later on?
is that JIP friendly?
Yes of course it's performance friendly
more than triggers
obviously running a loop in unscheduled is retarded
and that is what a lot of people fail to realize
so what I recommend you do is, don't use triggers and learn sqf
while still executes when it already mets the condition or it its keep running and can execute again?
im trying to use this one
{
hint selectRandom ["close2","close3","close4","close5"]
};```
and it not looping on the console
you can't run loops or sleep in console without spawning the code [] spawn { ...your code here ...};
how would i knoe that the debug console was un scheduled?
is not called unscheduled debug code
infinite facepalm into endless oblivion
rip
I literally just talked about it before he posted
gross
🤦
Eehh..
they got medication and cream for htat
Hi, how many times per second FSM can change state?
Wasn't FSM per Frame? hmm 🤔 (not sure, tbh)
Hi guys. is it possible to differentiate between an object being deleted and an object being killed?
Eventhandler
yeah I tried the eventhandler, but can I check in a script somehow if its been deleted vs killed?
both ways of performing actions when killed work fine.
if (!alive _v) then {
and using the killed EH
but I dont want to perform some stuff if its deleted
by zeus or whatever
if its deleted itl be null, if its dead itl be !alive
or, the var for it would return null assumingu have one
so I can use
if (_v == null) ?
isNull _v
How do you tell if PM from Apex belongs to Apex DLC?
getText(configFile >> "CfgWeapons" >> "hgun_Pistol_01_F" >> "DLC") returns ""
Is there another config structure that points to it?
Makarov pistol
"PM 9 mm" in game
@meager granite all apex’s weapons without DLC parameter..., weapons in CfgPatches >> “A3_Weapons_F_Exp” should be used... need fix!
Interesting, I can't seem to find any mention of CfgPatches in Arsenal
yet it correctly shows Apex icon for PM
Pretty sure the arsenal uses https://community.bistudio.com/wiki/configSourceMod to determine the addon of an item.
Aha, I've been looking at outdated script which did
_dlc = gettext (_itemCfg >> "dlc");
Strange why they got rid of dlc value from configs though
Anyway, the string reported by CSM should match a sub class in CfgMods:
class CfgMods //sources - ["A3_Data_F","A3_Language_F_Beta","A3_Language_F_Gamma","A3_Language_F_EPA","A3_Language_F_EPB","A3_Language_F_EPC","A3_Data_F_Curator","A3_Data_F_Kart","A3_Data_F_Heli","A3_Data_F_Mark","A3_Data_F_Exp","A3_Data_F_Jets","A3_Data_F_Argo","A3_Data_F_Orange"]
{
defaultAction = "";
class Mod_Base; //sources - ["A3_Data_F"]
class Expansion: Mod_Base //inherits 12 parameters from bin\config.bin/CfgMods/Mod_Base, sources - ["A3_Data_F_Exp"]
{
[...]
appId = 395180;
[...]
class Assets //sources - ["A3_Data_F_Exp"]
{
class TanoaTerrain //sources - ["A3_Data_F_Exp"]
{
displayName = "Tanoa Terrain";
overviewPicture = "\A3\Data_F_Exp\Images\FeatureTanoaTerrain_co.paa";
description = "Walk, swim, drive, fly, and sail your way across the brand new South Pacific island terrain.";
dlcType = "expansion";
};
class WeaponAK12 //sources - ["A3_Data_F_Exp"]
{
reference[] = {"CfgWeapons", "arifle_AK12_F"};
overviewPicture = "\A3\Data_F_Exp\Images\WeaponAK12_ca.paa";
tryAsset[] = {0, {"I_C_Soldier_Para_1_F", {"arifle_AK12_F"}}, ""};
dlcType = "expansion";
};
And this is how the game determines which weapon belongs to which item.
Yeah I've seen this structure in config but thought it was mainly used for DLC info displays and promotional menus
Thanks, it all makes sense now.
Does anyone remember in which PBO the code for the mount/dismount addAction from ACE2 was?
I don't remember a mount/dismount addAction aside from eject left/right when inside a helicopter.
Probably that one.
Why? We'll have this in ACE3 now in 3.11
I'm researching something...
ACE2 code is really ugly.
Indubitably.
I'm away from my main dev PC, does anyone know if Arma 3 accept binary notation? ( 0b00000001, 0b00000010, 0b00000011...)
😦
what's the float limit again before they're rounded, 9 ?
somewhere above 1E7
@lone glade you mean non-decimal numbers?
-16777215, 16777215 is the integer range you can store in float with 100% precision
Can I make listbox not be able to select items in it?
@icy raft arma accepts hexadecimal (0xaf01) but it will be converted to a number (also 24bit max!)
@frank ruin like having a list but the player can't select something?
if you don't want to disable the listbox just set the select colors the same as if not selected (aka colorselect/2 = text color and selectBackground/2 = background color)
The issue is
When I have 2 of them selected
It act bit jinky
Like the script has troubles with interacting with 2 selected listboxes
Even when I mentioned it has to take the selected lines in listbox 1
If I selected something in listbox 2
it doesn't execute straight away
I have to reselect listbox1 in order to confirm kind of
Cause it selects listbox2 being more selected then listbox1 being selected
So I would like to make listbox2 not being able to be selected
So it doesn't interrupt with listbox1
Assuming I have the following script
#include "script_component.hpp"
private _objList = [];
{
_objList pushBack _x;
} forEach nearEntities [player, ["Tank", "Car", "Ship", "Helicopter", "Plane", "StaticWeapon", "CAManBase"], 50];
hint format ["%1", _objList];
``` And it returns ```
[B Alpha 1-1:1 (Neviothr),B Alpha 1-3:1]
Is there a way to use the array in order to execute code on a certain element from it? I.E ```
B Alpha 1-3:1 setDamage 1
(which obviously doesn't work).
anyone know if I can look up the return of "surfaceType" somewhere in the config to get more information about the kind of surface ?
never messed around with those
@tough abyss forEach should be good enough for that, no ?
or apply
depending on what you want to do
and if you're looking for active objects then maye using "allUnits" would be better than nearEntities
since nearEntities also returns dead or destroyed ones
and is generally slower
I don't need every unit, all ones in a certain radius.
you dont understand
allUnits can be filtered
but nearEntities returns more than you might want
The question is - can I adress a nameless unit remotely?
sure
but the real question is
what do you want to do there
_unitsnearby = allUnits inAreaArray [getPosATL player, 50, 50];
I'm not sure how to explain the purpose, really.
you want to run code on certain units but i dont know which ones and for what purpose
Exactly.
the types ob units / objets you want determine which command is best used to find them
Can be any unit, and any code.
thats pretty vague
_unit = _array select 0; doCodeWith _unit; ???
@cunning nebula - let's say I'm in a SP or MP mission (which I can't edit), and there's a bug. A mission-critical unit, vehicle, etc. is damaged. How can I get the name or variable, if assigned, of that unit so I can manipulate it.
anyone know if I can look up the return of "surfaceType" somewhere in the config to get more information about the kind of surface ?
never messed around with those```
What kind of Information?
any information really 😛 i dont know how much there is
Hmm, I thought about using cursorTarget. But does it have a distance limit?
Like ```SQF
if (cursorTarget == objNull) then {
// Run some code on current player
} else {
// Run some code on target
};
isNull cursorTarget
The target has to be known to the player to some degree (knowsAbout > 0). If target is completely unknown, command returns objNull.
```?
cursorObject > cursorTarget
Fresh spawned Vehicle on a Server for example might take time, until "your pawn" knows about it, even when you can clearly see it
That's an issue.
Thats "normal", since: always
CursorObject should detect it from the moment it's there
@cunning nebula
_Surface = (surfaceType position player) select [1,100];
_CfgEntry = getText(configfile >> "CfgSurfaces" >> _Surface >> "files");```
Example
if you do it from the debug console you can simply put typeOf cursorTarget in one of the debug lines
or whatever else information you need
ah, great
so they are in the config
thanks
I'm assuming cursorObjectalso doesn't have a distance limit?
Why do you need a Distance?
if your aiming for units, then cursorTarget is better
+wasn't cursortarget ~2k?
it doesnt pick up clutter
Or was that LineIntersectObject ... hmm
@jade abyss - I need distance because if I want he script to be "dual-purpose" if you will. As I posted above ```SQF
if (cursorTarget == objNull) then {
// Run some code on current player
} else {
// Run some code on target
};
so they are in the config```
Yeah, it's basicly just the config name what you get... but... yeah, thats it. Not more.
ISNULL
Yeah I got that.
if (isNull cursorTarget) then {```
....
I'll try that, thanks. If it doesn't fit the bill I can always add a distance check, make sure cursorTarget's return is closer than 5, 10, 50m.
Thats what you should do anyway
Why do you need to check for something thats >50m away?
Or even 20 oO
I just gave arbitrary numbers.
I think you mean.
if (local cursorTarget) then {
there is also "allPlayers" if you're aming for someone specific
Where?
@cunning nebula - doesn't have to be used on players, could be an empty vehicle.
well, i still dont get the point
Same ¯_(ツ)_/¯
if youre in the debug its up to you what you run it on
Anyway, this one will always report false:
if (cursorTarget == objNull) then {
Because
objNull == objNull // false
Dude... stop deleting your answers... damn... thats annoying
Who?
Nevi
There there ```
// Run some code on current player
} else {
// Run some code on target
private _target = cursorTarget;
if (isNull _target) then {
_target = player;
};
I guess this ^ code also makes sense. I don't really know what the result should be.
Sorry.
The thing is, he wants to check for something >50 or above... So his code could execute even if he looks at a house or... anything
And since he doesn't say, what he want's to achieve with it -> limited help
cursorTarget doesn't work on map objects like hosues. It will report null for those.
@jade abyss - "[3:49 PM] Neviothr: I just gave arbitrary numbers."
Erm, nope? @little eagle
You're thinking of cursorObject maybe. cursorTarget only works on vehicles and soldiers and stuff like that. Mission objects.
Not working with Trees, thats correct. But houses work
Hmm.
@jade abyss tested FSM... now i am sure that “1 state change per frame”.. avg 0.999704 FrameNo diff for 3,5k frames
// Run some code on target
This sounds to me like something about MP remote objects. ¯_(ツ)_/¯
By "target" I meant whatever's under the cursor.
works even without locality 😛
So you mean run "for" target?
Because "on" sounds like you want to remote execute stuff on a different machine.
gj repeating what i just wrote 😂
Because i can =}
(fighting with Vector stuff, always angry when doing that crap)
This probably should do it ```SQF
if ((player) distance (cursorObject) < 2) then {
cursorObject setFuel 1;
} else {
vehicle player setFuel 1;
};
Won't work without locality Check + damn
dem round brackets
Exactly why do I need a locality check here?
if ((player) distance (cursorObject) < 2)
->
if ((player distance cursorObject) < 2)
check setFuel
It only works, when the Vehicle is local to you
because setFuel is AL EG
(╯°□°)╯︵ ┻━┻
@tough abyss try this
_target = [cursorTarget,player] select isNull cursorTarget;
Now you have to check if it's local and if a driver is in it, then you have to send that over to the owner OR set the ownership of that Veh to you
I fucking hate MP.
Woohoo Locality issues are my favorite!
SQF <3
setDir - AL
setPos - AG
addBackpack - AL
addUniform - AG
addMagazine - AL
addMagazine ARRAY - AG
use CBA targetEvent -> done 😄
@jade abyss - oh I know about locality, but I don't know shit about locality.
@Dscha - oh I know about locality, but I don't know shit about locality.
what?
0_0
just make sure any command you send is executed where the targeted object is local and you're safe, for the most part
Thanks @cunning nebula.
if(local _CTarget) then { setFuel Command}
else
{
_CTarget remoteExecCall ["SetFuelFunctionOnTheServer"];
};
remoteExec takes nearly anything as target dude
SetFuelFunctionOnTheServer =
{
[1] remoteExecCall ["SetFuel",owner _this];
};```
Or something like that
What I like the most is that I played MP once, yet try to make this thing MP compatible.
But you can't get the owner of a Vehicle from Clientside @lone glade
Or was that changed?
[_target, 1] remoteExec ["setFuel", _target];
filter targets via aimedAtTarget ?
iirc doesn't aimedAtTarget return accuracy?
or how well it's aligned with the target?
The idea is that you're shooting at it if it's aimed at enough.
🤔
pick the first one
thats most likely what hes shooting
but maybe checking aimedAt is faster, hard to tell
"most likely" 😐
inAreaArray filter with a rotated rectangle in weapon direction and then using that sub array sort method to get the object that the weapon is aligned with the most.
just tried targetsQuery on the local player
it lists the target im aiming at first
Something seems fishy, this can't be it ```SQF
_target = [cursorTarget, player] select isNull cursorTarget;
[_target, 1] remoteExec ["setFuel", _target];
Read what i worte about Owners Nevi
[4:07 PM] Dscha: But you can't get the owner of a Vehicle from Clientside @alganthe
[4:07 PM] Dscha: Or was that changed?
(the setFuel part)
Why wouldn't this work? It looks perfectly fine to me.
Aside from `player´ never being a vehicle and therefore never using fuel.
Idk, you guys wrote it 😂
So remoteExec ignores the locality of an Object?
What?
just because "owner" is restricted, doesnt mean remoteExec also is
^
would be stuipid if it was
All remoteExec are send to the server anyway. The server knows which machine it to send to.
Don't ask about sense
@little eagle - well , vehicle player? I guess?
rgr that
Sure.
Then Code should work
it seems like it does
I'm going to assume it would work with setDamage and setAmmo as well.
Neviothr, learning by doing.
@jade abyss - if only I had a proper MP testing environment 🤦
map content ?
@tough abyss Starting a DediServer is easily doable on your own machine
@jade abyss - if only my machine could handle one 😦
If it runs Arma, you can run a Dedi in the BG. Nobody said it must be filled with x000 Players/Units
+Excuses, excuses, excuses
no i was aiming at friendly to see if the array gets sorted
but since you want to know what a AI is shooting at....
its safe to say that he knows his target
@jade abyss
getNumber(configfile >> "CfgSurfaces" >> (surfaceType getPosATL player) select [1] >> "grassCover");
thanks, found this very useful config value 😃
more than i had hoped for
@jade abyss - "+Excuses, excuses, excuses" is my life in a nutshell, but that's for another channel.
@tough abyss ok, maybe i was wrong
when i tested it, i was standing between those targets
so i had to look in different directions
it doesnt work well when I'm some distance away and they stand close together
i guess in that case it returns the closest one or something like that
I used it for that: (sadly only doable when you know the path inside the .pbo to the .paa)
https://www.youtube.com/watch?v=t7mt1dcfdb8 (No Commy, no need to repost it, i disabled the PreviewPic 😛 )
hahaha
dscha early in the beta i used a pip-texture as camo for a uniform xD
erm alpha i mean
^^
I thought about that too, but then i rememberd: Oh, there are ppl who don't use PIP, damnit
i think i tested that with your brother, iirc ^^
Yeah, indeed it is
hidd0rn
i actually attached a camera between his legs xD
to get the ground texture
sadly pip also doesn't display shadows
Rly? Never payed attention to that
is there any particular difference between using BIS_fnc_addStackedEventHandler VS addMissionEventHandler for "PlayerConnected" and other mission-related events?
but damn, using surface texture is even better 😃
Won't this turn black if there are multiple of these next to each other?
yes probably
addMissionEventHandler is newer and better.
Yeah, downside: You have to find out the path of the Tex on your own and adjust it for every fkn island 😦
coolio, i'll use that one then
hmm
Hey guys, anyone here know if it's possible to have a progress bar in a listnbox?
@cunning nebula ( "_Tex =" part :/ )
https://pastebin.com/5J66MYZb
So I tried what we we're doing earlier, setVehicleAmmo and setFuel don't work in the context on that script 😕
Well, sorta. setFuel works if you're look at the vehicle (it will be refueled), if you're in a vehicle while looking at a vehicle (the vehicle you're looking at will be refueled). Although it won't refuel the player's vehicle.
cursorTarget?
Yes.
Yeah but isn't this supposed to set _target to vehicle player if you're not looking at another vehicle? _target = [cursorTarget, vehicle player] select isNull cursorTarget
Yes, but you probably looked at something.
Nope.
Debug console, cursorTarget.
objNull, tested while setting in an ATV.
Didn't cursorTarget from inside a Veh always returns the Veh you are in?
Can't remember anymore
No?
cursorObject is <NULL-object>, [cursorTarget, vehicle player] select isNull cursorTarget is B Alpha 1-1:1 (Neviothr).
Even if I look down right at the vehicle it's the same.
hmmm just crashed arma two times in a row, seems like i'm doing something wrong xD
right*
It's setVehicleAmmo that's broken. There are no rabbits on VR.
Who knows.
setVehicleAmmo only replenishes the current magazine...
Yes.
Maybe you want setVehicleAmmoDef to restore the config state.
@open vigil Ban this bot ^
FM is offline, try @graceful pewter or @drowsy skiff.
Just because he isn't visible for you, doesn't mean he is offline 😛
whats up
z_wo @graceful pewter
player spawn {
while { true } do
{
waitUntil { sleep 3; alive _this };
_this setVariable ["defcamo", _this getUnitTrait "camouflageCoef", true];
while { alive _this } do {
if (stance _this == "PRONE") then {
_surfaceType = (surfaceType getPosATL _this) select [1];
_grassCover = getNumber(configfile >> "CfgSurfaces" >> _surfaceType >> "grassCover");
_newCamo = 1 max 500 * _grassCover;
_this setUnitTrait ["camouflageCoef", _newCamo];
} else {
_this setUnitTrait ["camouflageCoef", _this getVariable "defcamo"];
};
sleep 1;
};
};
};
gone
values may need some tweaking but it seems to work well
setVehicleAmmoDef is acting really weird.
It like, switchs the current weapon to empty one and shifts and player's camera...
AI-Stuff Tajin?
Can someone try setVehicleAmmoDef to reproduce the above?
it makes your camo more effective when you're prone, depending on the amount of grass in that area
Hello all,
How can I fix this ?
player addAction ["SHOW SCORE",hint parseText format ["Score : <br/><t color='#0000FF'>BLUE</t> %1<br/><t color='#FF0000'>RED</t> %2<br/><br/>Flag Touch : <br/><t color='#0000FF'>BLUE</t> %3<br/><t color='#FF0000'>RED</t> %4", WScore, EScore, westtouch, easttouch]];
is doesn't work :S
their are so many options in addaction i get lost
@quartz coyote Wrap your code in brackets:
player addAction ["SHOW SCORE",
{
hint parseText format ["Score : <br/><t color='#0000FF'>BLUE</t> %1<br/><t color='#FF0000'>RED</t> %2<br/><br/>Flag Touch : <br/><t color='#0000FF'>BLUE</t> %3<br/><t color='#FF0000'>RED</t> %4", WScore, EScore, westtouch, easttouch]
}
];
addAction takes either "hint 'hello';" string or { hint "hello"; } code
Code is easier to manage and read, but string can be useful in some cases.
thanks man
Can also use functions or call a script.
Guys:
holsterKeydown = (findDisplay 46) displayAddEventHandler ["KeyDown", "if ((_this select 1) isEqualTo 0x23) then {_nul = [] execVM 'Client\Functions\Externals\KeyFunctions\WeaponHolster.sqf'};"];
Right now our mission uses the script above to determine if you push your "H" key and then allow you to holster your weapon. How do I assign a custom key?
@tough abyss By changing 0x23
Here's the list: https://gist.github.com/commy2/946de04d748c8e2894a0f581903988a5
i'm following...to what?
I posted it.
k let me read
i think i know what you think I meant
I mean...in arma...there's a whole "custom controls" option
user action 1, user action 2, and so on
how do I tell the script to point to user action 3
so taht the player can pick his key
That will not work. You can bind those to e.g. Alt+H and the alt modifier will make the actionKeys command report a number above the single floating point precision.
(_this select 1) isEqualTo 0x23 && (_this select 3)
Or was it (_this select 4)
?
_display, _key, _shift, _control, _alt
4
4 it was, not 3
(_this select 1) isEqualTo 0x23 && (_this select 4)
The comments on this page more or less explain why it doesn't work with USERXX: https://community.bistudio.com/wiki/actionKeys
Sucks, but that's how it is. It worked in A2, but I think they broke it when they moved to A3 and never bothered to remove them from the keybinding menu.
Or:
http://grueslayer.webs.com/Keystate.png
if((_this select 1) isEqualTo 17)then{hint "W was pressed"};```
or for CustomKeys:
if((_this select 1) in actionKeys 'User12')then```
- @tough abyss
_ctrl = _this select 0;
_button = _this select 1;
_BtnShift = _this select 2;
_BtnCtrl = _this select 3;
_BtnAlt = _this select 4;```
Add something like that in the beginning of your file (or use params["_bla"] stuff, if you want to)
Dscha, this breaks when you bind the action key to Alt+etc.
Did you even read what I wrote?
? oO
actionKeys reports huge numbers for keys with modifiers.
Not if you bind the user12 to alt+h itself
or shift+h
Left Ctrl + Key = 486539264 + DIK
Left Shift + Key = 704643072 + DIK
Left Alt + Key = 939524096 + DIK
Right Ctrl + Key = -1660944384 + DIK
Right Shift + Key = 905969664 + DIK
Right Alt + Key = -1207959552 + DIK
This has been broken for 4 years and you still haven't realized it lmao.
if(_button in actionKeys 'User11')then
{
if(_BtnCtrl)then
bla, using it
You don't understand why this won't work, do you?
Dude... i used it in OBE (wich works)
Open the menu right now and bind it to shift+something
You'll see that it does not in fact not work.
Shift + the UserAction button
Dude. If you bin User11 to alt+h.
Then actionKeys will report [hugeassnumber]
And hugeassnumber is not the DIK for whatever.
Who the F is doing that anyway
Bind stuff to shift+anything? Everyone?
Not rly
if they bind it that way -> Pff, who cares. Bind it to single Buttons. I couldn't care less
Right. Script stuff that only sometimes works. Great idea.
wait a sec
Nah, for a moment i thought i would have any interest in it.
@little eagle the 'broken' part your reffering to is related to code involving allowing the player to set custom binds with their controlls config -> keybinds , blah blah right? Not code involving just setting a function/etc to a specific dik code, that may or may not include shift alt modifiers correct?
actionKeys is essentially unusable.
Everything with actionKeys will break when modifier keys are used.
Shift, control, alt.
Get used to it. No work arounds.
i have noticed at least with enhanced movement, many keys wont work- and shift or alt modifiers never work
Yep. That's why you shouldn't use actionKeys as a scripter.
Commy, I'm adding an addaction to all opfor units, it as intended for placed units using if side = east in the init. It doesn't work for any further dynamically spawned units which I guess as those units don't yet exist in the init. Could you offer some advice on how to give the new units the addaction?
Mods or vanilla?
A mix - using Ravage, so I'm trying to loot the zombals (Main focus Mods then I guess)
A mix of mods and no mods.
As in I'm spawning Vanilla & Non-Vanilla - Didn't want to give the incorrect answer
🍪
++
["All", "initPost", {
params ["_object"];
if (side _object == east) then {
//something
};
}] call CBA_fnc_addClassEventHandler;
Something like this? Idk.
uldn't of even thought of that direction - I was trying to do stuff with While loops. Ill have a tinker thank you. Thanks Commy, with the cleaning of the code and that code you provided it works 😄
@tame portal pretty great huh?
I wonder where he gets this kind of stuff from
The interwebs.
can anyone confirm that this code completely freezes arma?
[_this] spawn
{
params["_unit"];
_unit select 0 addEventHandler["Killed",
{
params["_unit"];
private _box = "Box_NATO_Wps_F" createVehicle (getposATL _unit);
clearWeaponCargo _box;
clearMagazineCargo _box;
clearItemCargo _box;
clearBackpackCargo _box;
{_box addWeaponCargo[_x,1];} forEach (weapons _unit);
{_box addMagazineCargo[_x,1];} forEach (magazines _unit);
{_box addItemCargo[_x,1];} forEach (items _unit);
_box addItemCargo[(uniform _unit),1];
_box addItemCargo[(vest _unit),1];
_box addBackpackCargo[(unitBackpack _unit),1];
_box addUniform (uniform _unit);
}];
};
nothing in rpt
just totally locks up
nope, just local to the player
_this would be everything thrown at it during executio
which atm is only the player variable
_unit select 0 selects the player unit from the spawn params array
what's the most confusing about this is that it was working perfectly a few days ago, and all of suddne it stopped working. Which isn't just because it feels like it, I did something wrong here...
@subtle ore
[_this] spawn
{
params["_unit"];
_unit select 0 addEventHandler["Killed",
Should be:
_this spawn
{
params["_unit"];
_unit addEventHandler ["Killed",
addUniform is for persons. This will not work:
_box addUniform (uniform _unit);
Assuming that items etc. corresponds with the item needing addItemCargo etc. is very optimistic. I'm not sure that is always true.
{_box addWeaponCargo[_x,1];} forEach (weapons _unit);
{_box addMagazineCargo[_x,1];} forEach (magazines _unit);
{_box addItemCargo[_x,1];} forEach (items _unit);
unitBackpack reports OBJECT. addBackpackCargo needs the classname:
_box addBackpackCargo[(unitBackpack _unit),1];
You also needs the Global versions of these addXCargo commands. addXCargoGlobal.
Pretty sure that some of these could lock up the game. If the game locks up, no error message might be printed.
Oh:
createVehicle (getposATL _unit);
should be:
createVehicle ASLToAGL getPosASL _unit;
So this doesn't spawn the box in mid air on an aircraft carrier? Not sure if this createVehicle version doesn't spawn on the ocean floor anyway.
Hello Friends,
I'm encountering a weared situation. RPT file didn't give me any error and no error code ingame ether.
Description.ext
// Functions
class CfgFunctions
{
class Server {
tag = "ctf";
class functions {
file = "fnc\ctf";
class outro {};
class workflow {};
class timealerts {};
class scorereached {};
class prepphase {};
};
};
};```
initServer.sqf
```sqf
call ctf_fnc_workflow;
call ctf_fnc_scorereached;
call ctf_fnc_timealerts;
fn_scorereached.sqf
waitUntil {(ScoreP<10000 and ((WScore>=ScoreP) or (EScore>=ScoreP)))};
// Send End Status to allPlayers
TimeEnd=true;
publicVariable "TimeEnd";
hint parseText format ["Mission over<br/>Final Score : <br/><t color='#0000FF'>BLUE</t> %1<br/><t color='#FF0000'>RED</t> %2<br/><br/>Flag Touch : <br/><t color='#0000FF'>BLUE</t> %3<br/><t color='#FF0000'>RED</t> %4", WScore, EScore, westtouch, easttouch];
remoteexec ["ctf_fnc_outro"];
I tried putting a Hint "Test"; in th biggining of my function to see it was correctly executing but it never showed up ...
That's what I thought too... I'll try and tell ya if it fails
Yes ! It works
@Midnight#4592 _unit will already contain _this. do you really want _this select 0?
And why do you spawn a piece of code that shouldn't be spawned.
@still forum originally i had sleeped a different part of the code,
@little eagle thanks for the feedback.
Would be interesting to know which of these bugs causes a freeze. Because I don't see it.
Dunno. Going to root it out and see what the problem is.
Comment almost everything out and then uncomment bit by bit until it freezes again.
Debugging Arma style.
All you need is patience. You don't even have to use your brain that much doing it. I put myself in auto mode and just do it whenever I encoutner such a problem.
The creative thinking part is searching for an explanation afterwards.
Oh, i am very patient. I am just curious as to why i made so many mistakes in the first place, maybe i was sleepwalking whilst making this. Lol. I feel sometimes there isn't an explanation for everything and sqf is just what it id
Eh, everyone makes mistakes. Just needs practice to make fewer of them.
🤷
Why don't you try it and see if it works?
If it doesn't work then the code is not correct.
I don't think you can disable taking damage on map objects, but I can't remember the last time I tried something like this.
Syntax looks correct to me, but be aware that nearestBuilding only reports buildings with pathway lods for the persons etc.
So no streetlamps or some other small things like that.
What building are you using this on?
And it should be protected from artillery and other bombardment?
A radical solution would be to do a nearObjects scan every (?) frame and to delete everything resembling projectiles / ammunition.
That would make everything safe in there.
like 7 lines of code.
What's the base's positon and what should be the radius?
// init.sqf
if (isServer) then {
addMissionEventHandler ["EachFrame", {
{
if (_x isKindOf ["Default", configFile >> "CfgAmmo"]) then {
deleteVehicle _x;
};
} forEach (BASE_POSITION nearObjects SAFEZONE_RADIUS);
}];
};
- dunno if removing isServer is needed (if the code has to run everywhere)
- people will suggest using the scheduler, but then it becomes a gamble if the loop is quick enough to catch a quick projectile with a short flypath.
It has to be executed on the server. Doesn't matter which file or framework.
You can do it by debug console in the editor to check if it works. That's what I'd do first.
I don't have Arma installed on this machine, so I might've posted garbage. You should get the idea though.
guys, I have a question about BuildingPos. how many buildPositions I can create?
what do you mean by create? you mean in the 3D model?
yep
way more than you'll ever use
for example I can make 1000?
don't know, but it's way above 50 at least
ok, ty bro
🤔 Not really a scripting question
I wish find took an expression
Uhm, how'd that work?
like a select, but stop at the first result, I think
or return an array of matching indices
So basically a shorter version of:
private _result = -1;
{
if (CONDITION) exitWith {
_result = _forEachIndex;
};
} forEach ARRAY;
?
my thoughts exactly ^
yeah that'd be it
backtick.
not a single quote
` not '
hint "Hey kid, you like syntax highlighting?";
```sqf
code here <<<
```
^
Each individually. Also, the code is fully encapsulated by {}, but it's never called?
Whats with all those positions in the foreach?
Near objects is only going to take one of those
Yes. One position per nearObjects
Though, this works:
((POS_1 nearObjects 500) + (POS_2 nearObjects 500) + (POS_3 nearObjects 500) + (POS_4 nearObjects 500))
👍
what are you using as a text editor?
ytou're missing an ending bracket
you're missing a ] at the end of the addition
Yep
fix that
and I think you should be fine...?
Yep.
btw it should be something more like this
{
addMissionEventHandler ["EachFrame",
{
{
if (_x isKindOf ["Default", configFile >> "CfgAmmo"]) then
{
deleteVehicle _x;
};
} forEach (([14379.6,16139.4,5.34058e-005]nearObjects 500) + ([14808.6,16574.8,2.67029e-005]nearObjects 500) + ([15245.6,17253.1,3.43323e-005]nearObjects 500) + ([15415.1,17108.5,-0.000137329]nearObjects 500) + ([15248.4,16984.2,0.000112534]nearObjects 500)) ;
}];
};
I think you get the idea, freaking notepad
don't use execVM
but yeah, the formatting was just weird with yours
{
addMissionEventHandler ["EachFrame",
{
{
if (_x isKindOf ["Default", configFile >> "CfgAmmo"]) then
{
deleteVehicle _x;
};
} forEach (([14379.6,16139.4,5.34058e-005]nearObjects 500) + ([14808.6,16574.8,2.67029e-005]nearObjects 500) + ([15245.6,17253.1,3.43323e-005]nearObjects 500) + ([15415.1,17108.5,-0.000137329]nearObjects 500) + ([15248.4,16984.2,0.000112534]nearObjects 500)) ;
}];
};
use call compile preProcessFile
[] call compil preProcessFile "scripts\BaseProtection.sqf";
faster
you had some really funky 3 spaces on some of those brackets..
no, just replace execVM "scripts\BaseProtection.sqf"; with that
with postinit
lool, compil
cfgfunctions is what you are supposed to do as a mission maker
compiles on mission load
easier to call/spawn the script
sure
and you can use pre/post init
honestly, there isn't any point if you're going to run it once