#arma3_scripting
1 messages · Page 345 of 1
https://community.bistudio.com/wiki/missionStart how about this for real time?
no
why not
try it out
thank you
according to comments on wiki it works as i would expect
Som ething was wrong with that. Dunno. But I know that there is no was to retrieve current real-life time without extension
@still forum you can get serverstart time and then work your way from there
But why does everyone say there is no way besides extension then?
Maybe cause doing it with extension would be less of a hassle
Or they do not know
Command was broken for longtime. Plenty of extensions that return time, offset times etc
The command is not broken, you can get serverstart time with date and everything
AFAIK
Pretty sure I used it the other day
It was fixed in arma 3 1.5 i.e it was broken for long time.
This Syntax: missionStart Return Value: Array - real local date and time (similar to date format but with seconds)
Then you know, you just plus the time on that and you are all good
However, using an extension is most likely the best way
Plus need to code handle seconds/minutes/hours/days/months etc.
Code if you want to use a different timezone to what the server is using
Just easier to just use an extension imo, prob will end up faster aswell
Yep
How would I go about adding an eventhandler to an object (curator module) that's spawned by a script?
Well add it where the script spawns it
I should've mentioned, it's part of an addon, ie in a .pbo
but, fortunately, that script does look for free curator modules and if not, spawns a new one
Hey guys, does anyone know if it's possible to set a scripted waypoint that is not the normal waypoint? Just the one you add to yourself when you click ctrl and then on map?
Alright @indigo snow the final nail's in the coffin this addeventhandler ["CuratorGroupPlaced",{params ["_zeus", "_group"]; {_x setIdentity "ZSEC"} forEach (units _group);}];. Thanks
Use count @outer scarab it's faster.
Stop this sillyness immediately
forEach is perfectly fine, you don't run the chance of unexpected behaviour, and for people new to sqf is 400% more readable
Using count over foreach is one of those "cool tricks"
It serves no real use
Sure, I can see that. However unexpected behaviour?
Return values for example
Count will error if theres a nonboolean / nonnil return value
Yes, exactly.
Cause it needs something to be returned for element to be counted.
Not unexpected behaviour tbf.
I understand why
Its just completely unecessary
Youll save a millisec over 10 years
I can see how for beginners it can be a bit wrong to use it, however IIRC it's like much much faster?
Its not
You only miss an increment
You miss out on _a = _a+1
As soon as you add code , so not an emptt codeblock, the difference is negligible
And if you dont keep in mind the return values of each command you can run into errors you might not understand
I swear every time people tell new guys to use count and its the silliest thing ever
Sorry for the rant
I should go sleep
Heheh, I understand what you mean.
It can be pointless, but for me even if it's saves me 0.0001 milliseconds I will use it, cause why not?
And yes, I should also go to sleep to be fair.
Because if it errors and you have to fix it, youve just lost more time than youll ever win with the foreach to count replacement
You make your runtime improvements in different areas, not silly ones like this
I'm not doing it for me to save time, but more the players playing the mission.
Like imagine using a loop in a OEF handler, then you would want to use count instead of forEach surely.
I am not writing optimal code for myself to save time, but rather for the performance of the guy who enjoys playing the mission.
Again it wont save them anything. If at 10fps you shave of 0.0001 ms, youve won 0.001 ms. Thats still a minimal fraction of the frametime
And if you do anything worthwile inside the loop, thats were you shouls optimize
Cache calculations and the likes
If you understand the traps of using count as a foreach, youll be doing fine, and i wont try and stop you or anythinf
But its a useless gospel to preach to people new to scripting
Yes, as I said - I can understand that it might be overwhelming for beginners
Is there a method for making an ai pilot slingload im just missing?
Tried that, but it insta slings :/ i was hoping to avoid scripting in extensive "when close, attach, now fly away" shenanigans.
Was hoping LIFT CARGO waypoint woulda worked.
hey set waypoint lift cargo
and since its not going to work straight away
just ( for example ) if distance is less than now set sling load
I have, setwaypointtype "LIFT CARGO", but it stays like 30m up and 20m away, very obviously not going in for it :/
Okay, moved the helipad object to an open field, changed wp type to land... flies to the same spot. My problem may not be with lift cargo...
"Lift Cargo
In Arma 3, this waypoint lets AI helicopters pick up vehicles that their helicopter is capable of lifting. The behaviour seems to be very inconsistant, and the AI pilots seem almost completely incapable of picking up the cargo or dropping it off (They have a tendancy to circle if other entities are nearby)."
from BIS
no your problem is with the AI
What is the Side for civilians? Like for Create Group.
Im trying to spawn in a civ pilot for the chopper, but cant without a center and group. So i have CivHQ = createCenter CIV, similar for civpilots and group
But its not creating the pilot anymore :/
just place a civ down and set its presence to 0
_civGroup = [args] call BIS_fnc_spawnGroup
no
spawnGroup doesnt work for civs but im not sure will have to look into CfgGroups
Hum, didnt think about presence... i did that but immobilized him, and moved him - helicopter moved to his groups position and hovers. Troubleshooting!
dont do it to the civ you want to manipulate
just place a dif civ down and then do the presence
he wont show in game
sorry im just taking peeks at my second monitor but i am trying to help
Thats as i did, but removing his presence stops the pilot from spawning :/
Its fine, youre a great help :)
At least gives me ideas to play with.
yea most of the times you already kow it you just need to bounce off ideas
i get that
one can get tunnel vision sometimes
so if you place a second CIv down and set his presence to 0 the first CIv which is the pilot wont spawn ? @manic sigil
I have a civ down as the side's center and group CivPilots. He's off nearby, hemmed in with boxes. The script creates a Huron and a civ pilot, added to CivPilots' group.
Now I'm just playing with having the pilot already spawned in, the 'screwit I'm done' option.
But now the waypoint deal ain't working right ;?
not sure
i would try
place a CIV down and set his presence to 0 to have a side center
then on script
_civGroup = createGroup CIV
then spawn in the pilot
and then assign pilot to group
ofc this is not clear as day
but i ope you get the picture
Yeah, I see what you're going for.
I'm just tantalizingly close but every change cascades into a hundred problems :/
HAHA
Scripting!
_wp1 =_grp addWaypoint [position Helipad, 0,1];
_wp1 setWaypointType "LAND";
I have a helipad named helipad, but the pilot just straight up hovers as soon as the helicopter is formed.
... Poop, I think I know what I did.
Durrrhurrr
I made the initial WP into WP 1, forgot WP 0 was a thing.
He was getting it cued behind his nonexistant starting waypoint.
I meant in the array - position helipad, 0, 1
I mean, it worked once... but then he flew immediately to the second waypoint I had right after that, bypassing the landing :/
And then back to his initial position.
Now I'm going crazy.
yea ? try MP scripting
Play As as the pilot... has a waypoint in the helicopter, so yeah, adding waypoint and setcurrentwaypoint isn't working :/
... and deleting the 0th waypoint works.
But then he flies to where I had the 2nd waypoint.
There is no code for the second waypoint, I deleted it for troubleshooting.
:wonk:
@manic sigil still having probs ?
@blissful wind yeah, abandoned it for now.
hope its only until it sparks in you again
.. am I crazy, or did they used to have "LAND" as a waypoint type?
no you´re not crazy
.... FFFFFFFFFFFFFF
Further dwon the waypoint type page:
With the new sling loading in Arma 3, 2 new waypoint types are added aswell being: Drop Cargo and Lift Cargo. The names for these 2 waypoints are:** "UNHOOK" and "HOOK".**
And it immediately starts working as planned.
Eh, just finnicky with the actual hooking. Base may be too cluttered.
im off @manic sigil good night!
@tough abyss https://community.bistudio.com/wiki/setVehicleRadar
@outer scarab just use https://community.bistudio.com/wiki/allCurators and add it to all of them
@indigo snow count vs forEach does not "only miss an increment" as you said. If you look at what count does you can clearly see that it increments something. The different is that count doesn't set the _forEachIndex variable. Which is setting a variable. Setting a variable means looking up if such a variable is already there. If so then update it else insert it. Inserting means hashing the name, finding the right place and maybe reallocating an array.
I have to agree thought that this is nothing for beginners. People who read the code performance guide can do that.
Bam, got your morning coffee out of the way? 😄 thanks for the extra bit.
I don't drink coffee.. I probably should start tho
Yeah I wouldn't know where to put that
I'm too deprived of sleep to even think about this shit now
What we ended up with works, maybe not perfectly (Due to our setup, there may be more than one zeus - allcurators would probably would work better for that), but it gets the job done for something that won't see much use anyway
Since the curator modules are created when someone's assigned a zeus though, wouldn't a script using allcurators have to loop to ensure new curators have the eventhandler added?
Or worse, run on creation of a curator (Which means more eventhandlers)
More eventhandlers is better :3 No scripts running needlessly
The thing with eventhandlers is I need my hand holding more than with needless scripts
I need my hand holding with anything Arma except playing it
@still forum +1
do you know any trick to acquire current solar azimuth?
i copied coords from cfgworld to a calculator but there are discrepencies up to 20 deg
squint That script is a little big to post here. Would recommend gist.github.com
sorry!
just name the file .sqf on gist and you will get proper highlighting too. Which your script here didn't seem to have
Like in the description, i can't seem to get the string for _DropRespectThreshold in line 194, it always gives out "any" but it's working for _DropRespectThreshold in line 64
getting it for _DropPrice, _DropType is working flawless - i'm a bit confused 🤔
Did you check what APOC_AA_Drops actually contains at line 194?
How can i check if control does not exist?
ah sorry i think i just expressed myself a bit wonky - what i actually wanted to say - if you look at line 80 _DropRespectThreshold returns the correcet value out from APOC_AA_Drops but if you look at line 239 _DropRespectThreshold returns "any"
APOC_AA_Drops =[
["Vehicles",
[
["Quadbike", "Exile_Bike_QuadBike_Black", 10000, "vehicle", 1],
["Offroad", "Exile_Car_Offroad_Red", 20000, "vehicle", 2],
["Strider", "Exile_Car_Strider", 30000, "vehicle", 4]
]
],
["Weapons",
[
["Sniper Rifles", "airdrop_Snipers", 50000, "supply", 0],
["DLC Rifles", "airdrop_DLC_Rifles", 45000, "supply", 0],
["DLC LMGs", "airdrop_DLC_LMGs", 45000, "supply", 0]
]
],
["Supplies",
[
["Food (small)", "airdrop_FoodSmall", 1000, "supply", 0],
["Food (large)", "airdrop_FoodLarge", 5000, "supply", 0]
]
]
];```
Yes.. Because the variable is not defined in line 239
It's defined in line 194, like _DropPrice is defined in 192 and returns currect value at 233
it was defined in a lower scope.. Scope exited so variable became undefined
((APOC_AA_Drops select _i) select 1) there are no two sub arrays
if you go over array bounds by one, doesnt it return nil?
the formatting is hurting my head a little
ctrlNull does not exist...
_ctrl isEqualTo objNull ?
what no, nigel
but how is it possible dropPrice wich is also defined in that lower scope returning the correct value, that's what i don't understand (not yet)
@peak plover https://community.bistudio.com/wiki/controlNull
its never defined in the main scope
so it stays private to the lower scope
see lines 175 - 179
theyre all defined except for the threshold
Drop price is not defined in a lower scope. See https://gist.github.com/anonymous/67642807179b10fa541b6fbb172083b6#file-droprespectthreshold-sqf-L178
theres also a few defined at https://gist.github.com/anonymous/67642807179b10fa541b6fbb172083b6#file-droprespectthreshold-sqf-L147
you gotta work with the new private keyword man
Thanks @still forum
just for my understanding of that, _DropType isn't defined either but returning the right val
hehe, sorry - i just overlooked _droptype - guess i need new 👓
i'll give it a shot - thanks guys, helped me understanding that stuff a bit more 😘
maybe rewrite //Initializing some variables to //Initializing ALL variables 😛
haha..well it's not my script i just trying to modify and make it running properly but tbh i didn't understood at all why it was written that way, seems a bit inconvenient to me (but hell, if its working)
@peak plover why not isNull it?
I have a planted claymore charge _charge which can be detonated by player or on timer, how do I detect when it explodes?
when it no longer exists
there can be other reasons for that
like defusal
i'm interested in detonation only
the handledamage event handler might work
@queen cargo hmm no luck
I thought it's ctrlNull, so for the stupidity of myself I couldn't find 😄
yeah, thx controlNull works
For some reason the blood effect from ace3 turned out to be controlNull sometimes, therefor players didn't see blood when bleeding...
Can someone tell me how to trigger a outro init? I tried initIntro.sqf but it doesnt trigger on intro start like described on the Wiki: initIntro.sqf | Executed when intro, outro win or outro lose is started.
Whenever you want to end the mission, call myoutro2.sqf. And in the end of that one, have endmission "END2";
checking
wondering as 1 + 2 could be rated higher then diag_log
if that is the case ... i got a problem 🙈
kk
diag_log is unary, therefore higher rated as the binary +
i know
still could be SQF magic
which made me wondering
if SQF handles diag_log special orn ot
but as it does not, this still is valid:
1.000000
ERROR: STACK UNDERFLOW
ERROR: TYPE MISSMATCH```
Math operators are special kind just like else
Foxhound international have a pdf with all the priority numbers
i know
still diag_log could have been handled specially
would need to hand-code that into my VM if it was
in case one is bored: i still need some SQF AST generator for C
current parser works perfectly fine for that project
just a few "edge" cases ... eg. [[1]] select 0 select 0 are not working
([[1]] select (0 select 0))
but that is due to wrong build sequence of equal elements ...
Quick question here, if i write a .h file for definitons and #include it in the description.ext would i be able to use these definitions across all of the new scripts i make or do i need to include for each script?
#include is only telling the preprocessor to append whatever is in that file
you could name it "my_long.ding.dong" and fill it with 8=====> and #include could not bother more
just that you then would have scripts etc. scattered with those lil tiny things
only thing you need to be careful is: if your included file contains sqf instructions (not those in the #define but as simple plain text) the config parser will complain and vice versa
Gotcha. Will the rpt tell me or will i have to do something further to diagnose a preProcessor problem?
you will notice
game will crash if the preprocessor is actually the problem
if the config parser encounters issues, game also will crash
only sqf wont complain until you use compile on the file (or execVm or any other way to give that file to the compiler)
Okay, thanks for the info.
@peak plover sorry, I didn't quite get it. If I do it like this is all from the myoutro2.sqf script executed at outro start? And if so, shouldnt the endmission be executed somewhere else but the outro init?
@vernal elbow end mission should be triggered by end of outro, but should be setup during outro execution in my opinion
oh no you got me wrong
in the editor you can select outro scenario intro... you know? and on endmission scenario it launches the outro - if there is one
We are talking about the endMission bis function right?
Hey guys, what exactly can Headless Client access? I would assume it can access server namespace?
And the server side addons?
@rotund cypress Headless client is just like any other client
besides being headless
It can access its own addons and it's own script namespace
It's a completly seperate client
I know it's a completely separate client
However, how does it know what it's own addon is?
Think of HC like another user
You tell it that via the command line
Users can't access the server namepace etc
I know what a HC is, what it can access is shady, thats all
A HC can access exactly the same as any other normal player client
@subtle ore I dont think it has anything to do with the way of how the scenario is ended. If there is an outro it will launch after mission is ended by any command/module
Also, if I want both server and HC to be able to remoteExec variables, do I just whitelist that on remoteExec as client if only HC and other clients, and then anyone if HC and clients?
Do you know @still forum ?
Nope
My guess is HC doesn't have remoteExec restrictions.. But I dunno. Never used that
I dont think it does.
You might be able use remoteExecutedOwner to check if its HC.
But i avoid HC, since when they break tends to be awhile till gets fixed
can one do some testing for me?
need to know following things:
typeName (for "_i")
typeName (for "_i" from 0)
typeName (for "_i" from 0 to 1)
typeName (for "_i" from 0 to 1 step 1)
if i am right, the first one outputs "FOR"
and the rest "ARRAY"
but also could be that all of that is "FOR"
my arma still needs one hour to download fully ...
sec
Intercept probably has most the info you want already
"FOR"
"FOR"
"FOR"
"FOR"
As expected by me.
https://github.com/intercept/intercept/blob/develop/src/client/headers/client/sqf_pointers_declaration.hpp#L1553 There.
from is a binary command that takes FOR and SCALAR and returns FOR
same for to and step:
https://github.com/intercept/intercept/blob/develop/src/client/headers/client/sqf_pointers_declaration.hpp#L2167
Wow, just now looking at this intercept project. How the hell is that even possible?
Impressive research. Any mods using it yet?
Nothing really public yet. I have my test Project implementing a part of LUA scripting and some performance improvements for TFAR. There are a couple guys building stuff. But nothing that is publicly used yet or out of experimental stage
Cool to see at least TFAR is going that direction
To be honest I did expect more projects to start popping up. Back when Intercept was still a WIP concept that didn't really work yet there were a TON of people showing interest and begging for it to become reality. Not it's there. Out of alpha stage and working good so far. And most of the people that showed interest in the beginning now don't seem to care anymore
Unfortunate to say the least
Intercept was developed by ACRE devs (before I joined atleast) and was planned to be heavilly used for ACRE. Which could benefit ALOT from it.
Kinda ironic that now TFAR is the first using it 😄
LOL.
is there a simple way to have a constant display of some variable contents on the screen ingame?
systemChat @waxen tide
alternative: create a dialog, display it as overlay (cutRsc) and run a spawn/pfe to update it in background
i know about that but i would like something that is really permanent
that sounds more like it, will research. thx
if i try to run a script that is already running, will arma run a second instance of it in parallel?
if you spawn/execVM then yes
whats the best way to make sure a script can't be run twice under any circumstance?
set a variable at start. And if it was already set then just exit
i tried that, but i failed to properly exit the script. i tried exitwith{}; is that the correct way?
if (<condition>) exitWith {}
exitWith is a binary command. It doesn't work without the if
No...
I just wrote the correct syntax
and as I said.. exitWith is a binary command
exitwith{}; is unary so wrong.
exitWith; is nulary so even more wrong
Why don't you just read? https://community.bistudio.com/wiki/exitWith
i did i'm just not very bright.
i don't want to execute any code, i just want to exit the script
i think exitwith isn't the right choice
Scripts are code.
Okey.. Then find another choice if you are sure there is a better way
if i were sure i wouldn't be asking stupid questions.
So. Do you trust yourself or someone who has years of experience with SQF?
I was confused because in the wiki it says exitwith exists the current scope, and i was under the impression the scope is whatever code i put in the {} behind exitwith. But apparently this is not the case, the whole script seems to be the scope as it is apparently being exited.
I never questioned what you said, i just didn't understand it.
yes. It exits the current scope.. Not the next one that might be opened somewhere in the future
inside the {} after exitWith is a new lower scope yeah
but the exitWith itself is outside
makes much more sense.
How many players can be zeus in any given mission?
12^10
na lil joke
probably something around 2^32
but i doubt your server will be able to manage that
Thanks, i know how to put it in, but AFK and unable to test if it has sone hardcoded "only two zeus per side!" Mechanic
does setPlayable in arma 3 work as of recent?
Can face= in cfgIdentities be an array?
Hi gents, I am looking for a way to turn an empty car's wheels by script. I tried animateSource, animate, even animateDoor on wheel_1_1, and some other selections, and IDK exactly what to do. Do you happen to have any idea here? Thank you
I can't really get anything from animationNames, all I can get is animateDoor with Door_LF/RF etc. I can't even trigger wheel disappearance, I am a bit out of ideas now
you would have to cover all the keys BUT this one I am afraid
BIS_fnc_holdActionAdd ( https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd ) takes a bool to remove on completion but if I set it to -2 (everyone but server) on the remoteExec i won´t be able to see the action button since it´s not a dedicated server. If I set it to 0 (everyone including the server) I see the it but in multiplayer it doesn´t remove the action. I ´ve tried to also follow it with BIS_holdActionRemove but no luck. Any ideas?
see AlWarren note at the bottom; it might help you here... else maybe publicVariable a bool that should be in the showCondition, hiding it instead of removing it (quick and dirty workaround)
Thank you @winter rose
np, I know how to dirt code ;-p
oh
yea i ´ve seen the AIwarren note
i ´ve set it to 0
the action is there for the server and for the client
run it everywhere, if it's on the dediserver it's not a big deal anyway
but there´s the bool true to remove but it doesnt remove the action on completion
its true for remove on completion and false for unconscious state
I don't know much more about the holdActions I'm afraid =\
i mean if its remoteExec
I may test it tomorrow if you ping me then
seems to be working in multiplayer but i need a client to connect since my friend is now away... but it´s working so far whereas before it wasnt
do ```sqf
oh there´s sqf
and finish with ```
yup i know just didnt know bout sqf
thank you @peak plover
0 = [DataTerminal,"Download mission",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"_this distance _target < 3",
"_caller distance _target < 3",
{},
{},
{[(_this select 0), (_this select 2)] remoteExec ["BIS_fnc_holdActionRemove", 0];[]execVM "somekindofInit.sqf"},
{(_this select 0), (_this select 2)},
[],
2,
0,
true,
false] remoteExec ["BIS_fnc_holdActionAdd", 0, DataTerminal]; ```
loooks prewwwty
i know "readable"
😛
i also just set the bool to false to not remove the action after the button is complete, and let the code execution do it´s thing and yea seems to be working in MP now
is it possible to overwrite the config of a weapon from withhin a mission script?
or do you have to do an addon
I have a trigger that spawns and equips a single enemy rifleman - can I have it spawn the rifleman at the trigger's location without naming the trigger, thus making it a simple (single) spawner?
I tried position this, but it throws a fit :/
Otherwise, a way to repeat the whole spawn and scatter them amongst several locations would be equally useful. At each location with "Rifleman" in it's name, for "_i" from 1 to 20 {spawn unit}, for example.
... Man, even just blunt stating it it's dumb, dropping up to 20 units at each location. Durr.
so all you want to do is spawn a bunch of soldiers together in one spot ?
i guess you put the code to spawn and equip the rifleman into the triggers init? rather put it in a .sqf file and simply call the file multiple times
Not all together, but spread out - filling a combat course without having the units spawned in at the start.
So players step into the entryway, it triggers the course to fill with enemies in predefined positions.
so the player progresses thru the combat course, and at certain points you put triggers that spawn a soldier?
well why not simply make an .sqf file that spawns a soldier with the equipment you want and then simply call it with the trigger and pass the position of the trigger as an argument to the script
i'm a noob btw.
That's probably a lot smarter than I'm thinking - I still am getting the hang of the concept of passing things to outside files 😛
it is a bad idea to copy&paste the same code into 20 different triggers if you can put the code in one place and simply call it. when you want to make a change, you do it once and not 20x
you can even define a function in the sqf script, that might be a good idea if you call it a lot.
might save some performance
Yeah, that's a perfectly valid point :/
if you look at https://community.bistudio.com/wiki/spawn or execVM, both can pass any argument you want to the script and you can access the arguments with _this inside the script. i would simply fetch the coordinates of the trigger inside the trigger init, and then call the external script and pass the coordinates as argument. then inside the script use the coordinates to spawn your soldier
and ofc do whatever you want to the gear
idk if spawn/execVM is the ideal command but it should work
t. noob
_SRM = [getpos this] spawn {"SpawnRifleman.sqf"}
SpawnRifleman.sqf is my previously functional script, but with 'position Rifleman' replaced with just '_this'
Feels like I'm messing something up, but then, still entirely new to script-passing so hell do I know other than it's not working with that.
i think you're passing the args wrong, but i must check myself how to do it.
ah, i found it
you need to use _this select X;
X being 0,1,2,3 ...
0 = first argument you passed
1 = second arg ..
position Rifleman = _this select 0;
so lets say _SRM = [getpos this] passes an array containing X,Y,Z coordinates, then _this select 0; contains that array as well inside your script. i think.
Ahh, I think I follow
I brute forced it (trigger that has five copies of the spawn and arm script with five distinct getpos markers) so I can fall back to that, but I'mma give that a try.
oh so you have one trigger that spawns all the soldiers at once on different markers?
then i would just uhm generate a list of all markers inside your script, and go thru them with a for loop and slap a solder on each position
you can do getmarkerpos inside the script, no problem
Yeah, passing the argument to the script with '_this select 0' in the position section, no dice.
Ooh, that's more like what I was originally thinking. How would I parse it down to just, for example, the Rifleman markers, the Grenadier markers, the MG markers etc?
uhm
well with allMapMarkers you get a list of all markers. so you need to write a bit of code to filter out the ones you're looking for. probably regex but thats black voodoo magic
Because that'd be the same, right?
_Riflemanmarkerlist = allmapmarkers blackmagichere
{spawn unit [type, _x, etc], equipment script} foreach _Riflemanmarkerlist
well yes
the blackmagic part is interesting tho
arma has no regex natively, but killzonekid wrote dlls for them. i think that might be overkill, but i dont know any simpler solution
Hrm... but aren't markers limited to the 2d plane? I'm not sure if I'd be able to have them positioned elsewhere, upwise.
Returns the position of a given marker in format [x,y,0]. Array element 3 (height above ground) is always zero.
looks like it.
if you want soldiers in some second building floor, you'll need to add a height offset if you want to place it with a marker
At which point I
I'd be back to hand-placing them :/
Well, hand-directing-the-spawn-script
well whats your goal, placing soldiers at exact locations or just nicely spread out in buildings?
there is some occupation script floating around that automatically places soldiers in buildings
Preferably exact locations. Dang. It'd be fun setting that up, or I could just brute force it in small batches of troops to keep server load down, and hand-place each gamelogic I'm using as marker (probably gonna regret that one too.)
0 = [DataTerminal,"Download mission",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"_this distance _target < 3",
"_caller distance _target < 3",
{},
{},
{[(_this select 0), (_this select 2)] remoteExec ["BIS_fnc_holdActionRemove", 0];[]execVM "somekindofInit.sqf"},
{(_this select 0), (_this select 2)},
[],
2,
0,
true,
false] remoteExec ["BIS_fnc_holdActionAdd", 0, DataTerminal]; ```
^^^ not working if me and a client are on, just when the server is on (me)
why isnt this removing the action ?
TIA
@blissful wind that wiki article is confusing https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd
Numbe is element 3 (starting from 0) but it tells you to get element 2
It should 100$ remove the action for you. Because of the removeCompleted parameter set to true.
Is it not removing it for both of you or only the guy that didn't activate it
OUUHHH I know
player1 and player2 will have different ID's for the action.
Let's say player1 has ID 5 and player2 has ID 7.
If player1 is done with the action it tells player2 to remove the action with ID 5. But player2 doesn't have such action
Hey all, I've been reading Killzone's farewell gift: http://killzonekid.com/farewell-my-arma-friends/
It uses a script to redirect players to a new server by expoiting UI
Does anyone have any idea how he found the displays to achieve this?
Because there has to be access to each button in the Arma 3 menu
And if we do, we could in theory make a player unwillingly exit his game
everything in arma is available for you to view. the server hop is a very cool script, in comparison its too easy to force quit someones game.
@atomic epoch Config viewer.
@still forum lol that wilderness? That is a solution, but a rough idea of where to start in config would be very usefull
@manic forge How would you force someone to quit thier game? I'm intrigued
for UIs i look in the actual config files in the ui pbos. find it easier to search for what I'm after that way.
the ways I have seen for force quitting a game arent exactly graceful. the one ive seen most is to include a file that doesnt exist.
ui_f.pbo contains most of the UI elements that you see in arma.
They allow for a moddable game, that's what arma is about!
@robust hollow Thats awsome. At least now I now where to start
A full conversion mod is possible, so that it changes the main menus etc...
@peak plover If you don't mind me asking, how would does one dig into ui_f.pbo with config viewer?
I can't find the name >.<
the config viewer shows everything from the configfile. it doesnt show it from which pbo it comes from.
ui_f.pbo refers to the pbo file in arma 3\addons
youd unpack the actual game pbo file with a tool and then browse with a text editor
the actual pbo itself that holds the config.bin
It's not illegal to unpack the PBOs. All DLC / expansion are release as EBO (encrypted). Those are illegal to unpack.
But in time they usually change from EBO to PBO, so people can make skins for guns etc.
Thank you all, your all most helpful
skins for guns
Or just see how that epic APEX mission was made 😄
csgoing Intensifies
From what I've read in the updates, BI has already converted the EBO's back to PBOs?
At least those for APEX
for older dlcs yea, not the newer stuff
apex is half pbo half ebo looking at my 1.76 rc,
But you are only allowed to use assets from arma in arma... Meaning you are not allowed to unpack, take anything and then use it in different engine/game. (as in port the weapons to Insurgency)
Yeah, I'm pretty sure missions are PBOs. So those can be useful to get some tips and tricks for your missions, to improve them 😄
@peak plover it's not really illegal to unpack EBO's afaik. Or do you have a link to somewhere stating that?
Well, they are probably encrypted for a reason...
Reason being, they don't want them to be extracted...
Yeah. So they can't be unpacked. But I didn't read anywhere yet that it is actually forbidden
Neat!
@peak plover - them spaces 😋
Probably looks good on whatever they edit configs with?
Notepad.
😮
@tough abyss them spaces
Macros.
Must be macros for their ui editor
It all makes sense now...
I was always wondering about that one..
@peak plover - Poseidon brother...
@still forum Thanks for the insight! Yes its surely confusing, I´m going to have to test some more until i get it right. Thing is, there is not much information out there about the function.
Hey all! Would someone mind telling me if a certain script I'm writing would work or not? I'm using a forEach within a forEach, and I'm really not too sure if it'll work out or not.
Anyone wanna see how awesome the code is you guys write?
Check out https://forums.bistudio.com/forums/topic/191727-script_sa-script-action-just-what-was-missed-in-arma-carrying-bodiesdragging-objects-ailoading-in-vehicles-getting-ai-in-squad-killing-enemies-by-hands/
I love you guys. I'm so happy you are here and not that guy..
Just post @spice kayak
Here you go! https://hastebin.com/qefulujuya.sqf
I tried to explain what it's doing at the top there.
I'll be able to test it in a few hours, but I wanted to write down what was on my mind while it was there.
(Edited a quick mistake, thanks to lazy copy/pasting)
Are the strings variables?
don't do ("m"+ _x) so often. Just do it once and store it in a variable
Otherwise I don't see anything wrong
2 for loops can be a problem if the inner for loop overwrites _x but that's not the case here as you never use the _x of the outer loop. Besides that one check before the inner for loop
Ah, sweet. That's what I was hoping for / worried about.
Eh, KK's server transfer annoys me, not for the code, but for the implications regarding security
The fact you can manipulate main menu UIs and do whatever you want to a user after they've left the server (i.e. delete their profile)
Oh god
Configure the view distance to basically 0
Set all graphics settings to the lowest
I can imagine the look on my face if that ever happens to me XD
Now I have to make it happen!!
I'm so conflicted, it should be reported as a security issue but the ability to transfer servers is such a useful tool
@zenith totem I have the same concerns. You could also make players join malicious servers. And do way worse things to them than just deleting their profile
I've never met a malicious server. What are they like?
I also didn't
Arma 3 Life perhaps?
XD You could count that as malicious yeah 😄 Not what I meant though ^^
@still forum I'm suprised KK didn't notice the risks involved
Or maybe he just didn't care since he's leaving, who knows
KK also didn't notice the risks when he gave full debug console access to anyone on any server
The big debug console security update. If you started your game with -mod=stra3_debug and just made stra3_debug an empty folder then you get debug console on any server
Battleye also doesn't do anything against it
Was fixed in a security hotfix shortly after I reported it.
Apparently KK never tested his security "improvement" and QA also didn't notice. Aaaand no one seemed to do code reviews on what KK wrote
is stra3_debug the internal name for the revised debug console? How on earth did that load it
no
there was a stra_debug console back in Arma 2. My guess is KK has updated that to Arma 3 for some reason. And his code checked if you load that Mod. And if you do it circumvents all security checks and gives you instant access to debug console anywhere
Ah, never played A2 extensively
After I discovered it to test it out I started my game with an empty stra3_debug folder loaded as Mod. Joined a 2 player russian Battleye protected Server. And could just setDamage 1 everyone on the server with one CTRL+V and a click on execute globally
I can already see that resurfacing in the future if they change something security related with dev console and don't apply the same to that
Won't happen anymore now that KK is gone
Unless they removed it entirely, it's still there and possible to be neglected
The bug was somewhat fixed... Kinda..
The tickets for that bug are still open because it turns out it is not really 100% fixable unless BI does a major change.
so KK left BI?
Yup
Quick question; triggers in an array wouldn't have quotes either, would they?
Nope
I'm an idiot. Thanks.
the variable is a reference to the object, not a name
Yeah, I realized that. I was just looking over what i wrote earlier and thought about it.
Actually, I don't think it'll work. Damn it.
Hmm, I'm really not too sure how to word this, but is there any way to get the _x value to draw from the array being used outside of the forEach statement?
draw?
In the script, I realize that the vmrkr lines would use the reconArray value, and not the vehicleArray, if that makes sense https://hastebin.com/ijuxopiveh.sqf
Yes!
then use private _outerX = _x; before you enter the inner loop
and then you can use _outerX
facepalms @spice kayak
facepalm is such a funny word 😄 It's like arschgesicht.. Guess I'm too tired again
Ha, it is.
Well, I got something to happen. Just not quite what I wanted haha http://i.imgur.com/ZEZQ3Dz.png
I'm thinking, with the way I've written the script, it'll only do one vehicle at a time?
Actually, you know what, that doesn't matter. I'll only need it to mark one.
You're probably far better off asking in ACE Slack
Will try that, ty.
I know theres gotta be someone who can quickly solve my mind from being bent out of shape here.
this script: https://pastebin.com/U7hJGitM
will spawn smokegrenades inside my hawk and produce smoke, but it creates a gap between plumes as it were and I was wondering whether someone can help me with putting in a timer for each group of 5 Smoke grenades. So I create a continuous ;ine of smoke instead of the gap type trail that is created atm.
http://steamcommunity.com/sharedfiles/filedetails/?id=1119823966
I was under the impression that you can create tasks that will automatically pop up on the screen with a notification? or do i have to script that manually with hint etc?
https://community.bistudio.com/wiki/Arma_3_Task_Framework
this page shows you all the relevant functions
@warped mist all your smokes spawn at the same time so the gap is more likely caused by the speed of the plane and the particle system being what it is
in any case, just put in a sleep between the groups I guess
Yeah had a feeling it was the simultaneous spawning.
I tried that. I keep getting a generic error message for the sleep command.
did you give it a number for the time it needs to sleep?
what was the error exactly? Something about suspension?
Just the sleep command and error generic expression
I guess you'll have to post your code with the sleep stuff added
and perhaps the error you get from the RPT
All I did was put the sleep command every other 5 groups of nades.
sleep doesn't throw errors unless you did something wrong and we'll have to see it before we can tell what's wrong ^^
Ok wait out
Ive added this coding to the init of cop npcs of what they spawn in how do i make it so this also makes 3 other addActions called Threat Level Amber and Red? so far when you hit Threat Level Menu it only makes the Set Level Green here is my coding https://pastebin.com/yHuby5zS the custom coding as seen in the pastebin did not work either
@warped mist back in a bit though, someone else will probably help you out
@halcyon crypt I'll pm you after restart it up
ive tested out just player addAction ["Threat Level Menu", {player addAction["Set Level Green",life_fnc_levelgreen];}]; on its own and it worked any ideas?
@indigo snow thx thats exactly what i was looking for
sleep (0.5);
nope still the same error
You cannot sleep in unscheduled
and I need to possibly do what?
I already run the script from execVM in the init of the plane in the editor.
so the options to turn smoke on and off are there for you at the start
Via this? https://pastebin.com/U7hJGitM
You create the smoke instantly, I'm not sure what action you are referring to
well i just tried part of your code just on a soldier and it works. i can't see what line you're getting an error on btw.
yeah it spawns smoke grenades right away on the soldiers position.
yeah it does on the plane too.
You had an issue, which somebody told you to use sleep for, and should technically be fixed?
Now you're referring to actions
Good attitude though, good luck 👍
It as plain as day I put in what was suggested, it still didn't work how I'd expect it too. I'm not referring to actions, I'm back where I started.
but thanks for your input!
your first post doesn't really help, obviously your sleep 0.5 lacks a ; and when i fix that that code part works fine.
Try adding semi-colons to your code
I see we all saw the issue at the same time 😛
I thought it was working when he said:
Spooky - Today at 6:20 PM
yeah it does on the plane too.
Curious, do attributes set through the Eden Editor override those set by the description.ext file? Like the Name, author, etc.?
reverse
That's what I was initially thinking, but it doesn't seem to be the case for me currently. Would settings within the description.ext (3rdPersonView, AutoSpot) also override server's settings?
Yeah, if I leave the attributes blank but have relevant information in the description.ext, when I'm on either the lobby role selection screen, or the map screen, the name would be 'missionnamehere.malden.' If I have both the attributes and the description.ext filed out, with different information, it'll use the attributes over the description file.
Ultimately, I'm not sure it's even using the description.ext file at all.
I'll add a loading image to see if that'll at least show.
Okay, having the image and adding it to description.ext results in the image loading, but none of the information or settings.
@vestal mortar https://pastebin.com/bZT3WLZQ
Sorry, last message; seems all mission information loads. The only things that don't load is the Scenario Name (for the lobby and map screen but not the loading screen), and the settings defined in there for the server (3rd Person, Autospot, weaponCursor)
certain BIS functions take data in the type of "side", like side west for example. how can i store that in a variable? if i just put the string "west" in a variable and then try to use that variable instead of manually typing west in the spot it doesn't seem to work at all.
How to change the side of USS Freedom turrets? ex: I want turret to be friendly to opfor and enemy to blufor.
Also no need to ask question in 2 different channels at same time
🤐
Some guys like me are real assholes and don't answer a question although they know the answer very well if people show not a sense of effort or patience when asking a question
It's not that bad because you now learned and won't do that again. Also Extension questions are better in #arma3_tools Because all the C++ Programmers are in there
I thought there was a extension_makers channel, but then I wasn´t sure where to put it
If you don't know. You still knew callExtension was a script command. So #arma3_scripting
@delicate totem thanks man
no.
downgrade your arma
legacy branch is 1.68 apparently
That doesn't change facts...
so not #arma3_scripting
Answer is not possible.
Does anyone here know the point of scripted eventhandlers? I.e. this function https://community.bistudio.com/wiki/BIS_fnc_addScriptedEventHandler
Always wondered why not just do a function instead
BIS scripted Eventhandler system
like CBA eventhandlers
This is a script implementation of eventhandlers. Just like CBA has.. Just way worse than CBA's code 😄
👀
But why would you ever use it?
Because if you want these eventhandlers there is no other way
event handlers? just use
//fnc_waitfor_event
[] spawn {
my_event= false;
while {!my_event} do {
sleep 0.03; // how often to check if event has fired
};
call fnc_something;
call fnc_waitfor_event;
};
😉
(constantly checks if player is close to the fish trader)
@peak plover Remove the sleep = infinite more performance
@peak plover well things like end game spectator changes? Arsenal opened and closed?
You would need to script those events afaik, this is just a tad easier
@tame portal more performance? What is the difference between with and without?
Hello. Anyone has a clue how I can have an AI jet drop bombs / cluster bombs in a scripted way so that I dont have to pre-place it but instead so that I can decide that when certain conditions are met, the AI automatically does a bombing run on the objective (both friendly and enemy)?
@subtle ore @tame portal was joking about performance
@subtle ore I did try that but depending on the terrain, the distance at which the bomb needs to be dropped is different every time
👡
we need syntax highlighting for sarcasm
Hahaha...
I mean, if I can get the plane to lock onto something with the bomb so that it is guided...
:(
@turbid thunder speed, distance, how heavy the bomb is. All factors that need to be conditioned. Iirc someone has made as script to calculate bomb distance
@peak plover afaik google deepmind has already done something like that
_group setBehaviour "SAFE" // sarcasm
{_x disableAi "AUTOCOMBAT";}count unts _group;
_group setBehaviour "SAFE"; // not sarcasm
@peak plover 😂
There's a zeus module for bomb runs ?
Also you could just script in something fake or try to remove all ammo from AI except bombs and disable targenting, assign a target manually...
@peak plover ewww....i would rather have ai act on their own rather than a player control it all
But you want ai to use a bomb...
A good alternative to skip past the scripting in arma 3 is to use zeus and just remote control and drop bomb yourself 😉
Elabortae 😄
Basically what I have to do is spawn a "laser", disable its simulation so it doesnt just despawn and have the pilot of the airplane target it
Though, I have to use fireAtTarget to actually make it drop the bomb
That works?
Yeah 😄
Whoa, great
But you still have to manually make him drop it but thats okay
Atleast the bomb will then be guided so it cant miss
Now I just need to have some sort of failsafe in case there is terrain in the way
Hmmm
Apperently the laser target needs to be the same side as the plane I want to use, so LaserTargetW for blufor, LaserTargetE for opfor, LaserTargetC for, civilian (yes that classname exists) but what is for i... ohwait mayby LaserTargetI is for indipendent?
nope
hah!
Well it isnt LaserTargetG or LaserTargetR either
I need to find out the lasertarget classname for indfor
Problem is that the airplane bombs need a laser to lock on
Exactly
Oh
OH I GET IT
i get it
I just need to place a laser target for whoever is hostile towards greenfor
Fun fact: The AAF spotter uses a laser designator that spawns LaserTargetW
does it appear in allUnits?
it appears in nearestObjects and I spawn it in as a vehicle
Addrating was a mistake
Side == UNKNOWN
hmm
Buuuuut its fine
ai does not target?
Yeah but greenfor will probably not be friendly towards both sides
So there will always be one lasertarget that I can use
createGroup sideEnemy?
Nvm I'm an idiot let me just correct that
Yeah, it's nice that it actually works
well
Group
I dont know what happens if I spawn it as a unit
I guess that'll be good enough
I think the limitation of not being able to use that with indfor units when they are friendly towards both sides is good enough 😄 For my mission I will only need two sides anyways so that'll do
I wish I had more sides sometimes... But then I realize that the times that more than 3 sides would be in open conflict is tiny.
It would be nice if you have gang or mercenary groups that are their own side, or have certain AI only being hostile towards certain players while other AI is still friendly with those players ect
But yeah, usually in conflicts you usually only have two sides
You have one side with faction A, B and C and the opposing side with faction X, Y and Z
Yeah, but that can be done by spawning them, just to give an illusion of more than 3 sides
is there any reason why example 3 from here shouldn't work anymore? https://community.bistudio.com/wiki/titleText (Error 5 elements provided, 2 expected and the xml? markup isn't parsed)
That command doesn't exist yet
We are still on Arma 1.72 feature wise
the features from 1.73 are not in 1.74 and will only be in 1.76
I know.. Just don't ask
okay. thanks.
Is there a way to get the index of the selection when using selectRandom on an array?
You could go back and use find if the array doesn't include duplicates
Otherwise I don't think so
well basically i want to output random answers from an array where all answers but one are wrong, and when the right answer is given i need to trigger some stuff so i need to know. I could just compare the string of course but comparing a long string seems bad for performance so i thought i would just compare the index and have the correct answer be index 0
Just generate a random number based of length of the array.
That way you already have the index value
Hell you can avoid rounding the number aswell, since select works with numbers with decimal points etc
i was about to do that but i was wondering about a more elegant solution
@peak plover Rating degrades over time, will reset after a certain amount of time. I believe setFriend is the best option
If I want to move in as driver into a vehicle, a vehicle in which I am a passenger off, is that possible?
I tried with both moveInDriver and assignAsDriver which both did not seem to work.
You can take into account that there is no driver in the vehicle already.
@rotund cypress doesn't matter who is the passenger.
If the driver seat is empty you suould be able to move in
player moveInDriver objectParent player
That does nothing when I am in the vehicle.
As passenger
Maybe move them out then back in?
Thing is when doing the action it takes about a second before I am able to move in the driver again.
Which will be a bad result for me.
Using moveOut command seems to work
And was instant
dang, I didn't know about objectParent thing...
Also, for the in-vehicle position: yup. moveOut, or setPos [0,0,0] then moveInDriver.
I have a question about animation, I saw in the Orange minicampaign that an empty vehicle could have its wheels turned. does any of you know how to do this?
[01:27] Lou Montana: Hi gents, I am looking for a way to turn an empty car's wheels by script. I tried animateSource, animate, even animateDoor on wheel_1_1, and some other selections, and IDK exactly what to do. Do you happen to have any idea here? Thank you
[01:47] Lou Montana: I can't really get anything from animationNames, all I can get is animateDoor with Door_LF/RF etc. I can't even trigger wheel disappearance, I am a bit out of ideas now
I will try with Simple Objects, it might be that normal objects are too tied to animation sources. if you have an idea, please share! I am out of any (:
I will let you know the results
to no avail.
I'm glueing an "addaction" to a group of units with foreach. How can i add a delay so that addaction can't be spammed on a single unit?
You can utilize the hideonuse command @waxen tide
But depending on what it's calling, you can have the function disable the action using the condition field by setting the condition to false and then enabling it again after x seconds in the script.
Anyone know some magic way to load in a given mission in Eden?
just wanna give in a mission name / path and have it load
@tough abyss i tried but it doesn't appear to do anything?
Is there a pastebin service with proper syntax highlight or is it okay to paste 60 lines of code in proper code block directly into the channel?
@austere granite maybe launchoptions?
There's a way. Same way kk did the server to server thing
hello guys. I got a problem
i want to despawn vehicles on a marker (or helipad?)
i used that code
waah
yea i'll have to read the mission tree in the IDD displays
pastebin
and then just check if text is okay with what i need
this addAction ["<t size='1.3' color='#00c700'><img image='\a3\ui_f\data\igui\cfg\Actions\unloadAllVehicles_ca.paa' size='1.3'/> Fahrzeug entfernen</t>",
{ private _vehs = (getPosWorld del_pad01) nearEntities [["Car", "Motorcycle", "Tank", "Air"], 6.5];
if (count _vehs isEqualTo 0) exitWith {hint "Nichts zum entfernen in der Nähe."};
private _veh = _vehs select 0;
private _vehName = getText (configFile >> "cfgVehicles" >> typeOf _veh >> "displayName");
if (isEngineOn _veh) exitWith {
hint format ["Bitte den Motor von %1 ausschalten",_vehName];};
if (count (crew _veh) > 0) exitWith {
hint format ["%1 ist nicht leer",_vehName];};
if (!isTouchingGround _veh) exitWith {
hint format ["%1 ist nicht auf dem Boden",_vehName];};
[5, [_veh, _vehName],{
deleteVehicle ((_this select 0) select 0);
hint format ["%1 wurde entfernt",((_this select 0) select 1)];
},{"Action abgebrochen"}, format ["%1 wird entfernt",_vehName], {true}] call ace_common_fnc_progressBar;
},[],6,true,true,"(isNull objectParent player) && ((player distance _target) < 7)"];```
3:24:21 Error in expression < private _vehs = (getPosWorld VVS_armored_1) nearEntities [["Car", "Mo>
3:24:21 Error position: <VVS_armored_1) nearEntities [["Car", "Mo>
3:24:21 Error Nicht definierte Variable in Ausdruck: vvs_armored_1
3:32:34 Error in expression < private _vehs = (getPosWorld VVS_armored_1) nearEntities [["Car", "Mo>
3:32:34 Error position: <VVS_armored_1) nearEntities [["Car", "Mo>
3:32:34 Error Nicht definierte Variable in Ausdruck: vvs_armored_1
what did i do wrong here?
i got an undefined variable at vvs_armored_1 what can be a variable here?
since vvs_armored_1 isn't a comand normaly and isn't called or spawned it is declared as global variable what did you want to do with this?
vvs_armored_1 is a marker that i want to check if there is a vehicle on it
have you declared vvs_amored_1 as a variable on the marker you placed?
did you change it in the mission file on the marker?
becuase if you only change del_pad01 it is clear why it can't work
yes for sure
check again since it is a global variable it should be declared and the error should not show up
so
i check
vvs_armored_1 is an empty marker
there is no init text in that marker
just the variable name
alright sounds good still would you have me a pic about the attribute site?
of the marker?
yes
sure
(i think "Variables" is the actual position of that marker on the map)
hangon doing screenshot
terminalAvailable = true;
publicVariable "terminalAvailable";
0 = [DataTerminal,"Download mission",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"terminalAvailable",
"_caller distance _target < 3",
{},
{},
{[]execVM "someInit.sqf"},
{},
[],
2,
0,
false,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, DataTerminal]; ```
is working correctly in MP (not a dedicated server)
Thank you @winter rose for "else maybe publicVariable a bool that should be in the showCondition". You are correct in your "quick and dirty workaround".
i know this way it shows even from far away but for this purporse the terminal is inside a room anyway
@blissful wind Dedicated and listen servers are two different things in terms of what is local to which machine.
I want to spawn a bunch of civilians and have them stroll around and on some conditions go into (individual) houses. should i have them all join the same group with a group leader or will that only cause issues?
If youre controlling every way they move by script, id group them all up.
I should make a game engine called uinty where everything is a uint32
@blissful wind I think you can also put a distance in the condition, or somewhere else in the params
@fallen notch if it's a marker then use getMarkerPos "markername";
When something is optional in a function, how would you skip over using it? I'm having a bit of trouble messing around with addAction. If anyone could help out, that would be great!
If it's optional and you don't need to set that argument (or one after that) just don't
Yeah, I got that, but it's if I need to set one after. Would I just write in what the defaults are?
Yeah
So consider the argument of format [one, two, three, four] of which two to four are optional. If you need to set three it would be [ValueOne, DefaultTwo, ValueThree]
so, for example, if I wanted an action only on the player and no one around, I'd decrease the radius, so I'd end up with something like player addAction ["Action","Script.sqf",nil,6,false,true,"",true,-1]; ?
Is that a real application of yours or is this just for the sake of making an example?
Sake of making an example.
Thank you.
You're welcome
Well, I've gotten it to work, minus the radius thing haha. I can still walk up to the unit that also has the script and execute it, which isn't what I wanted, sadly.
I've got the radius set to -1, which is what I thought would work.
The radius seems really broken. Use the condition to cheat by checking the distance between object and player.
Well I only want the action on one player, and for only them to have access to it. I'm not sure distance between object and player would work in that sense.
Ugh, is there an _array in _array ?
arrayIntersects seems to kind of do what I want; )
arrayIntersects removes all duplicates if you use the same array on both sides
and yes... there is an _array in _array.. It's called in
["a","b","c"] arrayIntersect ["a","b","d"];
//["a","b"]
I have a string stored in a variable and i want to create an array which has that string as name. I'm a bit lost how to do that. var = "array name"
@waxen tide setVariable
Took me ages to figure that one out
@peak plover getVariable
I've ran into same issue as asdfghj, but I can't remember why
I needed to save something that I didn't know what it was
and getVar/setVar wouldn't do it
you don't need to for setVar... It accepts any type
setVar [UNKOWN,_myvar];
that was my issue I thinnk
I think the variable and value were the same or sth...
But yeah, call compile helps
Thanks @still forum @peak plover i think i got it working
@winter rose yea, thats how it was originally with the distance in the condition. I just wanted to make sure it worked. I tried to add a second condition but there was something wrong with my syntax so i just delete the distance for now until i figure it out. only later because now i have to go to work. ttyl
np! cya
cya 😃
Can you concatenate variables? Like dir100 = 2, dir10 =0, dir1= 5, dirtotal = 205?
I know strings would work, just wrapping my head around converting it back into a variable :p a hamfisted way of selecting a heading using player input.
probably there is a better solution, but i guess that should work.
uhm
so you have like 3 selection menus where you can select 0-9, one for the first digit, one for the second digit, and one for the third digit ?
Yeah
just multiply dir100 input with 100, and dir10 input with 10, and then add dir100 + dir10 + dir1
Thats the plan at least.
2*100 = 200, 0 *10 = 0 -> 200+0+5 = 205
no concatenation necessary, just math
dirtotal = ((dir100*100) + (dir10 *10) + dir1))
Durf. Why do i always ignore the obvious t_t
When I add an action to a player, and it has "script.sqf" as the action, would that execute the script only for the player? I figured it might, just wanted to ask though.
hands ☕ to @manic sigil
Cuz somehow people think programming hsa to be hard
@spice kayak It executes the script for the one that activates the action
Thank you, I thought that might be the case. So, if in the script that is executed on the client, it turns out a light nearby. Would that light only go out for the client that executed the script?
I'm mostly confused because despite it being a client-executed action, it affects other objects.
depends on how you turn off the light
@still forum or i just pick an option that seems to work and ignore obvious easier solutions :p
Not going to lie, I copied and pasted this bit of code here; { for "_i" from 0 to count getAllHitPointsDamage _x - 1 do { _x setHitIndex [_i, 0.97]; }; } forEach nearestObjects [ pOperator2, [ "Lamps_base_F", "PowerLines_base_F", "PowerLines_Small_base_F" ], 100 ];
https://community.bistudio.com/wiki/setHitIndex Global effects.
So, everyone else would see it? :D
Urgh discord sending my messages multiple times. Forget about it shining, my discord didn't load the newest messages until I already sent one ^^
@tame portal a proper JTAC scenario, full 9-line implementation.
So that's interesting. With the code I pasted earlier, it turns out every light, except for one bulb on one type of light, as shown here http://i.imgur.com/o4J4dhR.png
I'm not entirely sure why, though I feel it has something to do with setHitIndex, or how it counts the hitpoints.
I'm slightly annoyed by the sloppyness of the BI maps. not all military places are marked as military, airfields are inconsistent, etc.
There's a lot of inconsistency in every element of A3 :P
Which makes me wonder if set/getDammage still works.
Okay, I fixed my issue, though now I have another one. The code works wonderfully to set the damage of the lamps to the point of turning off, then back on 30 seconds later. Issue is, if I shoot out one of the lamps before the script is run, the game will then repair the light when it turns on, because that's what is written to do. I'm not sure how to get around that.
@waxen tide what do you mean by the airfields are inconsistent?
on tanoa airfield locations have the class airfields, on altis they don't, they're under local
@waxen tide https://community.bistudio.com/wiki/allAirports
Is there a way that house is not destroyed by any attack?
You could constantly set it's health to 1 every second or so.
for "_i" from 0 to count getAllHitPointsDamage _x do {
_x setHitIndex [_i, 0];
};
} forEach nearestObjects
[
<GameLogicNameHere>,
[
"<TypeOfHouseHere>"
],
10 //Distance in meters from the logic to look for house
];
sleep 1;```
Not sure if that'll work. It's similar to what I'm currently working on, so.
maybe allowDamage works for houses.. never tried
I'm not sure on that one. You'd have to experiment with it.
I need this:
_pos = position vehicle player;
(count (_pos nearEntities [['Man'],15]));
``` to search for specific class names such as O_soldier_F rather than 'man' anyone got any ideas?
Is the curator camera saved somewhere as variable?
Aww, so I wrote this whole script about one team having flashlights that run on battery, waited til the battery drained only to find out that enableGunLights "ForceOff" doesn't work :(
Yeah, guess that could work. Was just a little gimmick I thought might make the mission a little more interesting, but it's not necessary or anything. Still having issues with the other gimmick from earlier, but I can't seem to figure it out :(
how do i mark up code in discord as sqf?
@waxen tide
three ticks sqf at the end of the first tick
then whtiespace,
then end with the other three ticks
systemChat "This is sqf syntax highlighting";
if I'm not making sense take a look at the css example : https://support.discordapp.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline-
For multiline code, use ` three times at the start and end.
_array = ["array_name_1","array_name_2","array_name_3"];
{
missionNamespace setVariable [_x, [1,2,3]];
_x = [1,2,3]; // how do i access this?
} forEach _array;
You got it!
there yo ugo.
thx
Code here
afaik syntax highlighting only supports multiline
Dom, look at the css example here: https://support.discordapp.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline-
Well obviously you didn't click the link initially, I was just bringing downwards a ways after some people had answered...
what's the "you'll be shot for pasting so much code lines" limit?
If you need to post a lot, use Hastebin. I love that site.
@waxen tide Around 2k
if you change the filetype at the end of the addess, it'll change the syntax highlighting.
_types = [["NameCityCapital", "ColorWhite", "Capital City"],["NameVillage","ColorRed","Village"],["NameCity", "ColorRed", "City"],["NameLocal", "ColorPink", "Point of Interest"],["NameMarine", "ColorBlue", "Bay"],["Hill", "ColorGreen","Hill"]];
{
_temp_list_name = [];
_temp_location = (_x select 0);
_temp_color = (_x select 1);
_temp_text = (_x select 2);
{
_temp_list_name pushBackUnique [_x, text _x, position _x];
} forEach nearestLocations [player, [(_x select 0)], 50000];
missionNamespace setVariable [((_x select 0) + "List"), _temp_list_name];
{
_mkr = createMarker [format ["dmkr_%1_%2", _forEachIndex, _temp_location], position (_x select 0)];
_mkr setMarkerShape "Icon";
_mkr setMarkerType "hd_flag";
_mkr setMarkerColor _temp_color;
_mkr setMarkerText format ["%1 - %2", _temp_text, text (_x select 0)];
_mkr setMarkerAlpha 1;
} forEach _temp_list_name
} forEach _types;
is this acceptable, or did i do horrible things?
Use params instead of select
Use privates
_temp_location = (_x select 0);
->
_x params [["_temp_location", [], [[]]]]
Okay, I've tried to stick together a solution to my issue from earlier today, though I'd have no idea if it'll work, so if someone could glance over it, that would be great. Basically, I'm using the suggest method of turning out all the lights in a certain radius, then turning them back on again. That part was simple. The harder part was keeping damaged lights, damaged. For example, if you shoot the light before using the script, the light will break, then heal itself once the script reaches the point to turn the lights back on again. That's not what I want. If it's broken, it should stay broken, which is why I've written what I've written.
Code here: https://hastebin.com/ikacivayag.sqf