#arma3_scripting
1 messages Β· Page 631 of 1
i remember roughly that the new maps dont have roads as pasted on surface but something else? how do i detect if im on a road or not by script?
does this detect the pasted road segments?
yes
very cool, thanks
it returns a boolean
@little raptor
So I'm using MusicCFG for it
does that not define it because it's not working
boolean is fine. working on a script that shakes your camera if you drive offroad
and so far the detection was based on surfacetype comparing to a list of allowed surfaces
but isOnroad is so much better
yes
@open star What's not working? Post your code
object addAction ["Music On",
{
isNil {
{
playSound3D ["FortunateSon", _x]; //music file must be defined
} forEach [ls1, ls2, ls3, ls4, ls5];
}
}]```
You must provide the path to the music file
so
Is the music file in your mission folder?
If so:
object addAction ["Music On",
{
isNil {
{
playSound3D [getMissionPath "\Music\0FortunateSon.ogg", _x];
} forEach [ls1, ls2, ls3, ls4, ls5];
}
}]
post the full error
Also remove the comment
Maybe that's what's causing the error
anyone a smart idea on how to tell if a car is well suspended or not? i guess an 8 wheel APC gets through terrain smoother than a city car
at what point does a player loose his client scripts? apparently not respawning. after relogging on a MP server?
if the slot-unit has the script in init, will they be run again on relogging?
What u mean by "client scripts"
Relog should reload the mission I think... And thus rerun init?
im trying to figure out how to reliably give code to every client with as simple edits as possible. so just add the code to the slot-units init field in editor
oh crap init field gets run on every client lol
alright ill do initplayerlocal then
thx
btw, i suspect my script is killing the performance. when i tab out the game for a couple minutes, the frames drop to zero and take like 2 minutes to catch back up. any way to verify?
if you are talking about Steam FPS counter, it drops to 1 sometimes yes
Not just the counter. Its literally at 1 fps for 2 minutes straight
it can happen if all sounds/tasks are added at once when you come back yes
since there is -noPause in MP
hm interesting. very wierd. i dont do any of that.
ill play around a bit more and see if its caused without my script too
Can't possibly evaluate what's causing your FPS problem without knowing what kind of scripting methodology you're using.
@spark turret does it happen in SP too?
it didnt at first, now it did. im restarting, arma compelety ground to a halt
maybe uiSleep scripts
i think my install is effed. i restarted and even the main menu is at 1 fps lol. gonna reboot PC, try again and then annoy dedmen until i get a fix π
Or i created some kind of ram leak which exists outside or arma with my script :D
@spark turret Any draws?
I mean 3D draws
Because I've had that happening before when I used drawXXX3D while game was not focused.
Or maybe it happens if you're just using onEachFrame
I'm not sure about that one
no, i have zero clue what caused it. i have a 1 second timed loop with very simple checks like isOnRoad and speed vehicle.
sleep with sleep or uiSleep?
How would I get the position of a personal waypoint marker (LSHIFT + Click) https://i.gyazo.com/434b6e8a4c0828d7691ba8225ac104a1.png I have been trying something like waypointPosition [player, 0] but that is just returning the players position?
customWaypointPosition @frosty stratus π
Is there a scripted way of setting it as well?
i use sleep to suspend
Ah! That's what
customWaypointPosition@frosty stratus π
@winter rose So that's what they're called. I would also like to know how you disable them. Those things disable all need for range estimation in the game.
If you are running on a server you can disable them in the servers config @tough abyss
start in veteran mode does similar things
Is there a scripted way of setting it as well?
nope
I would also like to know how you disable them.
that's a difficulty setting yes
Senkyoo!
can i just use
[thingObject, true] call BIS_fnc_moduleTracers;
to spawn ambient tracers?
that seems to simple π§
hm okay no that doesnt work
Key word in there is "module"
well im following the bikis guide using:
private _moduleGroup = createGroup sideLogic;
"ModuleSmokeWhite_F" createUnit [
getPosATL thing,
_moduleGroup,
"this setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true];"
];
which works for smoke but not the tracers
oh my god are you kidding me.
the tracers module is literally spawning an invisible boat with a minigun to fire randomly into the sky LMAO
_veh = createvehicle ["B_Boat_Armed_01_minigun_F",position _logic,[],0,"none"];
_veh attachto [_logic,[0,0,10]];
_veh hideobject true;
_veh setvehicleammo 0;
okay no, im gonna make my own method. thats just to dirty
Someone already made an extensive ambient battle script (that includes tracers): https://steamcommunity.com/sharedfiles/filedetails/?id=682402094
Didn't pull it apart to check how, though.
Will look into it tomorrow thx :)
You know all those tacticool screenshots of players inside a helicopter with interior red light?
Well I basically want to recreate that for my MP mission.
Attaching the light cones to the helicopter interior ceiling (using AttachTo or BIS_fnc_attachToRelative) works fine. But when the helicopter executes a BIS_fnc_UnitPlay, the lights have a tiny amount of positional lag. Result is that the helicopter looks like it's pulling a string of Christmas lights.
How do other people fix this?
they create a light locally I suppose
see https://community.bistudio.com/wiki/Lightpoint_Tutorial @tough abyss
Hello everyone, I tried looking up a way to move an object ( basically create an animation where there is no animation ) but could not find a way on how to do this, would anyone here know a suitable command for this? ( It's for moving a object from top to down or from right/left to the opposite like a sliding door )
vehicles & AttachTo seem to provide a solution π
@tough abyss Use eachFrame and visual position instead of attachTo
excuse my total lack of knowledge here, but is there anywhere I can store and parse custom data on an object? I have a static mortar tube that can be deployed either through vanilla assembly as a backpack item, or through ace as a shoulder launcher item. When it is disassembled to backpack item, arma handles the magazines loaded into it and saves mag quantity and type. When I disassemble through scripts and ace action, I have no way of handling loaded mags. Currently, redploying the weapon through scripts just spawns a brand new fully loaded one. Can I dump a string with magazine classes and quantities somewhere on the launcher item itself when the static tube is disassembled into it?
I'd say yes
IIRC there is an event handler that detects what object(s) your launcher disassembles to
I don't have a problem yet with how I want to figure out what is loaded, I just need to find somewhere that says the tube is loaded with "5 HE, 2 Smoke". I am not sure if there is a way to store that info as a string in the init or something that I can parse through later
There are several magazine commands you can use
As for storing the variable, try setVariable
I'm on my phone so I can't provide more info on that
I can look through that, I am just worried how that will carry to multiplayer if a character dies and respawns with another tube.
I think I am going to look to see if I can add some kind of custom attribute to the object like ace adds "Is Repair Facility", etc. THank you for the link though, I will read through it
I am looking for a way to find out, if an object was spawned inside of a rock. Is there any nice function for that?
No.
you could detect distance with rock center and its bounding box, etc
how would i place a trigger zone that disables the movement of ai when they enter it?
cause placing a trigger zone and running disableAI "MOVE" isnt dooing anything in it
how do you use disableAI? π
{ _x disableAI "MOVE"; } foreach units _this;
ah
thought i was doing something wrong
didnt work π¦
nvm. i messed up in the condition. worked π
if you hover over the triggers code name, it displays a tooltip telling you what variables are available iirc.
which should be thisList and thisTrigger
firednear eh doesn't activate for mounted units π¦
mounted units firing a weapon activates the firednear EH on other nearby units
but not on himself
same for units in ffv seats, their firednear eh doesnt activate when they fire
add the event to the vehicle?
you could also use "FiredMan"
yeah, firednear is preferable for this use case
its players temporarily made setcaptive true for an infiltrate-the-enemy-town secondary mission
if they shoot a weapon, they and players nearyby are setcaptive false
so firednear is useful
ill test with the eh on the vec first
Could be set in the players fired eventhandler too
To check where they are when they fire
that too, but i suspect the same issue with a vehicle turret will arise
Possibly
i dont have a lot of vehicles and there's an existing getin EH , so the framework is already in place for putting the firednear on vehicles
thats first
oh, its actually a getinman eh, but i can work with that
its s shame there isn't a way of checking what EHs are already on an object
if i make a new eh everytime a player gets in a vehicle via GetInMan, im going to have multiple eventhandlers
if 2 players get in same vec
add only one EH on every vehicle, that triggers a mechanism that checks which units are there
yes, only add the eh if the vec is empty?
yeah, i'd need to remove the eh when the last player gotout
or a player getout - get back in again would duplicate the eh
probably easier to {addeventhandler firednear} foreach vehicle
we would need an "EntityCreated" mission EH⦠-hint hint-
hmmm
ok, not familiar with that puppy, lets have a look
oh i see, you want one, rather than suggesting i use one π
hehe
yup ^^ I felt its lack at some point
yes
just on the offchance, i looked allVariables on the player
(allvariables player) findif {"getin" in (tolower _x)}```
other eventhandlers are mentioned there, but not the GetInMan,
I thought I might be onto something there π
but no
```sqf ^^
see pinned message,
```sqf<line return>
your code
```
it's a pain at first but then it's wonderful :p
not yet, you have "sqf" written
wow, im good at this
```sqf
(allvariables player) findif {"getin" in (tolower _x)}
```
becomessqf (allvariables player) findif {"getin" in (tolower _x)}
no one saw anything (and I won't tell against π°)
hehe
ok, confirmed @young current , fired eh added to player doesn't activate when he fires a vehicle gun
as expected
will try adding the firednear to vehicles next
@finite sail
ok, confirmed @HorribleGoat , fired eh added to player doesn't activate when he fires a vehicle gun
Use FiredMan instead of fired
or a player getout - get back in again would duplicate the eh
No need to remove it. Just set var and you won't duplicate anything
just on the offchance, i looked allVariables on the player
other eventhandlers are mentioned there, but not the GetInMan,
That's only a list of variables. It has nothing to do with event handlers
will try adding the firednear to vehicles next
@finite sail
It most probably won't work
Afaik it only applies to entities
firednear does work on vehicles
specifically on quadbikes and prowler
it works when a player fires near it, that is
firednear eh added to a vehicle also works when that vehicle weapon is fired by a player
ok, some progress π
aside.. i wish quadbikes had ffv, crazy that they dont
Hi there folks, I am sure I did an oopsi, but not sure.
This condition is within a while loop. _x usually means usually whatever the while loop is running through.
Now I want to have the content of my condition fed into my array _shellRegistry, but how?
sqf if ((_cram nearObjects["Rocketbase",_radarrange]) || (_cram nearObjects["MissileBase",_radarrange]) || (_cram nearObjects["ShellBase",_radarrange])) && _canIntercept && _isDecending) then { _x append _shellRegistry; };
Hello guys I'm trying to play Music via a intro.sqf together with a text intro.
I defined the music in description.ext and call the intro.sqf via the init.sqf.
The Intro text works but the Music does not play.
Here is my intro.sqf
_cam cameraEffect ["internal", "BACK"];
CutText ["","Black Faded"];
sleep 1;
playMusic "IntroMusic";
sleep 0.5;
titleText ["Der, der weiΓ, wann er kΓ€mpfen sollte und wann nicht, wird siegreich sein.", "PLAIN", 2.0];
sleep 5;
titleText ["und um den Krieg zu ΓΌberleben, muss man selbst zum Krieg werden.", "PLAIN", 2.0];
sleep 5;
titleText ["~Malex Ason", "PLAIN", 2.0];
CutText ["","Black Faded"];
sleep 3;
titleText ["Operation Withering Dusk", "PLAIN", 2.0];
CutText ["","Black Faded"];
sleep 3;
CutText ["","Black in", 0];
_cam CameraEffect ["Terminate","back"];
CamDestroy _cam;
scriptDone introSeq;```
and here the description.ext.
```class CfgSounds
{
sounds[] = {};
class Golf22
{
// how the sound is referred to in the editor (e.g. trigger effects)
name = "Golf22";
// filename, volume, pitch
sound[] = {"Sounds\c_m01_35_lift_going_down_ABB_0.ogg", 60, 1};
// subtitle delay in seconds, subtitle text
titles[] = {1, "Golf 2-2 to Croassroads, we're under fire, Golf 2-2 sustaining heavy fire from our..."};
};
class Golf41
{
// how the sound is referred to in the editor (e.g. trigger effects)
name = "Golf41";
// filename, volume, pitch
sound[] = {"Sounds\c_out2_85_the_end_of_all_things_MEM_0.ogg", 60, 1};
// subtitle delay in seconds, subtitle text
titles[] = {1, "Mayday, Mayday! Golf 4-1 going down!"};
};
};
class CfgMusic
{
tracks[] = {};
class MyIntro
{
// display name
name = "IntroMusic";
// filename, volume, pitch
sound[] = { "Sounds\IntroMusic.ogg", 1, 1.0 };
};
};```
Can anybody tell me what I'm doing wrong? π
it might be playMusic "MyIntro";
but why 
because the name property is only a display name, as the comment suggests. its just for show.
oh
display in e.g triggers yes
Ok so how can I let it play from the intro.sqf
it might be
playMusic "MyIntro";
?
@silk ravine A while-loop has no _x.
What are you iterating over?
A while loop that has the condition to run as long as the object is alive
while that, the loop comes to a point where I want to feed specific objects that come into the range of the looping object.
I basically want to fill _shellRegistry with anything that belongs to the upper if condition and returns true on _isDecending and canIntercept
I just do not exactley know how, without doing nasty array fillers with +
(_cram nearObjects["MissileBase",_radarrange]) || (_cram nearObjects["ShellBase",_radarrange])
wat?
is that supposed to be a "condition"?
and even if it was (which it's not), that command is really slow
{
_x pushBack _shellRegistry;
} forEach ((_cram nearObjects ["MissileBase", _radarrange]) + (_cram nearObjects ["ShellBase", _radarrange]));
Might do part of what you are trying to do.
You should do lazy evaluation
Not sure about _isDecending and _canIntercept, need more info about that.
Is there any way to check if LinkedItemsAcc, LinkedItemsOptic, LinkedItemsUnder and LinkedItemsMuzzle in weapon config are not empty in mission environment?
by config reading yes getArray
Hello everyone, I have two switches with addAction commands. Switch one has the addaction is a "Power on" switch and switch two is a "Open Doors" one.
I want to make sure you cant "Open Doors" without having the "Power on"
I tried using
missionNamespace setVariable ["PowerOn_01", "true"];
in the addaction for the power switch and
in the door open switch but before the addaction.
This does not work though, it throws an exception so how would I use a variable to block usage of the Init script that is assigned to an object?
You can also set the condition of the 2nd action to "missionNamespace getVariable ["BunkerSwitch_01", false]"
Is it single player or multiplayer?
@sonic thicket
Testing in Eden but will be a small COOP so Multiplayer
it throws an exception
unscheduled environment error
Hmm i see, so a [this] execVM would be the solution?
Ill go ahead and try that π
spawn
It would be more optimal to add the action when that other switch activates
So no need for waitUntil
In other words, add the action where you set BunkerSwitch_01 to true
that idea totally missed me, thanks! that'll be much better indeed π
Always good to skip on any loop commands
yeah. waitUntil can "eat" your scheduler cycles
waitUntil in the init.sqf
always fun when you screw the condition up
ctrl alt delete
BTW, what we were talking about earlier @little raptor , I did end up using FiredMan
works a treat π
Good to know! π
indeed
when AI switches to autocombat, it has some timeout threshold to return to normal behavior again (noted by GL radio "clear")
is switching autocombat off and on again achieving the same?
I don't think so
is there a model for tracer bullets that already comes with its light source?
if i spawn
_bullet = "ACE_580x42_Ball_Tracer_Red" createVehicle ((position player) vectorAdd [0,0,2]);
it only spawns the bullet without the tracer effect
@velvet merlin
The only method I know that can return them back to the old state is:
_grp = group _unit;
_tmp = createGroup side _grp;
_cm = unitCombatMode _unit;
_team = assignedTeam _unit;
_unit enableAIFeature ["AUTOCOMBAT", false];
[_unit] joinSilent _tmp;
_unit setBehaviour "AWARE";
[_unit] joinSilent _grp;
_unit assignTeam _team;
_unit setUnitCombatMode _cm;
deleteGroup _tmp;
7,62 to the face will switch off autocombat
or setDamage
Anyway to fix the "Script #40 issue when making a Exile server?
That's not really a scripting question. Ask the Exile team
is there a model for tracer bullets that already comes with its light source?
@spark turret did you try giving some velocity to the bullet?
yeah it works. i looked into alias ambient battle and he attaches lightsources. that looks like an Alien flak, not like real tracers
@little raptor thanks. i am aware of the old group switch workaround. what is the difference to combatMode off/on?
You mean Auto Combat?
yeah i just have experience switching it on and off from player lead AI - for AI only group only either off or on all the time
guys. how would i go about changing the mode (safe/aware) of all ai units alive from the console?
{ _x setBehaviour "COMBAT" } forEach allGroups```
allGroups?
lou, do you have any smart ideas about my tracers?
would it matter if they are different sides?
then do select {side _x == "WEST"}
ah. thanks @winter rose . will try
lou, do you have any smart ideas about my tracers?
hum sorry what? well, you could create bullets and set velocity yes?
how bout if i want all to crouch Lou?
{_x setUnitPos "MIDDLE"} foreach allUnits; should work right?
yes
[Feature Request] New scripting command: getAutoCombat/setAutoCombat
https://feedback.bistudio.com/T155105
Is there a function that says like:
Am i being looked at or am i out of vision for everyone?
If not then [Feature request] I guess π
@velvet merlin
set
_unit enableAIFeature ["AUTOCOMBAT", false];
get
_unit checkAIFeature "AUTOCOMBAT";
AutoCombat is not a separate behavior
It's part of the AI brain
when AI switches to autocombat, it has some timeout threshold to return to normal behavior again (noted by GL radio "clear")
is switching autocombat off and on again achieving the same?
@brave elk No.
You can loop through all units and find if the line connecting their eyePos to your aimPos falls inside the FOV of the unit. Then do an actual check with checkVisibility
Right ok thanks
so is it the same, or is it not?
Nope
autocombat off prevents them from switching combat mode (behavior) automatically
that's it
afaik the period is hardcoded into their "brain" so I don't think it's fixable either
then what about disabling autocombat then setbehaviour?
already mentioned that: #arma3_scripting message
anyway, that's not what kju meant
does anyone know if it is possible to add the edit vehicle appearance to a ACE vehicle interaction?
You mean the virtual garage?
Yeah but just for that current vehicle if you get what I mean
["Open",[ true, _vehicle ]] call BIS_fnc_garage;
opens the garage for the vehicle you want
Or maybe it uses it as a position
I've never used the garage in scripts
Ok ill give it a try, I am trying to get it so you can walk up to the vehicle ace interact and change the camps and components like slatt armour
If you look at the function file (BIS_fnc_garage) you can figure out how it works.
Is there a function that says like:
Am i being looked at or am i out of vision for everyone?
@brave elk https://community.bistudio.com/wiki/BIS_fnc_isInFrontOf
is quite good for AI
and is fast
it's 2d
Thanks
ok thanks @little raptor
Quick question
Say I'm running am multiplayer mission
and player walks into a trigger and executes this
this = [] execVM "talk1.sqf";
Will it be just local to him because of this
Or will the other players see it also
the script will execute on every machine the trigger executes, no matter your this usage
wouldn't that create an error anyway? since this is protected?
No the line doesnt cause any errors
because that line of code will set the output of that script in a variable called this π€
@winter rose So just to make sense of that for my own clarification If I have person A, B & C
If B walks into the trigger B will only see it and A & C Wont
@exotic flax same with 0 = ; maybe because it is unscheduled
@topaz field it depends on how your trigger is defined.
could be, although I wouldn't do it, since it may f-up other scripts which use this properly
as in "Present, OPFOR" or "Present, Any player"?
wouldn't that create an error anyway? since
thisis protected?
@exotic flax
Why would this be protected? Only command names are protected. this is just a local variable
And 0 is also not a command name
it's Arma, nothing makes sense π€£
No it's not related to unscheduled
Everything makes sense when you understand how it works
but not everyone has access to the source code π
iirc I tried 0 = 5 and it threw an error, but I might be wrong π€
It actually sets a variable with the name "0" you can getVariable it.
but not everyone has access to the source code π
@exotic flax
You don't need to.
When I say "command names are reserved variables"
That doesn't mean that the name of a local variable, or a number are reserved variables, they are not commands, and only commands are reserved, so why the hell would they?
Just apply some logical thinking
this is a global variable, which means it can be overwritten.
And it WOULD make sense to have it protected since it's used all over SQF to prevent that
why, it's only used in unscheduled environments. So there's no risk someone overwrites the value you're working on.
No, this is a local variable (which is not logical, but doesn't change anything here)
Might make sense to protect it, but fact is "command names are reserved names" and nothing else.
so it acts like a _this, 100%?
Yes
Probably...? π€
It reads as a local variable, not sure if = will write as a local too
reposting, had wrong bg ;).
kewl
So global var this = 500 will never be impacted (but you can only access it through getVariable in local-this-equipped scripts)
But local/global is irrelevant to the fact that it's not a command
Who uses a global variable called "this" anyway :u that's crazy
yeah well, I still have nightmares after doing true = false in Arma 2 π
true, I use that for that π€£
The reserved variable thing that they did to "protect" is nonsense btw. There is no need to do that to make it safe.
I might actually make it properly safe the correct way.
That way all global variable accesses will also become faster...
moar perf? always welcome, be sure to not have side effects though :3
Every global variable read, first checks if there is a nular command with same name. Everytime you read the variable
Even though it already knows that at compile time.
Oh right, set too, but only for the bogus "reserved variable" check that's actually not needed at all
yeah both are needed. what would be your solution?
Both? No neither are needed
well, a check is needed?
You only need to check once at compile time, for the variable reads.
Not check on every read and every write
so you would catch a call compile "player = 5"
Why catch?
There's nothing wrong with that.
That sets the global variable "player" to 5
only accessible through getVariable hopefully
Yeah. Like it is now, already
so you would make the commands "not protected" anymore
I am afraid it will only bring more confusion
player = 5; // no error
hint str player; // hurr durr not 5
Will probably have to leave that, as warning to people that they are doing something weird they probably shouldnt
yes please⦠keep the script error (+ log warning?) if they don't use setVariable
Could do that compile time too tho
That's what I thought you had in mind at first
Not sure how big the performance overhead of that "needless" check is
... and have more people in this channel with broken scripts from l*fe frameworks π€£
You read variables more than you write, so the read fix is more important
reading variables should be "I don't care what it is, I just return it"
writing variables can have all the checks in the world (so that reading never fails)
so player can never be overwritten, but will also not care what it is when getting the value
hint str setDir ^^
currently does nothing too π
Quite sure that error never existed with non-nular commands.
As only nulars have the weirdness of sharing the same instruction with variables
If I was to write "global" instead of "this"
Would that mean people in multiplayer could also see the effects of trigger or script
locality of a script has nothing to do with the handle name
That doesn't matter...
Triggers will execute the code for everyone, which is why you can use thisList (list of all objects in trigger area, based on 'Activation') to limit on which client it will be executed
Triggers will execute the code for everyone
there are also local triggers
if you use createTrigger to create one, when made in the editor they're (always?) global (unless they added a checkbox for that, never used it)
there is a checkbox for server only
which will than never execute on a client, which doesn't make sense (unless you remoteExec stuff to clients)
which doesn't make sense
what doesn't make sense?!
have a script only execute on the server when it needs to be on the client (because I don't think that "talk1.sqf" is only used by the server: https://discordapp.com/channels/105462288051380224/105462984087728128/778775901273063426)
oh. ok. I didn't realize you were referring to that!
Just decided to be smart and have some initiative but by using "remoteExec" It should execute the script for the clients on the server correct?
if you want the code to execute on the server only, just set the trigger to server only
but to answer your question, the answer is yes. remoteExec ["fnc",2] executes the code on the server
Well Im a bit confused by the entire situation I have gotten myself into
Whats the difference between executing code on the "Server only" and peforming remote exec
because I have a script and I know it only executes locally now Im in a wild goose chase looking for a way to make it execute globally and still work XD
for a MP Mission
executing code on the "Server only"
I was referring to the trigger.
The trigger condition only runs on the server and so does its activation code
When you use remoteExec, you ask the server to execute your code on specific target machine(s)
so
Server only executes server wide
remoteExec executes server wide but only to specific people
or "machines"
no
Server only > Server only
remoteExec > Depends on target
If you explained what you're trying to do I could help you out
Such as what your script does and stuff
Yep Let me get it
Okay so I have a person
And when they enter the trigger (Which is set to "Present","Opfor")
executes this in the Activation
h2 say3D ["ring1", 150, 1]; execVM "talk.sqf";
let me get the sqf
sleep 1;
["Dimitri", "Hello?"] spawn BIS_fnc_showSubtitle;
sleep 2;
["Dyatlov", "DIMITRI!"] spawn BIS_fnc_showSubtitle;
sleep 2; ```
Now they work
But to my little to none knowledge it only executes locally to the person that walks into the trigger which means the rest of the people in the multiplayer server wont hear the noise nor also see the subtitles
Which is why I want to make the script execute globally so the rest of the people in the server hears them
This "person" that walks onto the trigger is not a player right?
Ok so when a player steps onto the trigger, should every player (regardless of their side or where they are) be able to see the subtitle?
Yes because the players are all on one side together
and in one spot?
yep
well that makes it easy:
within 50m if we need to be specific for the time period in which the script is being used
set the trigger to server only (there's a checkbox)
talk.sqf
h2 say3D ["ring1", 150, 1];
h2 say3D ["pickup1", 150, 1];
sleep 1;
["Dimitri", "Hello?"] spawn BIS_fnc_showSubtitle;
sleep 2;
["Dyatlov", "DIMITRI!"] spawn BIS_fnc_showSubtitle;
sleep 2;
trigger activation code:
["talk.sqf"] remoteExec ["execVM", 0]
if you want to limit it to like players within 30 meters of h2
["talk.sqf"] remoteExec ["execVM", allPlayers select {_x distance h2 < 30}]
Ahhh okay so Just to understand the activation code
What is the use of using execVM
Ahh okay that will help me a lot because I believe I might need something like that later on in my mission
Thank you very much
What is the use of using execVM
it executes your talk.sqf script
You could also remote exec each part of that in the trigger activation code (although you'd need to spawn the code because of sleep)
but this way it is better
it would be even better if your script was defined as a function
I know the scripting done in a3 is unique but what code is it based on?
C?
JavaScript?
It bears several similarities to many languages.
The engine code is in C++ afaik
I'd say python and C++ is what it draws most from
but it's still very different from those too
Yea I noticed
Also heads up the Say 3D aren't working
Let me just test it again
Yes they aren't working unfortunately
the subtitles work?
well it probably means your sound files are not defined for them
Well when it was all local they played fine
what is h2? is it defined?
is it an object?
ye
and how does not say3D work?
idk
how do yo know it does not work?
I had leopard do an excellent job and help me with the script right
Well because Ive had it working
I had it working locally right
then leopard helped me make the script global
And for some reason it doesnt work since we made the script global
@topaz field test this:
systemChat str (isClass (missionConfigFile >> "cfgSounds" >> "ring1"))
so say3D works but your script does not
I mean put it in talk.sqf
if it says false, the problem is the sound file
so say3D works but your script does not
the script works, but say3D doesn't! π
Brooo
I was looking at the wrong thing the entire time
Talk about smol brain haha
Im going to drink a bottle of water now
that might be wise
Hi, I would like that when the player respawn, he goes the arsenal that opens automatically how to do?
2 hours of research and I just feel like I'm using the wrong words.
I dont know specifics on how to do it exactly but
Once he spawns in a trigger it then opens it for them?
So it could be a very simple activation line command
@ashen urchin look up:
Respawn event handler
BIS_fnc_arsenal
@little raptor Thank you for helping me make that script global. I've taken what you done and applied it to another line of code I also am using I would just like to ask you if it looks all good.
addAction [Answer the Phone", "talk1.sqf"] remoteExec ["execVM", 0]
No
Thats a very flat response π
Take a look at the wiki page for remoteExec
I'm on my phone atm so harder for me to help now
Okie dokie, I had a look earlier but couldn't particularly decipher much. But I will look again
I understand
@little raptor Thanks to have show me the light 
@topaz field long story short:
[unit, ["Answer the Phone", "talk1.sqf"]] remoteExec ["addAction", unit]
Something like that
If you want to run it for everyone:
Thank you I'll give it a crack
I was gonna say something else:
[{Player addAction ["Answer the Phone", "talk1.sqf"]}] remoteExec ["call", 0]
Hard to type on the phone!
So much variety!
It's because the player object is different on each PC
So I passed the code to the client to be executed there
You are using "Player" as the variable name of the object correct?
no, it's a magic variable which always contains the player unit
still magic
I agree
These are magic vars
https://community.bistudio.com/wiki/Magic_Variables
it's a thing which always contains the player object
@topaz field I think you wanted to add the action to h2 right?
Yes
If so:
[H2, ["Answer the Phone", "talk1.sqf"]] remoteExec ["addAction", 0]
But your second line you produced worked
I have the impression to forget something.. but idk
this addEventHandler [[this, true] call ace_arsenal_fnc_initBox];
You're not providing the event handler type
Maybe this is what you meant:
this addEventHandler ["Respawn", {[_this#0, true] call ace_arsenal_fnc_initBox}];
Why _this#0 ?
_this is what is being passed to the code (an array)
_this#0 selects the first element of the array
@ashen urchin
params ["_unit", "_corpse"];
According to the wiki
So the first element of the array is the respawned unit
The second element is the corpse
Ok, i haven't no more error but it didn't work
I put the code directly on my user. But it's better on the respawn point ?
put the following on a container (or unit for that matter):
[this, true] call ace_arsenal_fnc_initBox;
and you should be fine.
no need for event handlers
It was my first try but it didn't work too, but i just tried on 3den
I think he wants to show the arsenal after respawn?
I want that player select his spawn, and direct have his arsenal
So directly after respawn
Do you have ace?
yes
Ha
this addEventHandler ["Respawn", {[_this#0, _this#0, true] call ace_arsenal_fnc_openBox}];
Is there an event handler that fires locally when the player quits or leaves a mission?
I am setting aperture to have brighter nights but the setting does not reset when I quit my mission
@little raptor It works fine, thank you a lot ! 
So I would like to just do setAperture -1 whenever the player leaves
But quickly, what's the first _this#0 and the send ?
_this#0 is the same thing as _this select 0, has higher priority too I think
Not my question, what's the role of both ?
ah, missed that you were asking about the first one, my bad D:
@uncut sphinx you might want to take a look at https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#HandleDisconnect or https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#PlayerDisconnected
Aren't both server-side?
it's local, but attached to the mission (if I read the wiki correct)
Thank you ! π
@tough abyss Use eachFrame and visual position instead of attachTo
@little raptor Thanks! When I read this article: https://community.bistudio.com/wiki/Simulation_vs_Render_Time_Scope
This does look like my problem. But how do I "setPos" visual so the position of the light updates correctly? Or maybe I misunderstand...
I have been working on a Mortar for the last couple of weeks (maybe more) and I currently have a bug were if the mortar is assembled on any sort of a slope it falls over ( see: https://gyazo.com/c1fec85ff2f0d5d965aec602b51159c0 ) however, if I assemble it on flat ground its fine ( see: https://gyazo.com/99c1c4d9a9aa5204dd8887ed018c80bf ) at the moment the assembly code looks like _mortar = createVehicle ["506th_weap_m224mortar", position player, [], 0, "CAN_COLLIDE"]; _mortar setDir (getDir player); however I think I may need to freeze the mortar, align it to the ground correctly and unfreeze it, the problem being I am unsure how to do this correctly.
@tough abyss render time scope commands are linked in that specific page
π Unfortunately they are all information commands like getPosATLVisual . Not setPosATLVisual.
So I don't know how it would help me with my "attached lights trailing vehicle" problem.
setPos getPosVisual method will do
π΅ That was fairly obvious. I need some sleep. Appreciate it.
Hey folks, I've been having trouble trying to get AI to respawn and head back to the waypoint they were heading to before they died. It's been killing me for like 3 days now, if anyone has any ideas, please DM me. any help would be greatly appreciated!
When an entity is killed you could retrieve all its waypoints and add them back.
https://community.bistudio.com/wiki/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#EntityKilled
https://community.bistudio.com/wiki/waypoints
https://community.bistudio.com/wiki/currentWaypoint
The top link was not missing a /wiki and is now broken π
I'm still lost, can someone DM me and help me out? I'll give credit to whoever helps in the mission description. This is gonna be a main op for my unit (10th MTN).
You can just ask here. Maybe someone has a similar issue. Stop PMing ppl. Thanks
Okay but i'm looking to share my screen and get real time feedback from someone who knows what they are doing.
The respawn systems is for players only, it does not work with AI. As such, you have to make your own system.
Like R3vo outlined, you can possibly get it working by adding an EntityKilled Mission Event Handler on the server. From that EH you then execute code that uses createVehicle to spawn a new unit and retrieves the dead unit's waypoint - hopefully with something like (waypoints (group deadUnit)) # currentWaypoint (group deadUnit) (this might not be possible, depending on how well these commands work with dead units!) - and then assigns that waypoint to the newly spawned unit.
does someone have a step by step guide for dummies so i can learn how to make an editor module?
Hello guys!
so I have an issue with deleteing an object.
In a script I create an object in this case _satcom = "Item_SatPhone"
later on I need to delete the object from another scope and I cannot seem to pass the local variable to the other.
So what I wanted to do is a workaround by simply checking for the closest objects to the player and then delete the object from that array
_list = nearestObjects [player, [], 2];
_object = _list select 1;
deletevehicle _object;
This works but ofc if there is another object closer than 2 meters then that object will be deleted instead...
SO I need help with find the specific objec in the _list.
If I perform I hint str _list it returns the following:
[B Alpha 1-1:2 (-Killet-),1f412a10100# 667283: dummyitemsmall_f.p3d]
is there any way to find the "Item_SatPhone" and filter on that?
Thanks for your help
@obsidian violet make it a global variable
KLT_SatcomToDeleteLater = createVehicle stuff;
// ...
deleteVehicle KLT_SatcomToDeleteLater;
```problem solved
That does solve the problem indeed =)
But for future reference how would I find the object in the array in this case mentioned above?
maybe a nearestObjects using type as filter
but it is ill-advised to act like that really (returned array may be empty, etc - many problems)
I am having a hard time setting radar always on to static radar vehicles like "B_Radar_System_01_F". No matter, if I set the Combat Mode to "RED", set emission control to 'Active' in the editor, or setVehicleRadar 1, the radar stays off. I am controlling this via taking control via UAV control of the gunner. The radar is always off.
Is there a solution to keep that thing on all the time?
are there mods?
A coupple, yes. Ace for example
try without, because setVehicleRadar should work
Ok, trying...
why 'crew' command returns empty array from static defense that has a gunner?
a drone maybe?
maybe mods
yes
What is this vanilla howitzer's class?
again, without mods?
yes
im standing looking at a mortar... crew cursorobject returns the gunner
Ok, setting the radar on is possible. Checking via isVehicleRadarOn returns 'true'. But when taking command via UAV terminal, on the mfd the radar is not active.
yeah, something wrong, but on your side.
where do I need to run [] call BIS_fnc_showMissionStatus to see tickets ? initPlayerLocal.sqf or initServer.sqf ?
anywhere you want? I would say it appears on screen immediately. maybe an action, if you need
@tough abyss @warm hedge you should use compatible position formats. There are like 5 position formats in Arma: AGL, AGLS, ATL, ASL, ASLW. You can find info on them in the dedicated wiki page about positions.
There is no setPosXXXvisual. Only getPosXXX must he visual
And getPosVisual is something you should NEVER use with setPosXXX commands.
Because there's no setPosAGLS command (and it makes no sense either)
I know, that's just the point of it
https://community.bistudio.com/wiki/Position for reference
I sometimes still confuse around with positioning NGL! π
setPositionNGL? 
π
What's NGL?!
afaik, not gonna lie
neutral gazelle limbo.
π€

Would love to see official vs code support with enfusiom engine
That makes no sense, Enfusion has its own IDE
Hey guys I was wondering if I could get some help with a script. I don't take credit for this script (flyingtarta) and I am not a talented scripter. But I was wondering if I could get some help modifying it. The script is it spawns shell craters when ever a arty or mortar lands. The script works fantastic, with one minor exception, it spawns craters for bullets as well. Heres the script-->https://pastebin.com/3VcggQMW I think I understand the problem in the code being this line
if (_z < 8) then {_c = "Land_ShellCrater_02_small_F";}; //changes the crater size if its an mortar
and that if anything is less than 8 then it still spawns the crater. Is there a way to make a less than say 4, for instance, come back as nothing?
@rustic crow the problem is that it does that for any fired bullet
Could I modify it for a specific ammo type fired?
I think there's some property in the ammo cfg that determines if it's a mortar shell
Didn't find anything in the ammo.cfg found it in the CfgMagazines tho
what did you find?
In reality all if I found was its class name, Sh_82mm_AMOS, Sh_155mm_AMOS,
Which might be referring to the magazine itself not the projectile
I think it's artilleryLock
if (getNumber(configFile >> "cfgAmmo" >> typeOf _bullet >> "artilleryLock") == 0) exitWith {}; //only artillery shells
@tough abyss @warm hedge you should use compatible position formats. There are like 5 position formats in Arma: AGL, AGLS, ATL, ASL, ASLW. You can find info on them in the dedicated wiki page about positions.
There is no setPosXXXvisual. Only getPosXXX must he visual
And getPosVisual is something you should NEVER use with setPosXXX commands.
@little raptor Interesting. But I am afraid this discussion is taking a left turn. Because the position of the lights is fine (it follows the unitPlay of the helicopter its attached to). But they are simply delayed by a fraction of a second. If I look at the output script file for BIS_fnc_UnitCapture, it seems to move the object relative to its starting position. Should I just detach the lights and execute UnitPlay on each light cone object?
Hey, I got a quick question: I am not that much into Arma scripting, but I try to change a script I found online.
radioJammer = [[jammer1], 3000, 50, TRUE] execVM "TFARjamRadios.sqf";
this is the line of code I am using. It is placed inside the initPlayerLocal.sqf but instead of loading it when the player connects I would like to load it via a script that gets executed mid-mission via execVM.
As far as I figured the issue seems to be that I need to load it for each player locally. I tried that with a call BIS_fnc_MP but I can't seem to get it working...
Here is what I thought could work:
[[radioJammer = [[jammer1], 3000, 50, TRUE], ["TFARjamRadios.sqf"]], "execVM"] call BIS_fnc_MP;
Could anyone tell me what my error is?
Thx in advance
@tough abyss when there's delay in position updates, that's why. Like I said, detach the light, use onEachFrame (the mission EH one) and update its position by getting the visual position of the helicopter
can you place the drone ai crew into a heli?
i like to have the blackfoot controlled as a drone
drone AI is no different than other AI
Drones don't have visual lod for crew, so you don't see them
hm feels like a pilot fucks up more, like flight height etc. dunno
no, they're exactly the same
ok thx
@queen junco bis_fnc_MP is deprecated
also your syntax is wrong
@sacred slate try the "virtualMan_F"
still i would be the pilot if i take controls
they're invisible
otherwise i have cockpit differences.
Okay... Well, what do I want to use then?
remoteExec
okay, thx will try it out ^^
ok thx
still i would be the pilot if i take controls
what do you mean? You're always the "pilot" when you take controls.
I think what made you think that the drone AI are different is how they behave when they face an enemy.
you can achieve the same behavior by setting the behavior to "CARELESS" and disabling "AUTOCOMBAT". They will become dumb like a "drone"
ah yeah
the autocombat does the trick
would be so great if you could operate the turret aim while flying
maybe give the helicopter waypoints/move orders?
still not the same. but i am just used to it, from planetside 2, there you have a gunship where you can operate a turret your self
i got pitch yaw turn on a wasd'ish layout.
btw, the unit type that the game uses for drones is "B_UAV_AI" (alternatives for other sides is "O_UAV_AI", etc.)
you can try that instead of VirtualMan_F
thx
@little raptor Hey I tried it with a remoteExec. But unfortunately I couldnt get it to work. So maybe I have a different error. It might be something stupid so here is a little more background:
I have an object(jammer1) with an BIS_fnc_holdActionAdd. Once this is complete I want to load a script
remoteExec ["jam.sqf", 0, true];
This should load the script that was originally in the initPlayerLocal.sqf
radioJammer = [[jammer1], 3000, 50, TRUE] execVM "TFARjamRadios.sqf";
So in theory it was supposed to load the script locally for every player once someone completes the holdAction. But instead it is either not loaded at all or not for the players as the TFARjamRadios.sqf includes a visual confirmation with a marker and a debug text. It worked fine with the initPlayerLocal.sqf.
@queen junco did you read the wiki description?
I tried to understand it. Thats why I came up with this. As mentioned I am not that experienced with Scripting
well the command you're trying to run is execVM
its arguments are:
left hand: [[jammer1], 3000, 50, TRUE]
right hand: "TFARjamRadios.sqf"
so the remoteExec command you want is:
[
[[jammer1], 3000, 50, TRUE],
"TFARjamRadios.sqf"
] remoteExec ["execVM", 0, true];
Ohh, okay. Thx ^^
I will try to figure out all the meaning why this works
So i have this restriction pop up in my script log file and wondering how i put it in the script.txt --- https://prnt.sc/vmesmf
Im new to all this
um...what?
restriction
you mean error?
Also, post the error on pastebin or something
And I mean full error, cause I don't see what that's supposed to be
@flint kraken Look up how to adjust battleye filters or use battleye autoexception generator
Having some issues with deleting FPS markers for my headless clients after they disconnect.
while {true} do
{
if (local HC1) then {"fpsmarkerHC1" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC1" remoteExec ["deleteMarkerLocal",0,true];};
if (local HC2) then {"fpsmarkerHC2" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC2" remoteExec ["deleteMarkerLocal",0,true];};
if (local HC3) then {"fpsmarkerHC3" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC3" remoteExec ["deleteMarkerLocal",0,true];};
sleep 0.5;
};```
Executing just the contents of the loop with the Debug Console on the server works as expected, markers are deleted, all bueno.
"FPS markers"?
To track server performance.
while {true} do {
private _myfps = diag_fps;
private _localgroups = {local _x} count allGroups;
private _localunits = {local _x} count allUnits;
_myfpsmarker setMarkerColor "ColorGREEN";
if (_myfps < 30) then {_myfpsmarker setMarkerColor "ColorYELLOW";};
if (_myfps < 20) then {_myfpsmarker setMarkerColor "ColorORANGE";};
if (_myfps < 10) then {_myfpsmarker setMarkerColor "ColorRed";};
_myfpsmarker setMarkerText format ["%1: %2 fps, %3 local groups, %4 local units", _sourcestr, (round (_myfps * 100.0)) / 100.0, _localgroups, _localunits];
if (local HC1) then {"fpsmarkerHC1" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC1" remoteExec ["deleteMarkerLocal",0,true];};
if (local HC2) then {"fpsmarkerHC2" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC2" remoteExec ["deleteMarkerLocal",0,true];};
if (local HC3) then {"fpsmarkerHC3" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC3" remoteExec ["deleteMarkerLocal",0,true];};
sleep 0.5;
};``` Here's the whole thing.
Updates a map marker with the current FPS, and unit and group count. This runs on init for the server and every HC.
I⦠don't get why you would deleteMarker then deleteMarkerLocal?
It was originally just deleteMarker
Which leads me to the issue I'm having.
The markers aren't actually getting deleted on the clients when the code is executed via script.
wait, stop
you delete them every 0.5s, but don't re create them π€ and what is _myfpsmarker?
Them being deleted should only happen when the Headless Client entities are local, hence if (local HCx)
//FPS marker
private _sourcestr = "Server";
private _position = 0;
private _myfpsmarker = createMarker [format ["fpsmarker%1", _sourcestr], [0, 0 - (100 * _position)]];
_myfpsmarker setMarkerType "mil_start";
_myfpsmarker setMarkerSize [0.7, 0.7];
while {true} do {
private _myfps = diag_fps;
private _localgroups = {local _x} count allGroups;
private _localunits = {local _x} count allUnits;
_myfpsmarker setMarkerColor "ColorGREEN";
if (_myfps < 30) then {_myfpsmarker setMarkerColor "ColorYELLOW";};
if (_myfps < 20) then {_myfpsmarker setMarkerColor "ColorORANGE";};
if (_myfps < 10) then {_myfpsmarker setMarkerColor "ColorRed";};
_myfpsmarker setMarkerText format ["%1: %2 fps, %3 local groups, %4 local units", _sourcestr, (round (_myfps * 100.0)) / 100.0, _localgroups, _localunits];
if (local HC1) then {"fpsmarkerHC1" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC1" remoteExec ["deleteMarkerLocal",0,true];};
if (local HC2) then {"fpsmarkerHC2" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC2" remoteExec ["deleteMarkerLocal",0,true];};
if (local HC3) then {"fpsmarkerHC3" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC3" remoteExec ["deleteMarkerLocal",0,true];};
sleep 0.5;
};
you delete HC1 marker on every machine if e.g HC1 is local on a machine, that makes no sense?
if HC1 is local to the server.
every 0.5s.
To check for them being disconnected, yes.
I'm aware this is absolute dogshit for performance, I'm trying to get it to work, first.
instead of deleting them, you could make them create a marker if HC
if (!hasInterface && !isServer) then {
// I iz headless
};
I'm doing that, yes, in the HC's init script.
The fpsmarkerHCx only exist if they are created by an HC joining the server.
It doesn't, though, is the thing. Not in the script at least.
If done through debug console, this works absolute wonders.
I've gone through simply deleteMarker, to remoteExec deleteMarker, to the iteration you see now.
then something else is wrong
do you have -showScriptErrors enabled? if the script fails before reaching the marker, it halts and you never know what happened
Yeah, I'm not getting anything, though, and the loop is working fine, FPS is being updated and all that.
Do you think using the HandleDisconnect EH might be a better solution?
yes
addMissionEventHandler ["HandleDisconnect",
{
params ["_unit", "_id", "_uid", "_name"];
if (_unit == HC1) then {deleteMarker "fpsmarkerHC1"} else
{
if (_unit == HC2) then {deleteMarker "fpsmarkerHC2"} else
{
if (_unit == HC3) then {deleteMarker "fpsmarkerHC3"};
};
};
true
}];``` This *should* work, right?
exitWith but yes ^^
@wild prairie If your maker names are consistent you don't even need that check. You can simply do format ["fpsmarker%1",vehicleVarName _unit];
Ah wait
I'd probably still check if the unit is a hc, otherwise you're sending a delete message for nothing
yea, _unit in [HC1,HC2,HC3]
And no bueno.
Marker's gone if I go back to the role assignment screen and back, though.
Ah, figured it out. Didn't have the loop inside of a scheduled environment.
uhmmmmmm, loops are not supposed to be in unscheduled environments.
It's been a long day.
All my players are of the same side, and they can't lock in each other with "r". It's possible to enable "r" lock between then?
Is it possible to make a script where if a grenade landa near the ai, they'd immediately try to move say; 10 meters away from it?
just a quick one, am i able to use inPolygon, to check whether a given position, is within a bounding box of an object.
you can, yes
i have some related code that I posted a few days ago, give me a few secs to dig it out
@past tiger nope, but you can lock with "T"
if you want them to be enemies, addRating negative
hmm, im using some code provided by killzone ,http://killzonekid.com/arma-3-bounding-box-utility/ i have the corners of the positions sorted (tested by creating an object on each corner) but im checking against the bounding box of a road, and it seems to be returning the wrong answer
I have never had much luck with that working all the time.
I have just tried it in the past, and it didn't work 100% of the time.
i was hoping by using bounding box, it would be slightly more reliable.
unless you can be more specific, I can only tell you I've been using isonroad, nearroads and roadat for years
and they are reliable
hmm, just tested roadAt, and seems to be working fine now, thanks π
roadat player and roadat vehicle player are sometimes tricky
but roadat position player and roadat position vehicle player are better practive, ive found
yeah, im just checking all corners of an objects bounding box,
yes, i do that to but only for buildings
if Im sensing roads, then isonroad is the way
also, this might be of interest, it's quite new
returns the width, and start and end points
though, I've not used this yet, as I say, it's new
I think isOnRoad, and roadAt should do from what im needing, tyvm
a small building system.
I've noticed that adding a display event handler and then removing the same handler will not actually reset the index of said it. Using displayRemoveAllEventHandlers works properly and resets it. Anyone know if this is intentional?
the same is true of all eventhandlers
the id serial doesn't decrease when an EH is removed
so I'm going to go out ona limb and say it's intentional
im making a mission where players have to breach buildings and look for intel. simple stuff.
i thought it would be cool if i had objects blocking hidden stuff. so i put bookcases and stuff down to hide a little room and other stuff.
ive been trying to it where the players can "move" the objects to access these hidden locations.
i tried to use Addaction, so the players can look at an object and it would be deleted. but my knowledge on arma script is limited. could anyone help out.
so far ive tried
This addaction ["move", "deleteVehicle _Target];
it says _target is undefined. so i named the objects something in the variable names.
This addaction ["move", "deleteVehicle _hidden_1];
it said that _hidden_1 was undefined.
im stuck at this point. i know next to nothing about code.
I have to say, @wary vine , boundingboxes of roads are huge compared to the actual visible size of the thing
you would probably have to use a global vs local variable for that.
@finite sail boundingbox real seems ok on all the objects I have tried for it.
ah right, not used real
gives you slight padding around the outside, but nothing over the top
global vs local? i know nothing about scripting XD
This addaction ["move", "deleteVehicle _hidden_1];
``` are you using this in an objects init ?
yeah
ok π
_this # 0 within an addaction, is the object the addaction is applied to,
that worked wonders. cheers mate π
Quick poll, who is annoyed by double-click selection behaviour in debug console and such, not selecting what you expect it to select.
Only ending on whitespace instead of ending at quote marks and other punctuation?
how could I get an array of unit's (man) gear including classnames of weapon, magazines etc ? I mean a simple, flat array of gear without duplicates
It's a nasty cludge fix, but if you str an array, it makes it into a string and sort of flattens the array
it squeezes out the nesting, if you like
I mean, we have getUnitLoadout. It contains some internal arrays with magazines details. I was thinking sqf api could have a tool to make one flat array with unique set of gear elements
arrayFlatten script command needed?
ok gimme 5 minutes
π
π
5 minutes was just a saying, I need to finish smth else first. I'll get back to you in maybe 30 minutes
In the contact DLC the aliens bullets have a pretty beautiful animation. How can i script it so that it shoots one from a predetermined position into another position? And can I do that without the contact DLC?
I mean just spawn an alien bullet and make it go somewhere.
I think I found that script: http://killzonekid.com/arma-scripting-tutorials-kk_fnc_arrayflatten-and-kk_fnc_arrayflattenunordered/
anyway, thanks for help π
yeah, thats the one. I knew it was around somewhere
it uses typeName
oof
and private array
for the sake of performance please don't do that first one oof
the unordered one uses isEqualType atleast, but it uses the bad for loop, which it probably needs tho
What's wrong with using private array?
private ["_var1"];
_var1 = 33;
```is performance and readability wise worse than```sqf
private _var1 = 33;
private array wastes performance.
while private keyword gains performance
What about declaring multiple values? Is there a break even point?
isnt the private = value quite new? I think kzks script predates it
Arma 2 had it. it was called local _var = value back then
ah right
I guess what I'm asking is, is there ever a good time /place to use the private ["_var"] format
no
only once if you want to make sure the variable is in the upper scope, that's the only only only case really
when you want to private to a specific scope that's above when you set the variable for the first time, and you don't want to specify a default value like 0
lol, i tested it in the debug performance thingy, expected it to end the universe
not sure the results are reliable, f course
30 elements private array 0,00004
30 individual private variabel= value 0.00003
yes
it's moar betterest
you are not testing properly
your first test needs to be both combined
because you first private array the variable, and THEN you also set it
yes, id did that too
was even slower
but not 30 elements. took too long to type π
also you can't measure the performance speedup of private'ing variables in the first place, like this. Because that's only visible when you have deeper scopes
i realise it wasa flawed test, im surprised debug even allows private
Is there a way to get the vehicle radar targets? like in a array?
On the question of the use of the private declaration I'm asking purely in terms of performance. For example declaring 10 local variables in one statement rather than 10 lines, and no values for them ("predeclaring" I guess you'd say)
no, array overhead is too big

Woo
to be fair, I think private ["_var", "_var2"] has a place - for when you need to have the variable there for future tests, ie., running isNil "_var" will break if you haven't declared it locally. Unless you tell me that private _var = nil; is faster? Personally I'd think that
private ["_var1", "_var2", "_var3", ... "_var20"]; is cleaner than
private _var2 = nil;
private _var3 = nil;
...
private _var20 = nil;```
running
isNil "_var"will break
no, that's the point ofisNilactually
I'm sure I've had a problem with not declaring a local variable
isNil "_unknownVar" // true
```you may mix it up with `isNull`
Ah yes, that's it
Or when you know you're going to populate it with an object later from a command like nearestObjects and it returns zip
check if isEqualTo [] then yes
anyone?
https://community.bistudio.com/wiki/Category:Command_Group:_Sensors
seems not (besides shared listRemoteTargets)
I was using targets but it returns any targets that the unit knows about, not exactly if he has on the radar.
Like, he can know a target that is far from his radar
then you can filter these out by type and distance, checking the config for radar range
but there seems to be no commands for that
Hello!
Is it possible to get the parent class of an object, like LandVehicle for vehicle ?
just checking, does the radar is interfered by mountains or objects blocking the radar? like in real life? or even just flying low is enough to be out of the radar?
Thank you @winter rose
okey no arrayFlatten before next week oof.. Maybe make a FT ticket about it π
i cant log into ft system, it rejects all my pw
why isnt ft system using same login as bohemia acount... grr
ok, im in
tank yu
tank yu too
@winter rose thanks Lou, but if i make then enemy with addRating, they will still be able to share the same vehicle if they want?
I believe so
ooo
you sure?
when you say 'share the vehicle' do you mean get in the same vehicle as passenger?
becuase you can't get in a vehicle of a unit you aren't friendy with
that's how I understood it as well
even with a shared side?
yeah, if you make him enemy with rating,
he will be side enemy, who is enemy to everyone
wont be able to getin anywhere if you're side enemy
that's how I understood it as well
even with a shared side?
They're not on the same side. Units with a negative rating are renegades
But afaik renegades are enemy to each other too
sideEnemy getFriend sideEnemy
Should be less than 0.6
yes, i think that was what i was trying to say, renegades are enemy even to other renegades
he will be side enemy, who is enemy to everyone
Oh you said that already. My bad
I only read Lou's comment
my apologies, i came in mid convo
Are you mocking me?! :)
no, not at all
my apologies, i came in mid convo
Cuz that's what I should've said!
not now, anyway π
just random info that might be helpful:
you can use these abstract sides to achieve Ai behavior. like sideFriendly if you want a helicopter to not be attacked by anyone.
i think ambientFlyby uses sideCaptive or sth related to have everyone ignore the planes
Or they're just civilian pilots
no, i know for a fact that they give them some kind of captive trait to achieve that they are ignored for sure
you cannot create groups other than west/blufor, east/opfor, resistance/independent, civilian, sideLogic
How does one become sideFriendly anyway?!
config, I suppose
no, i know for a fact that they give them some kind of captive trait to achieve that they are ignored for sure
captives are civilians too
setCaptive True
just one thing., may or may not be relevent.. units that are setcaptive true, are still scored according to their config side
so, i a blufor unit kills an opfor unit who is setcaptive true, he gets points as if he killed opfor, not civ
you mean they are counted as a kill?
lol proof that arma encourages warcrimes
well, yes... i use it for my roadblock secondary ission.. i take opfor, dress them in civ clothes and setcaptive them
so they can drive to my roadblock without players yelling ENEMY MAN FRONT
players have to search their car (look in the inventory), the opfor in disguise guys have ied in the car inventory
and players can kill them even though they are setcaptive true and get points as if they killed ofpor
setCaptive True
@finite sail
setCaptive true = set side civilian
not for scoring, they arent
for score, the captive unit is treated as if it were its original side
Because its group side doesn't change
probably, but players in lower difficulty modes dont see them (and shout onthe radio) as enemy, they do see them as civs
Hi all, I'm pretty new to the Discord thing, and I have a question about a script I'm using/customizing...here it is;
EDIT: it's kinda long...is there a way to get a "spoiler" windows or some thing so is not clogging-up the chat with a wall of code?
no, but youcan just post on sqfbin.com and post link here
you can disable the voices announcing what they see.
very helpful for prisoners to stop being annoying
OK...done...now the question:
the code block between line 93 trought 114 is the one involved;
what I want to achieve is this: once you designate the target with the laser, the drone will fire at it. I want an addAction that will prompt the player to "confirm" the target, and IF the target is confirmed the drone fire the missile. I tried multiple things,like:
uav1 setVariable ["_confirm",false ];
uav1 setCombatMode "BLUE";
CONFIRM = player addAction ["<t size='1.5' shadow='2' color='#00cc00'>CONFIRM TARGET</t>", {uav1 setVariable ["_confirm",true ],hint "TARGET CONFIRMED..GOING HOT!";true, true, "", ""}];
if (_confirm == "true") then {player removeAction CONFIRM; uav1 setCombatMode "YELLOW";};
sleep 1;
uav1 fireAtTarget [laserTarget player,"PylonMissile_1Rnd_LG_scalpel"];
but I can't get it to work.
The drone fire no matter what..I want it to wait for target confirmation and THEN fire
plenty of sintax error as well
I try with
or:
if (_drone getVariable "Mode" == "DESIGNATE") then
{
if (_info == "true") then {hint "SEND TARGET...";};
sleep 2;
if (_info == "true") then {hint "KEEP LASER ON TARGET...";};
sleep 3;
targetsarray = _drone targets [true, 3000];
index = targetsarray findIf {TypeOf _x =="lasertargetW"};
if (index>=0) then
{
myNearestEnemy = targetsarray select index;
_drone lockCameraTo [myNearestEnemy, [0]];
_drone doTarget myNearestEnemy;
_drone doWatch myNearestEnemy;
if (_info == "true") then {hint parseText format ["<t> the target is a %1<br/>at grid pos %2...GOING HOT... </t>",getText (configFile /"cfgVehicles" / typeOf cursorObject / "displayName"),mapGridPosition cursorObject];};
sleep 1;
_drone setCombatMode "BLUE";
_MYid = player addAction ["<t size='1.5' shadow='2' color='#00cc00'>CONFIRM TARGET</t>", {uav1 fireAtTarget [myNearestEnemy,"PylonMissile_1Rnd_LG_scalpel"], [], 4, true, true, "", ""}];
player removeAction _MYid;
_drone setCombatMode "YELLOW";
sleep 2;
if (_info == "true") then {hint "MISSILE FIRED!";};
sleep 6;
};
};
no joy
if (_confirm == "true") = if (_confirm). no need for == true
yes you need it
fix syntax first
because its a string, not a bool
aaah yeah okay
which is nonsense too and should also be changed..
if you just run fireAtTarget in debug console to test, does that als onot work just by itself?
furthermore, the addAction doesn't go away
the addAction code is not in your sqfbin
you are deleting the action IMMEDIATELY after adding it?
the fireAtTarget work well..the script is working just fine in hes "original" state..
that doesn#t sound intended, the action would never show up
I just want to add theat "function"
ah I see
your addAction is a syntax error
your code is weird and you are missing parameters
player addAction ["<t size='1.5' shadow='2' color='#00cc00'>CONFIRM TARGET</t>", {
uav1 fireAtTarget [myNearestEnemy,"PylonMissile_1Rnd_LG_scalpel"];
player removeAction (_this select 2);
}, [], 4, true, true, "", ""];
the script "dronesupport.sqf" is fired by a radio trigger with :
test=[uav1,60,"missiles_SCALPEL","false"] execVM "dronesupport.sqf";
when the trigger fire, you get the "main" addAction, which will prompt you for the different "modes" of the drone: standby,manual fire,auto
Fire the missile from inside the addactions code statement.
Your code tries to fire once the var is true but only checks the var once
If you choose manual fire, you lase the target, then once acquired the "laserTarget player" drone fire
I try that..no joy
_MYid = player addAction ["<t size='1.5' shadow='2' color='#00cc00'>CONFIRM TARGET</t>", {uav1 fireAtTarget [myNearestEnemy,"PylonMissile_1Rnd_LG_scalpel"], [], 4, true, true, "", ""}];
Action shows up and is usable?
yap
Mynearestenemy is not defined i guess
but the drone fire anyway
Wait whats the problem with the last codebit?
he's not waiting for ""confirm
Set it to holdfire
Hm you can disable AI features but that might impact the fire at command too
Read up on disableAi
I think it has a autotarget feature
I put this BEFORE the addAction,
drone setCombatMode "BLUE";
and this after the addAction
drone setCombatMode "RED";
Yeah get rid of the red part
I did disable every possible thing..that damn drone is furious..hahah
Your code does not stop at the addaction. It instantly runs on and execute set"red"
How do I stop the code at the addaction?
@serene quiver use if exitwith {};
https://community.bistudio.com/wiki/exitWith
right..will the script "restart" after the addAction has been executed? Sorry for the noob questions
@serene quiver do you know how if statemens work?
yes
so then if the conditions are right it will not exit.
its action you can call as many times as you like by selecting it
thank you..I'll give it a try
I need help with comparing variables that may or may not contain a group at all times.
What is the proper value to compare against a group instead of objNull?
the following returns this error 'Error Generic error in expression'
private _group1 = objNull;
private _group2 = group player;
if (_group1 == _group2) then
{
//do stuff.
};
nvm im a tart. grpNull
No stop
You dont want to exit, you want to wait until the action was called.
Use waitUntil{your condition here};
right....will dig in..thanks..
You can also write to yiur .rpt logfile with diag_log
But uh im a big noob on debugging. Dont listen to me
im a big noob on everything scripts lol
from what I can tell, either my init.sqf isnt running or my systemchat messages are wrong
systemChat "init start"
//[] execVM "scripts\jammerDef.sqf";
systemChat "init done";
missing semicolon at your first systemchat
also i dont know how early this runs
you might miss the chat if it runs too early and you are not ingame yet etc
will there be hell to pay if I put a waituntil in here?
does that only suspend the rest of that specific script or does it suspend the whole queue
i dont think you can wait in init.sqf as its unscheduled
might be wrong
use diag_log instead
Yeah or use
[] spawn {
//runs parallel scheduled code
Sleep 10;
Hint "hello world";
};
id recommend you use diag_log, spawning a thread waiting 10s is janky
But it allows to run suspended code from editor init fields without scriptfiles ;)
oh I will need script files