#arma3_scripting
1 messages Β· Page 574 of 1
im writing a sanity check into my code, and want to avoid nested if statements, but the second function i want to call would cause an error if the first function returns false
exit is the wrong word
the answer is still no
unless you do what i said
wiki page of if/&& should mention that
code as right arg?
yes
what does that mean
@fair lava
if (alive player && { damage player < 0.5 }) then { ... };
i might just have been awake for too long
bool = (call myFunc) and {call myFunc2};
oh
or
thats not too bad i'll change it to that, and i did not see anything like that on the wiki though i didn't find much
bool = (call myFunc) and myFunc2; if you're crazy
i didn't dare go this deep into sqf
im still at the "look at the wiki page for the if statement" stage of sqf learning
welcome aboard
can i do !{}
ah
if _hel && {!([_helmet, (_varHelmetArray select 1), true] call BIS_fnc_inString)} then
using parenthesise like bubble wrap and call is fragile ^.^
still missing a pair of parens
oh really?
not sure if && is higher than if
ah the whole statement
if (_hel && {!([_helmet, (_varHelmetArray select 1), true] call BIS_fnc_inString)}) then {
that should about do it
Thanks
since ya awake over here, any luck @still forum ?
with what
re: livonia I was crashing out when ya asked for dewrp link again.
no, and not today
okies, and gratz on the hire over.
on the hire? π
shh
question regarding radioChannelAdd: is it local to the client or does it have to occur on the server? Wiki doesn't say which is required
my instinct is that it has to occur on server, but I could be wrong
Your guide is found in the icons at the top of the wiki page
commands are global, and it must be called on server to work properly in multiplayer
excuse me, that's radioChannelCreate
radioChannelAdd, as you point out, is not indicated
That said I can tell you that it's global, ie., client can use radioChannelAdd and get into the custom channel, provided they provide the right channel number
yeah that is what was confusing me, because on the clients, the custom channel could be 6-15 whle radioChannelCreate returns a much lower number. This is why I wasn't sure how I should go about adding players to it; if i needed to remoteExec to the server or have the clients handle the command themselves
targetKnowledge returns last seen time, but what is it? in my testing it has values like -2.212e-6 That isn't server time, OR date as a number I think?
its a number... im guessing in seconds?
but its negative?!
repeatable/always happens? docs really dont even define what the time is
actually looks like for civ side only it gives this, for other sides its correct
time is seconds after server start it looks like
is it related to the target class? I'm wondering if it doesn't track positive numbers for vehicles but does so for men
oh i didn't check but i hope it tracks for vehicles as this is what i want to use it for!
Hi everyone, I am trying to get where an infantry unit was hit, and I am using this:
private _bodyParts = ["head", "body", "arms", "legs", "pelvis", "spine1", "spine2", "spine3", "neck"];
private _dmgParts = [0, 0, 0, 0, 0, 0, 0, 0, 0];
{
_dmgParts set [(_bodyParts find _x), _unit getHit _x];
} forEach _bodyParts;
private _bodyPart = _bodyParts select (_dmgParts findIf { _x >= 0.9 });
I am not sure this is the best, but it works... however sometimes I do get an
error zero divisor
Which I can't for the life of me understand why..
I was thinking maybe some of those body parts do not exist on a CAManbase type of unit? Meaning infantry stuff?
since getHit returns nothing if the selector is wrong, it may be that the assigning is going astray due to trying to asign a null value from an array into _bodypart
not sure if I explained that well...
@coral owl where did u get the _bodyParts strings from?
@surreal peak I think I got it, that would make sense.. I just got it .. mh from somewhere in the official forums lol maybe someone trying to do something with damage location
I was thinking worst-case I will reduce it to the first four, which work perfectly.
is there any other code being executed
can u post the entire script? in a pastebin or something
can only guess without context
It's basically that, at the moment it just reports
systemChat format ["you have been hit to the %1", _bodyPart];
["face_hub","neck","head","pelvis","spine1","spine2","spine3","body","arms","hands","legs","body"];
maybe try these for the array
private _bodyParts = ["head", "body", "arms", "legs", "pelvis", "spine1", "spine2", "spine3", "neck"];
private _dmgParts = [0, 0, 0, 0, 0, 0, 0, 0, 0];
private _bodyPart = 'TORSO';
{
_dmgParts set [(_bodyParts find _x), _unit getHit _x];
} forEach _bodyParts;
_bodyPart = _bodyParts select (_dmgParts findIf { _x >= 0.9 });
switch (_bodyPart) do {
case "head" : { _bodyPart = "HEAD" };
case "body" : { _bodyPart = "TORSO" };
case "arms" : { _bodyPart = "ARM" };
case "legs" : { _bodyPart = "LEG" };
case "pelvis" : { _bodyPart = "PELVIS" };
case "spine1" : { _bodyPart = "SPINE" };
case "spine2" : { _bodyPart = "SPINE" };
case "spine3" : { _bodyPart = "SPINE" };
case "neck" : { _bodyPart = "NECK" };
};
_messageDOWN2PARTA = 'YOU WERE HIT ON THE: ';
_messageDOWN2PARTB = _bodyPart;
```
that was just the old version when I discovered toUpper lol
but I am keeping the last switch as it's convenient..
also would probably be worth to change private _bodyPart = 'TORSO'; to private _bodyPart = '';
right right, true
As you can see I very basically check which area registers a damage over 0.9 and report that, nothing fancy
I put them in a sort of order, from most sensitive parts to others.. and it kinda works in case more than one location has 0.9 it reports the main one first (e.g. head)
but some damages are set to "", which is general damage
You are right that //["face_hub","neck","head","pelvis","spine1","spine2","spine3","body","arms","hands","legs","body"], seems good
so that could be why I get a zero divider.. as in "" >= 0.9 = BOOOM!
a "default" case in the switch
Thanks @winter rose and @surreal peak this is great just enlightening
anytime
it's kinda fun and I did not want to limit myself to head torso legs and arms which work fine
np, I like helping people cause it improves my skills as well π
It was cool to see "NECK" yeaaaaaaaaah I've been shot in the neck, look mom!
if you ever want to do something with it, I could recommend doing things like disabling nightvision goggles when headshot
@winter rose I think the default case is definitely useful but the error happens in the line just before the final switch?
or GPS when shot in arm
ah cool!
drop weapon when shot in the arm? fall down when shot in the leg?
_dmgParts set [(_bodyParts find _x), _unit getHit _x];
if find returns -1, in setβ¦
many things for torture immsersino
OR, I could completely revamp this using getAllHitPointsDamage
because that's what it returns..
getAllHitPointsDamage player;
//[
//["hitface","hitneck","hithead","hitpelvis","hitabdomen","hitdiaphragm","hitchest","hitbody","hitarms","hithands","hitlegs","incapacitated"],
//["face_hub","neck","head","pelvis","spine1","spine2","spine3","body","arms","hands","legs","body"],
//[0,0,0,0,0,0,0,0,0,0,0,0]
//]```
so basically I can scan the third array, find the first 0.9 or the highest number in the array... keep that array position number but move it to the second array and bam, I get the location
sounds good!
I just gotta find out how to return the index of the highest value in an array lol
there is a function for that
loop through array and just do comparisons between them
ooooooor
find the functino lou is talking about
sort sorts the data, you could do something with it
yup; but with selectMax you only get the value, not what it is linked to?
once I selectMax and get the value, I find it?
with sort you could do an array like [[0.5, "spine"], [0.2, "head"], ...]
use the find to return the index
I think selectMax + find
I think might just
- get the highest number
- find it again in the same array
- get its index
- use that index on the previous array and get the location name
...
should work
Just because it does not matter to me if there is another value that is similar to the max found..
otherwise Lou's is spot on and more precise
now question is what form of sorting alg does max use π
exactly, but if it misses one and gets another, I don't care as long as it feels good that you've been shot somewhere lol
With Lou's method you can basically go wherever you want with that data
hahaha
and you if wana try your luck: https://en.wikipedia.org/wiki/Bogosort
ahaha that's awesome
Anyway could be something like:
private _bodyParts = (getAllHitPointsDamage _unit) select 1;
private _dmgParts = (getAllHitPointsDamage _unit) select 2;
private _mostDamaged = selectMax _dmgParts;
private _mostDamagedPart = _dmgParts find _mostDamaged;
private _bodypart = _bodyparts select _mostDamagedPart;
switch (_bodyPart) do {
case default : { _messageDOWN2PARTB = "TORSO" };
case "face_hub" : { _messageDOWN2PARTB = "HEAD" };
case "head" : { _messageDOWN2PARTB = "HEAD" };
case "body" : { _messageDOWN2PARTB = "TORSO" };
case "arms" : { _messageDOWN2PARTB = "ARM" };
case "legs" : { _messageDOWN2PARTB = "LEG" };
case "pelvis" : { _messageDOWN2PARTB = "PELVIS" };
case "spine1" : { _messageDOWN2PARTB = "SPINE" };
case "spine2" : { _messageDOWN2PARTB = "SPINE" };
case "spine3" : { _messageDOWN2PARTB = "SPINE" };
case "neck" : { _messageDOWN2PARTB = "NECK" };
};
// reminder: for an infantry unit these are the hit zones that could get returned:
//["face_hub","neck","head","pelvis","spine1","spine2","spine3","body","arms","hands","legs","body"],
...```
rudimentary ofc
I could nest it as hell and do it in one line eheheh or TRY TO
private _bodypart = ((getAllHitPointsDamage _unit) select 1) select ((getAllHitPointsDamage _unit) select 2) find (selectMax ((getAllHitPointsDamage _unit) select 2));
switch (_bodyPart) do {
case default : { _messageDOWN2PARTB = "TORSO" };
case "face_hub" : { _messageDOWN2PARTB = "HEAD" };
case "head" : { _messageDOWN2PARTB = "HEAD" };
case "body" : { _messageDOWN2PARTB = "TORSO" };
case "arms" : { _messageDOWN2PARTB = "ARM" };
case "legs" : { _messageDOWN2PARTB = "LEG" };
case "pelvis" : { _messageDOWN2PARTB = "PELVIS" };
case "spine1" : { _messageDOWN2PARTB = "SPINE" };
case "spine2" : { _messageDOWN2PARTB = "SPINE" };
case "spine3" : { _messageDOWN2PARTB = "SPINE" };
case "neck" : { _messageDOWN2PARTB = "NECK" };
};
sometimes I think anyone getting this code in the future might hate me and therefore avoid doing this. Especially since I easily forget what this could do or mean
replace your switch with this π
_messageDOWN2PARTB = [toUpperANSI _bodyPart, "TORSO"] select (_bodyPart == "");
well, it keeps the number in "spine" though
if I put a sleep in a forEach, does that create a delay between instances of the forEach, or are they all run simultaneously?
believe its sequential/ordered execution so a sleep will make the script pause (x) amount of time... at that point.
I don't want to step on whoever's problem is above if not resolved, but I have a script that should be increasing the speed like an afterburner. It seems to run but it doesn't increase speed.
Something I'm missing?
@bold kiln for big chunk of code pastebin.com with c++ or similar fitting syntax enabled would be better place to put it
hastebin.com ftw
gotcha
and link here of course
the syntax highlight selection is somewhere at the bottom where you hit create too
right, right. trying to find the link so I can post
if you use hastebin the link is in the address bar soon as you click the save button top right
hastebin is having connection issues for me
really? odd...
https://hastebin.com/ << if it looks like basically a blank screen other then the few icons top right of screen then its working correctly
This site canβt be reachedhastebin.com unexpectedly closed the connection.
Try:
Checking the connection
Checking the proxy and the firewall
Running Windows Network Diagnostics
ERR_CONNECTION_CLOSED
ewww and odd... o.O
trying to think of md5's fork of hastebin... cant think of the link
yeah ya good
@hallow mortar SQF cannot execute anything simultaneously. So yes they run after eachother, including the sleeps inbetween
I know that technically it doesn't, but you can still spawn multiple scripts and have them run """in parallel""" ^^
if you have a script (lets call it script A) that calls two other scripts (B,C) , does script A wait for B to be finished before calling C?
if by calling you mean call then yes
Hi, I'm searching for some ingame texture selector script.
Does anyone here has a script like this?
Thanks!
Selector script? What do you mean?
Well, i've thought at something like a NPC or a crate with an addaction on it which allows player to change it's vehicle texture.
I've got some very basic knowledges in sqf, do you think it would be easy to develop?
Maybe not easy
But at least not too complicated ^^
Should be possible.
Vehicle textures are stored inside the vehicle's config IIRC
So you need to retrieve all texture for the vehicle and add actions to the vehicle accordingly
I've got personal textures in the pbo mission file, so I think the thing to do is to make a script that recognize the vehicle (to not put a huron skin onto a strider e.g) and to shows one addaction per texture.
Well, i'll work on it and stay you tuned
Thank you!
yw, gl π
https://community.bistudio.com/wiki/typeOf
https://community.bistudio.com/wiki/setObjectTexture
https://community.bistudio.com/wiki/addAction are a few good commands to help you get started
Yup @alpine ledge ! Thanks!
First i'm trying to get the vehicle classname.
I've put a prop in editor called "selector"
And i've written this code (which of course, does not work)
private _myArray = [];
private _classname = "";
_myArray = nearestObjects [selector, ["Car", "Tank", "Air"], 10];
_classname = _myArray select 0;
hint _classname;
I execute it from the debbug menu
I haven't yet understand how typeOf work.
nearestObjects returns class names, it returns objects.
Okay, so I can't use it in that way
if you do
_object = _myArray select 0;
hint str (typeOf _object);
that'll give you the class name of the nearest object.
So I only keep the first line and add the code you juste give me after it?
private _myArray = [];
private _classname = "";
_myArray = nearestObjects [selector, ["Car", "Tank", "Air"], 10];
if (_myArray isEqualTo []) exitWith {hint "No vehicle found!"};
_object = _myArray select 0;
hint str (typeOf _object);```
@worn forge @cosmic lichen you guys are genius
Now I've think about a switch/do to show the addactions
My code does not return any error but the game hint "Error1" (the default section of the switch/do)
private _myArray = [];
_myArray = nearestObjects [selector, ["Car", "Tank", "Air"], 10];
if (_myArray isEqualTo []) exitWith {hint "No vehicle found!"};
_object = _myArray select 0;
_veh = str (typeOf _object);
//hint str (typeOf _object);
switch (_veh) do
{
case "C_Kart_01_F":
{
hint "it's a kart"
};
case "C_Van_01_transport_F":
{
hint "It's a truck"
};
default
{
hint "Error1"
};
};
I'm just a little bit confused about what put in the switch
Is it the _object
str (typeOf
you are turning a string into a string
why
Ah you copied that from R3vo, bad R3vo
remove the str
Your _veh contains ""C_Kart_01_F"" instead of C_Kart_01_F which is why the case never hits
no
Here, let me copy-paste what I just told you
str (typeOf
you are turning a string into a string
remove the str
Yup it's removed
private _myArray = [];
_myArray = nearestObjects [selector, ["Car", "Tank", "Air"], 10];
if (_myArray isEqualTo []) exitWith {hint "No vehicle found!"};
_object = _myArray select 0;
//hint str (typeOf _object);
switch (_object) do
{
case "C_Kart_01_F":
{
hint "it's a kart"
};
case "C_Van_01_transport_F":
{
hint "It's a truck"
};
default
{
hint "Error1"
};
};
you cannot compare an object to a string
Thanks @winter rose that's just sexy and streamlined, it does keep the number in spine unfortunately, but yeah ONE LINE π
@still forum I copied from @worn forge π
x)
So now with a "nearestObject" i should be able to apply the skin to this nearest object?
Yes, you got the object already in the _object variable.
Yes
Btw use @cosmic lichen otherwise I will miss your messages
Not in every message though π
Not in every message though
@cosmic lichen π
I added that for special ppl like you π
Ohhhh, so if we're not special we can use it in every messages? Nice!
Roger!
I am the one who decides who's special and who's not, and seems your are special too π
π
Okay, so now there is an issue with the _object variable.
Could it be due to a private / local variable or something like this?
case "C_Truck_02_fuel_F":
{
texturer addAction ["Peindre skin XAL", {_object setObjectTextureGlobal [0, "Skin\xalvea1"];
_object setObjectTextureGlobal [1, "Skin\xalve2"];
hint "Fini!"
}];
};
@cosmic lichen 
Yes, _object is not available inside the code {} of the addAction
You can pass it to the code
See https://community.bistudio.com/wiki/addAction arguments
You can passe params to the addaction https://community.bistudio.com/wiki/addAction
What do you mean by "passing it" to the code/addaction?
this addAction
[
"<title>",
{
params ["_target", "_caller", "_actionId", "_arguments"];
_arguments params ["_object"]; //Get the _object variable like this
},
[_object],//Add the variable here
1.5,
true,
true,
"",
"true", // _target, _this, _originalTarget
50,
false,
"",
""
];```
The addAction gives access to 4 params in the script params ["_target", "_caller", "_actionId", "_arguments"];, the first 3 are not modifiable but the 4th one can by giving the arguments a value in the addAction
Hummm
So it's like overpass the limitation I have rn
1.5,
true,
true,
"",
"true", // _target, _this, _originalTarget
50,
false,
"",
""
For what are, all these lines, used for?
You might be interested in radius and condition arguments. But first get the code working.
For what I understand, you can modify really everything about this addaction
Yep, it's pretty powerful
Does this stand like a general config for all addactions or is it THE addaction (in this case, i'm not sure of where to place the code to execute after clicki,g the addaction on my NPC)
this addAction
[
"<title>",
{
params ["_target", "_caller", "_actionId", "_arguments"];
_arguments params ["_object"]; //Get the _object variable like this
},
[_object],//Add the variable here
1.5,
true,
true,
"",
"true", // _target, _this, _originalTarget
50,
false,
"",
""
];```
@cosmic lichen
It's a general config. I just added the _objects parameter
{
params ["_target", "_caller", "_actionId", "_arguments"];
_arguments params ["_object"]; //Get the _object variable like this
// Add your code here
},
Put the code inside the curly brackets
Okay
texturer addAction
[
"Peindre skin XAL",
{
params ["_target", "_caller", "_actionId", "_arguments"];
_arguments params ["_object"]; //Get the _object variable like this
hint "blahblahblah" //HERE
},
[_object],//Add the variable here
1.5,
true,
true,
"",
"true", // _target, _this, _originalTarget
10,
false,
"",
""
];
Oh boy
It work
And it work well
So much thank you @cosmic lichen @cunning crown @still forum @worn forge @alpine ledge for your time, help and patience !!
when i export my scenario to sp, all my execvm things aren't working anymore. how do i fix this?
ah they are not pbo and i have to move the files manually.
*they are not in the pbo
Where did you put your execVMs?
I am trying to set the position of a unoccupied turret, I can use _val = cursorObject animationSourcePhase "mainTurret"; hint str _val; to get the value but using cursorObject animateSource ["mainTurret",deg(_valu)]; is not working. I've searched and searched and don't know if theirs anyway to do this?
Yeah I don't think animateSource works that way, I think it's defined states
Also, there is a typo in your code. You get _val but use _valu for setting
phase: Number - wanted animation phase
When you say "set the position" do you mean set the location / direction? Because you would want to use setPos and setDir for this
I just read that with animationSourcePhase and deg one can set the relative direction of the turret to the vehicle. So that should work.
I mean the rotation, basically it's adjusting the rotation like this
_valu = _val + 0.01;
if (_valu >= 2.61799) then {_valu = 2.61799};
vehicle player animateSource ["mainTurret",deg(_valu)];```
_valu can range from 2.61799 to -2.44341
So you want to line up the vehicle direction with the direction of the main turret?
I'm trying to write a script to control the main turret from the drivers seat
using EV's that are added when your inside a certain type of vehicle
according to this post this should work https://forums.bohemia.net/forums/topic/145191-setdir-on-vehicle-gunner/?do=findComment&comment=3002583
The rest of that thread suggests that it works only with UGVs.
IIRC I tried that 2 years ago or so with tanks and couldn't get it to work, but it worked with UGVs
So that would support what's written in the thread
same
Problem solved, next case π
Thanks guys, I think I know a way around it but it would require some model changes
Too bad it doesn't work.
I would have made a spinning-turret helitank already π
π
Do you need a script to control the turret from the driver's seat? You should now be able to directly control a driver AI from the gunner's position (maybe not for UGVs). Might have better luck by dynamically spawning drivers if solo control is your goal
in OFP (β¦yeah) there were "hidden" classes of "one-man tanks" (M1A1auto" iirc) where you would drive with the keyboard and aim with the mouse, do it all by yourself
@hallow mortar Is right
That would be neat to have, or at least to see if the config can be replicated in A3. The new direct driver control lets you do basically the same thing, though
add an AI as driver and boom, one man tank
yup (but "RIGHT/LEFT/FORWARD/STOP/LEFT/STOP/LEFT(β¦)")
Only with overlapping order and driving keybinds
oh, maybe I should remap some keys then
Hello, is there any script that makes an specific vehicle for example the "B_Heli_Transport_01_F" only to be driven by an specific unit for example the "B_Helipilot_F" ? (I dont know too much about scripting)
Yup, put a getin EH on that vehicle, or one of the player, and kick the player out if he's not the specific class allowed to fly that heli
or just google for seat restriction script
you'd be looking for addEventHandler, , and roleDescriptionisTypeOf
Edit: ignore roleDescription, didn't register that you were using unit classes instead of lobby roles at first.
thanks @wispy cave , i dindt know what to exactly search and finally found this script:
init:
RestrictVehicles.sqf:
If i do it with more vehicles,
Will it make the server perform worse?
Short answer; Yes.
Event handlers for each vehicle are a lot more lightweight than a while loop iirc.
And how can i do that? To check only when a player enters into a vehicle
the thing is that i dont know about scripting
maybe that when someone gets in, the script actives
activates
this addEventHandler ["GetIn", {
if (((_this select 1) == "driver") && typeof (_this select 2) != "B_Helipilot_F" ) then {
moveOut (_this select 2);
}
}];
Drop it on the helis you want in editor.
and the other code i have?
Hello, is there any script that makes an specific vehicle for example the "B_Heli_Transport_01_F" only to be driven by an specific unit for example the "B_Helipilot_F" ? (I dont know too much about scripting)
@haughty fable This does what u specifically asked
ok, let me try it
Updated , try this one instead. I did not notice it is transport heli u wanted
It works, but it wont let anyone use it at all
I only want it for the driver position
yep it is now gonna do what you want
Still the copilot
you want copilot to be anything?
Yes
updated again π©
Can you send me the one you did before, for co pilot and pilot?
this addEventHandler ["GetIn", {
if ((((_this select 1) == "driver") || (_this select 1 == "gunner")) && typeof (_this select 2) != "B_Helipilot_F" ) then {
moveOut (_this select 2);
}
}];
thank you very much, you saved my day hahha
If i want it to display a message, i just have to put a hint at the end?
A private message*
depends on where u want. a hint is easy one
A private message, only for the player trying to enter
but it may not work if ur mission is multiplayer
Or maybe a message on the vehicle chat
"You are not a pilot!" remoteExec ["hint", _this select 2];
Put it after moveOut line, test it just in case.
is your mission multiplayer or not?
Yes
Is multiplayer
The script works perfect, also for artillery guns lol, thank you π
no worries, enjoy.
Hi folks, does anyone have a bright & simple idea for how I can detect a keypress that's assigned to any/all TFAR radio button activation?
CBA may have a better eventHandler to deal with this, I don't know.
You'll need to know the inputAction names of the TFAR radio button controls.
Construct an onKeyDown UI event handler. Use an if statement, the event handler's parameters, and actionKeys to determine if the key that was pressed matches one of the TFAR actions.
An example I haven't tested but should get you closer:
// create an event handler in Display 46 (main display)
_nul = findDisplay 46 displayAddEventHandler ["KeyDown", "
// create local variables for the results of the event handler
params ["_display","_key","_shift","_ctrl","_alt"];
// store the key codes for the TFAR actions in local variables
_TFARkey1 = actionKeys "TFARAction1";
_TFARkey2 = actionKeys "TFARAction1";
// check whether the key pressed matches the TFAR action key
if (_key in _TFARkey1) then {
hint "you pressed TFAR key 1";
};
if (_key in _TFARkey2) then {
hint "you pressed TFAR key 2";
};
"];
Hi Nikko, thanks for this. I'm using that exact strategy right now, and I think what I'm looking for are the inputAction names, if any π You have just reminded me that I think it's possible to hint out the inputAction as it's pressed, so I could get it that way.
I'm sure you can find a point of contact with the TFAR devs (or another modder who actually uses TFAR) who can tell you what they are
You'll need to know the inputAction names of the TFAR radio button controls.
wuht.
TFAR has eventhandlers for transmission start/end, ui open, and most things that are done with buttons. @worn forge
I believe this is the page with all of them: https://github.com/michail-nikolaev/task-force-arma-3-radio/wiki/API:-Events
most of them I think
I want to play a custom Arma map. But the teamate AI take a massive hit on fps, so all i want to do is disable teammate AI, you can do it when you host a server but I don't know how to do it for single player scenarios
i got told to post it in here
you also got told to remove your other post to avoid crossposting
he even pinged you so you cant pretend you didn't see it π
aaanyway.
In SP you don't have access to any settings (unless you use singleplayer cheat), so you "have to" play the way the mission maker designed it. If it is a mission you can edit in Eden, you can simply delete said AIs.
ok thanks
if you have editor/script access maybe just as simple as an addaction on yourself to disable the AI on any squad you controlling? not sure the implications/side effects of that though. only idea I could come up with other then as a player force them to just go sit somewhere
if you got zeus you can just tp them into a 'safe box' way out in nowhere. or maybe addaction that would do that effect?
Thanks for the direction towards TFAR variables and event handlers - I've been all over that page. My problem is that those variables are useful when the TFAR activity has been engaged, but I'm trying to detect the key event that triggers it. I've created a custom UAV interface through a camera, and using a Keydown displayeventhandler works only if you know what you're detecting for. My solution has been to allow everything and then add use cases for specific key presses (in my switch, I have a default condition now that produces false, and allows the TFAR actions to work)
can you explain what you want to do? Why you want this key blocking
When you create a camera with camCreate and push the player view into with switchCamera, user input is essentially disabled unless you put a displayEventHandler to capture input events. My workaround has been to put a default { false } case
with switchCamera the input is disabled, but just adding a displayEH re-enables it? Or are you handling the keybinds, inside your display handler specifically, per-keybind?
I'm not sure I understand your second question, but yes, putting the player view into a new camera disables input. Creating a "KeyDown" display event handler allows them, and in that event handler I use a switch to process the keypresses to provide different effects, and a "mouseMoving" handler (I think, probably not the right name, not looking at it right now) to allow the view direction to move.
I would recommend you instead let CBA handle the keys.
By adding a KeyDown/KeyUp handler, and piping it into CBA
https://github.com/CBATeam/CBA_A3/blob/75e6bfbc0fc578ccee38d60f607304a4991c8017/addons/events/fnc_keyHandlerDown.sqf
https://github.com/CBATeam/CBA_A3/blob/fbd59d2ac1f85da79ea18a53b2d14e3ea285f60a/addons/events/fnc_keyHandlerUp.sqf
https://github.com/CBATeam/CBA_A3/blob/667299c473a1f9f03e9fe2e42b828b1fe091550b/addons/events/fnc_initDisplayCurator.sqf#L5-L6
That way all CBA hotkeys will work from the display
also actionKeys won't work once modifiers come in. shift+ctrl+alt (as is common with TFAR) make the actionKeys numbers useless as their precision is too limited. Also TFAR keys don't even have a ActionKey
https://community.bistudio.com/wiki/actionKeys see notes.
you mean inputAction? I'm aware.
No I don't mean inputAction, that works fine
well tfar doesn't have one of those, either.
I mean actionKeys, in reference to the code snippet above
Question: If a client that has ai local to it(it is handling processing for ai) disconnects. What client are those ai then local to? Do they get dumped to server? This is an HC and Zeus related question for the most part.
server
Ok, then if im worried about server killing itself in such an event, would disabling simulation on all of the dumped units locally on the server reduce the processing impact of the dump? Reenabling later ofc after processing or offloading the ai again ofc.
or would using disableAi be better?
Its mostly meant for if like a HC dies and dumps 100+ ai with 50-70 players. That will probably kill it I think.
Thanks for the info
no it won't
Hmm. It is moded so that is also a factor. Disabling simulation is probably something ill hold off on for now then. Im already grabbing all of the ai being dropped and immediately starting offloading.
you could add them to the Dynamic Simulation system⦠or delete them
The worst that could happen is a minor server fps drop the moment the server gets all those AI.
Unless you have some weird scripts in place which only work/init on the server it should be fine.
ouch
I crashed Arma with airportSide π
:O
Hello I'm trying to make checkpoint mission but I'm awful at trigger scripting so is there a way so only cars in the trigger area skip the hold waypoint so the cars behind still hold until you say I've attached some diagrams hopefully this helps.
https://cdn.discordapp.com/attachments/548621671834189865/687729262329200720/help.jpg https://cdn.discordapp.com/attachments/548621671834189865/687711731736117253/boom.jpg
@exotic flax ```sqf
airportSide 999999999; // or something
position _x inArea triggerName for each car you want to check
https://community.bistudio.com/wiki/inArea
@hollow cloak
@austere sentinel Thanks π but how would I insert this would i have to change variable names for the cars ?
Hi, a new experienced developer here. I got a couple of questions:
- What's the best way to start learning arma 3 server side & client side scripting ?
- Is arma still a thing? Will a new multiplayer mode (other than Altis Life/KOTH) be played if made properly ?
Thanks :-).
Hi @tough abyss , for network scripting you can try https://community.bistudio.com/wiki/Multiplayer_Scripting
and Arma is pretty much still a thing, yes.
@austere sentinel Thanks π but how would I insert this would i have to change variable names for the cars ?
@hollow cloak
Are you doing this in the editor or via script? Are you just checking all cars in the trigger area, or against specific ones? If the former; aforEach thisListwould check against all units in the given trigger (you'd put that in activation/deactivation field). If you want to check specific cars, you'd have to use varnames, yes.
No just every car inside the trigger at that time and yes its in editor if possible @austere sentinel
Hello, is there any way that i can set specific respawns only for specific units? For example, i want that B_Helipilot_F can spawn at a house but no one else can
No just every car inside the trigger at that time and yes its in editor if possible
@hollow cloak
{ if ( _x isKindOf("Car") ) then { _x skipWaypointCommand; }; } forEach thisList;in the trigger activation field. ReplaceskipWaypointCommandwith whatever command you're using to skip. Trigger activation mode is up to you though π
@haughty fable yes, see https://community.bistudio.com/wiki/BIS_fnc_addRespawnPosition
@winter rose Thank you, but i dont know about scripting π
hehe
How did you learn it?
@austere sentinel Wait so it has to be a specific type of car stated so I cant have an SUV roll past then like 2 mins later a quad bike
Oops, that should've been isKindOf, edited. That should cover all ground vehicle types
@haughty fable practice
you can read good guides on the wiki, starting with https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
you won't be able to do what you want only through Eden; you will need scripting
@austere sentinel Wait so do i need to do anything else or just paste that in? Also thank you so much π
@winter rose Okay, i'll take a look π
You'd have to edit the skipWaypointCommand part to whatever skips your AI's waypoint, but other than that it should work out of the box. (I don't know the command off the cuff, sorry)
@austere sentinel Thanks for your help really appreciate it π cant test it just yet as im not on my pc any longer but if i need help could I ask you π π
No problem, and sure. π
Thanks alot
@LΧΧ
@winter rose Thanks. Unfortunately there is nothing in the guide about some templates or coding conventions regarding code structure (classes, sub folders, includes, correct hierarchy). Any idea?
Hi, how can i turn on siren and lights with SQF in B_GEN_Offroad_01_gen_F (and other gendarmerie vics)?
I worked it out from the arma files:
if(_siren) then {
[_vehicle, 'CustomSoundController1', 1, 0.2] remoteExec ['BIS_fnc_setCustomSoundController'];
_vehicle animate ['beaconsstart', 1, true];
} else {
[_vehicle, 'CustomSoundController1', 0, 0.4] remoteExec ['BIS_fnc_setCustomSoundController'];
_vehicle animate ['beaconsstart', 0, true];
};
yeah nvm am asking need to cut #s by x decimal places and ideas how?
nvm found what I needed. https://community.bistudio.com/wiki/BIS_fnc_cutDecimals
that or toFixed since I am going to a string anyway with it
while (TRUE) DO {
if (player distance _Satellite <= 10 && _ishvt) then
{
myActionID = _Satellite addAction
[
"REINFORCEMENT REQUESTER ", //title
{
params["_target", "_caller"];
[_caller] execVM "script.sqf";
},
[],
10,
false,
true,
"",
"true"
2,
false,
"",
""
];
};
};
Is there a was to stop the addaction for stacking??? its inside the while loop so, i guess thats why but what im trying to achieve it has to be in (while true)... i just want one action to show up.
@harsh vine you can add the action once and set a distance condition, without any waiting
@winter rose feedback tracker ticket for crasherinos, important to give correct category
myActionID = _Satellite addAction
[
"REINFORCEMENT REQUESTER ", //title
{
params["", "_caller"];//You don't use _target, no need to assign it
[_caller] execVM "script.sqf";
},
[],
10,
false,
true,
"",
"true" //Add isHvt here, cannot be a local variable
10, //Radius
false,
"",
""
];
``` @harsh vine
@still forum I shall, on Saturday (if I remember my password there)
anyone know what nearObjectsReady does? the description is vague at best https://community.bistudio.com/wiki/nearObjectsReady :
Check whether all data are loaded to nearObjects will return in reasonable time.
I assume that's a joke question and you meant "tell me what it does!"
I suppose it checks if object models etc are loaded in the designated area
camPreload etc
Maybe
what does "reasonable time" mean though 
--snip-- answer removed because user crossposted
yes unforgivable cross post, when its on a different server, a different language, and the overlap of people reading both is literally Dedmen and no one else... okay I see where I went wrong. :D
Hello, is there a way to force player group leader when he is incapacitated, I am trying to integrate arma3 revive to my mission it's working but the fact that player swap team on incapacitate is creating me some minor troubles that I would like to fix, if any of you had similar problem would be cool to know a possible solution. Cheers!
swap team?
I just want to stay leader of group also when incapacitated I think it's game engine that automatically give lead to an AI if you are incapacitated, so my question is: Can I force player as leader also when he is incapacitate (lifestate == incapacitated))
Is there a way to change sides in eden with a trigger? So ai wont outright shoot you lol. The dont fire unless fired upon keep in formation doesnt work and the one that says dont fire unless fired upon just makes em shoot you lol
@slate sapphire I don't think you can, but you can still try selectLeader
@young storm if you just want "not being shot at", you can use setCaptive
I need to use an event handler and check state incapacitated? yes I was reading about select leader problem is how to use it properly and if it's not looping back like you get lead but you incapacitated so lead switch again...
if you can't, you can't - there is no forcing, the engine is always stronger than commands
@winter rose hmm oki ty
@slate sapphire you can try in the Editor with the debug console
in the editor there is a strange behave if I host, without group works
with group, I get in a ghost invisible state I can kill all map nobody is shooting me and I see only 3rd person and black/white screen like I am in Limbo
if I do in dedicated server then it works with or without group
the problem is when I am incapacitate ai start to give orders and also other script that need to know if player group leader to work... such ass penalty on ai die and addranking remove to player, don't work cos player is not leader, it's something I would like to fix to have a more polished system that still count AI loss to side of player also if he is incapacitated, and remove ranking, plus I would lose all command to supply truck and other ai in group if one AI take lead and start to assign waypoints to all group.
come on AI I am not died yet don't take lead wait at least you mf... heheh
well that's an hint I'll follow also in real life but to be realistic in a warfare of hours and against also other players there is good amount of bullet in the air and the chance to get hit by one is very high, so I've ask if somebody already deal with incapacitated state and found a work around to the leadership swap, that was my question, if the answer is don't get shot, well thank you I'll tell to all players to don't get shot so problem solved.....
Perfect! Problem solved :+1:
@winter rose i hate to be a pain but my trigger isnt activating the way pointsss lol
Nvm it seemed being in proximity to the trigger was the problem
does anyone knows if Gcam works with controller?
@lucid junco I think it depends on the controller, it didn't work with my little Logitech gamepad.
I take it back my trigger is fubar lol
is there a script command to halt a server? e.g. if a preInit script decides that a condition is unrecoverable, stop all execution and shut down the server?
or can I just throw an exception outside a try/catch block to terminate the program?
_obj ctrlAnimateModel ["Threat_Level_Source", 0.5, true];
what is the "Threat_Level_Source" here?
it's a GUI element with some kind of animation, although it doesn't seem to be vanilla
Many Contact functions don't work unless you're running that DLC
im running the DLC
maybe im doing it wrong
this ctrlAnimateModel ["Threat_Level_Source", 0.5, true];
i just put this in to the init of the player for testing but it does not work
well the player isn't a control, so that's likely your problem right there
@gusty jewel no
thx
hey guys, does anyone know if HandleDisconnect also detects timed out players?
Wiki says it gives you the following params: ["_unit", "_id", "_uid", "_name"]; so the cause of disconnection is not made available.
yeah guess i have to try it myself π€
Someone helpee i hava question.
How many waypoints to trigger can i sync one trigger too?
How come if i do this the helos follow the waypoints without me triggering it ? What i do wrong lol
Hey guys, Is there a way to find out in game your arma.cfg settings and displayed?
@young storm #arma3_editor
@drowsy axle are you asking me or telling me to go there lol
Your question, is #arma3_editor related.
Or scripting, since it's possible to make waypoints and triggers with scripts
And afaik it's not possible to read out cfg files.
@drowsy axle what kind of info are you looking for from there?
Be careful not to Cross-Post π
Help understanding JIP queue please, this documentation does NOT explain it clearly for me: https://community.bistudio.com/wiki/Initialization_Order
When does the JIP queue get executed? Why is JIP a tick on the different entries in the init order, instead of an entry itself?
e.g. if I have remoteExec some piece of code or function call with JIP true, then when does it get executed on the joining client?
In the same order as normal, just skipping the tasks which are not JIP compatible
no i mean if I at some point do remoteExec of a function, when does that function get executed for the JIP player?
No, because you can't run code on a client that doesn't exist yet
Although depending on the function/script, it could be global and therefore automatically be set on new connections
Hello I did ask this morning without luck but I try again now, is there a way to force player as group leader when he is incapacitated, trying to integrate revive within my warfare and need to know if someone found a solution or know that is possible or not.
@young current to see if your info like GPU frames ahead etc
GPU frames what now?
no you cannot read the config.
@ebon ridge JIP is what gets executed for every player that joins after the mission started
And remoteExec with JIP true probably gets executed at the same level as BIS_fnc_MP, needs to be double checked though
i some how don't know the google syntax: can i designate some random area as town, so generators can find it as location?
does anyone have a script for a gunship?
@upper isle Drongo has an excellent mod for it... Must it be a script?
On triggers whats the timer thingy do
oh all the questions
@sacred slate you can create locations
@slate sapphire I told you to try commands in the editor
@upper isle the gunship script?
@young storm depends on the set timer mode; it is either a countdown or a "wait for x seconds of validated conditions"
Phew done.
π
Metin, It does not have to be a script. Where can I find Drongo's mod? Thank you.
Lou Montana, I was looking for an AC-130 script
is there a \a3\ui_f\hpp\ for joystick codes?
@upper isle you could use a circle waypoint with the Apex west airship
loiter... does have CCW
you mean DIK code @bright flume ?
Lou Montana, thank you I will try it.
not keyboard but input/dik codes for joysticks.
they are mostly analog so...
trying to figure why two totally different devices getting mapped as the same input from both
xbox example
#define XBOX_A 0
#define XBOX_B 1
#define XBOX_X 2
#define XBOX_Y 3
probably not that helfpul.
yeah its for a flight stick. I found the xbox ones
can't find anythin
I dont know what pbo that file paths into unless ya know offhand
k maybe hardcoded inputs
might not be any. If its not usable via script, there won't be a include for scripts
Im just looking for the defines in the hope to maybe manually remap it or see why it thinks and dups the inputs
@winter rose i tried that its weird. I went into trigger waited the apropiate amount of time that was max amount i set, i exit helo it starts up as soon as i leave. It then flies past two way points then instead of landing. It goes into a 2km holding patturn (flies round n round a forest when the LZ was 5 km away. What am i doin wrong? Surprisingly my trigger to get the MI8 and trucks full of infantry to move an rappel and dismount work (ish..the mi8 comes back an picks em up again or in my cycle waypoint it sits on the place n the infantry remount it. The 2nd truck out of the first one dismounts its units 200m from the point the first one does)
Sooo yeee tons of weirdness lol
XD im close to givin up after like ive been workin on this op for nearly 35hours in the last 3 weeks
punctuation x_x
Yes i know im sorryyyy
Its nearly midnight, being moderately coherent is hard ;_;
Can you forgive me sir lol
don't work with non-working brains, all you'll have is awful thinking π
take a break, have a kitkat and come back to it with a fresh mind - forcing won't do
Working 4 hours with triggers that change behaviours everytime does that lol. And ahah uhm sure xD why not
Got any advice on what im doing wrong tho ?
first, working tired!
second, I don't know. I would need to see the whole mess of triggers
Hmm yes you are correct lol. In that case ill go rest xD and try round 2 and 3 and 4 maybe 5 then ill bother you π π π
Honestly tho ty xd
'night! ^^
Hello everyone im kind of new to scripting and im messing with vehicule weapon and use them on vehicule that totaly should'nt have that and i wanted to make or find a script to make all the magazine in big one like if i have 3 120round belt on my canon with the script i only have 360 munition
yeah english is not my main langage so i may not use the right word to express myself ^^'
so let me get this straight:
- you are using scripts to add magazines
- you want all these magazines to combine into one
you can't merge all in one, but you can set the reload time to zero with https://community.bistudio.com/wiki/setWeaponReloadingTime
btw dad when u will come back from store its been like 8 years :v
I still haven't found my cigs, you will have to wait
yes i added a weapon thats not from the vehicule to it and because i use a secondary ammo type when i use it from the begining it start reloading
you can't merge all in one, but you can set the reload time to zero with https://community.bistudio.com/wiki/setWeaponReloadingTime
i found that while i was searching awser for what i wanted to do but i dont really know what to put were
if i do "this setWeaponReloadingTime [gunner (vehicle player), currentMuzzle (gunner (vehicle player)), 0.5];" idk what the bold part mean
i think if i put down the 0.5 to 0 its going to work as i want but dont know what i have to put instead of the bold stuff for my heli
If anyone could help me understand what i need to replace to make it work mp me or just tell me here ty ^^'
I'm trying to set a marker over the position fo a fugitive
I'm using this code
[] spawn {
While{not isNull fugitive; sleep 1} do{
"lastKnownPos" setMarkerPos getPos fugitive;
fugitive globalChat "well "+getPos fugitive;
};
};
};`
it's placed on the global init but it does nothing
tried also on the init of the unit itself and nothing
What's wrong with it?
fugitive is an undeclared variable, therefore the code errors
you can check in the arma rpt, and/or activate the -showScriptErrors startup flag to have a popup
@past mist
fugitive is a unit
I kinda resolved by adding
"lastKnownPos" setMarkerPos getPos fugitive;
sleep 60;
}
``` in the init.sqf
dunno why it works now and not before
fugitive globalChat "well "+getPos fugitive; // will error
ah yes, that was my attempt to debug
unless it only globalChat "well "
yep, you put the sleep after the condition in your while
the while code block should end with a boolean.
if(isServer) then{
[] spawn {
// While{not isNull fugitive; sleep 1}
while { sleep 1; not isNull fugitive }
do{
"lastKnownPos" setMarkerPos getPos fugitive;
systemChat str getPos fugitive;
};
};
};
``` @past mist
@winter rose sorry to ping you but i didnt find the meaning of the code to adapt it to my heli and other vehicules
Halp π
Its a ah- pawnee
So its for pilot
I removed the minigun and rocket and put a 20mm minigun and 230 mm rocket
Im not on my computer atm so i cant give you the actual code π
I tryed it for solo but if i can use it on mp it would be great
Yeah the weapon are on the pilot seat
I get it, but is there a pilot in it
or is it an empty vehicle
Its empty mb π
np :p
setWeaponReloadingTime seems to be the time between rounds, not reloading reloading
what you could do is remove/readd weapon, this would load the mag instant I think
Ok ty ill try that ^^
didn't one of the addMagazine commands recently get a parameter for instant mag loading?
I was thinking of addWeaponItem, which gained a parameter for instant loading in 1.95
Is there a script when an alarm is played while a bargate is open and then when it is shut it turns off?
Anyone has NoSQL integration to arma server ?
@hollow cloak https://community.bistudio.com/wiki/createSoundSource with createSoundSource you can play a sound and delete it when it needs to stop
@distant oyster Thank you appreciated
yo
I have a question
I am trying to kill my friend with the command player setdamage 1; but his name has a space in it, what do?
@viscid flame you don't use the player's name.
Hi friends, may I ask, for example, a map with a module (xxx.jackon_county), what is its worldname?
Is it (altis) or something else? Thank you
What kind of database solution would you recommend for storing massive amounts of information and retrieving it very often?
(talking about Arma 3 gamemode)
uh...
the kind of database usually depends on the kind of data, not the size/read frequency
Also congrats @still forum π
I'd say, use that what's available, which means extDB or intercept-db, which means mysql.
Just small bits of information like numbers and strings
But a lot of them. A lot
In terms of Arma
is there a function where i can pass cursor object and get config reference? issue is there are objects on the map that are not in cfgvehicles so i cant look up stuff using inherits from or functions like. i need to get base class name of an object that i cant click on in the eden editor.
typeOf gives you the class of the object
if it has a class. it has a cfgvehicles entry. if not it doesn't have a config entry at all (like many map objects)
so the equivalent to cfgvehicels. example what base class are tress in? is there a function that will give me that so can then write other code to get more info.
example what base class are tress in
none, they don't have a config class, they are terrain objects
ok.... when i use nearestobjects i cant hide/delete them. some stuff i want to delete/hide some stuff i dont. but i need to know the "iskindof" terms to use to keep what i want and remove what i want. only way i can do that is by looking them up in the config file, and to do that i need to know the base class to start looking in and it would be nice if i could go in game and look at something and return the info i need. so im trying to write that. not everything is terrain object or cfg vehicle. so any ideas on functions that would help. inheretsfrom or returnparents all require you to know the base class.
nearestObjects doesn't return terrain objects
well this hide/deleted everything on the map. this is just my test code. so....
{
private _x_delete = true;
if ((_x isKindOf "trees") || (_x isKindOf "bushes")) then
{
_x_delete = false;
};
if (typeOf _x == "O_MRAP_02_F") then
{
_x_delete = false;
};
if (_x_delete) then
{
deleteVehicle _x;
if !(isNull _x) then
{
hideObject _x;
};
};
} foreach nearestObjects [centerposition, [], 10000];
inheritsFrom gives you the base class of a class you have
have you read the nearestObjects wiki page yet?
it tells you how to detect trees
yes... hence my need for a way to detect them in the foreach so i dont delete them.
its not just about trees. its... nvm... ill ask someone else.
look at str _x for bushes, or modelInfo and see if you find anything that they have in common
but as I said, they have no config classes. so your config approach won't work
is there a way to detect if an object has no class?
what does typeOf return for a bush?
idk
tbh think there is a class did he name which bush cuz the ETO module picks up bushes under 'grass'
yeah but when it groups them Im thinking there some parentage that is being checked
In my RPT file, an error appears when a player exits the server.
Warning: Cleanup player - person 2:1859 not found
common
Is it possible to change the armor vest through the script in the mission?
I have a vest with a winter skin, but the protection characteristics are huge, I need to change the degree of protection, not change the vest.
no can do.
Is there any command that would let me check what map/terrain is the object being placed on wiht Init EH?
yes, worldName
ah, awesome, thanks π
I would like to have a unit take a weapon from an inventory, first moving to it if necessary, is there a simple way to do this or do I need to spawn a move and then wait for them to get there and use Take action?
someone knows keycodes for controller?
Where do i put sounds in my mission folder
?
playSound "Killfeed_notification.wav";
where do i put this sound
if you have defined in description.ext then u just put the sound into the folder coresponding with the path defined in ext file
not now
class CfgSounds
{
class boom
{
name = "boom";
sound[] = {"\sound\boom.wav", 1, 1};
titles[] = {1, ""};
};
};
in this case u put sound into "sound" folder
{"\sound\boom.wav", 1, 1};
where is problem?
probably some misspel. Dont have time to check sorry
playsound "music1";
you defined "class music1"
you should playSound "music1"
Has someone made a generalized system for dealing with all the different functions for accessing and modifying inventories? It requires a lot of boiler plate to have some remove item action that will work on a unit and a container. There should just be "removeItem" that will work regardless of what the target or item class is (and by "item" I mean everything, weapons, items, backpacks etc.)
@ebon ridge doesn't and won't exist.
So far, remove everything then re add everything -1
if you are talking about ammocrates, the "remove 1 item" will never exist
i mean something that generalizes the different interfaces between a unit and an inventory for instance. If I want to remove a vest from some object, I need to use a different function if that object is a unit or a crate.
yep, and it won't change
I didn't ask if anything will change
I asked if someone has written a wrapper that makes it sane
I don't think so, but⦠Perhaps
I never seen such a thing, but its only the 3rd time I need to write code for simply removing something from a target regardless of if that target is a crate or a unit, and already I am annoyed by it, so I hoped someone who wrote it 10 times got annoyed enough to solve it π
in this case its an auto looting script for AI, I jsut want AI to take a vest from any possible place
whether its a box or a body
and even more generally I want them to take a set of things, a primary, vest and helmet, without needing separate code paths for each item
removing one item from a crate is tricky : which magazine, for example? The first inserted one, or the one with the least ammo? Same for vest or backpack. Empty vest? Vest with one mag in it?
yeah these would be decisions such an API would either decide for me, or allow me to control with parameters
Write it
Sell it for 5 toilet paper rolls
???
Profit
different interfaces between a unit and an inventory for instance
uniformContainer, vestContainer, backpackContainer
are all vehicle cargo containers, same as if you target a vehicle directly
get the cargo container, and then use the same function on all of them because they are all equal
yeah but unit itself is a container as well which can have a vest and uniform in it right?
or at least i want it to behave like one
i don't care that a unit can only have one vest, and a box can contain lots, I jsut want to say object removeItem "vestclass"
or something like that
yeah but unit itself is a container as well which can have a vest and uniform in it right?
no
a unit has containers on it. Its not a container per-se, or atleast the unit container itself you cannot access
guys if I wanna remove the side skirts of a tank from RHS how would I do that? (T-80A/B/BV/BVK have that as customization option, but T-72s and T-90s dont, which I wanna change)
Is there a way I can make multiple Ai stop at a checkpoint then you use a radio command to tell them to go also the ai dont come at the same time
Hey guys! A way to βblockβ players weapon slots? Primary, secondary and launcher. So that player can not use any weapons.
@hollow cloak maybe with a trigger and the commands doStop or disableAI "MOVE"
@distant oyster How would i use this in my mission?
any idea why a script that change weapon work on eden and worked 1 time in mp dont worked after changed the weapon but still same code ?
@hollow cloak depends on your mission. seems harder than I thought but as I said that depends on your mission... After all you could try with a waypoint that is synched to a trigger with activation by radios.
@lofty rain There is the eventhandler "InventoryClosed". maybe run a check on the unit and if he has a wepon drop it via commands.
@distant oyster thanks. Iβll start digging.
Anyone know if its possible to have an eventhandler on a specific command? i.e. createVehicleLocal
Hello, can anyone tell me why when i run this script on my player, all the weapons dissapear?
[player, "PRONE_INJURED", "NONE"] call BIS_fnc_ambientAnim;
sleep 2;
[player, "STAND1", "NONE"] call BIS_fnc_ambientAnim__terminate;
@potent depot no
rip
@haughty fable "NONE"
@winter rose I tried with "FULL" , but the backpack still dissapearing
did you try "ASIS" @haughty fable?
Yes
Then this function removes everything by default for this anim, no way to do otherwise but use the animation yourself directly
Is their a difference between script used in eden and in zeus ?
some commands work only in eden, some live
does the command remove weaponturret and add weaponturret only work in eden ?
i made it work one time in zeus
since it worked in zeus that should tell you its not confined to Eden
most commands are normally run in live game
3DEN commands are restricted to the editor
and some of the other commands run in editor dont have actual effect when the mission is run and need to be run again when the game is live.
Is there a script anyone can help me with please where you scroll on a car and tell it to skip waypoint?
Also works on multiple separate cars
ya even supposed to use args with that? https://community.bistudio.com/wiki/BIS_fnc_ambientAnim says just use _unit call BIS_fnc_ambientAnim__terminate
also I believe someone mentioned this in the past, gotta lead in to the animation with ASIS otherwise wont matter what you stop it with as its already lost (could be the issue in this case?)
@haughty fable
it's sqf [player, "PRONE_INJURED", "ASIS"] call BIS_fnc_ambientAnim; sleep 2; player call BIS_fnc_ambientAnim__terminate; note that it's only player for the last call
thanks Lou it was likely you that mentioned it.
also, if you just want someone injured you can use setUnconscious (even if it is not immediate)
or swichMove "UnconsciousFaceUp"
I only asked about the wiki cuz Im spoiled by JavaDocs and basically even something like that its documented so the IDE knows it. π₯³
wrong channel? :p
nah I didnt want ya jumping. cuz Im about to ask....
oh shβ
is there a EH for vic spawning vanilla or even CBA? need to run a invulerablity script on any and all spawned vics. in this case a mod is spawning them not a player so I cant add the script on it like in eden. so hoping for a EH mission level to catch all of them
#define vic
vehicle...
(could have been victims)
yeah specifically ground, trying to stop alive from being naughty with some vehic's
your answer can be found on the page https://community.bistudio.com/wiki/Arma_3:_Event_Handlers
either a respawn EH, a MPRespawn EH or an EntityRespawned missionEH
does that count on the first spawn I mean these are 'spawns' not something being respawned.
my bad, I read "_re_spawning"
all good lol I fell in that trap this morning
I have this in a trigger 10x5 area car disableAI "move" ; then
this addAction ["Allow through","enableAI Move"]; but whenever I launch the mission it says 'enableAI Move # ' ---- Error invalid number in expression Could anyone help me out please ?
@bright flume vehicles
@hollow cloak "_this select 0 enableAI ""move"""
better in code { _this select 0 enableAI "move"}
wait where would that code go @winter rose
car disableAI "move";
car addAction ["Allow through",{ _this select 0 enableAI "Move" }];
Thank you alot for that π
dreams of a discord diff markup like quoting.
@winter rose Thank you, im trying another code, later i'll show you π
@winter rose Also is there a way where you have to be fairly close for it to work or is that very complicated?
radius # in addaction
@hollow cloak yes you can set a distance in addAction arguments
object addAction [title, script, arguments, priority, showWindow, hideOnUse, shortcut, condition, radius, unconscious, selection, memoryPoint]
https://community.bistudio.com/wiki/addAction
9th argument, so```sqf
car disableAI "move";
car addAction ["Allow through",{ _this select 0 enableAI "Move" }, nil, nil, nil, nil, nil, nil, 5]; // 5m
dang lou you type fast as me. well refence is above posted π
starts whispering number nine number nine...
'car # addAction allow through... Error type Any expected string
is the ; missing on the end of the addaction object's script command? cant remember if its needed in it
https://community.bistudio.com/wiki/addAction
9th argument, so```sqf
car disableAI "move";
car addAction ["Allow through",{ _this select 0 enableAI "Move" }, nil, nil, nil, nil, nil, nil, 5]; // 5m
@winter rose Is there any way i can change that argument without having to write all of that?
no
Okay
wtb a way to define specific args by [] π
shhh we don't do that here
?
Wait @winter rose Can you help the code has an error
gimme the code you put there?
shake just pose the question if its related, anyone here if they can help normally does.
^ also true
is the code you said
I am in no way the #arma3_scripting manager π§’ π
is the code you said
@hollow cloak car addAction ["Allow through",{ _this select 0 enableAI "Move" }, nil, nil, nil, nil, nil, nil, 5];
wtb a way to define specific args by [] π
@bright flume What do you mean?
sorry @bright flume π¦
no apologies needed just saying pose the ? :), and as for arg[] some let you define args without writing the whole line cuz you define the value to what arg by [] position as in like a list []. different language....
car disableAI "move";
0 = car addAction ["Allow through",{ _this select 0 enableAI "Move" }, nil, nil, nil, nil, nil, nil, 5]; // 5m
0 = @hollow cloak because triggerβ¦
no apologies needed just saying pose the ? :), and as for arg[] some let you define args without writing the whole line cuz you define the value to what arg by [] position as in like a list []. different language....
@bright flume Oh, thank you π
but like Lou said we dont talk about that here. lol
wait im confused I used the code but it still has an error do i need to change anything in the triggers?
but like Lou said we dont talk about that here. lol
@bright flume I dont understand english perfectly, so i didnΒ΄t know what you mean π
@hollow cloak just add 0 = before car addAction
I did π
hmm, weird then
lemme try
is there some form of ID for players joining a server that one could use to send variables?
like eh.
if (playername == "John") then {
//send variable ["John wallet"]
}
cause I want to incorporate money in my script, and that has to be server only to avoid tampering
Battleye UUID? steam ID?
ownerID
use remoteExec, you can send to player based on variable, ownerID, or just reply to whoever remoteExec'ed to you
@hollow cloak sorry, one has to provide most if not all the arguments
addAction ["Allow through", " _this select 0 enableAI ""Move"" ", nil, 1.5, true, true, "", "true", 5];
Fixed*
@winter rose It now says init missing ;
Nevermind sorry my fault
needed car at front
Thank you for your help much appreciated
yeah sorry I did cut to the meat of it :)
When doing a setPos, how can i change the x corrdinate adding +10?
For example, i have an object in [10,10,0] , how can i do a setpos to the player to those coordinates but adding 10 to the x coordinates?
vectorAdd
@haughty fable
private _origPos = getPosATL player;
private _newPos = _origPos vectorAdd [0,0,10]; // +10m altitude
player setPosATL _newPos;
so [10,0,0] in your case
ohh ok, thank you!
thanks @still forum and @bright flume ! remoteExec with remoteExecutedOwner seems to be what I need.
Ok, so i made this code:
_sBag = _this select 0;
_sbagPos = getPos _sBag vectorDiff [0.3,0,0];
_playerPos = getPos player;
player setPos _sbagPos;
player setDir(getDir _sBag + 180);
[player, "PRONE_INJURED", "ASIS"] call BIS_fnc_ambientAnim;
sleep 1;
player setPos _playerPos;
[player, "STAND1", "ASIS"] call BIS_fnc_ambientAnim__terminate;
But still dissapearing the backpack
Is there any way i can save all the equipment of the player on an array, remove them from the player, and then put them back into the player?
Is it possible that some animations lock the unit performing them and can never be toggled/moved again?
How would I rotate the junk in the back of this offroad
cant send images one sec
90 degrees
boom
Is it possible that some animations lock the unit performing them and can never be toggled/moved again?
@coral owl You need to end the animation
i am developing a mission in which it uses dynamic mission and i need to know how to add sound in scripts that doesnt use trigger.
could anybody help?
Thanks @haughty fable I am trying to find out if I can avoid a brutal switchMove ""
thats the way to end it
@cyan dome how are you running the scripts if not with triggers?
you just add the commands into whatever script you run
as i said it is dynamic
@young current yes but it disconnects from the previous action and the animation breaks
i was using sunday_system
that does not say anything to me
and @coral owl then you will need to play transition animations
before using switchmove "" to clear it
Thanks @young current I am looking into it, I can't seem to find the right transition animations, but I get it now
// Create extract task
switch (_extractStyle) do {
case "LEAVE": {
if (((count _heliTransports) > 0) && !extractHeliUsed) then {
_taskCreated = ["taskExtract", true, ["Extract from the AO. A helicopter transport is available to support. Alternatively leave the AO by any means available.", "Extract", ""], objNull, "CREATED", 5, true, true, "exit", true] call BIS_fnc_setTask;
diag_log format ["DRO: Extract task created: %1", _taskCreated];
[(leader (grpNetId call BIS_fnc_groupFromNetId)), "heliExtract"] remoteExec ["BIS_fnc_addCommMenuItem", (leader (grpNetId call BIS_fnc_groupFromNetId)), true];
} else {
_taskCreated = ["taskExtract", true, ["Leave the AO by any means to extract. Helicopter transport is unavailable.", "Extract", ""], objNull, "CREATED", 5, true, true, "exit", true] call BIS_fnc_setTask;
diag_log format ["DRO: Extract task created: %1", _taskCreated];
};
// Send new enemies to chase players if stealth is not maintained
if (!stealthActive) then {
if (enemyCommsActive) then {
diag_log 'DRO: Reinforcing due to mission completion';
[(leader (grpNetId call BIS_fnc_groupFromNetId)), [2,4]] execVM 'sunday_system\reinforce.sqf';
};
// Make existing enemies close in on players
diag_log "DRO: Init staggered attack";
[30] execVM 'sunday_system\generate_enemies\staggeredAttack.sqf';
};
this is the sample.
got it
@cyan dome pls use codeblock markdown formatting or pastebin.com
its discord feature
three ` then cpp
then your code
and three ` more
like this ?
no
im horrible at this
thats alright
you can do it
` usually is produced with the button left to the backspace and shift being pressed together
||~~taskCreated = ["taskExtract", true, ["Extract from the AO. A helicopter transport is available to support. Alternatively leave the AO by any means available.", "Extract", ""], ~~||
in any way that is the sample code
i have a voice acted ogg files ready
the only problem now is how am i gonna insert the voice in the script it can be done in triggers in game but just as the campaign mode it doesnt usally use tons of tons of trigger just to hear all the annoucer is saying in the game.
welll you just plug whatever sound command you want to use into there and it should play it
i have no idea what kind command i am gonna need to use for it.
is it safe to assume you did not write the code yourself?
https://steamcommunity.com/sharedfiles/filedetails/?id=865663571
this is the sample mission
PTPA
yep
i am just adding voice in the announcer to give it life for personal use ONLY
Id use triggers then
until the developer itself approved the release
is there a way to make an AI discharge its weapon accidentally?
no, you would have to force it to do so
but I have to create a virtual target it will aim to?
if you want it to point somewhere
I was curious if a weapon can be made to just shoot without being aimed
currentWeapon _unit something..
there are few different "fire" commands in the link above
yes, they seem to all be deliberate acts of fire to something
will investigate π
thanks
_sBag = _this select 0;
_sbagPos = getPos _sBag vectorDiff [0.3,0,0];
_playerPos = getPos player;
player setPos _sbagPos;
player setDir(getDir _sBag + 180);
[player, "PRONE_INJURED", "ASIS"] call BIS_fnc_ambientAnim;
sleep 1;
player setPos _playerPos;
[player, "STAND1", "ASIS"] call BIS_fnc_ambientAnim__terminate;
I made this code for sleeping,the only problem is that when i sleep, the action removes the backpack of the player
there is a command to that too I recall
@haughty fable removes it how?
theres nothing backpack related in your code
I made this code for sleeping,the only problem is that when i sleep, the action removes the backpack of the player
@haughty fable Is there any way that i can save all the things that the player is carrying on an array, remove them for the action and then give them back to the player (after the action)?
@haughty fable removes it how?
@young current It just dissapear, with all the things inside
sure you can save the stuff but better way would be to figure out what removes the stuff
I thin its the action itself, i have tried with [player, "PRONE_INJURED", "FULL"] also but still the same
sure you can save the stuff but better way would be to figure out what removes the stuff
@young current How can i do that ? (Im relatively new to scripting)
you collect the stuff into an array with different comands and then before the script ends you use other commands to put the things in the array back into the character
I know, but which commands
there are quite a many of different items and weapons related commands you can choose from
in the commands list I linked above
can I do a pushback on an array I have not defined?
I mean:
globalArray01 pushBack _unit;
I would like to avoid globalArray01 = [] at the beginning but I am getting an undefined variable error
When i use addAction in the init box of an unit, what can i do so that im the only one (the unit) who can access that action?
true @winter rose thanks
this for multiplayer @haughty fable
What?
you addAction
@haughty fable not put it in the init
as a poor workaround, ```sqf
if (local this) then { /* blah */ };
But what i mean is, when i put another unit near to me and put the addAction in his init box, i can access to it
in single player or in multiplayer�
how can i send an image?
Just answer the question Mason
SP or MP
SP or MP
@winter rose I have saved the mission on MPmissions
But im doing the tests in single player
then if (local this && player == this), should cover most cases
but using the init is baaad
β¦you are using the init field
using the init field is baaad
https://community.bistudio.com/wiki/Code_Best_Practices#Code.2FFiles_organisation
check last bullet point
ANd how do i put the addAction then?
scripts!
What you mean is to call the unit Unit1 (for example) and then do it all
through a script?
for example yes; on each player connection, all init fields are run so it's "not great"
Ok, let me try
I figure it makes sense to ask here, how do I include ACE functions in an SQF file so I can use them? trying to find the specific include command I'd need and the wiki isn't helping much
for example yes; on each player connection, all init fields are run so it's "not great"
@winter rose I cant make it work π©
if (local this) then {
Unit1 addAction ["Loadout", "Loadout.sqf"]
};
i tried but still nothing
where did you put this?
and where do you call it?
π€ i dont know, you told me to not use the init box of the unit π
What should i do?
in init.sqf, _which is called locally for the server and each clients (even JIP),
if (player == unit1) then {
unit1 addAction ["Loadout", "Loadout.sqf"];
};
That way, the script is only called for the Unit1? and doesnt affect to the server?
yep
as long as you don't allow group teamswitch or in-group respawn, it should be fine
unit1 addAction ["Loadout", "Loadout.sqf"]; so if i put only this on the init.sqf, what would happen?
put what I wrote up there
if you only put this, you would have the same effect as before, everyone would have access to the action.
i still dont have the addAction
are you unit1?
nope
case-insensitive
what do you want to do? that only if you are unit1, you have the action, right?
Well, i still dont have the action :/
what do you want to do? that only if you are unit1, you have the action, right?
@winter rose What i want to do, is that if another player comes close to me, he cant do the addAction
then that's the one
but it doesnt work
are you sure it's init.sqf and not init.sqf.txt?
yes
and are you playing as unit1?
put this in init.sqf:
sleep 1;
systemChat "1";
if (player == unit1) then {
unit1 addAction ["Loadout", "Loadout.sqf"];
systemChat "2";
};
systemChat "3";
then tell me the systemChat output
there is no armagic here; you probably didn't edit or save the good file
anyway, it's good now
I think its because i cant name the unit (unit1) only (Unit1)
case-insensitive
I dont know what happened then
*magic*
anyway, it's cleared now
Yes, thank you very much π