#arma3_scripting
1 messages · Page 131 of 1
@haughty sand
how much are you willing to put in to this? if you want to get into scripting, then it would be worth reading the basics that apply to most coding things in general. things like variables, types, functions/methods, arguments, parameters. stuff like that. You will end up seeing it all in SQF at some point.
The basics for SQF are here:
#arma3_scripting message
or if you don't want to, simply just ask someone to write it for you.
ima be honest i just wanted help doing a few things to my server. my friends already did most of the coding for me i just wanted to take off the clothing restriciton he put on the server, run speed, vehcihle speed, collision damage on vehichle, collision damage on player in vehcile and thats about it
other than that hes made everything else for me like respawns, infinite amo and more i cant think of
if your not willing to help me i understand but if you are on the condition i learn how to do it myself i can
im in the voice channel if anyone is free to talk
the difficult part is we can write stuff for you, but if you don't know how to implement it, you are still stuck.
we have the scrip files saved
we can just put them in
the guys alr did most of the hard part. just wanted to add my one scripts in
your friends don't want to teach you?
i don't even know what to say... but it is 12 am now so i'm going to bed...
params ["_terminal", "_range"];
{if ((typeOf _x == "LOP_ISTS_OPF_Infantry_Engineer") && (!isPlayer _x) && ((_terminal distance2D _x) < _range)) then {deleteVehicle _x}} forEach allUnits;
{if ((_terminal distance2D _x) > _range) then {deleteVehicle _x}} forEach allDeadMen;
What here is making _range not seen as a number?
if the _range is not set then it would return as nil
this addAction ["Delete targets", "scripts\targets\deleteTargets.sqf", [this, 75]];
this is how it's called
If anything it'd get this: [target, caller, actionId, [this, 75]]
Read the documentation for the script & arguments params in addAction.
If you change the first line to this then it might work:
(_this select 3) params ["_terminal", "_range"];
guys what is a proper event handler to reduce damage to all parts of body by half? i had a few examples before,all lost now and unsure if code changed
just wanna reduce damage to NATO units for a scenario
but not player or player squad
This works great! I forgot that addAction sent paramaters to scripts to begin with
Hello,
is there a way to check if the player owns the dlc? because e.g. contact UGVs are visible but you cannot use them. so I want to add events but only if you own / it is possible to use ugv.
Awesome, thanks. 👍
Hello, I'm trying to make a script where a civilian pulls a gun and becomes opfor when a blufor unit is close by. My problem is the unit doesn't start blasting the blufor point blank, but just stares at them. It only starts firing if the blufor unit is 10m or so away minimum. Anyone know why this is happening and how to work around it?
Set knowsAbout to 4 using reveal command
tested it now, but the AI still won't shoot if the target is closer than 6 meters
Is there a way to change the conditions required for the manual respawn button to function?
Say I want the player to spend at least 10s in the ground before being able to use the respawn button (or any other condition)
So far ive been looking into just flat-out disabling it from the editor and re-adding it myself with my own custom logic
but i have a feeling that there's probably a better way
I think AI doesn't engage with pistols from under 5m. Is it possible that this is a base game issue? I found this https://forums.bohemia.net/forums/topic/229599-ai-with-pistol-do-not-engage-if-within-5-meters-or-less/
Added: setVariable extended with support for addressing specific targets
Anyone got an example ?
i expect it to work like remoteExec
in careless mode,using cba patrol,my guy took out a pistol and shot a truck drive 3 meters away. weird all round
ai moment
Handle damage handler and you add it to all the units of a side
Anyone know what determines the order in which the init of CBA XEH preInits are called?
attempting to swap in my function into ace_field_rations_fnc_handleEffects as I don't want to have to branch off of ace
@hollow thistle
Update, I figured out how to get my init line to become the one seen in config viewer for ace_field_rations but it seems the ace functions are still becoming stored in the ace_field_rations_fnc_handleEffects name space variable. Is ace recompiling and overriding after mission load?
When coding, when is } and { used and how is it used?
config order
so might depend on loadorder
{ } are delimiters for a Code data type - a piece of code which is not necessarily immediately parsed and executed, but is preserved as-written so it can be passed to commands as a variable. Kind of like a String, but containing code rather than plain text.
Example:
private _myCode = { systemChat typeOf _x };
_myCode forEach [object1, object2];```
Note that Config files do not use SQF, so {} have a different behaviour there. In Config, they are class delimiters.
_bk = createvehicle ["land_gm_sandbags_02_bunker_high", position player];
How do I name the bunker so I can get to it with oither scripts?
Use a global scope variable rather than a local scope variable. (Remove the leading _ and give it a more unique name to prevent conflicts with other global variables)
https://community.bistudio.com/wiki/Variables#Scopes
Alternatively, if you're starting those other scripts from this script, you can keep it as a local variable and pass it as an argument to those scripts. e.g.
[_bk] call mrb_fnc_otherScript;
// ... fn_otherScript.sqf
params ["_bunker"];```
not what i asked. you didnt answer anything here. seriously?
I changed preInit but not preStart, that was my problem
you asked what event handler you should use. Hypoxic told you it's the HandleDamage EH. If you want different answer then write a different question. If you just want someone to write the script because you don't care enough to write it yourself, just state it.
im trying to get the support module script to work. https://community.bistudio.com/wiki/BIS_fnc_transportService. Ive tried both [player, "B_Heli_Transport_03_F"] call BIS_fnc_transportService and [player, heli1] call BIS_fnc_transportService and neither worked. Help.
did you try [player, heli1]?
first and second parameter need objects so why write them in different way?
forgive me, yes
says mp/frame work is missing
im trying to essentially mimic the support heli service script.
Was hoping to just use the vanilla one, but as a executed script.
or something similar.
it mighht be possible that it needs specific environment to work, also fact that it doesn't have a proper documentation but only some exported data means a lot
@deft zealot i was just wondering if i could use it in a mission
can someone please tell me why my code dosent work?
it creates the names and images for every player but it does not update the image when the player status changes
https://pastebin.com/5W09xf0p
calling it like this:
_players = playableUnits select {!(_x getVariable ["hideseek_isSeeker", true])};
[_players] remoteExec ["PARADOX_fnc_statusBar", 0];
I want to move a H-Barrier with setVelocity, but it doesn't seem to react, class is Land_HBarrier_1_F, any ideas why that is?
Because it's not a physx object
"highlight *this* and *that* word" regexReplace ["\*(.*)\*", "<t color='#ff0000'>$1</t>"]
```=>`"highlight <t color='#ff0000'>this* and *that</t> word"`
There doesn't seems to be ungreedy flag in https://community.bistudio.com/wiki/Arma_3:_Regular_Expressions
I guess my only option is to change the expression?
hmm, ok, is there any object that does not float but is rigid in the sea and can be moved with setVelocity?
@drowsy geyser Pretty sure there isn't supposed to be true on the end of this line:
_x setVariable ["para_statusBar", _para_statusBar, true];
This variable is only valid locally.
appreciated thank you
I can't believe it, that was the whole problem why it didn't work, thank you a million times!
There's a second one in there too but it's non-critical.
Yes, I saw it, I stuck with this code for three days, I thought this variable must be broadcasted global🤝
is there a way to totally disable AI slow walking when legs are hurt? it breaks scenarios when i need reaction groups to continue fighting as if SL is injured,whole group moves at snails pace
either a solution to this or a mod (not auto medic its buggy) that makes AI 100% heal themselves?
you should be able to fix the legs: _man setHitPointDamage ["hitLegs", 0];
with getpos/setpos
as i read it i understand that this will just remove damage taken to legs right?
im trying to prevent slow walking,not heal body parts or prevent damage to a body part
but if it prevents damage there entirely it may do
just prevent too much damage to the legs using handle damage:
this addEventHandler ["HandleDamage", {
params ["_unit", "", "_damage", "", "", "_hitIndex", "", "_hitPoint"];
if (_hitPoint == "hitlegs" && {_damage + (_unit getHitIndex _hitIndex) > 0.5}) then {0} else {_damage};
}];
the actual value for leg damage that causes walking was defined in config iirc
I just used 0.5 here
configFile >> "CfgFirstAid" >> "LegsHitLimit1Threshold" it is 0.5 yeah
This is a very useful pointer.
Is there a way to force limping manually (without hurting the legs) without having to intercept the inputs in order to do specific animations?
thanks leopard. i tried to adapt the code to what i already have(removeing legs entry ) but i must be writing it wrong. can you help me understand how i can combine both these event handlers?
this addeventhandler ["HandleDamage", {
_unit = _this select 0;
_selection = _this select 1;
_passedDamage = _this select 2;
_source = _this select 3;
_projectile = _this select 4;
_oldDamage = 0;
_damageMultiplier = 0.5;
switch(_selection)do{
case("head") :{_oldDamage = _unit getHitPointDamage "HitHead";};
case("body") :{_oldDamage = _unit getHitPointDamage "HitBody";};
case("hands") :{_oldDamage = _unit getHitPointDamage "HitHands";};
case("legs") :{_oldDamage = _unit getHitPointDamage "HitLegs";};
case("") :{_oldDamage = damage _unit;};
default{};
};
_return = _oldDamage + ((_passedDamage - _oldDamage) *_damageMultiplier);
_return
}];
and the one you gave me
are you use this code is correct? afaik we don't have a "legs" selection
we have selections for each leg
actually nvm, in hitpoints LOD there's also legs
this addEventHandler ["HandleDamage", {
_unit = _this select 0;
_selection = _this select 1;
_passedDamage = _this select 2;
_source = _this select 3;
_projectile = _this select 4;
_oldDamage = 0;
_damageMultiplier = 0.5;
switch(_selection) do {
case("head") :{_oldDamage = _unit getHitPointDamage "HitHead";};
case("body") :{_oldDamage = _unit getHitPointDamage "HitBody";};
case("hands") :{_oldDamage = _unit getHitPointDamage "HitHands";};
case("legs") :{_oldDamage = _unit getHitPointDamage "HitLegs";};
case("") :{_oldDamage = damage _unit;};
default{};
};
_return = _oldDamage + ((_passedDamage - _oldDamage) *_damageMultiplier);
if (_selection == "legs" && _return > 0.5) then {_return = 0.5};
_return
}];
anyone has a decent helicopter script so only pilots can fly it and with the switch seat bypass?
https://forums.bohemia.net/forums/topic/202978-only-pilots-fly/
In here you have EH GetIn and Swiched seats you can utilizes for only piltos can fly
Greets guys (and girls if there are any) ! I need a script bu which only pilots can use choppers and planes. Can anyone explain how to do that? Thanks
What am I doing wrong here? I want to lower the terrain's elevation in this case
[[3011.3 one [ too many
Wdym?
remove one [
What do you mean by that. What to remove?
Oh
Nvm
Thanks
How would I make the function stay so that the executed code shows up during the game? When I run the scenario, the edited terrain stuff just disappears
just run it again
The debug console isn't the way to run things that you want to actually bake into the mission. Its name is accurate: it's for debugging and testing.
setTerrainHeight requires server execution, so you should put it in initServer.sqf in the mission folder.
Okay, thanks
Thank you!
Probably something trivial I just can´t see but:
if (!_delete) then {
exitWith {_trg;};
} else {
waitUntil {triggerActivated _trg};
sleep 1;
deleteVehicle _trg;
};
can someone please tell me why and how it throws this:
if (!_delete) then {
exitWith |#|{_trg;};
} else {
waitUntil {triggerActivated _trg};
sleep 1;
deleteVehicle _trg;
};
|#| "Missing ´;´"
exitWith can't be used on its own like that. It's used as part of a specific structure:
if (_condition) exitWith { };```
Your code should look like this (the else is unnecessary since, well, it'll exit if the condition is met anyway)
if (!_delete) exitWith {_trg};
waitUntil {triggerActivated _trg};
sleep 1;
deleteVehicle _trg;```
So i´d have to rewrite it to something like:
if (!_delete) exitWith {_trg;};
But then i struggle to implement the other half.
if (!_delete) exitWith {_trg;};
waitUntil {triggerActivated _trg};
You typed that faster than me
thx btw
did not know i could not use exitWith that way
Hi everyone. can a praetorian intercept a missile ? Can it be modified in order to do it ?
Actually, i'm trying to integrate HAFM Ships to my new framework but i want to modify the ships so the cruise missiles can be intercepte by praetorian, rim systems and cheetahs
By default not. And Yes.
https://forums.bohemia.net/forums/topic/167999-c-ram-counter-rocket-artillery-and-mortar/
Counter Rocket, Artillery, and MortarThese are static weapons that can be manned by either AI or by Player users to destroy incoming rounds.As of right now this is still a WIP... this is an alpha release so that the community can help give some input on this extremely long process of getting clos...
Hmmm so it is possible. thank you very much 🙂
I have a question is it possible to change displayName of a object mid game ?
the displayName property is stored in the config so it cannot be modified once the game is started
how do i use a trigger for a modded gate to auto open and close
has anyone else run into issues with ADT complaining allMapMarkers gives NOTHING?
in true kjw fashion the answer came right after i asked; i have to bracket allMapMarkers select {(markerChannel _x) isEqualTo currentChannel}; to use in a foreach
Check example number 2 on this page: https://community.bistudio.com/wiki/createTrigger
params [
["_mapPos", [0,0,0], [objNull, []], [2,3]],
["_size", [50,50], [objNull, []], [2]],
["_side", "GUER", ["GUER", "EAST", "WEST", "CIV"], []],
["_target", objNull, [objNull, grpNull, "unit", []], []],
["_code", scriptNull, [scriptNull, {}], []],
["_delete", true, [true, false], []]
];
if (!isServer) exitWith{};
/*
fnc_callerInside = {
_target in thisList;
};
*/
_trg = createTrigger ["EmptyDetector", _mapPos, false];
_trg setTriggerArea [_size select 0, _size select 1, 0, false, 1000];
_trg setTriggerActivation [_side, "PRESENT", false];
_trg setTriggerStatements ["_target in thisList", "_code", ""];
//_trg setTriggerStatements ["call fnc_callerInside", "_code", ""];
if (!_delete) exitWith {_trg;};
waitUntil {triggerActivated _trg};
sleep 1;
deleteVehicle _trg;
Calling it like:
_trgDrop = [
_dropPos,
[50,50],
"GUER",
_Crew,
{hint "yeet";_Syktrain move [0,1000,300];},
true
]call ada_fnc_Trigger;
Not working, what did I do wrong? Been at this for a long bit and can´t figure where the mistake is. It is not giving errors but also not working
I don't think GUER is a side name. Guerrilla side name is RESISTANCE
https://community.bistudio.com/wiki/setTriggerActivation
"GUER" is under side tho
Indeed, my bad. What error does the script return ?
none, hence my confusion. It just does not work
In setTriggerStatements, _target is a local variable to the function you're calling (ada_fnc_Trigger). So when you set condition to _target in thisList, your trigger's condition statement is failing every time because _target is not defined.
but shouldn´t in be = _crew
because i give _crew as a parameter calling the trigger function?
Passing _crew to the function means the function knows about it (by the name _target because that's what you call it in params). But the trigger statements and stuff are a separate scope. When they happen, they're completely detached from the function.
I see, how do I get them to be the correct scope? So my trigger actually knows what it must do
You can't. They'll always be a separate scope, it's just how they work.
What you need to do is make the variables available in that scope. You can't pass arguments directly like you would for a function, but you can make a global variable and reference that. Or, you could use setVariable to store the variables in the trigger object's namespace (or any other namespace that suits you), and getVariable to retrieve them in the statements.
In addition, your activation string would not copy your _code variable, it would just try to execute an undefined variable _code on activation
You should be able to fix that by using str _code instead of "_code"...I think
Or replacing the {} on the argument passed with quotes and replacing "_code" with _code in setTriggerStatements
Damn making triggers in a Script is more complicated than I anticipated. Thank you for your help guys!
Also, you can't use waitUntil in an unscheduled script (one you call), and it becomes more difficult to return a value from a scheduled script (one you spawn, but waitUntil works with)
Do you need the returned trigger for anything?
What are you using the returned trigger for?
I just would like to have the trigger returned
Your params expected data types are a bit weird, btw.
The third argument in a param is an array of expected data types. It's not an array of possible values. So, when you set the array of expected data types for _side to ["GUER","EAST","WEST","CIV"], it's not saying "it can be one of these exact values", it's just saying "the data can be of type String" four times. Not broken but probably won't do exactly what you were expecting. Same for [true, false], that's just Boolean twice.
You also have the default value for _code as scriptNull. The Script data type is different from the Code data type. The Script data type refers to a currently running script thread. It's not what you're working with here. Just use {}, or "" if you decide to change _code to being a String all the way through.
Also also, you have Group and String in the list of accepted data types for _target. The code needed to actually work with those types is different to working with Objects, so accepting them is a bit useless.
Many things to learn I have. Thx alot!
thanks mate this worked a treat, no more limping even when legs suffered over 97% damage
by the way, iv been away for a while,has setgroup icons become broken?
setGroupIconsVisible [true, false];
in high command,this should prevent 3D markers from displaying but i cannot seem to have it disable the 3D markers whatsoever
according to biki that's not what it does
it hides the icons you add with addGroupIcon
any one got experience with setLightIR command, and it be used to change existing lamps/lights to ir only in a mission?
It only works on light objects.
Most objects like streetlights and cars and stuff have integrated lights, not seperate objects. You cannot access these integrated lights
sometimes you could turn the light off somehow, and spawn your own light object
thanks, thats what i was afraid of, but oh well
Why does this not work as a condition in a trigger?
east knowsAbout player
knowsAbout returns number, not boolean
east knowsAbout player > 1 or maybe > 0 ?
sir...
if you feel like it needs something else, what would you want to put on the page?
another example maybe?
Hello everyone
I'm trying to run a script that would enable & disable a light cone periodically
this spawn {
while {true} do {
_this enableSimulationGlobal false
;sleep 2;
_this enableSimulationGlobal true};
;sleep 2;
};
What i'm currently thinking is that this script should make a loop, disabling and enabling simulation every 2s, for some reason, it just stops at disabling simulation.
Any ideas ?
Thanks in advance
create and destroy the object instead
I've thought about this, looping it to add & remove, how would you make it in a loop, though ?
I think i've even upgraded the script I shared, because now it does the sequence "False, wait 2, true, wait 2", but it doesn't repeat it, it just stays on true and keeps it lit
I don't really know how to tell it to go back to the start and repeat indefinitely
this spawn { while {true} do { _this enableSimulationGlobal false; sleep 2; _this enableSimulationGlobal true; sleep 2;} };
Here's what I got so far
i'll show you in a sec
Thx !
have to test it real quick before i post it
Sure, take your time, tysm for helping
ok my solution didn't work. the more you create and delete, the dimmer it gets until its nothing
use a lightpoint instead
What's that ?
enableSimulation isn't right for what you're trying to do, overall. That would just freeze it in place, not turn it off and on, even if you got it fully working. Did you try hideObjectGlobal instead?
its worth trying. but light cones (the object) are weird
It seems to send light in every direction, i'm trying to create some sort of light projector for a nightclub (I know, it's silly)
you can create cones with it
that actually gives me an idea to add a flashing parameter to my modules enhanced lightpoint module
I'll give it a shot
this spawn {
while {true} do {
_this hideObjectGlobal false;
sleep 2;
_this hideObjectGlobal true;
sleep 2;}
};
That worked, it loops
put a isServer filter in that. no need to spawn a loop for every machine every time a client joins
if (isServer) then {
// stuff
};
In the init of the object, right ?
yeah
Alr, i'll give it a try, thanks !
Im trying to modify a CBA task patrol wp. simply trying to change move(wp type) to SEEK AND DESTROY. But SEEK AND DESTROY isnt registering. just shows up as "waypoint" debugging it
[this, getMarkerPos "mark1" ,250, 6, "SEEK AND DESTROY", "AWARE", "YELLOW", "NORMAL", "DIAMOND","", [3, 6, 9]] call CBA_fnc_taskPatrol;
Iv tried SEEK & DESTROY/ SEEK&DESTROY/ SEEK AND DESTROY AND SEEKANDDESTROY
"SAD"
your engine waypoints are here: https://community.bistudio.com/wiki/setWaypointType
Awesome. it works. never saw this biki page before thanks
quick question
upon activating SAD WP in this instance,is there a way to change behaviour to COMBAT?
then back to aware when they complete
you're getting into the scope of creating your own taskPatrol instead of using CBAs. That cba function has no return nor events or anything to work off of
everything that it uses to do its work, is also available to you via engine commands
but, technically speaking, on aware, they should go into combat when engaged, and move to aware when they feel safe after some time
yeah i notced that CBA tasks where a take from BIS ones just more modable. CBA task search nearby and searcharea are very interesting,allowing AI to search in buildings,before moving on. problem is AI pathing in 90% of buildings causes them to get stuck and WPs to never complete. did BIS have a similar function to searching houses via wp's?
yeah yeah it will be the case most times i know,just tryna polish things as best as can
the cba search function does exactly how anyone probably would have done it. its just finding the building positions and tasking a unit with a command move. the AI pathing wouldn't be really anything different if BIS made it
you could probably write your own detection to find if they are stuck, then unstick them
but thats just a combination of pathing, building models, etc. gotta accept arma for what arma is lol
that is advanced for me... infact my aim here is to use high command, then whenever i want, call a radio trigger,giving certain groups the task patrols/defend etc in current zone(mark1 marker) allowing those groups to move around in the AO randomly/freely until i reasign a manual High command wp
yeah iv long accepted arma and all her flaws. she makes up for it in many ways
Weird thing i never understood about CBA WP's is that why when i create a random patrol,or sync a patrol module to multiple groups(even a individual module for each group) does CBA generate the exact same coordinates for all wp's just around 50 meters apart for groups?
if i use bis patrol on a few groups , for example, their wp's are always random and not alike at all. though i dont use it because with bis patrol im unable to keep units wp's within a zone,cba does that for me
use LAMBS if you want better waypoint stuff.
does anyone know how to exclude player from the _x array in foreach units player?
am looking for a way to only activate the script for the Ai in player's group
forEach (units player - [player]);
For multiplayer, where some of the other units could also be players,
forEach (units player select {!isPlayer _x});
iv used lambs alot in the past,its more trouble than its worth right now(stable branch anyway) and besides that its crashing my game randomly. i dont think by itself its crashing but it clearly isnt mixing well with sth else,anyway im trying to learn vanilla functions /cba and keep things performance friendly
testing with BIS patrol right now, what a joke, CBA is really needed
theres really no inbuilt,non CBA way to create a patrol where a group will stay within a zone/marker in vanilla game??
You have to use it when the command mode is switched, like this:
addMissionEventHandler ["CommandModeChanged", {
params ["_isHighCommand", "_isForced"];
if (_isHighCommand) then { setGroupIconsVisible [true, false] };
}];
Otherwise it resets when you change mode.
High command does use addGroupIcon internally.
I'm just blind or is there no Eventhandler for UAV Connect/Disconnect?
Mhh better than nothing but one for the actual connect would have been nice ^^
There's also nothing direct for selectPlayer.
Mhh maybe the VehicleAdded group eventhandler gets trigger on connection🤔
that makes sense
yeah thats perfect thank u
the Add score/rating module. i understand it to a degree, if i were to sync it to a task complete state and in its init wrote 100 (for score) the task being completed would give me that score.. However what id like to do(not sure if its possible) is to remove a score or give minus if any friendly unit dies... so im thinking,sync to trigger with a condition that side west killed and on repeatable
sounds messy i know but is it possible?
i'd use an EntityKilled mission event handler with filters to remove instead of a trigger that is constantly evaluating
hmmm the tooltip in the editor for score, says both "must be positive" and "only works in mp".
two things which i dont want
perhaps its only rating that goes negative
sorry for all the questions...what is scalar meaning?
A normal number
You will find "only works in MP" on anything related to the built-in score system, because that system only works in MP. If you want scoring for SP, you'll need to make your own.
in cba patrol "waypoint count" has written "Waypoint Count (Scalar)" i was hoping i could make wp count into an array and have random wp's created
gotchya
private _waypointCount = floor (random [3,5,10]);
private _waypointCount = selectRandom [3,4,5,6,7];```
cheers
one last thing,iv been trying to figure how to do this now and best i came up with was a duck tape and broken nails approach. im trying to add rating to player for every individual blufor unit that enters a trigger area. Basically any man who survives grants the player 50 rating. so far i synced the rating module with 50 points to player and a trigger that has a width of 0.5 and repeatable,blufor present... however the trigger interval isnt registering individual guys crossing so well as they often move through the trigger at same time,registering just one activiation hence 50 points instead of 100
any good ideas to improve this method or a better not complicated solution?
The simplest solution would probably be to have them all go to a holding area and just count them at the end, but that might not work for your mission design
holding area is fine, how to count them?
basically the player has high command and should be rewarded for keeping units alive
end of mission RTB safe area
Let's say the trigger is set to BLUFOR Present and ignore the actual activation condition for now.
On activation:
{ player addRating 50 } forEach (thisList - [player]);```
Or if you do want to count them so you can display the number or whatever:
```sqf
private _bluforHere = count (thisList - [player]);
player addRating (50 * _bluforHere);```
The trigger's condition settings being BLUFOR Present is important because that's what makes thisList contain only BLUFOR units. However, you probably don't want the trigger to actually activate immediately when any BLUFOR are present, so that's where the activation condition code field comes in. In this field, this contains a boolean (true/false) value indicating whether the conditions set in the dropdowns have been met. You don't actually have to use this in the condition code, and you can also combine it with other things. For example:
this && (player in thisList); // when any BLUFOR are present and the player is one of them
player in thisList; // when the player is BLUFOR and here
triggerActivated some_other_trigger; // when another trigger is activated
this && {missionNamespace getVariable ["my_var_name",false]}; // when the conditions are met and a global variable is set to true```
thats magic
put a trigger delay on the first syntax to give units time to enter and get the count
worked great
thanks so much
foreach counts vehicles as one or as individual crew members?
there is a way to execute code when ppl change slots? i mean
player select an playable unit >> enters the mission >> init, initplayer, etc >> ingame >> abort >> select new playable slot >> coninue >>i want to execute it here
i mean, i want to "re exeute" initplayerlocal
I think one of the player connection mission EHs can do that
forEach iterates on every element in the array provided to it. Whether that array counts vehicles as one or as crew is up to the trigger itself, and the answer to that is: I don't know for sure, but it's easy to test.
{
systemChat typeOf _x;
} forEach thisList;```
This will reveal the classnames of everything the trigger is detecting. I'm sure you can figure out the unit/vehicle/unit-in-vehicle maths.
yep, thank you
Is there a way to find out the names of default actions? For example I'm trying to find the vanilla class cfgaction scroll actions for drones, is there some means with scripts to find that out without hunting through configs?
Wow, just saw Intercept, it looks very interesting. Very nice work, looking forward to it. While I'd obviously prefer something like a BIS-provided API in LUA that exposes the engine's underlying structure, this sort of "fan-made-bodge" is already a great step towards being able to use real programming skills in Arma :)
how do I get the weight of a inventory item like a magazine?
I want to know how much a list of items weight before adding to a player backpack
There's no specific command for it, but it's listed in the config so you can retrieve it from there with getNumber
I also find this usefull
loadAbs (backpackContainer cursorObject)
With that I can calculate the space on the player backpack if is >= the Cursor object backpack before move all items
I may have trouble with unfished magazines if they also reduce in weight when used
test
_look _mom_ i can do _u_n_dersco_res_
does anyone use createHashMapObject?
On the backpack note. I have this idea of making a backpack a movable spawnpoint. Is there an easy way to make it wearable and not "resetting" it? I.e. if I place and name a backpack in the editor, will it remain the same object when picked up and later dropped off, or will the dropped pack become a new object?
AFAIK they are the same object, I mean literally. If you grab, it remains same, if you drop, same
Ok. Thanks. Haven't had time to test it yet. Will do 🙂
This is because backpacks are actually a vehicle, not an item
Any way to make a bullet "from nowhere" by script?
Or should I just hidemodel on a unit
So, would this work? (I'm currently not at home, so I'm using my phone for brainstorming) Please bear with me 🙂
if (_bp == backpack player) {
removeallactions _bp;
} else {
_bp addaction ["Build spawnpoint","spawnscript.sqf"];
};
With sp = [this] execvm "bpspawn.sqf"; in the backpack init
If you use ace this would be easier with a self interaction that pops up if the backpack is equipped
But I don't have ace. Vanilla is good enough for me atm.
Bullets can be created with createVehicle and adjusted using normal position and direction commands
*Woops I meant to say they are not if they are in a ground object. I stand corrected.
My b, I'm le dumb.
Don't worry, I got a bad cold and a fever, so I'm about as smart and observant as a clam....
They are - the backpack vehicle still exists somewhere for its contents to be stored in. It's just a little complex to access them by script. everyBackpack is one way.
It's easy to confuse when you can get className and object itself in the same time
Good to know
Also technically uniform and vest are, too...
what I'm looking for is to kow if the player has the specifik backpack or nbot on his back, not the contents of it...
so how do I convert a string to boolean in this case? if statements only work with boolean conditions. Or should I maybe use some other way to check wether the player has the bp or if it is on the ground? Any tips is appreciated.
You don't need to convert string to bool. An if statement will work, you just need to check against backpackContainer player rather than backpack player.
ah. ofc
You could simplify this, though, by having the action on the backpack all the time and just giving it a condition. Figuring out when to add/remove it is a bit of a pain.
isNull objectParent _originalTarget as the action condition, for example
im trying to use _player switchCamera "INTERNAL"; to create head camera but for remote players the cam shows third person if the player is in that mode. can I somehow force 1st person mode?
"Error Undefined variable in expression: bis_fnc_param" <- well, that's weird
Hey y'all, i've got a problem with getting the mortars from the Spearhead DLC to fire on a marker position - the gunner seems to turn the mortar in the right direction, however he refuses to actually fire (its in range, i checked). CUP Mortars used to work just fine tho....
params ["_mortar", "_target","_rounds"];
_postarget = getMarkerPos _target;
_trg = createTrigger ["EmptyDetector", _postarget];
_trg setTriggerArea [100, 100, 0, false];
for "_i" from 1 to _rounds do {
_pos = _trg call BIS_fnc_randomPosTrigger;
_mortar doArtilleryFire [_pos, "SPE_8Rnd_81mm_FA_Mle_1932_HE", 1];
_delay = random [2, 3, 5];
sleep _delay;
};
deletevehicle _trg;
Calling it like this in a trigger (trigger fires too, i checked):
[MortarGer01,'TRP_1',8] execVM "MortarFireForEffect.sqf"
Magazines listed in the config are:
magazines[] = {"SPE_8Rnd_81mm_FA_Mle_1932_HE","SPE_8Rnd_81mm_FA_Mle_1932_HE","SPE_8Rnd_81mm_FA_Mle_1932_HE","SPE_8Rnd_81mm_FA_Mle_1932_HE","SPE_8Rnd_81mm_FA_Mle_1932_Smoke","SPE_8Rnd_81mm_FA_Mle_1932_Illu"};
so i think i got it right
It doesnt throw up any errors either :/ Does someone know what might be the issue here?
Works fine.
Is it a German mortar or the US one?
US one uses "SPE_8Rnd_81mmHE_M1_M43A1" as magazine
German one "SPE_8Rnd_81mm_FA_Mle_1932_HE"
The AI group being set to Force Hold Fire might stop it doing fire missions
That trigger is also useless
Just provide an area array to randomPosTrigger
Array - array in format [center, distance] or [center, [a, b, angle, rect]] or [center, [a, b, angle, rect, height]]
it's very fun that BIS_fnc_randomPos can work with triggers and BIS_fnc_randomPosTrigger isn't restricted to triggers
Hi, does anybody know how to force unit out of rested/lowered weapon state when unit has target assigned via doTarget cmd?
Ur not gonna believe this but i set the squad operating the mortar to "Do not fire unless fired upon" accidentally.... set it to "Open fire", works like a charm now - but thank you for helping me, even tho the biggest problem was my lack of braincells.. i removed the trigger, i just opted to instead use the trigger that calls the script as area for BIS_fnc_randomPosTrigger, should work fine too, shouldnt it? (and saves me time placing markers too)
Hello everyone, im playing with setVelocityTransformation and im struggling to get something to stop being controlled by the command.
What I am wanting to do is have a plane following a straight line perfectly, then after it reaches X point in space it resumes normal flight.
Crappy example...
null=[]spawn {
_vectorDir = (getPosASL plane1) vectorFromTo (getPosASL player);
plane1 setVectorDirAndUp [_vectorDir, [-cos (getDir player +90), sin (getDir player + 90), 90]];
plane1 setvelocity [100 * (sin (getdir plane1 )), 100 * (cos (getdir plane1 )), 0];
controlPointASL = plane1 modelToWorldVisual [0,100,0];
sleep 1;
player setpos controlPointASL;
sleep 1;
onEachFrame
{
plane1 setVelocityTransformation
[
getPosASL plane1,
controlPointASL,
velocityModelSpace plane1,
velocityModelSpace plane1,
(getPosASL plane1) vectorFromTo (getPosASL player),
(getPosASL plane1) vectorFromTo (getPosASL player),
vectorUp plane1,
vectorUp plane1,
0
];
};
};
Does anyone have a better idea of how to exit the setVelocityTransformation command? Or maybe I should rethink my approach?
So, this is a dedicated server and the xla_arsenal_3cb.sqf script hasn't been touched since July. Before 1.54: Works. Now: Weird stuff
How can "bis_fnc_param" be undefined? Especially since I tested it afterwards (debug console) and it worked just fine, both on my client as on the server....
Use a stackable EachFrame Mission Event Handler instead of onEachFrame. It's more compatible with other things that need to run every frame, and you can easily save the EH's index and remove it later. https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#EachFrame
functionCompiler running after your code?
also… if it's MP, I wouldn't recommend that EachFrame approach
god knows this patch is "special"
Yeah, but this is getting execVM'ed from inside an editor placed item's init field. That just shouldn't even be possible, right?
The function is recompiled
null=
And remove that please :3
"shouldnt be possible"
You can override functions by default in singleplayer editor i.e they are compile not compilefinal
Its MP yeah. Only reason im doing this is the behavior of AI in SP vs MP on a HC is wildy different for aircraft.
have you tried disabling AI traits with disableAI? the plane would then fly straight, hopefully
@tough abyss As I said, this is showing up only on dedicated. Exact same mission runs fine in editor and listen server
I tried path/move but ill try doing all and see what happens
It prob hasn't got recompiled by the time your code runs
In SP the plane properly dips towards the target and I force it to fire.
In MP the plane dips for a second then continues to fly level, which is why im trying to force it to follow a specific path
Try put waituntil in there & see if it fixes it
you could otherwise use BIS_fnc_unitCapture
If im not mistaken that setpos basically in world coords right? The idea would be for this script to be used modularly in multiple areas on the map
ah, I see then - that indeed won't fit
I think I have a VERY hacky solution. Setting the mass on aircraft reduce its maneuverability, if I set it to 1 its locked into a bearing. New problem is when it shoots, well it goes backward about 2000kmh 😄 So now to make a custom weapon that has 0 recoil.
hi guys im using event handler to replenish mags for infantry after reloading,i cant figure out how to apply this to any launcher ammo such as Gustav,MPRL TITAN ETC
this addEventHandler ["Reloaded",
{
_unit = _this select 0;
_mag = _this select 4 select 0;
_unit addMagazine _mag ;
}];
Do i need to add a line,replace "mag" with somethingg?
ideally(and for storage space) id need an AT unit to have one rocket that was fired,restored upon a reload. so 2 rockets..one fired,one left,reload,one added. something like that but im tripping over myself trying to achieve it
I believe for launchers you have to use the new magazine _this select 3 select 0 because the old magazine is deleted as soon as it's fired
so like this:
{
_unit = _this select 0;
_mag = _this select 4 select 0;
_mag = _this select 3 select 0;
_unit addMagazine _mag ;
}];
That should work, but you don't need to retrieve _this select 4 select 0 just to immediately overwrite it. You can remove that line.
got it let me try
params ["_veh", "_fromASL", "_toASL", "_duration"];
if (isNil "MovingVehicles") then {MovingVehicles = []};
private _velocity = (_toASL vectorDiff _fromASL) vectorMultiply 1/_duration;
private _dir = _fromASL vectorFromTo _toASL;
private _up = vectorNormalized([_dir#1, _dir#0 * -1, 0] vectorCrossProduct _dir);
MovingVehicles pushBack [_veh, _duration, _duration, _fromASL, _toASL, _velocity, _velocity, _dir, _dir, _up, _up];
if (missionNamespace getVariable ["MoveEachFrame", -1] >= 0) exitWith {};
MoveEachFrame = addMissionEventHandler ["EachFrame", {
if (isGamePaused) exitWith {};
_dt = diag_deltaTime * accTime;
{
_x params ["_veh", "_duration", "_remaining"];
_percent = ((1 - _remaining / _duration) max 0) min 1;
_remaining = _remaining - _dt;
_x set [2, _remaining];
_veh setVelocityTransformation ((_x select [3, 8]) + [_percent]);
if (_remaining < 0) then
{
MovingVehicles deleteAt _forEachIndex;
};
} forEachReversed MovingVehicles;
}]
you can either define that as a function (if you have more than 1 vehicle), or just define _veh, _fromASL, etc. instead of the params line
(e.g. _veh = plane1, _fromASL = getPosASL dummyPos1, _toASL = getPosASL _dummyPos2)
Put a sleep 30; in there, no change.
perfect. tested with small arms and 3 launchers,all restocking upon reload
this select 4 and this select 3
what are they referencing?
Elements of the parameters array, stored in _this, which the EH provides.
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Reloaded
Now I don't get the error message, either but I still get buggy behaviour
oh got it so the event handler is called and internally has "options" represented by numbers
jesus theres so much info here
could spend a lifetime learning everything u can do in this game
No, it gives you an array of information about the specific instance of the event that happened. You use select to get an element from that array, by its (zero-indexed) position in the array. (Or use params to parse out the whole array into named variables, but we only need two of them here so there's no need for that)
zero indexed, yes thats what i meant. i understand the function of it now
pretty cool
Correction: Haven't been getting the error message even in the old, no-sleep, version of the script
Maybe that one error message was just a freak occurence of bad timing and the bugs I'm seeing are unrelated? :(
systemchat uivar
bis_fnc_param_meta
if its not defined preprocesor of it didnt run
uinamespace getvar blah blah blah
Are there any useful event handlers that help with performance? for example on killed event handler could add a way to delete the body and inventory item(clean up). are there any interesting event handlers that can reduce cpu usage in heavy firefights by perhaps reducing the load of what AI are doing? (IE...Dumbing them down to a degree as the way arma2 AI leader brain was only one really active,to gleam some fps)
quite curious to experiment.
so, 1st iteration of protection documentation https://community.bistudio.com/wiki/Arma_3_Soldier_Protection
Well, it's there. However I only got this bis_fnc_param error once, thinking it's not related to that.
{["A3\functions_f\Debug\fn_param.sqf",".sqf",1,false,false,false,"HSim","Debug","param"]} smt like that right?
yeah, exactly
wierd then
http://pastebin.com/UULZSxkT Ignore everything except the last 10 lines, most of it is just a long list of classnames
use configs god deam it!
As opposed to classnames? Tell that to BIS, my xla_fnc_arsenal is still 90% vanilla bis_fnc_arsenal, including the treatment of everything as a classname
But yeah, I'm looking at the "virtual cargo" (variables in the namespace of the box) and for some reason e.g. the backpacks are there, so is the "%ALL" for items but for some reason the "%ALL" for weapons isn't there.
Which is very weird since that's between the two other calls and the XLA_fnc_addVirtualWeaponCargo function works on the server.
Hi guys, very new to scripting but learning slowly. I made a mission last week for my milsim unit and I tested it out on SP and MP side but on dedicated server was a no-go. Now I have 2 questions.. 1. If I ran the OnActivation on a trigger with a remoteExec would it have worked and 2. I'm trying to understand the code but I'm having a hard ttime understand the wiki and youtube videos. Would I make this code into a remoteExec format?
["towerObjective_1","SUCCEEDED"] call BIS_fnc_taskSetState;
That function has global args and effect, so no, you don't remoteExec it
So I;m using https://community.bistudio.com/wiki/getFriend
This works: Side _westguy getFriend side _eastguy
This does not: Side _westguy getFriend side _guerguy
assuming _westguy etc are properly defined and right unit & side
you should paste the code here. there's no way to tell what's wrong with it and if it needs remoteExec
This does: `Side _westguy getFriend resistance
anybody here has a clue as to why all of the sudden I cant lock any aircraft with my aa launcher anymore (modded and vanilla, no difference)?
The mission got a couple of respawn and ticket system related scripts added (not mine unfortunately, so I cant exactly tell what they contain), and I was wondering if it is even possible to influence such a game mechanic (locking to vehicles) just through mission scripting?
Have you checked your keybinds to make sure your lock-on key is still the same?
yes
Also, keep in mind that most light anti-aircraft missiles are IR-guided, so they can only lock on to aircraft that are hot (engine on). If you're trying it on parked aircraft, that'd be why.
we are currently testing with a group of people. In the old version of the mission everything works fine (same players, same keybinds, same helicopters flying at different heights/speeds/distances), in the new version when you hit the lock button (for me its tab), I get the diamond shape but with a dotted line, but only for a split second. after that it disappeares
What about using parantheses?
side _guerguy returns GUER
As far as I know, it's not possible to force break lock by scripting. (You can break the missile's lock, but that's after launch.)
Are the other people also experiencing this if they try to lock? What happens if you try it in a blank mission? Have you tested the old version of the mission now?
side _westguy getFriend side _guerguy looks like it might throw off the parser
A keyDown UI event handler could prevent the lock key from working at all, but if that was the issue then the lock wouldn't even begin
If you're already doing (side _westguy) getFriend (side _guerguy) then nevermind
let me try that, ty
hey does anyone know if theres a script/line that i can set a AI to be captured on their knees? like hands behind their back unable to move
(side player) = WEST
(side guy2) = CIV
WEST getFriend civilian = 1
(side guy2) getFriend (side player) = 0
makes eno sense
Is there a way to detect locally when the player is leaving the server or ending the mission in solo ? If i use onPlayerDisconnected on the server and remoteExec something on the player's machine, will it be executed ?
it has been resolved. I dont know what exactly caused it and I dont know how it got fixed, but it seems cursed af 😅
why does the civ hate blufor and opfor, but not if I directly ask for it?
OK. WOW. This is getting weird. I took my script, reg-exp'ed the comments away and dumped it in the debug console. (createvehicle'd a testbox, _this = TESTBOX; [copy-paste-of-script]). Execute on Server and ..boooom...working, everything there.
So the exact same code fails in some weird way when execVM'd in an init field (even with sleep 30;) but works from the debug console???
Hello everyone,
I am new to scripting, and I would like to seek some help from some experts.
I was trying to put together a custom composition where i would attach various objects to a vehicle. I am so far stuck trying to attach objects to the tank turret, because I cannot seem to attach it in a way that it would always face the turret's orientation.
Any help would be greatly appreciated, please ping.
- I could not make sense of the functions 😦
use the followBone parameter of attachTo
Interesting, could you please explain?
I did not come across it in any documentation..
check out the wiki page again
object1 attachTo [object2, offset, memPoint, followBoneRotation]
So if i put true for the followBone rotation, and put i think it was OsaHlavne for mempoint, it should work?
yeah if the mem point is correct it should work
Thank you very much man, I was stuck there for much longer than i would like to admit..
not sure but does this work?
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#Ended
_unit setCaptive true;
_unit switchAction "surrender";
_unit playActionNow "surrender";
once update 2.18 of the game is released you can do this to make it smoother:
_unit setCaptive true;
_unit switchMove ["amovpercmstpssurwnondnon", 0, 0, false];
map placed triggers dont detect respawned players?
BLUFOR present
ok, restarted the mission now everything is magically fixed. wonderful arma
does anyone here know how to make a vehichle despawn script to help server preformance
not blown up vehichles but vhics that are simply spawned in and left there
do you want them to all despawn in a wave? every 15 min or so?
every 15 min
@fair drum
well to be honest every 30 seconds to 1 minute as the server I was working on is pretty fast paced and was try to save on preformance.
[] spawn {
private _cycleTime = 30;
while {sleep _cycleTime; true} do {
private _entities = entities [["LandVehicle", "Air"], []];
_entities apply {
if (!alive _x || count crew _x == 0) then {
deleteVehicle _x;
};
};
};
};
@fair drum
would i add it to my current script like this?
if (Old_Vehicle_Spawned isNotEqualTo "") then {
deleteVehicle Old_Vehicle_Spawned;
};
Old_Vehicle_Spawned = _veh;
closeDialog 18002;
call Vortex_fnc_smoke;
// Adding the new script here
[] spawn {
private _cycleTime = 30;
while {sleep _cycleTime; true} do {
private _entities = entities [["LandVehicle", "Air"], []];
_entities apply {
if (!alive _x || count crew _x == 0) then {
deleteVehicle _x;
};
};
};
};
I have no idea as I don't know what the context is. What i sent is a generic, run from start of game init type thing
so this is how what i have in my script rn
did i add this correctly?
https://gyazo.com/46cdce80939548b50b90d4769419ce30
I'm assuming you are calling vehiceSpawn multiple times for each vehicle. Then that would be a no, you don't put that there as it would keep stacking more instances of it as people keep spawning vehicles
what i wrote goes into initserver.sqf
hey need some help using ACE check pbo function, im giving it a list n shit and putting it in the init.sqf file for my mission but its not kicking me when i load in with mods that are not whitelisted...
[2, true, 'insert list of mods in this format: ["classname","classname","classname","classname","classname","classname","classname"]'] call ace_common_fnc_checkPBOs;
umm... did you add your addon classes to it? or is that what you actually put in?
use pastebin. can't see if there's an error somewhere without seeing what you put in
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
used this page as reference https://ace3.acemod.org/wiki/framework/checkpbos-framework
im tryna make a whitelist of mods
nvm it works when on a dedicated server
but anyone got any suggestions on how to make a whitelist of mods and kick players that have mods not in that list
just use the launcher export import function and set your server to verifysignatures
you share the exported .html file and they can load it
Put the mods that are required on. Then put all the keys of the mods you want whitelisted in the keys folder on the server.
What server utility are you using
faster
faster does this really well. you should export 2 modlists. a client one, and a whitelisted one.
you then load the whitelist one, copy keys, then load client one
so now your server only loads client, but has the keys for the whitelisted ones
alright, ill experiment with it, thx!
So here's the situation. I have my taskCreate listed in initServer.sqf, and I have an object placed in the world with a hold action to "Reconfigure tower". That will trigger, wait a couple of minutes and then should activate the taskSetState to succeed.
Function in initServer.sqf = [west, "mainObjectives", ["These are the main objectives of the missions.", "Main Objectives", ""], objNull, "CREATED", 1, true] call BIS_fnc_taskCreate;
See attached the placed object's Hold Action params and trigger params.
Everything related to the task system can be server side. Your issue at least with this post is that you are using two different task strings:
mainObjectives in initServer.sqf
towerObjective_1 in trigger
They both need to be the same.
if you are doing a stacked task system, make sure your parent and child strings are appropriate as well
Sorry, I've just woken up.. I missed a partt. This is the whole initServer.sqf
//Starting Objectives [west, "mainObjectives", ["These are the main objectives of the missions.", "Main Objectives", ""], objNull, "CREATED", 1, true] call BIS_fnc_taskCreate; [west, ["towerObjective_1", "mainObjectives"], ["Reconfigure the radio tower by flipping the switch on top of the tower. Defend the tower while it's being reconfigured.", "Reconfigure radio tower #1", ""], objNull, "CREATED", 3, true, "search"] call BIS_fnc_taskCreate; [west, ["towerObjective_2", "mainObjectives"], ["Reconfigure the radio tower by flipping the switch on top of the tower. Defend the tower while it's being reconfigured.", "Reconfigure radio tower #1", ""], objNull, "CREATED", 3, true, "search"] call BIS_fnc_taskCreate; [west, ["towerObjective_3", "mainObjectives"], ["Reconfigure the radio tower by flipping the switch on top of the tower. Defend the tower while it's being reconfigured.", "Reconfigure radio tower #1", ""], objNull, "CREATED", 3, true, "search"] call BIS_fnc_taskCreate;
It's only been an issue on dedicated server, that's why I'm confused
ah ok. so the thing with the hold action add, when you are setting reconfigure1 to true, that is a global variable, but it is not a public variable. The server doesn't know it exists yet
the hold actions are local to the client machine
as well as their completions
Is the hold action never able to be public? Or are there ways?
so you actually need:
reconfigure1 = true;
publicVariable "reconfigure1";
or
missionNamespace setVariable ["reconfigure1", true, true];
basically the client needs to say, hey, this variable right here? i need it to be the same on all of your machines too (including server)
Ah alrightt, this is what I figured wasn't happened with the setTaskState, but I was looking at the wrong area. Are every BIS Functions always public?
global variable means only global to your book. my book can have the same global variable and it be different. public variable syncs global variables across every player's book.
Any function/command can be global or local or server (not public, public is for variable namespaces - not related)
Being new is hard :p But I'm beginning to understand. If I only make MP missions, I would assume I need to have a pretty good understanding of the publicVariable and remoteExec ?
yes, and when you get more advanced, CBA events.
to do your debugging and testing, turn off battleeye and you can start multiple copies of the game that can join each other.
Good advice, thanks.
I'm gonna go test out the solution you posted and start looking up more documentation on this. Thanks.
I didn't think it would be effective but Ended and MPEnded work, thanks
Is there a way to tell an AI jet pilot to move from point A to point B without taking off ?
I'dd like AI jets to be able to move on the taxiway to park themselves
I would be very surprised if Arma AI had that feature.
You'd probably need to move the planes with setVelocityTransformation.
You could try limiting their speed and maybe disabling their FSM. Good odds they try to take off anyway even though they can't achieve takeoff speed though.
Am I dreaming or was there a command that allows 2 objects to clip into each other without interacting/damaging each other (but still with simulation and damage turned on)
hmmm i guess i have no choice
disableCollisionWith
That's the one! Thank you very much
You can also attach one to the other.
Yeah I've got the fuel trailers from JBAD that I wanted to make look like they're hooked up to a Ural but without all the clipping explosions 😂
Welp that's not going to work this command does not disable collision between PhysX objects which the truck is I assume, oh well I can disable sim and use an EH instead to detect when the players blow it up
i got an issue, some of my mods are unsigned so i cant use this method i dont think, is there another way? i really wanna try to get the ace checkPBO to work but im habing trouble.
I don't know many that use it. Might want to ask on the ACE discord
bump, knowsAbout = 4, unit has enemy target assigned but keeps weapon in lowered state
@queen cargo What's so horrible about execVM? I mean we're talking about a one-time "go and set a few variables on this box" kind of script
so what?
where is the problem to properly do it then?
even if it is executed just once?
especially because it is executed "just once" for EVERY ammo box you use the script with
which can make up to X executions
where every time the script is reinterpreted
wasting time
and ressources
especially because it is async
which is not needed
What's the alternative?
call compile preprocessFileLineNumbers "your/file/..."
indeed, this still does the same like execVM
thus better using CfgFunctions and then just calling the function via its variable
Yeah, but that won't help me for multiple ammoboxes, right? (Remeber, this needs to be called from the init field of an ammobox so that mission designers can just copy&paste something into an init field without understanding what's going on)
why shouldnt it?
Because it'd still do a compilation for each ammobox, right?
I agree with the idea of CfgFunctions but ease-of-use won out over init performance ;)
even then
call compile preprocessFileLineNumbers is the way to go
execVM is just bad habbit
no "ease of use"
There is, it's much more portable since no description.ext setup for CfgFunctions are needed
ehh ... how is it more portable?!
I only need to drop a single file into my mission folder and then I can start copy&pasting that init line all over the place
hell you even could just say "put this in your init.sqf" which will then execute a function which compiles the functions for you ...
horrible
you have to add something else to your description.ext
something you do once
to make it proper
instead of the dirty way
code proper
TBH, call compile preprocessFileLineNumbers cuts down mission launch time, and in script heavy missions, cuts a lot of lag. It's well worth doing.
or stop it right now
This may be the first time I'm happy to agree with what X39 is saying.
so "call compile ppFLN" beats execVM? That's not exactly intuitive but nice to know
What about ArmA is intuitive?
-.-
call compileFinal is just the common way to say it
playing != coding @gleaming rivet
Very true, very true.
I do it as a daily part of my job as well ^^
I use CfgFunction for my own missions, but for this I'll stick with "drop in script, add line to init" because that's just way easier for people that have no clue what they're doing - which is the vast majority of people that end up using my mod.
Like, HAVING a description.ext is a challenge for some people xD
"and put this here in your description.ext"
can i somehow prioritize an if statement over another one if both are true?
example:
if (a == true) then {//some code};
if (b == true) then {//some code};
adding an line in init.sqf vs. adding and #include in description.ext? where is there difference in portability?
what's a description.ext
@deft zealot since I'm being super dirty (see above), I don't even need a line in init.sqf because then I'd get "what's an init.sqf?" xD
I guess we can hope that Eden will make the integration between "mission making" in the editor and scripting a bit nicer
init.sqf... you're all jsut making shit up
in it.sqf
what is IT
and why is it in a .sqf
if (a && b) then {
// code that you want to run if both are true
};
``` if I understood you correctly?
meaning?
wait, cfgFunctions results in faster functions, or just more organised/"proper"?
exitWith
Correct me if Im wrong, if you want X to only happen if a & b are true then shouldnt you use an exitWith to prevent the code from doing X and then Y and Z?
both statements have different code but both can be true at the same time and im asking if i can prioritize one over another if both are true XD
if ( a && b ) exitWith {
// Code for both
};
if (a) then {};
if (b) then {};
``` If A and B is true it will exit the scope and such prevents the other 2 if statements from running
Really wish there was a way to ensure no line break between image and text
<t nolb=1><img image="somepicture.paa"/> Text</t> Something like that
@candid sun I think technically CfgFunctions is a tiny bit slower than managing handles to compiledFinal'd code yourself. But still beats re-compiling it on every use by a million miles
what's the actual benefit of putting all your functions in cfgFunctions?
Oh, yeah, good point. CfgFunctions are the only way afaik to get compilation/execution in BEFORE init fields
Let's be honest. If you're building quality missions in arma 3, then you should know what init.sqf and description.ext is.
That's like not knowing what mission.sqm is.
you can used some more options like requiredAddons and much more in cfgFunctions
If it's a real problem, them give them a pre-build example file that's commented on.
That's literally how I do it for my community. On my github, I have a bunch of pre-made mission templates, which all have description.exts and init.sqf examples setup on them, ready to download and start building ontop of.
... if its a real problem tell em to educate
if its your community its on you to educate them
Nah, god no, not my community xD These are more the kind of questions I get via bi forum PM's ^^
respond then "educate yourself" or send them the wiki entry ...
There's lots of meeshun frameworks out there that are basically "drop units, press play"
Seriously, link them to Xenophon's framework, send them to the BIS wiki, or send them to a tutorial and tell them to learn that stuff.
So the image and the text are inline
Yeah
If you are using your own UI you could have them as separate things
Aka image on the left text on the right
I'm talking about inline within structured text control
Yeah unfortunately not possible
That's why I say I wish there was a way for it, have a property that stops line breaks
@sullen marsh Yeah, I think a lot of people start out by learning "2D editor only", i.e. plonk down units, sync triggers and waypoints, etc. Maybe use a framework that works with markers... Those that stick around to learn about scripting are probably the exception, but of course all the other ones never end up making missions for the kind of private MP sessions most of us probably play xD
Btw, talking about CfgFunctions - is that the only way to get preInit execution/compilation?
@rich bramble just send them this link http://lmgtfy.com/?q=description.ext+arma
^ :P
alternative link:
http://www.giyf.com/
so use CfgFunctions
do it proper
and stop using execVM
Just to confirm; execvm is still basically a shorthand for spawn compile preprocessfile, right?
@gray bramble IIRC execVM sets up a new scope, spawn doesn't? but not sure right now
spawn also creates a new scope
more or less @gray bramble ... quite sure there are weirdo differences in em
Not totally sure about preprocessfile rather than loadfile, either, actually.
I've been scripting most of today .. and have some nice script that I'm testing out. But a question.. if I put the scripts into a .sqf and load them in the init file with execVM "myScriptName.sqf"; would that make sure it's ran on server and all clients? Aka doing it's job properly on a dedicated server?
ARRRGGGHGHHHHH
Once more here looking for help on this;
Looking to disable stamina/fatigue for a certain group of players in a mission.
Last time i asked here got the suggestion of using steamids for them, but that is out the window cause i cant know the players beforehand. Also them execing any scripts themselves is not an option.
At this point not sure if this is possible, and i should just take the loss or is there a some convoluted way of doing this.
Does that group have a variable name?
It compiles but there are red wavvy lines! INFURIATING!
Unfortunately no
Is there a way to reposition the static ships easily with script?
blueship1 setpos [(getpos bouy select 0)-20,(getpos bouy select 1)-20,(getpos bouy select 2)];
doesn't work...
Trying to thing- How might I get/set magazines for a vehicle?
Idea is function I can call. Give the function objNull, an object, or array of objects, then somehow it knows to set magazines of the objects from the 2nd param, use what's on the clipboard, or copy the first object's magazines to clipboard. But not sure how to do that.
Maybe 2nd params could be a bool, then a 3rd param is an array? 2nd is true, it copies to clipboard. Otherwise, it will check if an array is provided in 3rd. Yes, use that. No, try clipboard.
static ships as in destroyer/aircraft carrier or?
yes. The destroyer in this case
BIS_fnc_Destroyer01PosUpdate maybe this?
oh- huh- idk
well, looking at the function, maybe could use what's inside?
Idk if this can be used directly, or if it's just meant for behind the scenes.
setVehiclePosition is a dead end too
Oh well, it's b/c the object you see is an invisibile helper objects
object ya can move**
The stuff ya see are not visible to eden/zeus
ofc.... why would it be easy.... -.-
Well, there's a- 50m? limit to object size
So, to get bigger objects, ya need to cheat a bit. Thus, this function, ya call it on the helper object. (Which- it LOOKS like it should work? but idk?) then it gets the objects that are associated with the ship, and moves them all accordingly.
this and BIS_fnc_Carrier01PosUpdate
Easier to rethink the approach with a supplyship to an airdrop.. :/
Red wavy lines, the best kind.
Still better than a massive red block of text in VS
Ah ye
I mean, ya could do it.
If I'm correct, depending on if its modded, and depending on if it's the destroyer or the carrier, ya should be able to call the function and give it the object ya can edit and the new position?
I'm not smart enough to do that tho
wait no- confusion-
OH
ok, so the function is just to update the position
So you'd just call the function on the destroyer, giving the object ya were already using.
_this call BIS_fnc_Carrier01PosUpdate for the carrier. give it the object (_this) then use call to send the object to the function BIS_fnc_Carrier01PosUpdate
(Destroyer is the same, just with destroyer instead of carrier)
if ya wanna get rid of it- that might be more complicated, idk xP
By the way, one question remains. How do i detect locally when the player leave the server, for exemple, when the server restarts ? When the server restarts, it doesn't throw everyone to the debriefing screen so the Ended event won't fire
There's other ways too
is there a way to increase the volume of a tune from the game. i have it to start playing in a trigger
Is there a script to add countermeasures to an aircraft ?
you could add ammunition to the flare launcher
How do i do that ?
Yo
yo
I didn't check on all planes but, for a F 18 Black Wasp for example, the flare launcher is called "CMFlareLauncher_Singles", its magazine name is "240Rnd_CMFlare_Chaff_Magazine" and to add amunitions to it, you need to add amunition to the driver turret:
vehicle player addMagazineTurret ["240Rnd_CMFlare_Chaff_Magazine", [-1]];
Thank you
one way is probably detecting when display#46 is destroyed 
what kind of tune?
just one of the in game ones. but i got it sorted, thanks xox
Question: what are the hints called that show up along the right hand edge of the screen? Not looking for BIS_fnc_advHint but the smaller 1x1 squares that show up.
What exactly do you mean by smaller 1x1 squares, and what is your thing you look for
The very small squares that show up on the right side of the screen when you can use the communication menu to show a hint, I should have said 1:1 boxes instead.
I'm almost starting to doubt if those are actually real or if I just dreamt about them...
I think I don't really know what you say, or ever seen by myself. Do you have a ref pic?
I'll try and find a picture.
It appears that I have got something wrong, I think what I am referring to are the supports icons on the left hand side of the screen.
One sec let me boot up and check
Yeah those, I have no idea where I got the idea that they were on the right
I think cTab has a "unread message" notification on the right so that might be why.
Guys is the SAD WP different compared to whats written in the wiki? as it states:
"It does not matter if this waypoint type is placed spatially or on an object. If attached to an object, the waypoint will remain fixed at the objects initial position as displayed in the mission editor (even if that object actually starts the mission in the cargo of another vehicle or has its position changed by its initialization string). Behaviour is the same for both situations - the group will move to the waypoint, then the leader will move about to search the immediate area with his group trying to keep up. The exact size of the area searched is limited to the leader's expected travel time. A leader on foot will rarely search more than 50m from the waypoint, while a leader in a helicopter will search up to 300m from the waypoint. The search will attempt to visually check all locations within the search range, so a search inside a city will take far longer than a search in an empty field. Unfortunately, the Seek & Destroy waypoint does not appear to make the group deliberately search inside buildings although their pathfinding may lead them to enter some. Whether or not the group finds any enemy units appears to have no impact on the search duration or range.
To make AI hunt down a known target, you need to setCombatMode to "RED". The Seek & Destroy waypoint only makes the AI search the vicinity of the waypoint itself, not affect their behavior on their way to the waypoint."
However, upon a SAD WP my units actually paused all wp's until the threat that was known about was destroyed
it seems the AI use this wp as it is intended finally?
and you dont need to use "set combat mode RED" for better effect?
I got a version working. Use the debug console to open the code, then run it. Maybe I could try making a module or context menu option for it?
can you print numbers larger than one million without it being format to something like 1e+006 ?
toFixed
nice thx 👍
Hi
Why i can't have the "N key effect" on my object when i put this
visionMode[] = { 'Normal', 'Normal' };
I want to have the effect like a nvg when we presse N without the screen effect of a Night Vision and whitout code that lma
Who can do that ?
Is it possible to spawn a rifle/gun without unit/ai/agent or sth and have it fire?
how could I improve this code ?
getting list of roads that are not in markers
private _markers = ["marker_1", "marker_2"];
private _all = [worldSize / 2, worldSize / 2] nearRoads ( sqrt 2 * ( worldSize / 2 ) );
private _roads = _all select { private _road = _x; _markers findIf { _road inArea _x } isEqualTo -1 };
use count ?
private _markers = ["marker_1", "marker_2"];
private _roads_all = [worldSize / 2, worldSize / 2] nearRoads ( sqrt 2 * ( worldSize / 2 ) );
private _roads_in = _markers apply {_roads_all inAreaArray _x};
private _roads_out = _roads_all - (_roads_in arrayIntersect _roads_in);
another point of optimization could be using allObjects instead of nearRoads but I'm not sure if its possible, didn't try
You can test the performance of different ways using BIS_fnc_codePerformance, so you can easily test tons of different ways to find the fastest one
What's the best way to check for players in a certian radius of an object?
The best depends on what you have, number of players, number of objects, how big is the radius
for small radiuses nearEntities Man isPlayer could be faster, for some allPlayers inAreaArray
I was thinking 200 meters, I just just need a boolean to see if they're there. Couldn't figure out how to use nearestObjects for it lol. Didn't see nearEntities 🤦♂️
ty
if your mission has few players, allPlayers inAreaArray could be better choice
It could be up to 40ish
what language of code is used for arma 3
SQF
Question, long story short when I delete a certain modded object there is a light left behind. Is there a way for me delete any light sources within lets say 10m radius?
I am not sure how to go about it if I do not know its name
Hi -
I'm using a server command to kick a player via script, but it doesn't let them join back until restart.
Is it possible to allow them to join back?
Adding to that, is it possible to include a kick reason within the "You have been kicked from the game" dialog?
how do i spawn a custom composition with scripts
or force ai to get into the nearest vehicle or smth
im spawning an lc with an infantry squad on top of it but they only get flung
Hi guys, is there any way to remove the functionality of repair trucks, ie they cannot be used for repair?
Server Config:
// kickID (type to determine from where the kick originated e.g. admin or votekick etc.)
// 0 - manual kick (vote kick, admin kick, bruteforce detection etc.)
// 1 - connectivity kick (ping, timeout, packetloss, desync)
// 2 - BattlEye kick
// 3 - harmless kick (wrong addons, steam timeout or checks, signatures, content etc.)
// timeout = in seconds how long until kicked player can return
// >0 seconds
// -1 until missionEnd
// -2 until serverRestart
kickTimeout[] = { {kickID, timeout}, ... };
Sorry I meant to say via sqf in game, its actually something you posted (which I thank you so much for doin)
You can't let people in if they're being blocked by the server config timeout rules. The server's authority is absolute on that.
This method saved me, couldnt understand how to use the servercommand to kick
["myPassword", format ["#kick %1", name player]] remoteExec ["serverCommand", 2];```
I just didnt know if I could edit the dialog that pops up when they leave
Yeah, so that script doesn't control when players are allowed to reconnect after being kicked. It just uses the kick command, same as if an admin had manually kicked them, and then the timeout is controlled by the server config settings.
Okay makes sense this is what I figured. I have RCON etc, so I just wasnt sure if the "reason" could be automated via sqf
I'm not sure what kickTimeout[] defaults to if it is not defined in the config (currently unknown on wiki - should report back so I can add it).
I believe ive never set a kick timeout actually i'll check this out
Wowie
Nice...
I had it set to default.. {0, -1}
https://community.bistudio.com/wiki/Multiplayer_Server_Commands
The #kick command doesn't provide any means of sending a message with the kick. If you're using the script you linked, you can change what message it sends in the hint (top right in-game message) before executing the kick, but any popup that happens on their end is not controllable.
1.) Place vehicle and give it a variable name - ie. myVehicleVariable
2.) Place group of units
3.) Open group's attributes (group flag click)
4.) Insert:
if (isServer) then {
this spawn {
waitUntil {
!isNull myVehicleVariable &&
alive myVehicleVariable
};
units _this apply {
_x moveInAny myVehicleVariable;
};
};
};
5.) Test and save composition
Yes in my script I have some dialogs like warnings etc and it counts down from 240 sec
It makes sense now why it wouldnt join until restart
I'd suggest making the systemChat warnings a little less frequent, that looks like it's happening on each frame or something which is...excessive
Its heavy WIP itll be set to each second for sure
Somone is helping me make an event handler, so now its on each frame just while i learn it since I kept using old school loops and stuff
if (isServer) then {
private _repairSupport = getRepairCargo this;
if (_repairSupport == -1) exitWith {
diag_log format["%1 does not support getRepairCargo", typeOf this];
};
this setRepairCargo 0;
};
How can I make the AI inside a plane fly that plane, in a straight line, forever? No matter what combination of flyInHeight, flyInHeightASL, disableAI I use, he keeps turning around into a circle. I'm not using a waypoint because I don't want him to reach the waypoint and stop. I want him to just fly forward at a height, forever, because it's an infinite map
while {alive _plane} do {
private _position = _plane getRelPos [5000,0];
driver _plane move _position;
sleep 15;
};```
Be aware that maps in Arma cannot truly be infinite, because world coordinates start to lose precision over a certain distance from [0,0,0], which leads to weird behaviour.
Hi everyone, below is a script I’ve copied and pasted and have been trying to tweak in order to get the weather to change more frequently and in shorter time periods. If anyone can look over this and let me know how to change this to faster weather transitions that would be appreciated:
if (!isServer) exitWith {};
_setRandom = [0,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1.0];
// Initial Weather
skipTime -24;
0 setOvercast selectRandom _setRandom; // Initial Weather Set Values: 0 = Sunny, clear skies 1 = Stormy, complete overcast
skipTime 24;
sleep 0.1; // Keep this at or above 0.1, or else simulWeatherSync command will not work properly.
simulWeatherSync; // This command will sync the selected weather pattern to appear as it should right away instead of having to wait.
// Random Weather
while { true } do {
300 setOvercast selectRandom _setRandom; // selectRandom is the new engine solution to BIS_fnc_selectRandom. This will select a random weather pattern from the array in variable _setRandom. Values: 0 = Sunny, clear skies 1 = Stormy, complete overcast.
sleep 0.1;
};
sleep 900; // Rests for 15 minutes real-life time before selecting new weather pattern. For 24 hour day cycles (1 in-game second = 1 real life second) or whichever you prefer, you will want to update this to make sure weather shifts as appropriate.
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
I wonder how far you could go before that precision becomes a problem
I'm being told "unexpected global variable name format" when I give the plane the variable name _plane. Am I meant to do that? Or is _plane referring to something that already exists?
_plane is a placeholder for whatever variable name the plane has.
You can't start a global variable name with _ because _ is the prefix for a local variable.
Oh, my bad. I have put in the actual variable name of the gryph. Then, no matter where I put the script -- in my console, in a trigger, in the gryphon--they all complain about how suspending is not allowed in that context.
Because those are all unscheduled contexts where suspending is not allowed.
https://community.bistudio.com/wiki/Scheduler
0 spawn {
while {alive _plane} do {
private _position = _plane getRelPos [5000,0];
driver _plane move _position;
sleep 15;
};
};```
that seems to work like a charm, thank you
It seems like there's an enforced limit of -50km/+500km from 0
At 200km you have a position jitter of around 1cm
that's not bad for most purposes. You could have full airbattles off map with that
Yeah, you're more likely to notice the jitter on foot.
Is there a way to get how much "load" does an item take in your inventory?
It depends on the type of the item.
For true weapons:
getNumber (configFile >> "CfgWeapons" >> _weaponClass >> "WeaponSlotsInfo" >> "mass");```
For "items" that are actually weapons:
```sqf
getNumber (configFile >> "CfgWeapons" >> _itemClass >> "ItemInfo" >> "mass");```
For things in CfgMagazines:
```sqf
getNumber (configFile >> "CfgMagazines" >> _itemClass >> "mass");```
If you just need to know if it will fit and not necessarily the actual mass, you can use `canAdd` or related commands.
am having issues with drawicon3d, no matter which path i used it says 'cannot load texture' like it cannot find the texture path
i tried all of these
drawIcon3D ["@ace\addons\ace_finger\UI\fp_icon2.paa", ...
drawIcon3D ["\ace_finger\UI\fp_icon2.paa", ...
drawIcon3D ["fp_icon2.paa", ...
Non of them works
Thank you.
Follow up question that just came up, is there a way to check the class and tell which one of the 3 is it?
It's complicated™
There are a couple of ways to approach it. One could be to check with syntax 3 of isKindOf; if it isKindOf cfgWeapons >> "default" and it isKindOf cfgWeapons >> "ItemCore" then it's probably an item. If it isKindOf cfgMagazines >> "CA_Magazine" then it's probably a magazine.
You can also consider the context, if you acquired the class via a source that has a known type then you already know which it'll be (e.g. magazines will always return...magazines)
Alrighty, thanks again :D
You need the full file path.
I'm on my phone but it should be something like...
"\z\ace\addons\finger\ui\fp_icon2.paa"
Thanks! 
its actually "\z\ace\addons\finger\UI\fp_icon2.paa"
i found it in the config file
The isKindOf command in syntax 3 takes 2 paramters after the command, what am I supposed to replace _something with if I set it up correctly?
if (_itemClassName isKindOf [_something, configFile >> "CfgWeapons" >> "default"];
if (_itemClassName isKindOf ["default", configFile >> "cfgWeapons"])```
It's the same as the second syntax, except you have to provide the target top-level config as well as the specific class to check against.
Ah, alrighty, so based on the message I replied to, the result would be:
For an item
if ((_itemClassName isKindOf ["default", configFile >> "CfgWeapons"]) && (_itemClassName isKindOf ["itemCore", configFile >> "CfgWeapons"])) then {/*execute code*/};
for a magazine
if (_itemClassName isKindOf ["CA_Magazine", configFile >> "CfgMagazines"]) then {/*execute code*/};
Oh also, would the magazine one also detect grenades? or other items that are usually added by addMagazine?
You can probably skip checking cfgWeapons default if you want to structure it like that. If it isKindOf cfgweapons itemcore then it must also be iskindof default.
The reason for checking both would be a flowchart structure, e.g.
if (isKindOf <cfgweapons default>) then {
// it's a weapon, let's check what kind
if (isKindOf <cfgweapons itemcore>) then {
// it's an item
} else {
// it's not an item
};
};```
The magazine one will detect basically anything in CfgMagazines. Checking for CA_Magazine is really just checking whether it's in CfgMagazines as opposed to some other top-level config. If you want to be more specific within CfgMagazines, open it up in the config viewer and find some classes that the things you want to identify inherit from.
The reason I only check for CfgMagazines "in general" in this example is because that's the only distinction that's important for finding the inventory mass. There's a difference in the structure of the config lookup you have to do, to get to the mass value. Within CfgMagazines, there are no differences in that structure.
Ah alrighty, so if all I care about is whether it is an item or not this would work instead of having to check for default:
if (_itemClassName isKindOf ["itemCore", configFile >> "CfgWeapons"]) then {/*execute code*/};
Yes.
Note that in theory it is possible that a mod could introduce something that is "an item" but doesn't inherit from itemCore. This should be a reasonable general solution on the assumption that no one would do something that insane, or if you're only working with vanilla stuff, but there might be another way to tell even more reliably. That other way would probably be more complex though, because there are a bunch of different ways that something can be "an item" instead of a weapon.
Hmmmm, I hope none of the mods I use do something insane then >_>
How complex if that can be answered simply?
I don't know myself exactly what you'd have to do to make a watertight check
I think the type config property would be involved, but there are a bunch of different relevant types and it's not well-documented
Okie Dokie, thanks once again for all the help ^_^
is it possible that object's scripts such as the "Land_ClutterCutter_large_F" are run delayed due to lag?
when i see the "water leakness" thing, i didnt expect this lol
anyone know how to delete a lightsource that I can not interact with in zeus?
{deleteVehicle _x} forEach nearestObjects [player, ["all"], 200]
this doesnt work
try without "all" (use []) see notes in https://community.bistudio.com/wiki/nearestObjects
that didnt work
its terrain light?
Are you trying to delete the light or turn the lights off ?
Delete a light source. There are mods with light sources attached to objects. When you delete the object, the light source stays behind on the map.
I am trying to find a way to delete it
it works, but in Eden simulation is disabled
if you want, enable its simulation and delete it so the light disappears
myb like this:
{
if(isClass(configOf _x >> "Reflectors")) then {
deleteVehicle _x;
};
} forEach (getpos player nearObjects 200);
i think they only appear in allmissionobjects iirc
Also yea are they part of terrain or something that you added in eden ?
I am talking about zeus
You missunderstand. It is not my mod. Its a thing that there are some mods that have lights attached to vehicles or aircraft. once it explodes or gets deleted, the lights stay behind in that place in the map
sadly didnt work either
attached objects should be automatically deleted if you delete a vehicle 
if i'm not mistaken
They are not, generally they get deleted, because mod authors remember to put "deleted" eventhandler
sadly it returns []. as in nothing
I dont know if this is possible try to see if this returns anything:
private _lights =
nearestObjects[getpos player,["#lightpoint","#lightreflector"],200];
[621162: <no shape>,621134: <no shape>,621133: <no shape>,621139: <no shape>]
Try to delete them then like so:
private _lights =
nearestObjects[getpos player,["#lightpoint","#lightreflector"],200];
{
deleteVehicle _x;
} foreach _lights;
oh, well that worked
perfection
Thnaks
New to working with the editor so this might be a stupid question.
I have played in a server where each role when using an arsenal is limited to specific items. For example the riflemen only has access to riflemen rifles but a grenadier would only have access to the rifles with grenade launchers. As well as medics only have access to the medical supplies. And everyone uses the same arsenal. Anyone know how I can go about doing this with ace arsenals?
Is there a command to force enable -skipIntro so a mission is always loaded in the main menu?
can someone give me an example of animateSource im still kinda new and dont understand too much about what im supposed to put in there
specifically the object part
i dont know if thats just the name or if i have to label the thing
You'll script it. Before I tell you how, 0-10 how familiar are you with scripting in arma?
So I can tailor the response
0, however I found a mod someone made that will add the script to your arsenal by default so I am using it.
Very well. Let me know if you have more questions.
Hello gent's i am wondering. Would it be possible to make a task which checks if given order was issued to an AI Squad? For example, the player would need first issue the "Advance" order, then "Stay behind" to complete the task?
how to i get to animation sources in CfgVehicles
animation sources is a class inside of a specific vehicle class
how do i find it
place down your vehicle, right click on it, and click find in config/config viewer
example:
im using an lcvp and when the door drops down they are supposed to send out three at a time but its still sending out only one
how do i fix that
Arma AI will naturally dismount one at a time from any vehicle. If you want to force them to exit several at a time, you'll have to move them out with the moveOut command. However, they won't use the dismounting animation and might not appear at the appropriate exit point for their seat.
how
i dont understand anything with all three of those
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
You need to get all the units in the vehicle's cargo (fullCrew). You then need to iterate over all of them (forEach) to move them out of the vehicle (moveOut).
// Retrieve the details of the vehicle's cargo positions
private _cargoDetails = fullCrew [_vehicle, "cargo"];
// The result for each occupied cargo position contains several bits of information, but we only want the unit reference
private _cargoUnits = _cargoDetails apply {_x select 0};
// Now apply the moveOut command to each unit
{
moveOut _x;
} forEach _cargoUnits;```
That will move out _all_ the units at once. Moving them out in groups of 3 is a bit more complex and I don't have time to write it for you right now. Try to read the documentation and figure out how the commands fit together in the example.
earlier on when the door was open 3 left automatically
Maybe that asset has some special scripting or something, I don't know. It's a modded vehicle, almost anything is possible.
the question im trying to ask is why would it function then and not now
It's a modded vehicle and not a vanilla feature, so only someone who knows how that mod works could answer that.
Hello!
Currently running into a problem:
A AI unit won't enter a helicopter that it has been assigned to and ordered to.
I am using following scripts:
init.sqf
pilotInjured disableAI "ANIM";
pilotInjured switchMove "UnconsciousReviveBody_B"; ```
and the script that does the next section
```sqf
[] spawn
{
// UnconsciousOutProne 05.033
pilotInjured switchMove "UnconsciousOutProne";
sleep 5.033;
pilotInjured enableAI "All";
pilotInjured setUnitPos "Middle";
pilotInjured setCombatBehaviour "CARELESS";
pilotInjured assignAsCargoIndex [evacHelicopter, 9];
[pilotInjured] orderGetIn true;
};
In an isolated test case it sometimes works, but not often - not sure what I am doing wrong, the unit just goes to helicopter and than doesn't enter it (even if the assignend slot is still empty)
In the test, does it matter whether you have the unconscious anim stuff or not?
Preprocessor probably hates me.
Imagine something like this
#define ADD_ACTION(var1,var2) [\
_x,\
"CONTAINER",\
LLSTRING(charge_change_##var1),\
nil,\
it continues witho other sutff.
Now, when I call it, for example like this ADD_ACTION(1,TBD_HE_CLASS)
The LLSTRING get's transformed into LLSTRING(charge_change_##1). Which is not correct...
Now you might be thinking... Just remove the ## from it, no?
Well... No, because then it would get transformed into LLSTRING(charge_change_var1).
Any idea what I might be doing wrong? 
My test setup uses the same prerequisites, with the same animation and scripts (just the actual mission stuff is cut out like tasks and the arriving to the location part)
how do i set it so that upon an ais death both their primary and secondary are cleared
i dont want the people who play it taking the guns i want them taking supplies
Tricky at the moment because getCorpseWeaponHolders is dev only.
is there a way to lock the weapons then
You'd need to find all simulated weapon holders in the vicinity and check getCorpse
I don't know what you mean by "lock the weapons"
On death, units have their weapons transferred to weapon holders.
So that they bounce around and waste CPU time :P
whats an easy way to lock the inventories then
Unless you want to stop players accessing inventories entirely then that sounds harder than finding the weapon holders.
whats the easiest way
Probably the method I suggested initially.
Although EntityCreated mission event handler might be better.
Don't need to search then.
Not sure if it fires before or after EntityKilled though.
The easiest way is to grab the weapon holder on death and just delete it. Simple, effective.
i dont know how to do that
If there's a simple method then I don't know it either.
ok so i'm seeing a trend so far. are you wanting to learn to script? or do you want us to write stuff for you. either is okay, just want to know so we don't spend time explaining if you don't want to learn it.
both. if people write it first i can try and understand how that works
i want to learn scripting i dont want to badger everyone all the time
but i know next to nothing
for the stuff thats like _unit is that the varname or classname
or am i just completely wrong
do you know what an argument and a parameter is?
an argument is an expression or value that you feed into something. a parameter takes that value and assigns it to a variable.
for instance:
// These are arguments
// |-----------------------------------------------|
[["apple", "orange", "pear"], ["okra", "potato", "leek"]] call {
// parameters
// |-------------------------|
params ["_fruitsToBuy", "_vegetablesToBuy"];
hint str _fruitsToBuy; // Displays: ["apple", "orange", "pear"];
hint str _vegetablesToBuy; // Displays: ["okra", "potato", "leek"]
};
so now lets look at the entity killed event handler:
addMissionEventHandler ["EntityKilled", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
}];
so this handler is taking arguments from the engine (you can't see it) and assigning them to the variables:
_unit
_killer
_instigator
_useEffects
You can type whatever you want as the name of the variable within params, what matters is the order you do them in will match the order of the inputted arguments
so you could do:
params ["_unitKilled", "_assassin", "_mainassassin", "_useEffects"];
and it would do the same thing, just with different variable names
how would i tie this in with removing the weapons
well you now know what unit was killed, and who killed them using this event handler. you can now get the position of the unit, find nearby groundweaponholders, and delete them.
so would it just be somethin like getPos and then the unit?
That would be the first step:
private _pos = getPosATL _unit;
what would be next?
go to the scripting commands page and ctrl f to find "near" and look through some of the commands
you know we don't need to find an enemy. and an entity is something that can be killed. how would you find out if "GroundWeaponHolder" is an entity or not?
what else can you find on that page
getCorpseWeaponholder
can't use that until version 2.18 (we just released 2.16)
m
but yes, that would make everything easier
how about nearObjects or nearestObject or nearestObjects?
e
thought about those but didnt actually think about them
mb
nearestObjects would look for the specific thing right?
or could i make it
note the warning at the top. that command only picks up entities, you still don't know if its an entity or not. so this is where you need to start testing each of the commands to find the one that suits your needs
alright so nearestObject
ok, so how are you going to impliment that command, so far you have:
addMissionEventHandler ["EntityKilled", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
// get position
private _pos = getPosATL _unit;
// what else
}];
nearestObject[position type]
im not sure what i would put in for position though
if we found the position of the unit would i just put in the unit
hmm
you have it already, its stored in _pos from above
i forgot that event handlers are only in that thing
we are saying: hey, take the return from getPosATL _unit and store it in _pos
I'll give you a freebe on this one. The ground weapon holder class is "GroundWeaponHolder"
alright
so what does nearestObject return when it is done running?
the groundweaponholder
simpler. what TYPE does it return? does it return an object? an array? a number?
object
and what happens if it can't find anything? what does it return
no, it returns an object, its just a null object: objNull
oh
so now you have your command's return, how are you going to store it so you can use that returned object later?
would it be something like GroundWeaponHolder = nearestObject[_pos, GroundWeaponHolder] or along those lines
uhh
should probably name it something unique
_obj = nearestObject[_pos, GroundWeaponHolder]
alright, now does GroundWeaponHolder match what I posted earlier: "GroundWeaponHolder"
yes
no it doesn't. mine is in quotes, making it a STRING type
ah
and if you notice:
so now you have your object. now delete it with deleteVehicle. write everything up and lets see what you have, and then we can go over some limitations to why what you have might work, and sometimes won't work and how to get around it
addMissionEventHandler ["EntityKilled", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
private _pos = getPosATL _unit;
nearestObject[_pos, "GroundWeaponHolder"]
_obj = nearestObject[_pos, "GroundWeaponHolder"]
deleteVehicle _obj;
}];
use this formatting for discord:
uhh
those are tilde keys
o
left of number 1 on top row
line 4 is redundant, and you need ; after every statement, also remember the string thing I talked about
alr
rewrite or fix above
did you try running it? I still see problems. See what error it gives you
alright
you are like 90% there
i tested it in game but the weapons are still there
not sure what i did
i added the semi colons to the end of every line
cept the first one
damn
i read line 5 sorry
weapons are still there tho
yep, keep posting new posts of what you have
addMissionEventHandler ["EntityKilled", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
private _pos = getPosATL _unit;
_obj = nearestObject[_pos, "GroundWeaponHolder"];
deleteVehicle _obj;
}];
still missing multiple ; and line 4 is still redundant (remove it)
do you see that line 4 and line 5 are doing the same thing, except line 5 is the one you want because its storing the variable?
nope, you deleted the wrong one
line 1 is the very top starting with addmissioneventhandler
ok now give it a shot
now onto the debugging part to see if it works, and fix it if/when it doesn't
addMissionEventHandler ["EntityKilled", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
private _pos = getPosATL _unit;
_obj = nearestObject[_pos, "GroundWeaponHolder"];
deleteVehicle _obj;
}];
still right here
but that didnt work this time
ok, so now you have to figure out what is actually happening. we can do this with either systemChat or diag_log (diag_log you need to open the log file)
try logging what _obj actually is being returned as
read the page and tell me:
https://community.bistudio.com/wiki/systemChat
the unit
you need a string. but _obj is an object. so we need to "stringify" the object so that it displays. we can use str for that:
https://community.bistudio.com/wiki/str
o
i know it may seem like im intentionally leading you in circles, but its more showing you the process of figuring it out.
it doesnt seem that way at all
the leading in circles thing
you definitely seem like you want to show me exactly how and why to do this
alr
expects a string not object
yup so now read how you would use str to make a new string that represents the object
addMissionEventHandler ["EntityKilled", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
private _pos = getPosATL _unit;
_obj = nearestObject[_pos, "GroundWeaponHolder"];
systemChat _obj;
deleteVehicle _str;
}];
try chaining commands together:
systemChat str _obj;
<NULL-Object>
so what you can infer from this, is that your event handler is firing, so its not that. its pulling the correct unit as it is registering when the person is killed, so the problem lies somewhere in the nearestObject line.
its returning objNull which if you remember we talked about it returning if it didn't find anything. so either the groundweaponholder doesn't exist at the instance that the person died, or, nearestObject doesn't register that object and you need to try a different command to use
nearObject
addMissionEventHandler ["EntityKilled", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
private _pos = getPosATL _unit;
_obj = _pos nearObjects 10;
systemChat _obj;
deleteVehicle _str;
}];
I'm going to go to bed here as I have some procedures I have to do in the morning, but I'm going to leave you with this problem to stew over, now that you know how to tackle it and figure out what the game is doing as you write your script. Try different commands, try different timings, etc.
