#arma3_scripting
1 messages Β· Page 622 of 1
might be what im looking for
nvm
rsctitles
@winter rose that still makes the dialog below invisible sadly
ah well, then IDK. maybe it is not possible (though there are OK messageboxes in vanillaβ¦? π€)
maybe someone else knows the trick - this is out of my field, sorry!
BIS_fnc_guiMessage is what I use to display an "are you sure?" dialog.
Although it will still hide any other dialog (since only one can exist at a time)
so every "are you sure you want to leave Eden?" are declared, but hidden controls/forms?
I think Eden is different
Yeah, it is different than guiMessage
BIS_fnc_guiMessage is just a function using a fixed control, so can be used for everything
and I'm sure 3den either uses the exact same function, or a modification of it
@robust hollow I see what he ment. My typos snuck pass me when posting that source
is there a command to return the dimensions of a .paa file?
No, because (texture) files are not used in scripting
of course they are
You can set a string, but the file itself isn't touched
They are just referenced as path within pbo AFAIK, not more
you can use PAA files as elements in a dialog for example
doesn't mean that there should be a scripting command returning its size π€
unless youre trying to create UI stuff that dynamically depends on the size of images
but guess thats too advanced for bis..
back to the drawing board then it is
did you try it? shouldn't it rescale by using some relative size already?
didn't try myself
Why would you want that?
A bit annoying to display a 4k image on a 1080p screen...
what difference does it make when the element sizes would depend on the size of the images
a bit annoying trying to resize UI elements based on the image size when you cant get the image size
If you want to ensure the aspect ratio, than simply set that in the UI config
but like I said, time to design this thing differently then
And otherwise just have a transparent element and place the texture (any size) in there
no. you're not listening and making assumptions. it's about having UI elements reposition &/ change size depending on the image size I'm loading.. the image could be 128x128, it could be 512x128, it could be 512x256 etc etc...
depending on the image size, the elements need to be in different positions
trying to fit a 128x512 image to a.. lets say arbitrarily 256x256 will stretch the dimensions wrong in the image and thus make the other elements align wrong
We have a #arma3_gui by the way
Does it stretch the image to fit your control size by default or how does it work?
I'm not listening, I'm reading...
And you asked a question which we answered, without any additional info about what you want...
the point is trying to make a system that will work with ALL situations, where I dont have to have hardcoded sizes for 2000 different combinations that I have to manually add
Well, since you'll need a config entry for each texture anyway (to be used in scripting/GUI's), why not add the size in the config?
its using existing files from the game that dont have such data attached to them
I guess he preferred to automate it which makes sense. I still don't understand how it scales the image though.
to put it very simply, which is not what I'm doing here, but as an example.. UI elements like the box (frame + IGUIbackground) size would change based on the size of the image loaded and comboboxes would move to different locations depending of the size of the image
anyone got a good script for basic teleporting for a mission file
just need it for 4 different areas from a map at where you resapwn
@obtuse sigil that is not possible, since you can't get the size of random textures (unless defined somewhere).
@tough abyss my preferred method is to (an)use the respawn system.
Although a quick Google search will give you a lot of scripts and examples
iv had a look and either im blind
or just dumb
probably both
but it seems people like to over complicate it
waitUntil {_temp1 = _distanceToWaypoint; _temp2 = dropship1 distance target; _distanceToWaypoint = _temp2; _temp2 > _temp1};
What could be the issue with this? The error is "Generic error in expression" with the marked error at ...; _temp2 |#|> _temp1};
@obtuse sigil you can scale control maybe?
Does anybody know how to make break in description.ext onLoadMission = "text \n text"?
onLoadMission = __EVAL("text"+endl +"text");
If doesnβt work then dunno
will try. thx
@tough abyss @winter rose
is there a way to create a subdialog of a dialog?
You can define the "second" display as a RscControlsGroup inside the first display. You get nearly the same features as you would with 2 displays. (note that control positions in RscControlsGroup are relative positions)
I've used this trick to show a "confirmation message" before, and it works fine.
yep, I wondered if another solution existed
@amber lantern Did you define _distanceToWaypoint before? Do both dropship1 and target have the correct type? (object or position)?
What error do you receive in the log before that message?
ty @little raptor
How can I check the start of each element of an array for a string?
_array = ["some_string", "other_string", "some_integer"];
_findPrefix = "some";
_stringOnly = _array select {
(_x find _findPrefix) == 0
};
_stringOnly; // returns ["some_string", some_integer"]
true... I'm so used to using apply lately that I use it by default now π€£
changed the code
thank you grez very cool!
hmm why aren't my units moving or doing absolutely anything
if I enable dynamic simulation they are just frozen, too
They aren't even patrolling even though I set their behaviour to patrol via 3den enhanced
Restarting helped, but still if I now enable dynamic simulation it breaks again
hi all,
I am trying to figure out why im getting a Bool
RTP
21:37:30 Error in expression <"duration");
currentTrack = (_dayTracks select _selecter);
if(debugging == 1) t>
21:37:30 Error position: <select _selecter);
if(debugging == 1) t>
21:37:30 Error select: Type String, expected Number,Bool,Array,code
Main SQF
//plays during no weather conditions during day.
_dayTracks = "'daytime' in getArray(_x >> 'parameters')" configClasses (configFile >> "CfgMusic");
_Selecter = 0;
if(isDay == 1) then
{
//Normal music
_selecter = configName selectRandom _dayTracks;
playMusic _selecter;
duration = getNumber (configFile >> "CfgMusic" >> _selecter >> "duration");
currentTrack = (_dayTracks select _selecter);
if(debugging == 1) then
{
hint format ["Changed music to day Trackname: %1", (_dayTracks select _selecter)];
};
};
any suggestion? I've checked for typos in variable names and it doesn't look like there is any.
First;
_Selector = 0 <-- missing ;
Second;
what is debugging and where is it defined?
debugging is defined in the loop that fires the script to detect isDay which is also defined in the loop that fires main.sqf
and third; I would use private variables (private _duration = ..., etc.) instead of global ones, because it will mess up scripts when using the same variable name
well good news is things work now.
Any suggestions on a script for locking doors?
// lock door
building setVariable ["bis_disabled_Door_1", 1, true];
// unlock door
building setVariable ["bis_disabled_Door_1", 0, true];
decent forum post about the topic: https://forums.bohemia.net/forums/topic/212173-how-to-lock-doors-on-a-building-for-all-players-on-a-multiplayer-server/
@amber lantern
Restarting helped, but still if I now enable dynamic simulation it breaks again
If you're sure that's why it happens, then it's a bug. Report it on feedback tracker.
You can also try
_unit enableAI "ALL"
very strange behaviour when spawning AI in preInit inside a vehicle: when I spawn a unit and then use any of the moveIn* commands the unit becomes invisible and completely irresponsive. The units appear as AI, get counted, have variables, a side, etc... but seems like they are not properly initialized before being moved into the vehicle. Any examples of spawning a unit inside a vehicle in PreInit?
spawn?
createUnit
image gallery showing behaviour: https://imgur.com/a/sstsPYc
last image shows behaviour when I delete veh
script works fine in postInit, both called
yeah no I meant spawn π
but of course it would defeat the preinit thing
oh yeah, i require unscheduled for this
maybe create the units unscheduled, then spawn code that will create the vehicle then put them in?
is there any info about what happens when a game is loaded from a save? which variables and scripts are loaded and which are not? do we have a biki page for that?
how can I select the last part of a string if the first part varies? something like:
"foobarfoobar parttoselect"
"foobar parttoselect"
okay thats a start. but for example if i set a variable on a unit and save and load the game will it be there after the load? what about currently running scripts? are they terminated on save?
@tough abyss with the select command. it supports strings:
_string = "foobar parttoselect";
_find = "parttoselect";
_result = _string select [_string find _find, count _find];
``` (might need some adjusting on the find and count numbers)
@distant oyster thank you, how would I trim the last part then?
or better yet to ask this question properly, I want to only keep the first part of the string that varies and then remove the last part
the string is a function call turned into a string, so I just want to get rid of the call fnc_Function and keep the array at the start
_result = _string select [0, _string find _find];
that might be it, thank you
_string = "foobarxparttoselectpostpost";
_find = "parttoselect";
_result = _string select [0, (_string find _find) - 1];
``` just tested with sqfvm
ty, one more thing, i've seen select within a select is possible, how would I do that?
an array within an array select
_array = [0,1,2,3,4];
_range = _array select [1,3];
_range
``` returns: `[1,2,3]`. 1 is the starting index, 3 is the range to select
what I mean is
_array = [1,2,[2,3]];
and then select a value inside the nested array @distant oyster
ah okay. thats just selecting the array first and then selecting the element.
"nested arrays" is the term
is that possible within one line?
so i dont have to do this
_array1 = _array0 select 0;
_array2 = _array1 select 0;
I like as much code within one line as possible π
and also the aformentioned looks ugly
[0, 1, [22, 33]] select 2 select 0; // 22
_array2 = _array0 select 0 select 0; // ninja'd but I post it anyway
I want to get NPCs to loop some animation in a multiplayer setting and used switchMove before to achieve that but it didn't work. Then someone told me that I need to combine it with playMoveNow for it to work so I put the following into the units init-field but that also doesn't work.
Anyone got any idea how I can get the unit to do the animation in a multiplayer environment?
if (local this) then {
this spawn {
{_this disableAI _x} forEach ["ANIM","AUTOTARGET","FSM","MOVE","TARGET"];
sleep 60;
_animationSet = ("SIT_AT_TABLE" call BIS_fnc_ambientAnimGetParams) select 0;
_animation = _animationSet call BIS_fnc_selectRandom;
_this switchMove _animation;
sleep 0.33;
_this playMoveNow _animation;
[_this,"Jets_ID"] call BIS_fnc_setUnitInsignia;
};
this addEventHandler ["AnimDone", {
params ["_unit", "_anim"];
{_unit disableAI _x} forEach ["ANIM","AUTOTARGET","FSM","MOVE","TARGET"];
_animationSet = ("SIT_AT_TABLE" call BIS_fnc_ambientAnimGetParams) select 0;
if (count _animationSet > 1) then { _animationSet = _animationSet - [_anim]; };
_animation = _animationSet call BIS_fnc_selectRandom;
_unit switchMove _animation;
sleep 0.33;
_unit playMoveNow _animation;
}];
};
_array2 = _array0 select 0 select 0; // ninja'd but I post it anyway
@winter rose trying to use select on a number, are we?
@vague geode Have you tried without disableAI?
if sqf _array1 = _array0 select 0; _array2 = _array1 select 0;worked, my code will as well
!false
as long as it's not "false!" π
afaik you dont have to combine it with playmovenow
switchmove doesn't cause an animdone event either afaik
@willow hound Not this particular code but yes, I have tried to use switchMove without disableAI but also without success.
From what I know you only combine them if you already have an animation going on and want to switch immediately then do playmovenow to get the event
Also I'm a complete scrub at locality but shouldn't this be executed on the server only?
Should, but local this will only be true on the server.
ah ok
think i figured it out
{_this disableAI _x} forEach ["ANIM","AUTOTARGET","FSM","MOVE","TARGET"];
you disable ANIM here
@vague geode
Also I'm a complete scrub at locality but shouldn't this be executed on the server only?
Yes, it will BUT the effect of both switchMove and playMoveNow is global.
{_this disableAI _x} forEach ["ANIM","AUTOTARGET","FSM","MOVE","TARGET"];you disable ANIM here
@tough abyss Yes, but as far as I know it only disables to unit's ability to change animation itself.
That line of code is also used in the BIS_fnc_ambientAnim function (line 115):
/* [...] */
//surpress the unit "intelligence"
{_unit disableAI _x} forEach ["ANIM","AUTOTARGET","FSM","MOVE","TARGET"];
/* [...] */
Not sure then
Yeah, me neither which is why I am asking...
(BTW just in case anyone is wondering why I am not just using BIS_fnc_ambientAnim, it's because I spawns a logic entity every time someone joins the server which quickly amount to dozens of useless logic entities reducing performance)
@vague geode remove the sleep 60; while debugging btw, that might be why the animation is not appearing
as youre not waiting 60 seconds
also might be the scheduler thats screwing you over
I tested it without the scheduler and the anim appears
Same with the locality check, although im not sure why
The spawn is needed due to the sleep(s), and that shouldn't cause any issues within a mission.
As for locality... this is still a black box for me...
Although if all you want is to prevent the mass-spam of Logic Objects; simply use
[_unit, "SIT_AT_TABLE", "NONE", objNull, false, false] call BIS_fnc_ambientAnim;
@vague geode remove the
sleep 60;while debugging btw, that might be why the animation is not appearingas youre not waiting 60 seconds
@tough abyss The NPCs are located on an aircraft carrier which is seven klicks away from the spawn and to get there I am using a helicopter support which only becomes available two mikes (120 seconds) after mission start so the code should definitely be executed when I get there.
The
spawnis needed due to thesleep(s), and that shouldn't cause any issues within a mission.
As for locality... this is still a black box for me...Although if all you want is to prevent the mass-spam of Logic Objects; simply use
[_unit, "SIT_AT_TABLE", "NONE", objNull, false, false] call BIS_fnc_ambientAnim;
@exotic flax I tried that as well but it did not appear to work. The logic entities still got spawned...
@exotic flax The responsable part of the BIS_fnc_ambientAnim-function is in line 417 to 466...
I see, it will create the logic, but don't attach the unit to it (meaning it can still float away)
_array2 = _array0 select 0 select 0; // ninja'd but I post it anyway
@winter rose
π
_array2 = _array0#0#0;
YOU MONSTER!!
xD
I have not looked at the BIS_fnc_ambientAnim source code (can do that later if you want me to), but it might work without spawning game logic entities on every client if you just call it like so:
if (isServer) then {
[...] call BIS_fnc_ambientAnim;
};
it will synchronise their existence on the network though
I made my own BIS_fnc_ambientAnim with blackjack andβ with only one logic placed at [0,0,0]
I have not looked at the
BIS_fnc_ambientAnimsource code (can do that later if you want me to), but it might work without spawning game logic entities on every client if you just call it like so:if (isServer) then { [...] call BIS_fnc_ambientAnim; };
@willow hound True, the only problem is, that the animation won't work. (I know that because I tried that as well.)
@winter rose Are game logics local?
nope, it's a "unit" like any other one. I tried createVehicleLocal and attachTo server-side, but it ended up having all units to disappear (I suppose to [0,0,0])
Why in Miller's name does it create a new one for every client then?!
not "one for every client"? π€¨
?
well maybe, yet some logic AI is enabled
I made my own because I didn't want one logic per soldier
they use a logic because if you were to attach to, say, a rock, the animations would stutter as they are tied to the simulation rate of the object to which they are attached
Everyone else just uses a cute little helper object
Could probably use the chair itself right away, but I have not animated sitting people in a long while
a chair will stutter the animation as well
Will have a look after food
no, now!1!
does parseSimpleArray have problems with single quotes?
because im getting a generic error for that
if so, how would I remove them from an string?
no, it doesn't care about single quotes, as long as the string has double quotes around them
_string = "[1, ""2"", ""3'4""]";
_array = parseSimpleArray _string;
_array; // returns [1, "2", "3'4"]
how would I give double quotes to every single entry of an array string then?
its made with a script not declared
what I have is "[foo, bar, 'foo', 'bar']"
but why?
If you create an array, why not make it an array instead of a string π€
because it goes through like 10 million hoops before the final result there
although i could probably cut it
Maybe just dosqf '[foo, bar, "foo", "bar"]'
not to mention that foo breaks, since it's not a string but a variable (which returns <null> is not defined)
@warm hedge also doesn't work
Hmm
is there some sort of reverse format function?
where you take a part of a string and turn it into a variable value
but why not use pushBack to put (new) stuff in the array
exactly
thats what i mean
go from comma to comma, take the value and then pushback
into a new array
_array = [];
while {whatever} do {
_array pushBack someValue;
};
_array;
I mean from what I currently have monke
because parseSimpleArray only makes sense when working with extensions (like ExtDB)
take this array string, go from starting [ to comma, then to comma, then to comma, etc. and inbetween those take the value and turn it into another string as a variable value
i.e a reverse format function
but where does that messed up string/array come from?
because that should be fixed, not the method to extract data from it
its values within a listbox row for a function call
specifically ace_medical_fnc_addDamageToUnit
working with the original values is fine as they come in a string, then i use format to turn them into one string, and then call compile when needed
now the problem is, I save these values into another string, and need them as an array
so don't save them as a string
setVariable accepts everything, also arrays
yes, but the values within that array are strings
so?
remember, I'm taking something like "[person, 0.6, 'Body', 'bite]"
_array = [123, "456", objNull, true];
uiNamespace setVariable ["mySecretArray", _array];
_mySecretArray uiNamespace getVariable ["mySecretArray", []];
as a listbox row only can store a string as data
in that case; have a "global" array with all the data, and only store the key of that array
@vague geode Slightly modified your code and it worked in singleplayer and hosted server preview (Arma was not happy with sleep in the EH code - what was it used for?):
if (isServer) then {
this spawn {
{_this disableAI _x} forEach ["ANIM","AUTOTARGET","FSM","MOVE","TARGET"];
sleep 0;
_animationSet = ("SIT_AT_TABLE" call BIS_fnc_ambientAnimGetParams) # 0;
_animation = _animationSet call BIS_fnc_selectRandom;
_this switchMove _animation;
};
this addEventHandler ["AnimDone", {
params ["_unit", "_anim"];
{_unit disableAI _x} forEach ["ANIM","AUTOTARGET","FSM","MOVE","TARGET"];
_animationSet = ("SIT_AT_TABLE" call BIS_fnc_ambientAnimGetParams) # 0;
if (count _animationSet > 1) then { _animationSet = _animationSet - [_anim]; };
_animation = _animationSet call BIS_fnc_selectRandom;
_unit switchMove _animation;
}];
};
If it still doesn't work for you, you might have to ask Lou for his LM_fnc_ambientAnim and try that.
This command will not cause an AnimChanged or AnimDone event. However, playMove will.
@willow hound
might want to use that instead of switchmove
@willow hound The problem wasn't in singleplayer and hosted server in the 3Ditor but on a "real" server. It has worked on both before but it does not online for some reason.
Hey guys,
I have a script, and I want to run it when a certain ammo type impacts. How should I go about it? I tried to dig into ACE configs to see how frags and etc works, but couldn't figure it out. πΌ π
someone know how to get the vehicle ammo ? example if the vehicle ammo is "1" it's full
There's no such command. You have to go through all weapons and check their ammo against full mag ammo.
@carmine quail What kind of impact? If you want to change the impact effects, don't use scripts. Change the effect file.
@little raptor oh ok but which command to do that ? because i'm a little bit confused
AFAIK you should use weaponsTurret
or maybe weapons too
Not sure
Then check the weapon ammo against mag count value in config
Anyone can explain me the thing...
After the latest patch, In our multiplayer mission I started seeing lots of scuba divers at the lower-left corner of the map. The mission did not create them.
If I run the script in the debugger, I get
p = ((screenToWorld [0.5, 0.5] nearObjects ["Man", 100]) select 0); typeOf p
// "Mackerel_F"
p = ((screenToWorld [0.5, 0.5] nearObjects ["Man", 100]) select 0); allVariables p apply {[_x, p getVariable _x]}
// [["_thiscreated",1],["_totalrunning",14],["_task",<null>],["leader",any],["_totalcreated",988],["members",[]],["_thisrunning",0],["_tasktype","Animal Main Task"],["_this",Agent 0xd0c20180],["state","move"]]
And they are considered "agents" rather than "units". What's going on? What created them?
oh ok thx @little raptor
@faint oasis Also, you must look up the magazines value for each weapon in the config, to make sure all mags are there
@quartz pebble sounds like the animal presence module (or similar)
fish are automatically created as ambient animals
Do you use any mods?
but why they are scuba divers? and why are they visible in spectator as units?
(no mods - vanila game)
Which version of the game?
I personally don't see anything on the latest DEV branch build
Type: Public
Build: Stable
Version: 1.98.146728
I personally don't see anything on the latest DEV branch build
I could attach screenshots - I'm on the server right now and see it right now - but discord doesn't allow
Anyone know if there's a way to make an AI unit tankier? (Using ACE medical)
Do variables on player object always reset when he respawns in MP?
I believe not
@quartz pebble Is that your mission? If not, maybe the mission maker uses them (if they're agents, maybe for path gen or something)
Hello y'all, Hopefully someone can help me or point me in the right direction. So I have a script that sends data that was entered by a player to my Database, it works. But I want to find out how to automatically log it to a channel in a discord I have setup.
@little raptor it is mine. All the code was written by ourselves and nothing was taken from "untrusted sources".
@quartz pebble After actually reading this:
p = ((screenToWorld [0.5, 0.5] nearObjects ["Man", 100]) select 0); typeOf p
// "Mackerel_F"
p = ((screenToWorld [0.5, 0.5] nearObjects ["Man", 100]) select 0); allVariables p apply {[_x, p getVariable _x]}
// [["_thiscreated",1],["_totalrunning",14],["_task",<null>],["leader",any],["_totalcreated",988],["members",[]],["_thisrunning",0],["_tasktype","Animal Main Task"],["_this",Agent 0xd0c20180],["state","move"]]
I noticed that it's actually an animal (Mackerel_F). You're just returning the fish in that area.
I'm not sure about the scuba divers or why they spawned there. This doesn't say anything
how do i go about finding the script for towing a car
Google?
already looked i was going to port into another game made bohemia if possible
So googling tow vehicle script arma 3 didn't give you any?
i was going to port into another game made bohemia if possible
wait... what?
i only see Arma 2
if I search for "Arma 3 tow script", the first like goes to the BI Forums with a mod/script for Arma 3
i dont see the BI Forums with the mod only steam
BI Forums: https://forums.bohemia.net/forums/topic/188980-advanced-towing/
Mod on Steam: https://steamcommunity.com/sharedfiles/filedetails/?id=639837898
GitHub with source: https://github.com/sethduda/AdvancedTowing
Im rlly new to this so here is my question, maybe somebody can help me.
Is it possible to make a script that gives players a specific rank insignia from the mod
https://steamcommunity.com/sharedfiles/filedetails/?id=888902496
Depending on the playerid ?
Yes
without looking into the mod, i imagine you want something like this
private _class = switch (getPlayerUID player) do {
case "7656.....":{"CTRG15"};
case "7656.....":{"MANW"};
case "7656.....";
case "7656.....":{"Curator"};
default {"CombatPatrol"};
};
[player,_class] call BIS_fnc_setUnitInsignia;
"Break Box", // Title of the action
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", // Idle icon shown on screen
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", // Progress icon shown on screen
"_this == side _caller", π
"_caller distance _target < 3",
_this == side _caller ...is there another way to get this to work ...i want the addaction to show up for the _caller teammates only
how would i make it so i cant leave a trigger?
@harsh vine there is a couple of things wrong with that but to fix them it may be useful to know the following first:
how are you adding that action? how does each individual player know who the caller is?
That seems like it, yes.
Would that go into the initPlayerLocal.sqf?
it should work there, sure. you may need to reapply it if a player dies though.
Hi there folks, I am stuck with something that is probably horribly obvious, but I just can not put my finger on it.
I am running this code, within a script that is local to the server (isServer) and on a popuptarget array that is defined and placed on the VR map.
_x addEventHandler [
"Hit", {
if ((_this select 0) getVariable "isHostage") then {
playSound3D ["a3\Ui_f\data\Sound\CfgNotifications\taskFailed.wss", _x];
};
(_this select 0) animate ["terc",1];
(_this select 0) removeEventHandler ["Hit",0];
}
];```
The script works, when I remove the if condition but stops working when it is added.
I am sort of blind to what the issue could be.
_x isnt defined in the event scope
So (_this select 0) should work? Cause I already experimented around with replacing _x with that one and it did not work either. isHostage btw is givin via setVariable in the object init
varspace issue?
yes (_this select 0) instead of _x in the playSound3D line should fix it, or at least remove that issue.
another thing you might want to do is provide a default value with getVariable, just to be safe.
(_this select 0) getVariable ["isHostage",false]
that is a very good point, will try it, brb
Okay... it seems to work now, sort of.
Might change the object its played on to one of the placed speakers
Thank you very much Connor!
how can i create an HUD Gui ?
because when i create a dialog with "createdialog" function i can't move
cutRsc or create your controls directly on display 46
cutRsc is usually the way to go
yes
because to create a controls on the display 46 i need to use the "sqf" with find display
so thx i will try cutRsc
@robust hollow the gui need to be in "RscTitle" ?
"RscTitles"* yes
class gui_teste {
idd = 502;
movingEnable = true;
enableSimulation = true;
};
because i have that
you also need these in an rsctitle
duration=1e+011;
fadeIn=0;
fadeOut=0;
the duration is how long you want it to stay open for, so there it is a generic big number which effectively means it wont close itself.
i want the gui "stay open"
always
i have that now
class RscTitles
{
class gui_teste {
idd = 502;
duration=1e+011;
fadeIn=0;
fadeOut=0;
class Controls {
class RscFrame_1800: RscFrame
{
idc = 1800;
x = 0.834688 * safezoneW + safezoneX;
y = 0.908 * safezoneH + safezoneY;
w = 0.143437 * safezoneW;
h = 0.051 * safezoneH;
};
};
};
};
it's in .hpp
can i include it to a description.ext ?
yes
ok
@robust hollow i have added : cutRsc ["gui_teste", "PLAIN"]; and it work perfectly
but how can i close the rsctitle ?
if you use a layer name like
"myLayerName" cutRsc ["gui_teste", "PLAIN"];
you can then do this to close it
"myLayerName" cutFadeOut 0;
it can be what ever you want. it would be best if it is something unique though, the point of it is to avoid conflicts with other addons. personally I put my prefix in front
eg: "BIS_myLayerName"
how would i make it so i cant leave a trigger?
i dont have experience with triggers so cant give the best solution, but a hacky one would be to setPos the unit back into the trigger on deactivation (them leaving it?)
ok
@robust hollow i have added that
class RscTitles
{
class Tickets_Gui {
idd = 1954;
duration=1e+011;
fadeIn=0;
fadeOut=0;
class Controls {
class Tickets_Shower : RscText
{
idc = 1955;
text = "German : 500 | USA : 500";
x = 0.428281 * safezoneW + safezoneX;
y = 0.00700002 * safezoneH + safezoneY;
w = 0.151406 * safezoneW;
h = 0.034 * safezoneH;
};
};
};
};
it work
but
how can i find the display ?
because i use "finddisplay 1954" but the command return "no display"
onLoad="uiNamespace setVariable ['Tickets_Gui',_this select 0];"; instead of an idd. idd doesnt work with rsctitles, idc still does but you use the variable as a reference instead of finddisplay
you may still need to define idd because displays need them. just do idd=-1;
Hello y'all, Hopefully someone can help me or point me in the right direction. So I have a script that sends a log of the form that players filled out in a GUI to my Database, it works. But I want to find out how to automatically log it to a channel in a discord I have setup.
There are some arma 3 discord bots you can take apart and research
player setPos (getPos player);
``` why isnt this working?
It's trying to set the position of the player to...their current position. How would you tell if it's not working?
The two possible outcomes of the code functioning correctly are either "no noticeable effect" or "constant setpos freeze locks them in place with no way to escape". I suspect the first outcome is what's happening.
If you want to force return them to the playable area, you need to locate a position inside the playable area and send them there. There are probably a few ways you could do that.
Good evening to you, I have a small problem with this script....
The two objects do not overlap ...
An idea of why and how?
Thank you in advance
_obj2 setPos (getPos _obj1);
_obj2 setVectorDir (vectorDir _obj1);
_obj2 setVectorUp (vectorUp _obj1);```
https://www.youtube.com/watch?v=LXEC0NjnlrA
try setVectorDirAndUp?
try
setVectorDirAndUp?
@winter rose Well that's fixed, thank you.
use getPosWorld setPosWorld and setVectorDirAndUp
Thank you this is perfect
I'm having a problem here with createSoundSource
I'm trying to make an alarm sound coming from a speaker. It works, BUT of course it does not for the exact alamr sound I wish to use. It is called "Alarm" and I have no clue why it wont read it
I have a createSoundSource question too, is there any alternative that lets me have looping sounds created via script, but aren't global like CSS objects are?
@cobalt leaf https://community.bistudio.com/wiki/createSoundSource has everything you need
Thanks
Hello, I have a question about using player to activate triggers :
In a multiplayer game, player reffers to any player controlled unit, or only the player designed unit ?
For exemple : I want a trigger that goes on whenever any player hops into a static MG .
Using :
player = vehicle _thatstaticmg
in the trigger condition means that any player entering the MG will trigger it, or all the players have to be in it ?
(I'm asking because I can not really try this since I don't have anybody else to try it with me)
Yeah I think I got the vehicle function wrong here
Also local variables aren't defined in your trigger
Okay but i'm wondering if it takes any player in a multiplayer game @robust hollow
player will be the unit of the person executing the condition
so for your condition you would want vehicle player == _thatstaticmg
to say if the vehicle the player is in matched _thatstaticmg
is it known that copyToClipboard cant export non English locale? or is there some workaround to it?
also when using structured text?
I recommend using toArray to convert the string to UTF16:
toArray "ΠΏΡΠΈΠ²Π΅Ρ"
Then convert it back to string using an external program. (if you want to use it inside Arma, you can use toString)
That's all I can think of
as far as a workaround goes you can open the data to copy in an edit ctrl (non-editable) and the user can manually select and copy it
uiNameSpace setVariable ["Display3DENCopy_data",["title?","content to copy"]];
findDisplay 46 createDisplay "Display3DENCopy";
(works outside of 3den)
probably worth mentioning: i suggest that because even if the character has issues with other commands or cant be displayed in the font, it does copy out when doing ctrl+c (in my experience)
@velvet merlin This is something I wrote that can do this:
_chars = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];
_fnc_getHex =
{
_code = "\u";
for "_i" from 3 to 0 step -1 do {
_quo = floor(_this/16^_i);
_code = _code + _chars#_quo;
_this = _this - _quo*16^_i;
};
_code
};
copyToClipboard (toArray "ΠΏΡΠΈΠ²Π΅Ρ" apply {_x call _fnc_getHex} joinString "")
Use the Notepad++ plug-in "HTML Tag" -> Decode JS (ctrl+shift+J) to convert it back to Unicode text
_near = getPos Box_1 select 2 < 2; //attached object
ropeUnwind [ropes heli_deposit_1 select 0, 5, _near, true]; //_near is the length if the rope;
//hehe i tried π
does anyone knw how to make a heli unwind its rope until, the attached objects is x meter off the ground.
Pseudo code:
wind rope
while until rope is desired length
stop wind
Or measure length from heli to ground - height of object from ground you desire
And you'll have your rope length
So if heli is 10m high and you want object to be 3m off the ground
10-3=7
So unwind rope to 7m
I recommed the latter option
@harsh vine ^
i knw how to do the measuring part, just that i have random locations for the heli to hover and each terrain is kind of different so thats why.
measure length from heli to ground
getPosATL or getPos should do?
@winter rose not when object is on a building or other surface
For this, use lineintersect
getPos should work
β¦always has?
Thank you Lou
also, getPosASL select 2 for both, subtract, ???, profit
Great
Anyways, you have your solution, i dont know the problem anymore?
I'm a bit feverish atm due to ear infection so maybe i should drop
Hey there - is there any possibility to set/get the marker height in the 3DEN Editor? Or does any mod exist to manage the height?
I think it should scale with your UI scale settings in video options?
I think he means height as in Z-axis ^^
yeah exactly π
when double-clicking on it, there is no Z field I assume?
No unfortunately not, this would be cool
Markers are only available in map, which is a 2D format, so Z is pointless
nope, Z value can be used for respawn purpose
Ah
otherwise they wouldn't have added it to createMarker π
Yeah, Z is stored IIRC but it's not available to edit easily
Yeah we need it for spawning reasons and therefore it would be great to set the height via editor instead of exporting it and manipulating it afterwards :/
in vanilla, you can either use createMarker, or setMarkerPos, or edit mission.sqm
it would be a nice thing to have in editor, you can create a feature request on the Feedback Tracker if it doesn't exist already
Sometimes I actually wish a way to show/edit markers in Eden Editor in 3D
especially visibility zero markers
it's a whole game in itself finding the blighters
Trying to get dedi server to push vehicle init to players but is unsuccessful. This is my current broken attempt, anyone care to take a look and assist in this pretty light scripting? https://pastebin.com/dXf84Bah
sure, if you tell what the error is
Error in "this". It doesn't fire off on the vehicles, so no addActions or ACE Inventory item for player in editor placed or Zeus placed vehicles of the type. Testing in editor local MP.
use _this
I am tempted to ask "why do you care?" variables are not case-sensitive anyway
case doesn't matter in variable names
because I'm doing a preset system so I'm asking to see if i should store the name inside the variable itself and not use its name
bad thing, don't do that.
the variable names are saved in lower case afaik. But yeah, dont
because the principle of the variable is to hold data, not to be one by itself π
exception made for a quick check of "has variable", nothing more
it is also more optimal to save all of your variables in one array in the namespace
oki thank you
it is also more optimal to save all of your variables in one array in the namespace
if you want to save some "names" like you mentioned. It generally depends on how you want to implement this
Thanks @winter rose works as intended
Hey guys,
Is there a way for me to use the Fired eventhandler to remove a bullet that has been shot but still allow the unit to throw hand munitions?
Since just deleting the projectile deletes grenades aswell
Check the type of projectile inside the EH.
If it's a Throwable, don't delete it
there's no need to check the projectile.
@wise frigate Simply check if the weapon is "throw"
this addEventHandler ["FiredMan", {
params ["_unit", "_weapon"];
if (_weapon == "throw") then {//hand weapon
}
}];
That works, thanks
Anyway to return subtype of a vehicle? ex: helicopter will return "Air"
or do I have to get hacky with isKindOf
I posted a question last week but I got busy and wasn't able to follow up. I'd like to as it again if that's alright.
I'm trying to get a unit (M1) to fire on the location of a trigger (arty1) via a mortar but he won't fire off any rounds
I tried doing checking if the unit was in range but inRangeOfArtillery always returned false
and are you sure it is within mortar range?
Yeah, the unit is within 500-600m of the trigger which is named arty1. Do I have to instruct the unit to change to medium mode via the arty computer?
should not - vanilla, no mods?
not vanilla
I use a script to spawn the mortar infront of the unit and force the unit to get in the gunner, but the unit doesn't aim at the position or fire any rounds
[M1] spawn {_pos = (_this select 0) modelToWorld [0,1,0];
(_this select 0) playMove "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";
removebackpack (_this select 0);
_mortar = "B_G_Mortar_01_F" createVehicle _pos;
sleep 2;
(_this select 0) moveInGunner _mortar;};```
The unit has a "fire mission" waypoint also
@agile pumice arty1 is a marker correct?
thereforesqf getMarkerPos "arty1"
please use the -showScriptErrors flag in the launcher, it will tell you the issue immediately
it is not a marker
Why would it need to be a marker? https://community.bistudio.com/wiki/doArtilleryFire just requires a position, so I used position arty1
have you been using the -showScriptErrors at all? If so make sure you check your RPT log
nope nope, my bad - I did read "trigger" as "marker" @agile pumice, nevermind my message
(position arty1) inRangeOfArtillery [[M1], "8Rnd_82mm_Mo_shells"] returns true when the unit is on the mortar
I'm restarting my game with showscripterrors enabled via the launcher. I could have sworn I remembered script errors come across my screen previously
There currently aren't any script errors showing after I enabled it
I can place a manned OPFOR mk6 mortar and assign a fire mission waypoint and it works fine
I tried using an opfor unit now instead of a civilian unit and still nothing
(screenToWorld[0.5,0.5]) basically is the center of your screen/cursor, right?
screen centre yes
ty
does anyone know of a way to detect which pylon on an aircraft is assigned to which turret? (usually but not always just related to helicopters with separate pilot and gunner)
Hi all
since getPylonMagazines doesnt return the turret the pylon is assigned to
Is it possible to call a image from the mod file?
Example: LoadingScreen.png
@MyOwnMod>Addons>server.pbo
it's the same path as on your P drive, just without the P:
eg. \MyOwnMod\addons\server\path\to\LoadingScreen.png
ah ok. i try now
wouldnt it be without the addons though? \MyOwnMod\Server\path\to\LoadingScreen.png
yep
again; depends on you P drive and setup
eg. I use the ACE/CBA method, which uses \x\NameOfMod\addons\NameOfAddon\path\to\files
and without the first \ ?
not to mention
- Must be in PAA file format.
- 2:1 aspect ratio (different aspect are rendered correctly as well, but won't cover the whole area).
- Ideally 1024x512 pixels.
ok it worked now thank you
define create task module
createtask scripting command according to wiki should return the task that you can store in a variable
no I want you to explain what you mean with "create task module"
because saying create task module doesnt make any sense to me
I imagine if you use that system to create the task, you must use the same system to update the tasks
either use scripting for all parts of tasks, use that module for all parts, or use that task framework that leopard20 linked for all parts
because the variable returns an object and not a task
you have an Object on the map that you have named task1, not a variable for a task
dude, I've been out of the scripting and mission making scene for 10 years right now, no idea how you're supposed to use this new stuff.. just giving my 2cents about how it has always been with bis
you are not naming the task with the module, you are naming the object that creates the task
if you do task1 = createtask yadayada task1 is the variable with the task
variables work with every script
its the type of data that has to be correct for the scripting command to be able to work
you can use global variables, you can use private local variables, but there is always a danger of doing it one way or the other
there are many ways of doing that, and many ways to break everything doing that
if you are creating a multiplayer mission, it will be a nightmare for you until you learn and understand locality of.. well.. everything
scripts will work completely differently in singleplayer, hosted multiplayer and dedicated server multiplayer
so you will never upload the mission anywhere for anyone else to play?
well then there is a high chance your scripts wont work for other people, when they play on dedicated server..
always test on dedicated, hosted and SP
all 3 need to be tested
there is no simple way to say how to "fix" it.. your code needs to run the right way in the right place for everything to work
well, for example.. if you just use createvehicle to spawn a vehicle.. you test it on single player, it works great.. then you go on 20 player server, run the same script and you will create 20 vehicles because the code is run on everyones computer
there is a start
also JIP (join in progress) players (meaning players who join server while the mission is running) are 4th thing that will break every script
if you stop your script there, it will stop and not continue.. most of the time you need to make scripts that keep running even if there is a state where it can't do something...
I'd just tell you to learn to make single player missions first.. once you get things working there you can start learning MP missions, you will otherwise get very overwhelmed
but, for an MP mission one simple workaround for the createvehicle would be: if (isDedicated) then { createvehicle code }; and then you can still continue your script if you have to
then you can run the same script on both client and server, but the vehicle will only get created on the server
but of course, the isDedicated returns false when you test it on single player.. soo..
Hey everyone, I want to add a script to a waypoint and pass two variables to that script. I know that it looks something like this: obj addWaypointScript βwaypoint.sqfβ. How do I pass variables to the waypoint.sqf script?
have you checked the wiki?
If these variables are just constant variables (number or string), you can use the wiki syntax.
Otherwise, you can add the variables to the group itself (since waypoints are specific to each group)
[_grp, 2] setWaypointScript "somescript.sqf [1,2,3,4,5,6,7,8]";
Or:
_grp setVariable ["TAG_fnc_args", _args]
@winter rose yes Iβve checked the wiki but the variables I want to pass are not number or string. Thank you @little raptor
BTW, a workaround to the first issue is to use global vars
[_grp, 2] setWaypointScript "somescript.sqf [VAR1, VAR2]";
or maybe vehicle var names
And what is the better solution in your opinion?
What kind of variables do you want to pass to the script?
array, object, string, number, etc.?
An object resulting of createVehicle
use:
object setVehicleVarName "SomeName";
and then:
[_grp, 2] setWaypointScript "somescript.sqf SomeName";
Thank you @little raptor and if I may ask, what does the 2 mean in the brackets? [_grp, 2] ...?
waypoint ID
It is the same as what you receive when you use addWaypoint
Waypoints are in format:
[grp, Index]
Ahh I see, thank you π
you could simply say:
_waypoint setWaypointScript "somescript.sqf SomeName";
Thatβs more convenient
also, if you use a vehicle var name, there's no need to pass it to the script anymore. You can simply use that variable inside the script.
_veh = SomeName;
you can also use a global variable instead
So if I use object setVehicleVarName βSomeNameβ, I can simply use _wp addWaypointScript βsomeScript.sqfβ?
yes. you can use the variable inside the script itself
this is true about all global vars
I see, thank you @little raptor π
What script would make my AI Heli exfil leave once all units that are alive from the playable squad are in the chopper
_units findIf {
!(_x in _chopper)
} == -1
is this a SP mission?
Something like:
_landPad = createVehicle ["Land_HelipadEmpty_F", _landPos];
_chopper land "GET OUT";
waitUntil {
sleep 1;
_units findIf {!(_x in _chopper)} == -1
};
_chopper land "NONE"; //take off
Depending on how this is set up, there are better alternatives tho
_units is the list of units. For example, for player's squad:
_units = units group player;
So if my group has 6 units, p1, p2 etc
and the group is named Razor
how would I input it into the script
How do you want to set up the mission?
waypoints? triggers? How (and when) do you want to call in the chopper?
Did you try using supports? (heli transport module)
task5d is a trigger?
yes
Assuming that the landing pos is the same as the trigger pos, you can put this in the trigger activation statement:
_WP = (group MY_HELI) addWaypoint [getPosASL thisTrigger, -1];
_WP setWaypointStatements ["true", "[] execVM 'land.sqf'"];
And create a file called "land.sqf" in the mission file. Put this in it:
_landPad = createVehicle ["Land_HelipadEmpty_F", ASLtoAGL getPosASL task5d];
MY_HELI land "GET OUT";
waitUntil {
sleep 1;
units group player findIf {alive _x && !(_x in MY_HELI )} == -1
};
deleteVehicle _landPad;
MY_HELI land "NONE"; //take off
MY_HELI is the name of the heli.
aigh thanks
But what does the heli do in the background? Currently I got it only to stay landed for 30 s
when the trigger is activated it enables the simulation for the Hiey
- updated the code
π π
Is it possible to call a "another.sqf" from the mod file?
Example: ExileTraderObjects.sqf
@MyOwnMod>Addons>server.pbo
P Drive Path: P:\RD\RD_Client\data\Traders\NPCs\ExileTraderObjects.sqf
Use the CfgFunctions, execVM, or any of the many other methods
i use execVM code
but not show in the server
i use code:
0 execVM "RD\RD_Client\data\Traders\NPCs\ExileTraders.sqf";
Correct ?
initPlayerLocal.sqf:
// Static Objects
///////////////////////////////////////////////////////////////////////////////
// Taken away for now
//#include "initServer.sqf"
if (!hasInterface || isServer) exitWith {};
0 call compileFinal preprocessFileLineNumbers "MarXet\MarXet_Init.sqf";
// NPC Traders
0 execVM "RD\RD_Client\data\Traders\NPCs\Master.sqf";
0 execVM "RD\RD_Client\data\Traders\NPCs\ExileTraders.sqf";
//StatusBar
0 execVM "ClientCode\StatusBar\StatusBar.sqf";```
I did it that way. did not give an error.
However, the objects did not appear in the game
- no need to add 0 everywhere, since it won't do anything (unless you need to parse that value to the scripts)
- the file paths are relative, so add a
\in front of it
Does anybody know if there's a way to get agents out of "panic" mode (playAction "Panic"), other than switchMove <idle animation>? playAction "" and playAction "Default" don't work
tried both ways but the vendors didn't come
execVM "RD\RD_Client\data\Traders\NPCs\Master.sqf"; and execVM "\RD\RD_Client\data\Traders\NPCs\Master.sqf";
@exotic flax
I have a beginner's question: What is a way to terminate a globally executed function from debug console?
Eg:
globalvar = [ obj1,scalar1,scalar2 ] execVM "fn_script.sqf";
I figured that redefining the globalvar with incorrect arguments would stop it (and it did). But does the engine have a direct termination function of some sort?
Thanks @willow hound
So idk if I'd post it in here but I've been thinking about this for a while. The Crysis suit mod gives you the ability to become "invisible" by using the scroll wheel. Would it be possible to make the same thing happen but bind it to a keybind? I've been thinking about making my first mod be something like the Ghost Recon: Future Soldier Optical Camouflage system.
What's a good way to pad a string with 0s?
toArray, set size, apply I guess?
private _class = switch (getPlayerUID player) do {
case "7656.....":{"CTRG15"};
case "7656.....":{"MANW"};
case "7656.....";
case "7656.....":{"Curator"};
default {"CombatPatrol"};
};
[player,_class] call BIS_fnc_setUnitInsignia;
It seems like im not rlly getting it to work. Can somebody help me set up a script giving Insignias to players dependent on the ID , using the ranks from this modhttps://steamcommunity.com/sharedfiles/filedetails/?id=888902496
Is there a weapon pullout/unholster player evh?
Hey guys, bit of a complex question:
Got this error:
_prevCount = 0;
{
_curCount = _x;
if (_forEachIndex == 0 || _curCount >
0:47:06 Error position: <_x;
if (_forEachIndex == 0 || _curCount >
0:47:06 Error Undefined variable in expression: _x
0:47:06 File m\mf7\addons\offload\fnc_emergencyDump.sqf..., line 59```
Code structure is as follows(parts omitted ofc):
```sqf
{
_hcIndex = 0;
_prevCount = 0;
{
_curCount = _x;
if (_forEachIndex == 0 || _curCount < _prevCount) then {
_hcIndex = _forEachIndex;
_prevCount = _curCount;
};
} forEach GVAR(HeadlessLocalCounts);
} forEach _groupArray;
Im wondering here as since the code structure seems fine and _x is a magic variable, would this be an error that can be cause by the server struggling? (this is a serverside script)
check your GVAR(HeadlessLocalCounts)
how so?
e.g systemChat
also, the forEach _groupArray doesn't do anything but run the same code multiple times
this is a snippet ofc there is a lot more to it but I just provided the relevant sections.
Top of the _groupArray loop is as so:
_groupMoving = _x;
_lead = leader _groupMoving;
_size = count (units _groupMoving);
_leadOwner = owner _lead;
_vehicle = vehicle _lead;```
anyway
Error Undefined variable in expression: _x
means that you either have anilin your array, or that your array is not defined at all
Well that gives me a start on where my issue is
debugging is half the fun, innit π
damn right, now i gotta figure out how it gets a nil in there. I know its initialized so its likely something to do with the disconnect EH. This is a script that runs if a HC drops.
you are not editing the array as you go through it?
im using set to update the values in it as it stores one element per HC. The only instance where it changes the number of elements is if a HC connects or disconnects
GVAR(HeadlessLocalCounts) set [_hcIndex, (GVAR(HeadlessLocalCounts) select _hcIndex) + _size]; the update
Is someone german here?
Any way to configure what gets output in the .rpt? I think this is an engine-level request. About 95% of my server .rpt is filled with
2020/10/05, 21:22:10 Server: Object 2:4133 not found (message Type_113)
... and if I could ask the server to restrict my .rpt to script errors that would make my life muuuch easier.
Only nil in array @winter rose
Foreach is iterating so the array is existing
@tough abyss plenty of people are german here
I dont think you can configure the .rpt. Its only on/off I believe. Someone may know something I dont though.
i iz tired oki? π
lel, its all good. I know that
its just figuring out why its getting a nil in there
@worn forge there are Tools out there to Filter rpt log Files
Yeah, I just run regex search/replace on a bunch of different stuff in the rpt
@potent depot you got the nil somewhere in the array
So you need to check the places where you mosfiy your array
But I don't need the server to be spending the time to output stuff I don't care about, y'know?
Then the only way is to indeed Shut it off
Or, Mount that Part in some RAM disk, given that you got enough place
Rpt log though should not eat up that much of Performance
Maybe someone from bi will hear your call tho π€·ββοΈπ€·ββοΈπ€ͺπ€ͺ
I dont believe there is really any way for set to swap out a element for nil unless i specifically tell it to set nil right?
array set [1, nil]
exactly
just asking out of bad memory, was it possible to display a control or control elements on a hiddenselection of an object, let's say a laptop?
Nica, explain?
Zulu why would you want to do it any other way?
Ryko, I meant as unless i did set [1, nil] it wont set it to nil. Mine do not do so at any point
was there an engine side way to display a control (dialog, UI-element, etc.) on a computer screen (which accepts setTexture)
@potent depot if your variable is nil, that you use in Set, then you do exactly that
Nica, you want to display a ui control on a laptop?
Promise you that you did not found some edge case in which sqf fails here
i dont know how that wasnt evident from the first question, but yes
If you render that object inside of the gui, yes
@queen cargo yeah im not assuming so. Im just confirming that as my set is used as so:
GVAR(HeadlessLocalCounts) set [_forEachIndex, (count (allUnits select { owner _x == _HCid }))];
its likely not my use of set but somewhere else
If you render it in the game World, no
ok, alright
if you resize the array it will populate it with nil values
myArray resize 4;``` [nil, nil, nil, nil]
yeah its why im diving into the only 2 portions of my code where it changes the number of elements in that array
Hit EH triggers on the machine where the EH is defined in or on the machine where the target of the EH is local?
Both
gotcha
Well, condition A and condition B
True
XD
wouldve been a valid answer, but not so helpful
human language doesnt always match with programming
if statement then do this
can't make it easier π€·ββοΈ
in human language, what i asked would probably translate to a sort of switch-case
well, a switch case would suffice in this, since i foremost wanted to know if it executes on the client that defines it
deleteAt removes an element and resizes the array correct?
hmm, I have no idea how the hell im getting a nil value in my array
can you paste a code snippet to show what you're doing?
Its an entire HC system so that isnt really possible as the code is spread across about 7 different file/functions. Its fine, I know what the issue is and have an idea on where the cause is. Though, atm I need to determine if the issue isnt due to something external from the code as it seems to be related to HCs disconnecting/connecting which can modify my array while its in the middle of a loop.
Yes, you should have only one entry point for edition, ideally. That and/or make a copy when iterating, and/or doing _arr = _arr select { not isNil "_x" } or something (ugly)
_arr = _arr - [nil];
every time you correct me, I feel that avatar π
I'm in bed, I can blame exhaustion
yeah this is an interesting issue for me though I have limited data to work with atm(still being funnelled to me). We had the HCs crash and disconnect/connect multiple times which is something that it seems the system cant handle very well. So gotta figure out how I can reinforce it against such an occurence
Its just gonna be a lot of going over all of it. The copying arrays idea isnt too bad I just gotta check and see if it could potentially cause problems.
Only place I could think it would is the disconnect failover
What's the appropriate method of checking whether a cutrsc has already been initialised/is showing?
personally I'd have the display set itself to a uinamespace variable during onload and then check if that is null.
Is there a way to boost a vechile's speed when they run over a trigger?
(Trying to make a loop da loop for a go-kart race)
Basically a Mario kart boost lol.
Is there a way to boost a vechile's speed when they run over a trigger?
(Trying to make a loop da loop for a go-kart race)
No
personally I'd have the display set itself to a uinamespace variable during onload and then check if that is null.
Yeah this is the only way
So slapping on setVelocity[50,0,0] doesn't just launch it forward a bunch?
It does but you can't really apply it for too long to get a boost
Plus it you want the vehicle to move forward, it is;
_veh setVelocityModelSpace [0,50,0]
Yeah it just needs like, to be thrown forward enough to get it to fly around a loop. Not a prolonged boost or anything.
Ill do some tests a bit later
It doesn't matter if the player has any control, or it flips over. I just need it to get pegged forward really hard.
It's more of a joke thing than a serious race.
You can get an awkward boost if you do this:
onEachFrame {vehicle player setVelocityModelSpace [0,50,-5]}
But the vehicle isn't really controllable
Hopefully the walls keep from flying out lol. Thanks ill give that a go.
this is better:
onEachFrame {
_veh = vehicle player;
if (isTouchingGround _veh) then {
_v = _veh vectorModelToWorld [0,50,0];
_veh setVelocity (_v vectorAdd [0,0,-5])
}
}
How would I get the name of the player that activated the trigger and print it into this?
endTime = time - startTime;
titleText [format ["Winner's lap time%1", endTime, ], "PLAIN"];
tried putting in _caller a few ways but I'm only getting errors
_caller is not a thing π€¨
thislist returns the list of units at the check time, but mind there might be multiple results at the same moment
Also, if there's no data after a , will throw an error
how about?
endTime = time - startTime; _playerCalling = name vehicle player; titleText [format ["_playerCalling Mission time%1", endTime], "PLAIN"];
just not sure how to make _playerCalling be read as the variable lol
ok yeah this works. just don't know how to get it to read both "mission time", endTime, and _playerCalling all in the same line.
endTime = time - startTime;
_playerCalling = name vehicle player;
titleText [format [" Mission time%1", _playerCalling], "PLAIN"];
ah right, i'll try that
yup this worked
endTime = time - startTime; _playerCalling = name vehicle player; titleText [format ["Winner %2 %1 ",endTime, _playerCalling], "PLAIN"];
sure, it will show all the players their own name
@torpid quartz trigger is checking its condition every 0.5 sec, hardly suitable for competitive timing
plus it doesnβt have an option to return first entity that triggered it
Isn't the first element in thisList the one that triggered it first? (except if multiple entities triggered it at the same time)
wat
list trigger
I believe the list doesn't list "who arrived first" as it is an instant check
it's just "who is in my area right now"
and I think not. FIGHT!

a trigger doesn't "always check" then give its results every half second; it does a check every half second, and if there are units they are added to the result list, I think that's it
I think it pushes the entities back to the list
@little raptor no
ok
it collects entities from global entity list which could have any order
is there a better way of setting up something that will just tell me who entered a trigger first for a race?
I'd use the racing modules but there isn't any documentation and I haven't found a way to get them to work.
inArea?
it's just a small box trigger that's in-between the two poles of the finish line prop.
hmm
_unit inArea trigger
yeah i'm reading through it's wiki right now just figuring it out
You can find the list of units that have triggered the trigger using:
_units inAreaArray trigger
you can create large trigger, set frequency interval on it higher than every 0.5s set it to trigger once then once it is triggered go through the list of entities provided and check which one is the closest to the center of the trigger
I'll see what i can do
larger trigger activation statement:
onEachFrame {
_units = list largerTrigger inAreaArray smallerTrigger;
if (count _units > 0) then {
_units = _units apply {[_x distance smallerTrigger, _x]};
_units sort true;
_firstUnit = _units#0#1;
onEachFrame "";
//optionally disable/delete trigger afterwards
}
}
deactivation:
onEachFrame ""
is it intended behaviour that a shooting target is broken by small arms gunfire?
@little raptor i dont know, but i've been told...
Missioneventhandler is better for this
you'd think there would be an easier way to set up a race when the game has a go-kart racing dlc lol.
is it intended behaviour that a shooting target is broken by small arms gunfire?
What do you mean broken?
as in dammage 1
and which target?
simple target
I'm not sure, but isn't it possible to add a handleDamage event handler to it or something?
To make damages smaller
And make it survive longer?
if by "once in a while" you mean loop, why not just use the event handler instead?
It's faster
i am
but it's "once in a while" in the sense that it's being healed every round it needs to be used
each round is about 5 shots
it's just that 60~ rounds from a 5.56 takes it down
@little raptor So i make two triggers, smallerTrigger and largerTrigger, smaller trigger more towards the end of the finish area to so it's more likely to pick the person that end through first since they'll be the furthest in?
nvm found another way that looks good.
For a karting car that moves at 20 m/s, given the trigger interval of 0.5s, the larger trigger radius must be larger than 10m for the trigger to activate in time.
The larger trigger centers around the smaller trigger.
The smaller trigger doesn't need any activation condition.
In fact, you only need its area.
ah so yeah only the two triggers, and to get the winner I only need to put _firstUnit as thing variable which will have the winners name in it?
Hey there anyone able to help me out with this?
Is there a weapon pullout/unholster player evh?
nope
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers
but maybe you can "cheat" by using the animation name or selected weapon.
the selected weapon not great
the animation event handler, not really
hot to disable bot movement order when simply left click on map and action menu is not showing ?
thanks
Does sqf have any equivalent to say C's continue? (It just skips to next iteration of loop)
yeah seems thats waht Im gonna have to do
that or (a bit ugly) call { if (condition) exitWith {} } additional scope ^^"
(seen done in some BIS functions)
wouldnt that just put it right back to where it is in the greater scope?
as your exiting from the call?
It is possible to do:
#define SKIP (_i = _i + 1)
for "_i" from _start to _end do {
if (_i == 5) then {SKIP}
}
Does essentially the same thing as continue
does anyone know how to force ai to fire during animation, forceweaponfire doesnt work and i need them to do full auto
Thats what he told me and I was hoping to avoid doing a if statement around the entire thing
@dire topaz this? https://community.bistudio.com/wiki/doSuppressiveFire
You still need an if statement for continue in C don't you?
doesnt look like it will work
Yes, its more for cleanlyness of code
@dire topaz forceWeaponFire works in all states (even if weapon is on back)
Yes you can
ive literally just tried
use fire instead
tried that too
I know for a fact that fire works
just tried, doesnt
do you have the correct muzzle?
show your code snippet
k gimme a sec
For both you need to call the function every frame
That's why you can't do full auto
You're calling it only once aren't you?
That's like clicking on the mouse and letting go
e3 forceWeaponFire [weaponState e3 select 1, weaponState e3 select 2];
You don't get full auto like that
only way i can get it to work
onEachFrame {
AI forceWeaponFire ["muzzle", "mode"];
}
ah ok i will try ty
for you it would probably be:
onEachFrame {
e3 forceWeaponFire [weaponState e3 select 1, "FullAuto"];
}```
that said, look at the documentation for the parameters
will do ty
keep in mind that onEachFrame will keep them firing forever you will need to make it break out of it when you want it to stop
Another alternative to onEachFrame is FiredMan event handler
yeah how do i do that? it works tho so ty
i meant making the break as zulu said
that's also what I said
oh ok
you could also use the missionEventHandler variant: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#EachFrame
then store the id returned by https://community.bistudio.com/wiki/addMissionEventHandler
then later remove the handler with the id: https://community.bistudio.com/wiki/removeMissionEventHandler
ahh okay cheers guys
true, but then how do you stop it?
I wouldn't suggest the condition route as itll leave a constant check there that doesnt need to be. But yeah you can set it up in the same was as ive described the missionEventHandlers. Pick your poison.
nvm
I think there should be more delay to fire the next shot
So this method won't work
scheduled EH would make no sense because some EHs return a value to engine, and engine needs this value now
can you disable the roadway like you do with collision?
no
: (
thanks
Rpt log though should not eat up that much of Performance
it does, WIP tho
Does sqf have any equivalent to say C's continue? (It just skips to next iteration of loop)
Stop reading my mind while I'm not even online @potent depot ...
:3

@still forum as per usual, you've already got something in the works β€οΈ
So apply etc. Now get a default scopename finally?
had the idea how to solve it last week. Just started implementing a couple hours ago
I guess you stopping writing means no
And the actual solution was more complex π€π
no?
why scopename?
I'll probably implement a forEachIndex kinda command too, that works in every loop type. So you can get your index in apply/count/findIf too
Existing System
Already Was emulatable using break to and breakout
doing it with a scopeName and breakTo would've been way more complex
me stopping writing is because I have 5KB/s internet speed and discord is taking its time
Okay π€π€·ββοΈ
Hyped to implement it into sqc
Thoooo
Breakwith reads kinda weird π
π
it seems Hit EH is only executed on the machine where the target unit is local
define the variable ^^
Well I'm new to that, basically I use alive to generate missions and whenever I enter town where civilians should be and some suicide bombers it prompts me with that
So what should I do or google?
ah well, I don't know Alive sorry
Hello again, wonderful people.
I got a simple one: I have a broadcast message I am playing using the playSound3D command. Is there a way to add echo to the sound?
nope, beside editing the sound
Affirmative, good thing I got a sound designer on the case.
Audacity, Reverb, ??, profit :p
that's probably what they will do anyways, lol.
doStop still lets units receive targeting and attack commands from the leader correct? it just ignores movement commands?
Hi.. I want my own image on this blank sign. http://prntscr.com/uudf57 and I want to put this in my own mod file. I want to make the classname Methlow_Sign. How can i do it?
define a class Methlow_Sign that inherits Land_Billboard_F and set the INIT eventhandler to set the texture to your picture. Alternatively, you can set the texture using hiddenselections in the config. This is preferred whenever possible.
for more information, ask on #arma3_config @digital plover
but you dont need a mod for this if you dont really have to
simply setObjectTexture/SetObjectTextureGlobal will do
any ways to fix "flooded engines" via script commands ?
might be the same mechanic that keeps boats in a sinking state once they were underwater. π€·ββοΈ
https://gyazo.com/6704f665099ceb25c6ecd89500d7b4f8
you could remove the vehicle, and respawn it (somewhere far away from water)
thats not an option for our mission type
the moment a vehicle drowned it will stay like that, afaik it's not reversible since it's engine based, not scripted
What a bummer. Thanks for the info π
in the case of the boat the engine is still working. just impossible to control it
Hi! I tried to synchronize CreateTask module with the player in MP.
[player, [task]] remoteExec ["synchronizeObjectsAdd", 0, true];
But it wouldn't work (I test a game like a host, not dedicated server). Anybody know - It would work and I've to try this on a dedicated server or it's impossible to synchronize task module with the player during MP game?
@little raptor About the script you helped me with, how do I reverse it so heli takes off once everyone is out
reverse the condition
what was the script?
Wait
Assuming that the landing pos is the same as the trigger pos, you can put this in the trigger activation statement:
_WP = (group MY_HELI) addWaypoint [getPosASL thisTrigger, -1]; _WP setWaypointStatements ["true", "[] execVM 'land.sqf'"];And create a file called "land.sqf" in the mission file. Put this in it:
_landPad = createVehicle ["Land_HelipadEmpty_F", ASLtoAGL getPosASL task5d]; MY_HELI land "GET OUT"; waitUntil { sleep 1; units group player findIf {alive _x && !(_x in MY_HELI )} == -1 }; deleteVehicle _landPad; MY_HELI land "NONE"; //take offMY_HELI is the name of the heli.
@little raptor
units group player findIf {alive _x && (_x in MY_HELI )} == -1
@little raptor It's works, I create and assign task by function, thank you. )
Is there any way to find out whether a player disconnected "normally" or got kicked/lost connection etc. e.g. with the HandleDisconnect or PlayerDisconnected-event handler?
i used to have a script that kind of achieved that. i dont remember exactly, but i think it did a setvariable to the server with a players info when they clicked abort, and then a handledisconnect eh would check for that variable.
Does anyone know how the numbers get on the UCAV Sentinel ("B_UAV_05_F")? I was looking at the textures (hiddenSelectionsTextures) but there were no numbers on it but in the game files is a folder with numbers for the UCAV but I could also not find the path to them anywhere in the CfgVehicles...
tried to set license plate number?
I wasn't aware that that was even an option. How would I do that?
Ah, ok. Found the setPlateNumber command. I will try that.
just updated to RC 200 - https://forums.bohemia.net/forums/topic/183855-release-candidate-branch-announcements/?do=findComment&comment=3418714 mentions Added: Many new script commands Is there any chance to see those on the wiki?
RC testing of a hotfix to update 1.96 has wrapped up - cheers! Steam branch access code: Arma3Hotfix196 Arma 3: ~60.7 MB / Arma 3 Server: ~17.9 MB Areas of focus (pseudo-changelog) Fixed: createVehicleLocal behavior restored to its prior state Fixed: Un-escaping double quotes ...
@still forum pls
https://community.bistudio.com/wiki/namedProperties this in it? π
how can i check if player enters water?
im trying to write a script to spawn in sharks in the water near a player
@austere granite why ping
@compact wyvern quite sure there is a isSwimming command or similar
oh sweet
lemme check the script list
only related swim i found is
swimInDepth
theres
this
_isWater = surfaceIsWater position player;
but thats expensive. I thought there's an easier way
i cant find an easier way
is water would work but a constant check of surface would kill xD
https://community.bistudio.com/wiki/underwater
https://community.bistudio.com/wiki/isAbleToBreathe
close but not on it.. oh actually underwater example. TFAR is also using height of eyePos to check if player is underwater
lol, careful with the loops
Um Wut?
makes sense
Hey all! quick question - I've been trying to get an object in one mission to launch another mission using the serverCommand script
to the object i've done a simple addAction that fires a sqf
the sqf simply has
#mission mission.malden "Custom";
actually - belay that
I might have solved it! Would welcome any insight in the meantime
that alone only works as a chat command. you need to use
https://community.bistudio.com/wiki/serverCommand
https://community.bistudio.com/wiki/Multiplayer_Server_Commands
I've been trying to get an object in one mission to launch another mission using the serverCommand script
? ^^
ah, hold up I posed it wrong the sqf is
serverCommand "#mission mission.malden Custom";
is there a log in the rpt when you attempt this to say why it hasnt worked?
just having a browse
im not 100% sure, but you may need to use the alt syntax where it executes on the server with password serverCommand command
i have put my server password (in ""s) in, and not having any luck
are you the host or is the mission running on a dedicated server?
running on dedicated
haha gotta upload the pbo each time π thought i'd sanity check on here in case I was doing something drastically wrong
that or maybe use filepatching
serverCommand with a password needs to execute on the server. addaction would be executing on your client. so you need to remoteexec to the server before executing it.
anyone know of a way to reliably detect which pylon is assigned to which turret on a vehicle? ie. which pylons are assigned for pilot and which are for gunner
that's not 100% reliable though.. if all pylons have the same weapon, it cannot determine which pylon is on which turret
already tried that
@obtuse sigil - Have you tried checking CfgVehicles >> [Vehicle name] >> Components >> TransportPylonsComponent >> Pylons >> [Pylon name] >> turret?
I believe that handles pylon assignment.
you are correct.. but what if the turrets have changed dynamically in a mission?
Can you clarify what you mean @obtuse sigil? I can't think of a way turrets can change dynamically.
afaik you can't change the turret (pilot, co-pilot, crew, passenger), but you can change which weapons are available for a turret.
However the pylons only define which weapons/ammo are available, not to which turret they belong.
in the dynamic loadout section if you have a gunner and a pilot (mostly just helicopters) you can choose which pylon is assigned to which turret (technically pilot or gunner, but there can be more turrets) so yes, I can use that config entry to read the default setting of the pylons, but the turret can change either by scripting inside a mission or by just making a custom loadout in the editor.. and after that it's anybodys guess which pylon is part of which turret.
and especially if the pylons change inside a mission with scripting, with for example a loadout manager
setPylonLoadout is how it is set (pylon, magazine and turret), but there is no getPylonLoadout or similar.
So unless those scripts store it somewhere themselves you can't know for sure
I did make a feature request in the feedback tracker to possibly expand the getPylonMagazines command with an optional extra boolean to return the turret each magazine is assigned to or get a new command for the turret readouts..
The ace function is as good as you can get it right now. There should be a getter.
But there's none right row.
I've been trying to call an sqf file from @MyOwnServerMod file for two days. However, I was not successful.
I am adding these codes into the initServer.sqf.
execVM "RD\RD_Client\data\Traders\NPCs\BMCapeZefyrisTraderObjects.sqf"```
I tried both ways but again it doesn't deol.
the path is the same as on your P: drive with @MyOwnServerMod
on my P-drive I have P:\MyMod\Flags\flagtexture.paa to use that ingame the path is "\MyMod\Flags\flagtexture.paa"
My P Drive Path:http://prntscr.com/uv67y0
My initServer.sqf:http://prntscr.com/uv68aa
and that is the version you pack and use in the server? have you checked your server .rpt if there are any errors in running the script itself?
are trying to run this on a local machine, because initServer wont run if you run it in singleplayer
My Server RPT: https://controlc.com/748993a7
too much stuff in your RPT and something is broken badly
simplify your stuff first
make a mission where the only thing you do is run that script, dont matter if the script doesnt work, just make sure if it runs first at all
it is likely that either your script is horribly broken and doesnt produce desired result because of that, or things break before you even get there
when you're doing scripting, it's easier to make sure almost one line at a time that things work, not write 1000 line script and hope it will work straight out of the box
especially when you're making very complicated stuff
@digital plover head over to the exile discord and get help with your create vehicle errors.
I guess I solved vehicle errors
My Server RPT:https://controlc.com/57793e04
Any other serious errors with my RPT file?
Please review
you are assuming you're not successful in running your script, but your script might start to run, but have for instance logic errors in it that don't work, even when there is no syntax errors in it
to track if your script is working, add a bunch of diag_log entries inside your loops or if-statements to see your script is actually doing what you want it to do
n e v e r assume your code works, if you cant verify it with diag_logs or hints or whatever indicators, your only assumption should be that it's not doing what you think it should do
assumption is the mother of all f ups
I guess I don't know that much. I guess I'm a little confused π
for instance, put diag_log "METHLOW: SCRIPT STARTED"; in the first line of BMCapeZefyrisTraderObjects.sqf
ah ok. i try now
remember to re-pack your addon, put it on your server, run your server and check if it says METHLOW: SCRIPT STARTED anywhere in your RPT
if your script runs, but it doesnt do what you think it should do, your problem lies elsewhere
just copy the objects into the initserver.cfg in private vehicles
or include the file path in that section
I discovered something strange


