#arma3_scripting
1 messages ยท Page 598 of 1
what about it?
also you play that sound everytime the player is alive, not dead
that code is ugly, stupid and inefficient
You can use selectRandom as I wrote above ๐
Look you tasked me with this
I hoped someone else would
ugh playSound needs CfgSounds
player addEventHandler ["killed", {
playSound selectRandom ["sound1", "sound2", "sound3"];
}]
something like that I think.
the ; is not at the end?
if you don't have any code after that, you don't need it
oh alright
I'll try this and let you know if it works
and what section goes under "killed"?
what mean?
doesn't something have to go there?
where?
i posted the whole code
it adds a eventhandler, that will fire the code once player gets "killed"
huh I thought i had to put something there. My little bit of knowledge is making me question a programmer way to much
I'm not good at explaining stuffz
same
And if you want to know this script is so I can play random anime sounds when players die in my mission because I do exotic ops in my unit and this one anime op is a tribute to our lead pilot (In case you were wondering)
I'm kinda losing hope on this stupid line
is there really no better way to change an object texture in the editor from the attributes?
what are you trying to set?
I've made an object and the problem is it has like 25 texture variants
and I don't want to spam the editor with 25 objects and instead make one with a texture selection menu
well setObjectTexture changes it in eden
I need it to be a dropdown menu visible in the attributes
like this https://imgur.com/a/brxxweZ
oh oh oh yeah i definitely misread your question uh im not sure how to solve that one but iโll see if i can find anything for you
don't worry I've been trying for 3 days
I'm the closest I'll ever be before I give up
thats the arma development spirit!
magazinesAmmo doesnt work on vehicles?
yes, it would seem so
ok, so there is no way to get the ammo-count of magazines in a vehicle's inventory?
yw
thank you โค๏ธ
im getting the feeling that youre developing this addon more than i am
๐
I demand 50% of the revenue
i make no revenue

i thought arma modding was about giving to the community
i got it all wrong
harr harr, how naive can you be! we du eeet for the moniez ๐ฐ
How much does a box of sand and a few snails cost though? ๐
PIECE??
supply and demand
ร6, no? Oo
demand is low, so supply is non-existent, thus prices for bulk are up
โฌ?
I feel way too concerned about snails prices all of a sudden
โฌ
#arma3_scripting : "Discussion about anything related to Script creation and usage within game ... IF (script == true) THEN {chat here};"
Lou and Nica: SNAILS!
yeah, idk
i'll add you on the credits
along with the whole discord
but you'll get a personal mention
as well as anyone who i can remember ๐
awww not mandatory but very welcome! ๐
it's the least i can do, tbh
script == true doesnt even work ๐ข
if (sand && count snails > 0) then { call vomit; };
Damn... I actually like escargo ๐
๐ฑ
let it forever be known, that Lou will be credited as Hugh Laurie-lookalike
https://community.bistudio.com/wiki/setTriggerArea
any idea if trigger's angle is always relative to North or a parent object's rotation also affects this?
if I find a way to ship some, I will @ebon citrus/@restive leaf /offtopic
@astral dawn I don't know, but I would tend to believe they act as attached objects (relative dir)
funny, I assumed it's relative to north always. Because it's the laziest implementation and it's more accurate to assume it. ๐ค
That's what I would assume, but tbh, just an assumption
there is a parameter to set rotation
but all objects spawn with a rotation of 0 unless otherwise specified
Dedmen probably wouldn't know... we need Dwarden for the answer to this one
since triggers are 2d-ish objects, theyre always on the vertical axis only
which is correlative with north
will have to check
Dedmen seems to learn Czech though
i dont get the question
You don't get my question?
yes, trigger attachto car
does that work?
Thanks but no need for it, I am trying this already
But I was thinking if someone had an immediate answer... there was a non zero chance of it ๐
I am very hyped for results since it will teach my bots to avoid vehicles moving towards them
Nice
Maybe @winter rose could add a note that that info should be added to the wiki before this conversation gets lost in the aether
not really
i think it acts as predicted
if it would act unpredictably, then i guess
Not really... otherwise the question would not have been asked and you wouldn't have tested it...
@astral dawn , how did you attach the trigger?
if it would act unpredictably, then i guess
It gets more weird here, since does it also rotate whole detection area box according to parent model rotation (including pitch and roll) or not?
i used attachTo
yes I used same
ok
It gets more weird here, since does it also rotate whole detection area box according to parent model rotation (including pitch and roll) or not?
would need to test
since it doesnt have those properties
it does have a height though - I would tend to support the fact that it shouldn't, but we can't rule it out before testing
No... trigger is a sphere so pitch and roll are irrelevent
You just roll around the circle
No... trigger is a sphere so pitch and roll are irrelevent
is it? trigger should have area (a, b, angle, ...)
triggers can be non-spherical
nope
they can also be rectangles
not a sphere
usually endless vertical cylinders
unless you set a height
Oh... really?
butโฆ they can be square/rectangle, and/or set a height yes
@restive leaf yep. you are wrong. please leave this Discord now.
no snails for you ๐ข

nope
triggers keep their rotatation
the only axes they rotate around is Z
i spent a good moment kicking a car around with a tank
because i was too tired to write as script
Fairly logical
Even with a height property
It is easier to check if something is inside something on a 2D plane then it is in 3D
For the mission init I have
player addEventHandler ["killed", {
playSound selectRandom ["tuturu_1.ogg", "tutturuu.ogg", "onee-sama.ogg", "oh-shit_2.ogg", "hitmarker_2.ogg", "niconiconilovesyou-3_cutted.ogg"];
}]
and for the Description.ext I have
class CfgMusic
{
sounds[] = {01,02,03,04,05,06};
class 01
{
name = "01";
sound[] = {"tuturu_1.ogg", db+10, 1.0};
titles[] = {0,""};
};
class 02
{
name = "02";
sound[] = {"tutturuu.ogg", db+10, 1.0};
titles[] = {0,""};
};
class 03
{
name = "03";
sound[] = {"onee-sama.ogg", db+10, 1.0};
titles[] = {0,""};
};
class 04
{
name = "04";
sound[] = {"oh-shit_2.ogg", db+10, 1.0};
titles[] = {0,""};
};
class 05
{
name = "05";
sound[] = {"hitmarker_2.ogg", db+10, 1.0};
titles[] = {0,""};
};
class 06
{
name = "06";
sound[] = {"niconiconilovesyou-3_cutted.ogg", db+10, 1.0};
titles[] = {0,""};
};
};
Is anything wrong with this? (I have the sound files in the mission folder)
Making custom death sounds for exotic op
for the init?
playSound selectRandom ["tuturu_1.ogg", "tutturuu.ogg", "onee-sama.ogg", "oh-shit_2.ogg", "hitmarker_2.ogg", "niconiconilovesyou-3_cutted.ogg"];
๐
playSound selectRandom ["01","02","03","04","05","06"];
oh sorry. How do I do that?
which one?
either one that is needed
oh alright thank you
thanks both
for example, if you want to paste your whole config
the prefer pastebin
keeps the chat nice and tidy
โค๏ธ
Nice, thanks Lou
@robust hollow Gives the error "Sound 05 not found"
you used CfgMusic, try CfgSounds
alright
unless it is actually music, in that case you might want the playMusic command. up to you.
it is an .ogg playing a quick sound so I think you are right
it is '''CfgSound''' not CfgSounds'''?
messed the entire sentence up
the wiki disagrees
huh
playSound
Description:
Plays a sound from CfgSounds
and also found the right (`)
Am I missing the "Sound\tuturu_1.ogg", ... (Sound\ )
that depends, are your sound files in a folder named sound?
They are in the mission file. Does that count?
as in the mission file root folder?
ye
then just "tuturu_1.ogg" should be fine
still not working
idk then. follow the instructions, do exactly what the wiki says and it is impossible to go wrong ๐
๐ญ Been doing this custom death sound thing for like 4 hrs
Way too much work for something totally not worth it
is your cfgsounds in the description.ext?
ye
maybe try with sounds[] = {01,02,03,04,05,06}; as an empty array instead.
i imagine it isnt changing those to strings anyway (which i assume they need to be). the wiki examples leave it empty though so i guess it isnt necessary.
Not working
mm yea i have no idea. never had any issues adding sounds myself.
Well it is a custom death sound. That change anything from what you use it for?
no
our lord and saviour
did not know about that until now
death sound to others or the player only?
player only
or for players on one side
like players on bluefor. Let them know someone died kinda
being? like in the init using eventhandler
which eventHandler are you using?
playSound selectRandom["01","02","03","04","05","06"];
}]``` The Init
If it cuts down time yes
cuts down?
forgot time
ummm, yeah like 3 seconds worth of writing
ok youre triggering the sound
how's your CfgSounds?
i suggested that before ๐ข
are all the sound-files in your root
if by sqf you mean sqm, yes
๐ญ Finally after like 5 hrs I can finally hear "Nico nico ni" when I die๐ญ
@ebon citrus @robust hollow @still forum
Thank you guys for helping me make a custom death sound and cutting down the time to only 5 hrs ๐ญ Thank you ๐ญ
@ebon citrus Yeah we kinda just made that
And you did help even if you just helped me see something I missed or misunderstood
helloo anyone knows how to do a costum Vignetting for a mission? , i want to use gas masks but JSHK mod doesnt have this "effect"
i found this old post but in the documentation (https://community.bistudio.com/wiki/Description.ext#rscTitles) i cant find how to define the rcsTitles
https://forums.bohemia.net/forums/topic/146786-vignetting/
you define a display inside the RscTitles class of a description.ext (or config.cpp?)
there isnt too much trickery to it, just add the class to your description.ext file and it should be good to go
class RscTitles {
class YourDisplay {/* display stuff here */};
};```
yes, but that isnt all. you would need to define a display and then an image control on that display to set the image path to.
if you have done the config correctly yes. maybe have a read of this to get an idea for what I'm meaning.
http://killzonekid.com/arma-scripting-tutorials-gui-part-1/
if a unit with a variable placed in editor dies and respawns, does it lose that variable? is that variable only for that life?
it looks like it does... any way I should go about reassigning it when that unit respawns?
depends
where does this variable need to exist?
where the unit is local? server? all clients? all clients and server?
The way to go about it is always "how lazy can i be"
Dont ever do more than is absolutely necessary
Lazy code = best code... usually
the unit is a playable unit lets name it squadlead1. so I guess it would have to be local to the player that is using it, and the server if I have scripts to run on that unit that are ran on the server
some things that come to mind are doing some sort of on respawn mechanics but I need to learn eventhandlers first
currently looking at MPRespawn which shows global and local
squadlead1 addMPEventHandler [
"MPRespawn", {
params ["_unit", "_corpse"];
if ((missionNamespace getVariable "squadlead1") == _corpse) then {
squadlead1 = _unit;
};
}
];
something like this?
MPRespawn fires only where unit is created, i.e. on the respawning player machine
i guess I'm still lost. just trying to grab the global variable off a players corpse and reassign it to him when he respawns.
if you give variable name to the unit in editor it should still have this name after respawn
without any additional scripting
well when I have a unit named "somename" and I enter him as a player, I run out, die, then respawn. when I check somename == player, I get false. same with isPlayer somename
hmm will have to check that
i think i might know the error. you might not have to... give me a sec
yes, as per usual its user error. I had a bandaid fix where I had named a random item a variable, then in the unit's init I had thatvariable=this so I could skip an error I was getting if players didn't select that unit
so I have created this which works wonderfully. the problem is, when the unit respawns, I have to manually call the script again. its as if the while loop ends on death. if I call it manually, everything works fine and resets on the unit. am I missing something?
So the problem is _unit right?
It works when you recall the function but the function fails after _unit's death, right?
yup my function throws nill after that unit dies, but if its called again, then it is defined again
It is because _unit is getting updated when you recall it , and when he dies, it is no more the respawned unit
but still the dead guy
you need to get _unit within while loop
I believe it is updated when I recall it yes
so just stick my params in the while loop?
The variable remains same as Killzone says, but the problem is , at that point, _unit is recorded in there in value form, not reference anymore.
You need to get the variable by using
missionNamespace getVariable ["_unit", objNull]; //Ignore this, this confused you. New one with additional info below.```
within your while loop
this will return the unitname/var?
ofc , whatever the _unit in there is
u wont write _unit there
but whatever input u give to function
an option to do that is, pass the variable as string...
then do it like this:
_unit = missionNamespace getVariable [_this select 0, objNull];```
So you do not pass an object anymore, but a string because your variable is what you want, but the value that variable returns is not always what you want(on death for example)
I guess I'm confused with params since this is my first time using it. I'm trying to make the code applicable to more scenarios than just putting the unitname in. I thought params ["_unit"] is the same as _this select 0
it is. But you have a while loop there, and you want _unit to always be the player who respawned
For example, you want "_unit" to always target player, which can not always be the same entity(if he dies, he is a new man, he is no more the value that is returned from _unit)
oh ok I think I get it. the params in the beginning is defining the first _this select 0 from the [unitname] execVM "filename.sqf". Then the unit dies and the first _unit isn't filled anymore. so the second _this select 0 is pulling from that `[unitname] execVM "filename.sqf" again?
you need to retrieve a new value, which is still stored in the variable that you pass to your function .
yeah, _unit in there is the dead guy in this scenario, which is why isPlayer someunit returns false after death.
Killzone said that variable name in the editor remains same, which is true, but you are losing that variable name after you pass a 'unit object'
you need to get the new value that variable returns
but in this function you are losing since _unit is an object now
therefore, your function should retrieve the variable in string form, so it is not the value, but u re returning the string.. so later on, you can ask this string who the new guy is by using getVariable I provided above.
which you have to do after your while loop starts.
ok I'm trying to follow. So I need to go back to the beginning and use something other than `params ["_unit"] to do this string idea?
so what you have to do is , it wont be a unit anymore, it will be just a string. So the _unit is something like _unitVariable now. then you call:
_unit = missionNamespace getVariable [_unitVariable, objNull];
beginning of your while loop.
/* ----------------------------------------------------------------------------
Name: Undercover
Description: Turns the unit defined by the parameter to friendly then hostile if unit gets too close to blufor or opfor units
Parameters:
0: Unit Variable <STRING>
How to call:
[unitname] execVM "undercover.sqf";
---------------------------------------------------------------------------- */
params ["_unitVariable"];
if (isServer) then {
while {true} do {
_unit = missionNamespace getVariable [_unitVariable, objNull];
waitUntil {
.
.
.
Mind that Parameters part, it is not OBJECT anymore but a STRING
making this change, will fix your problem. You do not need to change anything else, but try to understand what the problem is.
Edited code, I used 2 different variable names accidentally, recheck pls..
Of course, do not forget to turn your variable into string as well when u call the function.
Since we changed data type
ok so the unit gets brought into the script as a string "unitname". then what getVariable is doing is searching everything looking for the string "unitname" and finds it. It then pulls in the object variable of that said unit and sets it to our private variable?
indeed.
ok that makes sense, but wow I was trying to read the getvariable wiki page at the same time and that page is confusing for that command imo
Basically , you are getting the unit the variable is assigned to in this mission
so my call has to be ["string"] execVM... as well right?
indeed
the variable 'name' that you use for the unit..
if you are using
[myUnit] execVm ...
```you now need to use:
```sqf
["myUnit"] execVM ...
missionNamespace getVariable ["_unitVariable", objNull];
thats wrong. Needs to be
missionNamespace getVariable [_unitVariable, objNull];
i was just gonna ask that, cause it didn't seem to work
Thank you, @still forum , modified accordingly.
Coding in discord is not one of my top skills ๐ฉ
mk so in the getVariable parameter, if you want a string you put a string, and if you want an object you put an object
we wanted an object in the end
@fair drum Make sure you remove the " " parts in getvariable (modified the code now).
yeah i got it
getVariable just asks the missionNamespace, what the variable's value is.
if you are asking objNull that is provided as 2nd parameter, it is the default value in case it is not defined.
so if you wanna make it string, go ahead, but it is better practice to keep it same type as the value you expect _unit to be.
the wiki is just weird. it says varspace getvariable name where name is a string, and all the examples are strings. how would I know that I could put an object lol
You are talking about objNull part or the first part?
_unitVariable is a string, dont forget.
ah ok
you pass the variable name in string form, and you get the value from it.
["myObject"] call HYP_fnc_myFunction;
``````sqf
params ["_variableName"];
private _theObject = missionNamespace getVariable [_variableName, objNull];
hmmmm i have it like that and its still not looping. is it because I'm using ["suicideBomber"] execVM "undercover.sqf"?
my params is a string, and the getVariable is just a local variable just like above
["suicideBomber"] execVM "undercover.sqf";
params ["_unitVariable"];
_unit = missionNameSpace getvariable [_unitVariable, objNull];
sorry there was a pastebin above. standby
Can you paste your new code?
["suicideBomber"] execVM "undercover.sqf";
params ["_unitVariable"];
if (isServer) then {
while {true} do {
_unit = missionNameSpace getvariable [_unitVariable, objNull];
waitUntil {
sleep 1;
([west, east] findIf {_x knowsAbout _unit > 1.4} == -1) and
(primaryWeapon _unit == "") and
(handgunWeapon _unit == "");
};
hint "The Bomber is Hidden";
_unit setCaptive true;
waitUntil {
sleep 1;
({((side _x == west) or (side _x == east)) and (_x distance2D _unit < 20)} count allUnits > 0) or
(primaryWeapon _unit != "") or
(handgunWeapon _unit != "");
};
hint "The Bomber Has Been Discovered!";
_unit setCaptive false;
waitUntil {
sleep 1;
([west, east] findIf {_x knowsAbout _unit > 0} == -1) and
({((side _x == west) or (side _x == east)) and (_x distance2D _unit < 200)} count allUnits == 0);
};
sleep 10;
};
};
private _get = { missionNameSpace getvariable [_unitVariable, objNull]; };
if (alive (call _get)) then
{
// ...
};
because _unit might die at any point
yeah I thought that was what we were trying to fix above with the getVariable to reset the _unit
there are sleeps/waitUntils in this code, so after each sleep , you need to make sure the _unit is still the unit you want
when you place it in _unit, it refers to the object itself, not the reference - hence the need to either refresh _unit or to always go for getVariable
To identify the issue, can u remove all the sleeps except sleep 10 at the end?
and test it like that?
sure. before we did the getVariable stuff, I would run him into an enemy which he would die and I had a hint "test" after the sleep 10 which would always fire. I narrowed it down to the first while do returning nill because _unit was no longer defined. let me try it without the sleeps, 1 sec
Shoot uhh, how do you do quoted names inside of a quote again? So a command like typeof that needs a "b_heli_light" inside of something thats already under "quotes"
""
private _string = "his name is ""Lou Montana""";
private _string = 'his name is "Lou Montana"';
private _string = "his name is 'Lou Montana'";
Awesome, thank you so much. That was driving me nuts.
private _string = format ["his name is %1Lou Montana%1", '"'];
``` ๐ ๐
doesn't loop even without the sleeps.
then code problem - using -showScriptErrors?
let me try lou's dealio
no errors on screen from previous attempts
with your call lou, would you put it in the while loop at the start?
no, replacing every _unit
oh.... oh my
well I just looked up some reference material for gamemodes I know have an undercover system. looking specifically at antistasi and his functions all use player and not trying to do it with a particular unit. would this just be easier to do it with all players?
oooo or maybe an add action for the undercover script? or maybe something I can put into a player respawn template?
It really depends on what sort of mission/gamemode you have in your hand.
If you want to do this for all players instead of a particular unit, then yes you can use player but considering you will have multiple players, it is required to understand multiplayer scripting which I believe, you are not familiar with, yet.
adding action is a matter of design, which is up to you.
i do want to do it for a particular unit, but I've been at this single script for over 3 days now so I'm getting burned out and wondering if I should start from the ground up again lol
if you re getting burned out, give a pause. Pushing may discourage and demotivate you which can lead you to completely give up if you are new to it; and in some scenarios, may also affect your capability of thinking logic wise.
Are you saying it because the code is still not working, or is it fixed after Lou's fix?
it is not but I haven't fully implemented lou's fix yet. thats what I'm burned out about, I have rearranged and rewrittin this thing so many times in the past 3 days that its just burnout. I was looking for a simple idea that would be cool for an op for my unit but in the grand scheme of things, they probably wouldn't notice the work that went into it. its every friday so i'll have to make do for now but there's three more missions in this campaign so I have time to figure it out. just gonna take a break like you said
Take a break, also I suggest you to learn debugging techniques and whenever you are stuck, just use them to find out what is wrong.
It will make your life easier.
There is a wiki page for everything!
Eh, there was not when I had started :(
ive been using visual studio for the stuff. any cool things I can do with it if you guys use it?
not meaning that specific page, just in general ๐
@fair drum Visual Studio Code I hope?
https://community.bistudio.com/wiki/Category:Community_Tools#Code_Edition for plenty of options/plugins
See? told ya@crude vigil
yes VScode. Already have the color'd text plugin. gonna try the armadev
@winter rose Today's starters are lucky in resource aspect.
hopefully its consistent with the next iterations of the game so I don't have to relearn
@crude vigil we work hard on that! ๐
I 'member when using a wrong weapon classname in OFP crashed the gameโฆ
@fair drum unfortunatelyโฆ
https://community.bistudio.com/wiki/DayZ:Enforce_Script_Syntax
i have a question ? how can i make a convoy in arma 3 ? because i have this command : setConvoySeparation but i don't know how i use that.
link the vehicles together in a group, and order them to go to some other point - they should use roads in column
@winter rose ok but what is the "FOLLOW" waypoint ?
https://community.bistudio.com/wiki/Waypoint_types#Follow
not much I know I am afraid ^^
i have group all vehicles after i have set a "limitspeed" and "convoyseparation" and it work only if i change the formation to "line"
@winter rose i have remove the "convoyseparation" and the convoy always work so the "convoyseparation" command is only to change the distance between vehicle in a convoy and it doesn't work if i remove the limitspeed. When the vehicle doesn't have a speed limit the convoyseparation doesn't work and the distance between vehicle can be bigger ex : this setconvoyseparation 20 | can be 100 between a faster vehicle. So how the faster vehicle can wait other vehicle ?
ah yes, it's only a floor limitation, not a ceiling
limitSpeed to the min speed I suppose - although, vehicles should wait each others in a way
yes but i need to check the distance between all vehicle
and if it's greater than 20 limitspeed = 0
yes it's a good idea
There is even a real debugger with breakpoints and everything for VS Code, why not use this ๐คท
Because "real" programmers use Notepad (not ++)
how tf am i suppose to define a uav with addAction? only way i get it to work is going into in game init and doing "this" addAction...
in editor you can give the UAV a variable name
Depends on what youre adding the addaction to and how it's meant to worl
There are lots of ways of retrieving objects
you just need to find one that suits your purpose
player nearestObject addAction ["hi button",
{
hint "hi";
}];```
now that i look at this... idk man
i tried the variable name too and it just doesn't do anything lol, i wonder if im initiating the code right or something stupid
what do you expct this to do? @unkempt sorrel ?
check the syntax for addaction: https://community.bistudio.com/wiki/addAction
the excamples for this one are great aswell
this addAction
[
"title", // title
{
params ["_target", "_caller", "_actionId", "_arguments"]; // script
},
nil, // arguments
1.5, // priority
true, // showWindow
true, // hideOnUse
"", // shortcut
"true", // condition
50, // radius
false, // unconscious
"", // selection
"" // memoryPoint
];```
target (_this select 0): Object - the object which the action is assigned to
caller (_this select 1): Object - the unit that activated the action
actionId (_this select 2): Number - activated action's ID (same as addAction's return value)
arguments (_this select 3): Anything - arguments given to the script if you are using the extended syntax```
what you posted is a syntax error
player nearestObject addAction ["hi button",
{
hint "hi";
}];
//params ["_target", "_caller", "_actionId", "_arguments"];```
no...
do i have to fill out all of those params?
player addAction ["hi button",
{
hint "hi";
}];```
this adds the action "hi button" to the player
Yes, I'm aware of that but idk if its my brain but like i can't replace player with the object i want
the UAV, but the tricky thing is, the uav is programmed as if a player is inside of it and you take control of that unit inside of the uav, that's why there's 2 seats, im just wondering how to get the unit inside of the uav
why do you need to get the units inside of the UAV?
basically im trying to get an add action for the gunner in the uav
hell yeah man, thanks for the info ๐
aything else?
if i stumble across anything ill for sure let u know ๐
thanks, i like tricky questions
especially those ones that involve flipping a car over with a tank for research purposes
hm wasnt there a way to do a custom one of those radio support actions?
As in the ones that show up with a little icon on the top left of the screen that can then be executed via the radio
@ebon citrus quick question... do you believe this init script will work?
{
if (addMissionEventHandler ["PlayerViewChanged", {
params [
"_oldUnit", "_newUnit", "_vehicle",
"_oldCamera", "_newCamera", "_uav"
];
}]) then
{
_d = [_x] execvm "IRLaserScript.sqf";
};
} forEach fullCrew player;
i think i forgot the variable actually, i think i use _this
What are you trying to do? Since that script won't work
Well basically when i switch to a uav terminal or gunner screen, that event handler will fire and it will get the crew of the uav im in, then use that to put an addaction on the gunner
You most likely want something like this:
addMissionEventHandler ["PlayerViewChanged", {
params [
"_oldUnit", "_newUnit", "_vehicle",
"_oldCamera", "_newCamera", "_uav"
];
if !(isNull _vehicle) then {
_newBody execVM "IRLaserScript.sqf";
};
}];
Which will run an EH on "PlayerViewChanged", and run the script when inside a vehicle.
ohh okay, can u point out what i did wrong if u dont mind? i just like learning from my errors lol
im new to all this so
addMissionEventHandler doesn't return anything and will always execute when the EH is triggered (in this case on "PlayerViewChanged").
All scripts you want to run on executing must be placed inside the EH.
ohh okay so it doesn' t give a return so i add it in the block? makes sense ๐
it does return something, but that is the EH index (which can be used to remove the EH at a later stage).
see https://community.bistudio.com/wiki/addMissionEventHandler
@unkempt sorrel player is not a valid vehicle
fullCrew will return nothing
if you want the player's vehicle, you need to use vehicle player
Sorry i couldnt reply immediately, i was out helping my friend apply for worker's permit
@ebon citrus its okay i seemed to figure it out anyways, im using "gunner" and it does seem to return a value, my problem was initiating the script so i just did a simple way to start it and things are working as intended ๐
what exactly is your script?
if you care to share
i'd like to have a read to make sure you did it right
Is there a way to change how much the player score rises for certain kills? (E.g. for a jet double that of a helicopter or for a tank double that of an APC)
handlescore and addscore
couple that with "iskindof"
and you have an easy check to give specific score for specific type of vehicles
The _object refers to the destroyed vehicle?
object: Object - object for which score was awarded
So whatever is causing the award (killed unit, destroyed vehicle, etc.) is in this variable
Hiya does anyone know if it is possible to hide an object and only allow a specific unit to see it? Can't for the life of me think how it could be done
https://community.bistudio.com/wiki/hideObject
It's local, so needs to be called on all clients to take effect.
Meaning, you can call it on all, but one unit
@agile anchor What Grezvany13 said. If you want to hide if for everyone you could use hideObjectGlobal but I don't know if you can reveal it for one person with hideObject again afterwards...
uav = nearestObject [player, "USAF_MQ9"];
addMissionEventHandler ["PlayerViewChanged",
{
params ["_oldUnit", "_newUnit", "_vehicle","_oldCamera", "_newCamera", "_uav"];
list1 = gunner uav;
list1 addAction
[
format["<t color='%1'>Enable IR Marker!</t>","#228B22"], // forest green
{
params ["_target", "_caller", "_actionId", "_arguments"];
_pos = getMousePosition;
invis = createVehicle ["B_Soldier_A_F", uav, [], 0, "CAN_COLLIDE"];
invis hideObject false;
invis attachTo uav;
}
]
}];
dangerous use of a global variable
also, uav != _uav
i dont think "_uav" param is passed for that event
this works btw, it executes the command when i want, its just the matter of adjusting z coords, and i can make it local, i just dont understand the differences of why they can conflict with other things, and can you elaborate lou ? i dont quite understand, and it actually is, _uav is if you go into the terminal screen
oh, yeah it is
that's new
yeah, but it's still a dangerous use of a global variable
works if you have only one UAV named uav yes
make sure to remove the action aswell
or you'll keep on stacking them
and if you have one USAF_MQ9 in the mission
long story short: don't ๐
this seems like very Ad hoc code
it works for one use-case in VERY specific circumstances if you open the UAV terminal once
hmm so basically, no global variables, and remove the action and loop it back
and name uav something else
the game is adding a new action to the UAV whenever one of these occurs:
Fired on player view change. Player view changes when player is changing body due to teamSwitch, gets in out of a vehicle or operates UAV for example.```
it's broken on a fundamental level
how should i specify that i only want the uav
just do the param _uav?
i didn't know if that conflicted with other things
need help with it?
a little, but i think im understanding, ill have to see though when i actually write it lol
ok
it's best to design the code in pseudo-code first
first question, what do you want to do?
well, i do want an ir laser to be shot from the tgp of the USAF mq9, so basically you can see what it is pointing at
@exotic flax @vague geode thanks I look into that
visual to NVG
yeah, but only for night vision, exactly
not just visual to where it's pointing
yeah a visual laser
so im bascially putting an invis unit and attaching it to the drone
that turns off the laser too
if you make the unit invisible, the laser goes invisible too
is there a way to disable just the model of the unit?
i would assume the ir laser is seperate
yes and no
make a gun that has no model and a unit which has no proxies appart from weapon-proxy
then attach a laser to the gun
but that's VERY hacky
you haven't thought of using https://community.bistudio.com/wiki/drawLine3D
?
lmao that is probably what i would want, but is it possible to make it only seen by nvg's since it looks more like a mapping tool
like i wonder if there's a way to do an eventhandler with nvg's and run that script, but idk how much workload that is
yeah
@unkempt sorrel https://community.bistudio.com/wiki/currentVisionMode
damn
you got me
ninja'd

y e s, im fully erect, thanks btw man you helping me a lot lately lol
thank Lou
men
thank the community
that's the one
without the community, the community wouldn't exist
when one person helps you, it's a long chain of helping and advice
going way back decades
almost
decades - OFP was released in 2001, the wiki dates back from 2006, and Arma 3 released in 2013 (already) ๐
@fair drum unfortunatelyโฆ
https://community.bistudio.com/wiki/DayZ:Enforce_Script_Syntax
@winter rose
nooooooooooooooooooooooooooooooooooooooooooooo!!!!!! is it easier?
almost decades already
this is maybe a romantic idea
but i like to think that the arma community was born the day ofp was released
the community as in the people and the spirit
it sure did! mission makers existed day 1 thanks to the in-game editor ๐
the spirit grew from day 1 too
โค๏ธ
continuing a tradition spanning many decades would be a dream come true for me
a tradition around a game
a tradition about helping
(I remember my old website in html to download .zip ๐ด)
Helping is generally the best option for a social species, soโฆ yes, let's do that
uav1 = nearestObject [player, "USAF_MQ9"];
addMissionEventHandler ["PlayerViewChanged",
{
params ["_uav", "_uav1"];
_list1 = gunner uav1;
_list1 addAction
[
format["<t color='%1'>Enable IR Marker!</t>","#228B22"], // forest green
{
params ["_target", "_caller", "_actionId", "_arguments"];
_pos = getMousePosition;
if (currentVisionMode player == 1) then
{
drawLine3D [uav1, _pos, [0,0.2,0,1]];
}
}
]
},1]
removeMissionEventHandler ["PlayerViewChanged", 1];
return```
i had to use a global one
no
also, return is useless and throws an error ^^
yeah that was gonna be my question, how do i loop the script back
loop back?
dedmen coming at you
dont worry
lmao is starting out
with scripting
lets think this through
in pseudo code
if we are going to use drawLine3D
you need to first get the object to add the action to
which is the uav right?
the first line is useless as PlayerViewChanged gives us the UAV
but even better than that
you can attach the action to all UAV's at init-stage
when you are initializing said vehicle
this is a little dirty
how shall i go about this ๐
add an onEachFrame eventHanddler to draw the line if the player is in NVG-mode and toggle(let's call it that) is enabled
hmmm, is this multiplayer compatible meant to be?
@ebon citrus If I have to add the HandleScore event handler to the player how can I get the server to execute the addScore and addScoreSide commands?
can there be multiple UAV's?
@vague geode addScore has global effect
ah, i see the note
remoteExec?
well, it would be nice but, and yeah, multiple would be nice, but idk if its worth the workload cause idk how to really go about it,
remoteExec?
I don't know. I am asking you... XD
it's possible, but youre taking quite the undertaking here
considering your knowledge of scripting
so i would recommend you do it for one UAV for singleplayer for now
to get the hang of it
and how scripting works, sounds good?
hell yeah man, its all i need it for anyways, ive just been wanting to do a solo mission ๐
@vague geode yes, you would remoteExec it
Ok, thanks.
@unkempt sorrel the start of a scrtipting project is to consider what's the least effort you can expend to do it
dont just "i can do MP, it's nice"
it's a do i need to, do i not need to
anyways
give the UAV a variable name in it's init
something like "LMAO_UAV_1"
that way we can always refer back to the UAV with that name
now let's add an action in the uav's gunner
this action will just toggle a variable
i'm looking for insights, i wish to make an event where in a certain time a missle is shot by a unit on the terrain toward an helicopter but, the missle should not hit the helicopter, ie i want the unit to shoot to miss
LMAO_UAV_TOGGLE=false;
this addAction
[
format["<t color='%1'>Enable IR Marker!</t>","#228B22"], // forest green
{
if (LMAO_UAV_TOGGLE) then {
LMAO_UAV_TOGGLE=false;
}else{
LMAO_UAV_TOGGLE=true;
};
}
]```
something like that
you could also trigger this on the event of firing the UAV's laser marker, but we'll get to that later, not now
actually this is garbage
we probably want to use the UAV fired trigger
that way we have the lsertarget
@unkempt sorrel let's take this to DMs?
@ebon citrus I have never used remoteExec for a command with two parameters before so I don't know how I would do it...
[_unit, _score] remoteExec ["addScore"];?
change the projectile speed to make it miss@flat elbow
exactly like that
now just define it to fire only on server side
uhh i think even with lower speed the target lock will still keep it to hit
wouldn't the homing system just make it steer?
i mean i would expect a guided missle to steer even if I move it
setMissileTarget
exactly like that
@ebon citrus Was that the answer to my question?
Ok, thanks.
but just make it fire server-side
@flat elbow setMissileTargetPos to aim at a position instead of an object
https://community.bistudio.com/wiki/setMissileTargetPos
The munition must have manualControl config to use this command.
The target position has to be inside configured missile targeting cone for command to work.
what about exploding the missile short before hitting?
that could work
but if you want it to miss, i would recommend just steering it with script
https://community.bistudio.com/wiki/triggerAmmo
triggerAmmo 10m away
mmh i'd prefer the missle to just go over it
then just nudge it
missiles dont have infinite g-tolerance
they cant account for all changes
https://community.bistudio.com/wiki/setVelocityModelSpace to make it go up ^^
i amde a missile "jamming" script at one point to make missiles steer away when the jammer was online
@ebon citrus I have never used
remoteExecfor a command with two parameters before so I don't know how I would do it...
[_unit, _score] remoteExec ["addScore"];?
@vague geode[_unit, _score] remoteExec ["addScore",2];
basically:
1/ if you want the missile to go in a straight line to a missed point, setMissileTarget/setMissileTargetPos (depending on the weapon)
2/ if you don't mind the missile changing its trajectory before touching, setVelocity/setVelocityModelSpace
3/ if you don't want any of these, just triggerAmmo before hit (and beware of network desync)
@ebon citrus sorry i was taking a little break, i can add u and we can go into dms if u want ๐
can i like, get the helicopter position, add like 5 meters, then force the unit to aim there and then forceWeaponFire?
that would work @unkempt sorrel
yes
getPos
but you would want a dummy-vehicle for AA missile, for example
we need to know what kind of missile this is
private _posAboveHeli = getPosATL _helicopter vectorAdd [0,0,5];
yea for the getting i know that i'm unsure how to force the launcher orientation tho
(even though, 5m may not be enough)
5m is within detonation cone for AA missiles
the aimAt, fireAtTarget et simila requires an object not a pos
actually almost optimal
HOLY MOLY
is this an AA missile or ATGM?
does it have manual target or lock-on?
Speak!
it is a lock-on
ok, then you need setMissileTarget
OR!
you can do like the chads do
and spawn your own missile projectile
and guide it to target with script
and then make it miss
you overestimate my knowledge of trigonometry
but far easier would be to rely on the AI
anyways, im going to go and roast LMAO
Lou, have at it if you want to
i'll be back in a bit
basically i want the players to $ their pants as they hear they are getting locked
the pilot AI will then perform evasive manouvre but i need to be sure the missle miss
hah, if you want them to hear getting locked, the AI has to lock them unless you play a soundfile
and lock them with a radar-weapon at that
yes my idea was to make the AI lock them and as soon as the AI is ready to fire make it move the aim and shoot
you should count on the AI to shoot, then, but add a "Fired" EH to grab the missile and set its target off
maybe like creating an invisible object above the helicopter and making the missile to target it
mmh yea i can do that, maybe a pencil
so it will also explode at the heigh i want
i'm just curious now if I can manually control the aiming of a unit
like, tell the AI where to point the gun
maybe
but again, you won't have the locking
yea that's just out of curiosity now
i'm still on the side of nudging the missile
from memory, there were a lot of issues in forcing the AI to shoot at something
fire, doFire, fireAtTarget, forceWeaponFire, I guess all these commands tried to circumvent various issues differently
supressing fire
my best luck with getting AI to shoot is supressing fire
but im not sure if that works with missiles
I would argue that a missile suppressing fire is the most effective kind
if you are a soviet AA missle suppressing fire is like the standard
reminds me of this video of a Russian soldier with broken arm calling Stalin organs fire over the radio ๐
@ebon citrus how did you test the attached trigger rotation yesterday? In my tests it seems that the trigger's area is not rotated with the parent object.
jsut saw that the other day
not the area but the trigger's rotation
i guess i misunderstood your question
So what exactly did you find then?
the trigger's direction changes as the car's direction changes
when attached?
yep
in my case it seems to always look forward I mean North ๐ค
๐คทโโ๏ธ
velocity doesn't matter; direction does
internal scripting stuff maybe
resets trigger size if vel is 0
so that the trigger wont fire
he has an adaptive system based on speed
that scales the trigger
I just tested with a long narrow trigger area and yes, it seems like this area doesn't rotate with the car the trigger is attached to
it moves with it, but does not rotate
Does anyone happen to have a list of all possible type names of vehicles for the isKindOf command?
Every CfgVehicles entries could be
yeah, I am not listing that on the isKindOf page ๐
Hi I'm trying to hide an object to all units apart from 1 and have tried objectname hideObjectGlobal true; and objectname hideObject false; but this doesn't work any ideas please
where did you run that?
'global was in the mission init and normal in a trigger
@warm hedge Ok.
@agile anchor
hideObjectGlobal in init.sqf?
and the trigger, when does it fire? what are its settings
global in mission init from within editor and just for testing purposes i have the trigger player activated
from within editor
? wait, wut?
attributes/general/init (I believe it is the same as having an init.sqf) but I could be very wrong and would like to know lol
I don't know a lot about advanced Eden functionalities, which is why I ask ๐
Oh ok i was beginning to worry lol
well, it hides the object, right?
could there be another way of achieving what I'm after
yes it hides it
when ever i unhide it all see it
atm
the trigger would need to have player in thislist as condition
otherwise, any unit would trigger all local triggers
oh ok makes sense i'll give that a try thankyou
@winter rose didn't work unfortunately
wut?
so just to make sure i'm getting it right... in mission init objectname hideObjectGlobal true; activation trigger... Activation: 'any player' & 'present' Condition: player in thisList On Act: objectname hideObject false;
yep
doesn't work ๐
yes or a specific Ai unit and no other ai
that's different then
you cannot "hide" something from AI, except one-timed with forgetTarget
what you could do however, is setCaptive
Fired and FiredMan EH's dont work with laser designator?
I've tried setCaptive and same thing happens (as soon as it transfers over they all shoot)
@agile anchor yes, setCaptive must be reapplied on locality change
would i have to assign forgetTarget to all other ai (other than the 1 i want to use)?
now, give us context so we can be more precise
lol
what is it you really desire want to do?
you must know my question without anything else!
I'll stop being unhelpful ;)
@ebon citrus I don't think so
I'm trying to get a specific ai unit to engage a specific target but no other ai near by join the party lol
https://community.bistudio.com/wiki/laserTarget might be useful instead @ebon citrus
@agile anchor ```sqf
{ _x setBehaviour "CARELESS"; } forEach _allOtherUnits;
detect the firing of a laser designator on a vehicle without making a loop
yes, it would seem so
i was just coming here to confirm my assumnptions
think so's dont help
my hypothesis is that fired and firedMan dont work with lasers
Best way is to test, but afaik it doesn't
is that a hypothesis, or did you test it?
i tested it
after my hypothesis
and according to my tests
i have made the conclusion that it doesnt
I'll need a 2000 word report by monday!
Nah but seriously, as I thought ๐
Loop it'll have to be!
isLaserOn can help
yes, every time you turn on/off, a laser target object is created/deleted
hmmm
layers
mostly a Dark Souls reference ๐
is there a way to set an addAction's title to a script?
that would be re-evaluated the same way the condition is
or will i have to see if i can slip an setUserActionText in the condition field
this is gonna go so wrong
but im also intrigued
Just to make sure, with player addScore -1; I lower the score by one, right?
๐
it didnt work
i need to change the action name
since the players can change their backpacks
so the action name needs to be the backpack name
but i guess i cant do it in any "smart" way
uhhh...
i would hate to make a loop
@ebon citrus https://community.bistudio.com/wiki/setUserActionText ?
yep, i know about that
but i cant add a script to it, can i?
a script that would evaluate every time similar to the condition field
wait, never mind
it works
in the condition field
"
private _className = backpack _originalTarget;
if (_className != '') then {
private _backpackName = getText(configFile >> (_classname call TOM_fnc_getConfig) >> _className >> 'displayName');
_originalTarget setUserActionText [1, format ['Open %1',_backpackName]];
};
((backpack _originalTarget) !='') && (!alive _originalTarget);
"```
this has got to be the stupidest condition-field
ok, i've got a problem
the script is initialized for something IN THE MAIN MENU
is there a way to detect if the game is in a mission?
maybe you can figure something through findDisplay? IDK about UI
i tried 46
but 46 is loaded when the game loads into the main menu
let's see !isNull player
that might work
yep (and the script is irrelevant for dedi servers)
yep
MainMenu = uiNamespace getVariable ['RscDisplayMain', displayNull];
im trying to run a script as soon as the player loads into a mission
CfgFunctions?
nah, mainMenu is something different
cfgVehicles INIT eventhandler
yeah, no
shame
i wanted to add an EH that adds an action to all units
the script is running but it's not adding the eh
is there a way to get the unit's object with the unit-name?
never mind, it IS the object
hmmm
idk
the script executes but the action is not visible
it shows up in "actionIDs"
but the action itself is not visible
maybe it's inited too early
nope
it's not about when it's executed
let's see if it works if i execute it through cfgFunctions
instead of preprocessfile
that's weird
Vector question, does multiplying/diving a vector is the same as multiply/divide all of its values?
e.g
vector vectorMultiply 3
is equal to
[vector#0 * 3, vector#1 * 3, vector#2 * 3]
?
it seems so.
excuse me butโฆ what??
is there a rounding issue not displaying in the str array, ooor am I blind/crazy missing something?
private _v = [102, 687, 1543];
private _f = 53;
private _r1 = _v vectorMultiply 1/_f;
private _r2 = [_v, _f] call BIS_fnc_vectorDivide;
[_r1, _r2, _r1 isEqualTo _r2]
```for reference
i dont know what sorta floats arma uses
but 102 divided by 53 is quiteeeeeeee a lot of decimals
that's my guess, buuut
nah it's 1543/53
private _v = [102, 687, 1543];
private _f = 53;
private _r1 = _v vectorMultiply 1/_f;
private _r2 = [_v, _f] call BIS_fnc_vectorDivide;
[_r1, _r2, _r1 isEqualTo _r2, [_r1#0 isEqualTo _r2#0, _r1#1 isEqualTo _r2#1, _r1#2 isEqualTo _r2#2]] // last is [true, true, false]
A very simple formula is used to calculate floats in Real_Virtuality. It is (+/-)1 integer, decimal point, 5 integers as the fractional component, e,(+/-)3 integers representing the exponent component. If the beginning integer is negative, the negative symbol will be added, but if it is positive, it will be dropped. In the exponent component, positive and negative is always shown. If the resulting shortened value would go further than the hundred-thousandth's decimal place, it will be rounded at the hundred-thousandth's decimal place, this is why numbers of larger magnitude lose precision. Numbers start getting shortened once they reach the millions, thus, 999999 is the largest unshortened number than can be shown. 1000000 will be shown as 1e+006.
sooo there is a difference between x/y and x * 1/y?
no :D
private _a = 1543;
private _b = 53;
(_a/_b) isEqualTo (_a * 1/_b) // true
https://www.wolframalpha.com/input/?i=(x+*+1)+%2F+y+โ +x+%2F+y
Mathematical not possible to be false
arma doesnt fallow basic mathemathical order
so it does 1/_B
arma calculated _a*(1/b)
not (_a*1)/_b
right?
i've seen this behaviour in some notorious languages
Actually Arma is correct, since it first did math and then calling a command
And yes, a lot of languages just read RTL instead of per line and parse it correctly
Uhm... How did you came to that conclusion @ebon citrus?
i didnt
"a very simple formula is used" wat....
It's just standard c/c++ float... Nothing special
Actually Arma is correct, since it first did math and then calling a command
Math is also a command
gib answers ๐
LOL... That is straight from the wiki Dedmen
Who wrote that abomination of text?
So no tree__
DreadedEntity did... It was much shorter originally (in the original version by the same author actually) so I assume someone asked for it to be expanded...
also, maybe there were some evolutions in the engine? (don't burn me, just asking)
Please just wikipedia IEEE float
so all in all, where does the "issue" arise?
NOTE: Despite rounding the number and displaying it as a shortened literal, the engine seems to keep the actual value stored in RAM. ๐คฃ Now that is a classic line
Yes it is the same. And precision
float/double? or nothing alike
float prec
Could be that isEqual.... No can't..
Just some weird precision issue with specifically your numbers
is there anything I can check for when a variable I saved with saveVar for my campaign is nil in the next mission? it does appear in the campaign.sqc with the right value, so it should be there, but it's not :/
What are you storing in the variable?
a string
Ah. Our like 3rd implementation of methods to save variables
I just need a variable that will still be there in the next mission. if there's another way, let me know ๐
for some reason, it is nil, even though it did save correctly.
profileNamespace, but that would also stay there outside of campaign
huh, actually, the variable is there.
but isNil returns true ๐ค
yeah, I just noticed... thanks, I'll adjust it
hmm
my addaction is not showing up when i do it through the config.cpp
the action is there...
in actionIDs
but the action doesnt do anything
if i add the SAME action through in-game (copy-paste) debug monitor, it works
never mind, it is
im just ACTUALLY factually artarded myself
wrong action ID
because the one i added in the debug had the correct action ID since the previous one was already added below it
so it worked
i used action ID 1
๐จ
so the first aciton to be added was 0
consider also mods and other interactions - you should get the action ID by reference, not "guessing" it
yep, now it works
i know...
i swear there was a method to get all actions of an object
but now i can only find the IDs
yay, it works ๐
now I can have the strategic map from Arma 1
oooh with the little screen top-right and all?
I re-made it with the Arma 3 strategic map right now, because I have no clue about Rsc, but yeah, with some effort I could make the original A1 screen work ๐
(it almost worked unchanged, but not quite, a bit glitchy)
i swear there was a method to get all actions of an object
I believe all there was around wasactionIDs@ebon citrus
SWEAR TO MEEE ๐ฆ
but what do you mean by "get actions"?
obtain addAction parameters?
with card games, yeah ๐
here it is with the original map :)
not 100% functional though
https://i.imgur.com/fgqw0Gd.png
like, the video when you click a mission does not work, it just shows the players view xD
https://i.imgur.com/VbT7lgE.png
yeah that's the "video" I was talking about
this was a nice idea at the time!
you need an addAction & removeAction too ๐




