#arma3_scripting
1 messages Β· Page 559 of 1
Thats the idea essentially
Just struggling to achieve it. This is my first venture with SQF
oooooof, you didn't pick the easy first project - but if you need help, we're here!
I'm probably missing something simple, but where do I change the bottom text displayed when loading a map?
https://community.bistudio.com/wiki/Arma_3_Loading_Screens says I need "config.cpp" but I'm not sure where to edit/create that file.
Do you mean the "terrain trivia" text @steady terrace? That would be by addon, nothing you can do by-mission
@winter rose yeah that's what I meant! Found it, thanks. Bit weird that maps are addons, but hey
well, it "adds on" the default game π
Can anyone tell me why this scipt for warlords give me error
how can i determine if the object returned from nearest objects is in front of player?
oh wtf i cant send the full script and i cant send t he file
Can i Pm someone my warlords script to see why its not working?
http://www.pastebin.com @tough abyss and then send the link here
ok
https://gyazo.com/1f6410a2e3901044a94c3ddbec82078c <-- screenshot of error i get when loading the mission (can load the mission but when i hold "I" most of the tabs (infantry vehicles naval) are gone
Mods im using are CUP weapons vehicles and units
How can I show HP using scripts?
I'm trying to work out a method to essentially have 'getDirTo' but for VectorDir, and while my current implemenation works, soon as any pitch is involved (like the vehicle is on a slope, and is doing a 180 on said slope) things behave incorrectly
currently i'm using
private _dirTo = _positionVehicle getDir _positionTarget;
private _dirVector = vectorDirVisual _vehicle;
private _dirVectorUp = vectorUpVisual _vehicle;
private _dirVectorTo = [sin _dirTo * cos _altitude, cos _dirTo * cos _altitude, sin _altitude];
which as said, works great on flat surfaces
Hello, do you know any trick for add addaction to my createsimpleobject p3d?
@ivory lake
_dir = (getPos _objA) vectorFromTo (getPos _objB);
_objA setVectorDir _dir;
Like that?
That is what i am sometimes using, instead of getDir
ppppht
damn you @jade abyss always come in with a simple solution that works first go
π
ive been racking my brain all damn day with this crap
+i think... the same should be working with vectorUp π€
(maybe using vectorDiff, instead of vectorFromTo )
Also: I hate Vector-stuff the most, so that's probably the reason, why i go for the easiest way π
I hate them too because I have NO idea what i'm doing with them
π
UH! Thx to you, i found a solution for one of my current problems π
Thx alot π
glad I did something????
hmmmmm I dont think vectordiff worked https://cdn.discordapp.com/attachments/423013172769849348/650966002364055552/unknown.png
Have you vectorNormalized it?
or was it vectorMagnitude? i can't remember.
gtg now, hl me, if you found something o7
nope just private _dirVectorUpTo = _positionVehicle vectorDiff _positionTarget;
i dont really need it so I probably wont mess around with it unless someone hands me it solved
vectorUp needs normalized stuff, iirc
OH wait, fromTo already gives normalised one
anyway, later o7
What's the best way to get the nearest road from a position? just nearRoads and then test the distance to each road and find the shortest one? :/
@ivory lake could maybe use https://community.bistudio.com/wiki/BIS_fnc_transformVectorDirAndUp
https://i.imgur.com/D2az9AQ.png well that's a new one...
text colour = marker colour
you can make two markers though
how can i show hp of people using scripts, i already know name and distance
But how can i show the hp :0
Reaper when you say hp, do you mean their current damage level?
like health of player
im asking how could i display this on the player
DrawIcon3d
killzonekid omg you are a godly script man, im a fan
i just dont know how to use drawicon3d to to this sadly
i love your blog man
There are 2 examples on wiki make it work then modify
how could i use that to draw the hp of players though (sorry for being a moron)
{ drawIcon3D [
"\a3\ui_f\data\IGUI\Cfg\Revive\overlayIcons\r100_ca.paa",
"colorBLUFOR",
(getPosATL _x) vectorAdd (_x selectionPosition "Spine3"),
1,
1,
0,
format ['%1 (%2m) %3', name _x, floor(_x distance player), damage _x],
2,
0.03,
"PuristaLight",
"center",
true];
} forEach allPlayers;
}];```
Altered something I'm using, you'll have to tailor it for your own use
Well, that made everything better
If you add sqf, right after the first 3 `-> Highlights \o/
Dscha, appreciated - between Reddit & Discord's formatting rules, I get lost
o7
appreciate the point in the right direction, i will *mess around with it at home π
Where the text goes put
format ["%1 %2%3", name player, 100 - round (damage player * 100), "%"]
Ah KK you spoiled my fun, I was looking forward to the 12-digit decimal place
Any help with this? https://pastebin.com/tw4hbBtj
Still can't figure out why half the menus under "i" in warlords disappear. Dont know this error either https://gyazo.com/1f6410a2e3901044a94c3ddbec82078c
You are sure all classnames are correct?
class CUP_B_M1A2_TUSK_MG_US_Army //Tusk 2 M1a2
{
cost = 7000;
requirements[]={};
};
missing bracket + semicolon, you pls use a better tab style
class B_APC_Tracked_01_AA_F
{
cost = 4000;
requirements[]={};
};
class CUP_B_M1128_MGS_Woodland //MGS
{
cost = 5000;
requirements[]={};
};
class CUP_B_LAV25_USMC //apc
{
cost = 4300;
requirements[]={};
};
class CUP_B_M2Bradley_USA_W //Bradley
{
cost = 6000;
requirements[]={};
};
class CUP_B_M1A2_TUSK_MG_US_Army //Tusk 2 M1a2
{
cost = 7000;
requirements[]={};
That are 5 different tab alignments, don't do that, nobody can read that without looking closely. @tough abyss
zOMG what he said!
@spice axle pastebin took my copy+paste wierd idk what i did for it to turn out like that i also just noticed the comments moved down a line for each one, ill look at missing bracket + semicolon when i get home ty for time
you are mixing tab and spaces
rgr ill fix it now
fixed but still getting some error when loading the game i dont understand
^^fixed the error in the gyazo screenshot but the issue of the diffrent tabs not showing in warlords (only gear amd arsenal still persists
If I get an error with something that spits out Unit C Alpha 1-2:1
is that referring to the first unit in Alpha 1-2? The "Unit C" thing is throwing some of us since we don't know what that means
yes
thats the name of a "unit"
Group is "Alpha 1-2", not 100% sure about the :1 might aswell be ownerid
alright. So the C thing doesn't relate to which specific unit in the group it is?
Not sure. Might be units description/name thing?
Do you have a "Unit C" in that group?
Give me a bit to relook at the mission we were testing. There may be one. Although it would have to be variable name since the normal "slot" name was pretty generic.
otherwise we have to wait for someone who knows for sure how that unit name is made up. I'm sure I knew it at some point in the past, but I don't anymore
Is it possible to set a ai squad's waypoints from a waypoint array?
If not how would you suggest I got about it?
Then you'll have to explain a bit more what youw ant
I have a squad1 with a set waypoints and squad2 without any waypoints. Is there anyway to copy and store squad1's waypoints and apply it to squad2 after a set amount of time without using copyWaypoints? Would I have to loop through all of squad1's waypoints to gather the positions and store that info (and maybe apply to a squad3 or 4) and then apply it to squad2's through addWaypoint or is there an easier way?
drawPlayerDmg = addMissionEventHandler ["Draw3D", {
{ drawIcon3D [
"\a3\ui_f\data\IGUI\Cfg\Revive\overlayIcons\r100_ca.paa",
"colorBLUFOR",
(getPosATL _x) vectorAdd (_x selectionPosition "Spine3"),
1,
1,
0,
format ['%1 (%2m) %3', name _x, floor(_x distance player), damage _x],
2,
0.03,
"PuristaLight",
"center",
true];
} forEach allPlayers;
}];```
{ |#|drawIcon3D [
"\a3\ui_f\data\IGUI\Cf...'
Error 0 elements provided, 4 expected```
^ I get that message when I execute in my test server
@worn forge any idea
"colorBLUFOR", I don't think it's valid
Yeah, my bad, shouldn't be in quotes, it's a global
drawPlayerDmg = addMissionEventHandler ["Draw3D", {
{ drawIcon3D [
"\a3\ui_f\data\IGUI\Cfg\Revive\overlayIcons\r100_ca.paa",
colorBLUFOR,
(getPosATL _x) vectorAdd (_x selectionPosition "Spine3"),
1,
1,
0,
format ['%1 (%2m) %3', name _x, floor(_x distance player), damage _x],
2,
0.03,
"PuristaLight",
"center",
true];
} forEach allPlayers;
}];```
yup, should do
Well technically it's looking for a four-number array, for [Red, Green, Blue, Alpha]
colorBLUFOR is a global that encapsulates that
but you could just as easily do [1,1,1,1]
yeah, i don't think that's the issue x)
getting the same message
I also tried putting killzone kid's
format ["%1 %2%3", name player, 100 - round (damage player * 100), "%"]```
to replace the sqf format ['%1 (%2m) %3', name _x, floor(_x distance player), damage _x] in yours
I'd advise removing the fancy stuff and building it back up
that script should be showing hp right?
should be
i wonder what the heck is the issue, lol
did you swap colorBLUFOR for [1,1,1,1] ?
ok, that worked. but it's only showing my own "hp". i say "hp" because it's either a 1 for dead or 0 for alive. and it's only showing on my player, not the npcs i've placed in this test
It won't work on npcs, because the loop runs on allPlayers
You can use allUnits for the test you want to do
what does getObjectFOV actually return? the size of the object on screen?
it might seem so, but I cannot confirm
a stupid question it's possible to disable radio chatter on planes/heli without disable radio between AI ? and it's possible to avoid you char scream so loud that can be ear by 2 km far when give orders?
Working on my deadzone fix mod and I'm trying to set the view angle of the player. I can do it with setVectorDirAndUp but that angles the entire body :/
Is it possible to manipulate only the upper half of a character's torso? It seems like it is possible to do so with things like vehicle turrets but i'm not exactly sure how to alter CAManBase (or if that class can even be edited?) to make the same functionality available...
Is it possible to manipulate only the upper half of a character's torso?
no
:(
Is there any way to move a static object x meters in a direction?
I might just add this to my mod with a little 'this looks awful in third person do you really want to enable it?" checkbox :/
Is there any way to move a static object x meters in a direction?
uh setpos?
doesnt this just teleport the object?
uhh maybe that
I'll check
seems tricky but it may work
Asking for a friend.
We are looking to script a working ECM Backpack that can disrupt the activation of IEDs while also blocking radio communications, needs to be able to be toggled on and off, testing so far he has a somewhat working script but radios do not work at all and sometimes IEDs still trigger, we use ACRE2, any help would be appreciated, for more details I can pass on my friends details.
This is for a British Milsim we are in.
For ACRE you already seem to found a solution, which probably needs some modifications.
For IED's it's relatively easy: simply disable the IED when jammed:
_enitity = [explosive object];
// disable simulation = disable triggering
if (isMultiplayer) then {
_entity enableSimulationGlobal false;
} else {
_entity enableSimulation false;
};
and, in case you use ACE3: https://ace3mod.com/wiki/framework/explosives-framework.html#53-detonation-handler
Something that I found out while trying to do the same, with the addition of failing to jam IED signals, was that I had to run event handlers on the explosives instead of the item. Otherwise you might have 2 people trying to jam and get very strange results π
Anyone got any experience with using onDestroyScript on particles?
I need to pass parameters to it but it only lets you specify a script name, whats passed to that script is set (just the position of the particle)
I've tried setting up a queue system where it takes the latest parameters from an array when the script runs but this is unreliable when multiple instances of the script run.
does anyone have any better ideas?
how many particles you have? you can make script1 to scriptN and depending on the particle call this or the other script and call your function from each script but with param, you know what I mean? @ivory lake
Not the most elegant solution but it will be reliable
unlimited, I ended up just using a vehicle instead of a particle
ThingX to be specific
I attached a platform to a vehicle with attachtorelative
if I use the vehicle as anchor the platform becomes untouchable by other vehicles
if I use the platform as anchor the vehicle becomes unuseable
any way to solve this?
Well if you update the position of the attachment on each frame, it should work ok
Unless it lags by one frame
Might look ugly on clients, I am not sure
its for sp
well then go ahead and try it
of course you will have to run the model to world position and rotation transformations as well
thankfully SQF has such commands
to save on performance I could update it only when player enters a specific area
but how do I do that?
I am not even sure if my method works
maybe I can find a way to limit how the attachtorelative works
you will not have collisions on object when using attachTo, get/setPos seems like ok solution in SP.
In MP it could lag and generate a lot of trafic.
I can't seem to understand how to use them correctly
what I'm trying to do is to use said platform as a bridge, so I need the collision, which seems to work when walking but not with vehicles
Okay, so you have an _object, when you attach that _object to another _vehicle, the _object has no collisions with other vehicles
so as workaround we suggest to try to NOT use attachTo command
but instead make an onEachFrame event handler, which does setPos/getPos
to teleport the _object every frame
oh I see
so fps will become a must
no, what makes you think so?
you are not going to have 1000 of such platforms, are you?
Anyway, Arma Script Profiler will help you see the slow parts of your algorithm
But generally you can use the 'performance test' button in the console to see how much time it takes
oh no its just 4 floating boxes
though that with this system objects would feel laggy when the framerate lowers
just realized it doesnt make sense
though that with this system objects would feel laggy when the framerate lowers
why?
Oh you mean if their positions lag by one frame
Yes but I am not sure if they indeed lag by one frame in that case or not
Need to know how engine works
so I did some tests and I've most likely done it wrong
used
BoxA setPosWorld getPosWorld car;
didn't expect to work flawlessly but hoped it could at least fix boxA on the same position as the car
How does it work when run on each frame then?
it doesnt
I hope someone more capable than me manages to find a solution for this problem in the future
as for now I've just used a disgustingly cheap and easy trick
I'm simply activating the attachto only when the player enters the vehicle, and detaching when he gets out
https://imgur.com/a/SI96F5T
Anyone else having issues with the wiki? I'm trying to look up some variables n what not but its giving me 502 Bad Gateway.
yup, known problem
I needs some dikcodes from it π¦
@tough abyss What code?
(uiNamespace getVariable "RscDisplayMission") displayAddEventHandler ["KeyDown", "systemChat str _this"];
One of the values in array should be the dik code of the pressed key
(not sure if works, typed from phone)
I found it finally, I was looking for numbpad codes, but i found one that was for number 1 and i just went up from there.
_xx = _vec # 0;
_vec set[0,(_vec # 1) * -1];
_vec set[1,_xx ];
Is that the fastest way to rotate 2d vector 90 counter clockwise?
Guessing it is
bohemia is down for me at the moment so is there anyone willing to share a script that would allow me to loop through all animations and play then on a player? just trying to create a handy script for finding animations
@exotic tinsel animationNames will be of help
yeah i cant access bohemia at this time to look that up. i will make a note of it for later. hoping someone has a script i can work off of until the site is back up.
If you can play anim with playMove you can just execute them all at once and they will play one after another
Is it somehow possible to give agents waypoints directly?
Or do I have to write my own "waypoint system" by telling the agents to move to A, when they are near A to move to B, ...,when they are near N to move to N+1.
Hello, i having trouble to find an array where i can define a vehicle as an ace-medical-vehicle (_vehicle setvariable ["ace_medical_isMedicalFacility", true];) . Before they moved the acesettings to cba you could simply write them in an array in the medicalmodule, i find nothing about it in the cbasettings.sqf
Anyone can help?
double click the vehicle in 3den
@still forum ty, i saw that allready. The Problem is this will only set this specific vehicle to an medfacility. I want to define a vehicle ones and spawn vehicles during the mission with the var allready been set, like how it worked with the module.
is there no cba setting anymore?
Could use initpost eventhandler to set the variable, but no time to explain that
Do you mean a class of vehicles?
@digital hollow yes i do
hi how can i get the current opened container / weaponholder when player is in gear ?
@digital hollow ty
@sonic linden Get it when it opens https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#InventoryOpened
Sometimes when i change the fog via setFog i get a white line across the screen and don't see the actual fog. Some things can fix this issue, like for example going into Zeus and then out of it again fixes it. What is causing this and how can i prevent this from happening? Could it be, because i change it with a serverside script?
https://imgur.com/a/M6h1BWE
I guess there's some script which messes it up...
and based on the screenshot there are a lot of places where it can go wrong
That was during a play session. I also did some testing with only northern fronts terrains loaded in an empty mission and it still happened.
and if you test it in a vanilla environment (so without any mods)?
I could, probably should do that. But i was told this isn't a new issue so i hoped someone had a quick solution or at least some information on it.
The problem is that this happens very unreliably, so its a bit annoying to test. But i will try it on a vanilla map without mods loaded again a few times till it happens.
I know several issues related to fog, but never saw this one. And setFog should be executed on the server, so that won't be the issue.
Yeah that is how i did it.
The only thing which currently comes to my mind is that a mod/script is messing with the fog settings of the terrain(s), which causes this glitch.
I also only had it happen on server, never when i host the mission myself. Which is why i assumed some locality issue.
Hello, do u think it's possible to store a var on inactive user profile with profileNamespace command?
none that I know of
that would be a security issue, e.g being able to corrupt all the profiles at once
thanks for your response.
I've seen issues with setFog before, owing mostly to how Bohemia works fog. If you haven't read https://community.bistudio.com/wiki/Arma_3_Improved_Fog it's worth playing with those variables. Essentially the base of the fog can interfere with the height of the fog as time goes on, and the result is a weird horizontal line. It's more obvious with heavy fog, so just don't go crazy with the values and you should be alright.
I'm using the following line in a script:
if ((difficultyOption "thirdPersonView") == 1) thenο»Ώ {
// some code
};
However this gives the error:
Error Invalid number in expression
I know that difficultyOption returns an integer (and in this case 0 or 1), and even when I make it a string (using str ... == "1") it gives the same error...
π€
ikr
the only thing I can image is that the value is not set/available yet... since the function which I have this in is called through Extended_Init_EventHandlers
Same result on Dedicated Server.
Maybe a line earlier?
Mod-Issue then
Command works as expected in Vanilla Β―_(γ)_/Β―
(still don't know how π€ )
I know the command works, I did the same tests π
Just a guess: It probably get's loaded too early
It's part of a mod, however the script should only be called when a MP mission is running (and needs to be called from the mission).
So technically it should not call before that... and at the moment it already returns the error the moment I start the game...
// works
((difficultyOption "thirdPersonView") == 1)
// error
if ((difficultyOption "thirdPersonView") == 1) thenο»Ώ {
hintC "test";
};
^^ in debug console
gonna start arma again
if (difficultyOption "thirdPersonView" == 1)then //wΓΆrks
{
hintSilent "test";
};```
with extra brackets = wobblewobble
wobblewobble such as no worky worky?
hmmm.... seems I had some kind of weird hidden character on that line which broke the script...
I use Atom π
heh
I really should stop copy and pasting code from others...
because that's where the issue came from
βοΈ yup, a thousand times yup
it happened to me with some wiki code, that was not using the usual quote "
I looked for some time indeed
I remember, there was a greek ; that was a , or something
That too, it's a known joke now amongst devs :p
https://www.fileformat.info/info/unicode/char/037e/index.htm
How to troll a C# programmer: Replace a semicolon (;) with a greek question mark (ΝΎ). Then sit back and enjoy the black despair.
Get the complete details on Unicode character U+037E on FileFormat.Info
unless they use GitHub of course
so... another interesting question: Is it correct that isClass only returns objects which have scope = 2?
In other words, for a class to exist, it needs to be public?
Because I don't seem to be able to identify the class when it's protected
have you tried https://community.bistudio.com/wiki/BIS_fnc_getCfgIsClass ?
same result... although expected... searching in "CfgWeapons" when the object is in "CfgVehicles" π€¦ββοΈ
always a bad idea to do bug hunting when tired
so... another interesting question: Is it correct that
isClassonly returns objects which havescope = 2?
No, isClass returns true if the argument is config property defined with keyword class
Does someone know why I cant seem to be able to turn on support for CBA variables and functions in: https://github.com/Armitxes/VSCode_SQF
Also, is there a plugin that is useful when editing .cfg in visual studio code?
is there a function i can call that does what the orient to terrain does in the eden editor to fix these objects?
https://imgur.com/Zx3oz3a
surfaceNormal
@digital hollow thanks mate!
Q: whenever you see curly braces, i.e. {}, these are just functions, correct?
along which lines, I wonder if this makes sense:
_caseOneCallback = { /* ... */ };
switch (_x) do { case 1: _caseOneCallback; case 2: ... };
Or would we need to still provide the switch body, i.e. { [] call _caseOneCallback; }? which wouldn't be the worst thing. just curious. thanks...
these are just functions
no, these are CODE type.
case requires CODE type.
so yes, case 1: _caseOneCallback this is valid.
@hollow thistle okay, well, semantics, po-tay-to, po-tah-to. yes, what I meant. good to know, thank you.
How is arma calculating the time between a (mortar/arty/mlrs) Shell fired and the impact?
math
Yeah nice. Not gonna need to learn wizardry.
But is it calculate like in real life? Are there things I need to know? Has anyone done it and I just didn't find it via Google?
I suppose they calculate from the angle/velocity/distance factors yes, but how factually I have no idea of the formula. do you need the result yourself?
Basically I want to do a custom support system like the one arma has. But as arma ( in my experience) doesn't like support links between modules added on the fly I want to rewrite it. And one of the few things I don't know how to do is to give a timer on the map until shell impact.
have you checked https://community.bistudio.com/wiki/getArtilleryETA ?
How did I not find that with an hour Google search? Sorry.
I'll start testing that. But if it is the same vanilla arma uses it is not very accurate. So if anyone has deeper insights in the calculations needed I'll be very thankful
it should be the same as vanilla, I do believe this is the command they use for Artillery interface
Thanks anyway. And again. Sorry.
no problem at all? you're welcome
Hey, quick question. Can scripts in the file-patching folder not have return values?
They can. They are scripts like any other
Also there is no "the filepatching folder" but I guess I know what you mean
I just mean the scripts folder in the player profile folder
It doesn't matter anyway, I was just trying to test something with the debug console
I forgot that scripts executed with execVM only returns the directory
My current goal is to have a function set as a variable be called within an event handler but I can't seem to get it to work inside the event handler
only returns the directory
It doesn't. It returns a script handle
Call compile preprocessfilelinenumbers
Is your friend
I see, thanks
I have solved all of my problems anyway lol they were just simple things that I missed somehow
Another question for anyone who might know, is it possible to get the position of the splendid camera?
It is easy to do in eden since it has its own command (get3DENCamera), and it is simple to get the player position, but I am missing a way to get the actual camera position itself
GetCameraPosition command. Maybe that's not the correct name, screen to world maybe
... Tfar has it.
Tfar_fnc_defaultPositionCoordinates see on tfar github
positionCameraToWorld You mean this one? I looked at it but I guess I misunderstood what it does
Indeed it does seem to work
It doesn't work if there is no player unit, but it seems to work otherwise
thanks again
Should work without player too.. dunno..
Is it possible to mark some area as enemy so when you instruct AI to move by vehicle somewhere it will avoid roads in that place?
not really, but you might make a trigger or a script that would set them "STEALTH" or "COMBAT" when entering, and back to "AWARE" when leaving @sleek sail
what would be the best way to multiply the velocity of a bullet w/o changing its direction? Would it be vectorMultiply?
AI avoid mines so you could set up a bunch of mines surrounding the area and reveal them to the AI
that should make them avoid the area then
is there an alternative to inputAction that can detect a specific key that doesn't require a display event handler?
I want to check if a key is pressed, regardless of what the current display is, and without the necessity to remove any event handlers
@runic surge you can just add to main display. that should work all the time while playing
@tame lion yes. If you multiply a vector with a scalar you keep same direction... or you go opposite direction if you multiply with negative
hello, I need help with unflip, it's not possible that a little stone kill a tank more than missiles.... do you have a safe code to unflip/unstuck vehicles that prevent the explosion on vector up, next to map objects, cos this physics is really really frustrating.
Hi can someone tell me how to get uniforms and vests from a container ?
there is :
WeaponCargo box
ItemCargo box
MagazineCargo box
BackpackCargo box
but how do i get Uniforms and Vests ?
getItemCargo returns uniforms/vests
but
everyContainer box
only tells me the object and not the ammout of object (uniform/vest/backpack)
E.g. hpp [["FirstAidKit","V_PlateCarrierSpec_rgr","U_B_CombatUniform_mcam_tshirt"],[10,1,1]]
okay getItemCargo seems to do the job
Hello! So, a developement team I know wants to "add a command that measures how frequently a function or loop is called" to see what's causing lag & performance issues for a mission file and how it can be fixed and optimized. Any help?
Just use script profiler Β―_(γ)_/Β―
You mean the mod you made or something else?
yeah
doesn't work with scheduled, but scheduled scripts themselves are limited to 3ms execution time anyway, so they won't really cause lag
I've passed on the word to them. Thank you!
In what language are the scripts for Arma 3
@still forum Is there a possibility for your script profiler to work on scheduled events?
Only?
@tough abyss yes, why?
no
well you can enable instruction profiling and you'll see scheduled scripts
but as scheduled scripts cannot cause lag, it doesn't make much sense anyway
@velvet merlin thanks. I'll look into it
I must ask: is there a way to set myself to a variable name in Debug Console?
myVar = player
Would it matter if I global, local, or target execute it?
yes
it will set the variable locally where the script is executed, to the local player where the script is executed
if you execute globally, everyone will have that variable with themselves in it.
If you target then only that target will
understood, thank you. I have been trying to assign myself to the zeus module in a mission rn, but I think I have follied it
nvm, it worked after respawn. thank you very much
With camouflageCoef, is 1 is like invisibility while 0 is visible?
Or is it the other way around
but as scheduled scripts cannot cause lag
Unless there is a single instruction that takes very long to execute
looking at you, nearObjects π
Has anyone had any luck with forcing vehicles to reverse even for a few meters?
is there a function that convetrs a multi dim array to a single array ?
eg. all class names from https://community.bistudio.com/wiki/Unit_Loadout_Array to a single array
A command, don't believe so. A function, someone's probably written something at some point
turn array to string
strip all []
add [] on outside
parse simple array back to array
He'd still have to solve the issue of magazine/ammo counts if all he wants is classnames
iterate through the flat array, filter out all isEqualType string
dont know where to post this so i apologise, i cannot get rcon to work properly on my server, i have looked it up but cannot find a tutorial which actually works
do someone has an experience that the say3D command in some cases play sound twice?
Added a p3d to an mpmission and players are getting random kicks for wrong signature for file. Anyone got any ideas?
so files seems somehow broken, after reexport audio everything works good π
I know im doing something stupid but havent tried basic scripting in awhile
Keeps telling me "Error missing_;"
@peak hound missions (mpmissions) aren't signature verified.. so.. what other file are you getting sig error for
I have a file in my mpmission called mymodel.p3d, I spawn it in using createSimpleObject and I am kicked for "wrong signature file for mymodel.p3d"
@still forum
vehicle disableAI "LIGHTS"; _vehicle setPilotLight true;
what am i doing wrong
Wait
Think i got it
so why is it kicking me for that reason then?
you have a mission pbo right? not a folder?
might be game bug then π€
maybe get a issue resolved in the game for once?
get shit fixed for once
Is there a feedback tracker ticket? If not then it won't get fixed.
instead of issues being posted on a issue tracker which is looked at once a year
last time i submitted one of those bad boys bohemia lads ignored it for 2.5 years
How do I make a ticket, i will make a ticket then
instead of reporting tickets properly. You instead just throw it at some guy in discord?
And thats supposed to be better?
isnt it his job
Thanks
please remove that ping.
According to #rules
2. Please refrain from tagging `Bohemia.net` staff, if situation needs immediate attention, please tag a Moderator.
When they can't provide the necessary information or are unresponsive, then you may tag `sysop` administrator.
please remove your ping on me then
Is there a full moon tonight?
apparently
@peak hound optimally please also attach the mission pbo, or atleast a similar one that can be used to reproduce the issue, and the script to spawn the object
yeah just something to reproduce it. doesn't need to be that exact mission
if a dev has an hour time to look at a bug, he doesn't have the time to also find out how to reproduce it.
plus afaik what you trying to do never was possible, aka model file in mission pbo
thats the issue i am having
model spawns absolutely fine but then i randomly get kicked for the message in the screenshot
exactly the same issue I was having when I created a small model and put it into the mpmission
@wary field setpos is not an option? Wouldn't turn tyres but depending on distance that might not be needed?
objects and such needs to be own addon in own mod file with e.g. config definition, it's not scripted element
typical example of this discussed in past https://forums.bohemia.net/forums/topic/185516-adding-custom-itemsuser-made-content-directly-to-a-mission/
Hello there.I was wondering this question; Lets say Im working on a mission and all and for example I want to add a certain item that isnt in the base game, not just a texture; an entire item. Although, I dont want to make all of my friends have to download that item separate...
so we can't use p3d (spawnable via createSimpleObject) in missions without mods?
atleast not with signature verification enabled
it has nothing with signature verification, it wasn't possible even before that
it's jsut different error message ...
I am able to create the object and spawns correctly from the mission
however it just kicks you off randomly
signature verification
if we disabled signature verification are you saying that would work?
I would say so yea
in terms of usage of CSO vs p3d in mission file, i don't think that was intended to work
so it's undocumented grey zone (and also untested then)
anyway make the feedback tracker ticket, if it can be fixed for the CSO w/o unforseen consequences then it may get improved
i thought that it was even advertised to be usable for p3d's in mission file
but that may just have been community statements
but fully fledged objects weren't supported in mission file
would be nice to have custom models in the mission
https://community.bistudio.com/wiki/createSimpleObject
Models from within the mission file/folder can be created, but full system path is needed. Use:
(str missionConfigFile select [0, count str missionConfigFile - 15]) + "myModel.p3d"
//mission folder path code from: http://killzonekid.com/arma-scripting-tutorials-mission-root/
instead of that, I'm using the new getMissionPath command
but as the issue above, we spawn the model in fine, wait 5-10mins then kicked for "wrong signature"
ye that's logical as the check fails to find the file
shame really
anyway, when one of you make the ticket, post it here and dm it to me (just for sure)
will do
cheers for your help
the whole select reference thing is still a bit fuzzy to me. if we have,
_arr = [0, 1, [2, 3, 4], 5, 6];
(_arr select 2) deleteAt 1;
then _arr should be [0, 1, [2, 4], 5, 6], is that right? in other words unless select is referencing a view into the array?
yes
huh, okay, excellent. also as borne out in a debug console. thanks.
although sometimes it slices a reference, sometimes it does not. i.e. _x = [0, 1, [2, 3, 4], 5, 6]; (_x select [3, 2]) deleteAt 1; _x yields the original _x value.
inconsistent return values for the different syntax I guess
hmm, interestinger and interestinger... in this case, _y still has the reference to its view... _x = [0, 1, [[2], [3], [4]], 5, 6]; _y = +(_x select 2); _y deleteAt 1; _x set [2, _y]; _y deleteAt 1; _x yields [0, 1, [[2]], 5, 6]
_y is an array duplication (+array) yes
y is a deep copy, so no it doesn't have a reference
but then you replace the array reference at index 2, with _y
in getting there, yes, but point is illustrating _y still has its reference when deleteAt occurs.
well yeah, if you delete an element inside an array, the array doesn't disappear, it just gets its contents modified
can even do magic like, _x = [[0, [1, 2, 3]]]; _x select 0 select 1 append [4, 5, 6]; _x; yields [[0, [1, 2, 3, 4, 5, 6]]]
why is that magic?
illustrating the point, select is powerful, but you have to be careful you may be selecting a reference view into the operand.
@lavish ocean I've created a ticket on the tracker you requested: https://feedback.bistudio.com/T147191
ty
hmm also good to know... _x = [0, [1, 2, 3]]; _x params ["_id", "_arr"]; _arr append [4, 5, 6]; _x yields [0, [1, 2, 3, 4, 5, 6]]
You are discovering properties of arrays being passed by reference, right?
You can use that if you want to pass a 'pointer' to a function so that it puts the result into that 'pointer'
Is there a command or function for the in-engine gravity acceleration?
One message removed from a suspended account.
Does anyone know if allPlayers array return players in logical order as owner. Meaning I could use allPlayers select (_owner - 3)
@grim coyote No
@feral kestrel Yes, there are millions of scripts like this, just do a little searching
@digital hollow what do you mean?
@dreamy kestrel use array copy operator if you dont want reference https://community.bistudio.com/wiki/%2B
Okay thanks.
Is there a way to check the performance difference between a enabled trigger and a frozen (via enable simulation) one? Or basically, is it worth it to freeze them if they are not needed right now?
it depends on the checked conditions (and the trigger size) @knotty mantle
usually it's not worth it
if you can enableSimulation false it, you can maybe also script its effects
Thank you
@unique sundial I just used ~9.807 since it's close enough for military work =p
Self-quoting is not source
When working with an addAction, do I have to include all the parameters if I just want specific ones?
I want radius and hideOnUse, could I do
this addAction ["rescue","rescue.sqf", 3 , true];
no, you can't do that
some are optional, they are listed on the biki
https://community.bistudio.com/wiki/addAction
@real osprey
I see object addAction [title, script, arguments, priority, showWindow, hideOnUse, shortcut, condition, radius, unconscious, selection, memoryPoint]
How would I "skip" sections?
check parameters: some are marked Optional
you have to "reach" the one you want by filling with default values the ones you don't want to change, then you can leave out the ones after because optional
Alright
so it would look more like
this addAction ["Rescue","rescue.sqf", nil, 1.5, true, true, "", true, 3];
and a string just means it has to be in quotes?
Awesome
Thank you
Another quick question
If I assign an AI to a group, the group leader would then be able to command him, yes?
ex
yes?
surv1 join (group player);```
[surv1] join player```
https://community.bistudio.com/wiki/join
takes an array
you can activate the -showScriptErrors flag in the launcher to see script errors on screen
does join player and join group player do the same thing?
yep
Will an AI following a player automatically get into a vehicle that the player its following gets into or no?
nope, one has to order it
https://gyazo.com/ec794f55e8c8993e6511d77c10f1f2bf
Is the default "" (2x quotations) or '''' (4x apostrophes)?
" quotations
or two apostrophes, 'string' and "string" are the same
you can literally copy-paste from the wiki here
Im getting an "error bool expected string"
So does every true need to be in "" or only the ones marked as string?
only strings need to be strings
all strings need ""
true is a boolean
"true" is a string
regardless if the string contains true or false or when is arma 4 coming out
all need quotes
So my understanding is:
string, string, anything, number, boolean, boolean, string, string, number
yep
I must be missing something
maybe the error is on another line? near to the addAction? if you already fixed that
this allowDamage false;
this addAction ["Rescue","rescue.sqf", nil, 1.5, true, true, " ", "true", 5];
is the whole thing
and the error is still error bool expected string ?
yes
Ctrl+S? π
you may have the error in some other file or you are not working on this file, it should work in Eden
I found my error. I somehow had this running twice, and one of them was on an object rather than a player
Another question however. Can you place an array inside an array to have it randomly select?
to
[this, 0.8, ["all the body parts"], ["all the injuries"] ] call ace_medical_fnc_addDamageToUnit;```
[this, 0.8, selectRandom ["all the body parts"], selectRandom ["all the injuries"] ] call ace_medical_fnc_addDamageToUnit;
@real osprey see βοΈ selectRandom indeed
is there a way to confirm that an item has been removed ? removeItem dose not have an return value.
eg. systemChat str(player removeItem "hgun_P07_F"); // true / false
thanks i will test that
When a heli lands on a heli pad, I want it to be Rearmed, Refueled and Repaired anyone know of a good script to do this?
@high silo http://www.armaholic.com/page.php?id=19139 Vehicle Rearm Script
@winter rose i tested it now and i dont really get a good result
im testing this:
systemChat str _r; // = false;```
but
```_r = [player, "SmokeShell"] call BIS_fnc_hasItem;
systemChat str _r; // = true;```
And the SmokeShell is stored in the uniform. any idea how i can only check the uniform ?
excuse me ,What is the difference between the three param private params, and under what circumstances is it called in the script? I've always wondered, even if I read the wiki several times, I don't understand it very well, who can help me, thank you!
@runic quest as far as I can tell param extracts an unnamed parameter from the input argument, https://community.bistudio.com/wiki/param
whereas params allows you to unpack one or more, https://community.bistudio.com/wiki/params. params also has the added advantage, in my opinion, of deconstructing "tuples", loosely so-called by this man, by name. although folks would argue whether there are really "tuples" in SQF. IMO they are by application, but this is neither here nor there.
I find myself using params in numerous places these days, inserting placeholders for don't care positions, etc. i.e. _x params ["_0", "_1", "_icare2", "_3", "_icare4"] and so on.
I think _x params ["", "", "_icare2"] may also be acceptable.
but be careful when you deconstruct, it will preserve references when "appropriate" to do so.
Here's the gist of it:
// get variables from _this
_variable = param [0];
params ["_variable"];
_variable = _this select 0;
// set a variable as private directly
private _variable = "value";
// create a private variable for later use
private ["_variable"];
private "_variable";
but the wiki explains exactly what each is doing, how to use it and how it works
well, the wiki does not use the word deconstruct anywhere, but, depending on the context, that is exactly what it is doing.
it also does not clarify as to the referential nature under some circumstances. i.e. [0, 1, [2, 3, 4]] params ["", "", "_ref"], is perfectly fine. then you can manipulate the composition of the third array element through _ref.
I'm unfamiliar with the validation form, however.
in normal cases;
- use
paramsto get passed values (top of script), and automatically make them private - use
privatewhen you create a new variable which should remain within scope (script/loop/etc.) - use
selectto get a single value out of an array, andparamsfor multiple
validation in params is actually very simple, as long as you understand the data types
more or less, but for the reference gotcha. that can get you into trouble if you are unsuspecting.
and last is count _x - 1 π
Q: separate topic, I am looking for a way to format a timer time. I have it in seconds, do I need to RYO algo for that? do format and/or %n offer any specifiers along these lines?
no, format is a simple string_replace without any smart references
I see... algo it is. thanks much.
tks for helping me !
oh, well there's the BIS_fnc_timeToString which might be helpful rendering a timer counting down, https://community.bistudio.com/wiki/BIS_fnc_timeToString
or better yet BIS_fnc_secondsToString, https://community.bistudio.com/wiki/BIS_fnc_secondsToString
which is perfect, because in my case, time is my timer source, https://community.bistudio.com/wiki/time
I found my error. I somehow had this running twice, and one of them was on an object rather than a player
Player is also an object, and running something twice should not produce an error second time
@sonic linden take a look at the wiki, in the Containers function category
(I'm on mobile now)
Hi All, I am looking to have a script that will play a sound if the player has a certain object and they are in a trigger area. Basically trying to work out how to use the Chemdetect as a gieger counter if in a certain area?
@primal marten you could do something like
// this function is named myTag_fnc_chemdetect
if (getPos player distance _myTriggerArea > 500) then { // 500 in meter as example
playSound βmySoundβ;
};
[{call myTag_fnc_chemdetect}, 1] call CBA_fnc_waitAndExecute;
But if you want to have it doing the same as a ginger counter
// this function is named myTag_fnc_chemdetect
private _repeat = 1;
switch (getPos player distance _myTriggerArea) do {
case 100: {_repeat = 0.2;};
case 200: {_repeat = 0.3;};
case 300: {_repeat = 0.5;};
case 500: {_repeat = 1;};
};
if (getPos distance _myTriggerArea > 500) then {
playSound βmySooundβ;
};
[{call myTag_fnc_chemdetect}, _repeat] call CBA_fnc_waitAndExecute;
But there could be a syntax error, wrote on the phone. But give it a try
This code is optimizable because the condition is checked 2 times but that would be my start to the problem
awesome thanks @spice axle will give it a go!
@primal marten there is a logical error
The distance Condition need to be of course lower then 500 not greater and the variable _myTriggerArea is not a area just a single point position like [5, 13, 1]
need a couple of pointers. I've got a dialog "manager" which would follow a while {dialog} ... approach, I'm looking at optimizing it to a more .hpp event driven model. problem is, its chief data sources are refreshed via publishVariable and publishVariableClient from outside of itself. short of rolling our own event model, is there a way to signal to the dialog that is has new data, that it might possibly refresh itself?
along similar lines, what "type" is a dialog anyway? i.e. when we say typeOf _dlg or typeOf _ctrl for one of its controls?
right, but this stands alone does it not? I mean apart from the context of an operational dialog, with built in event handlers, etc.
Ye
or I need to look up the dialog via findDisplay I suppose and inject the update that way.
Or store it in a variable in uiNamespace
ah, correct. good point, thanks.
I've found out that you can put non-compatible ammo in any weapon through scripts, like putting a 40mm into the ammo slot of a revolver. This is what it feels like now with this power
I have no words for this https://twitter.com/i/status/1204139897369636866
@tough abyss do tell...
Someone substituted bullets on fire event with 40mm grenades and you feel like you are holding HK P7 M13 in Iraq @tough abyss ?
Every OP should have a Rambo π€£π€£π€£
Are there any BE whitelisted extensions for handling large numbers? I'm trying to make a mildly secure crypto fnc, the random command with a seed looks promising but is only accurate up to 999999, which can be bruteforced in about half a second...
Hi people! please tell me how to implement the transition of a player on another server using a trigger?
Use selectPlayer to switch player into another unit
second moment, or connecting a player to another server if the first server is unavailable
π
There is the first dedicated server (192.168.0.101:2312) with its own map of the area. There is a second dedicated server
(192.168.0.101:2322), with a different map of the area. The player connects to the first dedicated server (192.168.0.101:2312) and if some condition is met, for example, this player is not in the whitelist or the server is full, then this player is redirected to another server (192.168.0.101:2322). Or, a player connected to the first server activates a trigger on the map, in the initialization of which a redirect to another server is specified (192.168.0.101:2322), after which the player reconnects to the second server (192.168.0.101:2322). Is this realizable?
thank you friend!
@plain current im not aware of one currently available for that purpose
how can i modify this to increase the volume of custom music?
class sound1
{
name = "sound1";
sound[] = {"music\tune1.ogg", 40, 0};
titles[] = {};
};
His name is "Jack O'Neill" btw, not "Jack Oniell"
https://community.bistudio.com/wiki/Description.ext#CfgSounds
your first number is volume
im that other Oniell
I am unable to hear a difference. Setting it much greater? sound[] = {"music\tune1.ogg", 500, 0};
whats the max i can set it?
@spice axle Have to admit sir cant get it to work
@sudden yacht do you know what pitch does? Somehow I donβt think it should be 0
@unique sundial More like a miniature, handheld Mk19
Looking for a autorun script that allows a player to hit a key so their character will keep running, like what Exile has. Thank you
I did I found a mod, no server side scripts
@unique sundial This channel is called "Scripting" im looking for a script
it won't be a server-side script, it will be client-side though
@nocturne pagoda also, the channel's description states otherwise: this channel is about script creation and usage
I was trying to find something like what Exile uses, which is server side
This channel is for people with concrete script problems
ok
Then maybe you should unpack exile?
Like I made autorun script but something is not working, here is my script...
π
__EVAL macros MUST be assigned to a config property does this mean __EVAL cannot be used for macros (#define and stuff)?
source?
#define MEME __EVAL(parsingNamespace getVariable ["test", ""])
#include "macros.hpp"
private _meme = MEME;
diag_log format["_meme: %1", str _meme];
where is __EVAL?
in macros.hpp
well it's putting the entire __EVAL.... into the script
if i do MEME = __EVAL(...) in description.ext and do getText (missionConfigFile >> "meme") then it works, but thats not what i want
then no __EVAL macros are not suitable for SQF/SQS scripts
it will put it in script but it wont get processed
Yes i know it's erroring out because it's just replacing MEME with the __EVAL(parsingNamespace getVariable ["test", ""]) in the script, which is illegal (as stated on the wiki).
What I'm looking for is to use #define to make a macro with the value returned from __EVAL. I don't want it to be a config property. I'm just asking if it's possible to define a macro using __EVAL so it runs parsingNamespace getVariable ["test", ""] gets the value and puts it into the macro once at the start of the mission?
#define MEME (parsingNamespace getVariable ["test", ""])
Yes but then it just replaces MEME in all the scripts with (parsingNamespace getVariable ["test", ""]) meaning if the variable gets changed/removed the macro will change as well (which is not what i want). I need the value to be read once at the start of the mission and then be the same till the end (even if it's changed in the parsingNamespace).
you cannot store a static value in a macro
U mean i can't eval a static value into a macro? I could just do #define MEME "hello" but that's not exactly what i want
yes
ok thanks anyways
you could do it with config tho, whys that not an option?
The idea was for preventing cheats, because you can't read the macro values at run time with scripts outside the mission file (correct?), so sensitive data such as exp/money variable names, etc could be stored in a macro that gets set with __EVAL(parsingNamespace getVariable ["test", ""]) when you join and then the test variable could be nilled and it wouldn't be possible to get the contents of the macro.
because you can't read the macro values at run time with scripts outside the mission file (correct?)
you can preprocessFile the script file, the script text will contain the macro value
or loadFile the macro hpp
when you join and then the test variable could be nilled
that would defeat both my ideas. But I assume you store the then compiled script in a variable
If the user knows the variable name of the function containing the secret, he can just dump that
Just can't seem to untangle myself from the fact that this
[
"Test action",
{},
[],
1.5,
true,
true,
"",
"(testArray # 0) findIf {player inArea (_x getVariable "objComplete")} == -1",
50,
false,
"",
""
];```
is giving this:
```18:43:40 Error in expression < findIf {player inArea (_x getVariable "objComplete")} == -1",
50,
fal>
18:43:40 Error position: <objComplete")} == -1",
50,
fal>
18:43:40 Error Missing ]```
Missing ] from where?
Quotes
"(testArray # 0) findIf {player inArea (_x getVariable 'objComplete')} == -1",
^^ there u go
Those it was, thanks KK and Fini. Actually tried with 'blah blah' just there earlier but didn't work back then. Just realized I had something else messed up then when I had the quotes correct π€¦πΌββοΈ
@still forum if you can't do the eval in a macro, then the entire idea is a bit scuffed, the idea somewhat was that preprocessFile afterwards wouldn't work because the variable that the eval reads would be nilled and loadFile of the hpp would just show the #define __EVAL(parsingNamespace....) which would also be useless if the variable is nilled. Tho you could just diag_log one of the functions that uses the macro and yeah....
even if you did it in a macro, macros are placed in script text before compiling
and the string input to compile you can always get back
you can't read macros, because they don't exist
they exist for a split millisecond while a script is preprocessed
what is a CT_TOOLBOX control in user interface terms?
I think I see, looks like possible a radio button of sorts, but I've been wrong before.
Hi guys! how can I change texture on hiddenSelections[] = {"camo1"}; as for example with the command setObjectTextureGlobal
<yourobject> setObjectTextureGlobal [0, <yourtexture>];
execute
she changes on the whole object and I need to Selections
0 means you change it to the 1st element of array, which is "camo1"
what does getObjectTextures <yourobject> return?
Q: client/sever, does time yield the "same" value? intuitively I'm thinking probably not, but could be wrong about that. i.e. we have an elapsed "timer" refreshing primarily on the server, the artifacts of which get published to clients. probably want to keep it that way, but I wonder if there is any possibility there is client/server consistency in that.
time is local simulation time since you started the mission / joined the server.
serverTime is synced from server to clients
need some help when one of you guys have a second, I am trying to put in a curfew siren script into my mission file, the sound file plays as intended, however it seems that the script loops at the end of the .ogg file. Ill paste the script below, any help is greatly appreciated.
GOM_fnc_baseLoudspeakers = {
params ["_loudspeakers","_sounds"];
GOM_fnc_basePlaySounds = true;
while {GOM_fnc_basePlaySounds} do {
sleep random [90, 95, 100];
{
_sound = selectRandom _sounds;
if (alive _x) then {
[_x,_sound] remoteExec ["say3D",0];
};
sleep -1;
} forEach _loudspeakers
};
};
_loudspeakers = [speaker1, speaker2, speaker3];
_sounds = ["H_Curfew_Near"];
_play = [_loudspeakers, _sounds] spawn GOM_fnc_baseLoudspeakers;
@hollow thistle so... if the server is refreshing using its own time, that is theoretically analog if not the same as serverTime on clients?
negative @dreamy kestrel, time is for mission time, serverTime is for server uptime
(at least according to the wiki)
in that light, then I take it time, per se, should be consistent client to server to client, etc?
I want to spend time slowly during the day.
On the contrary, I want to pass the time quickly at night!
I want to know the code that works in the MP.
Q: about dialog controls[] = {} ... do the ones that are displayed need to be enumerated? or do all of them need to be enumerated? including the base classes, for instance.
@dreamy kestrel considering cba adds its own server and client synchronized time. I'd assume that time is not synchronized
@still forum Hmm, that's good to know. I might look into that. Thanks.
time is simulation time, it can be accelerated, decelerated and stopped all together. While this related to SP more than MP, if you have scripts that run longer than frame time in MP the time will start lagging behind
As for controls[], personally never needed to put anything there
Not sure what you mean by "lag behind". I'm not looking for a real time heart beat or anything of that sort. I take a time measurement, and gauge a duration in order to derive elapsed and remaining components. this happens periodically, yes, but I refresh the timer component at the moment I need to evaluate.
as far as periods and frequencies, the managers or other service loops could be asleep for several seconds or more between actual measurements.
Lag behind as in it shows 5 seconds elapsed but in fact it was 15
Not that drastic of course, just an example
I've seen that sort of behavior out of the "ticks" (theoretically, milliseconds) timer. have not tracked time that closely yet.
I doubt ticks timer does that
@craggy bluff search for sunormoon in this channel and I had a post earlier this year on how to do that. Canβt seem to copy the link from search on mobile
hi im search for a box removeItemCargo [item] script, because remove Item only works on units and i need to remove an item from a container. Can someone tell me where I find something like that π
There isnβt one
why ?
Because no one implemented it
So is there another way to remove an item from a box?
That seems to me to be quite essential
remove everything, then re-add, unfortunately (afaik)
but what about attachments and backpack items ...
well i will try ( thats why i thought someone made allready something like that).
not ideal, believe me I know
Attachments addWeaponWithAttachmentsCargoGlobal
Backpack items backpackContainer
I have a question, if I check side of nearest player vehicle, the side of vehicle (tank/car) will return the side of vehicle by config or by the crew that is manning the vehicle, example if bluefor crew inside redfor tank, what side _vehicle will return?
Better check side group vehicle
I am using that for now but I was thinking if allow or not the script to vehicle unmanned of other side
if (count _vehCrew > 0) then {
{if (side _x != sideJoined) then {_enemyIn = _enemyIn + 1;}} forEach _vehCrew;
};
@unique sundial I've sent you a friend add request, if you mind accept I would like to talk with you.
Thatβs cool, but Iβd rather you continue posting in public channels, this way you might find what you are looking much faster
one thing doesn't exclude other one, but nevermind it's ok
I don't think vehicles have a side, not even in config... which is a shame as I was hoping something like that was present in previous coding. You can kludge something by converting the class to a string (str typeOf vehicle _x) and then running a switch on the first letter... B would be west, O would be east, I would be independent
From the Biki... ```- side of an empty vehicle is civilian
- side of a crewed vehicle is, if present, commander's > gunner's > driver's or > cargo's side, in this order
For my goal need to be studied cos it's a warfare with a lot of vehicles, if you kill for example gunner/driver from a car the car side will be still enemy cos the crew as far as I read count also if dead, so until the crew will get deleted by the cleaning script, the vehicle will be enemy side, then civilian, so it's better if I base my code on crew instead of side of vehicle, I think I will stick with the crew system
you could use faction
if you kill for example gunner/driver from a car the car side will be still enemy cos the crew as far as I read count also if dead That is not true. Just tested and the vic became CIV as soon as the last occupant was dead, even if they are still inside
Description
Description:
Returns the crew (both dead and alive) of the given vehicle.
Syntax
Syntax:
crew vehicleName
I need to know if I can recover the vehicle or not, if there is enemy crew inside the vehicle can't be recovered ( it's a unflip/unstuck), I wanted to know if it's more convenient for my goal to check if there is crew, or check the side of vehicle, if I do for example a check if side joined if civ will not work, instead if I count alive crew and check that crew is not == to side joined, I got my goal, I think
If side is CIV then it is empty... Unless you have CIVs driving vics around. If crew are present and you need them to be the same side as something you just use side <vehicle object> and see whether it's the same as you need...
Also with respect to the car side will be still enemy cos the crew as far as I read count also if dead > All dead units are civilians
Yeah. That
Thanks all, I learned new things that lead in less confusion, much appreciated
Does description.ext not support emojis in defines or variable names? 
Angery @plain current
Better check side group vehicle
dead crew or empty == sideunknown
otherwise the side
description.ext has no variable names. You mean the eval thing? Might be that it doesn't support it
you mean #define SMILE :)?
#define π SomeConfigProperty
class Test {
π = "hey!";
}
lmao why would you ever want to do that? @plain current
Mate it's 2019, emojis are lyfe, all other languages are fine with them
no, won't work

Macro names should only consist of alphanumeric characters and underscores, i.e. 'a-z', 'A-Z', '0-9', and '_', and the first character should not be a digit. Some preprocessors also permit the dollar sign character '$', but you shouldn't use it; https://stackoverflow.com/questions/369495/what-are-the-valid-characters-for-macro-names
Q: when you style = ST_RIGHT; on a textual UI resource, is that right aligned in the w of the resource? does that change the x component at all? i.e. your x is still "left of" the resource? or is the x then on the "right of" the resource?
@dreamy kestrel #arma3_gui can help you π
thanks.
Somewhat new to scripting, is there a variable that represents basically all things in the game, or all units of a side?
https://community.bistudio.com/wiki/allUnits is one such command
there are others there too for different scopes
Thanks
cba related question:
Imagine attaching an class eventhandler to CAManBase with killed event on the server doing some stuff, it doesn't really matter
because it is local to the machine added
what happens if we transfer a unit from the server to a headless client and kill it
will it trigger the event on the server?
killed eh is local, so will trigger on the hc. You can remoteExec the code that it triggers.
@unique sundial re: the ticks timer, it was pretty bad. probably along the same lines. anyway, if I were timing 1 tick equals 1 millisecond as the docs claim, it was definitely not that. trust me, I measured.
How did you measure? By running a script?
The script that can be suspended at any time by the engine and resumed god knows when?
Anyone know if https://community.bistudio.com/wiki/displaySetEventHandler work with RscTitles display?
Hey all quick q I am setting up some waves of Ai for a mission, I want the ai and its group to teleport to a marker so far I have
waveai_1 setPos (getPos wavespawn_1);``` What do I need to make it so it tps the group aswell?
would { _x setPos (getPos wavespawn_1) } forEach units group waveai_1; work?
it does ty for help
you're welcome
@tough abyss probably not, since there isn't a UI event that would register on these displays
Hey guys, quick question: I have written a script that applies flags to vehicles via forceFlagTexture. I wanted to make it so that you could call the script like this
flagfun = [this,"UN",true] execVM "fahrzeugFlaggen.sqf";
the second argument passed is linked to configs. So for example, if you put "US" instead of "UN", the flagtexture is different. The problem that I have is with the texture path.
_flaggenKonfig = _this select 1;
if (_flaggenKonfig == "UN") then { flaggenSkriptTextur = "\A3\Data_F\Flags\Flag_uno_co.paa";};
So - how does the texturePath need to look, when I want to load a texture from a loaded addon like CUP?
try \cup\......
The Texture I am trying to load is in @ek_bwmod\addons\bwa3_common\data\flag_germany_co.paa"
Just putting down the path is giving the same error.
i've also tried \bwmod\bwa3_common\data\flag_germany_co.paa"
Have you tried \bwa3_common\data\flag_germany_co.paa?
Yes, no luck
I wonder if this is even possible with a addonTexture.
Yes it is possible, what do you think Arma 3 is?
Cool. So you know how to do it?
use correct path to the texture and it should work
I know that it works with vanilla flags
finding the correct path is the whole point.
for that you can extract the pbo of the mod which contains the flags, and see what the path is (basically the directory structure within the P: drive)
@unique sundial yes, isolated functions, ran scripts, dumped to diagnostics. nothing too mysterious there, just using the tools at my disposal.
Q: we are doing a mass sync publishing a bundle of otherwise unrelated variables server to client, and I currently need just one of those elements in an aspect of the client UI. Is it possible to publishVariableClient on the client itself to itself in order for such an event to be "see" by that client?
i.e. clientOwner publishVariableClient "My_variable"; client side?
you want to broadcast a variable to the client that updated the variable?
in certain situations hideObject no longer works (in SP) - i think its when the player camera is not on the object or camera is not on the player
the BIKI page mentions
When used on player, it only has an effect on third person mode. First person LOD is still visible. (A3 Dev 1.33)
Hi! Im making a few simple missions for my friends who is not big into the sudden deaths buit still want heavy firefights. I would like to make, lets say helicopters be invincible and the players inside to only take 10% of the real damage. I know JiP is hard to script so im thinking it'll just ahve to be without.
but can you help me/ guide me in the right direction? I know allowdamage false on the vehicle but how do I make it apply to all players that occupy it and how do i do the reduced damage?
Do you use any mods which modify the damage in any way (like ACE 3)?
And do you just want to reduce the damage to the people inside, or apply the damage from the vehicle to the units instead?
nop no ace.
I want to make the vehicle take no damage and eveyrone who jumps in the vehicle to only take 10% damage
In that case; for the vehicle it's easy with allowdamage false
For units you should look at https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage
This should get you started ;)
player addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
private _newDamage = _damage;
if (_unit in name_of_vehicle) then {
_newDamage = _damage * 0.10;
};
_newDamage;
}];
Thank you. Ill look into it π and does allowdamage false work in MP or will it only aspply to the first player? im guessing it will have to be scripted in hte init then to apply server wide?
it's a bit complicated with allowDamage...
This command has to be executed where object is local and as long as object does not change locality the effect of this command will be global. If object changes locality, the command needs to be executed again on the new owner's machine to maintain the effect
So as long as you set the value in the editor and don't use HC you should be fine.
from the wiki @ https://community.bistudio.com/wiki/allowDamage π
What is Hc?
Ah headless client. Na I will just host the server myself. Would ideally be that the effect on the vehicle would start once a player hopped in the driver/pilot seat and the driver/pilot and all passengers would take reduced damage.
Hello, where can I find init.sqf samples for simple singleplayer missionscripts? For example I only need really basic things like patroling, infiltrating, 2 AI Squads fighting against each other etc. On searching only found the high complex ones for famous mods like Altis Life, DayZ and so on. I prefer Arma 2 Engine.
"only need really basic things like patroling, infiltrating, 2 AI Squads fighting against each other etc."
2 things which don't really match in one sentence π
but especially for Arma 2 the forums are a good source for scripts (since most people moved to Arma 3, or never saw Arma 2)
@unique sundial from the client to itself, yes. possible?
@dreamy kestrel its nonsense. You have variable set on client already. It is like doing a = 1; a = a; what does the second expression achieve?
Hey can someone tell me how i can put a delay between the shots of an AI ? I cant figure it out
i tried this: this addEventHandler ["Fired", {sleep 10}];
doesnt work
Also tried using this (with 2 rounds, 1 in weapon and 1 as mag(using GL)):
sleep 5;
_unit = _this select 0 ;
_mag = _this select 4 select 0 ;
_unit addMagazine _mag ;
}] ;```
^ With this i get a generic error expression
i basically want to do that:
if Projectile is Fired at enemy then wait 5 seconds and shoot again at enemy if there is still one
@slow isle you cannot sleep in EH itself, use a spawn
Hey
I'm back again
I needed to respawn one vehicle loaded on other vehicle cargo. Like:
Respawn one vehicle with other on cargo
I'm trying to search internet. But it looks helpless
youll just have to respawn it and move it to the cargo
theres no respawn vehicle as cargo command
It can't respawn respawn inside other vehicle?
Because it's a water operation where I need to spawn barges with trucks inside to land on the beaches
Guess no then
π
Respawn the trucks on land and move them to cargo after they are spawned.
no you need to spawn all vehicles and then on their initialization move them in their places
also the above
Ok
Guess I can try... but I'll need a empty spot right?
Like a marker
So the vehicle spawn there and instantly go to the barge
With script
Ok thank you. Guess it's a north for me to start.
Ah! I forgot to say that they need to respawn
As it's a liberation mission. KP version. Guess I should ask them directly
@unique sundial no it's not, really. not our fault dealing with brittle code and an arguably poorly conceived bundle of public components. I want to take one of those components and individually publishVariableClient, from the client to itself. Which in turn might do things like notify a UI to refresh itself, that sort of thing.
Q: re: sorting... is it possible to sort by alphabetical order?
seems like perhaps sort would do the trick, especially since the array elements share the same shape.
Is it possible to decrease vehicle speed using vectorAdd?
i tried running this but it doesn't appear to work
fn_mcno = {
if (_speed <= 1 || _speed >= 0 || _velXM > _velYM) exitWith {};
_speedBrake = -10;
_curVMS = velocityModelSpace _veh;
_newVMS = _curVMS vectorAdd[0, _speedBrake, 0];
_veh setVelocityModelSpace _newVMS;
};
Because your script will always exitWith on condition _speed >= 0
@dreamy kestrel It is not BI's fault that you are trying to use outdated convoluted way doing things instead of more modern approach. remoteExec will do what you want if only you can bother to learn it
Hey guys I am trying to use this on a dedicated server but with no luck works in SP/MP local testing if (isServer) then { [prisonguard,"PrisonGuard",4] call prison_guard_voice_over; };
Would I need to remote exec this and if so how do I add that into the script above? Cheers for any help.
we would need to know what the prison_guard_voice_over is @long glacier
@winter rose it is this mate
prison_guard_voice_over = {
params ["_speaker","_voice_sample_name","_number_of_voiceovers"];
private _voiceover_list = [];
for "_i" from 1 to _number_of_voiceovers do {
_voiceover_list pushBack (format ["%1%2",_voice_sample_name,_i]);
};
_speaker kbTell [_speaker,"prisonchat",(selectRandom _voiceover_list)];
};```
and then this is the prison.bikb ```class Sentences
{
class PrisonGuard1
{
text = "";
speech[] = {"\sounds\PrisonGuard_1.ogg", 2, 1, 20};
class Arguments {};
};
class PrisonGuard2
{
text = "";
speech[] = {"\sounds\PrisonGuard_2.ogg", 2, 1, 20};
class Arguments {};
};
class PrisonGuard3
{
text = "";
speech[] = {"\sounds\PrisonGuard_3.ogg", 2, 1, 20};
class Arguments {};
};
class PrisonGuard4
{
text = "";
speech[] = {"\sounds\PrisonGuard_4.ogg", 2, 1, 20};
class Arguments {};
};
};
class Arguments{};
class Special{};
startWithVocal[] = {hour};
startWithConsonant[] = {europe, university};```
kbTell is local iirc @long glacier
Rgr cheers I will see if there is any global alternative
your bikb is fine since it is working in SP/hosted MP
You can remoteExec the kbTell ! @long glacier
ohh ok thanks a lot mate
Would this work? _speaker remoteExec [[kbTell [_speaker,"prisonchat",(selectRandom _voiceover_list)]];
negative π
// select random voice over prison guard
prison_guard_voice_over = {
params ["_speaker","_voice_sample_name","_number_of_voiceovers"];
private _voiceover_list = [];
for "_i" from 1 to _number_of_voiceovers do {
_voiceover_list pushBack (format ["%1%2",_voice_sample_name,_i]);
};
[_speaker, [_speaker, "prisonchat", selectRandom _voiceover_list]] remoteExec ["kbTell", _speaker];
};
ohh god I always think think simple changes will be easy, I am alway wrong
one piece at a time, really!
Thanks a alot man
you're welcome, don't hesitate to ask questions here
do setvelocity work for the rocks? i can get it to work. need falling rock but when use setvelocity nothing happen... ideas?
you would need PhysX-simulated objects yes
you could use rocks as drops I think
maybe https://community.bistudio.com/wiki/ParticleTemplates#Rock_Shower @lucid junco
pff π
but thx π
use setpos is bullshit right? i wasnt able to find way how to loop setpos somehow effectively
or do you see some way?
should they damage people or not?
it should fall from A to B vertically (just Z) and yes if player will step just under the falling rock it should kill him. I need it just for the one huge rock. Not for many small falling rocks
then setPos may not be the solution (unless you script the damage) as setPos is not "falling", just small teleports
if it's only one rock, you could setPos + script damage yeah
yea i can handle it. my problem is when i use setpos in loop. The loop gets unpredictable (sometimes go slower, sometimes faster, depends on scheduler i gess) delay so its sometimes desync with the sound
the setPos might be better in non-scheduled environment yes
this ensures your script is not "slowed down" if you have plenty of scripts, so aesthetically "cleaner" yes π
oh cool i forgot about this
i tried compileFinal preprocessfilelinenumbers
better, but not good
going to try evenhandler
thx man!
with pleasure!
not in #arma3_scripting ^^
most likely in #arma3_config @tough abyss ;-)
also: if it is not your addon, you cannot do it
I just want to make one vehicle drop cargo a bit foward to not crash on the transport vehicle
and this internet searches I'm doing isn't helping, but confusing my mind @winter rose
AH! I need a hint:
I'm making one respawn with this expression:
Β΄_success = barge setVehicleCargo truck;Β΄
the barge is the transport vehicle
the truck is the loaded vehicle
the option of force respawn is on
the problem:
-> It wont respawn when far
--> possible cause is that the vehicle is a single variable,
--> possible solution is to make a trigger to multiply the variable and make it readable to the script:
_success = barge setVehicleCargo truck;
something like this:
_success = typeOf("barge") setVehicleCargo typeOf("truck");
Is there a way for my mission script to disable modules when testing a mission in ED3N and enable them when properly hosted?
there is probably some boolean that detects if a mission is in ED3N or not.
Does anybody know if BI are going to add some of the functions that were in the contact version? Seems like they've added the gasmask stuff but not the chemlight function or the ragdoll function.
I mean they seem to be pretty normal. Nothing "alien" or "unrealistic" about these, right?
its possible attach magazine to player
Is this a question or a statement?
question
Short answer, yes, longer answer yes, but in a way that it looks nice it's not quite as easy.
I'd assume you would want it to either follow the players movements or hands or something?
attach to the left hand
Quite difficult and possibly not very mp friendly.
I mean you can simply attachTo a thing on the hand bone, but it will not properly follow the movement.
as in, it would follow the hand but always face the same "up direction" unless (heavily) scripted
Is there anyway to use lineIntersectsSurfaces in a similar fashion to the difference between getPosVisual and getPos
Im running into issues where the simulation version of the object does not match up with the rendered version, which causes my intersection check to return either the wrong surface or nothing at all
since you can use it with positions, you can use it with visual positions with visiblePositionASL @tiny wadi
Right yeah, I actually used the visual model to world command to get the head position of the player due to having the same problem with eyePos. But the actual problem I believe is that the surface check is looking for the view geometry LOD but that is still in simulation position?
Main issue is when the player is in a vehicle
ah, the intersection itself
that I don't know
Right yeah, i was considering abandoning the intersection check and somehow creating my own based on predefining the relative memory point positions of the vehicle
sounds like a pain though
rgr
I thought of terrainIntersects*
ah
mornings
Haha, more like late nights π
insert time zone joke
@tiny wadi it is tricky because in order to define the scope (render or future) you need to have an object you want to test intersection with, which is not an argument of the command, so the scope is undefined
ah
So if the scope is undefined, would it be best to come up with my own intersection determination? Or is there a way to work around that problem
what is the exact problem that you are trying to work around
I am using the surface intersect to determine whether a person is viewing a specific part of the model using the view geometry lod to replace the scroll wheel. then if that surface check comes out good I draw an icon and some text to indicate there is an action there. It works fantastic when you are not moving, or are moving at like 3km/h. The problem is when you begin to go over that speed the surface intersection check doesnt work reliably anymore and you cant use any actions while moving
what does the lineintersectssurfaces expression look like?
also have you tried getCursorObjectParams?
_begin = AGLToASL (player modelToWorldVisual [ _headX - 0.05, _headY, _headZ + 0.05 + (_distance / ( 12 ^ 2 )) / 1.5 ]);
_end = (_begin vectorAdd (getCameraViewDirection player vectorMultiply _distance));
_lod = getText(configFile >> "CfgVehicles" >> typeOf (_ob) >> "Interaction" >> "LOD");
if (isNil "_lod" || (typeName _lod) != "STRING" || _lod == "") then {_lod="VIEW";};
_intersect = lineIntersectsSurfaces [_begin, _end, player, objNull, true, 1, _lod, "NONE", true];```
Got the head position from this guy:
I have not looked at that command, ill take a look now
Thats an interesting command, i've never seen it before.
let me see how that works real quick
isNil "_lod" || (typeName _lod) != "STRING"
FIY _lod cannot be nil and is always a string
ah okay
EachFrame
maybe you should try draw3d for comparison, they are executed at different time during the frame
Oh π€ Also was not aware. Let me see how that goes
Same issue
getCursorObjectParams won't work b/c cursorObject wont return the vehicle you are in
I found this however: BIS_fnc_getIntersectionsUnderCursor
going to check it out now
How about getSelection position and compare that to screen coordinates?
@tiny wadi are you trying to do something like this? https://www.youtube.com/watch?v=u_nmNkz-69s
yes exactly
Take On Helicopters interface
Hi, I'm having some trouble with this bit of code:
{
_knowledge = (_group knowsAbout _x);
if (_knowledge > 0) then {
_enemyForceKnown pushBack _x;
};
} forEach _unitsUnknown;
specifically the line: _knowledge = (_group |#|knowsAbout _x);, I'm just getting generic error
_unitsUnknown and _enemyForceKnown are both arrays of units.
Ohhhhh... @unique sundial Looking at your debug console. You check the screen coordinates and how much they differ from the center.
Thats actually neat
@young current Pretty much same thing
@upper gazelle previous code lines plz? is _group a group?
So what I could do instead of using the intersect surface, I iterate each interaction class and check if the memory point screen position is within a boundary to the center
@winter rose yes it is
https://community.bistudio.com/wiki/knowsAbout
who knowsAbout target
who must be local, while target can be remote.
this is in an FSM where _group is a group that has been passed to it through execFSM
who must be local, while target can be remote.
generic error has nothing to do with locality, in this case one of the arguments type is not what is expected
might _unitsUnknown have undefined objects? or be a non-array @upper gazelle
could be anything, @upper gazelle thinks we are all clairvoyant here
@unique sundial nah, just want to see if my sleep deprived brain is missing something
yes
@winter rose im double checking that right now
it is missing diag_log
oof
oof?
uhh... long story
oof.
lmao
@winter rose you were correct, i had messed up building my _unitsUknown array
thanks for the help!
w00t w00t
go get some sleep, though π
i would but i just hit another error π
im trying to get this FSM bug free before hitting the sack
you don't always have to; sometimes you would struggle for hours but after a fresh brain you go "oh, it's that" and carry on π
brain is a wonderful (and mysterious) machine
(next error though?)
another type error on one of my functions. the function works fine, which means my issue is with how im calling it somewhere
might just look at in the morning afterall lol
Got it working, thanks @unique sundial
Heya, I've got a little issue with playSound3D.
I'm using it to play a sound originating from a vehicle.
So far so good, but when the vehicle starts moving, the sound origin is not synced with the vehicles current/new location.
Is there a way to fix that?
I am a bit confused, where exactly does the root land you when you do an include? i.e. #include "...\path\to\defines.hpp", if we are talking about \path\to\profile\mpmissions\MyMission\... and on from there, i.e. into scripts, scripts\shared, and so on. If I read the docs I am left with the impression that maybe it lands me in mpmissions? or is it MyMission?
root is virtual filesystem root
current directory is the same dir where your mission.sqm is
I get that much, I need to know where it lands us.
getting some weird variables undefined after savegame loading - anything specific to do?
what was stored in the variables
https://community.bistudio.com/wiki/list
Calling list immediately after creating a trigger via createTrigger (and setting up activation, area, statements, timeout, etc..), will return <null> instead of an array. It seems the trigger needs about 1 second to initialise
I assume same thing
huh, so saying #include "scripts\shared\defines.hpp" is the same as saying #include "\scripts\shared\defines.hpp". that's easier than remembering relative paths.
no