#arma3_scripting
1 messages ยท Page 499 of 1
so i could add them together in a controlled environment and nothing would interfere, even when 2 or more players working on ressources. Right?
yeah.. probably
but That would be harder and less efficient than just telling the server that "x resources have been mined" and letting the server take care of the rest
hmmm, now i have to ask. How? I still miss the experience to know the commands. Maybe i oversee a solution thats right in front of my eyes
oh wait! I think i have an idea!
remoteExec! I can send my variable to another script, that processes the information and updates the global ressources. Even when another player does it, it would just be added up behind the currently running remoteexec and uses the new data, right?
(what are you trying to do ?)
an active ressource-mining script that as many player can use as there are online.
mercs dont only make money through missions. They can, if they want, also go work on a more or less 'legal' job
a missions fun to play, a persistent one, relies on many things. If you can only do the same three things, the mission gets boring too quickly.
thats why we stopped with antistasi. Alone the black-market script i plan will be a whole lot of an adventure.
might get handy (promise system)
https://gist.github.com/X39/709ecbf88c5fda594586c9b995c8c6a0
I can send my variable to another script, that processes the information and updates the global ressources exactly what I've been trying to tell you the whole time
I need some time to understand stuff ^^
Client: I mined resources!
remoteExec ["fnc_updateResources", 2]
Server: I'll get right on that.
some_function_to_validate_gained_resource; // if applicable
_addedResources = Do calculation;
_total = _addedResources + currentGlobalResources;
do_your_setvariable;
Server is god, everyone else is peons.
the server is only a demi-god, because i tell the server what and when to do ๐
hi i'm trying to add an animation on a waypoint with the unit reacting if it gets attacked and then returning to waypoint(s) (if he doesn't die) so on the waypoint i have nul = [this] execVM "1stWP.sqf";
and in the sqf S1 playMove "Acts_Executioner_Squat"; sleep 10.033; S1 switchMove ""; 0 = this spawn {waitUntil {behaviour _this == "combat"}; S1 switchMove "";
it kind of works but is a bit messy and sometimes misses a waypoint out (after if in combat)
waypoint 2 and 3 are same code just different animations with different duration values related to animation
do you have to remote execute the setvariable command at all when you set the variable public anyway?
no
i think thtas whats supposed to happen here though
that just causes every player to set the variable public
[(("storedRawRessource", storedRawRessources, true), missionNamespace)] remoteExec ["setVariable"];
or not?
That line is bullshit
Yes. that's what it would do if it didn't have multiple syntax errors
That would send the variable to every client. And every client would send it off again.
So every client will receive <number of players>+1 variable updates. With the same value for the same variable.
Essentially a network traffic killer
but im trying to listen in, the stuff still confuses me sometimes
how can i necely simulate artillery?
at the moment i am at explosions, but i spawn them at locations and make them explode
how do i get it to actually drop shells from above that explode on impact?
spawn and set velocity?
just throw shit at them?
Yes. That's what I would do
That's also what zeus module does with it's fire support modules
unexploded ordonance would be interesting to play with
spawns the shell in sky. SetVelocity towards ground
hmm nice
I think they are subject to the same "unexploded ordenance" stuff as any other ordenance
dunno.. Think so
means if they are too slow, they wont exlode?
hmmmmmm
so with some "kill" eventhandler i could even get the impact coordinate i suppose
could make a script that slowly targets in on an area by slowly changing velocity or so
or just the origin or whatever
don't know if kill fires for ammo
its a vehicle id assume... maybe hit and stuff still works tho
but id prefer to trigger by damage not just when it is hit....
["here/itis.sqf"] remoteExec ["execVM", 2,]; How can i send a variable i would need to use in the 'itis.sqf' with the remoteExec as well?
["here/itis.sqf", _myvariable] remoteExec ["execVM", 2];?
you would make your life easier if you make a function out of your sqf, believe me
i have discovered that magic not so long ago
Hmm, maybe i learn that someday. But for today i want to learn first how i can do it "dirty" ^^ later i can make it cleaner and cleaner :3
i think there even is a thing that remoteexec does not execute sqfs?
it does execute sqfs ^^
[[_object],
{
private _object =_this select 0;
......code.....
}
] remoteexec ["spawn", _object];
this is how it works for me with small codes
now i am confused
with some function it would be
[[_object],
"my_function"
] remoteexec ["spawn", _object];
the _object in the end is because that makes it run where the object is local
if you want server, use 2
in my case units might be on headless clients too, so i rather do this
my_function = {
private _object =_this select 0;
......code.....
};
i am horrible confused O_O
but... i just want to pass a variable to another script? Is thats the way how i must do it?
that depends. how did you end up with questions about remoteexec?
because thats for passing variables between clients and server
["script.sqf", _myvariable] remoteExec ["execVM", 2];
Thats send from script 1 (on a local machine) which is the mining-stuff. And in script 2, which works on the server only, adds the mined ressource to the global pool.
even more confused now. Can i write a whole "script" into the remoteExec stuff?
you could. But if you do that. You also send the script over every time
yea but it looks shit ^^
i dont care how it looks. First i have to learn, use it multiple times, then i learn new advanced methods.
For now you can use the execVM thingy you posted
but you mixed up the arguments again
yea that too
left param on the left, right param on the right
I just want to know how i can pass a variable via the remoteexec as well.
but im wondering if its adding stuff to a global pool
couldnt he just do it with publicvariable
?
[_myvariable, "script.sqf"] remoteExec ["execVM", 2];
No he can't
We talked already talked about that
damn
ah, so everything i want to pass over is first
no?
Everything you want to pass over is the whole line
the array at the start are the arguments
[_myvar1, _myvar2, "myscript.sqf"] remoteExec?
ah alright i looked it up.
but you wrote [_myvariable, "script.sqf"] isnt that now for passing the variable?
problem with parallel users i guess?
Yes it is (to both of you)
ok understood
So it would look like this:
[_minedRessource, "serverMathematics.sqf"] remoteExec ["execVM", 2] and in serverMathematics.sqf i can say like "globalRessource = globalRessource + _minedRessource;" right?
yes
no
parameters are passed via _this
_mindedRessource variable will be undefined
oh right! forgot
global = global + _this;
Can i send an whole array of information over? Like
[[1, 2, 3,4], "stuff.sqf"] remoteExec ["execVM"]?
private _minedresource = _this selct 0;
you need to begin with that so that the thing knows what you are talking about
in the sqf i mean
@proven crystal so _this is not the actual value but an array where i have to select the only existing position?
you can pass an array, no problem
if your first parameter there is an array, then in the script _this select 0 will return that array
So currently it would look like this:
[_minedRessource, "serverMathematics.sqf"] remoteExec ["execVM", 2]
and in serverMathematics.sqf i can say like
"_minedRessource = _this select 0;"
"globalRessource = globalRessource + _minedRessource;"
yes that should work
sweet ^^
in front of private variables, use "private
Is it necessary?
private _minedResource = .....
do it once at the time that you introduce that variable
otherwise sooner or later there will be bugs
and on the use of functions
its useful
so do it ^^
and figure it out early because otherwise youll end up working over massive amounts of hard to read scrips as i did
I know that functions are good. But for now i have to understand basics and make a whole lot of a big mission without functions first. Understand everything and later, with the main-mission i will have the knowledge of everything that is possible without functions, and write proper functions ^^ does that make sense? ๐
my scripts are extremely detailed documented :3
If i die one day and have a big mission, people can learn from it easily - because i will adapt those mission(s) to new arma versions as well :3
explosions? I am curious now ๐
so much enjoy since i found out how to play with achilles modules
Well, explosions are noob stuff. Make Tanks fly! Then we can talk ๐
i can do that ^^
my module is called WIngardium Leviosa!
but lets say its not a comfortable ride
hahaha ^^ very well. XD But can only be used by a playername 'Hawwy Potter' ๐
its meant to mess with players that dont behave at briefling
oooh sweet
essentiall it accelerates you in some direction....
My mercs are awesome. Everytime i say something like "Briefing" they form a line in front of me :3 And accelrating is neat
I normal say something like "This is front" ๐ behaved players are best :3
yeah i suppose the guys have good discipline, i dont think it will be used often.... but as i found out how it works, i wanted to accelerate stuff ^^
hahaha, hey, you can use it to make a futuristic weapon ๐ a 'blow gun' or some sort of.
well as i have just learned, its a good way to go about artillery scripts
so ill find use for a more controlled version of this
dont remind me of that, i have to make virtual artillery as well... blergh.
i might have mine done by next week if you are interested
always interested into learning stuff for arma scripting ๐ Ultimatively i write every single line of code by myself. But examples are a nice way to learn for me
also i will finally be able to toss grenades from sabres ultralight plane!
i want to throw grenades that have a mini_chute on them ^^ like huntIRs but thrown by people. Does not make any sens, but's fun to watch ^^
oh... wait... no!
fucking genius!
throwable balls that can look around!
overhead cluster explosions are not a bad idea. but i dont know about the chutes
a good question though where that minichute can be found. might have use for it
balls that look around could be possible but i never played with the camera things or UAV controls
hmmm, you could look up the huntIR grenade in ace, they have a mini-chute on them
or the huntIR interface
but i think there is a relatively quick way to take another objects perspective
yeah, that will be ballas to make. But imagine the possibillities of men-thrown grenades to watch near surroundings. High Tech to safe soldiers lifes :3
dont know if it only works for units and no idea if you can look around when its an inate object or if you are tied to the units eyeballs
i would do the camera style of the huntir but 360ยฐ
when i have my main bits done for the general battles, i might look into that
awesome ^^
@proven crystal private _minedresource = _this selct 0;
It is generally better to use params especially easier for beginners
so _this is not the actual value no. _this is the value you pass. If you pass an array, then _this will be an array
but _miningwork is a value, do i still have to select it in the new script with _this select 0?
See my example from yesterday showing how _this/param/params works
If you call/spawn a new script, yes
alright, good to know
There is not really a reason to pass an array with a single value. Might just aswell just pass the value instead
if i write a line of code more, that would be okay for me for now :3
yes that should work that only works if _minedRessource is an array. Which is not visible in that snippet.
_minedRessource is a value of 4 only.
Okey I arrived at the bottom of the history
yeah then it won't work despite Fetzen saying that.
_this select 0 doesn't work if _this is a number
just use _this directly then. Or use params
alrighty
here is that example that gnashes meant
1 call {_this select 0}; //error type Scalar expected Array
1 call {_this}; //returns 1
[1] call {_this select 0}; //returns 1
[1] call {_this}; //returns [1]
1 call {_var = param[0]}; //returns 1
[1] call {_var = param[0]}; //returns 1
1 call [params["_var"]}; //returns 1
[1] call [params["_var"]}; //returns 1
why do the last 2 both return 1?
same for th e2 before that
if there is only one argument it doesnt matter?
i guess my question is
[1,2] call [params["_var"]};
then _var = 1?
yes
a ok i think i got it then
and why exactly will that be better?
somewhere on the internet it says its more a matter of preference and performance would only be different at huge amounts of script running...
somewhere on the internet it says the earth is flat
ive seen that too!
it's better because it's shorter and easy to make out.
And if you have multiple parameters, at about 2-3 it is also faster than tons of _this selects
the world is a 20 sided die.
hmm... i kinda prefferred the use of private for readability... but i guess ill just try it out then
or do i still need it?
private _var = param[0]; ?
i guess not
what happens if i do?
okdokie
you wouldnt happen to know or be able to test how much of a difference there is between param[0] and _this select 0? just for curiosity
ah i guess ic an do that in the debug console
minimal
param does more than select
You probably won't need the performance gain from it
Params is slower than select but faster than old BIS_fnc_param calls
But the difference between params and select is suuuuuper negligible, and params is just a better method all around
Hello!
I use _asd = param [0, "Default", ["STRING"]];
Any one knows why if I create a rope, my friend doesnt see it until he creates a rope first? After that, he see my ropes
simple thing: use params for input args and be done with it
avoid param and select and generally spoken, using _this in any way
unless one knows what he is doing, if you need to think about this you do not, using anything but params is stupid
how do i point a rocket at a corrdinate? or generally change the azimuth i suppose?
is there an equivalent of getDir and setDir for 3D?
Have you tried this? https://community.bistudio.com/wiki/setVectorDirAndUp
@proven crystal
Anyone about thhe ropes thing?
@minor lance I believe (unsure though) that it depends if the from/to is local or not, to the server or not (a locality sync issue)
^ would be my guess. Spawn 2 vehicles from the server, don't get in them, try connecting a rope and see what happens
ah right thats what i was looking for
@winter rose The thing is,, if he creates a rope (locally),, the next time I create a rope, he sees it
I have a problem with the cloak function.
cloak function?
yes
My disappearance is not good
When using the cloak function, it works, but the algorithm does not disappear.
๐ค
sorry, but i can't help you, you need to explain your problem exactly and what is a cloak function? do you mean clock?
so you want to hide your player object?
and you run hideObjectGlobal on the serverside?
_cloakunit hideObjectGlobal _bool;
yeah but do you run the script on serverside?
No
I do not think I'll do it, I use a server ready to use Apex Framework.
ok ๐ , but if you want to hide your object for other players you need this command, or you run hideObject with remoteExec
[_cloakunit , _bool] remoteExecCall ["hideObjectGlobal",2];
client
I do not understand your meaning.
Then I'm afraid I can't be of any help to you.
I can not understand some words I try to learn.
Ok, I'll solve it in the ini.sqf file.
what could be the reason that G_40mm_Smoke gets stuck at a position where i spawn it, hanging in the air, and SmokeShell falls as it should?
not that it makes any difference which i use here, but id like to know
both are ammo
SmokeShell is a grenade or not?
at least both in the same column here https://community.bistudio.com/wiki/Arma_3_CfgMagazines
as ammo
have the same thing with flares, whats an actual flare round then that would fall?
F_40mm_White doesnt
btw the ammo doesnt need to be accelerated, just rockets should be pointed in the right direction ^^^
everything explodes just fine on impact no matter the hight
its actually a bit sad. i liked the idea of random unexploded ordonance. but maybe ill just stick to minefields for the time being
{
class RscProgress```
Can I use this translator more than once?
?
Is there any horizontal listbox?
so if it is of interest to anyone, the 40mm smokes and flares start falling once you give them a little velocity
no matter what direction, apparently they remain stuck otherwise
smack em and they will fall
Since Dedmen was so space-focussed:
https://imgur.com/V3W54NV - scantime for 1600kmยฒ map is ~4 hrs with 240 cities scanned, 24.000 houses safed in db, 85.000 building positions evaluated for cover, and 352 roadblock spots found on the road network. 7.1MB of sql data.
https://imgur.com/0l8Ilu5 - exported to a sql file, it's 5.2MB vs the 4.8 MB of array i exported with copytoclipboard before.
This does not include the 4 million random empty safe positions, that's running right now. Just finished debugging the above tho and had the first complete run without hickups. (yay milestone)
Hello
SystemChat "Cloak Active";
_Unit setCaptive true;
I run it on the server but it still does not work.
all the chat commands are local only
@ebon sparrow
chances are if you test the value of captive command on said unit it will return true, assuming _unit was defined in the first place
you simply don't see the systemChat because its running on the server only and client doesn't get told to put it into the chat
@velvet merlin what dialog needed? ๐
@velvet merlin do you have that table? It should be possible to convert all those formulas
@dim terrace was not shared yet. however the idea is to add some features ontop of the xls import
or what formulas do you speak of? does the sheet have some internal formulas for computations across fields/phases?
@dusky pier implementing it as a table seems a bad idea to me. way too restrictive
@meager granite can you name some limitations you think of or somewhere to read more about it?
@velvet merlin what are theses values you posted ?
The limitation is that you need to use controls already existing with ctrlCreate command. But if you need some control configured specifically you can define it yourself in addon/mission and then create with ctrlCreate.
@velvet merlin
No, the opposite, dummy classes are already there
But there are lots of properties that are not changable through scripting commands and there might not be basic control class with needed properties
In this case you might need to create control config to later create it with the script
well dummies with the desired functionality i meant
Yes
Unless you're doing something sophisticated, all dummy classes are already there
alright. lets see how this goes
https://i.imgur.com/0lGWY8o.png - Turned out to be 3.6 Million positions and 160MB. I apparently suck at extrapolating data. (I'll take it tho)
I'm scanning the map with a bunch of scripts and safe the data in an SQL database so i can spawn randomized missions with high flexibility.
this way i can define a requirement list for each mission and compare that to all the locations on the map i pre-generated, and get a list of suitable locations for each missions. also it cuts down on mission spawn time by like 3-5 minutes and allows some crazy stuff that would take like an hour to check but that now is just an SQL query.
160MB?
what on earth are you saving?
i guess he saves data about sectors to use it as cache instead of running stuff like isFlatEmpty and nearestObjects
all suitable positions he is saving
still
to get that to 160MB you have to do either a hell lot of duplicates or use the wrong data types
which might not sound bad but the moment you realize that less data means higher speed, you may find the problem
lol, but it's was discussed here for a week and now you like -- "you doing it wrong". So where had you been all this time? :3
i am less active in the #arma3_scripting channel for quite some time
and have seen the discussion partially
was not here whilst the "design" happened
@queen cargo 3.6 million positions.
46byte per position
I mean you can look at it from different perspectives: 1. execution time of the scripts creating it 2. memory required to save it ....
My priorities is: execution performance during mission run (currently excellent) and development time (quite short for my standards atm)
so i'm really happy ๐
3.6 million positions then sounds like too many
why?
40kmx40km => 1600kmยฒ => 1600000mยฒ => 1pos per 1mยฒ
i have currently 3 usecases in mind
- i want to spawn something really big, i can't be picky about the exact location -> i grab all the really big locations from db -> i get like 100 -> i do random -> i have my location
- i want to spawn something medium sized, i want it roughly in the AO area -> i grab a sector (1x1km) or multiple sectors (2x2km, 3x3km) and grab all positions -> i get like 1000 -> i grab a few random -> i have my locations
- i want to spawn something quite small -> i can spawn it almost anywhere -> i grab a subsector (100x100m) -> i grab all locations -> i get like 100 -> i pick one random
i was pondering if it makes sense to just do the small ones during runtime and blah, but this way it's all following the same pattern and i have a high degree of flexibility and ... idk i don't see the downside atm.
also your math must be a bit off, i check in a 10m grid. The map has 1681000000mยฒ so that's 16mio positions i check, and 3.6mio i safe.
Have you considered using mysql spatial datatypes? They should make the i grab a sector (1x1km) or multiple sectors (2x2km, 3x3km) part really easy
nope. didn't even look into it.
i did the sector stuff in SQF before i even touched SQL
it's trivially simple
it's 4 for loops cascaded. you take the map size, divide it by 1000, round it up, and that's your main sector row length AND row count. so your for-loop-number for two cascaded for loops. copy the same stuff for subsectors but with fixed amount of 10 each since subsectors are always the same in relation to main sector.
oh and at the end of each loop iteration you simply do like coordinates + (1000 * _i)
ยฏ_(ใ)_/ยฏ
genius, i know. GENIUS.
the most work was actually re-implementing BIS_fnc_findsafepos
it aborts early as soon as a check fails to shorten the time needed
@waxen tide uuh this is good
@velvet merlin that values in table - possible to get by script?
@dusky pier why use the table - for what benefit?
@velvet merlin
in the table - it is convenient to get as many values โโas you need. The script is easy to set the number of rows and columns. You can also use any controls inside the table.
well one can do that also easily by scripting that yourself, no?
the only real benefit i can see so far is scrollbars if the window size wouldnt fit
the easiest way is to do it through the listbox. the easiest way is to do it through the listbox, but if there is a lot of information, it will look like porridge.
it is quite possible to make any dialog exclusively through the sqf script. No hpp. But then some visual settings for the elements will not be available.
is there something like tag_fnc_isACE3 besides using if (isClass (configfile >> "CfgPatches" >> "ace_common"))
I could extract it to an own func but why reinvent the wheel eh?
if it is to check whether a script has been initialised or your own mod is in use you can just use a variable
which brings me to a quastion that i have regarding initialization order
i guess the objects initboxes are done before the init.sqf or init.server.sqf and that means i can never call functions that i specify through scripts? but i could execute the scripts
or i could use it to initialize functions even earlier?
for whatsoeverreason
"before the init.sqf " are supposed to yes
but init.sqf is like the least reliable thing ever
"means i can never call functions that i specify through scripts" no. preInit fires before them
CfgFunctions get's initialized just before preInit
and you should be using CfgFunctions for your mission functions anyway
hmhmhm
the preinit and postinit parameters there are only necessary if i want to actually call the function in the beginning yes? 0 means they are available but nothing is happening?
enabled meaning they are executed on mission start i suppose?
at pre or post init
tbh someone inside BI should write a new command replacing isFlatEmpty,findEmptyPosition and BIS_fnc_findSafePos. They're all weird as fuck.
PlayerConnected eventhandler, fire when someone connect to lobby or connect ingame ?
ingame
Just started playing with ropes, can I make it indestructible?
Becouse now it detached from cargo at some speed
๐ค
Say i have a compass angle, like 80 degrees. I want a value that is +90 degrees of that, and -90 degrees of that.
that would be 80+90 = 170 degrees, and 80-90 = -10 degrees
but -10 isn't on the compass
is there an elegant way to do this to ensure always positive numbers?
๐ค if (value < 0) then {value = 360 - value};
ยฏ_(ใ)_/ยฏ
if value is negative, you'll be adding to 360
so if value were to be -10, you'd have 370
360 - -10
exactly, just the other way around
if (value < 0) then {value = value + 360};
yep
t-thanks. I should get a cofe.
@tough abyss metal bars coming from the ground?
It seems like a silly question, but can I view the source code of "edit vehicle appearance" of Eden Editor?
@quasi rover \Arma 3\Addons\3den.pbo\fn_3DENEntityMenu.sqf
you can also view all the stuff in the config viewer inside of eden
thx guys.
Any takers?
๐
@velvet merlin Expanding upon ctrlCreate: ```sqf
NOTE: Since Arma 3 v1.69.141213 ctrlCreate will also search for control class in mission config, if search in the main config failed. This means one can now define classes in mission config and use them with ctrlCreate
@meager granite raised a good point. Example: One of the ListBox control types (RscListNBox I think) does not offer a scripting command solution to drawSideArrows - only when using .hpp method.
There are also a few others sadly. Really annoying.
@obtuse cosmos thanks! what means "hpp method" - do you mean mod/config.cpp vs mission/desc.ext?
class way yeah
I added a note on the Wiki
class blah : RscListNBox {
etc - You can use drawSideArrow here only - If I remember anymore, I'll update the Wiki note - I know there are a few more though
That isn't to say that you shouldn't use ctrlCreate as there is alternative - Use RscControlsGroup and create your own buttons - a bit extra work but more control I guess) @velvet merlin
are they are mods or missions with more complex scripted dialogs?
Yes, of course, are you asking me to name some?
Sometimes I use ctrlCreate for basic dialogs, it isn't just about complex dialogs - at least for me - If I create a server-side addon that runs on every mission for example, I have to use ctrlCreate
well with more complex i means various different types used, or multi stage dialog
Further more, sometimes you can ONLY use ctrlCreate - For example: ```sqf
// Snippet
_inventoryDisplay = findDisplay 602;
_uniformLoadText = _inventoryDisplay ctrlCreate ["RscStructuredText", 7111];
_uniformLoadText ctrlSetPosition [(15.1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2)) / 2)), (5.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2)) / 2))];
_uniformLoadText ctrlCommit 0;
say something akin to fully inventory replacement, or server browser in terms of complexity
You can have multi stage dialogs the other way but you would have to use createDisplay to show more than 1 along side
^^ that timing haha
๐
๐
Are you asking for general knowledge as a whole or are you planning something?
If you are planning, might be easier to advise / share more info depending onwhat it is
they fixed it?
hell yes
now my loops can actually sync with the server very nice
thats good
sweet
@tough abyss anyone have ideas on how to make โtrapsโ? like instead of always mines and explosives
Do you mean like 'nam punji traps or the like? I made some of those and falling rock/tree trunk traps for my groups vietnam campaign. (which helped me figure out stalker anomalies in the end as well)
All of them worked on the basis of triggers around them. Punjis had local triggers for every one, so it would sync correctly when someone steps into one. the falling tree trunk one was a server trigger which then spawned a camera that made an animation downwards with the log attached to it. (this was before the animation modules were added and frankly i still have no idea how to use them)
I am at work right now so I cannot send you some code examples right away.
@tough abyss looks like CBA can scrap their missiontime or whatever they have?
No.
https://community.bistudio.com/wiki/serverTime
Returns 0 in SP.
it is a janky solution, but hey it worked
especially becaus ethe tree trunk had no phyiscs
Yes. WAY too logical ๐
here is how the "punji" looked like, basically bamboo sticks but hey people steppe dinto them on mass
https://cdn.discordapp.com/attachments/258350600201306132/369226853162156062/20171015144644_1.jpg
does anyone know why BI chose to go client authoritative? that choice confuses me for a game that has a seriously heavy emphasis on MP
and is not much different since OFP
they should add that onto the list for arma 4
first thing i learned when i started to do server management and software development, never trust the client
even if they are trusted
"trusted"
oh well, game is good either way
Well I guess in a military simulation that will be "played" by trained Soldiers under supervision of military personell... You could trust the client.
i just wouldve figured after the commercial success of OFP, CWR, arma 2, they wouldve done something about it
dope
while i love being able to parachute cows, spawn aircraft carriers and control clients its not exactly the best for arma as a whole
@kju ArmA itself and SQF feels like a hack most of the time ๐๐
yep pretty accurate
as someone who fought lua at every turn for like 5 years, SQF is no different really
not having continue/break, little stuff like that really makes SQF restrictive, but i suppose thats where the fun is
Coming from web dev here
Maybe I just expect too much from SQF
After all, SQF is only a scripting language and has limits
that just comes down to the API being expanded, i have a fundamental issue with operations
like not having continue, thats the big one that comes to mind
Hello guys! Do you know how gun shooting in ARMA is working? Is it like a raycast? Or Particles ? Or maybe it's something else? Thank you
particles?
Thanks buddy)
that wasnt supposed to be an answer lmao
i just dont know what you mean by particles, do you mean literal particle systems or?
Yes
uhh no not at all
i dont even know what to say to that really
Ammo
I mean for example in unity particle system
if you mean a particle system, in no way do particles actually have to do with bullet behavior.
DM me - I will prove that it does
But not sure about performance
Yes, but how implemented? Do you know? Is it like procedural raycast?
Quicksilver - DM him with proof lmao ๐ ๐ ๐
im dying atm
How high speed is handled?
@vague blaze It spawns a bullet. And it flies. And velocity loss get's simulated every frame
nah dedmen wrong, its particles
It's basically a tiny airplane
Lmao
Nice scripting chat guys)
A fast aeroplane
Thanks @minor moth
a very tiny and very fast aeroplane without wings
no problem buddy
You could even call it.. A bullet.
alright im gonna go to bed before my lungs give out on me
thanks for the hearty laughs
Why ask if you claim to know?
Why kind of logic is that? Then you say DM me I have a proof
Btw you were talking about SQF stuff.
Enscript is about 1000x faster than SQF :3
You could call it. A tiny aeroplane without wings.
yall are killing me, good night
@tough abyss
^ regarding the AI "attackTarget" command, note this information is available already in-engine, visible in diagnostics:
How do you show these diagnostics visible in your screenshot?
Back to 1985 for A4! Or better 1960! Seriously!
Lol, does AI know how to throw hand grenades over obstacles (except 1 mission from DLC)? Guess no, so A4 should take place in early 1700s
thx dedmen
Hey, what purpose do vehicles with the class names "ArtilleryTargetW", "B_TargetSoldier", "LaserTargetEBase", "NVG_TargetE" have? There are also variants of those for the EAST and INDEPENDENT side. But I like to know what purpose these have, like the "ArtilleryTargetW". Will it make enemy artillery units if they can see this unit target it automatically?
I'd assume that the price or whatever it was
is set high enough for artillery to targe it
#arma3_config probably knows
Yeah that could be its use. Im going to try to test it a bit.
you can start arma twice ๐
is it going to write cfg files for me then?
well i now have a database full of map data
and i have a script that grabs all eden editor build compositions from the config file where they're defined
so now i'm writing a mission cfg file where you define missions with requirements
which are then matched to the data in db
and available compositions
to return a list of possible spawn locations (from db) for such missions
๐ค sadly nobody came up with good required parameters for such mission "blocks" i call them atm.
a lot of work ๐ท
yeah i'm offended too.
this game is 5+ years old, and nobody bothered to make a good mission for it! outright offensive.
so you are making something like 'here we can place HQ', 'this is a good place for an outpost', etc? just caching good positions for future reuse?
good evening everyone
today i wonder how i can let the zeus enter a condition throuch ares module stuff. the module is fine its more about the fact that i have to get an onbjetc variable into a string
im trying something like this
call compile format ["private _object = %2; waituntil {%1};",_conditionstring,_object]; ```
the user should be able to reference _object in the string that is enetered
and run something like "0>(allplayers select {(_object distance2d _x )< 50})"
so window opens, some stuff is enetered, and then the dude can enter a little string to suspend execution until that conditio is true
0>(allplayers select {(_object distance2d _x )< 50}) isn't going to do anything except error though
well thats why im here ^^
Also, unless you intend to give your Zues access to debug, letting them enter a condition is likely not a great idea
well achilles comes with such a module anyway. and its a safe user circle
nobody will mess around, who is not supposed to
Use global var and add params code in string
i guess until i have great ideas why i else i would suspend this one i could do it as multi selection but the question remains
hm ya a global var would be an obtion
but in general, how would i get that object into the string, because currently it errors there
or is there no other way than a global var for that?
@astral dawn I pre-calculate everything and save it because it would take way too long to do it at mission runtime
didn't find. In such cases i use code like:
format[
"with missionNamespace do {
private _this = call dzn_fnc_DynamicAdvDialog_getValues;
private _args = %2;
%1
}"
, _expression
, _args
]
Because object is always stored as reference. So it's basically 2 ways -- use global variable or use function call inside your expression
well this idea isn't new... look up tables, caches, etc, they are often used
but the overall thing you are trying to achieve is nice, yeah
@proven crystal why condition string? Why not let the user pass a function?
pass a function
Pre-made function for zeus? I think the idea is to create conditions dynamically. But actually - why don't create UI with few selectables and function to process them
No
You can write down functions
liek you know.. {stuff}
"call compile format" is basically always wrong. Whatever you are doing
it's wrong.
yea it doesnt look good either
"call compile format" is basically always wrong
NO U!
well i think if i let them enter full code, its more dangerous as if i were to just allos them to enter whats inside a check
although that would still allow entering code i guess
You can do whatever you want in a while loop
They could nuke the server, and then return false at the end and it would still work
Hence why I said it's likely not a good idea
You can attach (true) && in the begining of condition. so any statements that doesn't return bool (like commands) will fail execution
oh nice... ill add that
and add some BIS_fnc_inString check for "create" or "delete" keywords
They'd still be able to make their "condition" ``"false; {bad code}; false"`
how?
@waxen tide if you need to run your code once in 3 hours to make a new mission, and it takes even one minute to calculate something, consider if messing with the SQL server is really worth it
if("bob" in "bob is amazing") then {
}
Might as well use engine command than the function
well to just get back to the point, no one will try to mess around
@astral dawn You're like 3 weeks too late with starting that discussion
@high marsh engine command is case sensitive
my wuestion is more because atm a get this
toLower?
private _object = 14c092bab00# 1781086: helipadempty_f.p3d;
which obviously doesnt work
so how get that _object variable in there. other options that a global var?
Because as I said. Call compile format is always wrong
just to know...
private _condition = compile _conditionstring;
waitUntil _condition;
Done.
@proven crystal so how _object object is selected?
literally. That's it
@short trout Using the previous code provided, you tried to do something like sqf waitUntil {call compile format["(true && %1)",_condition];}; //seriously, don't use call compile to prevent abuse of the manually entered condition. If I made my condition ```sqf
_condition = "false); {//some malicious code here}; (false"
i was talking about call compile whole code, not _condition
Example
It hurt to type, trust me
Was illustrating how you could still execute non-boolean code with his original example (in response to - ) ```
DusinToday at 1:45 PM
You can attach (true) && in the begining of condition. so any statements that doesn't return bool (like commands) will fail execution
ok, whatever
You cannot make code safe. Unless you only allow a specific set of commands and variable names
and at that point you already know what you want the user to type into the condition field. So you might aswell just do it by yourself
so any statements that doesn't return bool (like commands) will fail execution Correct. They will fail AFTER they executed.
Great job.
Oh my
@ruby breach If I made my condition no
it's real problem to ban people!
(true && false); {//some malicious code here}; (false) doesn't do anything.
I guess you meant
{ some malicious code here; false}
Yeah, that (I'll be honest, I really didn't proofread my example since it's all bad code anyway)
Anyway, keyword filtering still an option.
well i dont really worry about that. achilles has a code execution module inbuilt anyway, which is way more comfortable
and im using achilles and the menu framework there anyway
@proven crystal
menu framework
What is it? https://www.myinstants.com/media/instants_images/maxresdefault_11.jpg
oh, ok, great thing
while {condition1} do {
waitUntil {condition2} ;
};
now in a situation where i am waiting for condition 2, will it keep waiting there even if condition 1 changes?
suposse then i would add something like if (!condition1) exitWith {}; into and right after the waituntil
nonsense... probably just waitfor condition1&&condition2
but i like to make things more complicated
will it keep waiting there even if condition 1 changes?
yes if condition is code and not a function call (and function was updated, but even then it will wait for cond2 and then will re-check cond1)
so it will wait, but recheck condition1?
so if (!condition1) exitWith {}; after the waituntil is nonsense?
at next loop step, like while always do
If condition is set as code like while { _o1 distance2d _o2 < 2 } do { ... } - you won't be able to update it afaik, only terminate whole script or use if () exitWith {};
If condition is result of the function call like while fnc_MyCondition do {} or while { call fnc_MyCondition } do { ... } - then you can try yo update condition by changing code inside fnc_MyCondition. But it will apply only at next iteration of while loop.
ya makes sense. sorry no idea why i was asking. im doing it that way in other scrits. just confused myself again
i wdont use waituntil often so i was suddenly wondering ..
As sort of a fantasy it should look like this (but not sure how deep and dark it is):
fnc_MyCondition = { true };
fnc_UpdateMyCondition = {
// function to update condition and re-set loop: { %newCodition%} call fnc_UpdateMyCondition ;
fnc_MyCondition = _this;
gvar_ConditionUpdated = true;
};
[] spawn {
gvar_ConditionUpdated = false; // flag that loop condition changed and loop should proceed to the next step
while fnc_MyCondition do {
waitUntil { gvar_ConditionUpdated || %customCondition };
if (gvar_ConditionUpdated) then {
gvar_ConditionUpdated = false;
/* go to next loop step */
} else {
/* actual code */
};
};
};
is there a way to detech if someone has entered/existed a virtual arsenal?
@edgy dune
_isOpen = uinamespace getvariable "RSCDisplayArsenal"
Hey all, I'm very new to SQF, and this one script has been giving me some serious trouble. I moved the functions addMusic, playMusic, and callResource to a different directory, and despite having no mentions or #includes in other files, I'm still getting the following error.
Script functions\Radio\addMusic.sqf not found.
This is the way the functions are defined in the description.txt:
class CfgFunctions {
#include "core\def\functions.hpp"
// add your own functions below
class PIKE_Radio
{
class Radio
{
class addMusic {};
class playTrack {};
class callResource {};
};
};
};
Thanks, if you've got any questions I'll try to clear them up as best I can.
you must define the path with file = "path";
class CfgFunctions {
#include "core\def\functions.hpp"
// add your own functions below
class PIKE_Radio
{
class Radio
{
file = "path\to\directory";
class addMusic {};
class playTrack {};
class callResource {};
};
};
};
if i use revealMine will that actally work to prevent ai to walk into mines that i want ghem to be their own?
@proven crystal It'll give them knowledge of the mine yes, if you give them a detector it should do the same thing
hmm.. is there also a way to prevent mines to blow up if the units that would triger them are of a specific side?
i really hate it when they blow themselves up. bad enough in cars
and as vcom is running, not much i can do to prevent them from getting waypoints in or across minefields if i were to use one
disableSimulation to prevent mine trip
hmm but then i need to check more or less continuously if players come close
Yup.
why dont these things have an owner like remote detonated onbjects. an ownerside at least
no its to make sure that AI dont get blown up by their own minefields
there may be a patch of mines between ai and players. ai tends to advance sooner or later and would be blown up by their own stuff
i either want to prevent them entirely from entering that area, which i dont see how i would do it, or prevent the things from blowing up
preventing them from getting closer than X meter to known mines would be good
i have another thing that is more of a mth riddle to me
i want to get rockets oriented towards a target
what im still missing is the angle for the altitude
i thought this might lead to some result
_pos1 = getpos _obj1;
_pos2 = getpos _obj2;
_a = abs ((_pos1 select 2) - (_pos2 select 2));
_b = _pos1 distance2D _pos2;
_c = _pos1 distance _pos2;
_azimuth = acos (((_b^2) + (_c^2) - (_a^2))/ (2*_b*_c));
i think my geometry skills are outdated
@pure blade Unfortunately that doesn't seem to have worked. Each function is in its own file, in the directory mentioned.
class CfgFunctions {
#include "core\def\functions.hpp"
// add your own functions below
class PIKE_Radio
{
class Radio
{
file = "core/fnc/radio";
class addMusic {};
class playTrack {};
class callResource {};
};
};
};
anyone know how exile and other mods can use more than waypoints
using shift left click?
@drifting dragon change / to \ and take a look at here: https://community.bistudio.com/wiki/Functions_Library_(Arma_3)
are multiple waypoints not a own feature of exile?
If u click meanwhile pushing shift
create a marker with the distance from u to this point
in exile or other mods can put more than this points
and i don't know how to do it
do u understand me?
i understand you, do you create a mod or a mission?
yeah but i think there are no easy ways for vanilla
i am not trying to do in vanilla
i have a mod
how can i do in mod way
thanks in advance@pure blade
i don't create mods, but for vanilla i would try this with onMapSingleClick eventhandler, createmarker and drawIcon3D
aham
I'm still a bit a noob with defining classes and inheritance and such. Maybe someone can comment if the variant with or without subclasses seems to make more sense: https://pastebin.com/N2p46N8V (uhg, that word wrap in github)
I think i like the one without subclasses more, less confusing (but more verbose). sensible defaults that allow obmitting unnecessary values seems to help with that.
i would do this with subclasses, i think it's cleaner because you don't write so much as without subclasses
yeah butt
i can imagine pretty much overwriting every single possible value in a parent class
with something from a subclass
which is a mess to later interpret in code i would figure :/
classes are great... maybe as you implement the code for each mission type to work they will help you, for instance, if you make common code for all 'crashed_something' missions
or are you going to write specific script for every crashed_xxx mission?
i don't think it's a mess to interpret in the code, AFAIK when you inherit from something, you grab all its default values
yeah but there will be some script to poll the success/failure conditions, maybe you could generalize it
idk what i'm going to do in the future
everything that's possible with reasonable effort and has been prioritized high enough, probably
hence why i want flexibility
but also no bloat
and nothing overly complicated
so i'm trying to figure out the granularity i want right now
That worked, thanks @pure blade
how do you calculate convoy waypoints? do you have an optimal path search algorithm?
yeah, A*
no problem ๐ @drifting dragon
I watched another guy make an A*, and it turned out some road segments are poorly connected in arma map itself
oh that's the guy I am talking about
yeah well you need to implement some contingencies obviously
you can't expect to always get a valid path back
but i got it to work for what i'm doing.
I do like a dozen A* path searches for each city i spawn roadblocks around for example
so you put a roadblock... on a nearest path between two cities? or how do you use A* in that case?
have you heared of planned assault?
no
search of an optimal plan by using hierarchical task networks... also uses A* for the plan... hope someone could use it for dynamic mission generation
i plan to use it for convois, ambushing players and such
but currently i only have a function to calculate a path for a convoi that makes sense (it gives the AI a waypoint at each intersection) (someone i work with requested that from me for a convoi script, but i think he hasn't really done much with it yet)
and ofc the roadblock pre-calculation.
roadblocks are pretty static tbh, like 243 evaluated locations, maybe 180 of those get roadblocks (because they're cities) and that results in 352 different roadblock spots. it's hard to find suitable spots with sufficient space on sensible roads with a script in the first place, randomizing them was my plan but i dropped it because i probably spend like 500+ hrs on that roadblock placement script and the reward isn't worth it atm.-
back to my old topic: i don't like the look of these subclasses. too convoluted because you have to overwrite parent values :/
Hello! Is there anyway to get the object created in RSCObject dialog?
Also, is there any way to load all proxy from that control object?
@astral dawn That stuff is interesting. I've shoved it into my todo list.
good AI in arma
i mean, how hard can it be.
allright, tell me if you succede in that
I tried to read more of this tech but such planners are super hard for me
Anyone know abou t the rscObject?
well, you are doing almost same thing, right? finding an optimal plan where to place yur roadblocks for instance. HTN is a way to generalize everything and use A* to find an optimal plan for many many situations
eh ... publicly available missions have .. disappointed the people i ususally play with. so i went like "how hard can it be" and looked into scripting. most stuff is still "hard" to me.
yeah, kinda. but i've split stuff into 3 parts:
- pre-generating (a lot) of data
- spawning static mission elements depending on server ressources and player count (i call it static, but it also has patrols and such)
- dynamic reinforcements (based on player interaction)
1 and 2 were kinda "done", i've just recently moved everything to SQL and have been doing the cleanup for that last few days. 3 is 80% fancy concepts 20% done.
planned assault generates one thing offline which then is always the same? kinda? i guess?
also i'll try to do something like EOS (enemy occupation system) and spawn a bit of life everywhere on the map, but only a tiny little bit to keep players on their toes (and obviously de-spawn it if no players present)
yeah, well the cool thing it can resolve more tactical situations like 'move infantry through forest and tanks through open field vs move everything on the same road' and it can solve pretty complex dependencies like 'before we go on with the plan, we must bring all the troops to the area, and for that we must bring a truck, but truck can't go there, so troops will walk, etc', it can plan very deep
yeah... well he shared some pieces of code in the attached pdf documents
yeah i've skimmed thru those
not an option.
gives Quiksilver a dog-treat
i've written up a concept that is basically: AI knows nothing. if AI spots and engages player, after time X, AI gives a report to HQ. the more time passes, the more accurate that report to HQ becomes. read: if players kill AI quick, HQ is clueless. additionally: HQ occasionally checks on their units, if there is no reply, search parties will be send out if units are available. when HQ has build a sufficient picture of the enemy, HQ will send availabe supports to engage.
that was precisely to avoid what you just said.
(so far just a fancy concept page in our wiki)
sounds nice
what i kinda noticed tho, it's hard to give commands to non-existing AI. so the "spawn stuff" scripts have higher priority on the todo (what i'm currently working on)
i've kinda ignored the 9001 AI threads in forums, haven't looked too deeply into ASR, VCOM konkzy's stuff or what's inside the latest I&A. it's all on the todo tho.
Has anyone ever thought of making a mod that makes reload the weapon only if the mag is in the tactical gilet? (Like EFT) (Sorry for the bad English)
Tactical gilet?
you can only reload when you are perfectly shaved
else the magazines will tangle up in your beard
Do you mean not being able to reload using magazines from your backpack until you move them to your vest/uniform @quartz blade?
While I totally agree with that, I've never heard of any mod that does this.
I still hope, deep i my heart, that someone at BI wakes up every morning terribly, terribly ashamed by the fact that ArmA doesn't perfectly simulate the magazine-bullet-chamber situation. And we can't even fill magazines bullet by bullet with mixed ammo types! A disgrace.
How will i continue my life without rainbow colored tracer in my magazine when i feel like it?
Can you store 2 separate bits of data in lbSetData ?
Sure. Data is a string
just put both in the string with a seperator inbetween
"databit1|databit2"
And then split it apart again using splitString
Alternatively, you could store your data in an array and then convert data to a string. Then just do _data = call compile (_ctrl lbData _index);
When you need the data
Provided it's formatted appropriately for the command, use parseSimpleArray rather than call compile
@west venture exactly, that I mean
doe !isNull (getAssignedCuratorLogic player) also return true for the adminLogged?
where i did not link modules to slots in the editor?
or is there anothercommand to check for curator?
can projectiles not get variables assigned to them?
are they not also vehicles like others?
๐คท๐ป
maybe they are like
simple objects
Because there are a lot of them, they won't have a namespcae
hm
I'd want to know what gun the projectile came from
But I can't assign a variable
:*(
@peak plover Do you want to know that because you want to be able to identify what gun killed a unit?
What is your use case for assigning the variable/EHs
Then you can just use either the HandleDamage EH or the killed EH.
Sorry, not killed. Killed only gives the unit that killed the other unit
No, I need to know the gun for every hit, not just killed
but handledamage / hitpart only give me the projectile
not weapon
hmm.. yeah. Maybe there's a way to get the weapon from projectile
Do you mean from the config?
No
multiple weapons can use the same bullet/projectile
Well perhaps you can use the source unit that HandleDamage gives you, then detect what weapon that unit is using?
_weaponUsed = currentWeapon _sourceUnit ;
unit addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
_gunUsedToCauseDamage = currentWeapon _source;
}];
Why wouldn't this work?
If you switch weapon after shooting?
bullets take time to travel
Handledamage fires on remote machine from the firer
Therefor the delay is big anyway
Maybe keep track of last shot weapon per player then use that in handledamage
http://www.armaholic.com/page.php?id=31562 Check this script out. it may help
Its a kill feed that outputs victim killer and weapon
It uses currentweapon in killed eh
actually, nvm. It has the same thing i was saying, so it won't work for longer ranges and hang times.
haha, too fast for me to type it out
I'm fairly sure that KoTH does what you're after correctly, so perhaps ask Sa Matra or Bobby Digital?
Found a way
I'll create a namespace and use the str _projectile
Last bullet would not work because what if I shoot 1 and it hits someone in the distance
Only issue is cleaning it up
because it would eat memory on hc/server
when you use forgetTarget , is there a minimum time before the target is picked up again?
Then just do _data = call compile (_ctrl lbData _index); @tame lion NO!
parseSimpleArray!
why this not working?
[fez_suppression_targets,{
{ _x addCuratorEditableObjects [_this select 0, true ]; } foreach allCurators;
}] remoteexec ["call", 2]; ```
fez_suppression_targets is an array
and they are known to the client
Maybe u need function (like bis_fnc_spawn) instead of call command. it might be restricted for remoteexec
i swas informed that BIS_fnc_call and so are kind of old and not needed
Unless you set up your own custom CfgRemoteExec restrictions and blocked call by yourself. It's fine
fez_suppression_targets is an array Yes. So _this select 0 what is that?
ARRAY select 0? returns an element from the array
https://community.bistudio.com/wiki/addCuratorEditableObjects wants an array though
not just the first element of an array
wait i have improved i thgink but still not work
{[_x,[fez_suppression_targets, true ]] remoteexec ["addCuratorEditableObjects", 2]; } foreach allCurators;
@still forum i was not aware of that command parseSimpleArray
[fez_suppression_targets,{
{ _x addCuratorEditableObjects [_this, true ]; } foreach allCurators;
}] remoteexec ["call", 2];
does not work either
add diag_log's
hey dedmen
I made a ๐ฉ
health_fnc_onFired = {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
private _varName = str _projectile;
health_firedNamespace setVariable [_varName,_unit];
health_firedNamespace_variables pushBack (_varName);
health_firedNamespace_variables_count = health_firedNamespace_variables_count + 1;
// check if the namespace should be cleaned
if ((missionNamespace getVariable ['health_firedNamespace_nextClean',CBA_Missiontime])> CBA_Missiontime) exitWith {};
call {
// set time for next clean
missionNamespace setVariable ['health_firedNamespace_nextClean',CBA_Missiontime + 5]; // todo bigger delay
// only clean if more than 200 variables
if (health_firedNamespace_variables_count < 200) exitWith {};
// delete amt will be 100 less than the total amount
private _deleteAmount = health_firedNamespace_variables_count - 100;
// loop through the first 100 and set them to nil in the firedNamespace
for '_i' from 0 to _deleteAmount do {
health_firedNamespace setVariable [health_firedNamespace_variables # _i,nil];
};
// remove 101 from the count (0 also counts)
health_firedNamespace_variables_count = health_firedNamespace_variables_count - _deleteAmount+1;
// update the variables array and remove the first 100
health_firedNamespace_variables = health_firedNamespace_variables select [_deleteAmount+1,10000];
};
};```
Dedmen
Do you know a better way to know which weapon the projectiel was fired from / assigning varibles to projectiels?
health_firedNamespace_variables pushBack (_varName); Why? You already have allVariables command
health_firedNamespace_variables_count Wat? You already have count command to get number of elements in array
update the variables array and remove the first 100 But you are not actually removing elements at all
See deleteRange
- allvariables won't update when i
nil - a variable is faster than
count select [_deleteAmount,10000]
that means from ex 100 to 10000
If you need the ordering to stay consistent. Try checking if namespaces keep order
allvariables won't update when i nil Wat? Should definitely update.
a variable is faster than count not by much though. count is also just grabbing a variable from the array's internals
3. select [_deleteAmount,10000] Okey so.. You think copying up to 9900 elements, is better than just deleting the first 100?
hmm
I'll check out the allvariables
Didn't know that about count
aah deleterange
Thanks
I'll check this all out
Microoptimizations shudders
not really
this runs every time a unit fires
it adds up to makro
@still forum
setvariable nil
does not remove it from allvariables
๐ฆ
The entry should become nil
wtf
Oh wait no my bad
We tested that a couple weeks ago because someone said variables don't get removed when set to nil. We tested, they were gone, he was wrong.
I just did setvaraible ['test',1];
setvariable ['test',nil];
hi guys. Im making a chase script for a vehicle. I want it to drive as close to the target as possible, but it always stops around 5-6m from the target.
Im using this command
_unit doMove getPos _target;
can I force it to drive as close as possible? 1m would be perfect
Have you ever seen AI drive?
yes?
Either they stop 5m away. Or they ram into you and explode
ramming would be better in my case hehe
but it cant be forced in my script somehow?
oh in that case.
Maybe just try telling them doMove to a couple meters infront of the target
hmm I was thinking about giving the move order to going past the target somehow, but the direction of the target shouldnt matter here
Didn't they eventually add a command to make vehicles follow a very specific path?
If that command worked you could make the vehicle move close and then switch over to manually telling the driver where exactly to drive
Sweet thanks. Gonna give it a try
Hello, is there any way to add a list of vehicles to a RscListbox? I've tried this for a couple of hours but no luck.
This is currently my dialog:
https://pastebin.com/dYj81JZH
This is my script
https://pastebin.com/PEdLzdvb
@plucky schooner place onLoad = "call mug_getNearbyJets;"; after movingenable=true;
onLoad - is display event handler not control
i get that i have the true in the end whenever i use setVariable, but do i also have to use publicvariable whenever i change publicvariables otherwise??
when i create it on the server as publicvariable and later change it on the client
i do this on server
if (isnil "fez_HQs") then {
fez_HQs = [];
publicvariable "fez_HQs";
};
and later on the client
fez_HQs pushbackunique _mobileHQ;
again do publicvariable "fez_HQs"; after that or not`
When you want to send the variables value away to others. You call publicVariable
@proven crystal try send client - server - client
i need variable i send that from client:
_cnt = count fez_HQs;
fez_HQs pushbackunique _mobileHQ;
if (count fez_HQs > _cnt) then {
[fez_HQs] remoteExec ["fez_HQs_fnc",2];
};
@dusky pier That didnt seem to work. But when switching to execVM it will display all jets nearby. How would I get the data when selecting "Store Jet"?
Updated Code:
https://pastebin.com/WZN0kT1M
@plucky schooner try that
@proven crystal on server send publicVariable again in fez_HQs_fnc
@dusky pier Im able to the vehicle list around me, but how do I get the value when I select it, and press "Store Jet"?
disableSerialization;
private _listBox = (findDisplay 99999) displayCtrl 99998;
private _index = lbCurSel _listBox;
private _data = lbData [99998, _index];
private _value = _listbox lbValue _index;
diag_log _data;
_data returns ""
_value returns 0
_index returns -1
@plucky schooner you can use when fill listbox sqf uiNameSpace setVariable ["VEHICLE_S",_vehicles]; and when used storeJet - sqf _index = lbCurSel _listBox; _vehicles = uiNameSpace getVariable ["VEHICLE_S",[]]; _veh = _vehicles # _index;
@dusky pier Managed to get data when pressing Store Jet. Thank you for the help!
@plucky schooner no problem ๐ good luck
Hey guys! I'm trying to find a rearming script for aircrafts, a script which can change aircraft loadouts when an HEMTT ammo is side the aircraft.
Thanks for help!
How do I make a light source not look like a spot light? Do I change the constant, linear, or quadratic
how can i get the string of what users write in the chat?
trying to do some stuff with a bomb and a disarm code
there is no vanilla chat event, but you can create your "own" eventhandler, you must find out the idd and the idc of the chat and the messagebox
@proven crystal CBA has a chat message sent eventhandler
or so if you play with mods
aye
Anybody know why this is working for units but not for turrets?
null = [(_this select 1)] spawn {
_Unit = _this select 0;
_Unit disableAI "MOVE";
_Unit removeWeapon "Throw";
[_Unit,{_this hideObjectGlobal true;}] remoteExec ["call", 2];
_Unit allowDamage false;
_Unit addeventhandler ["fired", {(_this select 0) setvehicleammo 1;deleteVehicle (_this select 6);}];
for "_i" from 0 to 1 step 0 do {
If (!alive _Unit) exitWith{};
For "_i" from 0 to ((Ceil(Random 50)) + 6) step 1 do {
_Unit forceWeaponFire [weaponState _unit select 1, weaponState _unit select 2];
Sleep 0.1;
};
Sleep (Ceil(Random 15));
};
};
Turrets wont fire
theres no way to clear a variable in those namespaces don't say that too loudly
no way with vanilla Arma SQF scripts besides deleting the object.
you mean.
can i generate class definitions with fancy preprocessor commands somehow?
like, automate repetitive things.
class rhssaf_fort_tent_001
{
#include "rhssaf_fort_tent_001\header.sqe"
#include "rhssaf_fort_tent_001\composition.sqe"
};
Like, get rid of the string that's in there 3x.
macros can do things. But #include inside macro doesn't work I think
i need to have these classes defined pre-init, so i can't generate classes with sqf code, can i?`
i guess a shell skript to generate such cfg from folder/file structure is easiest
no
it's the format EDEN uses to save compositions
(select a bunch of objects, right click, save custom composition)
i make very liberal use of compositions
larrow's script to spawn them is very handy
Is it possible to use a for loop inside of another for loop?
yes
why wouldn't it?
If you call a function in a for loop. The function doesn't know where it was called from, so why should the second for loop somewhere in the function that you call magically break without any visible reason?
thats a very good point you made
so tell me whats up with this script. sqf for [crate1, crate2, crate3] do { for [{_i = 0}, {_i < 5}, {_i = _i + 1}] do { private _ammo556 = _x addItemCargo ["30Rnd_556x45_STANAG",1]; private _smoke = _x addItemCargo ["SmokeGrenade", 1]; private _rndmLoot = selectRandom [_ammo556, _smoke]; [] spawn _rndmLoot; }; };
for [crate1, crate2, crate3] do wat
Well... If all crate variables rae of type CODE it should work
but you don't use _i anywhere
and where does _x come from
also you are missing the private's
Also addItemCargo returns nothing. What the hell are you trying to store there in that variable?
Why are you storing nothing in a variable
and then selecting a random nothing out of two nothings
and you cannot spawn a nothing
your whole code doesn't make ANY sense
And I'm 99% sure you'd have noticed all these mistakes by simply reading the wiki pages for the commands that you are missusing here